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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 svg_noninherited_flags = other->svg_noninherited_flags; | 112 svg_noninherited_flags = other->svg_noninherited_flags; |
113 stops = other->stops; | 113 stops = other->stops; |
114 misc = other->misc; | 114 misc = other->misc; |
115 resources = other->resources; | 115 resources = other->resources; |
116 } | 116 } |
117 | 117 |
118 StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const | 118 StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const |
119 { | 119 { |
120 StyleDifference styleDifference; | 120 StyleDifference styleDifference; |
121 | 121 |
122 if (diffNeedsLayoutAndRepaint(other)) { | 122 if (diffNeedsLayoutAndPaintInvalidation(other)) { |
123 styleDifference.setNeedsFullLayout(); | 123 styleDifference.setNeedsFullLayout(); |
124 styleDifference.setNeedsRepaintObject(); | 124 styleDifference.setNeedsPaintInvalidationObject(); |
125 } else if (diffNeedsRepaint(other)) { | 125 } else if (diffNeedsPaintInvalidation(other)) { |
126 styleDifference.setNeedsRepaintObject(); | 126 styleDifference.setNeedsPaintInvalidationObject(); |
127 } | 127 } |
128 | 128 |
129 return styleDifference; | 129 return styleDifference; |
130 } | 130 } |
131 | 131 |
132 bool SVGRenderStyle::diffNeedsLayoutAndRepaint(const SVGRenderStyle* other) cons
t | 132 bool SVGRenderStyle::diffNeedsLayoutAndPaintInvalidation(const SVGRenderStyle* o
ther) const |
133 { | 133 { |
134 // If resources change, we need a relayout, as the presence of resources inf
luences the repaint rect. | 134 // If resources change, we need a relayout, as the presence of resources inf
luences the paint invalidation rect. |
135 if (resources != other->resources) | 135 if (resources != other->resources) |
136 return true; | 136 return true; |
137 | 137 |
138 // If markers change, we need a relayout, as marker boundaries are cached in
RenderSVGPath. | 138 // If markers change, we need a relayout, as marker boundaries are cached in
RenderSVGPath. |
139 if (inheritedResources != other->inheritedResources) | 139 if (inheritedResources != other->inheritedResources) |
140 return true; | 140 return true; |
141 | 141 |
142 // All text related properties influence layout. | 142 // All text related properties influence layout. |
143 if (svg_inherited_flags._textAnchor != other->svg_inherited_flags._textAncho
r | 143 if (svg_inherited_flags._textAnchor != other->svg_inherited_flags._textAncho
r |
144 || svg_inherited_flags._writingMode != other->svg_inherited_flags._writi
ngMode | 144 || svg_inherited_flags._writingMode != other->svg_inherited_flags._writi
ngMode |
(...skipping 28 matching lines...) Expand all Loading... |
173 || stroke->dashOffset != other->stroke->dashOffset | 173 || stroke->dashOffset != other->stroke->dashOffset |
174 || stroke->visitedLinkPaintColor != other->stroke->visitedLinkPaintC
olor | 174 || stroke->visitedLinkPaintColor != other->stroke->visitedLinkPaintC
olor |
175 || stroke->visitedLinkPaintUri != other->stroke->visitedLinkPaintUri | 175 || stroke->visitedLinkPaintUri != other->stroke->visitedLinkPaintUri |
176 || stroke->visitedLinkPaintType != other->stroke->visitedLinkPaintTy
pe) | 176 || stroke->visitedLinkPaintType != other->stroke->visitedLinkPaintTy
pe) |
177 return true; | 177 return true; |
178 } | 178 } |
179 | 179 |
180 return false; | 180 return false; |
181 } | 181 } |
182 | 182 |
183 bool SVGRenderStyle::diffNeedsRepaint(const SVGRenderStyle* other) const | 183 bool SVGRenderStyle::diffNeedsPaintInvalidation(const SVGRenderStyle* other) con
st |
184 { | 184 { |
185 if (stroke->opacity != other->stroke->opacity) | 185 if (stroke->opacity != other->stroke->opacity) |
186 return true; | 186 return true; |
187 | 187 |
188 // Painting related properties only need repaints. | 188 // Painting related properties only need paint invalidation. |
189 if (misc.get() != other->misc.get()) { | 189 if (misc.get() != other->misc.get()) { |
190 if (misc->floodColor != other->misc->floodColor | 190 if (misc->floodColor != other->misc->floodColor |
191 || misc->floodOpacity != other->misc->floodOpacity | 191 || misc->floodOpacity != other->misc->floodOpacity |
192 || misc->lightingColor != other->misc->lightingColor) | 192 || misc->lightingColor != other->misc->lightingColor) |
193 return true; | 193 return true; |
194 } | 194 } |
195 | 195 |
196 // If fill changes, we just need to repaint. Fill boundaries are not influen
ced by this, only by the Path, that RenderSVGPath contains. | 196 // If fill changes, we just need to issue paint invalidations. Fill boundari
es are not influenced by this, only by the Path, that RenderSVGPath contains. |
197 if (fill.get() != other->fill.get()) { | 197 if (fill.get() != other->fill.get()) { |
198 if (fill->paintType != other->fill->paintType | 198 if (fill->paintType != other->fill->paintType |
199 || fill->paintColor != other->fill->paintColor | 199 || fill->paintColor != other->fill->paintColor |
200 || fill->paintUri != other->fill->paintUri | 200 || fill->paintUri != other->fill->paintUri |
201 || fill->opacity != other->fill->opacity) | 201 || fill->opacity != other->fill->opacity) |
202 return true; | 202 return true; |
203 } | 203 } |
204 | 204 |
205 // If gradient stops change, we just need to repaint. Style updates are alre
ady handled through RenderSVGGradientSTop. | 205 // If gradient stops change, we just need to issue paint invalidations. Styl
e updates are already handled through RenderSVGGradientSTop. |
206 if (stops != other->stops) | 206 if (stops != other->stops) |
207 return true; | 207 return true; |
208 | 208 |
209 // Changes of these flags only cause repaints. | 209 // Changes of these flags only cause paint invalidations. |
210 if (svg_inherited_flags._colorRendering != other->svg_inherited_flags._color
Rendering | 210 if (svg_inherited_flags._colorRendering != other->svg_inherited_flags._color
Rendering |
211 || svg_inherited_flags._shapeRendering != other->svg_inherited_flags._sh
apeRendering | 211 || svg_inherited_flags._shapeRendering != other->svg_inherited_flags._sh
apeRendering |
212 || svg_inherited_flags._clipRule != other->svg_inherited_flags._clipRule | 212 || svg_inherited_flags._clipRule != other->svg_inherited_flags._clipRule |
213 || svg_inherited_flags._fillRule != other->svg_inherited_flags._fillRule | 213 || svg_inherited_flags._fillRule != other->svg_inherited_flags._fillRule |
214 || svg_inherited_flags._colorInterpolation != other->svg_inherited_flags
._colorInterpolation | 214 || svg_inherited_flags._colorInterpolation != other->svg_inherited_flags
._colorInterpolation |
215 || svg_inherited_flags._colorInterpolationFilters != other->svg_inherite
d_flags._colorInterpolationFilters | 215 || svg_inherited_flags._colorInterpolationFilters != other->svg_inherite
d_flags._colorInterpolationFilters |
216 || svg_inherited_flags._paintOrder != other->svg_inherited_flags._paintO
rder) | 216 || svg_inherited_flags._paintOrder != other->svg_inherited_flags._paintO
rder) |
217 return true; | 217 return true; |
218 | 218 |
219 if (svg_noninherited_flags.f.bufferedRendering != other->svg_noninherited_fl
ags.f.bufferedRendering) | 219 if (svg_noninherited_flags.f.bufferedRendering != other->svg_noninherited_fl
ags.f.bufferedRendering) |
220 return true; | 220 return true; |
221 | 221 |
222 if (svg_noninherited_flags.f.maskType != other->svg_noninherited_flags.f.mas
kType) | 222 if (svg_noninherited_flags.f.maskType != other->svg_noninherited_flags.f.mas
kType) |
223 return true; | 223 return true; |
224 | 224 |
225 return false; | 225 return false; |
226 } | 226 } |
227 | 227 |
228 EPaintOrderType SVGRenderStyle::paintOrderType(unsigned index) const | 228 EPaintOrderType SVGRenderStyle::paintOrderType(unsigned index) const |
229 { | 229 { |
230 ASSERT(index < ((1 << kPaintOrderBitwidth)-1)); | 230 ASSERT(index < ((1 << kPaintOrderBitwidth)-1)); |
231 unsigned pt = (paintOrder() >> (kPaintOrderBitwidth*index)) & ((1u << kPaint
OrderBitwidth) - 1); | 231 unsigned pt = (paintOrder() >> (kPaintOrderBitwidth*index)) & ((1u << kPaint
OrderBitwidth) - 1); |
232 return (EPaintOrderType)pt; | 232 return (EPaintOrderType)pt; |
233 } | 233 } |
234 | 234 |
235 } | 235 } |
OLD | NEW |