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

Unified Diff: Source/core/paint/SVGShapePainter.cpp

Issue 693313003: Factor SVGMarkerPainter into SVGShapePainter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/paint/SVGShapePainter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/SVGShapePainter.cpp
diff --git a/Source/core/paint/SVGShapePainter.cpp b/Source/core/paint/SVGShapePainter.cpp
index 0456a2a8cb44af53492db7145b1858714ef536a7..e0359b324a7b9b448b445409d4801174c94b96db 100644
--- a/Source/core/paint/SVGShapePainter.cpp
+++ b/Source/core/paint/SVGShapePainter.cpp
@@ -6,10 +6,11 @@
#include "core/paint/SVGShapePainter.h"
#include "core/paint/ObjectPainter.h"
-#include "core/paint/SVGMarkerPainter.h"
+#include "core/paint/SVGContainerPainter.h"
#include "core/rendering/GraphicsContextAnnotator.h"
#include "core/rendering/PaintInfo.h"
#include "core/rendering/svg/RenderSVGPath.h"
+#include "core/rendering/svg/RenderSVGResourceMarker.h"
#include "core/rendering/svg/RenderSVGShape.h"
#include "core/rendering/svg/SVGMarkerData.h"
#include "core/rendering/svg/SVGRenderSupport.h"
@@ -162,10 +163,30 @@ void SVGShapePainter::paintMarkers(PaintInfo& paintInfo)
unsigned size = markerPositions->size();
for (unsigned i = 0; i < size; ++i) {
if (RenderSVGResourceMarker* marker = SVGMarkerData::markerForType((*markerPositions)[i].type, markerStart, markerMid, markerEnd))
- SVGMarkerPainter(*marker).paint(paintInfo, (*markerPositions)[i], strokeWidth);
+ paintMarker(paintInfo, *marker, (*markerPositions)[i], strokeWidth);
}
}
+void SVGShapePainter::paintMarker(PaintInfo& paintInfo, RenderSVGResourceMarker& marker, const MarkerPosition& position, float strokeWidth)
+{
+ // An empty viewBox disables rendering.
+ SVGMarkerElement* markerElement = toSVGMarkerElement(marker.element());
+ ASSERT(markerElement);
+ if (markerElement->hasAttribute(SVGNames::viewBoxAttr) && markerElement->viewBox()->currentValue()->isValid() && markerElement->viewBox()->currentValue()->value().isEmpty())
+ return;
+
+ PaintInfo info(paintInfo);
+ GraphicsContextStateSaver stateSaver(*info.context, false);
+ info.applyTransform(marker.markerTransformation(position.origin, position.angle, strokeWidth), &stateSaver);
+
+ if (SVGRenderSupport::isOverflowHidden(&marker)) {
+ stateSaver.saveIfNeeded();
+ info.context->clip(marker.viewport());
+ }
+
+ SVGContainerPainter(marker).paint(info);
+}
+
void SVGShapePainter::strokeZeroLengthLineCaps(GraphicsContext* context)
{
const Vector<FloatPoint>* zeroLengthLineCaps = m_renderSVGShape.zeroLengthLineCaps();
« no previous file with comments | « Source/core/paint/SVGShapePainter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698