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

krit at webkit.org krit at webkit.org
Thu Apr 8 00:51:43 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 7e73c00174ab012c0debe9b757afdb984f2759c6
Author: krit at webkit.org <krit at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 29 20:46:17 2009 +0000

    2009-12-29  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 was buggy:
            - 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)
    
            Fixes all svg/custom/marker*.svg tests, that use dynamic updates (propagation failed before).
            Test: svg/custom/marker-referencePoint.svg
    
            * Android.mk:
            * GNUmakefile.am:
            * WebCore.pro:
            * WebCore.vcproj/WebCore.vcproj:
            * WebCore.xcodeproj/project.pbxproj:
            * rendering/RenderPath.cpp:
            (WebCore::RenderPath::repaintRectInLocalCoordinates):
            (WebCore::RenderPath::setPath):
            (WebCore::RenderPath::paint):
            (WebCore::RenderPath::calculateMarkerBoundsIfNeeded):
            * rendering/RenderPath.h:
            (WebCore::RenderPath::path):
            * rendering/RenderSVGContainer.h:
            * rendering/RenderSVGViewportContainer.cpp:
            (WebCore::RenderSVGViewportContainer::markerContentTransformation):
            * rendering/RenderSVGViewportContainer.h:
            * rendering/SVGMarkerLayoutInfo.cpp: Added.
            (WebCore::SVGMarkerLayoutInfo::SVGMarkerLayoutInfo):
            (WebCore::SVGMarkerLayoutInfo::~SVGMarkerLayoutInfo):
            (WebCore::SVGMarkerLayoutInfo::initialize):
            (WebCore::updateMarkerDataForElement):
            (WebCore::recordMarkerData):
            (WebCore::processStartAndMidMarkers):
            (WebCore::SVGMarkerLayoutInfo::calculateBoundaries):
            (WebCore::SVGMarkerLayoutInfo::drawMarkers):
            * rendering/SVGMarkerLayoutInfo.h: Added.
            (WebCore::MarkerData::):
            (WebCore::MarkerData::MarkerData):
            (WebCore::MarkerLayout::MarkerLayout):
            * svg/SVGMarkerElement.cpp:
            (WebCore::SVGMarkerElement::canvasResource):
            * svg/graphics/SVGResource.cpp:
            (WebCore::resourceSet):
            (WebCore::SVGResource::SVGResource):
            (WebCore::SVGResource::~SVGResource):
            (WebCore::SVGResource::removeClient):
            (WebCore::SVGResource::addClient):
            * svg/graphics/SVGResourceMarker.cpp:
            (WebCore::SVGResourceMarker::SVGResourceMarker):
            (WebCore::SVGResourceMarker::markerBoundaries):
            (WebCore::SVGResourceMarker::markerTransformation):
            (WebCore::SVGResourceMarker::draw):
            (WebCore::SVGResourceMarker::externalRepresentation):
            * svg/graphics/SVGResourceMarker.h:
            (WebCore::SVGResourceMarker::setRenderer):
            (WebCore::SVGResourceMarker::setReferencePoint):
            (WebCore::SVGResourceMarker::referencePoint):
    
    2009-12-29  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-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-overflow-clip-expected.txt:
            * 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-referencePoint.svg: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52630 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 47eec9a..ed9c787 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,38 @@
+2009-12-29  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-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-overflow-clip-expected.txt:
+        * 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-referencePoint.svg: Added.
+
 2009-12-29  Johnny Ding  <jnd at chromium.org>
 
         Reviewed by Dimitri Glazkov.
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 e923ea6..55898ac 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
@@ -7,8 +7,8 @@ KCanvasResource {id="marker4" [type=MARKER] [angle=0.00] [ref x=5.00 y=5.00]}
 layer at (0,0) size 480x360
   RenderView at (0,0) size 480x360
 layer at (0,0) size 480x360
-  RenderSVGRoot {svg} at (-0.80,-0.80) size 480.30x360.30
-    RenderSVGContainer {g} at (-0.80,-0.80) size 452x272.80
+  RenderSVGRoot {svg} at (-4,-4) size 483.50x363.50
+    RenderSVGContainer {g} at (-4,-4) size 455.20x276
       RenderSVGHiddenContainer {defs} at (0,0) size 0x0
       RenderSVGText {text} at (125,30) size 184x16 contains 1 chunk(s)
         RenderSVGInlineText {#text} at (0,-13) size 184x16
@@ -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 (0,0) size 80x110 [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)}]
@@ -34,13 +34,13 @@ layer at (0,0) size 480x360
             RenderSVGContainer {g} at (192,102) size 16x16 [clip path="overflowHiddenClip1"]
               RenderSVGContainer {g} at (192,102) size 16x16 [transform={m=((0.20,0.00)(0.00,0.20)) t=(0.00,0.00)}]
                 RenderPath {rect} at (192,102) size 16x16 [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 (-0.40,-0.40) size 450x142.40
+      RenderSVGContainer {g} at (-2,-2) size 451.60x144
         RenderSVGViewportContainer {marker} at (-0.40,-0.40) size 4.80x4.80
           RenderPath {rect} at (-0.40,-0.40) size 4.80x4.80 [stroke={[type=SOLID] [color=#000000] [stroke width=4.00]}] [data="M0.00,0.00 L20.00,0.00 L20.00,20.00 L0.00,20.00 Z"]
         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 (-2,-2) size 324x116.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"]
         RenderSVGContainer {g} at (380.40,50.40) size 69.20x69.20 [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 (380.40,50.40) size 19.20x19.20 [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,178.80) size 186.03x93.20
+      RenderSVGContainer {g} at (-4,-4) size 215.20x276
         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 (-4,-4) size 86x248.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"]
         RenderSVGContainer {g} at (138.80,178.80) size 72.40x72.40 [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 (138.80,178.80) size 72.40x72.40
@@ -80,11 +80,11 @@ layer at (0,0) size 480x360
               RenderSVGContainer {g} at (188.80,228.80) size 22.40x22.40 [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,178.80) size 186.03x93.20
+      RenderSVGContainer {g} at (-2,-2) size 453.20x274
         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 (-2,-2) size 324x246.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"]
         RenderSVGContainer {g} at (378.80,178.80) size 72.40x72.40 [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 (378.80,178.80) size 72.40x72.40
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..f491c28 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 (50,20) size 370.33x140.50 [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 (50,20) size 100x140.50 [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 (50,20) size 180.50x140.12 [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 (50,20) size 270.50x140.12 [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 (50,20) size 370.33x140.37 [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 (50,20) size 370.33x140.37 [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 (50,150) size 370.33x140.50 [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 (50,150) size 100x140.50 [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 (50,150) size 180.50x140.12 [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 (50,150) size 270.50x140.12 [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 (50,150) size 370.33x140.37 [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 (50,150) size 370.33x140.37 [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..4a718bb 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 (235,225) size 330x150
     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"]
+    RenderPath {path} at (235,225) size 330x150 [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..12d385a 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 (235,225) size 389.99x299.99 [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 (235,225) size 389.99x299.99 [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,315.01) size 389.99x209.99 [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..8b89a4d 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 (235,225) size 330x150 [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"]
+    RenderPath {path} at (235,225) size 330x150 [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..a34f14b 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 (235,225) size 330x150
+    RenderSVGViewportContainer {marker} at (338.12,271.88) size 123.75x56.25
+      RenderPath {path} at (338.12,271.88) size 123.75x56.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,271.88) size 123.75x56.25
+      RenderPath {path} at (338.12,271.88) size 123.75x56.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,225) size 330x150 [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..2f760af 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 (0,0) size 306.67x308.33
     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 (0,0) size 306.67x308.33
+      RenderPath {path} at (0,0) size 306.67x308.33 [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..2f760af 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 (0,0) size 306.67x308.33
     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 (0,0) size 306.67x308.33
+      RenderPath {path} at (0,0) size 306.67x308.33 [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..6ebd529 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 (0,0) size 184x185
     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 (0,0) size 184x185
+      RenderPath {path} at (0,0) size 184x185 [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..6ebd529 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 (0,0) size 184x185
     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 (0,0) size 184x185
+      RenderPath {path} at (0,0) size 184x185 [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..1bea5cc 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
@@ -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 (0,0) size 300x283.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-overflow-clip-expected.txt b/LayoutTests/platform/mac/svg/custom/marker-overflow-clip-expected.txt
index ae40ac5..9754bf1 100644
--- a/LayoutTests/platform/mac/svg/custom/marker-overflow-clip-expected.txt
+++ b/LayoutTests/platform/mac/svg/custom/marker-overflow-clip-expected.txt
@@ -2,12 +2,12 @@ KCanvasResource {id="marker" [type=MARKER] [angle=auto] [ref x=50.00 y=50.00]}
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
-  RenderSVGRoot {svg} at (-50,-50) size 378x300
+  RenderSVGRoot {svg} at (-50,-50) size 378x200
     RenderSVGViewportContainer {marker} at (-25,-25) size 100x100
       RenderPath {rect} at (-25,-25) size 100x100 [fill={[type=SOLID] [color=#FF0000]}] [data="M-50.00,-50.00 L150.00,-50.00 L150.00,150.00 L-50.00,150.00 Z"]
       RenderPath {rect} at (0,0) size 50x50 [fill={[type=SOLID] [color=#008000]}] [data="M0.00,0.00 L100.00,0.00 L100.00,100.00 L0.00,100.00 Z"]
     RenderPath {rect} at (0,0) size 25x25 [fill={[type=SOLID] [color=#000000]}] [data="M0.00,0.00 L25.00,0.00 L25.00,25.00 L0.00,25.00 Z"]
-    RenderPath {path} at (-50,-50) size 300x300 [start marker=marker] [data="M100.00,100.00 L100.00,100.00"]
+    RenderPath {path} at (-50,-50) size 200x200 [start marker=marker] [data="M100.00,100.00 L100.00,100.00"]
     RenderSVGText {text} at (30,20) size 298x18 contains 1 chunk(s)
       RenderSVGInlineText {#text} at (0,-14) size 298x18
         chunk 1 text run 1 at (30.00,20.00) startOffset 0 endOffset 45 width 298.00: "There should be a 150x150 green rect at 25x25"
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..9726a7a
--- /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,0) size 383.52x191.52
+    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 (0,0) size 243.39x123.39 [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..6ebd529 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 (0,0) size 184x185
     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 (0,0) size 184x185
+      RenderPath {path} at (0,0) size 184x185 [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..90a2fc3 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 (235,225) size 389.99x299.99
     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 (235,315.01) size 389.99x209.99 [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..fc175a1 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 (-0.83,0.83) size 622.50x284.36
     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 (-0.83,0.83) size 622.50x284.36 [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 (-0.83,0.83) size 13.33x282.50 [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 (0.83,0.83) size 133.85x282.87 [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 (0.83,0.83) size 250.51x284.36 [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 (0.83,0.83) size 367.18x283.33 [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-referencePoint.svg b/LayoutTests/svg/custom/marker-referencePoint.svg
new file mode 100644
index 0000000..570bc06
--- /dev/null
+++ b/LayoutTests/svg/custom/marker-referencePoint.svg
@@ -0,0 +1,24 @@
+<?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 b5c33c7..501e342 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,68 @@
+2009-12-29  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 was buggy:
+        - 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)
+
+        Fixes all svg/custom/marker*.svg tests, that use dynamic updates (propagation failed before).
+        Test: svg/custom/marker-referencePoint.svg
+
+        * Android.mk:
+        * GNUmakefile.am:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * rendering/RenderPath.cpp:
+        (WebCore::RenderPath::repaintRectInLocalCoordinates):
+        (WebCore::RenderPath::setPath):
+        (WebCore::RenderPath::paint):
+        (WebCore::RenderPath::calculateMarkerBoundsIfNeeded):
+        * rendering/RenderPath.h:
+        (WebCore::RenderPath::path):
+        * rendering/RenderSVGContainer.h:
+        * rendering/RenderSVGViewportContainer.cpp:
+        (WebCore::RenderSVGViewportContainer::markerContentTransformation):
+        * rendering/RenderSVGViewportContainer.h:
+        * rendering/SVGMarkerLayoutInfo.cpp: Added.
+        (WebCore::SVGMarkerLayoutInfo::SVGMarkerLayoutInfo):
+        (WebCore::SVGMarkerLayoutInfo::~SVGMarkerLayoutInfo):
+        (WebCore::SVGMarkerLayoutInfo::initialize):
+        (WebCore::updateMarkerDataForElement):
+        (WebCore::recordMarkerData):
+        (WebCore::processStartAndMidMarkers):
+        (WebCore::SVGMarkerLayoutInfo::calculateBoundaries):
+        (WebCore::SVGMarkerLayoutInfo::drawMarkers):
+        * rendering/SVGMarkerLayoutInfo.h: Added.
+        (WebCore::MarkerData::):
+        (WebCore::MarkerData::MarkerData):
+        (WebCore::MarkerLayout::MarkerLayout):
+        * svg/SVGMarkerElement.cpp:
+        (WebCore::SVGMarkerElement::canvasResource):
+        * svg/graphics/SVGResource.cpp:
+        (WebCore::resourceSet):
+        (WebCore::SVGResource::SVGResource):
+        (WebCore::SVGResource::~SVGResource):
+        (WebCore::SVGResource::removeClient):
+        (WebCore::SVGResource::addClient):
+        * svg/graphics/SVGResourceMarker.cpp:
+        (WebCore::SVGResourceMarker::SVGResourceMarker):
+        (WebCore::SVGResourceMarker::markerBoundaries):
+        (WebCore::SVGResourceMarker::markerTransformation):
+        (WebCore::SVGResourceMarker::draw):
+        (WebCore::SVGResourceMarker::externalRepresentation):
+        * svg/graphics/SVGResourceMarker.h:
+        (WebCore::SVGResourceMarker::setRenderer):
+        (WebCore::SVGResourceMarker::setReferencePoint):
+        (WebCore::SVGResourceMarker::referencePoint):
+
 2009-12-29  Alexander Pavlov  <apavlov at chromium.org>
 
         Reviewed by Pavel Feldman.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index c6c97b7..ed6b420 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -2950,6 +2950,8 @@ webcore_sources += \
 	WebCore/rendering/SVGInlineFlowBox.h \
 	WebCore/rendering/SVGInlineTextBox.cpp \
 	WebCore/rendering/SVGInlineTextBox.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 6d3d5de..8e9b7ed 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -2146,6 +2146,7 @@ HEADERS += \
     rendering/SVGCharacterLayoutInfo.h \
     rendering/SVGInlineFlowBox.h \
     rendering/SVGInlineTextBox.h \
+    rendering/SVGMarkerLayoutInfo.h \
     rendering/SVGRenderSupport.h \
     rendering/SVGRenderTreeAsText.h \
     rendering/SVGRootInlineBox.h \
@@ -3122,6 +3123,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..6feea7f 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -27819,6 +27819,14 @@
 				>
 			</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..26318a8 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -88,6 +88,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, ); }; };
@@ -5302,6 +5304,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 +15564,8 @@
 				853CA9E30AEEC608002372DC /* SVGInlineFlowBox.h */,
 				AA0972CA0B6947A800A705E9 /* SVGInlineTextBox.cpp */,
 				AA0972CB0B6947A800A705E9 /* SVGInlineTextBox.h */,
+				08735FB610E91232006D6FAD /* SVGMarkerLayoutInfo.cpp */,
+				08735FB710E91232006D6FAD /* SVGMarkerLayoutInfo.h */,
 				A8F4FB950C169E85002AFED5 /* SVGRenderSupport.cpp */,
 				A8F4FB930C169E7B002AFED5 /* SVGRenderSupport.h */,
 				B2EBDC9A0AF77E3400AE4A68 /* SVGRenderTreeAsText.cpp */,
@@ -18265,6 +18271,7 @@
 				BC56CB2310D5AC8000A77C64 /* GeolocationControllerClient.h in Headers */,
 				BC56CB2410D5AC8000A77C64 /* GeolocationError.h in Headers */,
 				BC56CB2510D5AC8000A77C64 /* GeolocationPosition.h in Headers */,
+				08735FB910E91232006D6FAD /* SVGMarkerLayoutInfo.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -20421,6 +20428,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/rendering/RenderPath.cpp b/WebCore/rendering/RenderPath.cpp
index 320a1b6..d07e506 100644
--- a/WebCore/rendering/RenderPath.cpp
+++ b/WebCore/rendering/RenderPath.cpp
@@ -25,6 +25,7 @@
 #if ENABLE(SVG)
 #include "RenderPath.h"
 
+#include "FloatConversion.h"
 #include "FloatPoint.h"
 #include "FloatQuad.h"
 #include "GraphicsContext.h"
@@ -129,9 +130,11 @@ FloatRect RenderPath::repaintRectInLocalCoordinates() const
     }
 
     // Markers and filters can paint outside of the stroke path
-    m_cachedLocalRepaintRect.unite(m_markerBounds);
-    m_cachedLocalRepaintRect.unite(filterBoundingBoxForRenderer(this));
+    if (m_cachedLocalMarkerBBox.isEmpty() && static_cast<SVGStyledElement*>(node())->supportsMarkers())
+        calculateMarkerBoundsIfNeeded();
 
+    m_cachedLocalRepaintRect.unite(m_cachedLocalMarkerBBox);
+    m_cachedLocalRepaintRect.unite(filterBoundingBoxForRenderer(this));
     return m_cachedLocalRepaintRect;
 }
 
@@ -140,11 +143,7 @@ void RenderPath::setPath(const Path& newPath)
     m_path = newPath;
     m_cachedLocalRepaintRect = FloatRect();
     m_cachedLocalFillBBox = FloatRect();
-}
-
-const Path& RenderPath::path() const
-{
-    return m_path;
+    m_cachedLocalMarkerBBox = FloatRect();
 }
 
 void RenderPath::layout()
@@ -196,7 +195,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);
     }
@@ -237,127 +236,7 @@ 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();
 
@@ -365,8 +244,10 @@ FloatRect RenderPath::drawMarkersIfNeeded(PaintInfo& paintInfo, const Path& path
     ASSERT(svgElement && svgElement->document() && svgElement->isStyled());
 
     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());
@@ -391,32 +272,11 @@ 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_markerLayoutInfo.initialize(startMarker, midMarker, endMarker, strokeWidth);
+    m_cachedLocalMarkerBBox = m_markerLayoutInfo.calculateBoundaries(m_path);
 }
 
 }
diff --git a/WebCore/rendering/RenderPath.h b/WebCore/rendering/RenderPath.h
index 67c0a81..9b525c6 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
@@ -63,7 +63,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;
@@ -71,7 +71,8 @@ private:
     mutable Path m_path;
     mutable FloatRect m_cachedLocalFillBBox;
     mutable FloatRect m_cachedLocalRepaintRect;
-    FloatRect m_markerBounds;
+    mutable FloatRect m_cachedLocalMarkerBBox;
+    mutable SVGMarkerLayoutInfo m_markerLayoutInfo;
     TransformationMatrix m_localTransform;
 };
 
@@ -94,5 +95,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 3604afc..d19b450 100644
--- a/WebCore/rendering/RenderSVGContainer.h
+++ b/WebCore/rendering/RenderSVGContainer.h
@@ -42,8 +42,8 @@ public:
     void setDrawsContents(bool);
     bool drawsContents() const;
 
-protected:
     virtual void paint(PaintInfo&, int parentX, int parentY);
+    virtual FloatRect repaintRectInLocalCoordinates() const;
 
 private:
     virtual RenderObjectChildList* virtualChildren() { return children(); }
@@ -57,7 +57,6 @@ private:
     virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
 
     virtual FloatRect objectBoundingBox() const;
-    virtual FloatRect repaintRectInLocalCoordinates() const;
 
     virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction);
 
diff --git a/WebCore/rendering/RenderSVGViewportContainer.cpp b/WebCore/rendering/RenderSVGViewportContainer.cpp
index a432ef3..a6427a9 100644
--- a/WebCore/rendering/RenderSVGViewportContainer.cpp
+++ b/WebCore/rendering/RenderSVGViewportContainer.cpp
@@ -38,17 +38,17 @@ RenderSVGViewportContainer::RenderSVGViewportContainer(SVGStyledElement* node)
 {
 }
 
-void RenderSVGViewportContainer::paint(PaintInfo& paintInfo, int parentX, int parentY)
+TransformationMatrix RenderSVGViewportContainer::markerContentTransformation(const TransformationMatrix& contentTransformation, const FloatPoint& origin, float strokeWidth) 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.
+    // The 'origin' coordinate maps to SVGs refX/refY, given in coordinates relative to the viewport established by the marker
+    FloatPoint mappedOrigin = viewportTransform().mapPoint(origin);
 
-    // A value of zero disables rendering of the element. 
-    if (!m_viewport.isEmpty() && (m_viewport.width() <= 0. || m_viewport.height() <= 0.))
-        return;
+    TransformationMatrix transformation = contentTransformation;
+    if (strokeWidth != -1)
+        transformation.scaleNonUniform(strokeWidth, strokeWidth);
 
-    RenderSVGContainer::paint(paintInfo, parentX, parentY);
+    transformation.translate(-mappedOrigin.x(), -mappedOrigin.y());
+    return transformation;
 }
 
 void RenderSVGViewportContainer::applyViewportClip(PaintInfo& paintInfo)
@@ -125,5 +125,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..0b3d334 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,15 @@ class RenderSVGViewportContainer : public RenderSVGContainer {
 public:
     RenderSVGViewportContainer(SVGStyledElement*);
 
-    // FIXME: This is only public for SVGResourceMarker::draw, likely the callsite should be changed.
-    TransformationMatrix viewportTransform() 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 +69,3 @@ void toRenderSVGViewportContainer(const RenderSVGViewportContainer*);
 
 #endif // ENABLE(SVG)
 #endif // RenderSVGViewportContainer_h
-
-// vim:ts=4:noet
diff --git a/WebCore/rendering/SVGMarkerLayoutInfo.cpp b/WebCore/rendering/SVGMarkerLayoutInfo.cpp
new file mode 100644
index 0000000..b72afd3
--- /dev/null
+++ b/WebCore/rendering/SVGMarkerLayoutInfo.cpp
@@ -0,0 +1,186 @@
+/*
+    Copyright (C) Research In Motion Limited 2009. 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 "FloatConversion.h"
+#include "SVGResourceMarker.h"
+
+namespace WebCore {
+
+SVGMarkerLayoutInfo::SVGMarkerLayoutInfo()
+    : m_startMarker(0)
+    , m_midMarker(0)
+    , m_endMarker(0)
+    , m_elementIndex(0)
+    , m_markerData(MarkerData::Unknown, 0)
+    , m_strokeWidth(0)
+{
+}
+
+SVGMarkerLayoutInfo::~SVGMarkerLayoutInfo()
+{
+}
+
+void SVGMarkerLayoutInfo::initialize(SVGResourceMarker* startMarker, SVGResourceMarker* midMarker, SVGResourceMarker* endMarker, float strokeWidth)
+{
+    m_startMarker = startMarker;
+    m_midMarker = midMarker;
+    m_endMarker = endMarker;
+    m_strokeWidth = strokeWidth;
+}
+
+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();
+    }
+}
+
+void recordMarkerData(SVGMarkerLayoutInfo& info)
+{
+    MarkerData& data = info.m_markerData;
+    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 MarkerData::Start:
+        angle = outslope;
+        break;
+    case MarkerData::Mid:
+        angle = (inslope + outslope) / 2;
+        break;
+    case MarkerData::End:
+        angle = inslope;
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        break;
+    }
+
+    TransformationMatrix transform = data.marker->markerTransformation(data.origin, narrowPrecisionToFloat(angle), info.m_strokeWidth);
+    info.m_layout.append(MarkerLayout(data.marker, transform));
+}
+
+void processStartAndMidMarkers(void* info, const PathElement* element)
+{
+    SVGMarkerLayoutInfo& data = *reinterpret_cast<SVGMarkerLayoutInfo*>(info);
+    FloatPoint* points = element->points;
+
+    // First update the outslope for the previous element
+    data.m_markerData.outslopePoints[0] = data.m_markerData.origin;
+    data.m_markerData.outslopePoints[1] = points[0];
+
+    // Draw the marker for the previous element
+    if (data.m_elementIndex != 0)
+        recordMarkerData(data);
+
+    // Update our marker data for this element
+    updateMarkerDataForElement(data.m_markerData, element);
+
+    if (data.m_elementIndex == 1) {
+        // After drawing the start marker, switch to drawing mid markers
+        data.m_markerData.marker = data.m_midMarker;
+        data.m_markerData.type = MarkerData::Mid;
+    }
+
+    ++data.m_elementIndex;
+}
+
+FloatRect SVGMarkerLayoutInfo::calculateBoundaries(const Path& path)
+{
+    m_layout.clear();
+    m_elementIndex = 0;
+    m_markerData = MarkerData(MarkerData::Start, m_startMarker);
+    path.apply(this, processStartAndMidMarkers);
+
+    m_markerData.marker = m_endMarker;
+    m_markerData.type = MarkerData::End;
+    recordMarkerData(*this);
+
+    if (m_layout.isEmpty())
+        return FloatRect();
+
+    FloatRect bounds;
+
+    if (m_startMarker)
+        bounds.unite(m_startMarker->markerBoundaries());
+
+    if (m_midMarker)
+        bounds.unite(m_midMarker->markerBoundaries());
+
+    if (m_endMarker)
+        bounds.unite(m_endMarker->markerBoundaries());
+
+    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);
+    }
+}
+
+}
+
+#endif // ENABLE(SVG)
diff --git a/WebCore/rendering/SVGMarkerLayoutInfo.h b/WebCore/rendering/SVGMarkerLayoutInfo.h
new file mode 100644
index 0000000..ceb171a
--- /dev/null
+++ b/WebCore/rendering/SVGMarkerLayoutInfo.h
@@ -0,0 +1,96 @@
+/*
+    Copyright (C) Research In Motion Limited 2009. 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 <wtf/Noncopyable.h>
+
+namespace WebCore {
+
+class Path;
+class SVGResourceMarker;
+
+struct MarkerData {
+    enum Type {
+        Unknown = 0,
+        Start,
+        Mid,
+        End
+    };
+
+    MarkerData(const Type& _type, SVGResourceMarker* _marker)
+        : type(_type)
+        , marker(_marker)
+    {
+    }
+
+    Type type;
+    SVGResourceMarker* marker;
+    FloatPoint origin;
+    FloatPoint subpathStart;
+    FloatPoint inslopePoints[2];
+    FloatPoint outslopePoints[2];
+};
+
+struct MarkerLayout {
+    MarkerLayout(SVGResourceMarker* _marker = 0, TransformationMatrix _matrix = TransformationMatrix())
+        : marker(_marker)
+        , matrix(_matrix)
+    {
+        ASSERT(marker);
+    }
+
+    SVGResourceMarker* marker;
+    TransformationMatrix matrix;
+};
+
+class SVGMarkerLayoutInfo : public Noncopyable {
+public:
+    SVGMarkerLayoutInfo();
+    ~SVGMarkerLayoutInfo();
+
+    void initialize(SVGResourceMarker* startMarker, SVGResourceMarker* midMarker, SVGResourceMarker* endMarker, float strokeWidth);
+
+    FloatRect calculateBoundaries(const Path&);
+    void drawMarkers(RenderObject::PaintInfo&);
+
+private:
+    friend void processStartAndMidMarkers(void*, const PathElement*);
+    friend void recordMarkerData(SVGMarkerLayoutInfo&);
+
+    SVGResourceMarker* m_startMarker;
+    SVGResourceMarker* m_midMarker;
+    SVGResourceMarker* m_endMarker;
+
+    // Used while layouting markers
+    int m_elementIndex;
+    MarkerData 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..e15d772 100644
--- a/WebCore/svg/SVGMarkerElement.cpp
+++ b/WebCore/svg/SVGMarkerElement.cpp
@@ -175,14 +175,14 @@ SVGResource* SVGMarkerElement::canvasResource(const RenderObject*)
     if (!m_marker)
         m_marker = SVGResourceMarker::create();
 
-    m_marker->setMarker(toRenderSVGViewportContainer(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..9a55537 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,26 @@ SVGResourceMarker::~SVGResourceMarker()
 {
 }
 
-void SVGResourceMarker::setMarker(RenderSVGViewportContainer* marker)
+FloatRect SVGResourceMarker::markerBoundaries() const
 {
-    m_marker = marker;
+    ASSERT(m_renderer);
+    return m_renderer->repaintRectInLocalCoordinates();
 }
 
-void SVGResourceMarker::setRef(double refX, double refY)
+TransformationMatrix SVGResourceMarker::markerTransformation(const FloatPoint& origin, float angle, float strokeWidth) const
 {
-    m_refX = refX;
-    m_refY = refY;
+    ASSERT(m_renderer);
+
+    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 +77,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 +99,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..5d9089d 100644
--- a/WebCore/svg/graphics/SVGResourceMarker.h
+++ b/WebCore/svg/graphics/SVGResourceMarker.h
@@ -27,25 +27,27 @@
 #define SVGResourceMarker_h
 
 #if ENABLE(SVG)
-
 #include "FloatRect.h"
+#include "FloatPoint.h"
 #include "RenderObject.h"
 #include "SVGResource.h"
 
 namespace WebCore {
 
     class RenderSVGViewportContainer;
+    class TransformationMatrix;
 
     class SVGResourceMarker : public SVGResource {
     public:
         static PassRefPtr<SVGResourceMarker> create() { return adoptRef(new SVGResourceMarker); }
         virtual ~SVGResourceMarker();
 
-        void setMarker(RenderSVGViewportContainer*);
+        FloatRect markerBoundaries() const;
+        TransformationMatrix markerTransformation(const FloatPoint& origin, float angle, float strokeWidth) const;
+        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 +56,17 @@ 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);
-        
+        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