Move TransformState code into its own member function, and remove a test that was...
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Oct 2012 01:16:09 +0000 (01:16 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 13 Oct 2012 01:16:09 +0000 (01:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=99117

Reviewed by Tim Horton.

The code that manipulates the TransformState and computes the visible rect is going to get
more complex, so move it into a new member function.

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::computeVisibleRect):
(WebCore::GraphicsLayerCA::recursiveCommitChanges):
* platform/graphics/ca/GraphicsLayerCA.h:
(GraphicsLayerCA):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@131247 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

index 3391201..4b50917 100644 (file)
@@ -1,3 +1,19 @@
+2012-10-11  Simon Fraser  <simon.fraser@apple.com>
+
+        Move TransformState code into its own member function, and remove a test that was prematurely added
+        https://bugs.webkit.org/show_bug.cgi?id=99117
+
+        Reviewed by Tim Horton.
+
+        The code that manipulates the TransformState and computes the visible rect is going to get
+        more complex, so move it into a new member function.
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::computeVisibleRect):
+        (WebCore::GraphicsLayerCA::recursiveCommitChanges):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        (GraphicsLayerCA):
+
 2012-10-12  Simon Fraser  <simon.fraser@apple.com>
 
         Add some initial visible rect tests and tweak the visible wash layer
index 740db33..32f5566 100644 (file)
@@ -914,13 +914,10 @@ TiledBacking* GraphicsLayerCA::tiledBacking()
     return m_layer->tiledBacking();
 }
 
-void GraphicsLayerCA::recursiveCommitChanges(const TransformState& state, float pageScaleFactor, const FloatPoint& positionRelativeToBase, bool affectedByPageScale)
+void GraphicsLayerCA::computeVisibleRect(TransformState& state)
 {
-    // Save the state before sending down to kids and restore it after
-    TransformState localState = state;
-    
     TransformState::TransformAccumulation accumulation = preserves3D() ? TransformState::AccumulateTransform : TransformState::FlattenTransform;
-    localState.move(m_position.x(), m_position.y(), accumulation);
+    state.move(m_position.x(), m_position.y(), accumulation);
     
     if (!transform().isIdentity()) {
         TransformationMatrix transformWithAnchorPoint;
@@ -929,21 +926,30 @@ void GraphicsLayerCA::recursiveCommitChanges(const TransformState& state, float
         transformWithAnchorPoint.translate3d(absoluteAnchorPoint.x(), absoluteAnchorPoint.y(), absoluteAnchorPoint.z());
         transformWithAnchorPoint.multiply(transform());
         transformWithAnchorPoint.translate3d(-absoluteAnchorPoint.x(), -absoluteAnchorPoint.y(), -absoluteAnchorPoint.z());
-        localState.applyTransform(transformWithAnchorPoint, accumulation);
+        state.applyTransform(transformWithAnchorPoint, accumulation);
     }
     
-    FloatRect clipRectForChildren = localState.lastPlanarQuad().boundingBox();
+    FloatRect clipRectForChildren = state.lastPlanarQuad().boundingBox();
     FloatRect clipRectForSelf(0, 0, m_size.width(), m_size.height());
     clipRectForSelf.intersect(clipRectForChildren);
     
     if (masksToBounds()) {
         ASSERT(accumulation == TransformState::FlattenTransform);
         // Replace the quad in the TransformState with one that is clipped to this layer's bounds
-        localState.setQuad(clipRectForSelf);
+        state.setQuad(clipRectForSelf);
     }
 
     m_visibleRect = clipRectForSelf;
-    
+
+    if (!childrenTransform().isIdentity())    
+        state.applyTransform(childrenTransform(), accumulation);
+}
+
+void GraphicsLayerCA::recursiveCommitChanges(const TransformState& state, float pageScaleFactor, const FloatPoint& positionRelativeToBase, bool affectedByPageScale)
+{
+    TransformState localState = state;
+    computeVisibleRect(localState);
+
 #ifdef VISIBLE_TILE_WASH
     // Use having a transform as a key to making the tile wash layer. If every layer gets a wash,
     // they start to obscure useful information.
@@ -962,7 +968,7 @@ void GraphicsLayerCA::recursiveCommitChanges(const TransformState& state, float
     }
 
     if (m_visibleTileWashLayer)
-        m_visibleTileWashLayer->setFrame(clipRectForSelf);
+        m_visibleTileWashLayer->setFrame(m_visibleRect);
 #endif
 
     bool hadChanges = m_uncommittedChanges;
@@ -985,9 +991,6 @@ void GraphicsLayerCA::recursiveCommitChanges(const TransformState& state, float
     const Vector<GraphicsLayer*>& childLayers = children();
     size_t numChildren = childLayers.size();
     
-    if (!childrenTransform().isIdentity())    
-        localState.applyTransform(childrenTransform(), accumulation);
-    
     for (size_t i = 0; i < numChildren; ++i) {
         GraphicsLayerCA* curChild = static_cast<GraphicsLayerCA*>(childLayers[i]);
         curChild->recursiveCommitChanges(localState, pageScaleFactor, baseRelativePosition, affectedByPageScale);
index f6efbfe..b8da577 100644 (file)
@@ -233,6 +233,7 @@ private:
 
     void computePixelAlignment(float pixelAlignmentScale, const FloatPoint& positionRelativeToBase,
         FloatPoint& position, FloatSize&, FloatPoint3D& anchorPoint, FloatSize& alignmentOffset) const;
+    void computeVisibleRect(TransformState&);
 
     // Used to track the path down the tree for replica layers.
     struct ReplicaState {