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

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: Fix marker regression 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
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..b66a352f6f1ae6bc94e1ab7fa29e2f7259ede282 100644
--- a/Source/core/layout/svg/LayoutSVGPath.cpp
+++ b/Source/core/layout/svg/LayoutSVGPath.cpp
@@ -50,10 +50,25 @@ LayoutSVGPath::~LayoutSVGPath()
void LayoutSVGPath::updateShapeFromElement()
{
LayoutSVGShape::updateShapeFromElement();
- processMarkerPositions();
updateZeroLengthSubpaths();
+}
+
+void LayoutSVGPath::updateStrokeAndFillBoundingBoxes()
+{
+ LayoutSVGShape::updateStrokeAndFillBoundingBoxes();
+
+ // TODO(pdr): It would be ideal to only call this in updateShapeFromElement
fs 2015/06/16 10:54:02 I think the first part (line) of this makes sense.
pdr. 2015/06/17 03:50:49 Done
+ // and have marker invalidation call setNeedsShapeUpdate.
+ 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 +106,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))

Powered by Google App Engine
This is Rietveld 408576698