Index: third_party/WebKit/Source/core/paint/PaintLayer.cpp |
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp |
index 7a098e407c3170d03fdbc948ebb001ca222ec3f6..4d1e1d09b3330a335004970f428fceb8cb9461ff 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp |
@@ -138,7 +138,6 @@ PaintLayer::PaintLayer(LayoutBoxModelObject* layoutObject) |
#if DCHECK_IS_ON() |
m_needsPositionUpdate(true), |
#endif |
- m_is3DTransformedDescendantDirty(true), |
m_has3DTransformedDescendant(false), |
m_containsDirtyOverlayScrollbars(false), |
m_needsAncestorDependentCompositingInputsUpdate(true), |
@@ -415,7 +414,7 @@ void PaintLayer::updateTransform(const ComputedStyle* oldStyle, |
updateTransformationMatrix(); |
if (had3DTransform != has3DTransform()) |
- dirty3DTransformedDescendantStatus(); |
+ markAncestorChainForDescendantDependentFlagsUpdate(); |
if (FrameView* frameView = layoutObject()->document().view()) |
frameView->setNeedsUpdateWidgetGeometries(); |
@@ -740,49 +739,35 @@ void PaintLayer::updateDescendantDependentFlags() { |
// this LayoutObject during the invalidateTreeIfNeeded walk. |
m_layoutObject->setMayNeedPaintInvalidation(); |
} |
-} |
- |
-void PaintLayer::dirty3DTransformedDescendantStatus() { |
- PaintLayerStackingNode* stackingNode = |
- m_stackingNode->ancestorStackingContextNode(); |
- if (!stackingNode) |
- return; |
- |
- stackingNode->layer()->m_is3DTransformedDescendantDirty = true; |
- // This propagates up through preserve-3d hierarchies to the enclosing |
- // flattening layer. Note that preserves3D() creates stacking context, so we |
- // can just run up the stacking containers. |
- while (stackingNode && stackingNode->layer()->preserves3D()) { |
- stackingNode->layer()->m_is3DTransformedDescendantDirty = true; |
- stackingNode = stackingNode->ancestorStackingContextNode(); |
- } |
+ update3DTransformedDescendantStatus(); |
} |
-// Return true if this layer or any preserve-3d descendants have 3d. |
-bool PaintLayer::update3DTransformedDescendantStatus() { |
- if (m_is3DTransformedDescendantDirty) { |
- m_has3DTransformedDescendant = false; |
- |
- m_stackingNode->updateZOrderLists(); |
+void PaintLayer::update3DTransformedDescendantStatus() { |
+ m_has3DTransformedDescendant = false; |
- // Transformed or preserve-3d descendants can only be in the z-order lists, |
- // not in the normal flow list, so we only need to check those. |
- PaintLayerStackingNodeIterator iterator( |
- *m_stackingNode.get(), PositiveZOrderChildren | NegativeZOrderChildren); |
- while (PaintLayerStackingNode* node = iterator.next()) |
- m_has3DTransformedDescendant |= |
- node->layer()->update3DTransformedDescendantStatus(); |
+ m_stackingNode->updateZOrderLists(); |
- m_is3DTransformedDescendantDirty = false; |
+ // Transformed or preserve-3d descendants can only be in the z-order lists, |
+ // not in the normal flow list, so we only need to check those. |
+ PaintLayerStackingNodeIterator iterator( |
+ *m_stackingNode.get(), PositiveZOrderChildren | NegativeZOrderChildren); |
+ while (PaintLayerStackingNode* node = iterator.next()) { |
+ const PaintLayer& childLayer = *node->layer(); |
+ bool childHas3D = false; |
+ // If the child lives in a 3d hierarchy, then the layer at the root of |
+ // that hierarchy needs the m_has3DTransformedDescendant set. |
+ if (childLayer.preserves3D() && (childLayer.has3DTransform() || |
+ childLayer.has3DTransformedDescendant())) |
+ childHas3D = true; |
+ else if (childLayer.has3DTransform()) |
+ childHas3D = true; |
+ |
+ m_has3DTransformedDescendant = m_has3DTransformedDescendant || childHas3D; |
Xianzhu
2016/12/28 18:56:33
Nit: Would the following look better:
if (child
chrishtr
2016/12/28 19:01:00
Done.
|
+ |
+ if (m_has3DTransformedDescendant) |
+ break; |
} |
- |
- // If we live in a 3d hierarchy, then the layer at the root of that hierarchy |
- // needs the m_has3DTransformedDescendant set. |
- if (preserves3D()) |
- return has3DTransform() || m_has3DTransformedDescendant; |
- |
- return has3DTransform(); |
} |
void PaintLayer::updateLayerPosition() { |