Title: [148651] trunk/Source/WebCore
Revision
148651
Author
[email protected]
Date
2013-04-17 17:04:49 -0700 (Wed, 17 Apr 2013)

Log Message

Fix GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush() to do predictive visible rect expansion
https://bugs.webkit.org/show_bug.cgi?id=114775

Reviewed by Tim Horton.

GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush() is intended to answer the question
"if your visible rect is changed to X, would any tiles be created or destroyed?".

However, for compositing layer tiled layers, we do some predictive visible rect expansion based on how
the visible rect is changing when we actually commit visible rect changes. recursiveVisibleRectChangeRequiresFlush()
was not doing that, causing it to give confusing answers, so fix it to do so.

Both now call adjustTiledLayerVisibleRect(), and it's cleaner to make this a static function.

A somewhat unrelated change is to take the layer bounds origin into account
in GraphicsLayerCA::computeVisibleRect(). Desktop WebKit never sets this, but it's used
on other platforms for composited scrolling, so needs to be taken into account
when computing visible rects.

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush):
(WebCore::GraphicsLayerCA::computeVisibleRect):
(WebCore::GraphicsLayerCA::adjustTiledLayerVisibleRect):
(WebCore::GraphicsLayerCA::updateVisibleRect):
* platform/graphics/ca/GraphicsLayerCA.h:
(GraphicsLayerCA):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (148650 => 148651)


--- trunk/Source/WebCore/ChangeLog	2013-04-17 23:58:42 UTC (rev 148650)
+++ trunk/Source/WebCore/ChangeLog	2013-04-18 00:04:49 UTC (rev 148651)
@@ -1,3 +1,32 @@
+2013-04-17  Simon Fraser  <[email protected]>
+
+        Fix GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush() to do predictive visible rect expansion
+        https://bugs.webkit.org/show_bug.cgi?id=114775
+
+        Reviewed by Tim Horton.
+
+        GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush() is intended to answer the question
+        "if your visible rect is changed to X, would any tiles be created or destroyed?".
+        
+        However, for compositing layer tiled layers, we do some predictive visible rect expansion based on how
+        the visible rect is changing when we actually commit visible rect changes. recursiveVisibleRectChangeRequiresFlush()
+        was not doing that, causing it to give confusing answers, so fix it to do so.
+        
+        Both now call adjustTiledLayerVisibleRect(), and it's cleaner to make this a static function.
+        
+        A somewhat unrelated change is to take the layer bounds origin into account
+        in GraphicsLayerCA::computeVisibleRect(). Desktop WebKit never sets this, but it's used
+        on other platforms for composited scrolling, so needs to be taken into account
+        when computing visible rects.
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush):
+        (WebCore::GraphicsLayerCA::computeVisibleRect):
+        (WebCore::GraphicsLayerCA::adjustTiledLayerVisibleRect):
+        (WebCore::GraphicsLayerCA::updateVisibleRect):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        (GraphicsLayerCA):
+
 2013-04-17  Oliver Hunt  <[email protected]>
 
         Automate generation of toJS function for classes that need to report extra memory usage

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (148650 => 148651)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2013-04-17 23:58:42 UTC (rev 148650)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2013-04-18 00:04:49 UTC (rev 148651)
@@ -913,10 +913,13 @@
     
     // This may be called at times when layout has not been updated, so we want to avoid calling out to the client
     // for animating transforms.
-    FloatRect visibleRect = computeVisibleRect(localState, 0);
-    if (visibleRect != m_visibleRect) {
+    FloatRect newVisibleRect = computeVisibleRect(localState, 0);
+    if (m_layer->layerType() == PlatformCALayer::LayerTypeTiledBackingLayer)
+        newVisibleRect = adjustTiledLayerVisibleRect(tiledBacking(), m_visibleRect, newVisibleRect, m_sizeAtLastVisibleRectUpdate, m_size);
+
+    if (newVisibleRect != m_visibleRect) {
         if (TiledBacking* tiledBacking = this->tiledBacking()) {
-            if (tiledBacking->tilesWouldChangeForVisibleRect(visibleRect))
+            if (tiledBacking->tilesWouldChangeForVisibleRect(newVisibleRect))
                 return true;
         }
     }
@@ -994,7 +997,10 @@
     
     bool mapWasClamped;
     FloatRect clipRectForChildren = state.mappedQuad(&mapWasClamped).boundingBox();
-    FloatRect clipRectForSelf(0, 0, m_size.width(), m_size.height());
+    FloatPoint boundsOrigin = m_boundsOrigin;
+    clipRectForChildren.move(boundsOrigin.x(), boundsOrigin.y());
+    
+    FloatRect clipRectForSelf(boundsOrigin, m_size);
     if (!applyWasClamped && !mapWasClamped)
         clipRectForSelf.intersect(clipRectForChildren);
     
@@ -1592,24 +1598,24 @@
         m_layer->setBorderWidth(0);
 }
 
-FloatRect GraphicsLayerCA::adjustTiledLayerVisibleRect(TiledBacking* tiledBacking, const FloatRect& oldVisibleRect, const FloatSize& oldSize) const
+FloatRect GraphicsLayerCA::adjustTiledLayerVisibleRect(TiledBacking* tiledBacking, const FloatRect& oldVisibleRect, const FloatRect& newVisibleRect, const FloatSize& oldSize, const FloatSize& newSize)
 {
     // If the old visible rect is empty, we have no information about how the visible area is changing
     // (maybe the layer was just created), so don't attempt to expand. Also don't attempt to expand
     // if the size changed.
-    if (oldVisibleRect.isEmpty() || m_size != oldSize)
-        return m_visibleRect;
+    if (oldVisibleRect.isEmpty() || newSize != oldSize)
+        return newVisibleRect;
 
     const float paddingMultiplier = 2;
 
-    float leftEdgeDelta = paddingMultiplier * (m_visibleRect.x() - oldVisibleRect.x());
-    float rightEdgeDelta = paddingMultiplier * (m_visibleRect.maxX() - oldVisibleRect.maxX());
+    float leftEdgeDelta = paddingMultiplier * (newVisibleRect.x() - oldVisibleRect.x());
+    float rightEdgeDelta = paddingMultiplier * (newVisibleRect.maxX() - oldVisibleRect.maxX());
 
-    float topEdgeDelta = paddingMultiplier * (m_visibleRect.y() - oldVisibleRect.y());
-    float bottomEdgeDelta = paddingMultiplier * (m_visibleRect.maxY() - oldVisibleRect.maxY());
+    float topEdgeDelta = paddingMultiplier * (newVisibleRect.y() - oldVisibleRect.y());
+    float bottomEdgeDelta = paddingMultiplier * (newVisibleRect.maxY() - oldVisibleRect.maxY());
     
     FloatRect existingTileBackingRect = tiledBacking->visibleRect();
-    FloatRect expandedRect = m_visibleRect;
+    FloatRect expandedRect = newVisibleRect;
 
     // More exposed on left side.
     if (leftEdgeDelta < 0) {
@@ -1659,7 +1665,7 @@
 
     FloatRect tileArea = m_visibleRect;
     if (m_layer->layerType() == PlatformCALayer::LayerTypeTiledBackingLayer)
-        tileArea = adjustTiledLayerVisibleRect(tiledBacking(), oldVisibleRect, m_sizeAtLastVisibleRectUpdate);
+        tileArea = adjustTiledLayerVisibleRect(tiledBacking(), oldVisibleRect, tileArea, m_sizeAtLastVisibleRectUpdate, m_size);
 
     tiledBacking()->setVisibleRect(tileArea);
 

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (148650 => 148651)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2013-04-17 23:58:42 UTC (rev 148650)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2013-04-18 00:04:49 UTC (rev 148651)
@@ -250,7 +250,7 @@
     FloatRect computeVisibleRect(TransformState&, ComputeVisibleRectFlags = RespectAnimatingTransforms) const;
     const FloatRect& visibleRect() const { return m_visibleRect; }
     
-    FloatRect adjustTiledLayerVisibleRect(TiledBacking*, const FloatRect& oldVisibleRect, const FloatSize& oldSize) const;
+    static FloatRect adjustTiledLayerVisibleRect(TiledBacking*, const FloatRect& oldVisibleRect, const FloatRect& newVisibleRect, const FloatSize& oldSize, const FloatSize& newSize);
 
     bool recursiveVisibleRectChangeRequiresFlush(const TransformState&) const;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to