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

Unified Diff: third_party/WebKit/Source/core/svg/SVGElement.cpp

Issue 2725973003: Add a use-counter for transforms using the reference box on SVG element (Closed)
Patch Set: Rebase; update histograms.xml Created 3 years, 10 months 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/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
//

Powered by Google App Engine
This is Rietveld 408576698