| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 2 Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
| 3 Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 3 Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 4 | 4 |
| 5 This library is free software; you can redistribute it and/or | 5 This library is free software; you can redistribute it and/or |
| 6 modify it under the terms of the GNU Library General Public | 6 modify it under the terms of the GNU Library General Public |
| 7 License as published by the Free Software Foundation; either | 7 License as published by the Free Software Foundation; either |
| 8 version 2 of the License, or (at your option) any later version. | 8 version 2 of the License, or (at your option) any later version. |
| 9 | 9 |
| 10 This library is distributed in the hope that it will be useful, | 10 This library is distributed in the hope that it will be useful, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 case PT_NONE: | 76 case PT_NONE: |
| 77 default: | 77 default: |
| 78 ASSERT_NOT_REACHED(); | 78 ASSERT_NOT_REACHED(); |
| 79 break; | 79 break; |
| 80 } | 80 } |
| 81 } while (paintorder >>= kPaintOrderBitwidth); | 81 } while (paintorder >>= kPaintOrderBitwidth); |
| 82 | 82 |
| 83 return list.release(); | 83 return list.release(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 PassRefPtrWillBeRawPtr<SVGPaint> CSSComputedStyleDeclaration::adjustSVGPaintForC
urrentColor(PassRefPtrWillBeRawPtr<SVGPaint> newPaint, RenderStyle& style) const | 86 PassRefPtrWillBeRawPtr<CSSValue> adjustSVGPaintForCurrentColor(SVGPaint::SVGPain
tType ptype, const String& url, const Color& color, const Color& currentColor) |
| 87 { | 87 { |
| 88 RefPtrWillBeRawPtr<SVGPaint> paint = newPaint; | 88 if (ptype >= SVGPaint::SVG_PAINTTYPE_URI_NONE) { |
| 89 if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR || paint->pai
ntType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR) | 89 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSepar
ated(); |
| 90 paint->setColor(style.color()); | 90 values->append(CSSPrimitiveValue::create(url, CSSPrimitiveValue::CSS_URI
)); |
| 91 return paint.release(); | 91 if (ptype == SVGPaint::SVG_PAINTTYPE_URI_NONE) |
| 92 values->append(CSSPrimitiveValue::create(CSSValueNone)); |
| 93 else if (ptype == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR) |
| 94 values->append(CSSPrimitiveValue::createColor(currentColor.rgb())); |
| 95 else if (ptype == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) |
| 96 values->append(CSSPrimitiveValue::createColor(color.rgb())); |
| 97 return values.release(); |
| 98 } |
| 99 if (ptype == SVGPaint::SVG_PAINTTYPE_NONE) |
| 100 return CSSPrimitiveValue::create(CSSValueNone); |
| 101 if (ptype == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR) |
| 102 return CSSPrimitiveValue::createColor(currentColor.rgb()); |
| 103 |
| 104 return CSSPrimitiveValue::createColor(color.rgb()); |
| 92 } | 105 } |
| 93 | 106 |
| 94 static inline String serializeAsFragmentIdentifier(const AtomicString& resource) | 107 static inline String serializeAsFragmentIdentifier(const AtomicString& resource) |
| 95 { | 108 { |
| 96 return "#" + resource; | 109 return "#" + resource; |
| 97 } | 110 } |
| 98 | 111 |
| 99 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSV
alue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const | 112 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSV
alue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const |
| 100 { | 113 { |
| 101 Node* node = m_node.get(); | 114 Node* node = m_node.get(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 if (!svgStyle->filterResource().isEmpty()) | 174 if (!svgStyle->filterResource().isEmpty()) |
| 162 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(s
vgStyle->filterResource()), CSSPrimitiveValue::CSS_URI); | 175 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(s
vgStyle->filterResource()), CSSPrimitiveValue::CSS_URI); |
| 163 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 176 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
| 164 case CSSPropertyFloodColor: | 177 case CSSPropertyFloodColor: |
| 165 return currentColorOrValidColor(*style, svgStyle->floodColor()); | 178 return currentColorOrValidColor(*style, svgStyle->floodColor()); |
| 166 case CSSPropertyLightingColor: | 179 case CSSPropertyLightingColor: |
| 167 return currentColorOrValidColor(*style, svgStyle->lightingColor()); | 180 return currentColorOrValidColor(*style, svgStyle->lightingColor()); |
| 168 case CSSPropertyStopColor: | 181 case CSSPropertyStopColor: |
| 169 return currentColorOrValidColor(*style, svgStyle->stopColor()); | 182 return currentColorOrValidColor(*style, svgStyle->stopColor()); |
| 170 case CSSPropertyFill: | 183 case CSSPropertyFill: |
| 171 return adjustSVGPaintForCurrentColor(SVGPaint::create(svgStyle->fill
PaintType(), svgStyle->fillPaintUri(), svgStyle->fillPaintColor()), *style); | 184 return adjustSVGPaintForCurrentColor(svgStyle->fillPaintType(), svgS
tyle->fillPaintUri(), svgStyle->fillPaintColor(), style->color()); |
| 172 case CSSPropertyMarkerEnd: | 185 case CSSPropertyMarkerEnd: |
| 173 if (!svgStyle->markerEndResource().isEmpty()) | 186 if (!svgStyle->markerEndResource().isEmpty()) |
| 174 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(s
vgStyle->markerEndResource()), CSSPrimitiveValue::CSS_URI); | 187 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(s
vgStyle->markerEndResource()), CSSPrimitiveValue::CSS_URI); |
| 175 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 188 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
| 176 case CSSPropertyMarkerMid: | 189 case CSSPropertyMarkerMid: |
| 177 if (!svgStyle->markerMidResource().isEmpty()) | 190 if (!svgStyle->markerMidResource().isEmpty()) |
| 178 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(s
vgStyle->markerMidResource()), CSSPrimitiveValue::CSS_URI); | 191 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(s
vgStyle->markerMidResource()), CSSPrimitiveValue::CSS_URI); |
| 179 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 192 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
| 180 case CSSPropertyMarkerStart: | 193 case CSSPropertyMarkerStart: |
| 181 if (!svgStyle->markerStartResource().isEmpty()) | 194 if (!svgStyle->markerStartResource().isEmpty()) |
| 182 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(s
vgStyle->markerStartResource()), CSSPrimitiveValue::CSS_URI); | 195 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(s
vgStyle->markerStartResource()), CSSPrimitiveValue::CSS_URI); |
| 183 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 196 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
| 184 case CSSPropertyStroke: | 197 case CSSPropertyStroke: |
| 185 return adjustSVGPaintForCurrentColor(SVGPaint::create(svgStyle->stro
kePaintType(), svgStyle->strokePaintUri(), svgStyle->strokePaintColor()), *style
); | 198 return adjustSVGPaintForCurrentColor(svgStyle->strokePaintType(), sv
gStyle->strokePaintUri(), svgStyle->strokePaintColor(), style->color()); |
| 186 case CSSPropertyStrokeDasharray: | 199 case CSSPropertyStrokeDasharray: |
| 187 return strokeDashArrayToCSSValueList(svgStyle->strokeDashArray()); | 200 return strokeDashArrayToCSSValueList(svgStyle->strokeDashArray()); |
| 188 case CSSPropertyStrokeDashoffset: | 201 case CSSPropertyStrokeDashoffset: |
| 189 return SVGLength::toCSSPrimitiveValue(svgStyle->strokeDashOffset()); | 202 return SVGLength::toCSSPrimitiveValue(svgStyle->strokeDashOffset()); |
| 190 case CSSPropertyStrokeWidth: | 203 case CSSPropertyStrokeWidth: |
| 191 return SVGLength::toCSSPrimitiveValue(svgStyle->strokeWidth()); | 204 return SVGLength::toCSSPrimitiveValue(svgStyle->strokeWidth()); |
| 192 case CSSPropertyBaselineShift: { | 205 case CSSPropertyBaselineShift: { |
| 193 switch (svgStyle->baselineShift()) { | 206 switch (svgStyle->baselineShift()) { |
| 194 case BS_BASELINE: | 207 case BS_BASELINE: |
| 195 return CSSPrimitiveValue::createIdentifier(CSSValueBaseline)
; | 208 return CSSPrimitiveValue::createIdentifier(CSSValueBaseline)
; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 default: | 242 default: |
| 230 // If you crash here, it's because you added a css property and are not
handling it | 243 // If you crash here, it's because you added a css property and are not
handling it |
| 231 // in either this switch statement or the one in CSSComputedStyleDelcara
tion::getPropertyCSSValue | 244 // in either this switch statement or the one in CSSComputedStyleDelcara
tion::getPropertyCSSValue |
| 232 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propertyID); | 245 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propertyID); |
| 233 } | 246 } |
| 234 WTF_LOG_ERROR("unimplemented propertyID: %d", propertyID); | 247 WTF_LOG_ERROR("unimplemented propertyID: %d", propertyID); |
| 235 return nullptr; | 248 return nullptr; |
| 236 } | 249 } |
| 237 | 250 |
| 238 } | 251 } |
| OLD | NEW |