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 | 33 |
34 SVGRenderStyle::SVGRenderStyle() | 34 SVGRenderStyle::SVGRenderStyle() |
35 { | 35 { |
36 static SVGRenderStyle* defaultStyle = new SVGRenderStyle(CreateDefault); | 36 static SVGRenderStyle* defaultStyle = new SVGRenderStyle(CreateDefault); |
37 | 37 |
38 fill = defaultStyle->fill; | 38 fill = defaultStyle->fill; |
39 stroke = defaultStyle->stroke; | 39 stroke = defaultStyle->stroke; |
40 stops = defaultStyle->stops; | 40 stops = defaultStyle->stops; |
41 misc = defaultStyle->misc; | 41 misc = defaultStyle->misc; |
42 inheritedResources = defaultStyle->inheritedResources; | 42 inheritedResources = defaultStyle->inheritedResources; |
| 43 layout = defaultStyle->layout; |
43 resources = defaultStyle->resources; | 44 resources = defaultStyle->resources; |
44 | 45 |
45 setBitDefaults(); | 46 setBitDefaults(); |
46 } | 47 } |
47 | 48 |
48 SVGRenderStyle::SVGRenderStyle(CreateDefaultType) | 49 SVGRenderStyle::SVGRenderStyle(CreateDefaultType) |
49 { | 50 { |
50 setBitDefaults(); | 51 setBitDefaults(); |
51 | 52 |
52 fill.init(); | 53 fill.init(); |
53 stroke.init(); | 54 stroke.init(); |
54 stops.init(); | 55 stops.init(); |
55 misc.init(); | 56 misc.init(); |
56 inheritedResources.init(); | 57 inheritedResources.init(); |
| 58 layout.init(); |
57 resources.init(); | 59 resources.init(); |
58 } | 60 } |
59 | 61 |
60 SVGRenderStyle::SVGRenderStyle(const SVGRenderStyle& other) | 62 SVGRenderStyle::SVGRenderStyle(const SVGRenderStyle& other) |
61 : RefCounted<SVGRenderStyle>() | 63 : RefCounted<SVGRenderStyle>() |
62 { | 64 { |
63 fill = other.fill; | 65 fill = other.fill; |
64 stroke = other.stroke; | 66 stroke = other.stroke; |
65 stops = other.stops; | 67 stops = other.stops; |
66 misc = other.misc; | 68 misc = other.misc; |
67 inheritedResources = other.inheritedResources; | 69 inheritedResources = other.inheritedResources; |
| 70 layout = other.layout; |
68 resources = other.resources; | 71 resources = other.resources; |
69 | 72 |
70 svg_inherited_flags = other.svg_inherited_flags; | 73 svg_inherited_flags = other.svg_inherited_flags; |
71 svg_noninherited_flags = other.svg_noninherited_flags; | 74 svg_noninherited_flags = other.svg_noninherited_flags; |
72 } | 75 } |
73 | 76 |
74 SVGRenderStyle::~SVGRenderStyle() | 77 SVGRenderStyle::~SVGRenderStyle() |
75 { | 78 { |
76 } | 79 } |
77 | 80 |
78 bool SVGRenderStyle::operator==(const SVGRenderStyle& other) const | 81 bool SVGRenderStyle::operator==(const SVGRenderStyle& other) const |
79 { | 82 { |
80 return fill == other.fill | 83 return fill == other.fill |
81 && stroke == other.stroke | 84 && stroke == other.stroke |
82 && stops == other.stops | 85 && stops == other.stops |
83 && misc == other.misc | 86 && misc == other.misc |
84 && inheritedResources == other.inheritedResources | 87 && inheritedResources == other.inheritedResources |
| 88 && layout == other.layout |
85 && resources == other.resources | 89 && resources == other.resources |
86 && svg_inherited_flags == other.svg_inherited_flags | 90 && svg_inherited_flags == other.svg_inherited_flags |
87 && svg_noninherited_flags == other.svg_noninherited_flags; | 91 && svg_noninherited_flags == other.svg_noninherited_flags; |
88 } | 92 } |
89 | 93 |
90 bool SVGRenderStyle::inheritedNotEqual(const SVGRenderStyle* other) const | 94 bool SVGRenderStyle::inheritedNotEqual(const SVGRenderStyle* other) const |
91 { | 95 { |
92 return fill != other->fill | 96 return fill != other->fill |
93 || stroke != other->stroke | 97 || stroke != other->stroke |
94 || inheritedResources != other->inheritedResources | 98 || inheritedResources != other->inheritedResources |
(...skipping 10 matching lines...) Expand all Loading... |
105 inheritedResources = svgInheritParent->inheritedResources; | 109 inheritedResources = svgInheritParent->inheritedResources; |
106 | 110 |
107 svg_inherited_flags = svgInheritParent->svg_inherited_flags; | 111 svg_inherited_flags = svgInheritParent->svg_inherited_flags; |
108 } | 112 } |
109 | 113 |
110 void SVGRenderStyle::copyNonInheritedFrom(const SVGRenderStyle* other) | 114 void SVGRenderStyle::copyNonInheritedFrom(const SVGRenderStyle* other) |
111 { | 115 { |
112 svg_noninherited_flags = other->svg_noninherited_flags; | 116 svg_noninherited_flags = other->svg_noninherited_flags; |
113 stops = other->stops; | 117 stops = other->stops; |
114 misc = other->misc; | 118 misc = other->misc; |
| 119 layout = other->layout; |
115 resources = other->resources; | 120 resources = other->resources; |
116 } | 121 } |
117 | 122 |
118 StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const | 123 StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const |
119 { | 124 { |
120 StyleDifference styleDifference; | 125 StyleDifference styleDifference; |
121 | 126 |
122 if (diffNeedsLayoutAndPaintInvalidation(other)) { | 127 if (diffNeedsLayoutAndPaintInvalidation(other)) { |
123 styleDifference.setNeedsFullLayout(); | 128 styleDifference.setNeedsFullLayout(); |
124 styleDifference.setNeedsPaintInvalidationObject(); | 129 styleDifference.setNeedsPaintInvalidationObject(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 || stroke->paintUri != other->stroke->paintUri | 175 || stroke->paintUri != other->stroke->paintUri |
171 || stroke->miterLimit != other->stroke->miterLimit | 176 || stroke->miterLimit != other->stroke->miterLimit |
172 || *stroke->dashArray != *other->stroke->dashArray | 177 || *stroke->dashArray != *other->stroke->dashArray |
173 || *stroke->dashOffset != *other->stroke->dashOffset | 178 || *stroke->dashOffset != *other->stroke->dashOffset |
174 || stroke->visitedLinkPaintColor != other->stroke->visitedLinkPaintC
olor | 179 || stroke->visitedLinkPaintColor != other->stroke->visitedLinkPaintC
olor |
175 || stroke->visitedLinkPaintUri != other->stroke->visitedLinkPaintUri | 180 || stroke->visitedLinkPaintUri != other->stroke->visitedLinkPaintUri |
176 || stroke->visitedLinkPaintType != other->stroke->visitedLinkPaintTy
pe) | 181 || stroke->visitedLinkPaintType != other->stroke->visitedLinkPaintTy
pe) |
177 return true; | 182 return true; |
178 } | 183 } |
179 | 184 |
| 185 // The x and y properties require a re-layout. |
| 186 if (layout.get() != other->layout.get()) { |
| 187 if (layout->x != other->layout->x |
| 188 || layout->y != other->layout->y) |
| 189 return true; |
| 190 } |
| 191 |
180 return false; | 192 return false; |
181 } | 193 } |
182 | 194 |
183 bool SVGRenderStyle::diffNeedsPaintInvalidation(const SVGRenderStyle* other) con
st | 195 bool SVGRenderStyle::diffNeedsPaintInvalidation(const SVGRenderStyle* other) con
st |
184 { | 196 { |
185 if (stroke->opacity != other->stroke->opacity) | 197 if (stroke->opacity != other->stroke->opacity) |
186 return true; | 198 return true; |
187 | 199 |
188 // Painting related properties only need paint invalidation. | 200 // Painting related properties only need paint invalidation. |
189 if (misc.get() != other->misc.get()) { | 201 if (misc.get() != other->misc.get()) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 238 } |
227 | 239 |
228 EPaintOrderType SVGRenderStyle::paintOrderType(unsigned index) const | 240 EPaintOrderType SVGRenderStyle::paintOrderType(unsigned index) const |
229 { | 241 { |
230 ASSERT(index < ((1 << kPaintOrderBitwidth)-1)); | 242 ASSERT(index < ((1 << kPaintOrderBitwidth)-1)); |
231 unsigned pt = (paintOrder() >> (kPaintOrderBitwidth*index)) & ((1u << kPaint
OrderBitwidth) - 1); | 243 unsigned pt = (paintOrder() >> (kPaintOrderBitwidth*index)) & ((1u << kPaint
OrderBitwidth) - 1); |
232 return (EPaintOrderType)pt; | 244 return (EPaintOrderType)pt; |
233 } | 245 } |
234 | 246 |
235 } | 247 } |
OLD | NEW |