Changeset 64830 in webkit
- Timestamp:
- Aug 6, 2010 4:21:20 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r64828 r64830 1 2010-08-06 Nikolas Zimmermann <nzimmermann@rim.com> 2 3 Reviewed by Dirk Schulze. 4 5 SVG - stroke-width:0 bug with stroke other than "none" 6 https://bugs.webkit.org/show_bug.cgi?id=42387 7 8 * 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. 9 * platform/mac-leopard/svg/W3C-SVG-1.1/animate-elem-40-t-expected.png: Ditto. 10 * platform/mac/fast/css/getComputedStyle/computed-style-expected.txt: kerning reports 0, stroke-dashoffset 0, stroke-width 1 instead of empty values. 11 * platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: Ditto. 12 * 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. 13 * platform/mac/svg/custom/path-zero-strokewidth-expected.checksum: Added. 14 * platform/mac/svg/custom/path-zero-strokewidth-expected.png: Added. 15 * platform/mac/svg/custom/path-zero-strokewidth-expected.txt: Added. 16 * svg/css/getComputedStyle-basic-expected.txt: An empty stroke-dasharray reports "none", as defined in the spec now. 17 * svg/custom/path-zero-strokewidth.svg: Added. 18 1 19 2010-08-05 Marcus Bulach <bulach@chromium.org> 2 20 -
trunk/LayoutTests/platform/mac-leopard/svg/W3C-SVG-1.1/animate-elem-40-t-expected.checksum
r63721 r64830 1 85ddcb5e223a8f0afb4e155b798b782b 1 cc0120156f9e039da3b6643a16557377 -
trunk/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-expected.txt
r60885 r64830 195 195 stroke: none; 196 196 stroke-dasharray: ; 197 stroke-dashoffset: ;197 stroke-dashoffset: 0; 198 198 stroke-linecap: butt; 199 199 stroke-linejoin: miter; 200 200 stroke-miterlimit: 4; 201 201 stroke-opacity: 1; 202 stroke-width: ;202 stroke-width: 1; 203 203 alignment-baseline: auto; 204 204 baseline-shift: baseline; 205 205 dominant-baseline: auto; 206 kerning: ;206 kerning: 0; 207 207 text-anchor: start; 208 208 writing-mode: lr-tb; -
trunk/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
r60885 r64830 194 194 stroke: none 195 195 stroke-dasharray: 196 stroke-dashoffset: 196 stroke-dashoffset: 0 197 197 stroke-linecap: butt 198 198 stroke-linejoin: miter 199 199 stroke-miterlimit: 4 200 200 stroke-opacity: 1 201 stroke-width: 201 stroke-width: 1 202 202 alignment-baseline: auto 203 203 baseline-shift: baseline 204 204 dominant-baseline: auto 205 kerning: 205 kerning: 0 206 206 text-anchor: start 207 207 writing-mode: lr-tb -
trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/animate-elem-40-t-expected.txt
r61393 r64830 152 152 RenderSVGInlineText {#text} at (0,0) size 104x18 153 153 chunk 1 (middle anchor) text run 1 at (-51.50,60.00) startOffset 0 endOffset 16 width 103.00: "x/y on <text>(2)" 154 RenderSVGContainer {g} at (138,168) size 8 2x121 [transform={m=((1.00,0.00)(0.00,1.00)) t=(180.00,210.00)}]154 RenderSVGContainer {g} at (138,168) size 83x121 [transform={m=((1.00,0.00)(0.00,1.00)) t=(180.00,210.00)}] 155 155 RenderSVGImage {image} at (140,170) size 50x50 156 156 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"] 157 RenderPath {rect} at (1 40,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"]158 RenderPath {rect} at (1 40,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"]157 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"] 158 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"] 159 159 RenderSVGText {text} at (-40,46) size 80x18 contains 1 chunk(s) 160 160 RenderSVGInlineText {#text} at (0,0) size 80x18 … … 163 163 RenderSVGInlineText {#text} at (0,0) size 76x18 164 164 chunk 1 (middle anchor) text run 1 at (-38.00,75.00) startOffset 0 endOffset 10 width 76.00: "on <image>" 165 RenderSVGContainer {g} at (258,168) size 8 2x121 [transform={m=((1.00,0.00)(0.00,1.00)) t=(300.00,210.00)}]165 RenderSVGContainer {g} at (258,168) size 83x121 [transform={m=((1.00,0.00)(0.00,1.00)) t=(300.00,210.00)}] 166 166 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"] 167 167 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"] 168 RenderPath {rect} at (2 60,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"]169 RenderPath {rect} at (2 60,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"]168 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"] 169 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"] 170 170 RenderSVGText {text} at (-40,46) size 80x18 contains 1 chunk(s) 171 171 RenderSVGInlineText {#text} at (0,0) size 80x18 -
trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt
r60885 r64830 385 385 rect: style.getPropertyValue(stroke) : #FFA500 386 386 rect: style.getPropertyCSSValue(stroke) : [object SVGPaint] 387 rect: style.getPropertyValue(stroke-dasharray) : 388 rect: style.getPropertyCSSValue(stroke-dasharray) : null389 rect: style.getPropertyValue(stroke-dashoffset) : 390 rect: style.getPropertyCSSValue(stroke-dashoffset) : null387 rect: style.getPropertyValue(stroke-dasharray) : none 388 rect: style.getPropertyCSSValue(stroke-dasharray) : [object CSSPrimitiveValue] 389 rect: style.getPropertyValue(stroke-dashoffset) : 0 390 rect: style.getPropertyCSSValue(stroke-dashoffset) : [object CSSPrimitiveValue] 391 391 rect: style.getPropertyValue(stroke-linecap) : butt 392 392 rect: style.getPropertyCSSValue(stroke-linecap) : [object CSSPrimitiveValue] … … 405 405 rect: style.getPropertyValue(dominant-baseline) : auto 406 406 rect: style.getPropertyCSSValue(dominant-baseline) : [object CSSPrimitiveValue] 407 rect: style.getPropertyValue(kerning) : 408 rect: style.getPropertyCSSValue(kerning) : null407 rect: style.getPropertyValue(kerning) : 0 408 rect: style.getPropertyCSSValue(kerning) : [object CSSPrimitiveValue] 409 409 rect: style.getPropertyValue(text-anchor) : start 410 410 rect: style.getPropertyCSSValue(text-anchor) : [object CSSPrimitiveValue] … … 805 805 g: style.getPropertyValue(stroke) : #FFA500 806 806 g: style.getPropertyCSSValue(stroke) : [object SVGPaint] 807 g: style.getPropertyValue(stroke-dasharray) : 808 g: style.getPropertyCSSValue(stroke-dasharray) : null809 g: style.getPropertyValue(stroke-dashoffset) : 810 g: style.getPropertyCSSValue(stroke-dashoffset) : null807 g: style.getPropertyValue(stroke-dasharray) : none 808 g: style.getPropertyCSSValue(stroke-dasharray) : [object CSSPrimitiveValue] 809 g: style.getPropertyValue(stroke-dashoffset) : 0 810 g: style.getPropertyCSSValue(stroke-dashoffset) : [object CSSPrimitiveValue] 811 811 g: style.getPropertyValue(stroke-linecap) : butt 812 812 g: style.getPropertyCSSValue(stroke-linecap) : [object CSSPrimitiveValue] … … 825 825 g: style.getPropertyValue(dominant-baseline) : auto 826 826 g: style.getPropertyCSSValue(dominant-baseline) : [object CSSPrimitiveValue] 827 g: style.getPropertyValue(kerning) : 828 g: style.getPropertyCSSValue(kerning) : null827 g: style.getPropertyValue(kerning) : 0 828 g: style.getPropertyCSSValue(kerning) : [object CSSPrimitiveValue] 829 829 g: style.getPropertyValue(text-anchor) : start 830 830 g: style.getPropertyCSSValue(text-anchor) : [object CSSPrimitiveValue] -
trunk/WebCore/ChangeLog
r64829 r64830 1 2010-08-06 Nikolas Zimmermann <nzimmermann@rim.com> 2 3 Reviewed by Dirk Schulze. 4 5 SVG - stroke-width:0 bug with stroke other than "none" 6 https://bugs.webkit.org/show_bug.cgi?id=42387 7 8 Stop storing refcounted CSSValue/CSSValueList objects in SVGRenderStyle, replacing them with SVGLength types. 9 Allows us to directly specify default values for stroke-dashoffset/width in the SVGRenderStyle, fixing a problem 10 with stroke-width animations when resetting to the original stored baseVal, exposed in svg/W3C-1.1/animate-elem-40-t.svg 11 Originally discovered by Fady Samuel. 12 13 Test: svg/custom/path-zero-strokewidth.svg 14 15 * css/SVGCSSComputedStyleDeclaration.cpp: 16 (WebCore::strokeDashArrayToCSSValueList): New helper function converting from Vector<SVGLength> to CSSValueList. 17 (WebCore::CSSComputedStyleDeclaration::getSVGPropertyCSSValue): Convert SVGLength values to CSSPrimitiveValues. 18 * css/SVGCSSStyleSelector.cpp: 19 (WebCore::CSSStyleSelector::applySVGProperty): Convert CSSPrimitiveValues to SVGLength objects, for SVGRenderStyle storage. 20 * rendering/RenderPath.cpp: 21 (WebCore::RenderPath::calculateMarkerBoundsIfNeeded): Just grab strokeWidth SVGLength value from SVGRenderSTyle, no need to call cssPrimitiveToLength anymore. 22 * rendering/RenderSVGText.cpp: 23 (WebCore::RenderSVGText::strokeBoundingBox): Ditto. 24 * rendering/SVGCharacterLayoutInfo.cpp: 25 (WebCore::calculateBaselineShift): Ditto (for baseline-shift). 26 * rendering/SVGInlineTextBox.cpp: 27 (WebCore::SVGInlineTextBox::buildLayoutInformation): Ditto (for kerning). 28 * rendering/SVGRenderSupport.cpp: 29 (WebCore::SVGRenderSupport::applyStrokeStyleToContext): Ditto (for stroke-width/stroke-dashoffset/stroke-dasharray). 30 * rendering/SVGRenderSupport.h: 31 * rendering/SVGRenderTreeAsText.cpp: 32 (WebCore::writeStyle): Ditto. 33 * rendering/SVGTextLayoutUtilities.cpp: 34 (WebCore::calculateCSSKerning): Ditto. 35 * rendering/SVGTextLayoutUtilities.h: 36 * rendering/style/SVGRenderStyle.cpp: Remove no longer needed cssPrimitiveToLength function. 37 * rendering/style/SVGRenderStyle.h: Stop storing RefPtr<CSSValue> / RefPtr<CSSValueList> but use SVGLength/Vector<SVGLength>. 38 (WebCore::SVGRenderStyle::initialStrokeDashArray): Allows us to specify correct default values, instead of null pointers. 39 (WebCore::SVGRenderStyle::initialBaselineShiftValue): Specify 0px default value. 40 (WebCore::SVGRenderStyle::initialKerning): Ditto. 41 (WebCore::SVGRenderStyle::initialStrokeDashOffset): Ditto. 42 (WebCore::SVGRenderStyle::initialStrokeWidth): Specify 1px default value. 43 (WebCore::SVGRenderStyle::setStrokeDashArray): Takes a Vector<SVGLength> now, not a PassRefPtr<CSSValueList>. 44 (WebCore::SVGRenderStyle::setStrokeWidth): Takes a SVGLength now, not a PassRefPtr<CSSValue>. 45 (WebCore::SVGRenderStyle::setStrokeDashOffset): Ditto. 46 (WebCore::SVGRenderStyle::setKerning): Ditto. 47 (WebCore::SVGRenderStyle::setStopColor): Pass Color as const-reference. 48 (WebCore::SVGRenderStyle::setFloodColor): Ditto. 49 (WebCore::SVGRenderStyle::setLightingColor): Ditto. 50 (WebCore::SVGRenderStyle::setBaselineShiftValue): Takes a SVGLength now, not a PassRefPtr<CSSValue>. 51 (WebCore::SVGRenderStyle::setShadow): Reformat, had wrong style. 52 (WebCore::SVGRenderStyle::setClipperResource): Pass String as const-reference. 53 (WebCore::SVGRenderStyle::setFilterResource): Ditto. 54 (WebCore::SVGRenderStyle::setMaskerResource): Ditto. 55 (WebCore::SVGRenderStyle::setMarkerStartResource): Ditto. 56 (WebCore::SVGRenderStyle::setMarkerMidResource): Ditto. 57 (WebCore::SVGRenderStyle::setMarkerEndResource): Ditto. 58 (WebCore::SVGRenderStyle::strokeDashArray): Return Vector<SVGLength>. 59 (WebCore::SVGRenderStyle::strokeWidth): Return SVGLength. 60 (WebCore::SVGRenderStyle::strokeDashOffset): Ditto. 61 (WebCore::SVGRenderStyle::kerning): Ditto. 62 (WebCore::SVGRenderStyle::baselineShiftValue): Ditto. 63 * rendering/style/SVGRenderStyleDefs.cpp: 64 (WebCore::StyleStrokeData::StyleStrokeData): Changed initialization order, to group stroke properties. 65 * rendering/style/SVGRenderStyleDefs.h: Store SVGLength values instead of reference counted CSS objects. 66 * svg/SVGLength.cpp: 67 (WebCore::SVGLength::SVGLength): Add copy constructor. 68 (WebCore::SVGLength::operator==): Add comparision operator. 69 (WebCore::SVGLength::operator!=): Ditto. 70 (WebCore::SVGLength::fromCSSPrimitiveValue): New static helper function to convert from a CSSPrimitiveValue. 71 (WebCore::SVGLength::toCSSPrimitiveValue): New static helper function to convert to a CSSPrimitiveValue. 72 * svg/SVGLength.h: Reindent. 73 1 74 2010-08-06 Luiz Agostini <luiz.agostini@openbossa.org> 2 75 -
trunk/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
r60885 r64830 45 45 return 0; 46 46 } 47 } 48 49 static PassRefPtr<CSSValue> strokeDashArrayToCSSValueList(const Vector<SVGLength>& dashes) 50 { 51 if (dashes.isEmpty()) 52 return CSSPrimitiveValue::createIdentifier(CSSValueNone); 53 54 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); 55 const Vector<SVGLength>::const_iterator end = dashes.end(); 56 for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it) 57 list->append(SVGLength::toCSSPrimitiveValue(*it)); 58 59 return list.release(); 47 60 } 48 61 … … 123 136 return svgStyle->fillPaint(); 124 137 case CSSPropertyKerning: 125 return svgStyle->kerning();138 return SVGLength::toCSSPrimitiveValue(svgStyle->kerning()); 126 139 case CSSPropertyMarkerEnd: 127 140 if (!svgStyle->markerEndResource().isEmpty()) … … 139 152 return svgStyle->strokePaint(); 140 153 case CSSPropertyStrokeDasharray: 141 return s vgStyle->strokeDashArray();154 return strokeDashArrayToCSSValueList(svgStyle->strokeDashArray()); 142 155 case CSSPropertyStrokeDashoffset: 143 return svgStyle->strokeDashOffset();156 return SVGLength::toCSSPrimitiveValue(svgStyle->strokeDashOffset()); 144 157 case CSSPropertyStrokeWidth: 145 return svgStyle->strokeWidth();158 return SVGLength::toCSSPrimitiveValue(svgStyle->strokeWidth()); 146 159 case CSSPropertyBaselineShift: { 147 160 switch (svgStyle->baselineShift()) { … … 153 166 return CSSPrimitiveValue::createIdentifier(CSSValueSub); 154 167 case BS_LENGTH: 155 return svgStyle->baselineShiftValue();168 return SVGLength::toCSSPrimitiveValue(svgStyle->baselineShiftValue()); 156 169 } 157 170 } -
trunk/WebCore/css/SVGCSSStyleSelector.cpp
r60885 r64830 154 154 } else { 155 155 svgstyle->setBaselineShift(BS_LENGTH); 156 svgstyle->setBaselineShiftValue( primitiveValue);156 svgstyle->setBaselineShiftValue(SVGLength::fromCSSPrimitiveValue(primitiveValue)); 157 157 } 158 158 … … 162 162 { 163 163 HANDLE_INHERIT_AND_INITIAL(kerning, Kerning); 164 svgstyle->setKerning( primitiveValue);164 svgstyle->setKerning(SVGLength::fromCSSPrimitiveValue(primitiveValue)); 165 165 break; 166 166 } … … 248 248 HANDLE_INHERIT_AND_INITIAL(strokeWidth, StrokeWidth) 249 249 if (primitiveValue) 250 svgstyle->setStrokeWidth( primitiveValue);250 svgstyle->setStrokeWidth(SVGLength::fromCSSPrimitiveValue(primitiveValue)); 251 251 break; 252 252 } … … 254 254 { 255 255 HANDLE_INHERIT_AND_INITIAL(strokeDashArray, StrokeDashArray) 256 if (value->isValueList()) 257 svgstyle->setStrokeDashArray(static_cast<CSSValueList*>(value)); 256 if (!value->isValueList()) 257 break; 258 259 CSSValueList* dashes = static_cast<CSSValueList*>(value); 260 261 Vector<SVGLength> array; 262 size_t length = dashes->length(); 263 for (size_t i = 0; i < length; ++i) { 264 CSSPrimitiveValue* dash = static_cast<CSSPrimitiveValue*>(dashes->itemWithoutBoundsCheck(i)); 265 if (!dash) 266 continue; 267 268 array.append(SVGLength::fromCSSPrimitiveValue(dash)); 269 } 270 271 svgstyle->setStrokeDashArray(array); 258 272 break; 259 273 } … … 262 276 HANDLE_INHERIT_AND_INITIAL(strokeDashOffset, StrokeDashOffset) 263 277 if (primitiveValue) 264 svgstyle->setStrokeDashOffset( primitiveValue);278 svgstyle->setStrokeDashOffset(SVGLength::fromCSSPrimitiveValue(primitiveValue)); 265 279 break; 266 280 } -
trunk/WebCore/rendering/RenderPath.cpp
r64275 r64830 258 258 return FloatRect(); 259 259 260 float strokeWidth = SVGRenderStyle::cssPrimitiveToLength(this, svgStyle->strokeWidth(), 1.0f); 261 return m_markerLayoutInfo.calculateBoundaries(markerStart, markerMid, markerEnd, strokeWidth, m_path); 260 return m_markerLayoutInfo.calculateBoundaries(markerStart, markerMid, markerEnd, svgStyle->strokeWidth().value(svgElement), m_path); 262 261 } 263 262 -
trunk/WebCore/rendering/RenderSVGText.cpp
r64275 r64830 164 164 { 165 165 FloatRect strokeBoundaries = objectBoundingBox(); 166 if (!style()->svgStyle()->hasStroke()) 166 const SVGRenderStyle* svgStyle = style()->svgStyle(); 167 if (!svgStyle->hasStroke()) 167 168 return strokeBoundaries; 168 169 169 strokeBoundaries.inflate(SVGRenderStyle::cssPrimitiveToLength(this, style()->svgStyle()->strokeWidth(), 1.0f)); 170 ASSERT(node()); 171 ASSERT(node()->isSVGElement()); 172 strokeBoundaries.inflate(svgStyle->strokeWidth().value(static_cast<SVGElement*>(node()))); 170 173 return strokeBoundaries; 171 174 } -
trunk/WebCore/rendering/SVGCharacterLayoutInfo.cpp
r61393 r64830 38 38 static float calculateBaselineShift(RenderObject* item) 39 39 { 40 ASSERT(item); 41 ASSERT(item->style()); 42 ASSERT(item->node()); 43 ASSERT(item->node()->isSVGElement()); 44 40 45 const Font& font = item->style()->font(); 41 46 const SVGRenderStyle* svgStyle = item->style()->svgStyle(); … … 43 48 float baselineShift = 0.0f; 44 49 if (svgStyle->baselineShift() == BS_LENGTH) { 45 CSSPrimitiveValue* primitive = static_cast<CSSPrimitiveValue*>(svgStyle->baselineShiftValue());46 baselineShift = primitive->getFloatValue();47 48 if (primitive->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)49 baselineShift = baselineShift / 100.0f * font.pixelSize();50 SVGLength baselineShiftValueLength = svgStyle->baselineShiftValue(); 51 if (baselineShiftValueLength.unitType() == LengthTypePercentage) 52 baselineShift = baselineShiftValueLength.valueAsPercentage() * font.pixelSize(); 53 else 54 baselineShift = baselineShiftValueLength.value(static_cast<SVGElement*>(item->node())); 50 55 } else { 51 56 float baselineAscent = font.ascent() + font.descent(); -
trunk/WebCore/rendering/SVGInlineTextBox.cpp
r64275 r64830 639 639 ASSERT(style); 640 640 641 RenderObject* parentRenderer = parent()->renderer(); 642 ASSERT(parentRenderer); 643 ASSERT(parentRenderer->node()); 644 ASSERT(parentRenderer->node()->isSVGElement()); 645 SVGElement* lengthContext = static_cast<SVGElement*>(parentRenderer->node()); 646 641 647 const Font& font = style->font(); 642 648 const UChar* characters = textRenderer->characters(); … … 710 716 711 717 // Take letter & word spacing and kerning into account 712 float spacing = font.letterSpacing() + calculateCSSKerning( style);718 float spacing = font.letterSpacing() + calculateCSSKerning(lengthContext, style); 713 719 714 720 const UChar* currentCharacter = characters + (textDirection == RTL ? endPosition - i : startPosition + i); -
trunk/WebCore/rendering/SVGRenderSupport.cpp
r64277 r64830 321 321 } 322 322 323 DashArray SVGRenderSupport::dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle)324 {325 DashArray array;326 327 CSSValueList* dashes = style->svgStyle()->strokeDashArray();328 if (!dashes)329 return array;330 331 CSSPrimitiveValue* dash = 0;332 unsigned long len = dashes->length();333 for (unsigned long i = 0; i < len; ++i) {334 dash = static_cast<CSSPrimitiveValue*>(dashes->itemWithoutBoundsCheck(i));335 if (!dash)336 continue;337 338 array.append(dash->computeLengthFloat(const_cast<RenderStyle*>(style), rootStyle));339 }340 341 return array;342 }343 344 323 void SVGRenderSupport::applyStrokeStyleToContext(GraphicsContext* context, const RenderStyle* style, const RenderObject* object) 345 324 { 346 context->setStrokeThickness(SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeWidth(), 1.0f)); 347 context->setLineCap(style->svgStyle()->capStyle()); 348 context->setLineJoin(style->svgStyle()->joinStyle()); 349 if (style->svgStyle()->joinStyle() == MiterJoin) 350 context->setMiterLimit(style->svgStyle()->strokeMiterLimit()); 351 352 const DashArray& dashes = dashArrayFromRenderingStyle(object->style(), object->document()->documentElement()->renderStyle()); 353 float dashOffset = SVGRenderStyle::cssPrimitiveToLength(object, style->svgStyle()->strokeDashOffset(), 0.0f); 325 ASSERT(context); 326 ASSERT(style); 327 ASSERT(object); 328 ASSERT(object->node()); 329 ASSERT(object->node()->isSVGElement()); 330 331 const SVGRenderStyle* svgStyle = style->svgStyle(); 332 ASSERT(svgStyle); 333 334 SVGElement* lengthContext = static_cast<SVGElement*>(object->node()); 335 context->setStrokeThickness(svgStyle->strokeWidth().value(lengthContext)); 336 context->setLineCap(svgStyle->capStyle()); 337 context->setLineJoin(svgStyle->joinStyle()); 338 if (svgStyle->joinStyle() == MiterJoin) 339 context->setMiterLimit(svgStyle->strokeMiterLimit()); 340 341 const Vector<SVGLength>& dashes = svgStyle->strokeDashArray(); 354 342 if (dashes.isEmpty()) 355 343 context->setStrokeStyle(SolidStroke); 356 else 357 context->setLineDash(dashes, dashOffset); 344 else { 345 DashArray dashArray; 346 const Vector<SVGLength>::const_iterator end = dashes.end(); 347 for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it) 348 dashArray.append((*it).value(lengthContext)); 349 350 context->setLineDash(dashArray, svgStyle->strokeDashOffset().value(lengthContext)); 351 } 358 352 } 359 353 -
trunk/WebCore/rendering/SVGRenderSupport.h
r64275 r64830 27 27 28 28 #if ENABLE(SVG) 29 #include "DashArray.h"30 29 #include "PaintInfo.h" 31 30 … … 82 81 // FIXME: These methods do not belong here. 83 82 static const RenderObject* findTextRootObject(const RenderObject* start); 84 static DashArray dashArrayFromRenderingStyle(const RenderStyle* style, RenderStyle* rootStyle);85 83 86 84 private: -
trunk/WebCore/rendering/SVGRenderTreeAsText.cpp
r64275 r64830 366 366 if (object.isRenderPath()) { 367 367 const RenderPath& path = static_cast<const RenderPath&>(object); 368 ASSERT(path.node()); 369 ASSERT(path.node()->isSVGElement()); 368 370 369 371 if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(const_cast<RenderPath*>(&path), path.style())) { … … 372 374 writeSVGPaintingResource(ts, strokePaintingResource); 373 375 374 double dashOffset = SVGRenderStyle::cssPrimitiveToLength(&path, svgStyle->strokeDashOffset(), 0.0f); 375 const DashArray& dashArray = SVGRenderSupport::dashArrayFromRenderingStyle(style, object.document()->documentElement()->renderStyle()); 376 double strokeWidth = SVGRenderStyle::cssPrimitiveToLength(&path, svgStyle->strokeWidth(), 1.0f); 376 SVGElement* element = static_cast<SVGElement*>(path.node()); 377 double dashOffset = svgStyle->strokeDashOffset().value(element); 378 double strokeWidth = svgStyle->strokeWidth().value(element); 379 const Vector<SVGLength>& dashes = svgStyle->strokeDashArray(); 380 381 DashArray dashArray; 382 const Vector<SVGLength>::const_iterator end = dashes.end(); 383 for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it) 384 dashArray.append((*it).value(element)); 377 385 378 386 writeIfNotDefault(ts, "opacity", svgStyle->strokeOpacity(), 1.0f); -
trunk/WebCore/rendering/SVGTextLayoutUtilities.cpp
r61393 r64830 316 316 } 317 317 318 float calculateCSSKerning( const RenderStyle* style)318 float calculateCSSKerning(SVGElement* context, const RenderStyle* style) 319 319 { 320 320 const Font& font = style->font(); 321 321 const SVGRenderStyle* svgStyle = style->svgStyle(); 322 322 323 float kerning = 0.0f; 324 if (CSSPrimitiveValue* primitive = static_cast<CSSPrimitiveValue*>(svgStyle->kerning())) { 325 kerning = primitive->getFloatValue(); 326 327 if (primitive->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE && font.pixelSize()) 328 kerning = kerning / 100.0f * font.pixelSize(); 329 } 330 331 return kerning; 323 SVGLength kerningLength = svgStyle->kerning(); 324 if (kerningLength.unitType() == LengthTypePercentage) 325 return kerningLength.valueAsPercentage() * font.pixelSize(); 326 327 return kerningLength.value(context); 332 328 } 333 329 -
trunk/WebCore/rendering/SVGTextLayoutUtilities.h
r61393 r64830 33 33 class RenderObject; 34 34 class RenderStyle; 35 class SVGElement; 35 36 class SVGRenderStyle; 36 37 class TextRun; … … 61 62 TextRun svgTextRunForInlineTextBox(const UChar*, int length, const RenderStyle*, const InlineTextBox*); 62 63 63 float calculateCSSKerning( const RenderStyle*);64 float calculateCSSKerning(SVGElement* context, const RenderStyle*); 64 65 bool applySVGKerning(SVGCharacterLayoutInfo&, const RenderStyle*, SVGLastGlyphInfo&, const String& unicodeString, const String& glyphName, bool isVerticalText); 65 66 -
trunk/WebCore/rendering/style/SVGRenderStyle.cpp
r64275 r64830 212 212 } 213 213 214 float SVGRenderStyle::cssPrimitiveToLength(const RenderObject* item, CSSValue* value, float defaultValue)215 {216 CSSPrimitiveValue* primitive = static_cast<CSSPrimitiveValue*>(value);217 218 unsigned short cssType = (primitive ? primitive->primitiveType() : (unsigned short) CSSPrimitiveValue::CSS_UNKNOWN);219 if (!(cssType > CSSPrimitiveValue::CSS_UNKNOWN && cssType <= CSSPrimitiveValue::CSS_PC))220 return defaultValue;221 222 if (cssType == CSSPrimitiveValue::CSS_PERCENTAGE) {223 SVGStyledElement* element = static_cast<SVGStyledElement*>(item->node());224 SVGElement* viewportElement = (element ? element->viewportElement() : 0);225 if (viewportElement) {226 float result = primitive->getFloatValue() / 100.0f;227 return SVGLength::PercentageOfViewport(result, element, LengthModeOther);228 }229 }230 231 return primitive->computeLengthFloat(const_cast<RenderStyle*>(item->style()), item->document()->documentElement()->renderStyle());232 }233 234 214 static void getSVGShadowExtent(ShadowData* shadow, float& top, float& right, float& bottom, float& left) 235 215 { -
trunk/WebCore/rendering/style/SVGRenderStyle.h
r64367 r64830 79 79 static float initialStrokeOpacity() { return 1.0f; } 80 80 static SVGPaint* initialStrokePaint() { return SVGPaint::defaultStroke(); } 81 static CSSValueList* initialStrokeDashArray() { return 0; }81 static Vector<SVGLength> initialStrokeDashArray() { return Vector<SVGLength>(); } 82 82 static float initialStrokeMiterLimit() { return 4.0f; } 83 static CSSValue* initialStrokeWidth() { return 0; }84 static CSSValue* initialStrokeDashOffset() { return 0; };85 static CSSValue* initialKerning() { return 0; }86 83 static float initialStopOpacity() { return 1.0f; } 87 84 static Color initialStopColor() { return Color(0, 0, 0); } … … 89 86 static Color initialFloodColor() { return Color(0, 0, 0); } 90 87 static Color initialLightingColor() { return Color(255, 255, 255); } 91 static CSSValue* initialBaselineShiftValue() { return 0; }92 88 static ShadowData* initialShadow() { return 0; } 93 89 static String initialClipperResource() { return String(); } … … 97 93 static String initialMarkerMidResource() { return String(); } 98 94 static String initialMarkerEndResource() { return String(); } 95 96 static SVGLength initialBaselineShiftValue() 97 { 98 SVGLength length; 99 length.newValueSpecifiedUnits(LengthTypeNumber, 0); 100 return length; 101 } 102 103 static SVGLength initialKerning() 104 { 105 SVGLength length; 106 length.newValueSpecifiedUnits(LengthTypeNumber, 0); 107 return length; 108 } 109 110 static SVGLength initialStrokeDashOffset() 111 { 112 SVGLength length; 113 length.newValueSpecifiedUnits(LengthTypeNumber, 0); 114 return length; 115 } 116 117 static SVGLength initialStrokeWidth() 118 { 119 SVGLength length; 120 length.newValueSpecifiedUnits(LengthTypeNumber, 1); 121 return length; 122 } 99 123 100 124 // SVG CSS Property setters … … 141 165 } 142 166 143 void setStrokeDashArray( PassRefPtr<CSSValueList>obj)167 void setStrokeDashArray(const Vector<SVGLength>& obj) 144 168 { 145 169 if (!(stroke->dashArray == obj)) … … 153 177 } 154 178 155 void setStrokeWidth( PassRefPtr<CSSValue>obj)179 void setStrokeWidth(const SVGLength& obj) 156 180 { 157 181 if (!(stroke->width == obj)) … … 159 183 } 160 184 161 void setStrokeDashOffset( PassRefPtr<CSSValue>obj)185 void setStrokeDashOffset(const SVGLength& obj) 162 186 { 163 187 if (!(stroke->dashOffset == obj)) … … 165 189 } 166 190 167 void setKerning( PassRefPtr<CSSValue>obj)191 void setKerning(const SVGLength& obj) 168 192 { 169 193 if (!(text->kerning == obj)) … … 177 201 } 178 202 179 void setStopColor( Colorobj)203 void setStopColor(const Color& obj) 180 204 { 181 205 if (!(stops->color == obj)) … … 189 213 } 190 214 191 void setFloodColor( Colorobj)215 void setFloodColor(const Color& obj) 192 216 { 193 217 if (!(misc->floodColor == obj)) … … 195 219 } 196 220 197 void setLightingColor( Colorobj)221 void setLightingColor(const Color& obj) 198 222 { 199 223 if (!(misc->lightingColor == obj)) … … 201 225 } 202 226 203 void setBaselineShiftValue( PassRefPtr<CSSValue>obj)227 void setBaselineShiftValue(const SVGLength& obj) 204 228 { 205 229 if (!(misc->baselineShiftValue == obj)) … … 207 231 } 208 232 209 void setShadow(PassOwnPtr<ShadowData> obj) { shadowSVG.access()->shadow = obj; 210 } 233 void setShadow(PassOwnPtr<ShadowData> obj) { shadowSVG.access()->shadow = obj; } 211 234 212 235 // Setters for non-inherited resources 213 void setClipperResource( Stringobj)236 void setClipperResource(const String& obj) 214 237 { 215 238 if (!(resources->clipper == obj)) … … 217 240 } 218 241 219 void setFilterResource( Stringobj)242 void setFilterResource(const String& obj) 220 243 { 221 244 if (!(resources->filter == obj)) … … 223 246 } 224 247 225 void setMaskerResource( Stringobj)248 void setMaskerResource(const String& obj) 226 249 { 227 250 if (!(resources->masker == obj)) … … 230 253 231 254 // Setters for inherited resources 232 void setMarkerStartResource( Stringobj)255 void setMarkerStartResource(const String& obj) 233 256 { 234 257 if (!(inheritedResources->markerStart == obj)) … … 236 259 } 237 260 238 void setMarkerMidResource( Stringobj)261 void setMarkerMidResource(const String& obj) 239 262 { 240 263 if (!(inheritedResources->markerMid == obj)) … … 242 265 } 243 266 244 void setMarkerEndResource( Stringobj)267 void setMarkerEndResource(const String& obj) 245 268 { 246 269 if (!(inheritedResources->markerEnd == obj)) … … 270 293 float strokeOpacity() const { return stroke->opacity; } 271 294 SVGPaint* strokePaint() const { return stroke->paint.get(); } 272 CSSValueList* strokeDashArray() const { return stroke->dashArray.get(); }295 Vector<SVGLength> strokeDashArray() const { return stroke->dashArray; } 273 296 float strokeMiterLimit() const { return stroke->miterLimit; } 274 CSSValue* strokeWidth() const { return stroke->width.get(); }275 CSSValue* strokeDashOffset() const { return stroke->dashOffset.get(); }276 CSSValue* kerning() const { return text->kerning.get(); }297 SVGLength strokeWidth() const { return stroke->width; } 298 SVGLength strokeDashOffset() const { return stroke->dashOffset; } 299 SVGLength kerning() const { return text->kerning; } 277 300 float stopOpacity() const { return stops->opacity; } 278 301 Color stopColor() const { return stops->color; } … … 280 303 Color floodColor() const { return misc->floodColor; } 281 304 Color lightingColor() const { return misc->lightingColor; } 282 CSSValue* baselineShiftValue() const { return misc->baselineShiftValue.get(); }305 SVGLength baselineShiftValue() const { return misc->baselineShiftValue; } 283 306 ShadowData* shadow() const { return shadowSVG->shadow.get(); } 284 307 String clipperResource() const { return resources->clipper; } … … 296 319 bool hasStroke() const { return strokePaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE; } 297 320 bool hasFill() const { return fillPaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE; } 298 299 static float cssPrimitiveToLength(const RenderObject*, CSSValue*, float defaultValue = 0.0f);300 321 301 322 protected: -
trunk/WebCore/rendering/style/SVGRenderStyleDefs.cpp
r57575 r64830 74 74 , width(SVGRenderStyle::initialStrokeWidth()) 75 75 , dashOffset(SVGRenderStyle::initialStrokeDashOffset()) 76 , dashArray(SVGRenderStyle::initialStrokeDashArray()) 76 77 , paint(SVGRenderStyle::initialStrokePaint()) 77 , dashArray(SVGRenderStyle::initialStrokeDashArray())78 78 { 79 79 } … … 85 85 , width(other.width) 86 86 , dashOffset(other.dashOffset) 87 , dashArray(other.dashArray) 87 88 , paint(other.paint) 88 , dashArray(other.dashArray)89 89 { 90 90 } -
trunk/WebCore/rendering/style/SVGRenderStyleDefs.h
r64367 r64830 30 30 31 31 #if ENABLE(SVG) 32 33 32 #include "Color.h" 34 33 #include "PlatformString.h" 34 #include "SVGLength.h" 35 35 #include "ShadowData.h" 36 36 #include <wtf/OwnPtr.h> … … 128 128 float miterLimit; 129 129 130 RefPtr<CSSValue> width; 131 RefPtr<CSSValue> dashOffset; 130 SVGLength width; 131 SVGLength dashOffset; 132 Vector<SVGLength> dashArray; 132 133 133 134 RefPtr<SVGPaint> paint; 134 RefPtr<CSSValueList> dashArray;135 135 136 136 private: … … 169 169 } 170 170 171 RefPtr<CSSValue>kerning;171 SVGLength kerning; 172 172 173 173 private: … … 193 193 194 194 // non-inherited text stuff lives here not in StyleTextData. 195 RefPtr<CSSValue>baselineShiftValue;195 SVGLength baselineShiftValue; 196 196 197 197 private: -
trunk/WebCore/svg/SVGLength.cpp
r64579 r64830 117 117 { 118 118 setValueAsString(valueAsString); 119 } 120 121 SVGLength::SVGLength(const SVGLength& other) 122 : m_valueInSpecifiedUnits(other.m_valueInSpecifiedUnits) 123 , m_unit(other.m_unit) 124 { 125 } 126 127 bool SVGLength::operator==(const SVGLength& other) const 128 { 129 return m_unit == other.m_unit 130 && m_valueInSpecifiedUnits == other.m_valueInSpecifiedUnits; 131 } 132 133 bool SVGLength::operator!=(const SVGLength& other) const 134 { 135 return !operator==(other); 119 136 } 120 137 … … 320 337 } 321 338 339 SVGLength SVGLength::fromCSSPrimitiveValue(CSSPrimitiveValue* value) 340 { 341 ASSERT(value); 342 343 SVGLengthType svgType; 344 switch (value->primitiveType()) { 345 case CSSPrimitiveValue::CSS_NUMBER: 346 svgType = LengthTypeNumber; 347 break; 348 case CSSPrimitiveValue::CSS_PERCENTAGE: 349 svgType = LengthTypePercentage; 350 break; 351 case CSSPrimitiveValue::CSS_EMS: 352 svgType = LengthTypeEMS; 353 break; 354 case CSSPrimitiveValue::CSS_EXS: 355 svgType = LengthTypeEXS; 356 break; 357 case CSSPrimitiveValue::CSS_PX: 358 svgType = LengthTypePX; 359 break; 360 case CSSPrimitiveValue::CSS_CM: 361 svgType = LengthTypeCM; 362 break; 363 case CSSPrimitiveValue::CSS_MM: 364 svgType = LengthTypeMM; 365 break; 366 case CSSPrimitiveValue::CSS_IN: 367 svgType = LengthTypeIN; 368 break; 369 case CSSPrimitiveValue::CSS_PT: 370 svgType = LengthTypePT; 371 break; 372 case CSSPrimitiveValue::CSS_PC: 373 svgType = LengthTypePC; 374 break; 375 case CSSPrimitiveValue::CSS_UNKNOWN: 376 default: 377 svgType = LengthTypeUnknown; 378 break; 379 }; 380 381 if (svgType == LengthTypeUnknown) 382 return SVGLength(); 383 384 SVGLength length; 385 length.newValueSpecifiedUnits(svgType, value->getFloatValue()); 386 return length; 387 } 388 389 PassRefPtr<CSSPrimitiveValue> SVGLength::toCSSPrimitiveValue(const SVGLength& length) 390 { 391 CSSPrimitiveValue::UnitTypes cssType; 392 switch (length.unitType()) { 393 case LengthTypeUnknown: 394 cssType = CSSPrimitiveValue::CSS_UNKNOWN; 395 break; 396 case LengthTypeNumber: 397 cssType = CSSPrimitiveValue::CSS_NUMBER; 398 break; 399 case LengthTypePercentage: 400 cssType = CSSPrimitiveValue::CSS_PERCENTAGE; 401 break; 402 case LengthTypeEMS: 403 cssType = CSSPrimitiveValue::CSS_EMS; 404 break; 405 case LengthTypeEXS: 406 cssType = CSSPrimitiveValue::CSS_EXS; 407 break; 408 case LengthTypePX: 409 cssType = CSSPrimitiveValue::CSS_PX; 410 break; 411 case LengthTypeCM: 412 cssType = CSSPrimitiveValue::CSS_CM; 413 break; 414 case LengthTypeMM: 415 cssType = CSSPrimitiveValue::CSS_MM; 416 break; 417 case LengthTypeIN: 418 cssType = CSSPrimitiveValue::CSS_IN; 419 break; 420 case LengthTypePT: 421 cssType = CSSPrimitiveValue::CSS_PT; 422 break; 423 case LengthTypePC: 424 cssType = CSSPrimitiveValue::CSS_PC; 425 break; 426 default: 427 ASSERT_NOT_REACHED(); 428 }; 429 430 return CSSPrimitiveValue::create(length.valueInSpecifiedUnits(), cssType); 431 } 432 322 433 } 323 434 -
trunk/WebCore/svg/SVGLength.h
r64579 r64830 27 27 namespace WebCore { 28 28 29 enum SVGLengthType { 30 LengthTypeUnknown = 0, 31 LengthTypeNumber = 1, 32 LengthTypePercentage = 2, 33 LengthTypeEMS = 3, 34 LengthTypeEXS = 4, 35 LengthTypePX = 5, 36 LengthTypeCM = 6, 37 LengthTypeMM = 7, 38 LengthTypeIN = 8, 39 LengthTypePT = 9, 40 LengthTypePC = 10 29 class CSSPrimitiveValue; 30 31 enum SVGLengthType { 32 LengthTypeUnknown = 0, 33 LengthTypeNumber = 1, 34 LengthTypePercentage = 2, 35 LengthTypeEMS = 3, 36 LengthTypeEXS = 4, 37 LengthTypePX = 5, 38 LengthTypeCM = 6, 39 LengthTypeMM = 7, 40 LengthTypeIN = 8, 41 LengthTypePT = 9, 42 LengthTypePC = 10 43 }; 44 45 enum SVGLengthMode { 46 LengthModeWidth = 0, 47 LengthModeHeight, 48 LengthModeOther 49 }; 50 51 class SVGElement; 52 53 class SVGLength { 54 public: 55 // Forward declare these enums in the w3c naming scheme, for IDL generation 56 enum { 57 SVG_LENGTHTYPE_UNKNOWN = LengthTypeUnknown, 58 SVG_LENGTHTYPE_NUMBER = LengthTypeNumber, 59 SVG_LENGTHTYPE_PERCENTAGE = LengthTypePercentage, 60 SVG_LENGTHTYPE_EMS = LengthTypeEMS, 61 SVG_LENGTHTYPE_EXS = LengthTypeEXS, 62 SVG_LENGTHTYPE_PX = LengthTypePX, 63 SVG_LENGTHTYPE_CM = LengthTypeCM, 64 SVG_LENGTHTYPE_MM = LengthTypeMM, 65 SVG_LENGTHTYPE_IN = LengthTypeIN, 66 SVG_LENGTHTYPE_PT = LengthTypePT, 67 SVG_LENGTHTYPE_PC = LengthTypePC 41 68 }; 42 69 43 enum SVGLengthMode { 44 LengthModeWidth = 0, 45 LengthModeHeight, 46 LengthModeOther 47 }; 70 SVGLength(SVGLengthMode mode = LengthModeOther, const String& valueAsString = String()); 71 SVGLength(const SVGLength&); 48 72 49 class SVGElement;73 SVGLengthType unitType() const; 50 74 51 class SVGLength { 52 public: 53 // Forward declare these enums in the w3c naming scheme, for IDL generation 54 enum { 55 SVG_LENGTHTYPE_UNKNOWN = LengthTypeUnknown, 56 SVG_LENGTHTYPE_NUMBER = LengthTypeNumber, 57 SVG_LENGTHTYPE_PERCENTAGE = LengthTypePercentage, 58 SVG_LENGTHTYPE_EMS = LengthTypeEMS, 59 SVG_LENGTHTYPE_EXS = LengthTypeEXS, 60 SVG_LENGTHTYPE_PX = LengthTypePX, 61 SVG_LENGTHTYPE_CM = LengthTypeCM, 62 SVG_LENGTHTYPE_MM = LengthTypeMM, 63 SVG_LENGTHTYPE_IN = LengthTypeIN, 64 SVG_LENGTHTYPE_PT = LengthTypePT, 65 SVG_LENGTHTYPE_PC = LengthTypePC 66 }; 75 bool operator==(const SVGLength&) const; 76 bool operator!=(const SVGLength&) const; 67 77 68 SVGLength(SVGLengthMode mode = LengthModeOther, const String& valueAsString = String()); 78 float value(const SVGElement* context) const; 79 void setValue(float); 69 80 70 SVGLengthType unitType() const; 81 float valueInSpecifiedUnits() const; 82 void setValueInSpecifiedUnits(float); 83 84 float valueAsPercentage() const; 71 85 72 float value(const SVGElement* context) const;73 void setValue(float);86 String valueAsString() const; 87 bool setValueAsString(const String&); 74 88 75 float valueInSpecifiedUnits() const; 76 void setValueInSpecifiedUnits(float); 77 78 float valueAsPercentage() const; 89 void newValueSpecifiedUnits(unsigned short, float valueInSpecifiedUnits); 90 void convertToSpecifiedUnits(unsigned short, const SVGElement* context); 79 91 80 String valueAsString() const;81 bool setValueAsString(const String&);92 // Helper functions 93 static float PercentageOfViewport(float value, const SVGElement* context, SVGLengthMode); 82 94 83 void newValueSpecifiedUnits(unsigned short, float valueInSpecifiedUnits); 84 void convertToSpecifiedUnits(unsigned short, const SVGElement* context); 95 inline bool isRelative() const 96 { 97 SVGLengthType type = unitType(); 98 return (type == LengthTypePercentage || type == LengthTypeEMS || type == LengthTypeEXS); 99 } 85 100 86 // Helper functions87 static float PercentageOfViewport(float value, const SVGElement* context, SVGLengthMode);101 static SVGLength fromCSSPrimitiveValue(CSSPrimitiveValue*); 102 static PassRefPtr<CSSPrimitiveValue> toCSSPrimitiveValue(const SVGLength&); 88 103 89 inline bool isRelative() const 90 { 91 SVGLengthType type = unitType(); 92 return (type == LengthTypePercentage || type == LengthTypeEMS || type == LengthTypeEXS); 93 } 94 95 private: 96 float m_valueInSpecifiedUnits; 97 unsigned int m_unit; 98 }; 104 private: 105 float m_valueInSpecifiedUnits; 106 unsigned int m_unit; 107 }; 99 108 100 109 } // namespace WebCore
Note: See TracChangeset
for help on using the changeset viewer.