Index: third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.h |
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.h b/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.h |
index 9097278a4aae2b30118a8dc070a20c826b9f6d1a..43b7ddb4ea31193fc79ba4d8fd5965f5768e7625 100644 |
--- a/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.h |
+++ b/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.h |
@@ -130,6 +130,43 @@ private: |
AffineTransform m_savedContentTransformation; |
}; |
+// The following enumeration is used to optimize cases where the scale is known |
+// to be invariant (see: LayoutSVGContainer::layout and LayoutSVGroot). The |
+// value 'Full' can be used in the general case when the scale change is |
+// unknown, or known to change. |
+enum class SVGTransformChange { |
+ None, |
+ ScaleInvariant, |
+ Full, |
+}; |
+ |
+// Helper for computing ("classifying") a change to a transform using the |
+// categoies defined above. |
+class SVGTransformChangeDetector { |
+ STACK_ALLOCATED(); |
+public: |
+ explicit SVGTransformChangeDetector(const AffineTransform& previous) |
+ : m_previousTransform(previous) |
+ { |
+ } |
+ |
+ SVGTransformChange computeChange(const AffineTransform& current) |
+ { |
+ if (m_previousTransform == current) |
+ return SVGTransformChange::None; |
+ if (scaleReference(m_previousTransform) == scaleReference(current)) |
+ return SVGTransformChange::ScaleInvariant; |
+ return SVGTransformChange::Full; |
+ } |
+ |
+private: |
+ static std::pair<double, double> scaleReference(const AffineTransform& transform) |
+ { |
+ return std::make_pair(transform.xScaleSquared(), transform.yScaleSquared()); |
+ } |
+ AffineTransform m_previousTransform; |
+}; |
+ |
template <typename LayoutObjectType> |
bool SVGLayoutSupport::computeHasNonIsolatedBlendingDescendants(const LayoutObjectType* object) |
{ |