Title: [100477] branches/safari-534.53-branch/Source/WebCore

Diff

Modified: branches/safari-534.53-branch/Source/WebCore/ChangeLog (100476 => 100477)


--- branches/safari-534.53-branch/Source/WebCore/ChangeLog	2011-11-16 19:29:26 UTC (rev 100476)
+++ branches/safari-534.53-branch/Source/WebCore/ChangeLog	2011-11-16 19:31:25 UTC (rev 100477)
@@ -1,5 +1,33 @@
 2011-11-15  Lucas Forschler  <lforsch...@apple.com>
 
+    Merge 89441 
+
+    2011-06-22  Simon Fraser  <simon.fra...@apple.com>
+
+            Reviewed by Dan Bernstein.
+
+            Update position, bounds and anchor point in GraphicsLayerCA all at once
+            https://bugs.webkit.org/show_bug.cgi?id=63148
+
+            Since position, bounds and anchor point are inter-dependent, avoid
+            redundant work by simply updating them all at the same time.
+
+            No behavior changes, so no new tests.
+
+            * platform/graphics/ca/GraphicsLayerCA.cpp:
+            (WebCore::GraphicsLayerCA::setPosition):
+            (WebCore::GraphicsLayerCA::setAnchorPoint):
+            (WebCore::GraphicsLayerCA::setSize):
+            (WebCore::GraphicsLayerCA::setBoundsOrigin):
+            (WebCore::GraphicsLayerCA::setAllowTiledLayer):
+            (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
+            (WebCore::GraphicsLayerCA::updateGeometry):
+            (WebCore::GraphicsLayerCA::ensureStructuralLayer):
+            (WebCore::GraphicsLayerCA::swapFromOrToTiledLayer):
+            * platform/graphics/ca/GraphicsLayerCA.h:
+
+2011-11-15  Lucas Forschler  <lforsch...@apple.com>
+
     Merge 91140
 
     2011-07-15  Simon Fraser  <simon.fra...@apple.com>

Modified: branches/safari-534.53-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (100476 => 100477)


--- branches/safari-534.53-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2011-11-16 19:29:26 UTC (rev 100476)
+++ branches/safari-534.53-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2011-11-16 19:31:25 UTC (rev 100477)
@@ -380,7 +380,7 @@
         return;
 
     GraphicsLayer::setPosition(point);
-    noteLayerPropertyChanged(PositionChanged);
+    noteLayerPropertyChanged(GeometryChanged);
 }
 
 void GraphicsLayerCA::setAnchorPoint(const FloatPoint3D& point)
@@ -389,7 +389,7 @@
         return;
 
     GraphicsLayer::setAnchorPoint(point);
-    noteLayerPropertyChanged(AnchorPointChanged);
+    noteLayerPropertyChanged(GeometryChanged);
 }
 
 void GraphicsLayerCA::setSize(const FloatSize& size)
@@ -398,7 +398,7 @@
         return;
 
     GraphicsLayer::setSize(size);
-    noteLayerPropertyChanged(SizeChanged);
+    noteLayerPropertyChanged(GeometryChanged);
 }
 
 void GraphicsLayerCA::setTransform(const TransformationMatrix& t)
@@ -495,8 +495,8 @@
 
     m_allowTiledLayer = allowTiledLayer;
     
-    // Handling this as a SizeChanged will cause use to switch in or out of tiled layer as needed
-    noteLayerPropertyChanged(SizeChanged);
+    // Handling this as a BoundsChanged will cause use to switch in or out of tiled layer as needed
+    noteLayerPropertyChanged(GeometryChanged);
 }
 
 void GraphicsLayerCA::setBackgroundColor(const Color& color)
@@ -848,14 +848,8 @@
     if (m_uncommittedChanges & ChildrenChanged)
         updateSublayerList();
 
-    if (m_uncommittedChanges & PositionChanged)
-        updateLayerPosition();
-    
-    if (m_uncommittedChanges & AnchorPointChanged)
-        updateAnchorPoint();
-    
-    if (m_uncommittedChanges & SizeChanged)
-        updateLayerSize();
+    if (m_uncommittedChanges & GeometryChanged)
+        updateGeometry();
 
     if (m_uncommittedChanges & TransformChanged)
         updateTransform();
@@ -969,14 +963,18 @@
         m_layer->setSublayers(newSublayers);
 }
 
-void GraphicsLayerCA::updateLayerPosition()
+void GraphicsLayerCA::updateGeometry()
 {
+    bool needTiledLayer = requiresTiledLayer(m_size);
+    if (needTiledLayer != m_usingTiledLayer)
+        swapFromOrToTiledLayer(needTiledLayer);
+
     FloatSize usedSize = m_usingTiledLayer ? constrainedSize() : m_size;
+    FloatRect boundsRect(FloatPoint(), usedSize);
 
+    // Update position.
     // Position is offset on the layer by the layer anchor point.
-    FloatPoint posPoint(m_position.x() + m_anchorPoint.x() * usedSize.width(),
-                          m_position.y() + m_anchorPoint.y() * usedSize.height());
-    
+    FloatPoint posPoint(m_position.x() + m_anchorPoint.x() * usedSize.width(), m_position.y() + m_anchorPoint.y() * usedSize.height());
     primaryLayer()->setPosition(posPoint);
 
     if (LayerMap* layerCloneMap = primaryLayerClones()) {
@@ -991,18 +989,16 @@
             it->second->setPosition(clonePosition);
         }
     }
-}
 
-void GraphicsLayerCA::updateLayerSize()
-{
-    FloatRect rect(0, 0, m_size.width(), m_size.height());
+    // Update bounds.
+    // Note that we don't resize m_contentsLayer. It's up the caller to do that.
     if (m_structuralLayer) {
-        m_structuralLayer->setBounds(rect);
+        m_structuralLayer->setBounds(boundsRect);
         
         if (LayerMap* layerCloneMap = m_structuralLayerClones.get()) {
             LayerMap::const_iterator end = layerCloneMap->end();
             for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it)
-                it->second->setBounds(rect);
+                it->second->setBounds(boundsRect);
         }
 
         // The anchor of the contents layer is always at 0.5, 0.5, so the position is center-relative.
@@ -1016,34 +1012,14 @@
         }
     }
     
-    bool needTiledLayer = requiresTiledLayer(m_size);
-    if (needTiledLayer != m_usingTiledLayer)
-        swapFromOrToTiledLayer(needTiledLayer);
-    
-    if (m_usingTiledLayer) {
-        FloatSize sizeToUse = constrainedSize();
-        rect = CGRectMake(0, 0, sizeToUse.width(), sizeToUse.height());
-    }
-    
-    m_layer->setBounds(rect);
+    m_layer->setBounds(boundsRect);
     if (LayerMap* layerCloneMap = m_layerClones.get()) {
         LayerMap::const_iterator end = layerCloneMap->end();
         for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it)
-            it->second->setBounds(rect);
+            it->second->setBounds(boundsRect);
     }
     
-    // Contents transform may depend on height.
-    updateContentsTransform();
-
-    // Note that we don't resize m_contentsLayer. It's up the caller to do that.
-
-    // if we've changed the bounds, we need to recalculate the position
-    // of the layer, taking anchor point into account.
-    updateLayerPosition();
-}
-
-void GraphicsLayerCA::updateAnchorPoint()
-{
+    // Update anchor point.
     primaryLayer()->setAnchorPoint(m_anchorPoint);
 
     if (LayerMap* layerCloneMap = primaryLayerClones()) {
@@ -1054,7 +1030,8 @@
         }
     }
 
-    updateLayerPosition();
+    // Contents transform may depend on height.
+    updateContentsTransform();
 }
 
 void GraphicsLayerCA::updateTransform()
@@ -1155,9 +1132,7 @@
             m_structuralLayer = 0;
 
             // Update the properties of m_layer now that we no longer have a structural layer.
-            updateLayerPosition();
-            updateLayerSize();
-            updateAnchorPoint();
+            updateGeometry();
             updateTransform();
             updateChildrenTransform();
 
@@ -1193,9 +1168,7 @@
     updateLayerNames();
 
     // Update the properties of the structural layer.
-    updateLayerPosition();
-    updateLayerSize();
-    updateAnchorPoint();
+    updateGeometry();
     updateTransform();
     updateChildrenTransform();
     updateBackfaceVisibility();
@@ -2068,9 +2041,7 @@
 
     updateContentsTransform();
 
-    updateLayerPosition();
-    updateLayerSize();
-    updateAnchorPoint();
+    updateGeometry();
     updateTransform();
     updateChildrenTransform();
     updateMasksToBounds();

Modified: branches/safari-534.53-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (100476 => 100477)


--- branches/safari-534.53-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2011-11-16 19:29:26 UTC (rev 100476)
+++ branches/safari-534.53-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2011-11-16 19:31:25 UTC (rev 100477)
@@ -262,9 +262,7 @@
     // All these "update" methods will be called inside a BEGIN_BLOCK_OBJC_EXCEPTIONS/END_BLOCK_OBJC_EXCEPTIONS block.
     void updateLayerNames();
     void updateSublayerList();
-    void updateLayerPosition();
-    void updateLayerSize();
-    void updateAnchorPoint();
+    void updateGeometry();
     void updateTransform();
     void updateChildrenTransform();
     void updateMasksToBounds();
@@ -306,29 +304,27 @@
         NoChange = 0,
         NameChanged = 1 << 1,
         ChildrenChanged = 1 << 2, // also used for content layer, and preserves-3d, and size if tiling changes?
-        PositionChanged = 1 << 3,
-        AnchorPointChanged = 1 << 4,
-        SizeChanged = 1 << 5,
-        TransformChanged = 1 << 6,
-        ChildrenTransformChanged = 1 << 7,
-        Preserves3DChanged = 1 << 8,
-        MasksToBoundsChanged = 1 << 9,
-        DrawsContentChanged = 1 << 10, // need this?
-        BackgroundColorChanged = 1 << 11,
-        ContentsOpaqueChanged = 1 << 12,
-        BackfaceVisibilityChanged = 1 << 13,
-        OpacityChanged = 1 << 14,
-        AnimationChanged = 1 << 15,
-        DirtyRectsChanged = 1 << 16,
-        ContentsImageChanged = 1 << 17,
-        ContentsMediaLayerChanged = 1 << 18,
-        ContentsCanvasLayerChanged = 1 << 19,
-        ContentsRectChanged = 1 << 20,
-        MaskLayerChanged = 1 << 21,
-        ReplicatedLayerChanged = 1 << 22,
-        ContentsNeedsDisplay = 1 << 23,
-        AcceleratesDrawingChanged = 1 << 24,
-        ContentsScaleChanged = 1 << 25
+        GeometryChanged = 1 << 3,
+        TransformChanged = 1 << 4,
+        ChildrenTransformChanged = 1 << 5,
+        Preserves3DChanged = 1 << 6,
+        MasksToBoundsChanged = 1 << 7,
+        DrawsContentChanged = 1 << 8, // need this?
+        BackgroundColorChanged = 1 << 9,
+        ContentsOpaqueChanged = 1 << 10,
+        BackfaceVisibilityChanged = 1 << 11,
+        OpacityChanged = 1 << 12,
+        AnimationChanged = 1 << 13,
+        DirtyRectsChanged = 1 << 14,
+        ContentsImageChanged = 1 << 15,
+        ContentsMediaLayerChanged = 1 << 16,
+        ContentsCanvasLayerChanged = 1 << 17,
+        ContentsRectChanged = 1 << 18,
+        MaskLayerChanged = 1 << 19,
+        ReplicatedLayerChanged = 1 << 20,
+        ContentsNeedsDisplay = 1 << 21,
+        AcceleratesDrawingChanged = 1 << 22,
+        ContentsScaleChanged = 1 << 23
     };
     typedef unsigned LayerChangeFlags;
     void noteLayerPropertyChanged(LayerChangeFlags flags);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to