WebKit+SVG is missing marker support I believe ksvg2 already actually has marker support for AGG (and possibly Cairo), but I just haven't gotten around to implementing it for the kcanvas Quartz backend. This would be a relatively easy fix for someone with some c++ skills looking to dive into KCanvas. There are several w3c tests for markers, at least these two: painting-marker-01-f.svg painting-marker-02-f.svg Right now you just see a bunch of these logs when running the tests: 2005-10-13 01:19:44.566 DumpKCanvasTree[15508] *** Marker support not implemented. 2005-10-13 01:19:44.567 DumpKCanvasTree[15508] *** Marker support not implemented.
Hi, I recently did some work to fix marker support in ksvg2 again somewhat. It is not perfect, for instance clipping is not correct, but it should fix some testcases. I'll add it so hopefully it helps in porting to OS X. Cheers, Rob.
Created attachment 4445 [details] Improved marker support
Created attachment 4766 [details] Proposed patch for marker support This patch essentially gets the path vertices coords and use them to draw the markers at the correct position. More testing is necessary to see if marker scaling, rotating and so on work correctly.
Created attachment 4767 [details] Improved Patch Pulled out some code from ksvg2. It should improve scaling among other things. SVGMarkerElementImpl::canvasResource
Created attachment 4776 [details] Should solve the markerUnits issue
Comment on attachment 4776 [details] Should solve the markerUnits issue We discussed this on IRC. Still needs some tweaks.
Created attachment 4836 [details] Patch improved with Eric's ideas This patch uses a CGPathApplierFunction to draw the markers. 2 structures are used to help the drawing : MarkerData and DrawMarkersData. In KCanvasRenderingStyle::updateStroke : Solves a problem when using a <marker markerUnits="strokeWidth"> with a <path stroke="none" stroke-width="8"> KCanvasMarker::draw doesn't use objectMatrix as an argument anymore. Modifies KCanvasMarker::draw to setDrawsContents(true) before marker rendering and setDrawsContents(false) after. KCanvasMarker::refX(), KCanvasMarker::refY() => KCanvasMarker::setRef(double refX, double refY) KCanvasMarker::setScaleX(), KCanvasMarker:: setScaleY() => KCanvasMarker::setScale(float scaleX, float scaleY) Adds CGPointSubtractPoints to QuartzSupport.
Comment on attachment 4836 [details] Patch improved with Eric's ideas Looks great!
Your patch produced a regression in all of the layout tests when I attempted to land. The line at fault was: + strokePainter()->setStrokeWidth(cssPrimitiveToLength(item, m_style->svgStyle()->strokeWidth(), 1.0)); which created a strokePainter() even when there was no stroke. (I know this is very confusing code... KCanvasRenderingStyle all needs to go away, and will *soon*.) I instead made cssPrimitiveToLength a static method on KCanvasRenderingStyle and just called it from your drawMarkersIfNeeded function to compute the strokeWidth there, which works even when stroke=none. I made a couple other minor style updates and landed.