Diff
Modified: trunk/LayoutTests/ChangeLog (261043 => 261044)
--- trunk/LayoutTests/ChangeLog 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/LayoutTests/ChangeLog 2020-05-02 04:57:13 UTC (rev 261044)
@@ -1,3 +1,16 @@
+2020-05-01 Tim Horton <[email protected]>
+
+ Books sometimes ends up with blank pages, especially after adjusting font size
+ https://bugs.webkit.org/show_bug.cgi?id=211265
+ <rdar://problem/59898144>
+
+ Reviewed by Darin Adler.
+
+ * tiled-drawing/tile-coverage-scrolled-view-exposed-rect-expected.txt: Added.
+ * tiled-drawing/tile-coverage-scrolled-view-exposed-rect.html: Added.
+ Add a test ensuring that we create the correct tiles with a
+ scrolled web view that also uses clipsToVisibleRect=YES.
+
2020-05-01 Kenneth Russell <[email protected]>
[WebGL2] Refactor texImage2D and texSubImage2D taking ImageBitmap, ImageData, Image, ArrayBufferView
Added: trunk/LayoutTests/tiled-drawing/tile-coverage-scrolled-view-exposed-rect-expected.txt (0 => 261044)
--- trunk/LayoutTests/tiled-drawing/tile-coverage-scrolled-view-exposed-rect-expected.txt (rev 0)
+++ trunk/LayoutTests/tiled-drawing/tile-coverage-scrolled-view-exposed-rect-expected.txt 2020-05-02 04:57:13 UTC (rev 261044)
@@ -0,0 +1,15 @@
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 785.00 5114.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 785.00 5114.00)
+ (contentsOpaque 1)
+ (tile cache coverage 0, 4608 785 x 506)
+ (tile size 512 x 512)
+ (top left tile 0, 9 tiles grid 2 x 1)
+ (in window 1)
+ )
+ )
+)
+
Added: trunk/LayoutTests/tiled-drawing/tile-coverage-scrolled-view-exposed-rect.html (0 => 261044)
--- trunk/LayoutTests/tiled-drawing/tile-coverage-scrolled-view-exposed-rect.html (rev 0)
+++ trunk/LayoutTests/tiled-drawing/tile-coverage-scrolled-view-exposed-rect.html 2020-05-02 04:57:13 UTC (rev 261044)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+
+ // "Expose" the bottom 200px of the view.
+ if (window.internals)
+ internals.setViewExposedRect(0, 2300, 800, 200);
+
+ testRunner.setViewSize(800, 2500);
+ testRunner.waitUntilDone();
+ }
+
+ function doTest()
+ {
+ window.setTimeout(function() {
+ scrollTo(0, 5000);
+
+ if (window.internals)
+ document.getElementById('layers').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_TILE_CACHES);
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }, 0);
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+<pre id="layers">Layer tree goes here</p>
+<div style='height: 5000px;'></div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (261043 => 261044)
--- trunk/Source/WebCore/ChangeLog 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebCore/ChangeLog 2020-05-02 04:57:13 UTC (rev 261044)
@@ -1,3 +1,16 @@
+2020-05-01 Tim Horton <[email protected]>
+
+ Books sometimes ends up with blank pages, especially after adjusting font size
+ https://bugs.webkit.org/show_bug.cgi?id=211265
+ <rdar://problem/59898144>
+
+ Reviewed by Darin Adler.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::setViewExposedRect):
+ Rename "hasRectChanged" because it only tests if the optional-state of the
+ rect has changed, not the actual value.
+
2020-05-01 Wenson Hsieh <[email protected]>
Text manipulation should observe the value attribute of some input elements
Modified: trunk/Source/WebCore/page/FrameView.cpp (261043 => 261044)
--- trunk/Source/WebCore/page/FrameView.cpp 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebCore/page/FrameView.cpp 2020-05-02 04:57:13 UTC (rev 261044)
@@ -5371,7 +5371,7 @@
LOG_WITH_STREAM(Scrolling, stream << "FrameView " << this << " setViewExposedRect " << (viewExposedRect ? viewExposedRect.value() : FloatRect()));
- bool hasRectChanged = !m_viewExposedRect == !viewExposedRect;
+ bool hasRectExistenceChanged = !m_viewExposedRect == !viewExposedRect;
m_viewExposedRect = viewExposedRect;
// FIXME: We should support clipping to the exposed rect for subframes as well.
@@ -5379,7 +5379,7 @@
return;
if (TiledBacking* tiledBacking = this->tiledBacking()) {
- if (hasRectChanged)
+ if (hasRectExistenceChanged)
updateTiledBackingAdaptiveSizing();
adjustTiledBackingCoverage();
tiledBacking->setTiledScrollingIndicatorPosition(m_viewExposedRect ? m_viewExposedRect.value().location() : FloatPoint());
Modified: trunk/Source/WebCore/page/TextIndicator.cpp (261043 => 261044)
--- trunk/Source/WebCore/page/TextIndicator.cpp 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebCore/page/TextIndicator.cpp 2020-05-02 04:57:13 UTC (rev 261044)
@@ -335,7 +335,7 @@
contentsClipRect = enclosingIntRect(frameView->exposedContentRect());
#else
if (auto viewExposedRect = frameView->viewExposedRect())
- contentsClipRect = frameView->viewToContents(enclosingIntRect(*viewExposedRect));
+ contentsClipRect = enclosingIntRect(*viewExposedRect);
else
contentsClipRect = frameView->visibleContentRect();
#endif
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (261043 => 261044)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2020-05-02 04:57:13 UTC (rev 261044)
@@ -514,8 +514,8 @@
// Having a m_scrolledContentsLayer indicates that we're doing scrolling via GraphicsLayers.
FloatRect visibleRect = m_scrolledContentsLayer ? FloatRect({ }, frameView.sizeForVisibleContent()) : frameView.visibleContentRect();
- if (frameView.viewExposedRect())
- visibleRect.intersect(frameView.viewExposedRect().value());
+ if (auto exposedRect = frameView.viewExposedRect())
+ visibleRect.intersect(*exposedRect);
return visibleRect;
#endif
Modified: trunk/Source/WebKit/ChangeLog (261043 => 261044)
--- trunk/Source/WebKit/ChangeLog 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebKit/ChangeLog 2020-05-02 04:57:13 UTC (rev 261044)
@@ -1,3 +1,85 @@
+2020-05-01 Tim Horton <[email protected]>
+
+ Books sometimes ends up with blank pages, especially after adjusting font size
+ https://bugs.webkit.org/show_bug.cgi?id=211265
+ <rdar://problem/59898144>
+
+ Reviewed by Darin Adler.
+
+ A few problems:
+
+ - There is short time during page creation where a WKWebView created
+ with _clipsToVisibleRect=YES would not yet have sent its viewExposedRect
+ to the Web Content process, and if we end up constructing tiles during
+ that time, we can make way too many, bogging down the process (or crashing).
+
+ Fix this by always keeping track of the viewExposedRect (on WebPageProxy,
+ instead of the somewhat-more-transient DrawingAreaProxy) and sending it
+ to the Web Content process in the WebPage creation parameters, to entirely
+ remove this window.
+
+ - Even when the viewExposedRect successfully gets to the Web Content
+ process, it can still end up wildly wrong: the DrawingArea was tasked with
+ watching scrolling changes, applying the scroll offset to the viewExposedRect,
+ and pushing it to FrameView in content coordinates.
+
+ It turns out that this was all unnecessary, as we need viewExposedRect
+ in root view coordinates (same space as visibleContentRect, which we
+ intersect it with), and we just didn't notice because all clients of
+ _clipsToVisibleRect: expand the view to its layout size and insert
+ a scrolling view outside the web view, and so don't use our scrolling.
+
+ Avoid this conversion and complexity entirely; I tested Mail and Books
+ where there is no impact (other than fixing the original bug), and also
+ a custom test app with a scrollable WKWebView inside a NSScrollView,
+ which improved significantly.
+
+ * Shared/WebPageCreationParameters.cpp:
+ (WebKit::WebPageCreationParameters::encode const):
+ (WebKit::WebPageCreationParameters::decode):
+ * Shared/WebPageCreationParameters.h:
+ Plumb view exposed rect via WebPage creation parameters.
+
+ * UIProcess/Cocoa/WebViewImpl.mm:
+ (WebKit::WebViewImpl::updateViewExposedRect):
+ Send viewExposedRect changes to WebPageProxy instead of DrawingAreaProxy.
+
+ * UIProcess/DrawingAreaProxy.cpp:
+ (WebKit::DrawingAreaProxy::didChangeViewExposedRect):
+ (WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired):
+ (WebKit::DrawingAreaProxy::setViewExposedRect): Deleted.
+ * UIProcess/DrawingAreaProxy.h:
+ (WebKit::DrawingAreaProxy::viewExposedRect const): Deleted.
+ * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
+ * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
+ (WebKit::RemoteLayerTreeDrawingAreaProxy::didChangeViewExposedRect):
+ (WebKit::RemoteLayerTreeDrawingAreaProxy::indicatorLocation const):
+ (WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator):
+ (WebKit::RemoteLayerTreeDrawingAreaProxy::setViewExposedRect): Deleted.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::setViewExposedRect):
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::viewExposedRect const):
+ Maintain viewExposedRect on WebPageProxy instead of DrawingAreaProxy,
+ so that we can always store it even if we don't have a DrawingAreaProxy yet
+ (or change DrawingAreaProxies) and can send it in WebPage creation parameters.
+
+ * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
+ * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
+ (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
+ (WebKit::RemoteLayerTreeDrawingArea::setViewExposedRect):
+ (WebKit::RemoteLayerTreeDrawingArea::updateRendering):
+ (WebKit::RemoteLayerTreeDrawingArea::updateScrolledExposedRect): Deleted.
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+ (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
+ (WebKit::TiledCoreAnimationDrawingArea::updateRendering):
+ (WebKit::TiledCoreAnimationDrawingArea::setViewExposedRect):
+ (WebKit::TiledCoreAnimationDrawingArea::scroll): Deleted.
+ (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect): Deleted.
+ Plumb viewExposedRect directly to FrameView, instead of trying to apply
+ the root view -> contents mapping ourselves and pushing updates.
+
2020-05-01 David Kilzer <[email protected]>
[IPC hardening] Refactor createMessageDecoder() for clarity
Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp (261043 => 261044)
--- trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.cpp 2020-05-02 04:57:13 UTC (rev 261044)
@@ -44,6 +44,7 @@
encoder << underlayColor;
encoder << useFixedLayout;
encoder << fixedLayoutSize;
+ encoder << viewExposedRect;
encoder << alwaysShowsHorizontalScroller;
encoder << alwaysShowsVerticalScroller;
encoder.encodeEnum(paginationMode);
@@ -188,6 +189,8 @@
return WTF::nullopt;
if (!decoder.decode(parameters.fixedLayoutSize))
return WTF::nullopt;
+ if (!decoder.decode(parameters.viewExposedRect))
+ return WTF::nullopt;
if (!decoder.decode(parameters.alwaysShowsHorizontalScroller))
return WTF::nullopt;
if (!decoder.decode(parameters.alwaysShowsVerticalScroller))
Modified: trunk/Source/WebKit/Shared/WebPageCreationParameters.h (261043 => 261044)
--- trunk/Source/WebKit/Shared/WebPageCreationParameters.h 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebKit/Shared/WebPageCreationParameters.h 2020-05-02 04:57:13 UTC (rev 261044)
@@ -84,6 +84,8 @@
bool useFixedLayout;
WebCore::IntSize fixedLayoutSize;
+ Optional<WebCore::FloatRect> viewExposedRect;
+
bool alwaysShowsHorizontalScroller;
bool alwaysShowsVerticalScroller;
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (261043 => 261044)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2020-05-02 04:57:13 UTC (rev 261044)
@@ -1902,8 +1902,7 @@
if (m_useContentPreparationRectForVisibleRect)
exposedRect = CGRectUnion(m_contentPreparationRect, exposedRect);
- if (auto drawingArea = m_page->drawingArea())
- drawingArea->setViewExposedRect(m_clipsToVisibleRect ? Optional<WebCore::FloatRect>(exposedRect) : WTF::nullopt);
+ m_page->setViewExposedRect(m_clipsToVisibleRect ? Optional<WebCore::FloatRect>(exposedRect) : WTF::nullopt);
}
void WebViewImpl::setClipsToVisibleRect(bool clipsToVisibleRect)
Modified: trunk/Source/WebKit/UIProcess/DrawingAreaProxy.cpp (261043 => 261044)
--- trunk/Source/WebKit/UIProcess/DrawingAreaProxy.cpp 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebKit/UIProcess/DrawingAreaProxy.cpp 2020-05-02 04:57:13 UTC (rev 261044)
@@ -91,13 +91,11 @@
}
#if PLATFORM(MAC)
-void DrawingAreaProxy::setViewExposedRect(Optional<WebCore::FloatRect> viewExposedRect)
+void DrawingAreaProxy::didChangeViewExposedRect()
{
if (!m_webPageProxy.hasRunningProcess())
return;
- m_viewExposedRect = viewExposedRect;
-
if (!m_viewExposedRectChangedTimer.isActive())
m_viewExposedRectChangedTimer.startOneShot(0_s);
}
@@ -107,11 +105,12 @@
if (!m_webPageProxy.hasRunningProcess())
return;
- if (m_viewExposedRect == m_lastSentViewExposedRect)
+ auto viewExposedRect = m_webPageProxy.viewExposedRect();
+ if (viewExposedRect == m_lastSentViewExposedRect)
return;
- send(Messages::DrawingArea::SetViewExposedRect(m_viewExposedRect));
- m_lastSentViewExposedRect = m_viewExposedRect;
+ send(Messages::DrawingArea::SetViewExposedRect(viewExposedRect));
+ m_lastSentViewExposedRect = viewExposedRect;
}
#endif // PLATFORM(MAC)
Modified: trunk/Source/WebKit/UIProcess/DrawingAreaProxy.h (261043 => 261044)
--- trunk/Source/WebKit/UIProcess/DrawingAreaProxy.h 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebKit/UIProcess/DrawingAreaProxy.h 2020-05-02 04:57:13 UTC (rev 261044)
@@ -89,8 +89,7 @@
virtual void commitTransientZoom(double, WebCore::FloatPoint) { }
#if PLATFORM(MAC)
- virtual void setViewExposedRect(Optional<WebCore::FloatRect>);
- Optional<WebCore::FloatRect> viewExposedRect() const { return m_viewExposedRect; }
+ virtual void didChangeViewExposedRect();
void viewExposedRectChangedTimerFired();
#endif
@@ -153,7 +152,6 @@
#if PLATFORM(MAC)
RunLoop::Timer<DrawingAreaProxy> m_viewExposedRectChangedTimer;
- Optional<WebCore::FloatRect> m_viewExposedRect;
Optional<WebCore::FloatRect> m_lastSentViewExposedRect;
#endif // PLATFORM(MAC)
#endif
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h (261043 => 261044)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h 2020-05-02 04:57:13 UTC (rev 261044)
@@ -71,7 +71,7 @@
void dispatchAfterEnsuringDrawing(WTF::Function<void (CallbackBase::Error)>&&) override;
#if PLATFORM(MAC)
- void setViewExposedRect(Optional<WebCore::FloatRect>) override;
+ void didChangeViewExposedRect() override;
#endif
#if PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm (261043 => 261044)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm 2020-05-02 04:57:13 UTC (rev 261044)
@@ -275,9 +275,9 @@
static const float indicatorInset = 10;
#if PLATFORM(MAC)
-void RemoteLayerTreeDrawingAreaProxy::setViewExposedRect(Optional<WebCore::FloatRect> viewExposedRect)
+void RemoteLayerTreeDrawingAreaProxy::didChangeViewExposedRect()
{
- DrawingAreaProxy::setViewExposedRect(viewExposedRect);
+ DrawingAreaProxy::didChangeViewExposedRect();
updateDebugIndicatorPosition();
}
#endif
@@ -293,8 +293,8 @@
tiledMapLocation += FloatSize(absoluteInset, absoluteInset);
#else
FloatPoint tiledMapLocation;
- if (viewExposedRect())
- tiledMapLocation = viewExposedRect().value().location();
+ if (auto viewExposedRect = m_webPageProxy.viewExposedRect())
+ tiledMapLocation = viewExposedRect->location();
tiledMapLocation += FloatSize(indicatorInset, indicatorInset);
float scale = 1 / m_webPageProxy.pageScaleFactor();
@@ -364,8 +364,8 @@
#if PLATFORM(IOS_FAMILY)
scaledExposedRect = m_webPageProxy.exposedContentRect();
#else
- if (viewExposedRect())
- scaledExposedRect = viewExposedRect().value();
+ if (auto viewExposedRect = m_webPageProxy.viewExposedRect())
+ scaledExposedRect = *viewExposedRect;
float scale = 1 / m_webPageProxy.pageScaleFactor();
scaledExposedRect.scale(scale);
#endif
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (261043 => 261044)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-05-02 04:57:13 UTC (rev 261044)
@@ -3778,6 +3778,19 @@
send(Messages::WebPage::SetFixedLayoutSize(size));
}
+void WebPageProxy::setViewExposedRect(Optional<WebCore::FloatRect> viewExposedRect)
+{
+ if (m_viewExposedRect == viewExposedRect)
+ return;
+
+ m_viewExposedRect = viewExposedRect;
+
+#if PLATFORM(MAC)
+ if (m_drawingArea)
+ m_drawingArea->didChangeViewExposedRect();
+#endif
+}
+
void WebPageProxy::setAlwaysShowsHorizontalScroller(bool alwaysShowsHorizontalScroller)
{
if (alwaysShowsHorizontalScroller == m_alwaysShowsHorizontalScroller)
@@ -7716,6 +7729,7 @@
parameters.underlayColor = m_underlayColor;
parameters.useFixedLayout = m_useFixedLayout;
parameters.fixedLayoutSize = m_fixedLayoutSize;
+ parameters.viewExposedRect = m_viewExposedRect;
parameters.alwaysShowsHorizontalScroller = m_alwaysShowsHorizontalScroller;
parameters.alwaysShowsVerticalScroller = m_alwaysShowsVerticalScroller;
parameters.suppressScrollbarAnimations = m_suppressScrollbarAnimations;
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (261043 => 261044)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-05-02 04:57:13 UTC (rev 261044)
@@ -998,6 +998,9 @@
bool useFixedLayout() const { return m_useFixedLayout; };
const WebCore::IntSize& fixedLayoutSize() const { return m_fixedLayoutSize; };
+ void setViewExposedRect(Optional<WebCore::FloatRect>);
+ Optional<WebCore::FloatRect> viewExposedRect() const { return m_viewExposedRect; }
+
void setAlwaysShowsHorizontalScroller(bool);
void setAlwaysShowsVerticalScroller(bool);
bool alwaysShowsHorizontalScroller() const { return m_alwaysShowsHorizontalScroller; }
@@ -2488,6 +2491,7 @@
bool m_useFixedLayout { false };
WebCore::IntSize m_fixedLayoutSize;
+ Optional<WebCore::FloatRect> m_viewExposedRect;
bool m_alwaysShowsHorizontalScroller { false };
bool m_alwaysShowsVerticalScroller { false };
Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h (261043 => 261044)
--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h 2020-05-02 04:57:13 UTC (rev 261044)
@@ -88,7 +88,7 @@
bool forceRepaintAsync(CallbackID) override { return false; }
void setViewExposedRect(Optional<WebCore::FloatRect>) override;
- Optional<WebCore::FloatRect> viewExposedRect() const override { return m_scrolledViewExposedRect; }
+ Optional<WebCore::FloatRect> viewExposedRect() const override { return m_viewExposedRect; }
void acceleratedAnimationDidStart(uint64_t layerID, const String& key, MonotonicTime startTime) override;
void acceleratedAnimationDidEnd(uint64_t layerID, const String& key) override;
@@ -108,7 +108,6 @@
bool addMilestonesToDispatch(OptionSet<WebCore::LayoutMilestone>) override;
- void updateScrolledExposedRect();
void updateRootLayers();
void addCommitHandlers();
@@ -145,7 +144,6 @@
WebCore::IntSize m_viewSize;
Optional<WebCore::FloatRect> m_viewExposedRect;
- Optional<WebCore::FloatRect> m_scrolledViewExposedRect;
WebCore::Timer m_updateRenderingTimer;
bool m_isRenderingSuspended { false };
Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm (261043 => 261044)
--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm 2020-05-02 04:57:13 UTC (rev 261044)
@@ -73,6 +73,9 @@
// DisplayIDs less likely, it is not entirely safe to have a RemoteLayerTreeDrawingArea and TiledCoreAnimationDrawingArea
// coeexist in the same process.
webPage.windowScreenDidChange(std::numeric_limits<uint32_t>::max() - webPage.identifier().toUInt64());
+
+ if (auto viewExposedRect = parameters.viewExposedRect)
+ setViewExposedRect(viewExposedRect);
}
RemoteLayerTreeDrawingArea::~RemoteLayerTreeDrawingArea()
@@ -227,7 +230,9 @@
void RemoteLayerTreeDrawingArea::setViewExposedRect(Optional<WebCore::FloatRect> viewExposedRect)
{
m_viewExposedRect = viewExposedRect;
- updateScrolledExposedRect();
+
+ if (FrameView* frameView = m_webPage.mainFrameView())
+ frameView->setViewExposedRect(m_viewExposedRect);
}
WebCore::FloatRect RemoteLayerTreeDrawingArea::exposedContentRect() const
@@ -251,22 +256,6 @@
scheduleRenderingUpdate();
}
-void RemoteLayerTreeDrawingArea::updateScrolledExposedRect()
-{
- FrameView* frameView = m_webPage.mainFrameView();
- if (!frameView)
- return;
-
- m_scrolledViewExposedRect = m_viewExposedRect;
-
-#if !PLATFORM(IOS_FAMILY)
- if (m_viewExposedRect)
- m_scrolledViewExposedRect.value().moveBy(frameView->scrollOffset());
-#endif
-
- frameView->setViewExposedRect(m_scrolledViewExposedRect);
-}
-
TiledBacking* RemoteLayerTreeDrawingArea::mainFrameTiledBacking() const
{
FrameView* frameView = m_webPage.mainFrameView();
@@ -333,8 +322,8 @@
m_webPage.updateRendering();
FloatRect visibleRect(FloatPoint(), m_viewSize);
- if (m_scrolledViewExposedRect)
- visibleRect.intersect(m_scrolledViewExposedRect.value());
+ if (auto exposedRect = m_webPage.mainFrameView()->viewExposedRect())
+ visibleRect.intersect(*exposedRect);
addCommitHandlers();
Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h (261043 => 261044)
--- trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h 2020-05-02 04:57:13 UTC (rev 261044)
@@ -58,7 +58,7 @@
// DrawingArea
void setNeedsDisplay() override;
void setNeedsDisplayInRect(const WebCore::IntRect&) override;
- void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta) override;
+ void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta) override { }
void forceRepaint() override;
bool forceRepaintAsync(CallbackID) override;
@@ -72,7 +72,7 @@
void mainFrameContentSizeChanged(const WebCore::IntSize&) override;
void setViewExposedRect(Optional<WebCore::FloatRect>) override;
- Optional<WebCore::FloatRect> viewExposedRect() const override { return m_scrolledViewExposedRect; }
+ Optional<WebCore::FloatRect> viewExposedRect() const override { return m_viewExposedRect; }
WebCore::FloatRect exposedContentRect() const override;
void setExposedContentRect(const WebCore::FloatRect&) override;
@@ -125,7 +125,6 @@
WebCore::TiledBacking* mainFrameTiledBacking() const;
void updateDebugInfoLayer(bool showLayer);
- void updateScrolledExposedRect();
void scaleViewToFitDocumentIfNeeded();
void sendPendingNewlyReachedPaintingMilestones();
@@ -145,7 +144,6 @@
RetainPtr<CALayer> m_pendingRootLayer;
Optional<WebCore::FloatRect> m_viewExposedRect;
- Optional<WebCore::FloatRect> m_scrolledViewExposedRect;
WebCore::IntSize m_lastViewSizeForScaleToFit;
WebCore::IntSize m_lastDocumentSizeForScaleToFit;
Modified: trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (261043 => 261044)
--- trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2020-05-02 04:57:13 UTC (rev 261044)
@@ -91,6 +91,9 @@
updateLayerHostingContext();
setColorSpace(parameters.colorSpace);
+ if (auto viewExposedRect = parameters.viewExposedRect)
+ setViewExposedRect(viewExposedRect);
+
if (!parameters.isProcessSwap)
sendEnterAcceleratedCompositingModeIfNeeded();
}
@@ -138,11 +141,6 @@
{
}
-void TiledCoreAnimationDrawingArea::scroll(const IntRect& scrollRect, const IntSize& scrollDelta)
-{
- updateScrolledExposedRect();
-}
-
void TiledCoreAnimationDrawingArea::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
{
CALayer *rootLayer = graphicsLayer ? graphicsLayer->platformLayer() : nil;
@@ -467,8 +465,8 @@
}
FloatRect visibleRect = [m_hostingLayer frame];
- if (m_scrolledViewExposedRect)
- visibleRect.intersect(m_scrolledViewExposedRect.value());
+ if (auto exposedRect = m_webPage.mainFrameView()->viewExposedRect())
+ visibleRect.intersect(*exposedRect);
// Because our view-relative overlay root layer is not attached to the main GraphicsLayer tree, we need to flush it manually.
if (m_viewOverlayRootLayer)
@@ -553,7 +551,9 @@
void TiledCoreAnimationDrawingArea::setViewExposedRect(Optional<FloatRect> viewExposedRect)
{
m_viewExposedRect = viewExposedRect;
- updateScrolledExposedRect();
+
+ if (FrameView* frameView = m_webPage.mainFrameView())
+ frameView->setViewExposedRect(m_viewExposedRect);
}
FloatRect TiledCoreAnimationDrawingArea::exposedContentRect() const
@@ -567,24 +567,6 @@
ASSERT_NOT_REACHED();
}
-void TiledCoreAnimationDrawingArea::updateScrolledExposedRect()
-{
- FrameView* frameView = m_webPage.mainFrameView();
- if (!frameView)
- return;
-
- m_scrolledViewExposedRect = m_viewExposedRect;
-
-#if !PLATFORM(IOS_FAMILY)
- if (m_viewExposedRect) {
- ScrollOffset scrollOffset = frameView->scrollOffsetFromPosition(frameView->scrollPosition());
- m_scrolledViewExposedRect.value().moveBy(scrollOffset);
- }
-#endif
-
- frameView->setViewExposedRect(m_scrolledViewExposedRect);
-}
-
void TiledCoreAnimationDrawingArea::updateGeometry(const IntSize& viewSize, bool flushSynchronously, const WTF::MachSendRight& fencePort)
{
m_inUpdateGeometry = true;
Modified: trunk/Tools/ChangeLog (261043 => 261044)
--- trunk/Tools/ChangeLog 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Tools/ChangeLog 2020-05-02 04:57:13 UTC (rev 261044)
@@ -1,3 +1,18 @@
+2020-05-01 Tim Horton <[email protected]>
+
+ Books sometimes ends up with blank pages, especially after adjusting font size
+ https://bugs.webkit.org/show_bug.cgi?id=211265
+ <rdar://problem/59898144>
+
+ Reviewed by Darin Adler.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKitCocoa/ViewExposedRect.mm: Added.
+ (forceRepaintCallback):
+ (TEST):
+ Add a test for the first problem, which would previously attempt to allocate
+ ~90TB of tiles, spinning and exploding, and now happily just allocates a few.
+
2020-05-01 Wenson Hsieh <[email protected]>
Text manipulation should observe the value attribute of some input elements
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (261043 => 261044)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-05-02 04:21:15 UTC (rev 261043)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-05-02 04:57:13 UTC (rev 261044)
@@ -140,6 +140,7 @@
2D3CA3A8221DF4B40088E803 /* PageOverlayPlugin.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D3CA3A4221DF2390088E803 /* PageOverlayPlugin.mm */; };
2D4CF8BD1D8360CC0001CE8D /* WKThumbnailView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D4CF8BC1D8360CC0001CE8D /* WKThumbnailView.mm */; };
2D51A0C71C8BF00C00765C45 /* DOMHTMLVideoElementWrapper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D51A0C51C8BF00400765C45 /* DOMHTMLVideoElementWrapper.mm */; };
+ 2D520635245A603D00338F88 /* ViewExposedRect.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D520634245A603C00338F88 /* ViewExposedRect.mm */; };
2D70059621EDA0C6003463CB /* TabOutOfWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D70059521EDA0C6003463CB /* TabOutOfWebView.mm */; };
2D70059921EDA4D0003463CB /* OffscreenWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D70059721EDA4D0003463CB /* OffscreenWindow.mm */; };
2D7FD19322419087007887F1 /* DocumentEditingContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D7FD19222419087007887F1 /* DocumentEditingContext.mm */; };
@@ -1736,6 +1737,7 @@
2D3CA3A4221DF2390088E803 /* PageOverlayPlugin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageOverlayPlugin.mm; sourceTree = "<group>"; };
2D4CF8BC1D8360CC0001CE8D /* WKThumbnailView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKThumbnailView.mm; path = WebKit/WKThumbnailView.mm; sourceTree = "<group>"; };
2D51A0C51C8BF00400765C45 /* DOMHTMLVideoElementWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMHTMLVideoElementWrapper.mm; sourceTree = "<group>"; };
+ 2D520634245A603C00338F88 /* ViewExposedRect.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewExposedRect.mm; sourceTree = "<group>"; };
2D61EC3021B0B75C00A7D1CB /* PencilKitTestSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PencilKitTestSPI.h; sourceTree = "<group>"; };
2D640B5417875DFF00BFAF99 /* ScrollPinningBehaviors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollPinningBehaviors.cpp; sourceTree = "<group>"; };
2D70059521EDA0C6003463CB /* TabOutOfWebView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TabOutOfWebView.mm; sourceTree = "<group>"; };
@@ -3203,6 +3205,7 @@
2E133B4F21D40AF000ED1CB2 /* UseSelectionAsFindString.mm */,
93E943F11CD3E87E00AC08C2 /* VideoControlsManager.mm */,
CD3065DF2165682E00E895DF /* VideoQualityDisplayCompositing.mm */,
+ 2D520634245A603C00338F88 /* ViewExposedRect.mm */,
6356FB211EC4E0BA0044BF18 /* VisibleContentRect.mm */,
83779C371F82FEB0007CDA8A /* VisitedLinkStore.mm */,
830F2E0B209A6A7400D36FF1 /* WebContentProcessDidTerminate.mm */,
@@ -5193,6 +5196,7 @@
7C83E03A1D0A602700FEBCF3 /* UtilitiesCocoa.mm in Sources */,
7C83E0C61D0A654E00FEBCF3 /* VideoControlsManager.mm in Sources */,
CD3065E02165682E00E895DF /* VideoQualityDisplayCompositing.mm in Sources */,
+ 2D520635245A603D00338F88 /* ViewExposedRect.mm in Sources */,
115EB3431EE0BA03003C2C0A /* ViewportSizeForViewportUnits.mm in Sources */,
6356FB221EC4E0BA0044BF18 /* VisibleContentRect.mm in Sources */,
83779C381F82FECE007CDA8A /* VisitedLinkStore.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ViewExposedRect.mm (0 => 261044)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ViewExposedRect.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ViewExposedRect.mm 2020-05-02 04:57:13 UTC (rev 261044)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+
+#import "PlatformUtilities.h"
+#import "Test.h"
+#import "TestWKWebView.h"
+#import <WebKit/WKPage.h>
+#import <WebKit/WKPagePrivate.h>
+#import <WebKit/WKWebViewPrivate.h>
+#import <wtf/RetainPtr.h>
+
+#if PLATFORM(MAC)
+
+@interface WKWebView ()
+- (WKPageRef)_pageForTesting;
+@end
+
+static bool didForceRepaint;
+
+static void forceRepaintCallback(WKErrorRef error, void*)
+{
+ EXPECT_NULL(error);
+ didForceRepaint = true;
+}
+
+TEST(WebKit, InitialTileCoverageUsesViewExposedRect)
+{
+ RetainPtr<TestWKWebView> webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 5000000, 5000000)]);
+ [webView _setClipsToVisibleRect:YES];
+ [[webView hostWindow] setFrame:NSMakeRect(0, 0, 800, 600) display:NO];
+ [webView addToTestWindow];
+ [webView synchronouslyLoadHTMLString:@""];
+
+ didForceRepaint = false;
+ WKPageForceRepaint([webView _pageForTesting], 0, forceRepaintCallback);
+ TestWebKitAPI::Util::run(&didForceRepaint);
+}
+
+#endif // PLATFORM(MAC)