Title: [152271] branches/safari-537-branch/Source/WebKit2

Diff

Modified: branches/safari-537-branch/Source/WebKit2/ChangeLog (152270 => 152271)


--- branches/safari-537-branch/Source/WebKit2/ChangeLog	2013-07-01 23:31:53 UTC (rev 152270)
+++ branches/safari-537-branch/Source/WebKit2/ChangeLog	2013-07-01 23:33:30 UTC (rev 152271)
@@ -1,5 +1,48 @@
 2013-07-01  Lucas Forschler  <[email protected]>
 
+        Merge r152266
+
+    2013-07-01  Tim Horton  <[email protected]>
+
+            [wk2] TiledCoreAnimationDrawingArea should support scrolling its exposed rect
+            https://bugs.webkit.org/show_bug.cgi?id=118173
+            <rdar://problem/14301166>
+
+            Reviewed by Anders Carlsson.
+
+            Offset the exposed rect passed from the WKView by the main frame's current scroll position
+            before sending it to our TiledBackings, so that it is in the same coordinate space as their
+            ordinary visibleRects.
+
+            This has the side effect of making clips-to-exposed-rect testable (though useless) in Safari.
+
+            * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
+            Add updateScrolledExposedRect() and m_scrolledExposedRect.
+
+            * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+            (WebKit::TiledCoreAnimationDrawingArea::scroll):
+            Call updateScrolledExposedRect when the main frame scrolls.
+
+            (WebKit::TiledCoreAnimationDrawingArea::setExposedRect):
+            Remove a FIXME about this change.
+            Call updateScrolledExposedRect instead of passing down the unscrolled rect.
+
+            (WebKit::TiledCoreAnimationDrawingArea::setClipsToExposedRect):
+            Call updateScrolledExposedRect, because that method will short-circuit if
+            setClipsToExposedRect is false, so we need to update here for correctness
+            if we get a setExposedRect(), setClipsToExposedRect(true) pair.
+
+            (WebKit::TiledCoreAnimationDrawingArea::updateScrolledExposedRect):
+            Update m_scrolledExposedRect and propagate it to our TiledBackings.
+
+            (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
+            (WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer):
+            (WebKit::TiledCoreAnimationDrawingArea::createPageOverlayLayer):
+            (WebKit::TiledCoreAnimationDrawingArea::didCommitChangesForLayer):
+            Use the scrolled exposed rect.
+
+2013-07-01  Lucas Forschler  <[email protected]>
+
         Merge r152077
 
     2013-06-26  Simon Cooper  <[email protected]>

Modified: branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h (152270 => 152271)


--- branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h	2013-07-01 23:31:53 UTC (rev 152270)
+++ branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h	2013-07-01 23:33:30 UTC (rev 152271)
@@ -111,6 +111,7 @@
 
     void updateIntrinsicContentSizeTimerFired(WebCore::Timer<TiledCoreAnimationDrawingArea>*);
     void updateMainFrameClipsToExposedRect();
+    void updateScrolledExposedRect();
     
     void invalidateAllPageOverlays();
 
@@ -132,6 +133,7 @@
     bool m_hasRootCompositingLayer;
 
     WebCore::FloatRect m_exposedRect;
+    WebCore::FloatRect m_scrolledExposedRect;
     bool m_clipsToExposedRect;
 
     WebCore::IntSize m_lastSentIntrinsicContentSize;

Modified: branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (152270 => 152271)


--- branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2013-07-01 23:31:53 UTC (rev 152270)
+++ branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm	2013-07-01 23:33:30 UTC (rev 152271)
@@ -112,6 +112,7 @@
 
 void TiledCoreAnimationDrawingArea::scroll(const IntRect& scrollRect, const IntSize& scrollDelta)
 {
+    updateScrolledExposedRect();
 }
 
 void TiledCoreAnimationDrawingArea::invalidateAllPageOverlays()
@@ -351,7 +352,7 @@
 
     IntRect visibleRect = enclosingIntRect(m_rootLayer.get().frame);
     if (m_clipsToExposedRect)
-        visibleRect.intersect(enclosingIntRect(m_exposedRect));
+        visibleRect.intersect(enclosingIntRect(m_scrolledExposedRect));
 
     for (PageOverlayLayerMap::iterator it = m_pageOverlayLayers.begin(), end = m_pageOverlayLayers.end(); it != end; ++it) {
         GraphicsLayer* layer = it->value.get();
@@ -404,22 +405,43 @@
 
 void TiledCoreAnimationDrawingArea::setExposedRect(const FloatRect& exposedRect)
 {
-    // FIXME: This should be mapped through the scroll offset, but we need to keep it up to date.
     m_exposedRect = exposedRect;
-
-    mainFrameTiledBacking()->setExposedRect(exposedRect);
-
-    for (PageOverlayLayerMap::iterator it = m_pageOverlayLayers.begin(), end = m_pageOverlayLayers.end(); it != end; ++it)
-        if (TiledBacking* tiledBacking = it->value->tiledBacking())
-            tiledBacking->setExposedRect(exposedRect);
+    updateScrolledExposedRect();
 }
 
 void TiledCoreAnimationDrawingArea::setClipsToExposedRect(bool clipsToExposedRect)
 {
     m_clipsToExposedRect = clipsToExposedRect;
+    updateScrolledExposedRect();
     updateMainFrameClipsToExposedRect();
 }
 
+void TiledCoreAnimationDrawingArea::updateScrolledExposedRect()
+{
+    if (!m_clipsToExposedRect)
+        return;
+
+    Frame* frame = m_webPage->corePage()->mainFrame();
+    if (!frame)
+        return;
+
+    FrameView* frameView = frame->view();
+    if (!frameView)
+        return;
+
+    IntPoint scrollPositionWithOrigin = frameView->scrollPosition() + toIntSize(frameView->scrollOrigin());
+
+    m_scrolledExposedRect = m_exposedRect;
+    m_scrolledExposedRect.moveBy(scrollPositionWithOrigin);
+
+    mainFrameTiledBacking()->setExposedRect(m_scrolledExposedRect);
+
+    for (PageOverlayLayerMap::iterator it = m_pageOverlayLayers.begin(), end = m_pageOverlayLayers.end(); it != end; ++it) {
+        if (TiledBacking* tiledBacking = it->value->tiledBacking())
+            tiledBacking->setExposedRect(m_scrolledExposedRect);
+    }
+}
+
 void TiledCoreAnimationDrawingArea::updateGeometry(const IntSize& viewSize, const IntSize& layerPosition)
 {
     m_inUpdateGeometry = true;
@@ -565,7 +587,7 @@
 
     if (TiledBacking* tiledBacking = mainFrameTiledBacking()) {
         tiledBacking->setAggressivelyRetainsTiles(m_webPage->corePage()->settings()->aggressiveTileRetentionEnabled());
-        tiledBacking->setExposedRect(m_exposedRect);
+        tiledBacking->setExposedRect(m_scrolledExposedRect);
     }
 
     updateMainFrameClipsToExposedRect();
@@ -589,7 +611,7 @@
     m_pageOverlayPlatformLayers.set(layer.get(), layer->platformLayer());
 
     if (TiledBacking* tiledBacking = layer->tiledBacking()) {
-        tiledBacking->setExposedRect(m_exposedRect);
+        tiledBacking->setExposedRect(m_scrolledExposedRect);
         tiledBacking->setClipsToExposedRect(m_clipsToExposedRect);
     }
 
@@ -637,7 +659,7 @@
     [CATransaction commit];
 
     if (TiledBacking* tiledBacking = layer->tiledBacking()) {
-        tiledBacking->setExposedRect(m_exposedRect);
+        tiledBacking->setExposedRect(m_scrolledExposedRect);
         tiledBacking->setClipsToExposedRect(m_clipsToExposedRect);
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to