[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

zimmermann at webkit.org zimmermann at webkit.org
Thu Apr 8 00:53:36 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit df09220d365adb458badbb0241fe6e1def719331
Author: zimmermann at webkit.org <zimmermann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jan 4 17:31:35 2010 +0000

    2010-01-04  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Dirk Schulze.
    
            Marker code is buggy: referencePoint translation is off
            https://bugs.webkit.org/show_bug.cgi?id=33012
    
            Rewrite marker code, as it had many issues:
            - Correct refX/refY handling (covered by new marker-referencePoint.svg test)
            - Calculate marker bounds on layout time, instead of paint time, to deliver correct repaint rects
            - Cleanup RenderPath code, which was cluttered by marker stuff (outlay in SVGMarkerLayoutInfo)
            - Fix SVGResource assuming that there is only one resource per resource type per element. Markers
              can have three different resources of the same type (three markers, start/mid/end markers)
    
            Filed bug 33115 (PathElementAddQuadCurveToPoint not handled for <marker>), which was just a TODO in the code before.
    
            Fixes all svg/custom/marker*.svg tests, that use dynamic updates (propagation failed before).
            Test: svg/custom/marker-referencePoint.svg
                  svg/custom/marker-opacity.svg
    
            * Android.mk: Add SVGMarkerData.h / SVGMarkerLayoutInfo.(cpp,h) to build.
            * GNUmakefile.am: Ditto.
            * WebCore.pro: Ditto.
            * WebCore.vcproj/WebCore.vcproj: Ditto.
            * WebCore.xcodeproj/project.pbxproj: Ditto.
            * page/FrameView.cpp: Notify RenderSVGRoot children about viewport size changes, just like it's handled for <body> in HTML.
            (WebCore::FrameView::layout): This is important, as marker bounding boxes may depend on the current viewport size through relative coordinates used in <svg>.
            * rendering/RenderPath.cpp:
            (WebCore::RenderPath::markerBoundingBox): Calculates and caches marker boundaries in the layout() phase.
            (WebCore::RenderPath::repaintRectInLocalCoordinates): Use the cached marker bounding box during paint() time.
            (WebCore::RenderPath::setPath): Clear marker boundaries upon path changes.
            (WebCore::RenderPath::paint): Use SVGMarkerLayoutInfo::drawMarkers() instead of the local drawMarkersIfNeeded() function, which is gone now.
            (WebCore::RenderPath::calculateMarkerBoundsIfNeeded): Utilized by markerBoundingBox() to request SVGResourceMarker objects and calculate their boundaries.
            * rendering/RenderPath.h: Store SVGMarkerLayoutInfo objects, and rename m_markerBounds to m_cachedLocalMarkerBBox for consistency.
            (WebCore::RenderPath::path): Inline this accessor.
            * rendering/RenderSVGContainer.h: Make paint() public (to be used from SVGResourceMarker), all other methods protected (to be used from RenderSVGViewportContainer).
            * rendering/RenderSVGViewportContainer.cpp: Remove useless paint() override, as the comment in the code indicated.
            (WebCore::RenderSVGViewportContainer::markerBoundaries): Maps the marker contents repaintRectInLocalCoordinates() into the final coordinate system (see code).
            (WebCore::RenderSVGViewportContainer::markerContentTransformation): Add marker-specific helper method, allowing to make viewportTransform() private again.
            * rendering/RenderSVGViewportContainer.h: Marking viewportTransform() private, it's never meant to be used outside this renderer.
            * rendering/SVGMarkerData.h: Added. Refactored from existing RenderPath code, preserving original copyrights.
            (WebCore::SVGMarkerData::): Helper struct for SVGMarkerLayoutInfo.
            (WebCore::SVGMarkerData::origin): Holds the final computed destination of a marker.
            (WebCore::SVGMarkerData::marker): Holds a pointer to the associated SVGResourceMarker object, which we're aiming to layout.
            (WebCore::SVGMarkerData::currentAngle): Calculates the current angle for a certain marker type (start/mid/end) based upon the computed inslope/outslope values.
            (WebCore::SVGMarkerData::updateTypeAndMarker): Helper method.
            (WebCore::SVGMarkerData::updateOutslope): Ditto.
            (WebCore::SVGMarkerData::updateMarkerDataForPathElement): Does the actual inslope/outslope calculation.
            (WebCore::SVGMarkerData::updateInslope): Helper method.
            * rendering/SVGMarkerLayoutInfo.cpp: Added. New approach to build marker layout info, this time correct during layout() time instead of paint() time.
            (WebCore::SVGMarkerLayoutInfo::SVGMarkerLayoutInfo):
            (WebCore::SVGMarkerLayoutInfo::~SVGMarkerLayoutInfo):
            (WebCore::processStartAndMidMarkers): Static helper method used to visit each path element in order to calculate inslopes/outslopes (-> orientation angles)
            (WebCore::SVGMarkerLayoutInfo::calculateBoundaries): Build list of MarkerLayout objects, used to query boundaries, and to paint markers during drawMarkers().
            (WebCore::SVGMarkerLayoutInfo::drawMarkers): Cheap method walking existing MarkerLayout vector, drawing the individual RenderSVGViewportContainer of the markers.
            (WebCore::SVGMarkerLayoutInfo::addLayoutedMarker): Helper method.
            * rendering/SVGMarkerLayoutInfo.h: Added.
            (WebCore::MarkerLayout::MarkerLayout): Helper struct storing a pair of SVGResourceMarker* and a TranformationMatrix.
            (WebCore::SVGMarkerLayoutInfo::markerData): Public helper methods returning references to private member variables, used from processStartAndMidMarkers.
            (WebCore::SVGMarkerLayoutInfo::midMarker): Ditto.
            (WebCore::SVGMarkerLayoutInfo::elementIndex): Ditto.
            * svg/SVGMarkerElement.cpp: Adopt to name change: setRef() -> setReferencePoint(). setMarker() -> setRenderer()
            (WebCore::SVGMarkerElement::canvasResource): Add ASSERT(renderer()) to clarify that canvasResource() is only meant to used after renderer creation.
            * svg/graphics/SVGResource.cpp: Instead of maintaining a global hashmap between SVGStyledElements and an array of possible SVGResources, use a HashSet of SVGResources
                                            and directly scan the already existing list of clients for a certain SVGResource. This wrong approach has been introduced over two years
                                            ago, making the assumption that there's only one resource type per element. Though markers can provide three resources of the same type
                                            per element (all SVGResourceMarker objects, but in different rules: start/mid/end marker). That information is only available while painting.
            (WebCore::resourceSet): Add global static HashSet<SVGResource*>.
            (WebCore::SVGResource::SVGResource): Add us to the resourceSet.
            (WebCore::SVGResource::~SVGResource): Remove us from resourceSet.
            (WebCore::SVGResource::removeClient): Traverse all SVGResource clients and remove the passed SVGStyledElement from the client list (invoked by SVGStyledElement destructor).
            (WebCore::SVGResource::addClient): Remove the offending part of the old approach, making the wrong assumption regarding resource types.
            * svg/graphics/SVGResourceMarker.cpp:
            (WebCore::SVGResourceMarker::SVGResourceMarker):
            (WebCore::SVGResourceMarker::markerTransformation): Create TransformationMatrix in the local marker content (RenderSVGViewportContainer) coordinate system, to position a marker.
            (WebCore::SVGResourceMarker::draw): Simplify marker drawing a lot: used the passing TransformationMatrix (cached in SVGMarkerLayoutInfo) to draw the marker content renderer.
            (WebCore::SVGResourceMarker::externalRepresentation): Adopt to refX/refY -> referencePoint changes.
            * svg/graphics/SVGResourceMarker.h: Store a FloatPoint m_referecePoint instead of two refX/refY float values.
            (WebCore::SVGResourceMarker::setRenderer): Renamed from setMarker().
            (WebCore::SVGResourceMarker::setReferencePoint): Renamed from setRef().
            (WebCore::SVGResourceMarker::referencePoint): New accessor replacing refX() / refY().
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52745 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index e9a6e63..dca6208 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,5 +1,44 @@
 2010-01-04  Nikolas Zimmermann  <nzimmermann at rim.com>
 
+        Reviewed by Dirk Schulze.
+
+        Marker code is buggy: referencePoint translation is off
+        https://bugs.webkit.org/show_bug.cgi?id=33012
+
+        Update SVG test baseline, after rewriting marker support.
+
+        * platform/mac/svg/W3C-SVG-1.1/painting-marker-01-f-expected.txt:
+        * platform/mac/svg/W3C-SVG-1.1/painting-marker-02-f-expected.txt:
+        * platform/mac/svg/W3C-SVG-1.1/painting-marker-03-f-expected.txt:
+        * platform/mac/svg/custom/circular-marker-reference-1-expected.txt:
+        * platform/mac/svg/custom/circular-marker-reference-2-expected.txt:
+        * platform/mac/svg/custom/circular-marker-reference-3-expected.txt:
+        * platform/mac/svg/custom/circular-marker-reference-4-expected.txt:
+        * platform/mac/svg/custom/js-late-marker-and-object-creation-expected.txt:
+        * platform/mac/svg/custom/js-late-marker-creation-expected.txt:
+        * platform/mac/svg/custom/marker-changes-expected.checksum:
+        * platform/mac/svg/custom/marker-changes-expected.png:
+        * platform/mac/svg/custom/marker-changes-expected.txt:
+        * platform/mac/svg/custom/marker-child-changes-expected.checksum:
+        * platform/mac/svg/custom/marker-child-changes-expected.png:
+        * platform/mac/svg/custom/marker-child-changes-expected.txt:
+        * platform/mac/svg/custom/marker-default-width-height-expected.txt:
+        * platform/mac/svg/custom/marker-opacity-expected.checksum: Added.
+        * platform/mac/svg/custom/marker-opacity-expected.png: Added.
+        * platform/mac/svg/custom/marker-opacity-expected.txt: Added.
+        * platform/mac/svg/custom/marker-referencePoint-expected.checksum: Added.
+        * platform/mac/svg/custom/marker-referencePoint-expected.png: Added.
+        * platform/mac/svg/custom/marker-referencePoint-expected.txt: Added.
+        * platform/mac/svg/custom/marker-viewBox-changes-expected.checksum:
+        * platform/mac/svg/custom/marker-viewBox-changes-expected.png:
+        * platform/mac/svg/custom/marker-viewBox-changes-expected.txt:
+        * platform/mac/svg/custom/non-circular-marker-reference-expected.txt:
+        * platform/mac/svg/custom/shapes-supporting-markers-expected.txt:
+        * svg/custom/marker-opacity.svg: Added.
+        * svg/custom/marker-referencePoint.svg: Added.
+
+2010-01-04  Nikolas Zimmermann  <nzimmermann at rim.com>
+
         Not reviewed. Fix typo in test name.
 
         * platform/win/Skipped:
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/painting-marker-01-f-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/painting-marker-01-f-expected.txt
index 05d9b91..57af453 100644
--- a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/painting-marker-01-f-expected.txt
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/painting-marker-01-f-expected.txt
@@ -21,7 +21,7 @@ layer at (0,0) size 480x360
       RenderSVGText {text} at (170,30) size 90x16 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,-13) size 90x16
           chunk 1 text run 1 at (170.00,30.00) startOffset 0 endOffset 13 width 90.00: "Basic Markers"
-      RenderPath {path} at (130,36) size 54x54 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M130.00,40.00 L180.00,40.00 L180.00,90.00"]
+      RenderPath {path} at (122,32) size 66x66 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M130.00,40.00 L180.00,40.00 L180.00,90.00"]
       RenderSVGContainer {g} at (242,32) size 66x66 [transform={m=((1.00,0.00)(0.00,1.00)) t=(120.00,0.00)}]
         RenderPath {path} at (250,36) size 54x54 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [data="M130.00,40.00 L180.00,40.00 L180.00,90.00"]
         RenderSVGContainer {g} at (242,32) size 16x16 [transform={m=((1.60,0.00)(0.00,1.60)) t=(122.00,32.00)}]
@@ -33,7 +33,7 @@ layer at (0,0) size 480x360
       RenderSVGText {text} at (145,125) size 137x16 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,-13) size 137x16
           chunk 1 text run 1 at (145.00,125.00) startOffset 0 endOffset 21 width 137.00: "Start, Middle and End"
-      RenderPath {path} at (130,131) size 54x54 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [start marker=markerStart] [middle marker=markerMiddle] [end marker=markerEnd] [data="M130.00,135.00 L180.00,135.00 L180.00,185.00"]
+      RenderPath {path} at (122,127) size 66x66 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [start marker=markerStart] [middle marker=markerMiddle] [end marker=markerEnd] [data="M130.00,135.00 L180.00,135.00 L180.00,185.00"]
       RenderSVGContainer {g} at (242,127) size 66x66 [transform={m=((1.00,0.00)(0.00,1.00)) t=(120.00,0.00)}]
         RenderPath {path} at (250,131) size 54x54 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [data="M130.00,135.00 L180.00,135.00 L180.00,185.00"]
         RenderSVGContainer {g} at (242,127) size 16x16 [transform={m=((1.60,0.00)(0.00,1.60)) t=(122.00,127.00)}]
@@ -45,7 +45,7 @@ layer at (0,0) size 480x360
       RenderSVGText {text} at (145,220) size 137x16 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,-13) size 137x16
           chunk 1 text run 1 at (145.00,220.00) startOffset 0 endOffset 21 width 137.00: "Automatic Orientation"
-      RenderPath {path} at (130,226) size 54x54 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [start marker=marker2] [middle marker=marker2] [end marker=marker2] [data="M130.00,230.00 L180.00,230.00 L180.00,280.00"]
+      RenderPath {path} at (122,218.69) size 69.31x69.31 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [start marker=marker2] [middle marker=marker2] [end marker=marker2] [data="M130.00,230.00 L180.00,230.00 L180.00,280.00"]
       RenderSVGContainer {g} at (242,218.69) size 69.31x69.31 [transform={m=((1.00,0.00)(0.00,1.00)) t=(120.00,0.00)}]
         RenderPath {path} at (250,226) size 54x54 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [data="M130.00,230.00 L180.00,230.00 L180.00,280.00"]
         RenderSVGContainer {g} at (242,222) size 16x16 [transform={m=((1.60,0.00)(0.00,1.60)) t=(122.00,222.00)}]
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/painting-marker-02-f-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/painting-marker-02-f-expected.txt
index 821ef25..7c98394 100644
--- a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/painting-marker-02-f-expected.txt
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/painting-marker-02-f-expected.txt
@@ -19,7 +19,7 @@ layer at (0,0) size 480x360
         RenderSVGText {text} at (100,140) size 54x11 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,-9) size 54x11
             chunk 1 text run 1 at (100.00,140.00) startOffset 0 endOffset 13 width 54.00: "Fill Property"
-        RenderPath {path} at (30,60) size 50x50 [fill={[type=SOLID] [color=#000000]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M30.00,60.00 L80.00,60.00 L80.00,110.00 Z"]
+        RenderPath {path} at (22,52) size 66x66 [fill={[type=SOLID] [color=#000000]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M30.00,60.00 L80.00,60.00 L80.00,110.00 Z"]
         RenderSVGContainer {g} at (142,52) size 66x66 [transform={m=((1.00,0.00)(0.00,1.00)) t=(120.00,0.00)}]
           RenderPath {path} at (150,60) size 50x50 [fill={[type=SOLID] [color=#000000]}] [data="M30.00,60.00 L80.00,60.00 L80.00,110.00 Z"]
           RenderSVGContainer {g} at (142,52) size 16x16 [transform={m=((8.00,0.00)(0.00,8.00)) t=(22.00,52.00)}]
@@ -40,7 +40,7 @@ layer at (0,0) size 480x360
         RenderSVGText {text} at (340,140) size 72x11 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,-9) size 72x11
             chunk 1 text run 1 at (340.00,140.00) startOffset 0 endOffset 15 width 72.00: "Stroke Property"
-        RenderPath {path} at (265.17,58) size 56.83x56.83 [stroke={[type=SOLID] [color=#000000] [stroke width=4.00]}] [start marker=marker2] [middle marker=marker2] [end marker=marker2] [data="M270.00,60.00 L320.00,60.00 L320.00,110.00 Z"]
+        RenderPath {path} at (260.40,50.40) size 69.20x69.20 [stroke={[type=SOLID] [color=#000000] [stroke width=4.00]}] [start marker=marker2] [middle marker=marker2] [end marker=marker2] [data="M270.00,60.00 L320.00,60.00 L320.00,110.00 Z"]
         RenderSVGContainer {g} at (382,52) size 66x66 [transform={m=((1.00,0.00)(0.00,1.00)) t=(120.00,0.00)}]
           RenderPath {path} at (385.17,58) size 56.83x56.83 [stroke={[type=SOLID] [color=#000000] [stroke width=4.00]}] [data="M270.00,60.00 L320.00,60.00 L320.00,110.00 Z"]
           RenderSVGContainer {g} at (382,52) size 16x16 [transform={m=((4.00,0.00)(0.00,4.00)) t=(262.00,52.00)}]
@@ -60,11 +60,11 @@ layer at (0,0) size 480x360
           RenderPath {rect} at (-0.80,-0.80) size 5.60x5.60 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00 L20.00,0.00 L20.00,20.00 L0.00,20.00 Z"]
         RenderSVGViewportContainer {marker} at (-0.80,-0.80) size 5.60x5.60
           RenderPath {rect} at (-0.80,-0.80) size 5.60x5.60 [stroke={[type=SOLID] [color=#0000FF] [stroke width=4.00]}] [fill={[type=SOLID] [color=#000000]}] [data="M0.00,0.00 L10.00,0.00 L10.00,10.00 L0.00,10.00 Z"]
-      RenderSVGContainer {g} at (25.17,182) size 182.83x90
+      RenderSVGContainer {g} at (18.80,178.80) size 189.20x93.20
         RenderSVGText {text} at (90,270) size 77x11 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,-9) size 77x11
             chunk 1 text run 1 at (90.00,270.00) startOffset 0 endOffset 16 width 77.00: "Mixed Properties"
-        RenderPath {path} at (25.17,188) size 56.83x56.83 [stroke={[type=SOLID] [color=#800080] [stroke width=4.00]}] [fill={[type=SOLID] [color=#FF0000]}] [start marker=marker3] [middle marker=marker3] [end marker=marker3] [data="M30.00,190.00 L80.00,190.00 L80.00,240.00 Z"]
+        RenderPath {path} at (18.80,178.80) size 72.40x72.40 [stroke={[type=SOLID] [color=#800080] [stroke width=4.00]}] [fill={[type=SOLID] [color=#FF0000]}] [start marker=marker3] [middle marker=marker3] [end marker=marker3] [data="M30.00,190.00 L80.00,190.00 L80.00,240.00 Z"]
         RenderSVGContainer {g} at (142,182) size 66x66 [transform={m=((1.00,0.00)(0.00,1.00)) t=(120.00,0.00)}]
           RenderPath {path} at (145.17,188) size 56.83x56.83 [stroke={[type=SOLID] [color=#800080] [stroke width=4.00]}] [fill={[type=SOLID] [color=#FF0000]}] [data="M30.00,190.00 L80.00,190.00 L80.00,240.00 Z"]
           RenderSVGContainer {g} at (142,182) size 66x66
@@ -80,11 +80,11 @@ layer at (0,0) size 480x360
               RenderSVGContainer {g} at (192,232) size 16x16 [clip path="overflowHiddenClip"]
                 RenderSVGContainer {g} at (188.80,228.80) size 22.40x22.40 [transform={m=((0.20,0.00)(0.00,0.20)) t=(0.00,0.00)}]
                   RenderPath {rect} at (188.80,228.80) size 22.40x22.40 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00 L20.00,0.00 L20.00,20.00 L0.00,20.00 Z"]
-      RenderSVGContainer {g} at (265.17,182) size 182.83x90
+      RenderSVGContainer {g} at (258.80,178.80) size 189.20x93.20
         RenderSVGText {text} at (340,270) size 77x11 contains 1 chunk(s)
           RenderSVGInlineText {#text} at (0,-9) size 77x11
             chunk 1 text run 1 at (340.00,270.00) startOffset 0 endOffset 16 width 77.00: "Mixed Properties"
-        RenderPath {path} at (265.17,188) size 56.83x56.83 [stroke={[type=SOLID] [color=#800080] [stroke width=4.00]}] [fill={[type=SOLID] [color=#FF0000]}] [start marker=marker4] [middle marker=marker4] [end marker=marker4] [data="M270.00,190.00 L320.00,190.00 L320.00,240.00 Z"]
+        RenderPath {path} at (258.80,178.80) size 72.40x72.40 [stroke={[type=SOLID] [color=#800080] [stroke width=4.00]}] [fill={[type=SOLID] [color=#FF0000]}] [start marker=marker4] [middle marker=marker4] [end marker=marker4] [data="M270.00,190.00 L320.00,190.00 L320.00,240.00 Z"]
         RenderSVGContainer {g} at (382,182) size 66x66 [transform={m=((1.00,0.00)(0.00,1.00)) t=(120.00,0.00)}]
           RenderPath {path} at (385.17,188) size 56.83x56.83 [stroke={[type=SOLID] [color=#800080] [stroke width=4.00]}] [fill={[type=SOLID] [color=#FF0000]}] [data="M270.00,190.00 L320.00,190.00 L320.00,240.00 Z"]
           RenderSVGContainer {g} at (382,182) size 66x66
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/painting-marker-03-f-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/painting-marker-03-f-expected.txt
index 2b9dcf5..05194d6 100644
--- a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/painting-marker-03-f-expected.txt
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/painting-marker-03-f-expected.txt
@@ -15,21 +15,21 @@ layer at (0,0) size 480x360
     RenderSVGText {text} at (170,70) size 140x23 contains 1 chunk(s)
       RenderSVGInlineText {#text} at (0,-18) size 140x23
         chunk 1 (middle anchor) text run 1 at (170.00,70.00) startOffset 0 endOffset 17 width 140.00: "'marker' property"
-    RenderSVGContainer {g} at (59.50,79.50) size 360.83x81 [transform={m=((1.00,0.00)(0.00,1.00)) t=(50.00,20.00)}] [start marker=marker1] [middle marker=marker1] [end marker=marker1]
-      RenderPath {path} at (59.50,79.50) size 81x81 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M10.00,60.00 C63.33,60.00,90.00,86.67,90.00,140.00 C36.67,140.00,10.00,113.33,10.00,60.00 Z M10.00,140.00 C10.00,86.67,36.67,60.00,90.00,60.00 C90.00,113.33,63.33,140.00,10.00,140.00 Z M50.00,70.00 L80.00,100.00 L50.00,130.00 L20.00,100.00 Z"]
-      RenderPath {polygon} at (149.50,79.88) size 81x80.24 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M100.00,60.00 L120.00,140.00 L140.00,60.00 L160.00,140.00 L180.00,60.00 L180.00,100.00 L100.00,100.00 Z"]
-      RenderPath {polyline} at (239.51,79.88) size 80.99x80.24 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M190.00,60.00 L210.00,140.00 L230.00,60.00 L250.00,140.00 L270.00,60.00 L270.00,100.00 L190.00,100.00"]
-      RenderPath {line} at (329.67,79.63) size 90.66x80.75 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M280.00,60.00 L370.00,140.00"]
-      RenderPath {line} at (329.67,79.63) size 90.66x80.75 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M370.00,60.00 L280.00,140.00"]
+    RenderSVGContainer {g} at (57.50,77.50) size 365x85 [transform={m=((1.00,0.00)(0.00,1.00)) t=(50.00,20.00)}] [start marker=marker1] [middle marker=marker1] [end marker=marker1]
+      RenderPath {path} at (57.50,77.50) size 85x85 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M10.00,60.00 C63.33,60.00,90.00,86.67,90.00,140.00 C36.67,140.00,10.00,113.33,10.00,60.00 Z M10.00,140.00 C10.00,86.67,36.67,60.00,90.00,60.00 C90.00,113.33,63.33,140.00,10.00,140.00 Z M50.00,70.00 L80.00,100.00 L50.00,130.00 L20.00,100.00 Z"]
+      RenderPath {polygon} at (147.50,77.50) size 85x85 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M100.00,60.00 L120.00,140.00 L140.00,60.00 L160.00,140.00 L180.00,60.00 L180.00,100.00 L100.00,100.00 Z"]
+      RenderPath {polyline} at (237.50,77.50) size 85x85 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M190.00,60.00 L210.00,140.00 L230.00,60.00 L250.00,140.00 L270.00,60.00 L270.00,100.00 L190.00,100.00"]
+      RenderPath {line} at (327.50,77.50) size 95x85 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M280.00,60.00 L370.00,140.00"]
+      RenderPath {line} at (327.50,77.50) size 95x85 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M370.00,60.00 L280.00,140.00"]
     RenderSVGText {text} at (27,200) size 426x23 contains 1 chunk(s)
       RenderSVGInlineText {#text} at (0,-18) size 426x23
         chunk 1 (middle anchor) text run 1 at (27.00,200.00) startOffset 0 endOffset 53 width 426.00: "'marker-start', 'marker-mid' & 'marker-end' attribute"
-    RenderSVGContainer {g} at (59.50,209.50) size 360.83x81 [transform={m=((1.00,0.00)(0.00,1.00)) t=(50.00,150.00)}] [start marker=marker1] [middle marker=marker1] [end marker=marker1]
-      RenderPath {path} at (59.50,209.50) size 81x81 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M10.00,60.00 C63.33,60.00,90.00,86.67,90.00,140.00 C36.67,140.00,10.00,113.33,10.00,60.00 Z M10.00,140.00 C10.00,86.67,36.67,60.00,90.00,60.00 C90.00,113.33,63.33,140.00,10.00,140.00 Z M50.00,70.00 L80.00,100.00 L50.00,130.00 L20.00,100.00 Z"]
-      RenderPath {polygon} at (149.50,209.88) size 81x80.24 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M100.00,60.00 L120.00,140.00 L140.00,60.00 L160.00,140.00 L180.00,60.00 L180.00,100.00 L100.00,100.00 Z"]
-      RenderPath {polyline} at (239.51,209.88) size 80.99x80.24 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M190.00,60.00 L210.00,140.00 L230.00,60.00 L250.00,140.00 L270.00,60.00 L270.00,100.00 L190.00,100.00"]
-      RenderPath {line} at (329.67,209.63) size 90.66x80.75 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M280.00,60.00 L370.00,140.00"]
-      RenderPath {line} at (329.67,209.63) size 90.66x80.75 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M370.00,60.00 L280.00,140.00"]
+    RenderSVGContainer {g} at (57.50,207.50) size 365x85 [transform={m=((1.00,0.00)(0.00,1.00)) t=(50.00,150.00)}] [start marker=marker1] [middle marker=marker1] [end marker=marker1]
+      RenderPath {path} at (57.50,207.50) size 85x85 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M10.00,60.00 C63.33,60.00,90.00,86.67,90.00,140.00 C36.67,140.00,10.00,113.33,10.00,60.00 Z M10.00,140.00 C10.00,86.67,36.67,60.00,90.00,60.00 C90.00,113.33,63.33,140.00,10.00,140.00 Z M50.00,70.00 L80.00,100.00 L50.00,130.00 L20.00,100.00 Z"]
+      RenderPath {polygon} at (147.50,207.50) size 85x85 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M100.00,60.00 L120.00,140.00 L140.00,60.00 L160.00,140.00 L180.00,60.00 L180.00,100.00 L100.00,100.00 Z"]
+      RenderPath {polyline} at (237.50,207.50) size 85x85 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M190.00,60.00 L210.00,140.00 L230.00,60.00 L250.00,140.00 L270.00,60.00 L270.00,100.00 L190.00,100.00"]
+      RenderPath {line} at (327.50,207.50) size 95x85 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M280.00,60.00 L370.00,140.00"]
+      RenderPath {line} at (327.50,207.50) size 95x85 [stroke={[type=SOLID] [color=#000000]}] [fill={[type=SOLID] [color=#FFD700] [fill rule=EVEN-ODD]}] [start marker=marker1] [middle marker=marker1] [end marker=marker1] [data="M370.00,60.00 L280.00,140.00"]
     RenderSVGText {text} at (10,340) size 264x46 contains 1 chunk(s)
       RenderSVGInlineText {#text} at (0,-36) size 264x46
         chunk 1 text run 1 at (10.00,340.00) startOffset 0 endOffset 16 width 264.00: "$Revision: 1.9 $"
diff --git a/LayoutTests/platform/mac/svg/custom/circular-marker-reference-1-expected.txt b/LayoutTests/platform/mac/svg/custom/circular-marker-reference-1-expected.txt
index b45d339..650ff31 100644
--- a/LayoutTests/platform/mac/svg/custom/circular-marker-reference-1-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/circular-marker-reference-1-expected.txt
@@ -2,8 +2,8 @@ KCanvasResource {id="mark" [type=MARKER] [angle=0.00] [ref x=4.00 y=4.00]}
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (235,345) size 330x30
+  RenderSVGRoot {svg} at (108.67,265.08) size 458.91x109.92
     RenderSVGHiddenContainer {defs} at (0,0) size 0x0
-      RenderSVGViewportContainer {marker} at (-2.06,-0.94) size 4.12x0.38
-        RenderPath {path} at (-2.06,-0.94) size 4.12x0.38 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M-5.00,-2.00 L0.00,-2.00 L5.00,-2.00"]
-    RenderPath {path} at (235,345) size 330x30 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M-5.00,2.00 L0.00,2.00 L5.00,2.00"]
+      RenderSVGViewportContainer {marker} at (-3.21,-1.66) size 5.30x1.10
+        RenderPath {path} at (-3.21,-1.66) size 5.30x1.10 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M-5.00,-2.00 L0.00,-2.00 L5.00,-2.00"]
+    RenderPath {path} at (108.67,265.08) size 458.91x109.92 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M-5.00,2.00 L0.00,2.00 L5.00,2.00"]
diff --git a/LayoutTests/platform/mac/svg/custom/circular-marker-reference-2-expected.txt b/LayoutTests/platform/mac/svg/custom/circular-marker-reference-2-expected.txt
index a6162bd..d8d8283 100644
--- a/LayoutTests/platform/mac/svg/custom/circular-marker-reference-2-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/circular-marker-reference-2-expected.txt
@@ -2,9 +2,9 @@ KCanvasResource {id="mark" [type=MARKER] [angle=0.00] [ref x=4.00 y=4.00]}
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (235,225) size 330x150 [start marker=mark] [middle marker=mark] [end marker=mark]
+  RenderSVGRoot {svg} at (210.63,200.63) size 378.74x198.74 [start marker=mark] [middle marker=mark] [end marker=mark]
     RenderSVGHiddenContainer {defs} at (0,0) size 0x0 [start marker=mark] [middle marker=mark] [end marker=mark]
       RenderSVGViewportContainer {marker} at (0.19,0.19) size 2.62x2.62 [start marker=mark] [middle marker=mark] [end marker=mark]
         RenderPath {circle} at (0.19,0.19) size 2.62x2.62 [stroke={[type=SOLID] [color=#FF0000] [line cap=ROUND]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M7.00,4.00 L6.99,4.19 L6.98,4.38 L6.95,4.56 L6.91,4.75 L6.85,4.93 L6.79,5.10 L6.71,5.28 L6.63,5.45 L6.53,5.61 L6.43,5.76 L6.31,5.91 L6.19,6.05 L6.05,6.19 L5.91,6.31 L5.76,6.43 L5.61,6.53 L5.45,6.63 L5.28,6.71 L5.10,6.79 L4.93,6.85 L4.75,6.91 L4.56,6.95 L4.38,6.98 L4.19,6.99 L4.00,7.00 L3.81,6.99 L3.62,6.98 L3.44,6.95 L3.25,6.91 L3.07,6.85 L2.90,6.79 L2.72,6.71 L2.55,6.63 L2.39,6.53 L2.24,6.43 L2.09,6.31 L1.95,6.19 L1.81,6.05 L1.69,5.91 L1.57,5.76 L1.47,5.61 L1.37,5.45 L1.29,5.28 L1.21,5.10 L1.15,4.93 L1.09,4.75 L1.05,4.56 L1.02,4.38 L1.01,4.19 L1.00,4.00 L1.01,3.81 L1.02,3.62 L1.05,3.44 L1.09,3.25 L1.15,3.07 L1.21,2.90 L1.29,2.72 L1.37,2.55 L1.47,2.39 L1.57,2.24 L1.69,2.09 L1.81,1.95 L1.95,1.81 L2.09,1.69 L2.24,1.57 L2.39,1.47 L2.55,1.37 L2.72,1.29 L2.90,1.21 L3.07,1.15 L3.25,1.09 L3.44,1.05 L3.62,1.02 L3.81,1.01 L4.00,1.00 L4.19,1.01 L4.38,1.02 L4.56,1.05 L4.75,1.09 L4.93,1.15 L5.10,1.21 L5.28,1.29 L5.45,1.37 L5.61,1.47 L5.76,1.57 L5.91,1.69 L6.05,1.81 L6.19,1.95 L6.31,2.09 L6.43,2.24 L6.53,2.39 L6.63,2.55 L6.71,2.72 L6.79,2.90 L6.85,3.07 L6.91,3.25 L6.95,3.44 L6.98,3.62 L6.99,3.81 Z"]
-    RenderPath {path} at (235,225) size 330x30 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M-5.00,-2.00 L0.00,-2.00 L5.00,-2.00"]
-    RenderPath {path} at (235,345) size 330x30 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M-5.00,2.00 L0.00,2.00 L5.00,2.00"]
+    RenderPath {path} at (210.63,200.63) size 378.74x78.74 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M-5.00,-2.00 L0.00,-2.00 L5.00,-2.00"]
+    RenderPath {path} at (210.63,320.63) size 378.74x78.74 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M-5.00,2.00 L0.00,2.00 L5.00,2.00"]
diff --git a/LayoutTests/platform/mac/svg/custom/circular-marker-reference-3-expected.txt b/LayoutTests/platform/mac/svg/custom/circular-marker-reference-3-expected.txt
index 51d8478..bc46158 100644
--- a/LayoutTests/platform/mac/svg/custom/circular-marker-reference-3-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/circular-marker-reference-3-expected.txt
@@ -2,8 +2,8 @@ KCanvasResource {id="mark" [type=MARKER] [angle=0.00] [ref x=4.00 y=4.00]}
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (235,345) size 330x30 [start marker=mark] [middle marker=mark] [end marker=mark]
+  RenderSVGRoot {svg} at (108.67,265.08) size 458.91x109.92 [start marker=mark] [middle marker=mark] [end marker=mark]
     RenderSVGHiddenContainer {defs} at (0,0) size 0x0 [start marker=mark] [middle marker=mark] [end marker=mark]
-      RenderSVGViewportContainer {marker} at (-2.06,-0.94) size 4.12x0.38 [start marker=mark] [middle marker=mark] [end marker=mark]
-        RenderPath {path} at (-2.06,-0.94) size 4.12x0.38 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M-5.00,-2.00 L0.00,-2.00 L5.00,-2.00"]
-    RenderPath {path} at (235,345) size 330x30 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M-5.00,2.00 L0.00,2.00 L5.00,2.00"]
+      RenderSVGViewportContainer {marker} at (-3.21,-1.66) size 5.30x1.10 [start marker=mark] [middle marker=mark] [end marker=mark]
+        RenderPath {path} at (-3.21,-1.66) size 5.30x1.10 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M-5.00,-2.00 L0.00,-2.00 L5.00,-2.00"]
+    RenderPath {path} at (108.67,265.08) size 458.91x109.92 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M-5.00,2.00 L0.00,2.00 L5.00,2.00"]
diff --git a/LayoutTests/platform/mac/svg/custom/circular-marker-reference-4-expected.txt b/LayoutTests/platform/mac/svg/custom/circular-marker-reference-4-expected.txt
index e94a842..e73a97f 100644
--- a/LayoutTests/platform/mac/svg/custom/circular-marker-reference-4-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/circular-marker-reference-4-expected.txt
@@ -3,9 +3,9 @@ KCanvasResource {id="mark2" [type=MARKER] [angle=0.00] [ref x=4.00 y=4.00]}
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (235,271.88) size 330x103.12
-    RenderSVGViewportContainer {marker} at (338.12,271.88) size 123.75x11.25
-      RenderPath {path} at (338.12,271.88) size 123.75x11.25 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark2] [middle marker=mark2] [end marker=mark2] [data="M-5.00,-2.00 L0.00,-2.00 L5.00,-2.00"]
-    RenderSVGViewportContainer {marker} at (338.12,316.88) size 123.75x11.25
-      RenderPath {path} at (338.12,316.88) size 123.75x11.25 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark1] [middle marker=mark1] [end marker=mark1] [data="M-5.00,2.00 L0.00,2.00 L5.00,2.00"]
-    RenderPath {path} at (235,345) size 330x30 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark1] [middle marker=mark1] [end marker=mark1] [data="M-5.00,2.00 L0.00,2.00 L5.00,2.00"]
+  RenderSVGRoot {svg} at (95.75,258.78) size 472.09x116.22
+    RenderSVGViewportContainer {marker} at (290.75,258.78) size 172.09x24.35
+      RenderPath {path} at (290.75,258.78) size 172.09x24.35 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark2] [middle marker=mark2] [end marker=mark2] [data="M-5.00,-2.00 L0.00,-2.00 L5.00,-2.00"]
+    RenderSVGViewportContainer {marker} at (303.67,295.08) size 158.91x33.05
+      RenderPath {path} at (303.67,295.08) size 158.91x33.05 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark1] [middle marker=mark1] [end marker=mark1] [data="M-5.00,2.00 L0.00,2.00 L5.00,2.00"]
+    RenderPath {path} at (95.75,273.78) size 472.09x101.22 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark1] [middle marker=mark1] [end marker=mark1] [data="M-5.00,2.00 L0.00,2.00 L5.00,2.00"]
diff --git a/LayoutTests/platform/mac/svg/custom/js-late-marker-and-object-creation-expected.txt b/LayoutTests/platform/mac/svg/custom/js-late-marker-and-object-creation-expected.txt
index bb83985..67641b8 100644
--- a/LayoutTests/platform/mac/svg/custom/js-late-marker-and-object-creation-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/js-late-marker-and-object-creation-expected.txt
@@ -4,7 +4,7 @@ KCanvasResource {id="markerMiddle" [type=MARKER] [angle=0.00] [ref x=5.00 y=5.00
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (216.67,218.33) size 90.00x90
+  RenderSVGRoot {svg} at (203.33,211.67) size 110x110.00
     RenderSVGHiddenContainer {defs} at (0,0) size 0x0
       RenderSVGViewportContainer {marker} at (0,0) size 2x2
         RenderPath {rect} at (0,0) size 2x2 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L10.00,0.00 L10.00,10.00 L0.00,10.00 Z"]
@@ -12,5 +12,5 @@ layer at (0,0) size 800x600
         RenderPath {path} at (0,0) size 2x2 [fill={[type=SOLID] [color=#0000FF]}] [data="M5.00,0.00 L10.00,10.00 L0.00,10.00 Z"]
       RenderSVGViewportContainer {marker} at (0,0) size 2x2
         RenderPath {circle} at (0,0) size 2x2 [fill={[type=SOLID] [color=#008000]}] [data="M10.00,5.00 L9.99,5.31 L9.96,5.63 L9.91,5.94 L9.84,6.24 L9.76,6.55 L9.65,6.84 L9.52,7.13 L9.38,7.41 L9.22,7.68 L9.05,7.94 L8.85,8.19 L8.64,8.42 L8.42,8.64 L8.19,8.85 L7.94,9.05 L7.68,9.22 L7.41,9.38 L7.13,9.52 L6.84,9.65 L6.55,9.76 L6.24,9.84 L5.94,9.91 L5.63,9.96 L5.31,9.99 L5.00,10.00 L4.69,9.99 L4.37,9.96 L4.06,9.91 L3.76,9.84 L3.45,9.76 L3.16,9.65 L2.87,9.52 L2.59,9.38 L2.32,9.22 L2.06,9.05 L1.81,8.85 L1.58,8.64 L1.36,8.42 L1.15,8.19 L0.95,7.94 L0.78,7.68 L0.62,7.41 L0.48,7.13 L0.35,6.84 L0.24,6.55 L0.16,6.24 L0.09,5.94 L0.04,5.63 L0.01,5.31 L0.00,5.00 L0.01,4.69 L0.04,4.37 L0.09,4.06 L0.16,3.76 L0.24,3.45 L0.35,3.16 L0.48,2.87 L0.62,2.59 L0.78,2.32 L0.95,2.06 L1.15,1.81 L1.36,1.58 L1.58,1.36 L1.81,1.15 L2.06,0.95 L2.32,0.78 L2.59,0.62 L2.87,0.48 L3.16,0.35 L3.45,0.24 L3.76,0.16 L4.06,0.09 L4.37,0.04 L4.69,0.01 L5.00,0.00 L5.31,0.01 L5.63,0.04 L5.94,0.09 L6.24,0.16 L6.55,0.24 L6.84,0.35 L7.13,0.48 L7.41,0.62 L7.68,0.78 L7.94,0.95 L8.19,1.15 L8.42,1.36 L8.64,1.58 L8.85,1.81 L9.05,2.06 L9.22,2.32 L9.38,2.59 L9.52,2.87 L9.65,3.16 L9.76,3.45 L9.84,3.76 L9.91,4.06 L9.96,4.37 L9.99,4.69 Z"]
-    RenderSVGContainer {g} at (216.67,218.33) size 90.00x90
-      RenderPath {path} at (216.67,218.33) size 90.00x90 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [start marker=markerStart] [middle marker=markerMiddle] [end marker=markerEnd] [data="M130.00,135.00 L180.00,135.00 L180.00,185.00"]
+    RenderSVGContainer {g} at (203.33,211.67) size 110x110.00
+      RenderPath {path} at (203.33,211.67) size 110x110.00 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [start marker=markerStart] [middle marker=markerMiddle] [end marker=markerEnd] [data="M130.00,135.00 L180.00,135.00 L180.00,185.00"]
diff --git a/LayoutTests/platform/mac/svg/custom/js-late-marker-creation-expected.txt b/LayoutTests/platform/mac/svg/custom/js-late-marker-creation-expected.txt
index bb83985..67641b8 100644
--- a/LayoutTests/platform/mac/svg/custom/js-late-marker-creation-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/js-late-marker-creation-expected.txt
@@ -4,7 +4,7 @@ KCanvasResource {id="markerMiddle" [type=MARKER] [angle=0.00] [ref x=5.00 y=5.00
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (216.67,218.33) size 90.00x90
+  RenderSVGRoot {svg} at (203.33,211.67) size 110x110.00
     RenderSVGHiddenContainer {defs} at (0,0) size 0x0
       RenderSVGViewportContainer {marker} at (0,0) size 2x2
         RenderPath {rect} at (0,0) size 2x2 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L10.00,0.00 L10.00,10.00 L0.00,10.00 Z"]
@@ -12,5 +12,5 @@ layer at (0,0) size 800x600
         RenderPath {path} at (0,0) size 2x2 [fill={[type=SOLID] [color=#0000FF]}] [data="M5.00,0.00 L10.00,10.00 L0.00,10.00 Z"]
       RenderSVGViewportContainer {marker} at (0,0) size 2x2
         RenderPath {circle} at (0,0) size 2x2 [fill={[type=SOLID] [color=#008000]}] [data="M10.00,5.00 L9.99,5.31 L9.96,5.63 L9.91,5.94 L9.84,6.24 L9.76,6.55 L9.65,6.84 L9.52,7.13 L9.38,7.41 L9.22,7.68 L9.05,7.94 L8.85,8.19 L8.64,8.42 L8.42,8.64 L8.19,8.85 L7.94,9.05 L7.68,9.22 L7.41,9.38 L7.13,9.52 L6.84,9.65 L6.55,9.76 L6.24,9.84 L5.94,9.91 L5.63,9.96 L5.31,9.99 L5.00,10.00 L4.69,9.99 L4.37,9.96 L4.06,9.91 L3.76,9.84 L3.45,9.76 L3.16,9.65 L2.87,9.52 L2.59,9.38 L2.32,9.22 L2.06,9.05 L1.81,8.85 L1.58,8.64 L1.36,8.42 L1.15,8.19 L0.95,7.94 L0.78,7.68 L0.62,7.41 L0.48,7.13 L0.35,6.84 L0.24,6.55 L0.16,6.24 L0.09,5.94 L0.04,5.63 L0.01,5.31 L0.00,5.00 L0.01,4.69 L0.04,4.37 L0.09,4.06 L0.16,3.76 L0.24,3.45 L0.35,3.16 L0.48,2.87 L0.62,2.59 L0.78,2.32 L0.95,2.06 L1.15,1.81 L1.36,1.58 L1.58,1.36 L1.81,1.15 L2.06,0.95 L2.32,0.78 L2.59,0.62 L2.87,0.48 L3.16,0.35 L3.45,0.24 L3.76,0.16 L4.06,0.09 L4.37,0.04 L4.69,0.01 L5.00,0.00 L5.31,0.01 L5.63,0.04 L5.94,0.09 L6.24,0.16 L6.55,0.24 L6.84,0.35 L7.13,0.48 L7.41,0.62 L7.68,0.78 L7.94,0.95 L8.19,1.15 L8.42,1.36 L8.64,1.58 L8.85,1.81 L9.05,2.06 L9.22,2.32 L9.38,2.59 L9.52,2.87 L9.65,3.16 L9.76,3.45 L9.84,3.76 L9.91,4.06 L9.96,4.37 L9.99,4.69 Z"]
-    RenderSVGContainer {g} at (216.67,218.33) size 90.00x90
-      RenderPath {path} at (216.67,218.33) size 90.00x90 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [start marker=markerStart] [middle marker=markerMiddle] [end marker=markerEnd] [data="M130.00,135.00 L180.00,135.00 L180.00,185.00"]
+    RenderSVGContainer {g} at (203.33,211.67) size 110x110.00
+      RenderPath {path} at (203.33,211.67) size 110x110.00 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [start marker=markerStart] [middle marker=markerMiddle] [end marker=markerEnd] [data="M130.00,135.00 L180.00,135.00 L180.00,185.00"]
diff --git a/LayoutTests/platform/mac/svg/custom/marker-changes-expected.checksum b/LayoutTests/platform/mac/svg/custom/marker-changes-expected.checksum
index 155e8ae..374c765 100644
--- a/LayoutTests/platform/mac/svg/custom/marker-changes-expected.checksum
+++ b/LayoutTests/platform/mac/svg/custom/marker-changes-expected.checksum
@@ -1 +1 @@
-cb9c6ae0d0cd0a862ab1a47be6272684
\ No newline at end of file
+fbb0a4464cb404cec2fa22a55477ff2e
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/marker-changes-expected.png b/LayoutTests/platform/mac/svg/custom/marker-changes-expected.png
index 7ba3873..c902c27 100644
Binary files a/LayoutTests/platform/mac/svg/custom/marker-changes-expected.png and b/LayoutTests/platform/mac/svg/custom/marker-changes-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/marker-changes-expected.txt b/LayoutTests/platform/mac/svg/custom/marker-changes-expected.txt
index 716baf9..c86cf60 100644
--- a/LayoutTests/platform/mac/svg/custom/marker-changes-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/marker-changes-expected.txt
@@ -4,7 +4,7 @@ KCanvasResource {id="markerEnd" [type=MARKER] [angle=0.00] [ref x=5.00 y=5.00]}
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (130,131) size 54x54
+  RenderSVGRoot {svg} at (122,127) size 66x66
     RenderSVGHiddenContainer {defs} at (0,0) size 0x0
       RenderSVGViewportContainer {marker} at (0,0) size 2x2
         RenderPath {rect} at (0,0) size 2x2 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L10.00,0.00 L10.00,10.00 L0.00,10.00 Z"]
@@ -12,5 +12,5 @@ layer at (0,0) size 800x600
         RenderPath {circle} at (0,0) size 2x2 [fill={[type=SOLID] [color=#008000]}] [data="M10.00,5.00 L9.99,5.31 L9.96,5.63 L9.91,5.94 L9.84,6.24 L9.76,6.55 L9.65,6.84 L9.52,7.13 L9.38,7.41 L9.22,7.68 L9.05,7.94 L8.85,8.19 L8.64,8.42 L8.42,8.64 L8.19,8.85 L7.94,9.05 L7.68,9.22 L7.41,9.38 L7.13,9.52 L6.84,9.65 L6.55,9.76 L6.24,9.84 L5.94,9.91 L5.63,9.96 L5.31,9.99 L5.00,10.00 L4.69,9.99 L4.37,9.96 L4.06,9.91 L3.76,9.84 L3.45,9.76 L3.16,9.65 L2.87,9.52 L2.59,9.38 L2.32,9.22 L2.06,9.05 L1.81,8.85 L1.58,8.64 L1.36,8.42 L1.15,8.19 L0.95,7.94 L0.78,7.68 L0.62,7.41 L0.48,7.13 L0.35,6.84 L0.24,6.55 L0.16,6.24 L0.09,5.94 L0.04,5.63 L0.01,5.31 L0.00,5.00 L0.01,4.69 L0.04,4.37 L0.09,4.06 L0.16,3.76 L0.24,3.45 L0.35,3.16 L0.48,2.87 L0.62,2.59 L0.78,2.32 L0.95,2.06 L1.15,1.81 L1.36,1.58 L1.58,1.36 L1.81,1.15 L2.06,0.95 L2.32,0.78 L2.59,0.62 L2.87,0.48 L3.16,0.35 L3.45,0.24 L3.76,0.16 L4.06,0.09 L4.37,0.04 L4.69,0.01 L5.00,0.00 L5.31,0.01 L5.63,0.04 L5.94,0.09 L6.24,0.16 L6.55,0.24 L6.84,0.35 L7.13,0.48 L7.41,0.62 L7.68,0.78 L7.94,0.95 L8.19,1.15 L8.42,1.36 L8.64,1.58 L8.85,1.81 L9.05,2.06 L9.22,2.32 L9.38,2.59 L9.52,2.87 L9.65,3.16 L9.76,3.45 L9.84,3.76 L9.91,4.06 L9.96,4.37 L9.99,4.69 Z"]
       RenderSVGViewportContainer {marker} at (0,0) size 2x2
         RenderPath {path} at (0,0) size 2x2 [fill={[type=SOLID] [color=#0000FF]}] [data="M5.00,0.00 L10.00,10.00 L0.00,10.00 Z"]
-    RenderSVGContainer {g} at (130,131) size 54x54
-      RenderPath {path} at (130,131) size 54x54 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [start marker=markerStart] [middle marker=markerMiddle] [end marker=markerEnd] [data="M130.00,135.00 L180.00,135.00 L180.00,185.00"]
+    RenderSVGContainer {g} at (122,127) size 66x66
+      RenderPath {path} at (122,127) size 66x66 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [start marker=markerStart] [middle marker=markerMiddle] [end marker=markerEnd] [data="M130.00,135.00 L180.00,135.00 L180.00,185.00"]
diff --git a/LayoutTests/platform/mac/svg/custom/marker-child-changes-expected.checksum b/LayoutTests/platform/mac/svg/custom/marker-child-changes-expected.checksum
index a003fa0..374c765 100644
--- a/LayoutTests/platform/mac/svg/custom/marker-child-changes-expected.checksum
+++ b/LayoutTests/platform/mac/svg/custom/marker-child-changes-expected.checksum
@@ -1 +1 @@
-f99aed7b122ebf0155573231013d80d7
\ No newline at end of file
+fbb0a4464cb404cec2fa22a55477ff2e
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/marker-child-changes-expected.png b/LayoutTests/platform/mac/svg/custom/marker-child-changes-expected.png
index 7f3a824..c902c27 100644
Binary files a/LayoutTests/platform/mac/svg/custom/marker-child-changes-expected.png and b/LayoutTests/platform/mac/svg/custom/marker-child-changes-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/marker-child-changes-expected.txt b/LayoutTests/platform/mac/svg/custom/marker-child-changes-expected.txt
index 716baf9..c86cf60 100644
--- a/LayoutTests/platform/mac/svg/custom/marker-child-changes-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/marker-child-changes-expected.txt
@@ -4,7 +4,7 @@ KCanvasResource {id="markerEnd" [type=MARKER] [angle=0.00] [ref x=5.00 y=5.00]}
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (130,131) size 54x54
+  RenderSVGRoot {svg} at (122,127) size 66x66
     RenderSVGHiddenContainer {defs} at (0,0) size 0x0
       RenderSVGViewportContainer {marker} at (0,0) size 2x2
         RenderPath {rect} at (0,0) size 2x2 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L10.00,0.00 L10.00,10.00 L0.00,10.00 Z"]
@@ -12,5 +12,5 @@ layer at (0,0) size 800x600
         RenderPath {circle} at (0,0) size 2x2 [fill={[type=SOLID] [color=#008000]}] [data="M10.00,5.00 L9.99,5.31 L9.96,5.63 L9.91,5.94 L9.84,6.24 L9.76,6.55 L9.65,6.84 L9.52,7.13 L9.38,7.41 L9.22,7.68 L9.05,7.94 L8.85,8.19 L8.64,8.42 L8.42,8.64 L8.19,8.85 L7.94,9.05 L7.68,9.22 L7.41,9.38 L7.13,9.52 L6.84,9.65 L6.55,9.76 L6.24,9.84 L5.94,9.91 L5.63,9.96 L5.31,9.99 L5.00,10.00 L4.69,9.99 L4.37,9.96 L4.06,9.91 L3.76,9.84 L3.45,9.76 L3.16,9.65 L2.87,9.52 L2.59,9.38 L2.32,9.22 L2.06,9.05 L1.81,8.85 L1.58,8.64 L1.36,8.42 L1.15,8.19 L0.95,7.94 L0.78,7.68 L0.62,7.41 L0.48,7.13 L0.35,6.84 L0.24,6.55 L0.16,6.24 L0.09,5.94 L0.04,5.63 L0.01,5.31 L0.00,5.00 L0.01,4.69 L0.04,4.37 L0.09,4.06 L0.16,3.76 L0.24,3.45 L0.35,3.16 L0.48,2.87 L0.62,2.59 L0.78,2.32 L0.95,2.06 L1.15,1.81 L1.36,1.58 L1.58,1.36 L1.81,1.15 L2.06,0.95 L2.32,0.78 L2.59,0.62 L2.87,0.48 L3.16,0.35 L3.45,0.24 L3.76,0.16 L4.06,0.09 L4.37,0.04 L4.69,0.01 L5.00,0.00 L5.31,0.01 L5.63,0.04 L5.94,0.09 L6.24,0.16 L6.55,0.24 L6.84,0.35 L7.13,0.48 L7.41,0.62 L7.68,0.78 L7.94,0.95 L8.19,1.15 L8.42,1.36 L8.64,1.58 L8.85,1.81 L9.05,2.06 L9.22,2.32 L9.38,2.59 L9.52,2.87 L9.65,3.16 L9.76,3.45 L9.84,3.76 L9.91,4.06 L9.96,4.37 L9.99,4.69 Z"]
       RenderSVGViewportContainer {marker} at (0,0) size 2x2
         RenderPath {path} at (0,0) size 2x2 [fill={[type=SOLID] [color=#0000FF]}] [data="M5.00,0.00 L10.00,10.00 L0.00,10.00 Z"]
-    RenderSVGContainer {g} at (130,131) size 54x54
-      RenderPath {path} at (130,131) size 54x54 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [start marker=markerStart] [middle marker=markerMiddle] [end marker=markerEnd] [data="M130.00,135.00 L180.00,135.00 L180.00,185.00"]
+    RenderSVGContainer {g} at (122,127) size 66x66
+      RenderPath {path} at (122,127) size 66x66 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [start marker=markerStart] [middle marker=markerMiddle] [end marker=markerEnd] [data="M130.00,135.00 L180.00,135.00 L180.00,185.00"]
diff --git a/LayoutTests/platform/mac/svg/custom/marker-default-width-height-expected.txt b/LayoutTests/platform/mac/svg/custom/marker-default-width-height-expected.txt
index 88a6fc4..44ff946 100644
--- a/LayoutTests/platform/mac/svg/custom/marker-default-width-height-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/marker-default-width-height-expected.txt
@@ -4,8 +4,8 @@ KCanvasResource {id="marker3" [type=MARKER] [angle=0.00] [ref x=5.00 y=5.00]}
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (0,0) size 643.33x283.33
-    RenderSVGContainer {g} at (0,0) size 643.33x283.33
+  RenderSVGRoot {svg} at (0,0) size 643.33x303.33
+    RenderSVGContainer {g} at (0,0) size 643.33x303.33
       RenderSVGText {text} at (0,20) size 386x18 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,-14) size 386x18
           chunk 1 text run 1 at (0.00,20.00) startOffset 0 endOffset 61 width 386.00: "This should show three markers on the path for start/mid/end."
@@ -24,4 +24,4 @@ layer at (0,0) size 800x600
         RenderPath {rect} at (0,0) size 5x5 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00 L10.00,0.00 L10.00,10.00 L0.00,10.00 Z"]
       RenderSVGViewportContainer {marker} at (0,0) size 5x5
         RenderPath {rect} at (0,0) size 5x5 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00 L10.00,0.00 L10.00,10.00 L0.00,10.00 Z"]
-      RenderPath {path} at (216.67,200) size 83.33x83.33 [start marker=marker1] [middle marker=marker2] [end marker=marker3] [data="M130.00,120.00 L180.00,120.00 L180.00,170.00"]
+      RenderPath {path} at (196.67,180) size 123.33x123.33 [start marker=marker1] [middle marker=marker2] [end marker=marker3] [data="M130.00,120.00 L180.00,120.00 L180.00,170.00"]
diff --git a/LayoutTests/platform/mac/svg/custom/marker-opacity-expected.checksum b/LayoutTests/platform/mac/svg/custom/marker-opacity-expected.checksum
new file mode 100644
index 0000000..5643b5a
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/marker-opacity-expected.checksum
@@ -0,0 +1 @@
+8ab6ae697714c4e19416ea307d94b401
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/marker-opacity-expected.png b/LayoutTests/platform/mac/svg/custom/marker-opacity-expected.png
new file mode 100644
index 0000000..be06de2
Binary files /dev/null and b/LayoutTests/platform/mac/svg/custom/marker-opacity-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/marker-opacity-expected.txt b/LayoutTests/platform/mac/svg/custom/marker-opacity-expected.txt
new file mode 100644
index 0000000..df8b73b
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/marker-opacity-expected.txt
@@ -0,0 +1,23 @@
+KCanvasResource {id="arrow" [type=MARKER] [angle=auto] [ref x=4.00 y=2.00]}
+KCanvasResource {id="circle" [type=MARKER] [angle=auto] [ref x=5.00 y=5.00]}
+KCanvasResource {id="arrow2" [type=MARKER] [angle=auto] [ref x=4.00 y=2.00]}
+KCanvasResource {id="circle2" [type=MARKER] [angle=auto] [ref x=5.00 y=5.00]}
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (88.48,63.32) size 304.96x298.12
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+      RenderSVGViewportContainer {marker} at (1.43,-0.07) size 5.17x4.13
+        RenderPath {path} at (1.43,-0.07) size 5.17x4.13 [stroke={[type=SOLID] [color=#5555FF] [line cap=ROUND] [line join=ROUND]}] [data="M2.00,0.50 L6.00,2.00 L2.00,3.50"]
+      RenderSVGViewportContainer {marker} at (0.80,0.80) size 2.40x2.40
+        RenderPath {circle} at (0.80,0.80) size 2.40x2.40 [fill={[type=SOLID] [color=#5555FF]}] [data="M8.00,5.00 L7.99,5.19 L7.98,5.38 L7.95,5.56 L7.91,5.75 L7.85,5.93 L7.79,6.10 L7.71,6.28 L7.63,6.45 L7.53,6.61 L7.43,6.76 L7.31,6.91 L7.19,7.05 L7.05,7.19 L6.91,7.31 L6.76,7.43 L6.61,7.53 L6.45,7.63 L6.28,7.71 L6.10,7.79 L5.93,7.85 L5.75,7.91 L5.56,7.95 L5.38,7.98 L5.19,7.99 L5.00,8.00 L4.81,7.99 L4.62,7.98 L4.44,7.95 L4.25,7.91 L4.07,7.85 L3.90,7.79 L3.72,7.71 L3.55,7.63 L3.39,7.53 L3.24,7.43 L3.09,7.31 L2.95,7.19 L2.81,7.05 L2.69,6.91 L2.57,6.76 L2.47,6.61 L2.37,6.45 L2.29,6.28 L2.21,6.10 L2.15,5.93 L2.09,5.75 L2.05,5.56 L2.02,5.38 L2.01,5.19 L2.00,5.00 L2.01,4.81 L2.02,4.62 L2.05,4.44 L2.09,4.25 L2.15,4.07 L2.21,3.90 L2.29,3.72 L2.37,3.55 L2.47,3.39 L2.57,3.24 L2.69,3.09 L2.81,2.95 L2.95,2.81 L3.09,2.69 L3.24,2.57 L3.39,2.47 L3.55,2.37 L3.72,2.29 L3.90,2.21 L4.07,2.15 L4.25,2.09 L4.44,2.05 L4.62,2.02 L4.81,2.01 L5.00,2.00 L5.19,2.01 L5.38,2.02 L5.56,2.05 L5.75,2.09 L5.93,2.15 L6.10,2.21 L6.28,2.29 L6.45,2.37 L6.61,2.47 L6.76,2.57 L6.91,2.69 L7.05,2.81 L7.19,2.95 L7.31,3.09 L7.43,3.24 L7.53,3.39 L7.63,3.55 L7.71,3.72 L7.79,3.90 L7.85,4.07 L7.91,4.25 L7.95,4.44 L7.98,4.62 L7.99,4.81 Z"]
+      RenderSVGViewportContainer {marker} at (1.43,-0.07) size 5.17x4.13
+        RenderPath {path} at (1.43,-0.07) size 5.17x4.13 [stroke={[type=SOLID] [color=#5555FF] [opacity=0.25] [line cap=ROUND] [line join=ROUND]}] [data="M2.00,0.50 L6.00,2.00 L2.00,3.50"]
+      RenderSVGViewportContainer {marker} at (0.80,0.80) size 2.40x2.40
+        RenderPath {circle} at (0.80,0.80) size 2.40x2.40 [fill={[type=SOLID] [color=#5555FF] [opacity=0.25]}] [data="M8.00,5.00 L7.99,5.19 L7.98,5.38 L7.95,5.56 L7.91,5.75 L7.85,5.93 L7.79,6.10 L7.71,6.28 L7.63,6.45 L7.53,6.61 L7.43,6.76 L7.31,6.91 L7.19,7.05 L7.05,7.19 L6.91,7.31 L6.76,7.43 L6.61,7.53 L6.45,7.63 L6.28,7.71 L6.10,7.79 L5.93,7.85 L5.75,7.91 L5.56,7.95 L5.38,7.98 L5.19,7.99 L5.00,8.00 L4.81,7.99 L4.62,7.98 L4.44,7.95 L4.25,7.91 L4.07,7.85 L3.90,7.79 L3.72,7.71 L3.55,7.63 L3.39,7.53 L3.24,7.43 L3.09,7.31 L2.95,7.19 L2.81,7.05 L2.69,6.91 L2.57,6.76 L2.47,6.61 L2.37,6.45 L2.29,6.28 L2.21,6.10 L2.15,5.93 L2.09,5.75 L2.05,5.56 L2.02,5.38 L2.01,5.19 L2.00,5.00 L2.01,4.81 L2.02,4.62 L2.05,4.44 L2.09,4.25 L2.15,4.07 L2.21,3.90 L2.29,3.72 L2.37,3.55 L2.47,3.39 L2.57,3.24 L2.69,3.09 L2.81,2.95 L2.95,2.81 L3.09,2.69 L3.24,2.57 L3.39,2.47 L3.55,2.37 L3.72,2.29 L3.90,2.21 L4.07,2.15 L4.25,2.09 L4.44,2.05 L4.62,2.02 L4.81,2.01 L5.00,2.00 L5.19,2.01 L5.38,2.02 L5.56,2.05 L5.75,2.09 L5.93,2.15 L6.10,2.21 L6.28,2.29 L6.45,2.37 L6.61,2.47 L6.76,2.57 L6.91,2.69 L7.05,2.81 L7.19,2.95 L7.31,3.09 L7.43,3.24 L7.53,3.39 L7.63,3.55 L7.71,3.72 L7.79,3.90 L7.85,4.07 L7.91,4.25 L7.95,4.44 L7.98,4.62 L7.99,4.81 Z"]
+    RenderSVGContainer {g} at (88.48,63.32) size 304.96x98.12 [opacity=0.25]
+      RenderPath {path} at (88.48,63.32) size 304.96x98.12 [stroke={[type=SOLID] [color=#5555FF] [stroke width=4.00] [line cap=ROUND]}] [start marker=circle] [end marker=arrow] [data="M388.00,156.00 C244.00,135.00,244.00,94.00,100.00,73.00"]
+    RenderSVGContainer {g} at (88.48,163.32) size 304.96x98.12
+      RenderPath {path} at (88.48,163.32) size 304.96x98.12 [stroke={[type=SOLID] [color=#5555FF] [stroke width=4.00] [line cap=ROUND]}] [start marker=circle] [end marker=arrow] [data="M388.00,256.00 C244.00,235.00,244.00,194.00,100.00,173.00"]
+    RenderSVGContainer {g} at (88.48,263.32) size 304.96x98.12
+      RenderPath {path} at (88.48,263.32) size 304.96x98.12 [stroke={[type=SOLID] [color=#5555FF] [opacity=0.25] [stroke width=4.00] [line cap=ROUND]}] [start marker=circle2] [end marker=arrow2] [data="M388.00,356.00 C244.00,335.00,244.00,294.00,100.00,273.00"]
diff --git a/LayoutTests/platform/mac/svg/custom/marker-referencePoint-expected.checksum b/LayoutTests/platform/mac/svg/custom/marker-referencePoint-expected.checksum
new file mode 100644
index 0000000..7b6d4ce
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/marker-referencePoint-expected.checksum
@@ -0,0 +1 @@
+1d7912349ff4cfc7ac757a7855e1c8c2
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/marker-referencePoint-expected.png b/LayoutTests/platform/mac/svg/custom/marker-referencePoint-expected.png
new file mode 100644
index 0000000..0d2cf06
Binary files /dev/null and b/LayoutTests/platform/mac/svg/custom/marker-referencePoint-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/marker-referencePoint-expected.txt b/LayoutTests/platform/mac/svg/custom/marker-referencePoint-expected.txt
new file mode 100644
index 0000000..686c439
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/marker-referencePoint-expected.txt
@@ -0,0 +1,10 @@
+KCanvasResource {id="Triangle" [type=MARKER] [angle=auto] [ref x=0.00 y=5.00]}
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 384x192
+  RenderSVGRoot {svg} at (0.48,0.48) size 383.04x191.04
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+      RenderSVGViewportContainer {marker} at (0.50,0) size 3x3
+        RenderPath {path} at (0.50,0) size 3x3 [fill={[type=SOLID] [color=#000000]}] [data="M0.00,0.00 L10.00,5.00 L0.00,10.00 Z"]
+    RenderPath {rect} at (0.48,0.48) size 383.04x191.04 [stroke={[type=SOLID] [color=#0000FF] [stroke width=10.00]}] [data="M10.00,10.00 L3990.00,10.00 L3990.00,1990.00 L10.00,1990.00 Z"]
+    RenderPath {path} at (96,67.20) size 174.55x83.35 [stroke={[type=SOLID] [color=#000000] [stroke width=100.00]}] [end marker=Triangle] [data="M1000.00,750.00 L2000.00,750.00 L2500.00,1250.00"]
diff --git a/LayoutTests/platform/mac/svg/custom/marker-viewBox-changes-expected.checksum b/LayoutTests/platform/mac/svg/custom/marker-viewBox-changes-expected.checksum
index 73cab2f..374c765 100644
--- a/LayoutTests/platform/mac/svg/custom/marker-viewBox-changes-expected.checksum
+++ b/LayoutTests/platform/mac/svg/custom/marker-viewBox-changes-expected.checksum
@@ -1 +1 @@
-112d6156ec1070f8934e12652f26239a
\ No newline at end of file
+fbb0a4464cb404cec2fa22a55477ff2e
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/marker-viewBox-changes-expected.png b/LayoutTests/platform/mac/svg/custom/marker-viewBox-changes-expected.png
index a6c19b1..c902c27 100644
Binary files a/LayoutTests/platform/mac/svg/custom/marker-viewBox-changes-expected.png and b/LayoutTests/platform/mac/svg/custom/marker-viewBox-changes-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/marker-viewBox-changes-expected.txt b/LayoutTests/platform/mac/svg/custom/marker-viewBox-changes-expected.txt
index 716baf9..c86cf60 100644
--- a/LayoutTests/platform/mac/svg/custom/marker-viewBox-changes-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/marker-viewBox-changes-expected.txt
@@ -4,7 +4,7 @@ KCanvasResource {id="markerEnd" [type=MARKER] [angle=0.00] [ref x=5.00 y=5.00]}
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (130,131) size 54x54
+  RenderSVGRoot {svg} at (122,127) size 66x66
     RenderSVGHiddenContainer {defs} at (0,0) size 0x0
       RenderSVGViewportContainer {marker} at (0,0) size 2x2
         RenderPath {rect} at (0,0) size 2x2 [fill={[type=SOLID] [color=#FF0000]}] [data="M0.00,0.00 L10.00,0.00 L10.00,10.00 L0.00,10.00 Z"]
@@ -12,5 +12,5 @@ layer at (0,0) size 800x600
         RenderPath {circle} at (0,0) size 2x2 [fill={[type=SOLID] [color=#008000]}] [data="M10.00,5.00 L9.99,5.31 L9.96,5.63 L9.91,5.94 L9.84,6.24 L9.76,6.55 L9.65,6.84 L9.52,7.13 L9.38,7.41 L9.22,7.68 L9.05,7.94 L8.85,8.19 L8.64,8.42 L8.42,8.64 L8.19,8.85 L7.94,9.05 L7.68,9.22 L7.41,9.38 L7.13,9.52 L6.84,9.65 L6.55,9.76 L6.24,9.84 L5.94,9.91 L5.63,9.96 L5.31,9.99 L5.00,10.00 L4.69,9.99 L4.37,9.96 L4.06,9.91 L3.76,9.84 L3.45,9.76 L3.16,9.65 L2.87,9.52 L2.59,9.38 L2.32,9.22 L2.06,9.05 L1.81,8.85 L1.58,8.64 L1.36,8.42 L1.15,8.19 L0.95,7.94 L0.78,7.68 L0.62,7.41 L0.48,7.13 L0.35,6.84 L0.24,6.55 L0.16,6.24 L0.09,5.94 L0.04,5.63 L0.01,5.31 L0.00,5.00 L0.01,4.69 L0.04,4.37 L0.09,4.06 L0.16,3.76 L0.24,3.45 L0.35,3.16 L0.48,2.87 L0.62,2.59 L0.78,2.32 L0.95,2.06 L1.15,1.81 L1.36,1.58 L1.58,1.36 L1.81,1.15 L2.06,0.95 L2.32,0.78 L2.59,0.62 L2.87,0.48 L3.16,0.35 L3.45,0.24 L3.76,0.16 L4.06,0.09 L4.37,0.04 L4.69,0.01 L5.00,0.00 L5.31,0.01 L5.63,0.04 L5.94,0.09 L6.24,0.16 L6.55,0.24 L6.84,0.35 L7.13,0.48 L7.41,0.62 L7.68,0.78 L7.94,0.95 L8.19,1.15 L8.42,1.36 L8.64,1.58 L8.85,1.81 L9.05,2.06 L9.22,2.32 L9.38,2.59 L9.52,2.87 L9.65,3.16 L9.76,3.45 L9.84,3.76 L9.91,4.06 L9.96,4.37 L9.99,4.69 Z"]
       RenderSVGViewportContainer {marker} at (0,0) size 2x2
         RenderPath {path} at (0,0) size 2x2 [fill={[type=SOLID] [color=#0000FF]}] [data="M5.00,0.00 L10.00,10.00 L0.00,10.00 Z"]
-    RenderSVGContainer {g} at (130,131) size 54x54
-      RenderPath {path} at (130,131) size 54x54 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [start marker=markerStart] [middle marker=markerMiddle] [end marker=markerEnd] [data="M130.00,135.00 L180.00,135.00 L180.00,185.00"]
+    RenderSVGContainer {g} at (122,127) size 66x66
+      RenderPath {path} at (122,127) size 66x66 [stroke={[type=SOLID] [color=#000000] [stroke width=8.00]}] [start marker=markerStart] [middle marker=markerMiddle] [end marker=markerEnd] [data="M130.00,135.00 L180.00,135.00 L180.00,185.00"]
diff --git a/LayoutTests/platform/mac/svg/custom/non-circular-marker-reference-expected.txt b/LayoutTests/platform/mac/svg/custom/non-circular-marker-reference-expected.txt
index ed89cf8..04a6052 100644
--- a/LayoutTests/platform/mac/svg/custom/non-circular-marker-reference-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/non-circular-marker-reference-expected.txt
@@ -2,9 +2,9 @@ KCanvasResource {id="mark" [type=MARKER] [angle=0.00] [ref x=4.00 y=4.00]}
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (235,225) size 330x150
+  RenderSVGRoot {svg} at (210.63,225) size 378.74x174.37
     RenderSVGHiddenContainer {defs} at (0,0) size 0x0
       RenderSVGViewportContainer {marker} at (0.19,0.19) size 2.62x2.62
         RenderPath {circle} at (0.19,0.19) size 2.62x2.62 [stroke={[type=SOLID] [color=#FF0000] [line cap=ROUND]}] [data="M7.00,4.00 L6.99,4.19 L6.98,4.38 L6.95,4.56 L6.91,4.75 L6.85,4.93 L6.79,5.10 L6.71,5.28 L6.63,5.45 L6.53,5.61 L6.43,5.76 L6.31,5.91 L6.19,6.05 L6.05,6.19 L5.91,6.31 L5.76,6.43 L5.61,6.53 L5.45,6.63 L5.28,6.71 L5.10,6.79 L4.93,6.85 L4.75,6.91 L4.56,6.95 L4.38,6.98 L4.19,6.99 L4.00,7.00 L3.81,6.99 L3.62,6.98 L3.44,6.95 L3.25,6.91 L3.07,6.85 L2.90,6.79 L2.72,6.71 L2.55,6.63 L2.39,6.53 L2.24,6.43 L2.09,6.31 L1.95,6.19 L1.81,6.05 L1.69,5.91 L1.57,5.76 L1.47,5.61 L1.37,5.45 L1.29,5.28 L1.21,5.10 L1.15,4.93 L1.09,4.75 L1.05,4.56 L1.02,4.38 L1.01,4.19 L1.00,4.00 L1.01,3.81 L1.02,3.62 L1.05,3.44 L1.09,3.25 L1.15,3.07 L1.21,2.90 L1.29,2.72 L1.37,2.55 L1.47,2.39 L1.57,2.24 L1.69,2.09 L1.81,1.95 L1.95,1.81 L2.09,1.69 L2.24,1.57 L2.39,1.47 L2.55,1.37 L2.72,1.29 L2.90,1.21 L3.07,1.15 L3.25,1.09 L3.44,1.05 L3.62,1.02 L3.81,1.01 L4.00,1.00 L4.19,1.01 L4.38,1.02 L4.56,1.05 L4.75,1.09 L4.93,1.15 L5.10,1.21 L5.28,1.29 L5.45,1.37 L5.61,1.47 L5.76,1.57 L5.91,1.69 L6.05,1.81 L6.19,1.95 L6.31,2.09 L6.43,2.24 L6.53,2.39 L6.63,2.55 L6.71,2.72 L6.79,2.90 L6.85,3.07 L6.91,3.25 L6.95,3.44 L6.98,3.62 L6.99,3.81 Z"]
     RenderPath {path} at (235,225) size 330x30 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [data="M-5.00,-2.00 L0.00,-2.00 L5.00,-2.00"]
-    RenderPath {path} at (235,345) size 330x30 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M-5.00,2.00 L0.00,2.00 L5.00,2.00"]
+    RenderPath {path} at (210.63,320.63) size 378.74x78.74 [stroke={[type=SOLID] [color=#000000] [line cap=ROUND]}] [fill={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M-5.00,2.00 L0.00,2.00 L5.00,2.00"]
diff --git a/LayoutTests/platform/mac/svg/custom/shapes-supporting-markers-expected.txt b/LayoutTests/platform/mac/svg/custom/shapes-supporting-markers-expected.txt
index c4e5e50..cc0cc4e 100644
--- a/LayoutTests/platform/mac/svg/custom/shapes-supporting-markers-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/shapes-supporting-markers-expected.txt
@@ -2,11 +2,11 @@ KCanvasResource {id="mark" [type=MARKER] [angle=0.00] [ref x=4.00 y=4.00]}
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (-0.83,10) size 622.50x275.20
+  RenderSVGRoot {svg} at (-2.19,10) size 623.85x275.52
     RenderSVGHiddenContainer {defs} at (0,0) size 0x0
       RenderSVGViewportContainer {marker} at (0.19,0.19) size 2.62x2.62
         RenderPath {circle} at (0.19,0.19) size 2.62x2.62 [stroke={[type=SOLID] [color=#FF0000]}] [data="M7.00,4.00 L6.99,4.19 L6.98,4.38 L6.95,4.56 L6.91,4.75 L6.85,4.93 L6.79,5.10 L6.71,5.28 L6.63,5.45 L6.53,5.61 L6.43,5.76 L6.31,5.91 L6.19,6.05 L6.05,6.19 L5.91,6.31 L5.76,6.43 L5.61,6.53 L5.45,6.63 L5.28,6.71 L5.10,6.79 L4.93,6.85 L4.75,6.91 L4.56,6.95 L4.38,6.98 L4.19,6.99 L4.00,7.00 L3.81,6.99 L3.62,6.98 L3.44,6.95 L3.25,6.91 L3.07,6.85 L2.90,6.79 L2.72,6.71 L2.55,6.63 L2.39,6.53 L2.24,6.43 L2.09,6.31 L1.95,6.19 L1.81,6.05 L1.69,5.91 L1.57,5.76 L1.47,5.61 L1.37,5.45 L1.29,5.28 L1.21,5.10 L1.15,4.93 L1.09,4.75 L1.05,4.56 L1.02,4.38 L1.01,4.19 L1.00,4.00 L1.01,3.81 L1.02,3.62 L1.05,3.44 L1.09,3.25 L1.15,3.07 L1.21,2.90 L1.29,2.72 L1.37,2.55 L1.47,2.39 L1.57,2.24 L1.69,2.09 L1.81,1.95 L1.95,1.81 L2.09,1.69 L2.24,1.57 L2.39,1.47 L2.55,1.37 L2.72,1.29 L2.90,1.21 L3.07,1.15 L3.25,1.09 L3.44,1.05 L3.62,1.02 L3.81,1.01 L4.00,1.00 L4.19,1.01 L4.38,1.02 L4.56,1.05 L4.75,1.09 L4.93,1.15 L5.10,1.21 L5.28,1.29 L5.45,1.37 L5.61,1.47 L5.76,1.57 L5.91,1.69 L6.05,1.81 L6.19,1.95 L6.31,2.09 L6.43,2.24 L6.53,2.39 L6.63,2.55 L6.71,2.72 L6.79,2.90 L6.85,3.07 L6.91,3.25 L6.95,3.44 L6.98,3.62 L6.99,3.81 Z"]
-    RenderSVGContainer {g} at (-0.83,10) size 622.50x275.20 [start marker=mark] [middle marker=mark] [end marker=mark]
+    RenderSVGContainer {g} at (-2.19,10) size 623.85x275.52 [start marker=mark] [middle marker=mark] [end marker=mark]
       RenderSVGText {text} at (0,20) size 373x18 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,-14) size 373x18
           chunk 1 text run 1 at (0.00,20.00) startOffset 0 endOffset 58 width 373.00: "The first row of shapes should have no marker decorations,"
@@ -16,7 +16,7 @@ layer at (0,0) size 800x600
       RenderPath {rect} at (-0.83,82.50) size 85x85 [stroke={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M0.00,50.00 L50.00,50.00 L50.00,100.00 L0.00,100.00 Z"]
       RenderPath {circle} at (90.83,84.17) size 85.00x85.00 [stroke={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M105.00,76.00 L104.95,77.57 L104.80,79.13 L104.56,80.68 L104.21,82.22 L103.78,83.73 L103.24,85.20 L102.62,86.64 L101.91,88.04 L101.11,89.40 L100.23,90.69 L99.26,91.94 L98.22,93.11 L97.11,94.22 L95.94,95.26 L94.69,96.23 L93.40,97.11 L92.04,97.91 L90.64,98.62 L89.20,99.24 L87.73,99.78 L86.22,100.21 L84.68,100.56 L83.13,100.80 L81.57,100.95 L80.00,101.00 L78.43,100.95 L76.87,100.80 L75.32,100.56 L73.78,100.21 L72.27,99.78 L70.80,99.24 L69.36,98.62 L67.96,97.91 L66.60,97.11 L65.31,96.23 L64.06,95.26 L62.89,94.22 L61.78,93.11 L60.74,91.94 L59.77,90.69 L58.89,89.40 L58.09,88.04 L57.38,86.64 L56.76,85.20 L56.22,83.73 L55.79,82.22 L55.44,80.68 L55.20,79.13 L55.05,77.57 L55.00,76.00 L55.05,74.43 L55.20,72.87 L55.44,71.32 L55.79,69.78 L56.22,68.27 L56.76,66.80 L57.38,65.36 L58.09,63.96 L58.89,62.60 L59.77,61.31 L60.74,60.06 L61.78,58.89 L62.89,57.78 L64.06,56.74 L65.31,55.77 L66.60,54.89 L67.96,54.09 L69.36,53.38 L70.80,52.76 L72.27,52.22 L73.78,51.79 L75.32,51.44 L76.87,51.20 L78.43,51.05 L80.00,51.00 L81.57,51.05 L83.13,51.20 L84.68,51.44 L86.22,51.79 L87.73,52.22 L89.20,52.76 L90.64,53.38 L92.04,54.09 L93.40,54.89 L94.69,55.77 L95.94,56.74 L97.11,57.78 L98.22,58.89 L99.26,60.06 L100.23,61.31 L101.11,62.60 L101.91,63.96 L102.62,65.36 L103.24,66.80 L103.78,68.27 L104.21,69.78 L104.56,71.32 L104.80,72.87 L104.95,74.43 Z"]
       RenderPath {ellipse} at (182.50,84.17) size 101.67x85.00 [stroke={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M170.00,76.00 L169.94,77.57 L169.76,79.13 L169.47,80.68 L169.06,82.22 L168.53,83.73 L167.89,85.20 L167.14,86.64 L166.29,88.04 L165.33,89.40 L164.27,90.69 L163.12,91.94 L161.87,93.11 L160.54,94.22 L159.12,95.26 L157.63,96.23 L156.07,97.11 L154.45,97.91 L152.77,98.62 L151.04,99.24 L149.27,99.78 L147.46,100.21 L145.62,100.56 L143.76,100.80 L141.88,100.95 L140.00,101.00 L138.12,100.95 L136.24,100.80 L134.38,100.56 L132.54,100.21 L130.73,99.78 L128.96,99.24 L127.23,98.62 L125.55,97.91 L123.93,97.11 L122.37,96.23 L120.88,95.26 L119.46,94.22 L118.13,93.11 L116.88,91.94 L115.73,90.69 L114.67,89.40 L113.71,88.04 L112.86,86.64 L112.11,85.20 L111.47,83.73 L110.94,82.22 L110.53,80.68 L110.24,79.13 L110.06,77.57 L110.00,76.00 L110.06,74.43 L110.24,72.87 L110.53,71.32 L110.94,69.78 L111.47,68.27 L112.11,66.80 L112.86,65.36 L113.71,63.96 L114.67,62.60 L115.73,61.31 L116.88,60.06 L118.13,58.89 L119.46,57.78 L120.88,56.74 L122.37,55.77 L123.93,54.89 L125.55,54.09 L127.23,53.38 L128.96,52.76 L130.73,52.22 L132.54,51.79 L134.38,51.44 L136.24,51.20 L138.12,51.05 L140.00,51.00 L141.88,51.05 L143.76,51.20 L145.62,51.44 L147.46,51.79 L149.27,52.22 L151.04,52.76 L152.77,53.38 L154.45,54.09 L156.07,54.89 L157.63,55.77 L159.12,56.74 L160.54,57.78 L161.87,58.89 L163.12,60.06 L164.27,61.31 L165.33,62.60 L166.29,63.96 L167.14,65.36 L167.89,66.80 L168.53,68.27 L169.06,69.78 L169.47,71.32 L169.76,72.87 L169.94,74.43 Z"]
-      RenderPath {line} at (-0.83,200) size 1.67x83.33 [stroke={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M0.00,120.00 L0.00,170.00"]
-      RenderPath {polyline} at (50,199.17) size 84.68x84.54 [stroke={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M30.00,120.00 L80.00,120.00 L55.00,170.00"]
-      RenderPath {polygon} at (165.32,199.17) size 86.03x86.03 [stroke={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M100.00,120.00 L150.00,120.00 L125.00,170.00 Z"]
-      RenderPath {path} at (282.50,199.17) size 85.52x85.00 [stroke={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M170.00,120.00 L220.00,120.00 L195.00,170.00 C185.00,170.00,170.00,140.00,170.00,120.00"]
+      RenderPath {line} at (-2.19,197.81) size 4.37x87.71 [stroke={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M0.00,120.00 L0.00,170.00"]
+      RenderPath {polyline} at (47.81,197.81) size 87.71x87.71 [stroke={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M30.00,120.00 L80.00,120.00 L55.00,170.00"]
+      RenderPath {polygon} at (164.48,197.81) size 87.71x87.71 [stroke={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M100.00,120.00 L150.00,120.00 L125.00,170.00 Z"]
+      RenderPath {path} at (281.15,197.81) size 87.71x87.71 [stroke={[type=SOLID] [color=#000000]}] [start marker=mark] [middle marker=mark] [end marker=mark] [data="M170.00,120.00 L220.00,120.00 L195.00,170.00 C185.00,170.00,170.00,140.00,170.00,120.00"]
diff --git a/LayoutTests/svg/custom/marker-opacity.svg b/LayoutTests/svg/custom/marker-opacity.svg
new file mode 100644
index 0000000..63e0e54
--- /dev/null
+++ b/LayoutTests/svg/custom/marker-opacity.svg
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" x="0" y="0">
+    <defs>
+        <marker id="arrow" viewBox="0 0 4 4" refX="4" refY="2" markerUnits="strokeWidth" markerWidth="4" markerHeight="4" orient="auto" style="overflow: visible;">
+            <path d="M 2 0.5 L 6 2 L 2 3.5" style="fill: none; stroke: rgb(85, 85, 255); stroke-width: 1; stroke-linecap: round; stroke-linejoin: round;"/>
+        </marker>
+        <marker id="circle" viewBox="0 0 10 10" refX="5" refY="5" markerUnits="strokeWidth" markerWidth="4" markerHeight="4" orient="auto" style="overflow: visible;">
+            <circle cx="5" cy="5" r="3" style="fill: rgb(85, 85, 255);"/>
+        </marker>
+        <marker id="arrow2" stroke-opacity="0.25" viewBox="0 0 4 4" refX="4" refY="2" markerUnits="strokeWidth" markerWidth="4" markerHeight="4" orient="auto" style="overflow: visible;">
+            <path d="M 2 0.5 L 6 2 L 2 3.5" style="fill: none; stroke: rgb(85, 85, 255); stroke-width: 1; stroke-linecap: round; stroke-linejoin: round;"/>
+        </marker>
+        <marker id="circle2" fill-opacity="0.25" viewBox="0 0 10 10" refX="5" refY="5" markerUnits="strokeWidth" markerWidth="4" markerHeight="4" orient="auto" style="overflow: visible;">
+            <circle cx="5" cy="5" r="3" style="fill: rgb(85, 85, 255);"/>
+        </marker>
+    </defs>
+    <g opacity="0.25">
+        <path d="M 388,156 C 244,135 244,94 100,73" style="overflow: visible; fill: none; stroke: rgb(85, 85, 255); stroke-width: 4; stroke-linecap: round; marker-end: url(#arrow); marker-start: url(#circle);"/>
+    </g>
+    <g>
+        <path d="M 388,256 C 244,235 244,194 100,173" style="overflow: visible; fill: none; stroke: rgb(85, 85, 255); stroke-width: 4; stroke-linecap: round; marker-end: url(#arrow); marker-start: url(#circle);"/>
+    </g>
+    <g>
+        <path d="M 388,356 C 244,335 244,294 100,273" stroke-opacity="0.25" style="overflow: visible; fill: none; stroke: rgb(85, 85, 255); stroke-width: 4; stroke-linecap: round; marker-end: url(#arrow2); marker-start: url(#circle2);"/>
+    </g>
+</svg>
diff --git a/LayoutTests/svg/custom/marker-referencePoint.svg b/LayoutTests/svg/custom/marker-referencePoint.svg
new file mode 100644
index 0000000..05410e0
--- /dev/null
+++ b/LayoutTests/svg/custom/marker-referencePoint.svg
@@ -0,0 +1,23 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" 
+  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="4in" height="2in" 
+     viewBox="0 0 4000 2000" version="1.1"
+     xmlns="http://www.w3.org/2000/svg">
+  <defs>
+    <marker id="Triangle"
+      viewBox="0 0 10 10" refX="0" refY="5" 
+      markerUnits="strokeWidth"
+      markerWidth="4" markerHeight="3"
+      orient="auto">
+      <path d="M 0 0 L 10 5 L 0 10 z" />
+    </marker>
+  </defs>
+  <rect x="10" y="10" width="3980" height="1980"
+       fill="none" stroke="blue" stroke-width="10" />
+  <desc>Placing an arrowhead at the end of a path.
+  </desc>
+  <path d="M 1000 750 L 2000 750 L 2500 1250"
+        fill="none" stroke="black" stroke-width="100" 
+        marker-end="url(#Triangle)"  />
+</svg>
diff --git a/WebCore/Android.mk b/WebCore/Android.mk
index 293c43b..9b45df0 100644
--- a/WebCore/Android.mk
+++ b/WebCore/Android.mk
@@ -630,6 +630,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
 	rendering/SVGCharacterLayoutInfo.cpp \
 	rendering/SVGInlineFlowBox.cpp \
 	rendering/SVGInlineTextBox.cpp \
+	rendering/SVGMarkerLayoutInfo.cpp \
 	rendering/SVGRenderSupport.cpp \
 	rendering/SVGRenderTreeAsText.cpp \
 	rendering/SVGRootInlineBox.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ecb4a71..c7b0ecc 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,85 @@
+2010-01-04  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        Marker code is buggy: referencePoint translation is off
+        https://bugs.webkit.org/show_bug.cgi?id=33012
+
+        Rewrite marker code, as it had many issues:
+        - Correct refX/refY handling (covered by new marker-referencePoint.svg test)
+        - Calculate marker bounds on layout time, instead of paint time, to deliver correct repaint rects
+        - Cleanup RenderPath code, which was cluttered by marker stuff (outlay in SVGMarkerLayoutInfo)
+        - Fix SVGResource assuming that there is only one resource per resource type per element. Markers
+          can have three different resources of the same type (three markers, start/mid/end markers)
+
+        Filed bug 33115 (PathElementAddQuadCurveToPoint not handled for <marker>), which was just a TODO in the code before.
+
+        Fixes all svg/custom/marker*.svg tests, that use dynamic updates (propagation failed before).
+        Test: svg/custom/marker-referencePoint.svg
+              svg/custom/marker-opacity.svg
+
+        * Android.mk: Add SVGMarkerData.h / SVGMarkerLayoutInfo.(cpp,h) to build.
+        * GNUmakefile.am: Ditto.
+        * WebCore.pro: Ditto.
+        * WebCore.vcproj/WebCore.vcproj: Ditto.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * page/FrameView.cpp: Notify RenderSVGRoot children about viewport size changes, just like it's handled for <body> in HTML.
+        (WebCore::FrameView::layout): This is important, as marker bounding boxes may depend on the current viewport size through relative coordinates used in <svg>.
+        * rendering/RenderPath.cpp:
+        (WebCore::RenderPath::markerBoundingBox): Calculates and caches marker boundaries in the layout() phase.
+        (WebCore::RenderPath::repaintRectInLocalCoordinates): Use the cached marker bounding box during paint() time.
+        (WebCore::RenderPath::setPath): Clear marker boundaries upon path changes.
+        (WebCore::RenderPath::paint): Use SVGMarkerLayoutInfo::drawMarkers() instead of the local drawMarkersIfNeeded() function, which is gone now.
+        (WebCore::RenderPath::calculateMarkerBoundsIfNeeded): Utilized by markerBoundingBox() to request SVGResourceMarker objects and calculate their boundaries.
+        * rendering/RenderPath.h: Store SVGMarkerLayoutInfo objects, and rename m_markerBounds to m_cachedLocalMarkerBBox for consistency.
+        (WebCore::RenderPath::path): Inline this accessor.
+        * rendering/RenderSVGContainer.h: Make paint() public (to be used from SVGResourceMarker), all other methods protected (to be used from RenderSVGViewportContainer).
+        * rendering/RenderSVGViewportContainer.cpp: Remove useless paint() override, as the comment in the code indicated.
+        (WebCore::RenderSVGViewportContainer::markerBoundaries): Maps the marker contents repaintRectInLocalCoordinates() into the final coordinate system (see code).
+        (WebCore::RenderSVGViewportContainer::markerContentTransformation): Add marker-specific helper method, allowing to make viewportTransform() private again.
+        * rendering/RenderSVGViewportContainer.h: Marking viewportTransform() private, it's never meant to be used outside this renderer.
+        * rendering/SVGMarkerData.h: Added. Refactored from existing RenderPath code, preserving original copyrights.
+        (WebCore::SVGMarkerData::): Helper struct for SVGMarkerLayoutInfo.
+        (WebCore::SVGMarkerData::origin): Holds the final computed destination of a marker.
+        (WebCore::SVGMarkerData::marker): Holds a pointer to the associated SVGResourceMarker object, which we're aiming to layout.
+        (WebCore::SVGMarkerData::currentAngle): Calculates the current angle for a certain marker type (start/mid/end) based upon the computed inslope/outslope values.
+        (WebCore::SVGMarkerData::updateTypeAndMarker): Helper method.
+        (WebCore::SVGMarkerData::updateOutslope): Ditto.
+        (WebCore::SVGMarkerData::updateMarkerDataForPathElement): Does the actual inslope/outslope calculation.
+        (WebCore::SVGMarkerData::updateInslope): Helper method.
+        * rendering/SVGMarkerLayoutInfo.cpp: Added. New approach to build marker layout info, this time correct during layout() time instead of paint() time.
+        (WebCore::SVGMarkerLayoutInfo::SVGMarkerLayoutInfo):
+        (WebCore::SVGMarkerLayoutInfo::~SVGMarkerLayoutInfo):
+        (WebCore::processStartAndMidMarkers): Static helper method used to visit each path element in order to calculate inslopes/outslopes (-> orientation angles)
+        (WebCore::SVGMarkerLayoutInfo::calculateBoundaries): Build list of MarkerLayout objects, used to query boundaries, and to paint markers during drawMarkers().
+        (WebCore::SVGMarkerLayoutInfo::drawMarkers): Cheap method walking existing MarkerLayout vector, drawing the individual RenderSVGViewportContainer of the markers.
+        (WebCore::SVGMarkerLayoutInfo::addLayoutedMarker): Helper method.
+        * rendering/SVGMarkerLayoutInfo.h: Added.
+        (WebCore::MarkerLayout::MarkerLayout): Helper struct storing a pair of SVGResourceMarker* and a TranformationMatrix.
+        (WebCore::SVGMarkerLayoutInfo::markerData): Public helper methods returning references to private member variables, used from processStartAndMidMarkers.
+        (WebCore::SVGMarkerLayoutInfo::midMarker): Ditto.
+        (WebCore::SVGMarkerLayoutInfo::elementIndex): Ditto.
+        * svg/SVGMarkerElement.cpp: Adopt to name change: setRef() -> setReferencePoint(). setMarker() -> setRenderer()
+        (WebCore::SVGMarkerElement::canvasResource): Add ASSERT(renderer()) to clarify that canvasResource() is only meant to used after renderer creation.
+        * svg/graphics/SVGResource.cpp: Instead of maintaining a global hashmap between SVGStyledElements and an array of possible SVGResources, use a HashSet of SVGResources
+                                        and directly scan the already existing list of clients for a certain SVGResource. This wrong approach has been introduced over two years
+                                        ago, making the assumption that there's only one resource type per element. Though markers can provide three resources of the same type
+                                        per element (all SVGResourceMarker objects, but in different rules: start/mid/end marker). That information is only available while painting.
+        (WebCore::resourceSet): Add global static HashSet<SVGResource*>.
+        (WebCore::SVGResource::SVGResource): Add us to the resourceSet.
+        (WebCore::SVGResource::~SVGResource): Remove us from resourceSet.
+        (WebCore::SVGResource::removeClient): Traverse all SVGResource clients and remove the passed SVGStyledElement from the client list (invoked by SVGStyledElement destructor).
+        (WebCore::SVGResource::addClient): Remove the offending part of the old approach, making the wrong assumption regarding resource types.
+        * svg/graphics/SVGResourceMarker.cpp:
+        (WebCore::SVGResourceMarker::SVGResourceMarker):
+        (WebCore::SVGResourceMarker::markerTransformation): Create TransformationMatrix in the local marker content (RenderSVGViewportContainer) coordinate system, to position a marker.
+        (WebCore::SVGResourceMarker::draw): Simplify marker drawing a lot: used the passing TransformationMatrix (cached in SVGMarkerLayoutInfo) to draw the marker content renderer.
+        (WebCore::SVGResourceMarker::externalRepresentation): Adopt to refX/refY -> referencePoint changes.
+        * svg/graphics/SVGResourceMarker.h: Store a FloatPoint m_referecePoint instead of two refX/refY float values.
+        (WebCore::SVGResourceMarker::setRenderer): Renamed from setMarker().
+        (WebCore::SVGResourceMarker::setReferencePoint): Renamed from setRef().
+        (WebCore::SVGResourceMarker::referencePoint): New accessor replacing refX() / refY().
+
 2010-01-04  Simon Hausmann  <simon.hausmann at nokia.com>
 
         Reviewed by Tor Arne Vestbø.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index c6c97b7..a9f89f8 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -2950,6 +2950,9 @@ webcore_sources += \
 	WebCore/rendering/SVGInlineFlowBox.h \
 	WebCore/rendering/SVGInlineTextBox.cpp \
 	WebCore/rendering/SVGInlineTextBox.h \
+	WebCore/rendering/SVGMarkerData.h \
+	WebCore/rendering/SVGMarkerLayoutInfo.cpp \
+	WebCore/rendering/SVGMarkerLayoutInfo.h \
 	WebCore/rendering/SVGRenderSupport.cpp \
 	WebCore/rendering/SVGRenderSupport.h \
 	WebCore/rendering/SVGRenderTreeAsText.cpp \
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index be7a576..a88644a 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -2141,6 +2141,8 @@ HEADERS += \
     rendering/SVGCharacterLayoutInfo.h \
     rendering/SVGInlineFlowBox.h \
     rendering/SVGInlineTextBox.h \
+    rendering/SVGMarkerData.h \
+    rendering/SVGMarkerLayoutInfo.h \
     rendering/SVGRenderSupport.h \
     rendering/SVGRenderTreeAsText.h \
     rendering/SVGRootInlineBox.h \
@@ -3117,6 +3119,7 @@ contains(DEFINES, ENABLE_SVG=1) {
         rendering/SVGCharacterLayoutInfo.cpp \
         rendering/SVGInlineFlowBox.cpp \
         rendering/SVGInlineTextBox.cpp \
+        rendering/SVGMarkerLayoutInfo.cpp \
         rendering/SVGRenderSupport.cpp \
         rendering/SVGRootInlineBox.cpp
 
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 9df9a45..81ce740 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -27819,6 +27819,18 @@
 				>
 			</File>
 			<File
+				RelativePath="..\rendering\SVGMarkerData.h"
+				>
+			</File>
+			<File
+				RelativePath="..\rendering\SVGMarkerLayoutInfo.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\rendering\SVGMarkerLayoutInfo.h"
+				>
+			</File>
+			<File
 				RelativePath="..\rendering\SVGRenderSupport.cpp"
 				>
 			</File>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 92975bb..0f6baab 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -62,6 +62,7 @@
 		08203AA00ED8C35300B8B61A /* WMLAccessElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08203A9E0ED8C35300B8B61A /* WMLAccessElement.h */; };
 		082341C50FCF3A9500D75BD6 /* WMLSelectElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 082341C30FCF3A9400D75BD6 /* WMLSelectElement.cpp */; };
 		082341C60FCF3A9500D75BD6 /* WMLSelectElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 082341C40FCF3A9400D75BD6 /* WMLSelectElement.h */; };
+		08385FF610F0186000BFE07B /* SVGMarkerData.h in Headers */ = {isa = PBXBuildFile; fileRef = 08385FF510F0186000BFE07B /* SVGMarkerData.h */; };
 		0839476C0ECE4BD600027350 /* WMLElementFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08FB84B00ECE373300DC064E /* WMLElementFactory.cpp */; };
 		0839476D0ECE4BD600027350 /* WMLElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 08FB84B10ECE373300DC064E /* WMLElementFactory.h */; };
 		083DAEA60F01A7FB00342754 /* RenderTextControlMultiLine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 083DAEA20F01A7FB00342754 /* RenderTextControlMultiLine.cpp */; };
@@ -88,6 +89,8 @@
 		087281560F26B9B600AFC596 /* OptionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 087281520F26B9B600AFC596 /* OptionElement.h */; };
 		087281570F26B9B600AFC596 /* OptionGroupElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 087281530F26B9B600AFC596 /* OptionGroupElement.cpp */; };
 		087281580F26B9B600AFC596 /* OptionGroupElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 087281540F26B9B600AFC596 /* OptionGroupElement.h */; };
+		08735FB810E91232006D6FAD /* SVGMarkerLayoutInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08735FB610E91232006D6FAD /* SVGMarkerLayoutInfo.cpp */; };
+		08735FB910E91232006D6FAD /* SVGMarkerLayoutInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 08735FB710E91232006D6FAD /* SVGMarkerLayoutInfo.h */; };
 		08744BAA0EDB7D86004C9E63 /* WMLOnEventElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08744BA90EDB7D86004C9E63 /* WMLOnEventElement.cpp */; };
 		08744BAE0EDB7D92004C9E63 /* WMLOnEventElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08744BAD0EDB7D92004C9E63 /* WMLOnEventElement.h */; };
 		0878B1FD10874E3F00A55097 /* SVGAnimatedProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1F910874E3F00A55097 /* SVGAnimatedProperty.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -5278,6 +5281,7 @@
 		08203A9E0ED8C35300B8B61A /* WMLAccessElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLAccessElement.h; sourceTree = "<group>"; };
 		082341C30FCF3A9400D75BD6 /* WMLSelectElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLSelectElement.cpp; sourceTree = "<group>"; };
 		082341C40FCF3A9400D75BD6 /* WMLSelectElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLSelectElement.h; sourceTree = "<group>"; };
+		08385FF510F0186000BFE07B /* SVGMarkerData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerData.h; sourceTree = "<group>"; };
 		083DAEA20F01A7FB00342754 /* RenderTextControlMultiLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTextControlMultiLine.cpp; sourceTree = "<group>"; };
 		083DAEA30F01A7FB00342754 /* RenderTextControlMultiLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderTextControlMultiLine.h; sourceTree = "<group>"; };
 		083DAEA40F01A7FB00342754 /* RenderTextControlSingleLine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTextControlSingleLine.cpp; sourceTree = "<group>"; };
@@ -5302,6 +5306,8 @@
 		087281520F26B9B600AFC596 /* OptionElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionElement.h; sourceTree = "<group>"; };
 		087281530F26B9B600AFC596 /* OptionGroupElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OptionGroupElement.cpp; sourceTree = "<group>"; };
 		087281540F26B9B600AFC596 /* OptionGroupElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OptionGroupElement.h; sourceTree = "<group>"; };
+		08735FB610E91232006D6FAD /* SVGMarkerLayoutInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGMarkerLayoutInfo.cpp; sourceTree = "<group>"; };
+		08735FB710E91232006D6FAD /* SVGMarkerLayoutInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMarkerLayoutInfo.h; sourceTree = "<group>"; };
 		08744BA90EDB7D86004C9E63 /* WMLOnEventElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLOnEventElement.cpp; sourceTree = "<group>"; };
 		08744BAD0EDB7D92004C9E63 /* WMLOnEventElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLOnEventElement.h; sourceTree = "<group>"; };
 		0878B1F910874E3F00A55097 /* SVGAnimatedProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedProperty.h; sourceTree = "<group>"; };
@@ -15560,6 +15566,9 @@
 				853CA9E30AEEC608002372DC /* SVGInlineFlowBox.h */,
 				AA0972CA0B6947A800A705E9 /* SVGInlineTextBox.cpp */,
 				AA0972CB0B6947A800A705E9 /* SVGInlineTextBox.h */,
+				08385FF510F0186000BFE07B /* SVGMarkerData.h */,
+				08735FB610E91232006D6FAD /* SVGMarkerLayoutInfo.cpp */,
+				08735FB710E91232006D6FAD /* SVGMarkerLayoutInfo.h */,
 				A8F4FB950C169E85002AFED5 /* SVGRenderSupport.cpp */,
 				A8F4FB930C169E7B002AFED5 /* SVGRenderSupport.h */,
 				B2EBDC9A0AF77E3400AE4A68 /* SVGRenderTreeAsText.cpp */,
@@ -18265,6 +18274,8 @@
 				BC56CB2310D5AC8000A77C64 /* GeolocationControllerClient.h in Headers */,
 				BC56CB2410D5AC8000A77C64 /* GeolocationError.h in Headers */,
 				BC56CB2510D5AC8000A77C64 /* GeolocationPosition.h in Headers */,
+				08735FB910E91232006D6FAD /* SVGMarkerLayoutInfo.h in Headers */,
+				08385FF610F0186000BFE07B /* SVGMarkerData.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -20421,6 +20432,7 @@
 				0C3F1F5A10C8871200D72CE1 /* WebGLUniformLocation.cpp in Sources */,
 				0C45342710CDBBFA00869157 /* JSWebGLUniformLocation.cpp in Sources */,
 				BC56CB2110D5AC8000A77C64 /* GeolocationController.cpp in Sources */,
+				08735FB810E91232006D6FAD /* SVGMarkerLayoutInfo.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp
index 483a220..2c3901c 100644
--- a/WebCore/page/FrameView.cpp
+++ b/WebCore/page/FrameView.cpp
@@ -597,7 +597,8 @@ void FrameView::layout(bool allowSubtree)
     }
 
     if (!subtree) {
-        RenderObject* rootRenderer = document->documentElement() ? document->documentElement()->renderer() : 0;
+        Node* documentElement = document->documentElement();
+        RenderObject* rootRenderer = documentElement ? documentElement->renderer() : 0;
         Node* body = document->body();
         if (body && body->renderer()) {
             if (body->hasTagName(framesetTag)) {
@@ -612,8 +613,15 @@ void FrameView::layout(bool allowSubtree)
                 RenderObject* o = rootRenderer->style()->overflowX() == OVISIBLE && document->documentElement()->hasTagName(htmlTag) ? body->renderer() : rootRenderer;
                 applyOverflowToViewport(o, hMode, vMode);
             }
-        } else if (rootRenderer)
+        } else if (rootRenderer) {
+#if ENABLE(SVG)
+            if (documentElement->isSVGElement()) {
+                if (!m_firstLayout && (m_size.width() != layoutWidth() || m_size.height() != layoutHeight()))
+                    rootRenderer->setChildNeedsLayout(true);
+            }
+#endif
             applyOverflowToViewport(rootRenderer, hMode, vMode);
+        }
 #ifdef INSTRUMENT_LAYOUT_SCHEDULING
         if (m_firstLayout && !document->ownerElement())
             printf("Elapsed time before first layout: %d\n", document->elapsedTime());
diff --git a/WebCore/rendering/RenderPath.cpp b/WebCore/rendering/RenderPath.cpp
index a919d01..30cbedf 100644
--- a/WebCore/rendering/RenderPath.cpp
+++ b/WebCore/rendering/RenderPath.cpp
@@ -131,6 +131,17 @@ FloatRect RenderPath::strokeBoundingBox() const
     return m_cachedLocalStrokeBBox;
 }
 
+FloatRect RenderPath::markerBoundingBox() const
+{
+    if (m_path.isEmpty())
+        return FloatRect();
+
+    if (m_cachedLocalMarkerBBox.isEmpty())
+        calculateMarkerBoundsIfNeeded();
+
+    return m_cachedLocalMarkerBBox;
+}
+
 FloatRect RenderPath::repaintRectInLocalCoordinates() const
 {
     if (m_path.isEmpty())
@@ -140,16 +151,15 @@ FloatRect RenderPath::repaintRectInLocalCoordinates() const
     if (!m_cachedLocalRepaintRect.isEmpty())
         return m_cachedLocalRepaintRect;
 
-    m_cachedLocalRepaintRect = strokeBoundingBox();
-
-    // Markers and filters can paint outside of the stroke path
-    m_cachedLocalRepaintRect.unite(m_markerBounds);
-
     // FIXME: We need to be careful here. We assume that there is no filter,
-    // clipper or masker if the rects are empty.
+    // clipper, marker or masker if the rects are empty.
     FloatRect rect = filterBoundingBoxForRenderer(this);
     if (!rect.isEmpty())
         m_cachedLocalRepaintRect = rect;
+    else {
+        m_cachedLocalRepaintRect = strokeBoundingBox();
+        m_cachedLocalRepaintRect.unite(markerBoundingBox());
+    }
 
     rect = clipperBoundingBoxForRenderer(this);
     if (!rect.isEmpty())
@@ -168,11 +178,7 @@ void RenderPath::setPath(const Path& newPath)
     m_cachedLocalRepaintRect = FloatRect();
     m_cachedLocalStrokeBBox = FloatRect();
     m_cachedLocalFillBBox = FloatRect();
-}
-
-const Path& RenderPath::path() const
-{
-    return m_path;
+    m_cachedLocalMarkerBBox = FloatRect();
 }
 
 void RenderPath::layout()
@@ -224,7 +230,7 @@ void RenderPath::paint(PaintInfo& paintInfo, int, int)
             fillAndStrokePath(m_path, paintInfo.context, style(), this);
 
             if (static_cast<SVGStyledElement*>(node())->supportsMarkers())
-                m_markerBounds = drawMarkersIfNeeded(paintInfo, m_path);
+                m_markerLayoutInfo.drawMarkers(paintInfo);
         }
         finishRenderSVGContent(this, paintInfo, filter, savedInfo.context);
     }
@@ -267,136 +273,20 @@ bool RenderPath::nodeAtFloatPoint(const HitTestRequest&, HitTestResult& result,
     return false;
 }
 
-enum MarkerType {
-    Start,
-    Mid,
-    End
-};
-
-struct MarkerData {
-    FloatPoint origin;
-    FloatPoint subpathStart;
-    double strokeWidth;
-    FloatPoint inslopePoints[2];
-    FloatPoint outslopePoints[2];
-    MarkerType type;
-    SVGResourceMarker* marker;
-};
-
-struct DrawMarkersData {
-    DrawMarkersData(RenderObject::PaintInfo&, SVGResourceMarker* startMarker, SVGResourceMarker* midMarker, double strokeWidth);
-    RenderObject::PaintInfo& paintInfo;
-    int elementIndex;
-    MarkerData previousMarkerData;
-    SVGResourceMarker* midMarker;
-};
-
-DrawMarkersData::DrawMarkersData(RenderObject::PaintInfo& pi, SVGResourceMarker* start, SVGResourceMarker* mid, double strokeWidth)
-    : paintInfo(pi)
-    , elementIndex(0)
-    , midMarker(mid)
-{
-    previousMarkerData.origin = FloatPoint();
-    previousMarkerData.subpathStart = FloatPoint();
-    previousMarkerData.strokeWidth = strokeWidth;
-    previousMarkerData.marker = start;
-    previousMarkerData.type = Start;
-}
-
-static void drawMarkerWithData(RenderObject::PaintInfo& paintInfo, MarkerData& data)
-{
-    if (!data.marker)
-        return;
-
-    FloatPoint inslopeChange = data.inslopePoints[1] - FloatSize(data.inslopePoints[0].x(), data.inslopePoints[0].y());
-    FloatPoint outslopeChange = data.outslopePoints[1] - FloatSize(data.outslopePoints[0].x(), data.outslopePoints[0].y());
-
-    double inslope = rad2deg(atan2(inslopeChange.y(), inslopeChange.x()));
-    double outslope = rad2deg(atan2(outslopeChange.y(), outslopeChange.x()));
-
-    double angle = 0.0;
-    switch (data.type) {
-        case Start:
-            angle = outslope;
-            break;
-        case Mid:
-            angle = (inslope + outslope) / 2;
-            break;
-        case End:
-            angle = inslope;
-    }
-
-    data.marker->draw(paintInfo, data.origin.x(), data.origin.y(), data.strokeWidth, angle);
-}
-
-static inline void updateMarkerDataForElement(MarkerData& previousMarkerData, const PathElement* element)
-{
-    FloatPoint* points = element->points;
-    
-    switch (element->type) {
-    case PathElementAddQuadCurveToPoint:
-        // TODO
-        previousMarkerData.origin = points[1];
-        break;
-    case PathElementAddCurveToPoint:
-        previousMarkerData.inslopePoints[0] = points[1];
-        previousMarkerData.inslopePoints[1] = points[2];
-        previousMarkerData.origin = points[2];
-        break;
-    case PathElementMoveToPoint:
-        previousMarkerData.subpathStart = points[0];
-    case PathElementAddLineToPoint:
-        previousMarkerData.inslopePoints[0] = previousMarkerData.origin;
-        previousMarkerData.inslopePoints[1] = points[0];
-        previousMarkerData.origin = points[0];
-        break;
-    case PathElementCloseSubpath:
-        previousMarkerData.inslopePoints[0] = previousMarkerData.origin;
-        previousMarkerData.inslopePoints[1] = points[0];
-        previousMarkerData.origin = previousMarkerData.subpathStart;
-        previousMarkerData.subpathStart = FloatPoint();
-    }
-}
-
-static void drawStartAndMidMarkers(void* info, const PathElement* element)
-{
-    DrawMarkersData& data = *reinterpret_cast<DrawMarkersData*>(info);
-
-    int elementIndex = data.elementIndex;
-    MarkerData& previousMarkerData = data.previousMarkerData;
-
-    FloatPoint* points = element->points;
-
-    // First update the outslope for the previous element
-    previousMarkerData.outslopePoints[0] = previousMarkerData.origin;
-    previousMarkerData.outslopePoints[1] = points[0];
-
-    // Draw the marker for the previous element
-    if (elementIndex != 0)
-        drawMarkerWithData(data.paintInfo, previousMarkerData);
-
-    // Update our marker data for this element
-    updateMarkerDataForElement(previousMarkerData, element);
-
-    if (elementIndex == 1) {
-        // After drawing the start marker, switch to drawing mid markers
-        previousMarkerData.marker = data.midMarker;
-        previousMarkerData.type = Mid;
-    }
-
-    data.elementIndex++;
-}
-
-FloatRect RenderPath::drawMarkersIfNeeded(PaintInfo& paintInfo, const Path& path) const
+void RenderPath::calculateMarkerBoundsIfNeeded() const
 {
     Document* doc = document();
 
     SVGElement* svgElement = static_cast<SVGElement*>(node());
-    ASSERT(svgElement && svgElement->document() && svgElement->isStyled());
+    ASSERT(svgElement && svgElement->document());
+    if (!svgElement->isStyled())
+        return;
 
     SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(svgElement);
-    const SVGRenderStyle* svgStyle = style()->svgStyle();
+    if (!styledElement->supportsMarkers())
+        return;
 
+    const SVGRenderStyle* svgStyle = style()->svgStyle();
     AtomicString startMarkerId(svgStyle->startMarker());
     AtomicString midMarkerId(svgStyle->midMarker());
     AtomicString endMarkerId(svgStyle->endMarker());
@@ -421,32 +311,10 @@ FloatRect RenderPath::drawMarkersIfNeeded(PaintInfo& paintInfo, const Path& path
         endMarker->addClient(styledElement);
 
     if (!startMarker && !midMarker && !endMarker)
-        return FloatRect();
-
-    double strokeWidth = SVGRenderStyle::cssPrimitiveToLength(this, svgStyle->strokeWidth(), 1.0f);
-    DrawMarkersData data(paintInfo, startMarker, midMarker, strokeWidth);
-
-    path.apply(&data, drawStartAndMidMarkers);
-
-    data.previousMarkerData.marker = endMarker;
-    data.previousMarkerData.type = End;
-    drawMarkerWithData(paintInfo, data.previousMarkerData);
-
-    // We know the marker boundaries, only after they're drawn!
-    // Otherwhise we'd need to do all the marker calculation twice
-    // once here (through paint()) and once in absoluteClippedOverflowRect().
-    FloatRect bounds;
-
-    if (startMarker)
-        bounds.unite(startMarker->cachedBounds());
-
-    if (midMarker)
-        bounds.unite(midMarker->cachedBounds());
-
-    if (endMarker)
-        bounds.unite(endMarker->cachedBounds());
+        return;
 
-    return bounds;
+    float strokeWidth = SVGRenderStyle::cssPrimitiveToLength(this, svgStyle->strokeWidth(), 1.0f);
+    m_cachedLocalMarkerBBox = m_markerLayoutInfo.calculateBoundaries(startMarker, midMarker, endMarker, strokeWidth, m_path);
 }
 
 }
diff --git a/WebCore/rendering/RenderPath.h b/WebCore/rendering/RenderPath.h
index 44ead17..ae08088 100644
--- a/WebCore/rendering/RenderPath.h
+++ b/WebCore/rendering/RenderPath.h
@@ -25,9 +25,9 @@
 #define RenderPath_h
 
 #if ENABLE(SVG)
-
 #include "FloatRect.h"
 #include "RenderSVGModelObject.h"
+#include "SVGMarkerLayoutInfo.h"
 #include "TransformationMatrix.h"
 
 namespace WebCore {
@@ -40,7 +40,7 @@ class RenderPath : public RenderSVGModelObject {
 public:
     RenderPath(SVGStyledTransformableElement*);
 
-    const Path& path() const;
+    const Path& path() const { return m_path; }
 
 private:
     // Hit-detection seperated for the fill and the stroke
@@ -49,7 +49,7 @@ private:
 
     virtual FloatRect objectBoundingBox() const;
     virtual FloatRect strokeBoundingBox() const;
-    virtual FloatRect markerBoundingBox() const { return m_markerBounds; }
+    virtual FloatRect markerBoundingBox() const;
     virtual FloatRect repaintRectInLocalCoordinates() const;
 
     virtual TransformationMatrix localToParentTransform() const;
@@ -65,7 +65,7 @@ private:
 
     virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction);
 
-    FloatRect drawMarkersIfNeeded(PaintInfo&, const Path&) const;
+    void calculateMarkerBoundsIfNeeded() const;
 
 private:
     virtual TransformationMatrix localTransform() const;
@@ -74,7 +74,8 @@ private:
     mutable FloatRect m_cachedLocalFillBBox;
     mutable FloatRect m_cachedLocalStrokeBBox;
     mutable FloatRect m_cachedLocalRepaintRect;
-    FloatRect m_markerBounds;
+    mutable FloatRect m_cachedLocalMarkerBBox;
+    mutable SVGMarkerLayoutInfo m_markerLayoutInfo;
     TransformationMatrix m_localTransform;
 };
 
@@ -97,5 +98,3 @@ void toRenderPath(const RenderPath*);
 
 #endif // ENABLE(SVG)
 #endif
-
-// vim:ts=4:noet
diff --git a/WebCore/rendering/RenderSVGContainer.h b/WebCore/rendering/RenderSVGContainer.h
index 318c1cc..f681e50 100644
--- a/WebCore/rendering/RenderSVGContainer.h
+++ b/WebCore/rendering/RenderSVGContainer.h
@@ -42,10 +42,9 @@ public:
     void setDrawsContents(bool);
     bool drawsContents() const;
 
-protected:
     virtual void paint(PaintInfo&, int parentX, int parentY);
 
-private:
+protected:
     virtual RenderObjectChildList* virtualChildren() { return children(); }
     virtual const RenderObjectChildList* virtualChildren() const { return children(); }
 
@@ -72,6 +71,7 @@ private:
 
     bool selfWillPaint() const;
 
+private:
     RenderObjectChildList m_children;
     bool m_drawsContents : 1;
 };
diff --git a/WebCore/rendering/RenderSVGViewportContainer.cpp b/WebCore/rendering/RenderSVGViewportContainer.cpp
index a432ef3..ef8207a 100644
--- a/WebCore/rendering/RenderSVGViewportContainer.cpp
+++ b/WebCore/rendering/RenderSVGViewportContainer.cpp
@@ -38,17 +38,27 @@ RenderSVGViewportContainer::RenderSVGViewportContainer(SVGStyledElement* node)
 {
 }
 
-void RenderSVGViewportContainer::paint(PaintInfo& paintInfo, int parentX, int parentY)
+FloatRect RenderSVGViewportContainer::markerBoundaries(const TransformationMatrix& markerTransformation) const
 {
-    // FIXME: The if statement here evaluates to false. isEmpty() is exactly the same
-    // as what is on the right side, so it's basically !isEmpty && isEmpty. So this
-    // function does nothing.
+    FloatRect coordinates = repaintRectInLocalCoordinates();
 
-    // A value of zero disables rendering of the element. 
-    if (!m_viewport.isEmpty() && (m_viewport.width() <= 0. || m_viewport.height() <= 0.))
-        return;
+    // Map repaint rect into parent coordinate space, in which the marker boundaries have to be evaluated
+    coordinates = localToParentTransform().mapRect(coordinates);
 
-    RenderSVGContainer::paint(paintInfo, parentX, parentY);
+    return markerTransformation.mapRect(coordinates);
+}
+
+TransformationMatrix RenderSVGViewportContainer::markerContentTransformation(const TransformationMatrix& contentTransformation, const FloatPoint& origin, float strokeWidth) const
+{
+    // The 'origin' coordinate maps to SVGs refX/refY, given in coordinates relative to the viewport established by the marker
+    FloatPoint mappedOrigin = viewportTransform().mapPoint(origin);
+
+    TransformationMatrix transformation = contentTransformation;
+    if (strokeWidth != -1)
+        transformation.scaleNonUniform(strokeWidth, strokeWidth);
+
+    transformation.translate(-mappedOrigin.x(), -mappedOrigin.y());
+    return transformation;
 }
 
 void RenderSVGViewportContainer::applyViewportClip(PaintInfo& paintInfo)
@@ -125,5 +135,3 @@ bool RenderSVGViewportContainer::pointIsInsideViewportClip(const FloatPoint& poi
 }
 
 #endif // ENABLE(SVG)
-
-// vim:ts=4:noet
diff --git a/WebCore/rendering/RenderSVGViewportContainer.h b/WebCore/rendering/RenderSVGViewportContainer.h
index b8b30b5..2dc5544 100644
--- a/WebCore/rendering/RenderSVGViewportContainer.h
+++ b/WebCore/rendering/RenderSVGViewportContainer.h
@@ -24,7 +24,6 @@
 #define RenderSVGViewportContainer_h
 
 #if ENABLE(SVG)
-
 #include "RenderSVGContainer.h"
 
 namespace WebCore {
@@ -35,15 +34,18 @@ class RenderSVGViewportContainer : public RenderSVGContainer {
 public:
     RenderSVGViewportContainer(SVGStyledElement*);
 
-    // FIXME: This is only public for SVGResourceMarker::draw, likely the callsite should be changed.
-    TransformationMatrix viewportTransform() const;
+    // Calculates marker boundaries, mapped to the target element's coordinate space
+    FloatRect markerBoundaries(const TransformationMatrix& markerTransformation) const;
 
-    virtual void paint(PaintInfo&, int parentX, int parentY);
+    // Generates a transformation matrix usable to render marker content. Handles scaling the marker content
+    // acording to SVGs markerUnits="strokeWidth" concept, when a strokeWidth value != -1 is passed in.
+    TransformationMatrix markerContentTransformation(const TransformationMatrix& contentTransformation, const FloatPoint& origin, float strokeWidth = -1) const;
 
 private:
     virtual bool isSVGContainer() const { return true; }
     virtual const char* renderName() const { return "RenderSVGViewportContainer"; }
 
+    TransformationMatrix viewportTransform() const;
     virtual TransformationMatrix localToParentTransform() const;
 
     // FIXME: This override should be removed once callers of RenderBox::absoluteTransform() can be removed.
@@ -70,5 +72,3 @@ void toRenderSVGViewportContainer(const RenderSVGViewportContainer*);
 
 #endif // ENABLE(SVG)
 #endif // RenderSVGViewportContainer_h
-
-// vim:ts=4:noet
diff --git a/WebCore/rendering/SVGMarkerData.h b/WebCore/rendering/SVGMarkerData.h
new file mode 100644
index 0000000..5ff2993
--- /dev/null
+++ b/WebCore/rendering/SVGMarkerData.h
@@ -0,0 +1,134 @@
+/*
+    Copyright (C) Research In Motion Limited 2010. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    aint with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef SVGMarkerData_h
+#define SVGMarkerData_h
+
+#if ENABLE(SVG)
+#include "FloatConversion.h"
+#include "Path.h"
+#include <wtf/MathExtras.h>
+
+namespace WebCore {
+
+class SVGResourceMarker;
+
+class SVGMarkerData {
+public:
+    enum Type {
+        Unknown = 0,
+        Start,
+        Mid,
+        End
+    };
+
+    SVGMarkerData(const Type& type = Unknown, SVGResourceMarker* marker = 0)
+        : m_type(type)
+        , m_marker(marker)
+    {
+    }
+
+    FloatPoint origin() const { return m_origin; }
+    SVGResourceMarker* marker() const { return m_marker; }
+
+    float currentAngle() const
+    {
+        FloatSize inslopeChange = m_inslopePoints[1] - m_inslopePoints[0];
+        FloatSize outslopeChange = m_outslopePoints[1] - m_outslopePoints[0];
+
+        double inslope = rad2deg(atan2(inslopeChange.height(), inslopeChange.width()));
+        double outslope = rad2deg(atan2(outslopeChange.height(), outslopeChange.width()));
+
+        double angle = 0;
+        switch (m_type) {
+        case Start:
+            angle = outslope;
+            break;
+        case Mid:
+            angle = (inslope + outslope) / 2;
+            break;
+        case End:
+            angle = inslope;
+            break;
+        default:
+            ASSERT_NOT_REACHED();
+            break;
+        }
+
+        return narrowPrecisionToFloat(angle);
+    }
+
+    void updateTypeAndMarker(const Type& type, SVGResourceMarker* marker)
+    {
+        m_type = type;
+        m_marker = marker;
+    }
+
+    void updateOutslope(const FloatPoint& point)
+    {
+        m_outslopePoints[0] = m_origin;
+        m_outslopePoints[1] = point;
+    }
+
+    void updateMarkerDataForPathElement(const PathElement* element)
+    {
+        FloatPoint* points = element->points;
+
+        switch (element->type) {
+        case PathElementAddQuadCurveToPoint:
+            // FIXME: https://bugs.webkit.org/show_bug.cgi?id=33115 (PathElementAddQuadCurveToPoint not handled for <marker>)
+            m_origin = points[1];
+            break;
+        case PathElementAddCurveToPoint:
+            m_inslopePoints[0] = points[1];
+            m_inslopePoints[1] = points[2];
+            m_origin = points[2];
+            break;
+        case PathElementMoveToPoint:
+            m_subpathStart = points[0];
+        case PathElementAddLineToPoint:
+            updateInslope(points[0]);
+            m_origin = points[0];
+            break;
+        case PathElementCloseSubpath:
+            updateInslope(points[0]);
+            m_origin = m_subpathStart;
+            m_subpathStart = FloatPoint();
+        }
+    }
+
+private:
+    void updateInslope(const FloatPoint& point)
+    {
+        m_inslopePoints[0] = m_origin;
+        m_inslopePoints[1] = point;
+    }
+
+    Type m_type;
+    SVGResourceMarker* m_marker;
+    FloatPoint m_origin;
+    FloatPoint m_subpathStart;
+    FloatPoint m_inslopePoints[2];
+    FloatPoint m_outslopePoints[2];
+};
+
+}
+
+#endif // ENABLE(SVG)
+#endif // SVGMarkerData_h
diff --git a/WebCore/rendering/SVGMarkerLayoutInfo.cpp b/WebCore/rendering/SVGMarkerLayoutInfo.cpp
new file mode 100644
index 0000000..3fe513f
--- /dev/null
+++ b/WebCore/rendering/SVGMarkerLayoutInfo.cpp
@@ -0,0 +1,124 @@
+/*
+    Copyright (C) Research In Motion Limited 2010. All rights reserved.
+                  2004, 2005, 2007 Nikolas Zimmermann <zimmermann at kde.org>
+                  2004, 2005, 2008 Rob Buis <buis at kde.org>
+                  2005, 2007 Eric Seidel <eric at webkit.org>
+                  2009 Google, Inc.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    aint with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "SVGMarkerLayoutInfo.h"
+
+#include "RenderSVGViewportContainer.h"
+#include "SVGResourceMarker.h"
+
+namespace WebCore {
+
+SVGMarkerLayoutInfo::SVGMarkerLayoutInfo()
+    : m_midMarker(0)
+    , m_elementIndex(0)
+    , m_strokeWidth(0)
+{
+}
+
+SVGMarkerLayoutInfo::~SVGMarkerLayoutInfo()
+{
+}
+
+static inline void processStartAndMidMarkers(void* infoPtr, const PathElement* element)
+{
+    SVGMarkerLayoutInfo& info = *reinterpret_cast<SVGMarkerLayoutInfo*>(infoPtr);
+    SVGMarkerData& markerData = info.markerData();
+    int& elementIndex = info.elementIndex();
+
+    // First update the outslope for the previous element
+    markerData.updateOutslope(element->points[0]);
+
+    // Draw the marker for the previous element
+    SVGResourceMarker* marker = markerData.marker();
+    if (elementIndex > 0 && marker)
+        info.addLayoutedMarker(marker, markerData.origin(), markerData.currentAngle());
+
+    // Update our marker data for this element
+    markerData.updateMarkerDataForPathElement(element);
+
+    // After drawing the start marker, switch to drawing mid markers
+    if (elementIndex == 1)
+        markerData.updateTypeAndMarker(SVGMarkerData::Mid, info.midMarker());
+
+    ++elementIndex;
+}
+
+FloatRect SVGMarkerLayoutInfo::calculateBoundaries(SVGResourceMarker* startMarker, SVGResourceMarker* midMarker, SVGResourceMarker* endMarker, float strokeWidth, const Path& path)
+{
+    m_layout.clear();
+    m_midMarker = midMarker;
+    m_strokeWidth = strokeWidth;
+    m_elementIndex = 0;
+    m_markerData = SVGMarkerData(SVGMarkerData::Start, startMarker);
+    path.apply(this, processStartAndMidMarkers);
+
+    if (endMarker) {
+        m_markerData.updateTypeAndMarker(SVGMarkerData::End, endMarker);
+        addLayoutedMarker(endMarker, m_markerData.origin(), m_markerData.currentAngle());
+    }
+
+    if (m_layout.isEmpty())
+        return FloatRect();
+
+    Vector<MarkerLayout>::iterator it = m_layout.begin();
+    Vector<MarkerLayout>::iterator end = m_layout.end();
+
+    FloatRect bounds;
+    for (; it != end; ++it) {
+        MarkerLayout& layout = *it;
+
+        RenderSVGViewportContainer* markerContent = layout.marker->renderer();
+        ASSERT(markerContent);
+
+        bounds.unite(markerContent->markerBoundaries(layout.matrix));
+    }
+
+    return bounds;
+}
+
+void SVGMarkerLayoutInfo::drawMarkers(RenderObject::PaintInfo& paintInfo)
+{
+    if (m_layout.isEmpty())
+        return;
+
+    Vector<MarkerLayout>::iterator it = m_layout.begin();
+    Vector<MarkerLayout>::iterator end = m_layout.end();
+
+    for (; it != end; ++it) {
+        MarkerLayout& layout = *it;
+        layout.marker->draw(paintInfo, layout.matrix);
+    }
+}
+
+void SVGMarkerLayoutInfo::addLayoutedMarker(SVGResourceMarker* marker, const FloatPoint& origin, float angle)
+{
+    ASSERT(marker);
+    m_layout.append(MarkerLayout(marker, marker->markerTransformation(origin, angle, m_strokeWidth)));
+}
+
+}
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/rendering/SVGMarkerLayoutInfo.h b/WebCore/rendering/SVGMarkerLayoutInfo.h
new file mode 100644
index 0000000..1dfeee9
--- /dev/null
+++ b/WebCore/rendering/SVGMarkerLayoutInfo.h
@@ -0,0 +1,74 @@
+/*
+    Copyright (C) Research In Motion Limited 2010. All rights reserved.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    aint with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef SVGMarkerLayoutInfo_h
+#define SVGMarkerLayoutInfo_h
+
+#if ENABLE(SVG)
+#include "RenderObject.h"
+#include "SVGMarkerData.h"
+#include <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class Path;
+class SVGResourceMarker;
+
+struct MarkerLayout {
+    MarkerLayout(SVGResourceMarker* markerObj = 0, TransformationMatrix matrixObj = TransformationMatrix())
+        : marker(markerObj)
+        , matrix(matrixObj)
+    {
+        ASSERT(marker);
+    }
+
+    SVGResourceMarker* marker;
+    TransformationMatrix matrix;
+};
+
+class SVGMarkerLayoutInfo : public Noncopyable {
+public:
+    SVGMarkerLayoutInfo();
+    ~SVGMarkerLayoutInfo();
+
+    FloatRect calculateBoundaries(SVGResourceMarker* startMarker, SVGResourceMarker* midMarker, SVGResourceMarker* endMarker, float strokeWidth, const Path&);
+    void drawMarkers(RenderObject::PaintInfo&);
+
+    // Used by static inline helper functions in SVGMarkerLayoutInfo.cpp
+    SVGMarkerData& markerData() { return m_markerData; }
+    SVGResourceMarker* midMarker() const { return m_midMarker; }
+    int& elementIndex() { return m_elementIndex; }
+    void addLayoutedMarker(SVGResourceMarker*, const FloatPoint& origin, float angle);
+
+private:
+    SVGResourceMarker* m_midMarker;
+
+    // Used while layouting markers
+    int m_elementIndex;
+    SVGMarkerData m_markerData;
+    float m_strokeWidth;
+
+    // Holds the final computed result
+    Vector<MarkerLayout> m_layout;
+};
+
+}
+
+#endif // ENABLE(SVG)
+#endif // SVGMarkerLayoutInfo_h
diff --git a/WebCore/svg/SVGMarkerElement.cpp b/WebCore/svg/SVGMarkerElement.cpp
index 104b5d4..7d95a86 100644
--- a/WebCore/svg/SVGMarkerElement.cpp
+++ b/WebCore/svg/SVGMarkerElement.cpp
@@ -175,14 +175,15 @@ SVGResource* SVGMarkerElement::canvasResource(const RenderObject*)
     if (!m_marker)
         m_marker = SVGResourceMarker::create();
 
-    m_marker->setMarker(toRenderSVGViewportContainer(renderer()));
+    ASSERT(renderer());
+    m_marker->setRenderer(toRenderSVGViewportContainer(renderer()));
 
     if (orientType() == SVG_MARKER_ORIENT_ANGLE)
         m_marker->setAngle(orientAngle().value());
     else
         m_marker->setAutoAngle();
 
-    m_marker->setRef(refX().value(this), refY().value(this));
+    m_marker->setReferencePoint(FloatPoint(refX().value(this), refY().value(this)));
     m_marker->setUseStrokeWidth(markerUnits() == SVG_MARKERUNITS_STROKEWIDTH);
 
     return m_marker.get();
diff --git a/WebCore/svg/graphics/SVGResource.cpp b/WebCore/svg/graphics/SVGResource.cpp
index 9a1b287..a071996 100644
--- a/WebCore/svg/graphics/SVGResource.cpp
+++ b/WebCore/svg/graphics/SVGResource.cpp
@@ -31,61 +31,30 @@
 #include "RenderPath.h"
 #include "SVGElement.h"
 #include "SVGStyledElement.h"
+#include <wtf/HashSet.h>
 #include <wtf/StdLibExtras.h>
 
 namespace WebCore {
 
-SVGResource::SVGResource()
+typedef HashSet<SVGResource*> ResourceSet;
+
+static ResourceSet& resourceSet()
 {
+    DEFINE_STATIC_LOCAL(ResourceSet, set, ());
+    return set;
 }
 
-struct ResourceSet : Noncopyable {
-    ResourceSet() 
-    {
-        for (int i = 0; i < _ResourceTypeCount; i++)
-            resources[i] = 0;
-    }
-    SVGResource* resources[_ResourceTypeCount]; 
-};
-
-typedef HashMap<SVGStyledElement*, ResourceSet*> ResourceClientMap;
-
-static ResourceClientMap& clientMap()
+SVGResource::SVGResource()
 {
-    DEFINE_STATIC_LOCAL(ResourceClientMap, map, ());
-    return map;
+    ASSERT(!resourceSet().contains(this));
+    resourceSet().add(this);
 }
 
+
 SVGResource::~SVGResource()
 {
-    int type = -1;
-    HashSet<SVGStyledElement*>::iterator itr = m_clients.begin();
-    
-    for (; type < 0 && itr != m_clients.end(); ++itr) {
-        ResourceSet* target = clientMap().get(*itr);
-        if (!target)
-            continue;
-
-        for (int i = 0; i < _ResourceTypeCount; i++) {
-            if (target->resources[i] != this) 
-                continue;
-            type = i;
-            target->resources[i] = 0;
-            break;
-        }
-    }
-    
-    if (type < 0)
-        return;
-    
-    for (; itr != m_clients.end(); ++itr) {
-        ResourceSet* target = clientMap().get(*itr);
-        if (!target)
-            continue;
-        
-        if (target->resources[type] == this) 
-            target->resources[type] = 0;
-    }
+    ASSERT(resourceSet().contains(this));
+    resourceSet().remove(this);
 }
 
 void SVGResource::invalidate()
@@ -120,20 +89,15 @@ void SVGResource::invalidateClients(HashSet<SVGStyledElement*> clients)
 
 void SVGResource::removeClient(SVGStyledElement* item) 
 {
-    ResourceClientMap::iterator resourcePtr = clientMap().find(item);
-    if (resourcePtr == clientMap().end())
-        return;
-    
-    ResourceSet* set = resourcePtr->second;
-    ASSERT(set);
-    
-    clientMap().remove(resourcePtr);
-    
-    for (int i = 0; i < _ResourceTypeCount; i++)
-        if (set->resources[i])
-            set->resources[i]->m_clients.remove(item);
-    
-    delete set;
+    ResourceSet::iterator it = resourceSet().begin();
+    ResourceSet::iterator end = resourceSet().end();
+
+    for (; it != end; ++it) {
+        SVGResource* resource = *it;
+        if (!resource->m_clients.contains(item))
+            continue;
+        resource->m_clients.remove(item);
+    }
 }
 
 void SVGResource::addClient(SVGStyledElement* item)
@@ -142,17 +106,6 @@ void SVGResource::addClient(SVGStyledElement* item)
         return;
 
     m_clients.add(item);
-
-    ResourceSet* target = clientMap().get(item);
-    if (!target) 
-        target = new ResourceSet;
-
-    SVGResourceType type = resourceType();
-    if (SVGResource* oldResource = target->resources[type])
-        oldResource->m_clients.remove(item);
-
-    target->resources[type] = this;
-    clientMap().set(item, target);
 }
 
 TextStream& SVGResource::externalRepresentation(TextStream& ts) const
diff --git a/WebCore/svg/graphics/SVGResourceMarker.cpp b/WebCore/svg/graphics/SVGResourceMarker.cpp
index cb8e71f..ad29785 100644
--- a/WebCore/svg/graphics/SVGResourceMarker.cpp
+++ b/WebCore/svg/graphics/SVGResourceMarker.cpp
@@ -38,10 +38,8 @@ namespace WebCore {
 
 SVGResourceMarker::SVGResourceMarker()
     : SVGResource()
-    , m_refX(0.0)
-    , m_refY(0.0)
     , m_angle(-1) // just like using setAutoAngle()
-    , m_marker(0)
+    , m_renderer(0)
     , m_useStrokeWidth(true)
 {
 }
@@ -50,20 +48,20 @@ SVGResourceMarker::~SVGResourceMarker()
 {
 }
 
-void SVGResourceMarker::setMarker(RenderSVGViewportContainer* marker)
+TransformationMatrix SVGResourceMarker::markerTransformation(const FloatPoint& origin, float angle, float strokeWidth) const
 {
-    m_marker = marker;
-}
+    ASSERT(m_renderer);
 
-void SVGResourceMarker::setRef(double refX, double refY)
-{
-    m_refX = refX;
-    m_refY = refY;
+    TransformationMatrix transform;
+    transform.translate(origin.x(), origin.y());
+    transform.rotate(m_angle == -1 ? angle : m_angle);
+    transform = m_renderer->markerContentTransformation(transform, m_referencePoint, m_useStrokeWidth ? strokeWidth : -1);
+    return transform;
 }
 
-void SVGResourceMarker::draw(RenderObject::PaintInfo& paintInfo, double x, double y, double strokeWidth, double angle)
+void SVGResourceMarker::draw(RenderObject::PaintInfo& paintInfo, const TransformationMatrix& transform)
 {
-    if (!m_marker)
+    if (!m_renderer)
         return;
 
     DEFINE_STATIC_LOCAL(HashSet<SVGResourceMarker*>, currentlyDrawingMarkers, ());
@@ -73,41 +71,18 @@ void SVGResourceMarker::draw(RenderObject::PaintInfo& paintInfo, double x, doubl
         return;
 
     currentlyDrawingMarkers.add(this);
-
-    TransformationMatrix transform;
-    transform.translate(x, y);
-    transform.rotate(m_angle > -1 ? m_angle : angle);
-
-    // refX and refY are given in coordinates relative to the viewport established by the marker, yet they affect
-    // the translation performed on the viewport itself.
-    TransformationMatrix viewportTransform;
-    if (m_useStrokeWidth)
-        viewportTransform.scaleNonUniform(strokeWidth, strokeWidth);
-    viewportTransform *= m_marker->viewportTransform();
-    double refX, refY;
-    viewportTransform.map(m_refX, m_refY, refX, refY);
-    transform.translate(-refX, -refY);
-
-    if (m_useStrokeWidth)
-        transform.scaleNonUniform(strokeWidth, strokeWidth);
+    ASSERT(!m_renderer->drawsContents());
 
     paintInfo.context->save();
     paintInfo.context->concatCTM(transform);
-    m_marker->setDrawsContents(true);
-    m_marker->paint(paintInfo, 0, 0);
-    m_marker->setDrawsContents(false);
+    m_renderer->setDrawsContents(true);
+    m_renderer->paint(paintInfo, 0, 0);
+    m_renderer->setDrawsContents(false);
     paintInfo.context->restore();
 
-    m_cachedBounds = transform.mapRect(m_marker->absoluteClippedOverflowRect());
-
     currentlyDrawingMarkers.remove(this);
 }
 
-FloatRect SVGResourceMarker::cachedBounds() const
-{
-    return m_cachedBounds;
-}
-
 TextStream& SVGResourceMarker::externalRepresentation(TextStream& ts) const
 {
     ts << "[type=MARKER]"
@@ -118,7 +93,7 @@ TextStream& SVGResourceMarker::externalRepresentation(TextStream& ts) const
     else
         ts << angle() << "]";
 
-    ts << " [ref x=" << refX() << " y=" << refY() << "]";
+    ts << " [ref x=" << m_referencePoint.x() << " y=" << m_referencePoint.y() << "]";
     return ts;
 }
 
diff --git a/WebCore/svg/graphics/SVGResourceMarker.h b/WebCore/svg/graphics/SVGResourceMarker.h
index ec6dad8..5c98d2f 100644
--- a/WebCore/svg/graphics/SVGResourceMarker.h
+++ b/WebCore/svg/graphics/SVGResourceMarker.h
@@ -27,7 +27,7 @@
 #define SVGResourceMarker_h
 
 #if ENABLE(SVG)
-
+#include "FloatPoint.h"
 #include "FloatRect.h"
 #include "RenderObject.h"
 #include "SVGResource.h"
@@ -35,17 +35,18 @@
 namespace WebCore {
 
     class RenderSVGViewportContainer;
+    class TransformationMatrix;
 
     class SVGResourceMarker : public SVGResource {
     public:
         static PassRefPtr<SVGResourceMarker> create() { return adoptRef(new SVGResourceMarker); }
         virtual ~SVGResourceMarker();
 
-        void setMarker(RenderSVGViewportContainer*);
+        RenderSVGViewportContainer* renderer() const { return m_renderer; }
+        void setRenderer(RenderSVGViewportContainer* marker) { m_renderer = marker; }
 
-        void setRef(double refX, double refY);
-        double refX() const { return m_refX; }
-        double refY() const { return m_refY; }
+        void setReferencePoint(const FloatPoint& point) { m_referencePoint = point; }
+        FloatPoint referencePoint() const { return m_referencePoint; }
 
         void setAngle(float angle) { m_angle = angle; }
         void setAutoAngle() { m_angle = -1; }
@@ -54,18 +55,18 @@ namespace WebCore {
         void setUseStrokeWidth(bool useStrokeWidth = true) { m_useStrokeWidth = useStrokeWidth; }
         bool useStrokeWidth() const { return m_useStrokeWidth; }
 
-        FloatRect cachedBounds() const;
-        void draw(RenderObject::PaintInfo&, double x, double y, double strokeWidth = 1, double angle = 0);
-        
+        TransformationMatrix markerTransformation(const FloatPoint& origin, float angle, float strokeWidth) const;
+        void draw(RenderObject::PaintInfo&, const TransformationMatrix&);
+
         virtual SVGResourceType resourceType() const { return MarkerResourceType; }
         virtual TextStream& externalRepresentation(TextStream&) const;
 
     private:
         SVGResourceMarker();
-        double m_refX, m_refY;
-        FloatRect m_cachedBounds;
+
+        FloatPoint m_referencePoint;
         float m_angle;
-        RenderSVGViewportContainer* m_marker;
+        RenderSVGViewportContainer* m_renderer;
         bool m_useStrokeWidth;
     };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list