| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 } | 84 } |
| 85 | 85 |
| 86 PassRefPtrWillBeRawPtr<SVGPaint> CSSComputedStyleDeclaration::adjustSVGPaintForC
urrentColor(PassRefPtrWillBeRawPtr<SVGPaint> newPaint, RenderStyle& style) const | 86 PassRefPtrWillBeRawPtr<SVGPaint> CSSComputedStyleDeclaration::adjustSVGPaintForC
urrentColor(PassRefPtrWillBeRawPtr<SVGPaint> newPaint, RenderStyle& style) const |
| 87 { | 87 { |
| 88 RefPtrWillBeRawPtr<SVGPaint> paint = newPaint; | 88 RefPtrWillBeRawPtr<SVGPaint> paint = newPaint; |
| 89 if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR || paint->pai
ntType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR) | 89 if (paint->paintType() == SVGPaint::SVG_PAINTTYPE_CURRENTCOLOR || paint->pai
ntType() == SVGPaint::SVG_PAINTTYPE_URI_CURRENTCOLOR) |
| 90 paint->setColor(style.color()); | 90 paint->setColor(style.color()); |
| 91 return paint.release(); | 91 return paint.release(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 static inline String serializeAsFragmentIdentifier(const AtomicString& resource) |
| 95 { |
| 96 return "#" + resource; |
| 97 } |
| 98 |
| 94 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSV
alue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const | 99 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getSVGPropertyCSSV
alue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const |
| 95 { | 100 { |
| 96 Node* node = m_node.get(); | 101 Node* node = m_node.get(); |
| 97 if (!node) | 102 if (!node) |
| 98 return nullptr; | 103 return nullptr; |
| 99 | 104 |
| 100 // Make sure our layout is up to date before we allow a query on these attri
butes. | 105 // Make sure our layout is up to date before we allow a query on these attri
butes. |
| 101 if (updateLayout) | 106 if (updateLayout) |
| 102 node->document().updateLayout(); | 107 node->document().updateLayout(); |
| 103 | 108 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 case CSSPropertyAlignmentBaseline: | 144 case CSSPropertyAlignmentBaseline: |
| 140 return CSSPrimitiveValue::create(svgStyle->alignmentBaseline()); | 145 return CSSPrimitiveValue::create(svgStyle->alignmentBaseline()); |
| 141 case CSSPropertyDominantBaseline: | 146 case CSSPropertyDominantBaseline: |
| 142 return CSSPrimitiveValue::create(svgStyle->dominantBaseline()); | 147 return CSSPrimitiveValue::create(svgStyle->dominantBaseline()); |
| 143 case CSSPropertyTextAnchor: | 148 case CSSPropertyTextAnchor: |
| 144 return CSSPrimitiveValue::create(svgStyle->textAnchor()); | 149 return CSSPrimitiveValue::create(svgStyle->textAnchor()); |
| 145 case CSSPropertyWritingMode: | 150 case CSSPropertyWritingMode: |
| 146 return CSSPrimitiveValue::create(svgStyle->writingMode()); | 151 return CSSPrimitiveValue::create(svgStyle->writingMode()); |
| 147 case CSSPropertyClipPath: | 152 case CSSPropertyClipPath: |
| 148 if (!svgStyle->clipperResource().isEmpty()) | 153 if (!svgStyle->clipperResource().isEmpty()) |
| 149 return CSSPrimitiveValue::create(svgStyle->clipperResource(), CS
SPrimitiveValue::CSS_URI); | 154 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(s
vgStyle->clipperResource()), CSSPrimitiveValue::CSS_URI); |
| 150 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 155 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
| 151 case CSSPropertyMask: | 156 case CSSPropertyMask: |
| 152 if (!svgStyle->maskerResource().isEmpty()) | 157 if (!svgStyle->maskerResource().isEmpty()) |
| 153 return CSSPrimitiveValue::create(svgStyle->maskerResource(), CSS
PrimitiveValue::CSS_URI); | 158 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(s
vgStyle->maskerResource()), CSSPrimitiveValue::CSS_URI); |
| 154 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 159 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
| 155 case CSSPropertyFilter: | 160 case CSSPropertyFilter: |
| 156 if (!svgStyle->filterResource().isEmpty()) | 161 if (!svgStyle->filterResource().isEmpty()) |
| 157 return CSSPrimitiveValue::create(svgStyle->filterResource(), CSS
PrimitiveValue::CSS_URI); | 162 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(s
vgStyle->filterResource()), CSSPrimitiveValue::CSS_URI); |
| 158 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 163 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
| 159 case CSSPropertyFloodColor: | 164 case CSSPropertyFloodColor: |
| 160 return currentColorOrValidColor(*style, svgStyle->floodColor()); | 165 return currentColorOrValidColor(*style, svgStyle->floodColor()); |
| 161 case CSSPropertyLightingColor: | 166 case CSSPropertyLightingColor: |
| 162 return currentColorOrValidColor(*style, svgStyle->lightingColor()); | 167 return currentColorOrValidColor(*style, svgStyle->lightingColor()); |
| 163 case CSSPropertyStopColor: | 168 case CSSPropertyStopColor: |
| 164 return currentColorOrValidColor(*style, svgStyle->stopColor()); | 169 return currentColorOrValidColor(*style, svgStyle->stopColor()); |
| 165 case CSSPropertyFill: | 170 case CSSPropertyFill: |
| 166 return adjustSVGPaintForCurrentColor(SVGPaint::create(svgStyle->fill
PaintType(), svgStyle->fillPaintUri(), svgStyle->fillPaintColor()), *style); | 171 return adjustSVGPaintForCurrentColor(SVGPaint::create(svgStyle->fill
PaintType(), svgStyle->fillPaintUri(), svgStyle->fillPaintColor()), *style); |
| 167 case CSSPropertyMarkerEnd: | 172 case CSSPropertyMarkerEnd: |
| 168 if (!svgStyle->markerEndResource().isEmpty()) | 173 if (!svgStyle->markerEndResource().isEmpty()) |
| 169 return CSSPrimitiveValue::create(svgStyle->markerEndResource(),
CSSPrimitiveValue::CSS_URI); | 174 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(s
vgStyle->markerEndResource()), CSSPrimitiveValue::CSS_URI); |
| 170 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 175 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
| 171 case CSSPropertyMarkerMid: | 176 case CSSPropertyMarkerMid: |
| 172 if (!svgStyle->markerMidResource().isEmpty()) | 177 if (!svgStyle->markerMidResource().isEmpty()) |
| 173 return CSSPrimitiveValue::create(svgStyle->markerMidResource(),
CSSPrimitiveValue::CSS_URI); | 178 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(s
vgStyle->markerMidResource()), CSSPrimitiveValue::CSS_URI); |
| 174 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 179 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
| 175 case CSSPropertyMarkerStart: | 180 case CSSPropertyMarkerStart: |
| 176 if (!svgStyle->markerStartResource().isEmpty()) | 181 if (!svgStyle->markerStartResource().isEmpty()) |
| 177 return CSSPrimitiveValue::create(svgStyle->markerStartResource()
, CSSPrimitiveValue::CSS_URI); | 182 return CSSPrimitiveValue::create(serializeAsFragmentIdentifier(s
vgStyle->markerStartResource()), CSSPrimitiveValue::CSS_URI); |
| 178 return CSSPrimitiveValue::createIdentifier(CSSValueNone); | 183 return CSSPrimitiveValue::createIdentifier(CSSValueNone); |
| 179 case CSSPropertyStroke: | 184 case CSSPropertyStroke: |
| 180 return adjustSVGPaintForCurrentColor(SVGPaint::create(svgStyle->stro
kePaintType(), svgStyle->strokePaintUri(), svgStyle->strokePaintColor()), *style
); | 185 return adjustSVGPaintForCurrentColor(SVGPaint::create(svgStyle->stro
kePaintType(), svgStyle->strokePaintUri(), svgStyle->strokePaintColor()), *style
); |
| 181 case CSSPropertyStrokeDasharray: | 186 case CSSPropertyStrokeDasharray: |
| 182 return strokeDashArrayToCSSValueList(svgStyle->strokeDashArray()); | 187 return strokeDashArrayToCSSValueList(svgStyle->strokeDashArray()); |
| 183 case CSSPropertyStrokeDashoffset: | 188 case CSSPropertyStrokeDashoffset: |
| 184 return SVGLength::toCSSPrimitiveValue(svgStyle->strokeDashOffset()); | 189 return SVGLength::toCSSPrimitiveValue(svgStyle->strokeDashOffset()); |
| 185 case CSSPropertyStrokeWidth: | 190 case CSSPropertyStrokeWidth: |
| 186 return SVGLength::toCSSPrimitiveValue(svgStyle->strokeWidth()); | 191 return SVGLength::toCSSPrimitiveValue(svgStyle->strokeWidth()); |
| 187 case CSSPropertyBaselineShift: { | 192 case CSSPropertyBaselineShift: { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 default: | 229 default: |
| 225 // If you crash here, it's because you added a css property and are not
handling it | 230 // If you crash here, it's because you added a css property and are not
handling it |
| 226 // in either this switch statement or the one in CSSComputedStyleDelcara
tion::getPropertyCSSValue | 231 // in either this switch statement or the one in CSSComputedStyleDelcara
tion::getPropertyCSSValue |
| 227 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propertyID); | 232 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", propertyID); |
| 228 } | 233 } |
| 229 WTF_LOG_ERROR("unimplemented propertyID: %d", propertyID); | 234 WTF_LOG_ERROR("unimplemented propertyID: %d", propertyID); |
| 230 return nullptr; | 235 return nullptr; |
| 231 } | 236 } |
| 232 | 237 |
| 233 } | 238 } |
| OLD | NEW |