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

Unified Diff: Source/core/rendering/svg/RenderSVGShape.cpp

Issue 701433002: Lazily allocate svg shape transforms, shrink RenderSVGShape by 44B (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Refactor for cleanliness Created 6 years, 1 month 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
« no previous file with comments | « Source/core/rendering/svg/RenderSVGShape.h ('k') | Source/core/svg/SVGGraphicsElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/svg/RenderSVGShape.cpp
diff --git a/Source/core/rendering/svg/RenderSVGShape.cpp b/Source/core/rendering/svg/RenderSVGShape.cpp
index ba966d95be3449e7eb0e36b9f6a72cebb94d4431..5573a80d007fe9b4f2a334bd99a75f19a8f944cc 100644
--- a/Source/core/rendering/svg/RenderSVGShape.cpp
+++ b/Source/core/rendering/svg/RenderSVGShape.cpp
@@ -110,6 +110,19 @@ bool RenderSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke
return shapeDependentStrokeContains(point);
}
+void RenderSVGShape::updateLocalTransform()
+{
+ SVGGraphicsElement* graphicsElement = toSVGGraphicsElement(element());
+ if (graphicsElement->hasAnimatedLocalTransform()) {
+ if (m_localTransform)
+ m_localTransform->setTransform(graphicsElement->calculateAnimatedLocalTransform());
+ else
+ m_localTransform = adoptPtr(new AffineTransform(graphicsElement->calculateAnimatedLocalTransform()));
+ } else {
+ m_localTransform = 0;
+ }
+}
+
void RenderSVGShape::layout()
{
bool updateCachedBoundariesInParents = false;
@@ -123,7 +136,7 @@ void RenderSVGShape::layout()
}
if (m_needsTransformUpdate) {
- m_localTransform = toSVGGraphicsElement(element())->calculateAnimatedLocalTransform();
+ updateLocalTransform();
m_needsTransformUpdate = false;
updateCachedBoundariesInParents = true;
}
@@ -175,7 +188,7 @@ bool RenderSVGShape::nodeAtFloatPoint(const HitTestRequest& request, HitTestResu
return false;
FloatPoint localPoint;
- if (!SVGRenderSupport::transformToUserSpaceAndCheckClipping(this, m_localTransform, pointInParent, localPoint))
+ if (!SVGRenderSupport::transformToUserSpaceAndCheckClipping(this, localToParentTransform(), pointInParent, localPoint))
return false;
PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_GEOMETRY_HITTESTING, request, style()->pointerEvents());
« no previous file with comments | « Source/core/rendering/svg/RenderSVGShape.h ('k') | Source/core/svg/SVGGraphicsElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698