[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
zimmermann at webkit.org
zimmermann at webkit.org
Wed Dec 22 11:46:23 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 51cbd13e51721b92fd98723bf8615f7c31d141b3
Author: zimmermann at webkit.org <zimmermann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Aug 6 11:21:20 2010 +0000
2010-08-06 Nikolas Zimmermann <nzimmermann at rim.com>
Reviewed by Dirk Schulze.
SVG - stroke-width:0 bug with stroke other than "none"
https://bugs.webkit.org/show_bug.cgi?id=42387
Stop storing refcounted CSSValue/CSSValueList objects in SVGRenderStyle, replacing them with SVGLength types.
Allows us to directly specify default values for stroke-dashoffset/width in the SVGRenderStyle, fixing a problem
with stroke-width animations when resetting to the original stored baseVal, exposed in svg/W3C-1.1/animate-elem-40-t.svg
Originally discovered by Fady Samuel.
Test: svg/custom/path-zero-strokewidth.svg
* css/SVGCSSComputedStyleDeclaration.cpp:
(WebCore::strokeDashArrayToCSSValueList): New helper function converting from Vector<SVGLength> to CSSValueList.
(WebCore::CSSComputedStyleDeclaration::getSVGPropertyCSSValue): Convert SVGLength values to CSSPrimitiveValues.
* css/SVGCSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applySVGProperty): Convert CSSPrimitiveValues to SVGLength objects, for SVGRenderStyle storage.
* rendering/RenderPath.cpp:
(WebCore::RenderPath::calculateMarkerBoundsIfNeeded): Just grab strokeWidth SVGLength value from SVGRenderSTyle, no need to call cssPrimitiveToLength anymore.
* rendering/RenderSVGText.cpp:
(WebCore::RenderSVGText::strokeBoundingBox): Ditto.
* rendering/SVGCharacterLayoutInfo.cpp:
(WebCore::calculateBaselineShift): Ditto (for baseline-shift).
* rendering/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::buildLayoutInformation): Ditto (for kerning).
* rendering/SVGRenderSupport.cpp:
(WebCore::SVGRenderSupport::applyStrokeStyleToContext): Ditto (for stroke-width/stroke-dashoffset/stroke-dasharray).
* rendering/SVGRenderSupport.h:
* rendering/SVGRenderTreeAsText.cpp:
(WebCore::writeStyle): Ditto.
* rendering/SVGTextLayoutUtilities.cpp:
(WebCore::calculateCSSKerning): Ditto.
* rendering/SVGTextLayoutUtilities.h:
* rendering/style/SVGRenderStyle.cpp: Remove no longer needed cssPrimitiveToLength function.
* rendering/style/SVGRenderStyle.h: Stop storing RefPtr<CSSValue> / RefPtr<CSSValueList> but use SVGLength/Vector<SVGLength>.
(WebCore::SVGRenderStyle::initialStrokeDashArray): Allows us to specify correct default values, instead of null pointers.
(WebCore::SVGRenderStyle::initialBaselineShiftValue): Specify 0px default value.
(WebCore::SVGRenderStyle::initialKerning): Ditto.
(WebCore::SVGRenderStyle::initialStrokeDashOffset): Ditto.
(WebCore::SVGRenderStyle::initialStrokeWidth): Specify 1px default value.
(WebCore::SVGRenderStyle::setStrokeDashArray): Takes a Vector<SVGLength> now, not a PassRefPtr<CSSValueList>.
(WebCore::SVGRenderStyle::setStrokeWidth): Takes a SVGLength now, not a PassRefPtr<CSSValue>.
(WebCore::SVGRenderStyle::setStrokeDashOffset): Ditto.
(WebCore::SVGRenderStyle::setKerning): Ditto.
(WebCore::SVGRenderStyle::setStopColor): Pass Color as const-reference.
(WebCore::SVGRenderStyle::setFloodColor): Ditto.
(WebCore::SVGRenderStyle::setLightingColor): Ditto.
(WebCore::SVGRenderStyle::setBaselineShiftValue): Takes a SVGLength now, not a PassRefPtr<CSSValue>.
(WebCore::SVGRenderStyle::setShadow): Reformat, had wrong style.
(WebCore::SVGRenderStyle::setClipperResource): Pass String as const-reference.
(WebCore::SVGRenderStyle::setFilterResource): Ditto.
(WebCore::SVGRenderStyle::setMaskerResource): Ditto.
(WebCore::SVGRenderStyle::setMarkerStartResource): Ditto.
(WebCore::SVGRenderStyle::setMarkerMidResource): Ditto.
(WebCore::SVGRenderStyle::setMarkerEndResource): Ditto.
(WebCore::SVGRenderStyle::strokeDashArray): Return Vector<SVGLength>.
(WebCore::SVGRenderStyle::strokeWidth): Return SVGLength.
(WebCore::SVGRenderStyle::strokeDashOffset): Ditto.
(WebCore::SVGRenderStyle::kerning): Ditto.
(WebCore::SVGRenderStyle::baselineShiftValue): Ditto.
* rendering/style/SVGRenderStyleDefs.cpp:
(WebCore::StyleStrokeData::StyleStrokeData): Changed initialization order, to group stroke properties.
* rendering/style/SVGRenderStyleDefs.h: Store SVGLength values instead of reference counted CSS objects.
* svg/SVGLength.cpp:
(WebCore::SVGLength::SVGLength): Add copy constructor.
(WebCore::SVGLength::operator==): Add comparision operator.
(WebCore::SVGLength::operator!=): Ditto.
(WebCore::SVGLength::fromCSSPrimitiveValue): New static helper function to convert from a CSSPrimitiveValue.
(WebCore::SVGLength::toCSSPrimitiveValue): New static helper function to convert to a CSSPrimitiveValue.
* svg/SVGLength.h: Reindent.
2010-08-06 Nikolas Zimmermann <nzimmermann at rim.com>
Reviewed by Dirk Schulze.
SVG - stroke-width:0 bug with stroke other than "none"
https://bugs.webkit.org/show_bug.cgi?id=42387
* platform/mac-leopard/svg/W3C-SVG-1.1/animate-elem-40-t-expected.checksum: Updated result, as fill="freeze" and stroke-width now works as expected.
* platform/mac-leopard/svg/W3C-SVG-1.1/animate-elem-40-t-expected.png: Ditto.
* platform/mac/fast/css/getComputedStyle/computed-style-expected.txt: kerning reports 0, stroke-dashoffset 0, stroke-width 1 instead of empty values.
* platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: Ditto.
* platform/mac/svg/W3C-SVG-1.1/animate-elem-40-t-expected.txt: Updated result, as fill="freeze" and stroke-width now works as expected.
* platform/mac/svg/custom/path-zero-strokewidth-expected.checksum: Added.
* platform/mac/svg/custom/path-zero-strokewidth-expected.png: Added.
* platform/mac/svg/custom/path-zero-strokewidth-expected.txt: Added.
* svg/css/getComputedStyle-basic-expected.txt: An empty stroke-dasharray reports "none", as defined in the spec now.
* svg/custom/path-zero-strokewidth.svg: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 90adcba..aaaa2e9 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2010-08-06 Nikolas Zimmermann <nzimmermann at rim.com>
+
+ Reviewed by Dirk Schulze.
+
+ SVG - stroke-width:0 bug with stroke other than "none"
+ https://bugs.webkit.org/show_bug.cgi?id=42387
+
+ * platform/mac-leopard/svg/W3C-SVG-1.1/animate-elem-40-t-expected.checksum: Updated result, as fill="freeze" and stroke-width now works as expected.
+ * platform/mac-leopard/svg/W3C-SVG-1.1/animate-elem-40-t-expected.png: Ditto.
+ * platform/mac/fast/css/getComputedStyle/computed-style-expected.txt: kerning reports 0, stroke-dashoffset 0, stroke-width 1 instead of empty values.
+ * platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: Ditto.
+ * platform/mac/svg/W3C-SVG-1.1/animate-elem-40-t-expected.txt: Updated result, as fill="freeze" and stroke-width now works as expected.
+ * platform/mac/svg/custom/path-zero-strokewidth-expected.checksum: Added.
+ * platform/mac/svg/custom/path-zero-strokewidth-expected.png: Added.
+ * platform/mac/svg/custom/path-zero-strokewidth-expected.txt: Added.
+ * svg/css/getComputedStyle-basic-expected.txt: An empty stroke-dasharray reports "none", as defined in the spec now.
+ * svg/custom/path-zero-strokewidth.svg: Added.
+
2010-08-05 Marcus Bulach <bulach at chromium.org>
Reviewed by Jeremy Orlow.
diff --git a/LayoutTests/platform/mac-leopard/svg/W3C-SVG-1.1/animate-elem-40-t-expected.checksum b/LayoutTests/platform/mac-leopard/svg/W3C-SVG-1.1/animate-elem-40-t-expected.checksum
index 3a6db73..06ecf7a 100644
--- a/LayoutTests/platform/mac-leopard/svg/W3C-SVG-1.1/animate-elem-40-t-expected.checksum
+++ b/LayoutTests/platform/mac-leopard/svg/W3C-SVG-1.1/animate-elem-40-t-expected.checksum
@@ -1 +1 @@
-85ddcb5e223a8f0afb4e155b798b782b
\ No newline at end of file
+cc0120156f9e039da3b6643a16557377
\ No newline at end of file
diff --git a/LayoutTests/platform/mac-leopard/svg/W3C-SVG-1.1/animate-elem-40-t-expected.png b/LayoutTests/platform/mac-leopard/svg/W3C-SVG-1.1/animate-elem-40-t-expected.png
index 23c7c4e..698b682 100644
Binary files a/LayoutTests/platform/mac-leopard/svg/W3C-SVG-1.1/animate-elem-40-t-expected.png and b/LayoutTests/platform/mac-leopard/svg/W3C-SVG-1.1/animate-elem-40-t-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-expected.txt b/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-expected.txt
index b3f89ce..d1d2d34 100644
--- a/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-expected.txt
+++ b/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-expected.txt
@@ -194,16 +194,16 @@ marker-start: none;
shape-rendering: auto;
stroke: none;
stroke-dasharray: ;
-stroke-dashoffset: ;
+stroke-dashoffset: 0;
stroke-linecap: butt;
stroke-linejoin: miter;
stroke-miterlimit: 4;
stroke-opacity: 1;
-stroke-width: ;
+stroke-width: 1;
alignment-baseline: auto;
baseline-shift: baseline;
dominant-baseline: auto;
-kerning: ;
+kerning: 0;
text-anchor: start;
writing-mode: lr-tb;
glyph-orientation-horizontal: 0deg;
diff --git a/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt b/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
index b9222a5..bed26a0 100644
--- a/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
+++ b/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
@@ -193,16 +193,16 @@ Computed style of an element whose parent's 'display' value is 'none':
shape-rendering: auto
stroke: none
stroke-dasharray:
- stroke-dashoffset:
+ stroke-dashoffset: 0
stroke-linecap: butt
stroke-linejoin: miter
stroke-miterlimit: 4
stroke-opacity: 1
- stroke-width:
+ stroke-width: 1
alignment-baseline: auto
baseline-shift: baseline
dominant-baseline: auto
- kerning:
+ kerning: 0
text-anchor: start
writing-mode: lr-tb
glyph-orientation-horizontal: 0deg
diff --git a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/animate-elem-40-t-expected.txt b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/animate-elem-40-t-expected.txt
index 9538892..6532154 100644
--- a/LayoutTests/platform/mac/svg/W3C-SVG-1.1/animate-elem-40-t-expected.txt
+++ b/LayoutTests/platform/mac/svg/W3C-SVG-1.1/animate-elem-40-t-expected.txt
@@ -151,22 +151,22 @@ layer at (0,0) size 480x360
RenderSVGText {text} at (-52,46) size 104x18 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 104x18
chunk 1 (middle anchor) text run 1 at (-51.50,60.00) startOffset 0 endOffset 16 width 103.00: "x/y on <text>(2)"
- RenderSVGContainer {g} at (138,168) size 82x121 [transform={m=((1.00,0.00)(0.00,1.00)) t=(180.00,210.00)}]
+ RenderSVGContainer {g} at (138,168) size 83x121 [transform={m=((1.00,0.00)(0.00,1.00)) t=(180.00,210.00)}]
RenderSVGImage {image} at (140,170) size 50x50
RenderPath {rect} at (138,168) size 54x54 [stroke={[type=SOLID] [color=#FFB400] [stroke width=4.00]}] [data="M-40.00,-40.00 L10.00,-40.00 L10.00,10.00 L-40.00,10.00 Z"]
- RenderPath {rect} at (140,170) size 80x20 [stroke={[type=SOLID] [color=#FFB400] [stroke width=0.00]}] [data="M-40.00,-40.00 L40.00,-40.00 L40.00,-20.00 L-40.00,-20.00 Z"]
- RenderPath {rect} at (140,170) size 20x80 [stroke={[type=SOLID] [color=#FFB400] [stroke width=0.00]}] [data="M-40.00,-40.00 L-20.00,-40.00 L-20.00,40.00 L-40.00,40.00 Z"]
+ RenderPath {rect} at (139,169) size 82x22 [stroke={[type=SOLID] [color=#FFB400]}] [data="M-40.00,-40.00 L40.00,-40.00 L40.00,-20.00 L-40.00,-20.00 Z"]
+ RenderPath {rect} at (139,169) size 22x82 [stroke={[type=SOLID] [color=#FFB400]}] [data="M-40.00,-40.00 L-20.00,-40.00 L-20.00,40.00 L-40.00,40.00 Z"]
RenderSVGText {text} at (-40,46) size 80x18 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 80x18
chunk 1 (middle anchor) text run 1 at (-39.50,60.00) startOffset 0 endOffset 12 width 79.00: "width/height"
RenderSVGText {text} at (-38,61) size 76x18 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 76x18
chunk 1 (middle anchor) text run 1 at (-38.00,75.00) startOffset 0 endOffset 10 width 76.00: "on <image>"
- RenderSVGContainer {g} at (258,168) size 82x121 [transform={m=((1.00,0.00)(0.00,1.00)) t=(300.00,210.00)}]
+ RenderSVGContainer {g} at (258,168) size 83x121 [transform={m=((1.00,0.00)(0.00,1.00)) t=(300.00,210.00)}]
RenderPath {rect} at (260,170) size 50x50 [fill={[type=SOLID] [color=#808080]}] [data="M-40.00,-40.00 L10.00,-40.00 L10.00,10.00 L-40.00,10.00 Z"]
RenderPath {rect} at (258,168) size 54x54 [stroke={[type=SOLID] [color=#FFB400] [stroke width=4.00]}] [data="M-40.00,-40.00 L10.00,-40.00 L10.00,10.00 L-40.00,10.00 Z"]
- RenderPath {rect} at (260,170) size 80x20 [stroke={[type=SOLID] [color=#FFB400] [stroke width=0.00]}] [data="M-40.00,-40.00 L40.00,-40.00 L40.00,-20.00 L-40.00,-20.00 Z"]
- RenderPath {rect} at (260,170) size 20x80 [stroke={[type=SOLID] [color=#FFB400] [stroke width=0.00]}] [data="M-40.00,-40.00 L-20.00,-40.00 L-20.00,40.00 L-40.00,40.00 Z"]
+ RenderPath {rect} at (259,169) size 82x22 [stroke={[type=SOLID] [color=#FFB400]}] [data="M-40.00,-40.00 L40.00,-40.00 L40.00,-20.00 L-40.00,-20.00 Z"]
+ RenderPath {rect} at (259,169) size 22x82 [stroke={[type=SOLID] [color=#FFB400]}] [data="M-40.00,-40.00 L-20.00,-40.00 L-20.00,40.00 L-40.00,40.00 Z"]
RenderSVGText {text} at (-40,46) size 80x18 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 80x18
chunk 1 (middle anchor) text run 1 at (-39.50,60.00) startOffset 0 endOffset 12 width 79.00: "width/height"
diff --git a/LayoutTests/platform/mac/svg/custom/path-zero-strokewidth-expected.checksum b/LayoutTests/platform/mac/svg/custom/path-zero-strokewidth-expected.checksum
new file mode 100644
index 0000000..a20761e
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/path-zero-strokewidth-expected.checksum
@@ -0,0 +1 @@
+22998279d01102f1d51d87c163f7eb1b
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/svg/custom/path-zero-strokewidth-expected.png b/LayoutTests/platform/mac/svg/custom/path-zero-strokewidth-expected.png
new file mode 100644
index 0000000..60dad47
Binary files /dev/null and b/LayoutTests/platform/mac/svg/custom/path-zero-strokewidth-expected.png differ
diff --git a/LayoutTests/platform/mac/svg/custom/path-zero-strokewidth-expected.txt b/LayoutTests/platform/mac/svg/custom/path-zero-strokewidth-expected.txt
new file mode 100644
index 0000000..3ce8a5b
--- /dev/null
+++ b/LayoutTests/platform/mac/svg/custom/path-zero-strokewidth-expected.txt
@@ -0,0 +1,7 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 500x500
+ RenderSVGRoot {svg} at (40,10) size 285x75
+ RenderPath {polygon} at (40,10) size 100x60 [stroke={[type=SOLID] [color=#000088] [stroke width=0.00]}] [fill={[type=SOLID] [color=#DDEEFF]}] [data="M100.00,10.00 L120.00,20.00 L130.00,15.00 L140.00,50.00 L130.00,60.00 L120.00,70.00 L90.00,60.00 L40.00,25.00 Z"]
+ RenderPath {rect} at (200,10) size 50x50 [stroke={[type=SOLID] [color=#000088] [stroke width=0.00]}] [fill={[type=SOLID] [color=#DDEEFF]}] [data="M200.00,10.00 L250.00,10.00 L250.00,60.00 L200.00,60.00 Z"]
+ RenderPath {circle} at (275,35) size 50x50 [stroke={[type=SOLID] [color=#000088] [stroke width=0.00]}] [fill={[type=SOLID] [color=#DDEEFF]}] [data="M325.00,60.00 L324.95,61.57 L324.80,63.13 L324.56,64.68 L324.21,66.22 L323.78,67.73 L323.24,69.20 L322.62,70.64 L321.91,72.04 L321.11,73.40 L320.23,74.69 L319.26,75.94 L318.22,77.11 L317.11,78.22 L315.94,79.26 L314.69,80.23 L313.40,81.11 L312.04,81.91 L310.64,82.62 L309.20,83.24 L307.73,83.78 L306.22,84.21 L304.68,84.56 L303.13,84.80 L301.57,84.95 L300.00,85.00 L298.43,84.95 L296.87,84.80 L295.32,84.56 L293.78,84.21 L292.27,83.78 L290.80,83.24 L289.36,82.62 L287.96,81.91 L286.60,81.11 L285.31,80.23 L284.06,79.26 L282.89,78.22 L281.78,77.11 L280.74,75.94 L279.77,74.69 L278.89,73.40 L278.09,72.04 L277.38,70.64 L276.76,69.20 L276.22,67.73 L275.79,66.22 L275.44,64.68 L275.20,63.13 L275.05,61.57 L275.00,60.00 L275.05,58.43 L275.20,56.87 L275.44,55.32 L275.79,53.78 L276.22,52.27 L276.76,50.80 L277.38,49.36 L278.09,47.96 L278.89,46.60 L279.77,45.31 L280.74,44.06 L281.78,42.89 L282.89,41.78 L284.06,40.74 L285.31,39.77 L286.60,38.89 L287.96,38.09 L289.36,37.38 L290.80,36.76 L292.27,36.22 L293.78,35.79 L295.32,35.44 L296.87,35.20 L298.43,35.05 L300.00,35.00 L301.57,35.05 L303.13,35.20 L304.68,35.44 L306.22,35.79 L307.73,36.22 L309.20,36.76 L310.64,37.38 L312.04,38.09 L313.40,38.89 L314.69,39.77 L315.94,40.74 L317.11,41.78 L318.22,42.89 L319.26,44.06 L320.23,45.31 L321.11,46.60 L321.91,47.96 L322.62,49.36 L323.24,50.80 L323.78,52.27 L324.21,53.78 L324.56,55.32 L324.80,56.87 L324.95,58.43 Z"]
diff --git a/LayoutTests/svg/css/getComputedStyle-basic-expected.txt b/LayoutTests/svg/css/getComputedStyle-basic-expected.txt
index b5b9b1b..a7e9bc2 100644
--- a/LayoutTests/svg/css/getComputedStyle-basic-expected.txt
+++ b/LayoutTests/svg/css/getComputedStyle-basic-expected.txt
@@ -384,10 +384,10 @@ rect: style.getPropertyValue(shape-rendering) : auto
rect: style.getPropertyCSSValue(shape-rendering) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(stroke) : #FFA500
rect: style.getPropertyCSSValue(stroke) : [object SVGPaint]
-rect: style.getPropertyValue(stroke-dasharray) :
-rect: style.getPropertyCSSValue(stroke-dasharray) : null
-rect: style.getPropertyValue(stroke-dashoffset) :
-rect: style.getPropertyCSSValue(stroke-dashoffset) : null
+rect: style.getPropertyValue(stroke-dasharray) : none
+rect: style.getPropertyCSSValue(stroke-dasharray) : [object CSSPrimitiveValue]
+rect: style.getPropertyValue(stroke-dashoffset) : 0
+rect: style.getPropertyCSSValue(stroke-dashoffset) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(stroke-linecap) : butt
rect: style.getPropertyCSSValue(stroke-linecap) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(stroke-linejoin) : miter
@@ -404,8 +404,8 @@ rect: style.getPropertyValue(baseline-shift) : baseline
rect: style.getPropertyCSSValue(baseline-shift) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(dominant-baseline) : auto
rect: style.getPropertyCSSValue(dominant-baseline) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(kerning) :
-rect: style.getPropertyCSSValue(kerning) : null
+rect: style.getPropertyValue(kerning) : 0
+rect: style.getPropertyCSSValue(kerning) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(text-anchor) : start
rect: style.getPropertyCSSValue(text-anchor) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(writing-mode) : lr-tb
@@ -804,10 +804,10 @@ g: style.getPropertyValue(shape-rendering) : auto
g: style.getPropertyCSSValue(shape-rendering) : [object CSSPrimitiveValue]
g: style.getPropertyValue(stroke) : #FFA500
g: style.getPropertyCSSValue(stroke) : [object SVGPaint]
-g: style.getPropertyValue(stroke-dasharray) :
-g: style.getPropertyCSSValue(stroke-dasharray) : null
-g: style.getPropertyValue(stroke-dashoffset) :
-g: style.getPropertyCSSValue(stroke-dashoffset) : null
+g: style.getPropertyValue(stroke-dasharray) : none
+g: style.getPropertyCSSValue(stroke-dasharray) : [object CSSPrimitiveValue]
+g: style.getPropertyValue(stroke-dashoffset) : 0
+g: style.getPropertyCSSValue(stroke-dashoffset) : [object CSSPrimitiveValue]
g: style.getPropertyValue(stroke-linecap) : butt
g: style.getPropertyCSSValue(stroke-linecap) : [object CSSPrimitiveValue]
g: style.getPropertyValue(stroke-linejoin) : miter
@@ -824,8 +824,8 @@ g: style.getPropertyValue(baseline-shift) : baseline
g: style.getPropertyCSSValue(baseline-shift) : [object CSSPrimitiveValue]
g: style.getPropertyValue(dominant-baseline) : auto
g: style.getPropertyCSSValue(dominant-baseline) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(kerning) :
-g: style.getPropertyCSSValue(kerning) : null
+g: style.getPropertyValue(kerning) : 0
+g: style.getPropertyCSSValue(kerning) : [object CSSPrimitiveValue]
g: style.getPropertyValue(text-anchor) : start
g: style.getPropertyCSSValue(text-anchor) : [object CSSPrimitiveValue]
g: style.getPropertyValue(writing-mode) : lr-tb
diff --git a/LayoutTests/svg/custom/path-zero-strokewidth.svg b/LayoutTests/svg/custom/path-zero-strokewidth.svg
new file mode 100644
index 0000000..94b4f2c
--- /dev/null
+++ b/LayoutTests/svg/custom/path-zero-strokewidth.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" width="500" height="500">
+ <polygon points="100,10 120,20 130,15 140,50 130,60 120,70 90,60 40,25" />
+ <rect x="200" y="10" width="50" height="50"/>
+ <circle cx="300" cy="60" r="25"/>
+ <style type="text/css">
+ polygon, rect, circle { stroke:#008; stroke-width:0; fill:#DEF; }
+ </style>
+</svg>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index bed0843..d8926a5 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,76 @@
+2010-08-06 Nikolas Zimmermann <nzimmermann at rim.com>
+
+ Reviewed by Dirk Schulze.
+
+ SVG - stroke-width:0 bug with stroke other than "none"
+ https://bugs.webkit.org/show_bug.cgi?id=42387
+
+ Stop storing refcounted CSSValue/CSSValueList objects in SVGRenderStyle, replacing them with SVGLength types.
+ Allows us to directly specify default values for stroke-dashoffset/width in the SVGRenderStyle, fixing a problem
+ with stroke-width animations when resetting to the original stored baseVal, exposed in svg/W3C-1.1/animate-elem-40-t.svg
+ Originally discovered by Fady Samuel.
+
+ Test: svg/custom/path-zero-strokewidth.svg
+
+ * css/SVGCSSComputedStyleDeclaration.cpp:
+ (WebCore::strokeDashArrayToCSSValueList): New helper function converting from Vector<SVGLength> to CSSValueList.
+ (WebCore::CSSComputedStyleDeclaration::getSVGPropertyCSSValue): Convert SVGLength values to CSSPrimitiveValues.
+ * css/SVGCSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::applySVGProperty): Convert CSSPrimitiveValues to SVGLength objects, for SVGRenderStyle storage.
+ * rendering/RenderPath.cpp:
+ (WebCore::RenderPath::calculateMarkerBoundsIfNeeded): Just grab strokeWidth SVGLength value from SVGRenderSTyle, no need to call cssPrimitiveToLength anymore.
+ * rendering/RenderSVGText.cpp:
+ (WebCore::RenderSVGText::strokeBoundingBox): Ditto.
+ * rendering/SVGCharacterLayoutInfo.cpp:
+ (WebCore::calculateBaselineShift): Ditto (for baseline-shift).
+ * rendering/SVGInlineTextBox.cpp:
+ (WebCore::SVGInlineTextBox::buildLayoutInformation): Ditto (for kerning).
+ * rendering/SVGRenderSupport.cpp:
+ (WebCore::SVGRenderSupport::applyStrokeStyleToContext): Ditto (for stroke-width/stroke-dashoffset/stroke-dasharray).
+ * rendering/SVGRenderSupport.h:
+ * rendering/SVGRenderTreeAsText.cpp:
+ (WebCore::writeStyle): Ditto.
+ * rendering/SVGTextLayoutUtilities.cpp:
+ (WebCore::calculateCSSKerning): Ditto.
+ * rendering/SVGTextLayoutUtilities.h:
+ * rendering/style/SVGRenderStyle.cpp: Remove no longer needed cssPrimitiveToLength function.
+ * rendering/style/SVGRenderStyle.h: Stop storing RefPtr<CSSValue> / RefPtr<CSSValueList> but use SVGLength/Vector<SVGLength>.
+ (WebCore::SVGRenderStyle::initialStrokeDashArray): Allows us to specify correct default values, instead of null pointers.
+ (WebCore::SVGRenderStyle::initialBaselineShiftValue): Specify 0px default value.
+ (WebCore::SVGRenderStyle::initialKerning): Ditto.
+ (WebCore::SVGRenderStyle::initialStrokeDashOffset): Ditto.
+ (WebCore::SVGRenderStyle::initialStrokeWidth): Specify 1px default value.
+ (WebCore::SVGRenderStyle::setStrokeDashArray): Takes a Vector<SVGLength> now, not a PassRefPtr<CSSValueList>.
+ (WebCore::SVGRenderStyle::setStrokeWidth): Takes a SVGLength now, not a PassRefPtr<CSSValue>.
+ (WebCore::SVGRenderStyle::setStrokeDashOffset): Ditto.
+ (WebCore::SVGRenderStyle::setKerning): Ditto.
+ (WebCore::SVGRenderStyle::setStopColor): Pass Color as const-reference.
+ (WebCore::SVGRenderStyle::setFloodColor): Ditto.
+ (WebCore::SVGRenderStyle::setLightingColor): Ditto.
+ (WebCore::SVGRenderStyle::setBaselineShiftValue): Takes a SVGLength now, not a PassRefPtr<CSSValue>.
+ (WebCore::SVGRenderStyle::setShadow): Reformat, had wrong style.
+ (WebCore::SVGRenderStyle::setClipperResource): Pass String as const-reference.
+ (WebCore::SVGRenderStyle::setFilterResource): Ditto.
+ (WebCore::SVGRenderStyle::setMaskerResource): Ditto.
+ (WebCore::SVGRenderStyle::setMarkerStartResource): Ditto.
+ (WebCore::SVGRenderStyle::setMarkerMidResource): Ditto.
+ (WebCore::SVGRenderStyle::setMarkerEndResource): Ditto.
+ (WebCore::SVGRenderStyle::strokeDashArray): Return Vector<SVGLength>.
+ (WebCore::SVGRenderStyle::strokeWidth): Return SVGLength.
+ (WebCore::SVGRenderStyle::strokeDashOffset): Ditto.
+ (WebCore::SVGRenderStyle::kerning): Ditto.
+ (WebCore::SVGRenderStyle::baselineShiftValue): Ditto.
+ * rendering/style/SVGRenderStyleDefs.cpp:
+ (WebCore::StyleStrokeData::StyleStrokeData): Changed initialization order, to group stroke properties.
+ * rendering/style/SVGRenderStyleDefs.h: Store SVGLength values instead of reference counted CSS objects.
+ * svg/SVGLength.cpp:
+ (WebCore::SVGLength::SVGLength): Add copy constructor.
+ (WebCore::SVGLength::operator==): Add comparision operator.
+ (WebCore::SVGLength::operator!=): Ditto.
+ (WebCore::SVGLength::fromCSSPrimitiveValue): New static helper function to convert from a CSSPrimitiveValue.
+ (WebCore::SVGLength::toCSSPrimitiveValue): New static helper function to convert to a CSSPrimitiveValue.
+ * svg/SVGLength.h: Reindent.
+
2010-08-06 Luiz Agostini <luiz.agostini at openbossa.org>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/css/SVGCSSComputedStyleDeclaration.cpp b/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
index 00cb308..410eede 100644
--- a/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
+++ b/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
@@ -46,6 +46,19 @@ static PassRefPtr<CSSPrimitiveValue> glyphOrientationToCSSPrimitiveValue(EGlyphO
}
}
+static PassRefPtr<CSSValue> strokeDashArrayToCSSValueList(const Vector<SVGLength>& dashes)
+{
+ if (dashes.isEmpty())
+ return CSSPrimitiveValue::createIdentifier(CSSValueNone);
+
+ RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+ const Vector<SVGLength>::const_iterator end = dashes.end();
+ for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it)
+ list->append(SVGLength::toCSSPrimitiveValue(*it));
+
+ return list.release();
+}
+
PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(int propertyID, EUpdateLayout updateLayout) const
{
Node* node = m_node.get();
@@ -122,7 +135,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(int pro
case CSSPropertyFill:
return svgStyle->fillPaint();
case CSSPropertyKerning:
- return svgStyle->kerning();
+ return SVGLength::toCSSPrimitiveValue(svgStyle->kerning());
case CSSPropertyMarkerEnd:
if (!svgStyle->markerEndResource().isEmpty())
return CSSPrimitiveValue::create(svgStyle->markerEndResource(), CSSPrimitiveValue::CSS_URI);
@@ -138,11 +151,11 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(int pro
case CSSPropertyStroke:
return svgStyle->strokePaint();
case CSSPropertyStrokeDasharray:
- return svgStyle->strokeDashArray();
+ return strokeDashArrayToCSSValueList(svgStyle->strokeDashArray());
case CSSPropertyStrokeDashoffset:
- return svgStyle->strokeDashOffset();
+ return SVGLength::toCSSPrimitiveValue(svgStyle->strokeDashOffset());
case CSSPropertyStrokeWidth:
- return svgStyle->strokeWidth();
+ return SVGLength::toCSSPrimitiveValue(svgStyle->strokeWidth());
case CSSPropertyBaselineShift: {
switch (svgStyle->baselineShift()) {
case BS_BASELINE:
@@ -152,7 +165,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSValue(int pro
case BS_SUB:
return CSSPrimitiveValue::createIdentifier(CSSValueSub);
case BS_LENGTH:
- return svgStyle->baselineShiftValue();
+ return SVGLength::toCSSPrimitiveValue(svgStyle->baselineShiftValue());
}
}
case CSSPropertyGlyphOrientationHorizontal:
diff --git a/WebCore/css/SVGCSSStyleSelector.cpp b/WebCore/css/SVGCSSStyleSelector.cpp
index 3b38890..b8cc4f7 100644
--- a/WebCore/css/SVGCSSStyleSelector.cpp
+++ b/WebCore/css/SVGCSSStyleSelector.cpp
@@ -153,7 +153,7 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value)
}
} else {
svgstyle->setBaselineShift(BS_LENGTH);
- svgstyle->setBaselineShiftValue(primitiveValue);
+ svgstyle->setBaselineShiftValue(SVGLength::fromCSSPrimitiveValue(primitiveValue));
}
break;
@@ -161,7 +161,7 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value)
case CSSPropertyKerning:
{
HANDLE_INHERIT_AND_INITIAL(kerning, Kerning);
- svgstyle->setKerning(primitiveValue);
+ svgstyle->setKerning(SVGLength::fromCSSPrimitiveValue(primitiveValue));
break;
}
case CSSPropertyDominantBaseline:
@@ -247,21 +247,35 @@ void CSSStyleSelector::applySVGProperty(int id, CSSValue* value)
{
HANDLE_INHERIT_AND_INITIAL(strokeWidth, StrokeWidth)
if (primitiveValue)
- svgstyle->setStrokeWidth(primitiveValue);
+ svgstyle->setStrokeWidth(SVGLength::fromCSSPrimitiveValue(primitiveValue));
break;
}
case CSSPropertyStrokeDasharray:
{
HANDLE_INHERIT_AND_INITIAL(strokeDashArray, StrokeDashArray)
- if (value->isValueList())
- svgstyle->setStrokeDashArray(static_cast<CSSValueList*>(value));
+ if (!value->isValueList())
+ break;
+
+ CSSValueList* dashes = static_cast<CSSValueList*>(value);
+
+ Vector<SVGLength> array;
+ size_t length = dashes->length();
+ for (size_t i = 0; i < length; ++i) {
+ CSSPrimitiveValue* dash = static_cast<CSSPrimitiveValue*>(dashes->itemWithoutBoundsCheck(i));
+ if (!dash)
+ continue;
+
+ array.append(SVGLength::fromCSSPrimitiveValue(dash));
+ }
+
+ svgstyle->setStrokeDashArray(array);
break;
}
case CSSPropertyStrokeDashoffset:
{
HANDLE_INHERIT_AND_INITIAL(strokeDashOffset, StrokeDashOffset)
if (primitiveValue)
- svgstyle->setStrokeDashOffset(primitiveValue);
+ svgstyle->setStrokeDashOffset(SVGLength::fromCSSPrimitiveValue(primitiveValue));
break;
}
case CSSPropertyFillOpacity:
diff --git a/WebCore/rendering/RenderPath.cpp b/WebCore/rendering/RenderPath.cpp
index 915be5d..ddc2c45 100644
--- a/WebCore/rendering/RenderPath.cpp
+++ b/WebCore/rendering/RenderPath.cpp
@@ -257,8 +257,7 @@ FloatRect RenderPath::calculateMarkerBoundsIfNeeded()
if (!markerStart && !markerMid && !markerEnd)
return FloatRect();
- float strokeWidth = SVGRenderStyle::cssPrimitiveToLength(this, svgStyle->strokeWidth(), 1.0f);
- return m_markerLayoutInfo.calculateBoundaries(markerStart, markerMid, markerEnd, strokeWidth, m_path);
+ return m_markerLayoutInfo.calculateBoundaries(markerStart, markerMid, markerEnd, svgStyle->strokeWidth().value(svgElement), m_path);
}
void RenderPath::styleWillChange(StyleDifference diff, const RenderStyle* newStyle)
diff --git a/WebCore/rendering/RenderSVGText.cpp b/WebCore/rendering/RenderSVGText.cpp
index c4fc353..20c8a7c 100644
--- a/WebCore/rendering/RenderSVGText.cpp
+++ b/WebCore/rendering/RenderSVGText.cpp
@@ -163,10 +163,13 @@ void RenderSVGText::paint(PaintInfo& paintInfo, int, int)
FloatRect RenderSVGText::strokeBoundingBox() const
{
FloatRect strokeBoundaries = objectBoundingBox();
- if (!style()->svgStyle()->hasStroke())
+ const SVGRenderStyle* svgStyle = style()->svgStyle();
+ if (!svgStyle->hasStroke())
return strokeBoundaries;
- strokeBoundaries.inflate(SVGRenderStyle::cssPrimitiveToLength(this, style()->svgStyle()->strokeWidth(), 1.0f));
+ ASSERT(node());
+ ASSERT(node()->isSVGElement());
+ strokeBoundaries.inflate(svgStyle->strokeWidth().value(static_cast<SVGElement*>(node())));
return strokeBoundaries;
}
diff --git a/WebCore/rendering/SVGCharacterLayoutInfo.cpp b/WebCore/rendering/SVGCharacterLayoutInfo.cpp
index 18315df..71ff1aa 100644
--- a/WebCore/rendering/SVGCharacterLayoutInfo.cpp
+++ b/WebCore/rendering/SVGCharacterLayoutInfo.cpp
@@ -37,16 +37,21 @@ namespace WebCore {
// Helper function
static float calculateBaselineShift(RenderObject* item)
{
+ ASSERT(item);
+ ASSERT(item->style());
+ ASSERT(item->node());
+ ASSERT(item->node()->isSVGElement());
+
const Font& font = item->style()->font();
const SVGRenderStyle* svgStyle = item->style()->svgStyle();
float baselineShift = 0.0f;
if (svgStyle->baselineShift() == BS_LENGTH) {
- CSSPrimitiveValue* primitive = static_cast<CSSPrimitiveValue*>(svgStyle->baselineShiftValue());
- baselineShift = primitive->getFloatValue();
-
- if (primitive->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
- baselineShift = baselineShift / 100.0f * font.pixelSize();
+ SVGLength baselineShiftValueLength = svgStyle->baselineShiftValue();
+ if (baselineShiftValueLength.unitType() == LengthTypePercentage)
+ baselineShift = baselineShiftValueLength.valueAsPercentage() * font.pixelSize();
+ else
+ baselineShift = baselineShiftValueLength.value(static_cast<SVGElement*>(item->node()));
} else {
float baselineAscent = font.ascent() + font.descent();
diff --git a/WebCore/rendering/SVGInlineTextBox.cpp b/WebCore/rendering/SVGInlineTextBox.cpp
index a293124..f5bbe5b 100644
--- a/WebCore/rendering/SVGInlineTextBox.cpp
+++ b/WebCore/rendering/SVGInlineTextBox.cpp
@@ -638,6 +638,12 @@ void SVGInlineTextBox::buildLayoutInformation(SVGCharacterLayoutInfo& info, SVGL
RenderStyle* style = textRenderer->style();
ASSERT(style);
+ RenderObject* parentRenderer = parent()->renderer();
+ ASSERT(parentRenderer);
+ ASSERT(parentRenderer->node());
+ ASSERT(parentRenderer->node()->isSVGElement());
+ SVGElement* lengthContext = static_cast<SVGElement*>(parentRenderer->node());
+
const Font& font = style->font();
const UChar* characters = textRenderer->characters();
@@ -709,7 +715,7 @@ void SVGInlineTextBox::buildLayoutInformation(SVGCharacterLayoutInfo& info, SVGL
}
// Take letter & word spacing and kerning into account
- float spacing = font.letterSpacing() + calculateCSSKerning(style);
+ float spacing = font.letterSpacing() + calculateCSSKerning(lengthContext, style);
const UChar* currentCharacter = characters + (textDirection == RTL ? endPosition - i : startPosition + i);
const UChar* lastCharacter = 0;
diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp
index 34f6659..67e19f2 100644
--- a/WebCore/rendering/SVGRenderSupport.cpp
+++ b/WebCore/rendering/SVGRenderSupport.cpp
@@ -320,41 +320,35 @@ bool SVGRenderSupport::pointInClippingArea(RenderObject* object, const FloatPoin
return true;
}
-DashArray SVGRenderSupport::dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle)
+void SVGRenderSupport::applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle* style, const RenderObject* object)
{
- DashArray array;
-
- CSSValueList* dashes = style->svgStyle()->strokeDashArray();
- if (!dashes)
- return array;
-
- CSSPrimitiveValue* dash = 0;
- unsigned long len = dashes->length();
- for (unsigned long i = 0; i < len; ++i) {
- dash = static_cast<CSSPrimitiveValue*>(dashes->itemWithoutBoundsCheck(i));
- if (!dash)
- continue;
-
- array.append(dash->computeLengthFloat(const_cast<RenderStyle*>(style), rootStyle));
- }
+ ASSERT(context);
+ ASSERT(style);
+ ASSERT(object);
+ ASSERT(object->node());
+ ASSERT(object->node()->isSVGElement());
- return array;
-}
+ const SVGRenderStyle* svgStyle = style->svgStyle();
+ ASSERT(svgStyle);
-void SVGRenderSupport::applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle* style, const RenderObject* object)
-{
- context->setStrokeThickness(SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeWidth(), 1.0f));
- context->setLineCap(style->svgStyle()->capStyle());
- context->setLineJoin(style->svgStyle()->joinStyle());
- if (style->svgStyle()->joinStyle() == MiterJoin)
- context->setMiterLimit(style->svgStyle()->strokeMiterLimit());
-
- const DashArray& dashes = dashArrayFromRenderingStyle(object->style(), object->document()->documentElement()->renderStyle());
- float dashOffset = SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeDashOffset(), 0.0f);
+ SVGElement* lengthContext = static_cast<SVGElement*>(object->node());
+ context->setStrokeThickness(svgStyle->strokeWidth().value(lengthContext));
+ context->setLineCap(svgStyle->capStyle());
+ context->setLineJoin(svgStyle->joinStyle());
+ if (svgStyle->joinStyle() == MiterJoin)
+ context->setMiterLimit(svgStyle->strokeMiterLimit());
+
+ const Vector<SVGLength>& dashes = svgStyle->strokeDashArray();
if (dashes.isEmpty())
context->setStrokeStyle(SolidStroke);
- else
- context->setLineDash(dashes, dashOffset);
+ else {
+ DashArray dashArray;
+ const Vector<SVGLength>::const_iterator end = dashes.end();
+ for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it)
+ dashArray.append((*it).value(lengthContext));
+
+ context->setLineDash(dashArray, svgStyle->strokeDashOffset().value(lengthContext));
+ }
}
const RenderObject* SVGRenderSupport::findTextRootObject(const RenderObject* start)
diff --git a/WebCore/rendering/SVGRenderSupport.h b/WebCore/rendering/SVGRenderSupport.h
index 371ac75..576475b 100644
--- a/WebCore/rendering/SVGRenderSupport.h
+++ b/WebCore/rendering/SVGRenderSupport.h
@@ -26,7 +26,6 @@
#define SVGRenderSupport_h
#if ENABLE(SVG)
-#include "DashArray.h"
#include "PaintInfo.h"
namespace WebCore {
@@ -81,7 +80,6 @@ public:
// FIXME: These methods do not belong here.
static const RenderObject* findTextRootObject(const RenderObject* start);
- static DashArray dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle);
private:
// This class is not constructable.
diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp
index d298544..db4c07a 100644
--- a/WebCore/rendering/SVGRenderTreeAsText.cpp
+++ b/WebCore/rendering/SVGRenderTreeAsText.cpp
@@ -365,15 +365,23 @@ static void writeStyle(TextStream& ts, const RenderObject& object)
writeIfNotDefault(ts, "opacity", style->opacity(), RenderStyle::initialOpacity());
if (object.isRenderPath()) {
const RenderPath& path = static_cast<const RenderPath&>(object);
+ ASSERT(path.node());
+ ASSERT(path.node()->isSVGElement());
if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(const_cast<RenderPath*>(&path), path.style())) {
TextStreamSeparator s(" ");
ts << " [stroke={" << s;
writeSVGPaintingResource(ts, strokePaintingResource);
- double dashOffset = SVGRenderStyle::cssPrimitiveToLength(&path, svgStyle->strokeDashOffset(), 0.0f);
- const DashArray& dashArray = SVGRenderSupport::dashArrayFromRenderingStyle(style, object.document()->documentElement()->renderStyle());
- double strokeWidth = SVGRenderStyle::cssPrimitiveToLength(&path, svgStyle->strokeWidth(), 1.0f);
+ SVGElement* element = static_cast<SVGElement*>(path.node());
+ double dashOffset = svgStyle->strokeDashOffset().value(element);
+ double strokeWidth = svgStyle->strokeWidth().value(element);
+ const Vector<SVGLength>& dashes = svgStyle->strokeDashArray();
+
+ DashArray dashArray;
+ const Vector<SVGLength>::const_iterator end = dashes.end();
+ for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it)
+ dashArray.append((*it).value(element));
writeIfNotDefault(ts, "opacity", svgStyle->strokeOpacity(), 1.0f);
writeIfNotDefault(ts, "stroke width", strokeWidth, 1.0);
diff --git a/WebCore/rendering/SVGTextLayoutUtilities.cpp b/WebCore/rendering/SVGTextLayoutUtilities.cpp
index 4366498..2debf28 100644
--- a/WebCore/rendering/SVGTextLayoutUtilities.cpp
+++ b/WebCore/rendering/SVGTextLayoutUtilities.cpp
@@ -315,20 +315,16 @@ TextRun svgTextRunForInlineTextBox(const UChar* characters, int length, const Re
return run;
}
-float calculateCSSKerning(const RenderStyle* style)
+float calculateCSSKerning(SVGElement* context, const RenderStyle* style)
{
const Font& font = style->font();
const SVGRenderStyle* svgStyle = style->svgStyle();
- float kerning = 0.0f;
- if (CSSPrimitiveValue* primitive = static_cast<CSSPrimitiveValue*>(svgStyle->kerning())) {
- kerning = primitive->getFloatValue();
-
- if (primitive->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE && font.pixelSize())
- kerning = kerning / 100.0f * font.pixelSize();
- }
+ SVGLength kerningLength = svgStyle->kerning();
+ if (kerningLength.unitType() == LengthTypePercentage)
+ return kerningLength.valueAsPercentage() * font.pixelSize();
- return kerning;
+ return kerningLength.value(context);
}
bool applySVGKerning(SVGCharacterLayoutInfo& info, const RenderStyle* style, SVGLastGlyphInfo& lastGlyph, const String& unicodeString, const String& glyphName, bool isVerticalText)
diff --git a/WebCore/rendering/SVGTextLayoutUtilities.h b/WebCore/rendering/SVGTextLayoutUtilities.h
index 8c07f62..459d682 100644
--- a/WebCore/rendering/SVGTextLayoutUtilities.h
+++ b/WebCore/rendering/SVGTextLayoutUtilities.h
@@ -32,6 +32,7 @@ class Font;
class InlineTextBox;
class RenderObject;
class RenderStyle;
+class SVGElement;
class SVGRenderStyle;
class TextRun;
@@ -60,7 +61,7 @@ float cummulatedWidthOfInlineBoxCharacterRange(SVGInlineBoxCharacterRange&);
float cummulatedHeightOfInlineBoxCharacterRange(SVGInlineBoxCharacterRange&);
TextRun svgTextRunForInlineTextBox(const UChar*, int length, const RenderStyle*, const InlineTextBox*);
-float calculateCSSKerning(const RenderStyle*);
+float calculateCSSKerning(SVGElement* context, const RenderStyle*);
bool applySVGKerning(SVGCharacterLayoutInfo&, const RenderStyle*, SVGLastGlyphInfo&, const String& unicodeString, const String& glyphName, bool isVerticalText);
}
diff --git a/WebCore/rendering/style/SVGRenderStyle.cpp b/WebCore/rendering/style/SVGRenderStyle.cpp
index 2a9003c..0df26f4 100644
--- a/WebCore/rendering/style/SVGRenderStyle.cpp
+++ b/WebCore/rendering/style/SVGRenderStyle.cpp
@@ -211,26 +211,6 @@ StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const
return StyleDifferenceEqual;
}
-float SVGRenderStyle::cssPrimitiveToLength(const RenderObject* item, CSSValue* value, float defaultValue)
-{
- CSSPrimitiveValue* primitive = static_cast<CSSPrimitiveValue*>(value);
-
- unsigned short cssType = (primitive ? primitive->primitiveType() : (unsigned short) CSSPrimitiveValue::CSS_UNKNOWN);
- if (!(cssType > CSSPrimitiveValue::CSS_UNKNOWN && cssType <= CSSPrimitiveValue::CSS_PC))
- return defaultValue;
-
- if (cssType == CSSPrimitiveValue::CSS_PERCENTAGE) {
- SVGStyledElement* element = static_cast<SVGStyledElement*>(item->node());
- SVGElement* viewportElement = (element ? element->viewportElement() : 0);
- if (viewportElement) {
- float result = primitive->getFloatValue() / 100.0f;
- return SVGLength::PercentageOfViewport(result, element, LengthModeOther);
- }
- }
-
- return primitive->computeLengthFloat(const_cast<RenderStyle*>(item->style()), item->document()->documentElement()->renderStyle());
-}
-
static void getSVGShadowExtent(ShadowData* shadow, float& top, float& right, float& bottom, float& left)
{
top = 0.0f;
diff --git a/WebCore/rendering/style/SVGRenderStyle.h b/WebCore/rendering/style/SVGRenderStyle.h
index c1d72e9..f071755 100644
--- a/WebCore/rendering/style/SVGRenderStyle.h
+++ b/WebCore/rendering/style/SVGRenderStyle.h
@@ -78,17 +78,13 @@ public:
static SVGPaint* initialFillPaint() { return SVGPaint::defaultFill(); }
static float initialStrokeOpacity() { return 1.0f; }
static SVGPaint* initialStrokePaint() { return SVGPaint::defaultStroke(); }
- static CSSValueList* initialStrokeDashArray() { return 0; }
+ static Vector<SVGLength> initialStrokeDashArray() { return Vector<SVGLength>(); }
static float initialStrokeMiterLimit() { return 4.0f; }
- static CSSValue* initialStrokeWidth() { return 0; }
- static CSSValue* initialStrokeDashOffset() { return 0; };
- static CSSValue* initialKerning() { return 0; }
static float initialStopOpacity() { return 1.0f; }
static Color initialStopColor() { return Color(0, 0, 0); }
static float initialFloodOpacity() { return 1.0f; }
static Color initialFloodColor() { return Color(0, 0, 0); }
static Color initialLightingColor() { return Color(255, 255, 255); }
- static CSSValue* initialBaselineShiftValue() { return 0; }
static ShadowData* initialShadow() { return 0; }
static String initialClipperResource() { return String(); }
static String initialFilterResource() { return String(); }
@@ -97,6 +93,34 @@ public:
static String initialMarkerMidResource() { return String(); }
static String initialMarkerEndResource() { return String(); }
+ static SVGLength initialBaselineShiftValue()
+ {
+ SVGLength length;
+ length.newValueSpecifiedUnits(LengthTypeNumber, 0);
+ return length;
+ }
+
+ static SVGLength initialKerning()
+ {
+ SVGLength length;
+ length.newValueSpecifiedUnits(LengthTypeNumber, 0);
+ return length;
+ }
+
+ static SVGLength initialStrokeDashOffset()
+ {
+ SVGLength length;
+ length.newValueSpecifiedUnits(LengthTypeNumber, 0);
+ return length;
+ }
+
+ static SVGLength initialStrokeWidth()
+ {
+ SVGLength length;
+ length.newValueSpecifiedUnits(LengthTypeNumber, 1);
+ return length;
+ }
+
// SVG CSS Property setters
void setAlignmentBaseline(EAlignmentBaseline val) { svg_noninherited_flags.f._alignmentBaseline = val; }
void setDominantBaseline(EDominantBaseline val) { svg_noninherited_flags.f._dominantBaseline = val; }
@@ -140,7 +164,7 @@ public:
stroke.access()->paint = obj;
}
- void setStrokeDashArray(PassRefPtr<CSSValueList> obj)
+ void setStrokeDashArray(const Vector<SVGLength>& obj)
{
if (!(stroke->dashArray == obj))
stroke.access()->dashArray = obj;
@@ -152,19 +176,19 @@ public:
stroke.access()->miterLimit = obj;
}
- void setStrokeWidth(PassRefPtr<CSSValue> obj)
+ void setStrokeWidth(const SVGLength& obj)
{
if (!(stroke->width == obj))
stroke.access()->width = obj;
}
- void setStrokeDashOffset(PassRefPtr<CSSValue> obj)
+ void setStrokeDashOffset(const SVGLength& obj)
{
if (!(stroke->dashOffset == obj))
stroke.access()->dashOffset = obj;
}
- void setKerning(PassRefPtr<CSSValue> obj)
+ void setKerning(const SVGLength& obj)
{
if (!(text->kerning == obj))
text.access()->kerning = obj;
@@ -176,7 +200,7 @@ public:
stops.access()->opacity = obj;
}
- void setStopColor(Color obj)
+ void setStopColor(const Color& obj)
{
if (!(stops->color == obj))
stops.access()->color = obj;
@@ -188,60 +212,59 @@ public:
misc.access()->floodOpacity = obj;
}
- void setFloodColor(Color obj)
+ void setFloodColor(const Color& obj)
{
if (!(misc->floodColor == obj))
misc.access()->floodColor = obj;
}
- void setLightingColor(Color obj)
+ void setLightingColor(const Color& obj)
{
if (!(misc->lightingColor == obj))
misc.access()->lightingColor = obj;
}
- void setBaselineShiftValue(PassRefPtr<CSSValue> obj)
+ void setBaselineShiftValue(const SVGLength& obj)
{
if (!(misc->baselineShiftValue == obj))
misc.access()->baselineShiftValue = obj;
}
- void setShadow(PassOwnPtr<ShadowData> obj) { shadowSVG.access()->shadow = obj;
- }
+ void setShadow(PassOwnPtr<ShadowData> obj) { shadowSVG.access()->shadow = obj; }
// Setters for non-inherited resources
- void setClipperResource(String obj)
+ void setClipperResource(const String& obj)
{
if (!(resources->clipper == obj))
resources.access()->clipper = obj;
}
- void setFilterResource(String obj)
+ void setFilterResource(const String& obj)
{
if (!(resources->filter == obj))
resources.access()->filter = obj;
}
- void setMaskerResource(String obj)
+ void setMaskerResource(const String& obj)
{
if (!(resources->masker == obj))
resources.access()->masker = obj;
}
// Setters for inherited resources
- void setMarkerStartResource(String obj)
+ void setMarkerStartResource(const String& obj)
{
if (!(inheritedResources->markerStart == obj))
inheritedResources.access()->markerStart = obj;
}
- void setMarkerMidResource(String obj)
+ void setMarkerMidResource(const String& obj)
{
if (!(inheritedResources->markerMid == obj))
inheritedResources.access()->markerMid = obj;
}
- void setMarkerEndResource(String obj)
+ void setMarkerEndResource(const String& obj)
{
if (!(inheritedResources->markerEnd == obj))
inheritedResources.access()->markerEnd = obj;
@@ -269,17 +292,17 @@ public:
SVGPaint* fillPaint() const { return fill->paint.get(); }
float strokeOpacity() const { return stroke->opacity; }
SVGPaint* strokePaint() const { return stroke->paint.get(); }
- CSSValueList* strokeDashArray() const { return stroke->dashArray.get(); }
+ Vector<SVGLength> strokeDashArray() const { return stroke->dashArray; }
float strokeMiterLimit() const { return stroke->miterLimit; }
- CSSValue* strokeWidth() const { return stroke->width.get(); }
- CSSValue* strokeDashOffset() const { return stroke->dashOffset.get(); }
- CSSValue* kerning() const { return text->kerning.get(); }
+ SVGLength strokeWidth() const { return stroke->width; }
+ SVGLength strokeDashOffset() const { return stroke->dashOffset; }
+ SVGLength kerning() const { return text->kerning; }
float stopOpacity() const { return stops->opacity; }
Color stopColor() const { return stops->color; }
float floodOpacity() const { return misc->floodOpacity; }
Color floodColor() const { return misc->floodColor; }
Color lightingColor() const { return misc->lightingColor; }
- CSSValue* baselineShiftValue() const { return misc->baselineShiftValue.get(); }
+ SVGLength baselineShiftValue() const { return misc->baselineShiftValue; }
ShadowData* shadow() const { return shadowSVG->shadow.get(); }
String clipperResource() const { return resources->clipper; }
String filterResource() const { return resources->filter; }
@@ -296,8 +319,6 @@ public:
bool hasStroke() const { return strokePaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE; }
bool hasFill() const { return fillPaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE; }
- static float cssPrimitiveToLength(const RenderObject*, CSSValue*, float defaultValue = 0.0f);
-
protected:
// inherit
struct InheritedFlags {
diff --git a/WebCore/rendering/style/SVGRenderStyleDefs.cpp b/WebCore/rendering/style/SVGRenderStyleDefs.cpp
index bf7624f..c30ae6d 100644
--- a/WebCore/rendering/style/SVGRenderStyleDefs.cpp
+++ b/WebCore/rendering/style/SVGRenderStyleDefs.cpp
@@ -73,8 +73,8 @@ StyleStrokeData::StyleStrokeData()
, miterLimit(SVGRenderStyle::initialStrokeMiterLimit())
, width(SVGRenderStyle::initialStrokeWidth())
, dashOffset(SVGRenderStyle::initialStrokeDashOffset())
- , paint(SVGRenderStyle::initialStrokePaint())
, dashArray(SVGRenderStyle::initialStrokeDashArray())
+ , paint(SVGRenderStyle::initialStrokePaint())
{
}
@@ -84,8 +84,8 @@ StyleStrokeData::StyleStrokeData(const StyleStrokeData& other)
, miterLimit(other.miterLimit)
, width(other.width)
, dashOffset(other.dashOffset)
- , paint(other.paint)
, dashArray(other.dashArray)
+ , paint(other.paint)
{
}
diff --git a/WebCore/rendering/style/SVGRenderStyleDefs.h b/WebCore/rendering/style/SVGRenderStyleDefs.h
index adb890c..339bb77 100644
--- a/WebCore/rendering/style/SVGRenderStyleDefs.h
+++ b/WebCore/rendering/style/SVGRenderStyleDefs.h
@@ -29,9 +29,9 @@
#define SVGRenderStyleDefs_h
#if ENABLE(SVG)
-
#include "Color.h"
#include "PlatformString.h"
+#include "SVGLength.h"
#include "ShadowData.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
@@ -127,11 +127,11 @@ namespace WebCore {
float opacity;
float miterLimit;
- RefPtr<CSSValue> width;
- RefPtr<CSSValue> dashOffset;
+ SVGLength width;
+ SVGLength dashOffset;
+ Vector<SVGLength> dashArray;
RefPtr<SVGPaint> paint;
- RefPtr<CSSValueList> dashArray;
private:
StyleStrokeData();
@@ -168,7 +168,7 @@ namespace WebCore {
return !(*this == other);
}
- RefPtr<CSSValue> kerning;
+ SVGLength kerning;
private:
StyleTextData();
@@ -192,7 +192,7 @@ namespace WebCore {
Color lightingColor;
// non-inherited text stuff lives here not in StyleTextData.
- RefPtr<CSSValue> baselineShiftValue;
+ SVGLength baselineShiftValue;
private:
StyleMiscData();
diff --git a/WebCore/svg/SVGLength.cpp b/WebCore/svg/SVGLength.cpp
index 2cfc547..d3e16c8 100644
--- a/WebCore/svg/SVGLength.cpp
+++ b/WebCore/svg/SVGLength.cpp
@@ -118,6 +118,23 @@ SVGLength::SVGLength(SVGLengthMode mode, const String& valueAsString)
setValueAsString(valueAsString);
}
+SVGLength::SVGLength(const SVGLength& other)
+ : m_valueInSpecifiedUnits(other.m_valueInSpecifiedUnits)
+ , m_unit(other.m_unit)
+{
+}
+
+bool SVGLength::operator==(const SVGLength& other) const
+{
+ return m_unit == other.m_unit
+ && m_valueInSpecifiedUnits == other.m_valueInSpecifiedUnits;
+}
+
+bool SVGLength::operator!=(const SVGLength& other) const
+{
+ return !operator==(other);
+}
+
SVGLengthType SVGLength::unitType() const
{
return extractType(m_unit);
@@ -319,6 +336,100 @@ float SVGLength::PercentageOfViewport(float value, const SVGElement* context, SV
return 0.0f;
}
+SVGLength SVGLength::fromCSSPrimitiveValue(CSSPrimitiveValue* value)
+{
+ ASSERT(value);
+
+ SVGLengthType svgType;
+ switch (value->primitiveType()) {
+ case CSSPrimitiveValue::CSS_NUMBER:
+ svgType = LengthTypeNumber;
+ break;
+ case CSSPrimitiveValue::CSS_PERCENTAGE:
+ svgType = LengthTypePercentage;
+ break;
+ case CSSPrimitiveValue::CSS_EMS:
+ svgType = LengthTypeEMS;
+ break;
+ case CSSPrimitiveValue::CSS_EXS:
+ svgType = LengthTypeEXS;
+ break;
+ case CSSPrimitiveValue::CSS_PX:
+ svgType = LengthTypePX;
+ break;
+ case CSSPrimitiveValue::CSS_CM:
+ svgType = LengthTypeCM;
+ break;
+ case CSSPrimitiveValue::CSS_MM:
+ svgType = LengthTypeMM;
+ break;
+ case CSSPrimitiveValue::CSS_IN:
+ svgType = LengthTypeIN;
+ break;
+ case CSSPrimitiveValue::CSS_PT:
+ svgType = LengthTypePT;
+ break;
+ case CSSPrimitiveValue::CSS_PC:
+ svgType = LengthTypePC;
+ break;
+ case CSSPrimitiveValue::CSS_UNKNOWN:
+ default:
+ svgType = LengthTypeUnknown;
+ break;
+ };
+
+ if (svgType == LengthTypeUnknown)
+ return SVGLength();
+
+ SVGLength length;
+ length.newValueSpecifiedUnits(svgType, value->getFloatValue());
+ return length;
+}
+
+PassRefPtr<CSSPrimitiveValue> SVGLength::toCSSPrimitiveValue(const SVGLength& length)
+{
+ CSSPrimitiveValue::UnitTypes cssType;
+ switch (length.unitType()) {
+ case LengthTypeUnknown:
+ cssType = CSSPrimitiveValue::CSS_UNKNOWN;
+ break;
+ case LengthTypeNumber:
+ cssType = CSSPrimitiveValue::CSS_NUMBER;
+ break;
+ case LengthTypePercentage:
+ cssType = CSSPrimitiveValue::CSS_PERCENTAGE;
+ break;
+ case LengthTypeEMS:
+ cssType = CSSPrimitiveValue::CSS_EMS;
+ break;
+ case LengthTypeEXS:
+ cssType = CSSPrimitiveValue::CSS_EXS;
+ break;
+ case LengthTypePX:
+ cssType = CSSPrimitiveValue::CSS_PX;
+ break;
+ case LengthTypeCM:
+ cssType = CSSPrimitiveValue::CSS_CM;
+ break;
+ case LengthTypeMM:
+ cssType = CSSPrimitiveValue::CSS_MM;
+ break;
+ case LengthTypeIN:
+ cssType = CSSPrimitiveValue::CSS_IN;
+ break;
+ case LengthTypePT:
+ cssType = CSSPrimitiveValue::CSS_PT;
+ break;
+ case LengthTypePC:
+ cssType = CSSPrimitiveValue::CSS_PC;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ };
+
+ return CSSPrimitiveValue::create(length.valueInSpecifiedUnits(), cssType);
+}
+
}
#endif
diff --git a/WebCore/svg/SVGLength.h b/WebCore/svg/SVGLength.h
index dd9b6fb..a0551f7 100644
--- a/WebCore/svg/SVGLength.h
+++ b/WebCore/svg/SVGLength.h
@@ -26,76 +26,85 @@
namespace WebCore {
- enum SVGLengthType {
- LengthTypeUnknown = 0,
- LengthTypeNumber = 1,
- LengthTypePercentage = 2,
- LengthTypeEMS = 3,
- LengthTypeEXS = 4,
- LengthTypePX = 5,
- LengthTypeCM = 6,
- LengthTypeMM = 7,
- LengthTypeIN = 8,
- LengthTypePT = 9,
- LengthTypePC = 10
+class CSSPrimitiveValue;
+
+enum SVGLengthType {
+ LengthTypeUnknown = 0,
+ LengthTypeNumber = 1,
+ LengthTypePercentage = 2,
+ LengthTypeEMS = 3,
+ LengthTypeEXS = 4,
+ LengthTypePX = 5,
+ LengthTypeCM = 6,
+ LengthTypeMM = 7,
+ LengthTypeIN = 8,
+ LengthTypePT = 9,
+ LengthTypePC = 10
+};
+
+enum SVGLengthMode {
+ LengthModeWidth = 0,
+ LengthModeHeight,
+ LengthModeOther
+};
+
+class SVGElement;
+
+class SVGLength {
+public:
+ // Forward declare these enums in the w3c naming scheme, for IDL generation
+ enum {
+ SVG_LENGTHTYPE_UNKNOWN = LengthTypeUnknown,
+ SVG_LENGTHTYPE_NUMBER = LengthTypeNumber,
+ SVG_LENGTHTYPE_PERCENTAGE = LengthTypePercentage,
+ SVG_LENGTHTYPE_EMS = LengthTypeEMS,
+ SVG_LENGTHTYPE_EXS = LengthTypeEXS,
+ SVG_LENGTHTYPE_PX = LengthTypePX,
+ SVG_LENGTHTYPE_CM = LengthTypeCM,
+ SVG_LENGTHTYPE_MM = LengthTypeMM,
+ SVG_LENGTHTYPE_IN = LengthTypeIN,
+ SVG_LENGTHTYPE_PT = LengthTypePT,
+ SVG_LENGTHTYPE_PC = LengthTypePC
};
- enum SVGLengthMode {
- LengthModeWidth = 0,
- LengthModeHeight,
- LengthModeOther
- };
+ SVGLength(SVGLengthMode mode = LengthModeOther, const String& valueAsString = String());
+ SVGLength(const SVGLength&);
- class SVGElement;
-
- class SVGLength {
- public:
- // Forward declare these enums in the w3c naming scheme, for IDL generation
- enum {
- SVG_LENGTHTYPE_UNKNOWN = LengthTypeUnknown,
- SVG_LENGTHTYPE_NUMBER = LengthTypeNumber,
- SVG_LENGTHTYPE_PERCENTAGE = LengthTypePercentage,
- SVG_LENGTHTYPE_EMS = LengthTypeEMS,
- SVG_LENGTHTYPE_EXS = LengthTypeEXS,
- SVG_LENGTHTYPE_PX = LengthTypePX,
- SVG_LENGTHTYPE_CM = LengthTypeCM,
- SVG_LENGTHTYPE_MM = LengthTypeMM,
- SVG_LENGTHTYPE_IN = LengthTypeIN,
- SVG_LENGTHTYPE_PT = LengthTypePT,
- SVG_LENGTHTYPE_PC = LengthTypePC
- };
-
- SVGLength(SVGLengthMode mode = LengthModeOther, const String& valueAsString = String());
-
- SVGLengthType unitType() const;
-
- float value(const SVGElement* context) const;
- void setValue(float);
-
- float valueInSpecifiedUnits() const;
- void setValueInSpecifiedUnits(float);
-
- float valueAsPercentage() const;
-
- String valueAsString() const;
- bool setValueAsString(const String&);
-
- void newValueSpecifiedUnits(unsigned short, float valueInSpecifiedUnits);
- void convertToSpecifiedUnits(unsigned short, const SVGElement* context);
-
- // Helper functions
- static float PercentageOfViewport(float value, const SVGElement* context, SVGLengthMode);
-
- inline bool isRelative() const
- {
- SVGLengthType type = unitType();
- return (type == LengthTypePercentage || type == LengthTypeEMS || type == LengthTypeEXS);
- }
-
- private:
- float m_valueInSpecifiedUnits;
- unsigned int m_unit;
- };
+ SVGLengthType unitType() const;
+
+ bool operator==(const SVGLength&) const;
+ bool operator!=(const SVGLength&) const;
+
+ float value(const SVGElement* context) const;
+ void setValue(float);
+
+ float valueInSpecifiedUnits() const;
+ void setValueInSpecifiedUnits(float);
+
+ float valueAsPercentage() const;
+
+ String valueAsString() const;
+ bool setValueAsString(const String&);
+
+ void newValueSpecifiedUnits(unsigned short, float valueInSpecifiedUnits);
+ void convertToSpecifiedUnits(unsigned short, const SVGElement* context);
+
+ // Helper functions
+ static float PercentageOfViewport(float value, const SVGElement* context, SVGLengthMode);
+
+ inline bool isRelative() const
+ {
+ SVGLengthType type = unitType();
+ return (type == LengthTypePercentage || type == LengthTypeEMS || type == LengthTypeEXS);
+ }
+
+ static SVGLength fromCSSPrimitiveValue(CSSPrimitiveValue*);
+ static PassRefPtr<CSSPrimitiveValue> toCSSPrimitiveValue(const SVGLength&);
+
+private:
+ float m_valueInSpecifiedUnits;
+ unsigned int m_unit;
+};
} // namespace WebCore
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list