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

Unified Diff: Source/core/layout/svg/LayoutSVGPath.cpp

Issue 1158583003: Reduce how often LayoutSVGShape::updateShapeFromElement is called (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Put selfHasRelativeLengths back Created 5 years, 6 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
« no previous file with comments | « Source/core/layout/svg/LayoutSVGPath.h ('k') | Source/core/layout/svg/LayoutSVGRect.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/svg/LayoutSVGPath.cpp
diff --git a/Source/core/layout/svg/LayoutSVGPath.cpp b/Source/core/layout/svg/LayoutSVGPath.cpp
index 72ccd5e6427f4b16083c99380c8318393c0d6d8e..2d14461c137230652dbb042e1b3687562a1e4c11 100644
--- a/Source/core/layout/svg/LayoutSVGPath.cpp
+++ b/Source/core/layout/svg/LayoutSVGPath.cpp
@@ -50,10 +50,24 @@ LayoutSVGPath::~LayoutSVGPath()
void LayoutSVGPath::updateShapeFromElement()
{
LayoutSVGShape::updateShapeFromElement();
- processMarkerPositions();
updateZeroLengthSubpaths();
+}
+
+void LayoutSVGPath::updateStrokeAndFillBoundingBoxes()
+{
+ LayoutSVGShape::updateStrokeAndFillBoundingBoxes();
+
+ // TODO(pdr): We should only call this in updateShapeFromElement.
+ processMarkerPositions();
+ if (!m_markerPositions.isEmpty())
+ m_strokeBoundingBox.unite(markerRect(strokeWidth()));
- m_strokeBoundingBox = calculateUpdatedStrokeBoundingBox();
+ if (style()->svgStyle().hasStroke()) {
+ // FIXME: zero-length subpaths do not respect vector-effect = non-scaling-stroke.
+ float strokeWidth = this->strokeWidth();
+ for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i)
+ m_strokeBoundingBox.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWidth));
+ }
}
FloatRect LayoutSVGPath::hitTestStrokeBoundingBox() const
@@ -91,23 +105,6 @@ FloatRect LayoutSVGPath::hitTestStrokeBoundingBox() const
return box;
}
-FloatRect LayoutSVGPath::calculateUpdatedStrokeBoundingBox() const
-{
- FloatRect strokeBoundingBox = m_strokeBoundingBox;
-
- if (!m_markerPositions.isEmpty())
- strokeBoundingBox.unite(markerRect(strokeWidth()));
-
- if (style()->svgStyle().hasStroke()) {
- // FIXME: zero-length subpaths do not respect vector-effect = non-scaling-stroke.
- float strokeWidth = this->strokeWidth();
- for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i)
- strokeBoundingBox.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWidth));
- }
-
- return strokeBoundingBox;
-}
-
bool LayoutSVGPath::shapeDependentStrokeContains(const FloatPoint& point)
{
if (LayoutSVGShape::shapeDependentStrokeContains(point))
« no previous file with comments | « Source/core/layout/svg/LayoutSVGPath.h ('k') | Source/core/layout/svg/LayoutSVGRect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698