Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Unified Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp

Issue 2598923002: Update transform paint property's transform-offset on element size changes (Closed)
Patch Set: Only create transform-origin when needed Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 b2f4792cbd2d1d5ef2195439409926d321b9bbe5..02a5eb4c308e1a9be16f905c037932b4f327a49f 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -268,15 +268,6 @@ void PaintPropertyTreeBuilder::updatePaintOffsetTranslation(
}
}
-static FloatPoint3D transformOrigin(const LayoutBox& box) {
- const ComputedStyle& style = box.styleRef();
- FloatSize borderBoxSize(box.size());
- return FloatPoint3D(
- floatValueForLength(style.transformOriginX(), borderBoxSize.width()),
- floatValueForLength(style.transformOriginY(), borderBoxSize.height()),
- style.transformOriginZ());
-}
-
// SVG does not use the general transform update of |updateTransform|, instead
// creating a transform node for SVG-specific transforms without 3D.
void PaintPropertyTreeBuilder::updateTransformForNonRootSVG(
@@ -330,6 +321,18 @@ static CompositingReasons compositingReasonsForTransform(
return compositingReasons;
}
+static FloatPoint3D transformOrigin(const LayoutBox& box) {
+ const ComputedStyle& style = box.styleRef();
+ // Transform origin has no effect without a transform or motion path.
+ if (!style.hasTransform())
+ return FloatPoint3D();
+ FloatSize borderBoxSize(box.size());
+ return FloatPoint3D(
+ floatValueForLength(style.transformOriginX(), borderBoxSize.width()),
+ floatValueForLength(style.transformOriginY(), borderBoxSize.height()),
+ style.transformOriginZ());
+}
+
void PaintPropertyTreeBuilder::updateTransform(
const LayoutObject& object,
PaintPropertyTreeBuilderContext& context) {
@@ -350,10 +353,10 @@ void PaintPropertyTreeBuilder::updateTransform(
// descendants.
if (object.isBox() && (style.hasTransform() || style.preserves3D() ||
compositingReasons != CompositingReasonNone)) {
+ auto& box = toLayoutBox(object);
TransformationMatrix matrix;
style.applyTransform(
- matrix, toLayoutBox(object).size(),
- ComputedStyle::ExcludeTransformOrigin,
+ matrix, box.size(), ComputedStyle::ExcludeTransformOrigin,
ComputedStyle::IncludeMotionPath,
ComputedStyle::IncludeIndependentTransformProperties);
@@ -367,8 +370,7 @@ void PaintPropertyTreeBuilder::updateTransform(
auto& properties = object.getMutableForPainting().ensurePaintProperties();
context.forceSubtreeUpdate |= properties.updateTransform(
- context.current.transform, matrix,
- transformOrigin(toLayoutBox(object)),
+ context.current.transform, matrix, transformOrigin(box),
context.current.shouldFlattenInheritedTransform, renderingContextID,
compositingReasons);
} else {

Powered by Google App Engine
This is Rietveld 408576698