Index: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp |
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp |
index e388aaff88dbc94db86bc74a32d1a0c531bf55e1..69ff7a794652e0303b0845b023528905a3c87b49 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp |
@@ -9,6 +9,7 @@ |
#include "core/frame/Settings.h" |
#include "core/layout/LayoutInline.h" |
#include "core/layout/LayoutView.h" |
+#include "core/layout/compositing/CompositingReasonFinder.h" |
#include "core/layout/svg/LayoutSVGRoot.h" |
#include "core/paint/FindPropertiesNeedingUpdate.h" |
#include "core/paint/ObjectPaintProperties.h" |
@@ -308,6 +309,19 @@ void PaintPropertyTreeBuilder::updateTransformForNonRootSVG( |
} |
} |
+static CompositingReasons compositingReasonsForTransform( |
+ const LayoutObject& object) { |
+ CompositingReasons compositingReasons = CompositingReasonNone; |
+ if (CompositingReasonFinder::requiresCompositingForTransform(object)) |
+ compositingReasons |= CompositingReason3DTransform; |
+ |
+ if (object.styleRef().hasWillChangeCompositingHint() && |
+ !object.styleRef().subtreeWillChangeContents()) |
+ compositingReasons |= CompositingReasonWillChangeCompositingHint; |
+ |
+ return compositingReasons; |
+} |
+ |
void PaintPropertyTreeBuilder::updateTransform( |
const LayoutObject& object, |
PaintPropertyTreeBuilderContext& context) { |
@@ -318,7 +332,16 @@ void PaintPropertyTreeBuilder::updateTransform( |
if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) { |
const ComputedStyle& style = object.styleRef(); |
- if (object.isBox() && (style.hasTransform() || style.preserves3D())) { |
+ |
+ CompositingReasons compositingReasons = |
+ compositingReasonsForTransform(object); |
+ |
+ // A transform node is allocated for transforms, preserves-3d and any |
+ // direct compositing reason. The latter is required because this is the |
+ // only way to represent compositing both an element and its stacking |
+ // descendants. |
+ if (object.isBox() && (style.hasTransform() || style.preserves3D() || |
+ compositingReasons != CompositingReasonNone)) { |
TransformationMatrix matrix; |
style.applyTransform( |
matrix, toLayoutBox(object).size(), |
@@ -338,7 +361,8 @@ void PaintPropertyTreeBuilder::updateTransform( |
context.forceSubtreeUpdate |= properties.updateTransform( |
context.current.transform, matrix, |
transformOrigin(toLayoutBox(object)), |
- context.current.shouldFlattenInheritedTransform, renderingContextID); |
+ context.current.shouldFlattenInheritedTransform, renderingContextID, |
+ compositingReasons); |
} else { |
if (auto* properties = object.getMutableForPainting().paintProperties()) |
context.forceSubtreeUpdate |= properties->clearTransform(); |