Index: third_party/WebKit/Source/core/svg/SVGElement.cpp |
diff --git a/third_party/WebKit/Source/core/svg/SVGElement.cpp b/third_party/WebKit/Source/core/svg/SVGElement.cpp |
index 58a7d3fdf85d115f6b13db43154b8faea23afe88..b2a5fb79897d8b5d2b9a94abed7aa0ba5cdc9830 100644 |
--- a/third_party/WebKit/Source/core/svg/SVGElement.cpp |
+++ b/third_party/WebKit/Source/core/svg/SVGElement.cpp |
@@ -296,6 +296,24 @@ bool SVGElement::hasTransform(ApplyMotionTransform applyMotionTransform) const { |
(applyMotionTransform == IncludeMotionTransform && hasSVGRareData()); |
} |
+static inline bool transformUsesBoxSize( |
+ const ComputedStyle& style, |
+ ComputedStyle::ApplyTransformOrigin applyTransformOrigin) { |
+ if (applyTransformOrigin == ComputedStyle::IncludeTransformOrigin && |
+ (style.transformOriginX().type() == Percent || |
+ style.transformOriginY().type() == Percent) && |
+ style.requireTransformOrigin(ComputedStyle::IncludeTransformOrigin, |
+ ComputedStyle::ExcludeMotionPath)) |
+ return true; |
+ if (style.transform().dependsOnBoxSize()) |
+ return true; |
+ if (style.translate() && style.translate()->dependsOnBoxSize()) |
+ return true; |
+ if (style.hasOffset()) |
+ return true; |
+ return false; |
+} |
+ |
AffineTransform SVGElement::calculateTransform( |
ApplyMotionTransform applyMotionTransform) const { |
const ComputedStyle* style = |
@@ -318,6 +336,9 @@ AffineTransform SVGElement::calculateTransform( |
applyTransformOrigin = ComputedStyle::ExcludeTransformOrigin; |
} |
+ if (transformUsesBoxSize(*style, applyTransformOrigin)) |
+ UseCounter::count(document(), UseCounter::TransformUsesBoxSizeOnSVG); |
+ |
// CSS transforms operate with pre-scaled lengths. To make this work with |
// SVG (which applies the zoom factor globally, at the root level) we |
// |