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

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

Issue 14907011: Support 'paint-order' from SVG2. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 8 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/rendering/svg/RenderSVGShape.cpp
diff --git a/Source/core/rendering/svg/RenderSVGShape.cpp b/Source/core/rendering/svg/RenderSVGShape.cpp
index b91234f97685edfefe0b2f677162f855bf9f1216..63e60fc2066925c0a907de4ac2953aee1de9fc8d 100644
--- a/Source/core/rendering/svg/RenderSVGShape.cpp
+++ b/Source/core/rendering/svg/RenderSVGShape.cpp
@@ -248,26 +248,6 @@ void RenderSVGShape::strokeShape(RenderStyle* style, GraphicsContext* context)
}
}
-void RenderSVGShape::fillAndStrokeShape(GraphicsContext* context)
-{
- RenderStyle* style = this->style();
-
- fillShape(style, context);
-
- if (!style->svgStyle()->hasVisibleStroke())
- return;
-
- GraphicsContextStateSaver stateSaver(*context, false);
-
- if (hasNonScalingStroke()) {
- AffineTransform nonScalingTransform = nonScalingStrokeTransform();
- if (!setupNonScalingStrokeContext(nonScalingTransform, stateSaver))
- return;
- }
-
- strokeShape(style, context);
-}
-
void RenderSVGShape::paint(PaintInfo& paintInfo, const LayoutPoint&)
{
if (paintInfo.context->paintingDisabled() || style()->visibility() == HIDDEN || isEmpty())
@@ -290,9 +270,34 @@ void RenderSVGShape::paint(PaintInfo& paintInfo, const LayoutPoint&)
if (svgStyle->shapeRendering() == SR_CRISPEDGES)
childPaintInfo.context->setShouldAntialias(false);
- fillAndStrokeShape(childPaintInfo.context);
- if (!m_markerPositions.isEmpty())
- drawMarkers(childPaintInfo);
+ for (int i = 0; i < 3; i++) {
+ switch(svgStyle->paintOrder(i)) {
+ case PO_FILL:
+ fillShape(this->style(), childPaintInfo.context);
+ break;
+ case PO_STROKE:
+ if (svgStyle->hasVisibleStroke()) {
+ GraphicsContextStateSaver stateSaver(*childPaintInfo.context, false);
+ AffineTransform nonScalingTransform;
+
+ if (hasNonScalingStroke()) {
+ AffineTransform nonScalingTransform = nonScalingStrokeTransform();
+ if (!setupNonScalingStrokeContext(nonScalingTransform, stateSaver))
+ return;
+ }
+
+ strokeShape(this->style(), childPaintInfo.context);
+ }
+ break;
+ case PO_MARKERS:
+ if (!m_markerPositions.isEmpty())
+ drawMarkers(childPaintInfo);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698