| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 2004, 2005, 2010 Rob Buis <buis@kde.org> | 3 2004, 2005, 2010 Rob Buis <buis@kde.org> |
| 4 Copyright (C) Research In Motion Limited 2010. All rights reserved. | 4 Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 5 | 5 |
| 6 Based on khtml code by: | 6 Based on khtml code by: |
| 7 Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 7 Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 8 Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) | 8 Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 9 Copyright (C) 2002-2003 Dirk Mueller (mueller@kde.org) | 9 Copyright (C) 2002-2003 Dirk Mueller (mueller@kde.org) |
| 10 Copyright (C) 2002 Apple Computer, Inc. | 10 Copyright (C) 2002 Apple Computer, Inc. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 using namespace std; | 33 using namespace std; |
| 34 | 34 |
| 35 namespace WebCore { | 35 namespace WebCore { |
| 36 | 36 |
| 37 SVGRenderStyle::SVGRenderStyle() | 37 SVGRenderStyle::SVGRenderStyle() |
| 38 { | 38 { |
| 39 static SVGRenderStyle* defaultStyle = new SVGRenderStyle(CreateDefault); | 39 static SVGRenderStyle* defaultStyle = new SVGRenderStyle(CreateDefault); |
| 40 | 40 |
| 41 fill = defaultStyle->fill; | 41 fill = defaultStyle->fill; |
| 42 stroke = defaultStyle->stroke; | 42 stroke = defaultStyle->stroke; |
| 43 text = defaultStyle->text; | |
| 44 stops = defaultStyle->stops; | 43 stops = defaultStyle->stops; |
| 45 misc = defaultStyle->misc; | 44 misc = defaultStyle->misc; |
| 46 inheritedResources = defaultStyle->inheritedResources; | 45 inheritedResources = defaultStyle->inheritedResources; |
| 47 resources = defaultStyle->resources; | 46 resources = defaultStyle->resources; |
| 48 | 47 |
| 49 setBitDefaults(); | 48 setBitDefaults(); |
| 50 } | 49 } |
| 51 | 50 |
| 52 SVGRenderStyle::SVGRenderStyle(CreateDefaultType) | 51 SVGRenderStyle::SVGRenderStyle(CreateDefaultType) |
| 53 { | 52 { |
| 54 setBitDefaults(); | 53 setBitDefaults(); |
| 55 | 54 |
| 56 fill.init(); | 55 fill.init(); |
| 57 stroke.init(); | 56 stroke.init(); |
| 58 text.init(); | |
| 59 stops.init(); | 57 stops.init(); |
| 60 misc.init(); | 58 misc.init(); |
| 61 inheritedResources.init(); | 59 inheritedResources.init(); |
| 62 resources.init(); | 60 resources.init(); |
| 63 } | 61 } |
| 64 | 62 |
| 65 SVGRenderStyle::SVGRenderStyle(const SVGRenderStyle& other) | 63 SVGRenderStyle::SVGRenderStyle(const SVGRenderStyle& other) |
| 66 : RefCounted<SVGRenderStyle>() | 64 : RefCounted<SVGRenderStyle>() |
| 67 { | 65 { |
| 68 fill = other.fill; | 66 fill = other.fill; |
| 69 stroke = other.stroke; | 67 stroke = other.stroke; |
| 70 text = other.text; | |
| 71 stops = other.stops; | 68 stops = other.stops; |
| 72 misc = other.misc; | 69 misc = other.misc; |
| 73 inheritedResources = other.inheritedResources; | 70 inheritedResources = other.inheritedResources; |
| 74 resources = other.resources; | 71 resources = other.resources; |
| 75 | 72 |
| 76 svg_inherited_flags = other.svg_inherited_flags; | 73 svg_inherited_flags = other.svg_inherited_flags; |
| 77 svg_noninherited_flags = other.svg_noninherited_flags; | 74 svg_noninherited_flags = other.svg_noninherited_flags; |
| 78 } | 75 } |
| 79 | 76 |
| 80 SVGRenderStyle::~SVGRenderStyle() | 77 SVGRenderStyle::~SVGRenderStyle() |
| 81 { | 78 { |
| 82 } | 79 } |
| 83 | 80 |
| 84 bool SVGRenderStyle::operator==(const SVGRenderStyle& other) const | 81 bool SVGRenderStyle::operator==(const SVGRenderStyle& other) const |
| 85 { | 82 { |
| 86 return fill == other.fill | 83 return fill == other.fill |
| 87 && stroke == other.stroke | 84 && stroke == other.stroke |
| 88 && text == other.text | |
| 89 && stops == other.stops | 85 && stops == other.stops |
| 90 && misc == other.misc | 86 && misc == other.misc |
| 91 && inheritedResources == other.inheritedResources | 87 && inheritedResources == other.inheritedResources |
| 92 && resources == other.resources | 88 && resources == other.resources |
| 93 && svg_inherited_flags == other.svg_inherited_flags | 89 && svg_inherited_flags == other.svg_inherited_flags |
| 94 && svg_noninherited_flags == other.svg_noninherited_flags; | 90 && svg_noninherited_flags == other.svg_noninherited_flags; |
| 95 } | 91 } |
| 96 | 92 |
| 97 bool SVGRenderStyle::inheritedNotEqual(const SVGRenderStyle* other) const | 93 bool SVGRenderStyle::inheritedNotEqual(const SVGRenderStyle* other) const |
| 98 { | 94 { |
| 99 return fill != other->fill | 95 return fill != other->fill |
| 100 || stroke != other->stroke | 96 || stroke != other->stroke |
| 101 || text != other->text | |
| 102 || inheritedResources != other->inheritedResources | 97 || inheritedResources != other->inheritedResources |
| 103 || svg_inherited_flags != other->svg_inherited_flags; | 98 || svg_inherited_flags != other->svg_inherited_flags; |
| 104 } | 99 } |
| 105 | 100 |
| 106 void SVGRenderStyle::inheritFrom(const SVGRenderStyle* svgInheritParent) | 101 void SVGRenderStyle::inheritFrom(const SVGRenderStyle* svgInheritParent) |
| 107 { | 102 { |
| 108 if (!svgInheritParent) | 103 if (!svgInheritParent) |
| 109 return; | 104 return; |
| 110 | 105 |
| 111 fill = svgInheritParent->fill; | 106 fill = svgInheritParent->fill; |
| 112 stroke = svgInheritParent->stroke; | 107 stroke = svgInheritParent->stroke; |
| 113 text = svgInheritParent->text; | |
| 114 inheritedResources = svgInheritParent->inheritedResources; | 108 inheritedResources = svgInheritParent->inheritedResources; |
| 115 | 109 |
| 116 svg_inherited_flags = svgInheritParent->svg_inherited_flags; | 110 svg_inherited_flags = svgInheritParent->svg_inherited_flags; |
| 117 } | 111 } |
| 118 | 112 |
| 119 void SVGRenderStyle::copyNonInheritedFrom(const SVGRenderStyle* other) | 113 void SVGRenderStyle::copyNonInheritedFrom(const SVGRenderStyle* other) |
| 120 { | 114 { |
| 121 svg_noninherited_flags = other->svg_noninherited_flags; | 115 svg_noninherited_flags = other->svg_noninherited_flags; |
| 122 stops = other->stops; | 116 stops = other->stops; |
| 123 misc = other->misc; | 117 misc = other->misc; |
| 124 resources = other->resources; | 118 resources = other->resources; |
| 125 } | 119 } |
| 126 | 120 |
| 127 StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const | 121 StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const |
| 128 { | 122 { |
| 129 // NOTE: All comparisions that may return StyleDifferenceLayout have to go b
efore those who return StyleDifferenceRepaint | 123 // NOTE: All comparisions that may return StyleDifferenceLayout have to go b
efore those who return StyleDifferenceRepaint |
| 130 | 124 |
| 131 // If kerning changes, we need a relayout, to force SVGCharacterData to be r
ecalculated in the SVGRootInlineBox. | |
| 132 if (text != other->text) | |
| 133 return StyleDifferenceLayout; | |
| 134 | |
| 135 // If resources change, we need a relayout, as the presence of resources inf
luences the repaint rect. | 125 // If resources change, we need a relayout, as the presence of resources inf
luences the repaint rect. |
| 136 if (resources != other->resources) | 126 if (resources != other->resources) |
| 137 return StyleDifferenceLayout; | 127 return StyleDifferenceLayout; |
| 138 | 128 |
| 139 // If markers change, we need a relayout, as marker boundaries are cached in
RenderSVGPath. | 129 // If markers change, we need a relayout, as marker boundaries are cached in
RenderSVGPath. |
| 140 if (inheritedResources != other->inheritedResources) | 130 if (inheritedResources != other->inheritedResources) |
| 141 return StyleDifferenceLayout; | 131 return StyleDifferenceLayout; |
| 142 | 132 |
| 143 // All text related properties influence layout. | 133 // All text related properties influence layout. |
| 144 if (svg_inherited_flags._textAnchor != other->svg_inherited_flags._textAncho
r | 134 if (svg_inherited_flags._textAnchor != other->svg_inherited_flags._textAncho
r |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } | 212 } |
| 223 | 213 |
| 224 EPaintOrderType SVGRenderStyle::paintOrderType(unsigned index) const | 214 EPaintOrderType SVGRenderStyle::paintOrderType(unsigned index) const |
| 225 { | 215 { |
| 226 ASSERT(index < ((1 << kPaintOrderBitwidth)-1)); | 216 ASSERT(index < ((1 << kPaintOrderBitwidth)-1)); |
| 227 unsigned pt = (paintOrder() >> (kPaintOrderBitwidth*index)) & ((1u << kPaint
OrderBitwidth) - 1); | 217 unsigned pt = (paintOrder() >> (kPaintOrderBitwidth*index)) & ((1u << kPaint
OrderBitwidth) - 1); |
| 228 return (EPaintOrderType)pt; | 218 return (EPaintOrderType)pt; |
| 229 } | 219 } |
| 230 | 220 |
| 231 } | 221 } |
| OLD | NEW |