| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 2005 Apple Computer, Inc. | 2 Copyright (C) 2005 Apple Computer, Inc. |
| 3 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 4 2004, 2005, 2008 Rob Buis <buis@kde.org> | 4 2004, 2005, 2008 Rob Buis <buis@kde.org> |
| 5 Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 5 Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 6 | 6 |
| 7 Based on khtml css code by: | 7 Based on khtml css code by: |
| 8 Copyright(C) 1999-2003 Lars Knoll(knoll@kde.org) | 8 Copyright(C) 1999-2003 Lars Knoll(knoll@kde.org) |
| 9 (C) 2003 Apple Computer, Inc. | 9 (C) 2003 Apple Computer, Inc. |
| 10 (C) 2004 Allan Sandfeld Jensen(kde@carewolf.com) | 10 (C) 2004 Allan Sandfeld Jensen(kde@carewolf.com) |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 static Color colorFromSVGColorCSSValue(SVGColor* svgColor, const Color& fgColor) | 91 static Color colorFromSVGColorCSSValue(SVGColor* svgColor, const Color& fgColor) |
| 92 { | 92 { |
| 93 Color color; | 93 Color color; |
| 94 if (svgColor->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR) | 94 if (svgColor->colorType() == SVGColor::SVG_COLORTYPE_CURRENTCOLOR) |
| 95 color = fgColor; | 95 color = fgColor; |
| 96 else | 96 else |
| 97 color = svgColor->color(); | 97 color = svgColor->color(); |
| 98 return color; | 98 return color; |
| 99 } | 99 } |
| 100 | 100 |
| 101 static EPaintOrder paintOrderFlattened(CSSValue* cssPaintOrder) |
| 102 { |
| 103 if (cssPaintOrder->isValueList()) { |
| 104 int paintOrder = 0; |
| 105 CSSValueListInspector iter(cssPaintOrder); |
| 106 for (size_t i = 0; i < iter.length(); i++) { |
| 107 CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(iter.item
(i)); |
| 108 |
| 109 EPaintOrderType paintOrderType = PT_NONE; |
| 110 switch (value->getIdent()) { |
| 111 case CSSValueFill: |
| 112 paintOrderType = PT_FILL; |
| 113 break; |
| 114 case CSSValueStroke: |
| 115 paintOrderType = PT_STROKE; |
| 116 break; |
| 117 case CSSValueMarkers: |
| 118 paintOrderType = PT_MARKERS; |
| 119 break; |
| 120 default: |
| 121 ASSERT_NOT_REACHED(); |
| 122 break; |
| 123 } |
| 124 |
| 125 paintOrder |= (paintOrderType << kPaintOrderBitwidth*i); |
| 126 } |
| 127 return (EPaintOrder)paintOrder; |
| 128 } |
| 129 |
| 130 return PO_NORMAL; |
| 131 } |
| 132 |
| 101 void StyleResolver::applySVGProperty(CSSPropertyID id, CSSValue* value) | 133 void StyleResolver::applySVGProperty(CSSPropertyID id, CSSValue* value) |
| 102 { | 134 { |
| 103 ASSERT(value); | 135 ASSERT(value); |
| 104 CSSPrimitiveValue* primitiveValue = 0; | 136 CSSPrimitiveValue* primitiveValue = 0; |
| 105 if (value->isPrimitiveValue()) | 137 if (value->isPrimitiveValue()) |
| 106 primitiveValue = toCSSPrimitiveValue(value); | 138 primitiveValue = toCSSPrimitiveValue(value); |
| 107 | 139 |
| 108 const StyleResolverState& state = m_state; | 140 const StyleResolverState& state = m_state; |
| 109 SVGRenderStyle* svgstyle = state.style()->accessSVGStyle(); | 141 SVGRenderStyle* svgstyle = state.style()->accessSVGStyle(); |
| 110 | 142 |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 break; | 625 break; |
| 594 } | 626 } |
| 595 case CSSPropertyMaskType: { | 627 case CSSPropertyMaskType: { |
| 596 HANDLE_INHERIT_AND_INITIAL(maskType, MaskType) | 628 HANDLE_INHERIT_AND_INITIAL(maskType, MaskType) |
| 597 if (!primitiveValue) | 629 if (!primitiveValue) |
| 598 break; | 630 break; |
| 599 | 631 |
| 600 svgstyle->setMaskType(*primitiveValue); | 632 svgstyle->setMaskType(*primitiveValue); |
| 601 break; | 633 break; |
| 602 } | 634 } |
| 635 case CSSPropertyPaintOrder: { |
| 636 HANDLE_INHERIT_AND_INITIAL(paintOrder, PaintOrder) |
| 637 |
| 638 svgstyle->setPaintOrder(paintOrderFlattened(value)); |
| 639 |
| 640 break; |
| 641 } |
| 603 default: | 642 default: |
| 604 // If you crash here, it's because you added a css property and are
not handling it | 643 // If you crash here, it's because you added a css property and are
not handling it |
| 605 // in either this switch statement or the one in StyleResolver::appl
yProperty | 644 // in either this switch statement or the one in StyleResolver::appl
yProperty |
| 606 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", id); | 645 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", id); |
| 607 return; | 646 return; |
| 608 } | 647 } |
| 609 } | 648 } |
| 610 | 649 |
| 611 } | 650 } |
| OLD | NEW |