OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 static_assert(sizeof(BorderValue) == sizeof(SameSizeAsBorderValue), "BorderValue
should stay small"); | 65 static_assert(sizeof(BorderValue) == sizeof(SameSizeAsBorderValue), "BorderValue
should stay small"); |
66 | 66 |
67 struct SameSizeAsComputedStyle : public RefCounted<SameSizeAsComputedStyle> { | 67 struct SameSizeAsComputedStyle : public RefCounted<SameSizeAsComputedStyle> { |
68 void* dataRefs[7]; | 68 void* dataRefs[7]; |
69 void* ownPtrs[1]; | 69 void* ownPtrs[1]; |
70 void* dataRefSvgStyle; | 70 void* dataRefSvgStyle; |
71 | 71 |
72 struct InheritedData { | 72 struct InheritedData { |
73 unsigned m_bitfields[2]; | 73 unsigned m_bitfields[2]; |
74 } inherited_data; | 74 } m_inheritedData; |
75 | 75 |
76 struct NonInheritedData { | 76 struct NonInheritedData { |
77 unsigned m_bitfields[3]; | 77 unsigned m_bitfields[3]; |
78 } noninherited_data; | 78 } m_nonInheritedData; |
79 }; | 79 }; |
80 | 80 |
81 static_assert(sizeof(ComputedStyle) == sizeof(SameSizeAsComputedStyle), "Compute
dStyle should stay small"); | 81 static_assert(sizeof(ComputedStyle) == sizeof(SameSizeAsComputedStyle), "Compute
dStyle should stay small"); |
82 | 82 |
83 PassRefPtr<ComputedStyle> ComputedStyle::create() | 83 PassRefPtr<ComputedStyle> ComputedStyle::create() |
84 { | 84 { |
85 return adoptRef(new ComputedStyle()); | 85 return adoptRef(new ComputedStyle()); |
86 } | 86 } |
87 | 87 |
88 PassRefPtr<ComputedStyle> ComputedStyle::createInitialStyle() | 88 PassRefPtr<ComputedStyle> ComputedStyle::createInitialStyle() |
(...skipping 15 matching lines...) Expand all Loading... |
104 return newStyle; | 104 return newStyle; |
105 } | 105 } |
106 | 106 |
107 PassRefPtr<ComputedStyle> ComputedStyle::clone(const ComputedStyle& other) | 107 PassRefPtr<ComputedStyle> ComputedStyle::clone(const ComputedStyle& other) |
108 { | 108 { |
109 return adoptRef(new ComputedStyle(other)); | 109 return adoptRef(new ComputedStyle(other)); |
110 } | 110 } |
111 | 111 |
112 ALWAYS_INLINE ComputedStyle::ComputedStyle() | 112 ALWAYS_INLINE ComputedStyle::ComputedStyle() |
113 : m_box(initialStyle().m_box) | 113 : m_box(initialStyle().m_box) |
114 , visual(initialStyle().visual) | 114 , m_visual(initialStyle().m_visual) |
115 , m_background(initialStyle().m_background) | 115 , m_background(initialStyle().m_background) |
116 , surround(initialStyle().surround) | 116 , m_surround(initialStyle().m_surround) |
117 , rareNonInheritedData(initialStyle().rareNonInheritedData) | 117 , m_rareNonInheritedData(initialStyle().m_rareNonInheritedData) |
118 , rareInheritedData(initialStyle().rareInheritedData) | 118 , m_rareInheritedData(initialStyle().m_rareInheritedData) |
119 , inherited(initialStyle().inherited) | 119 , m_styleInheritedData(initialStyle().m_styleInheritedData) |
120 , m_svgStyle(initialStyle().m_svgStyle) | 120 , m_svgStyle(initialStyle().m_svgStyle) |
121 { | 121 { |
122 setBitDefaults(); // Would it be faster to copy this from the default style? | 122 setBitDefaults(); // Would it be faster to copy this from the default style? |
123 static_assert((sizeof(InheritedData) <= 8), "InheritedData should not grow")
; | 123 static_assert((sizeof(InheritedData) <= 8), "InheritedData should not grow")
; |
124 static_assert((sizeof(NonInheritedData) <= 12), "NonInheritedData should not
grow"); | 124 static_assert((sizeof(NonInheritedData) <= 12), "NonInheritedData should not
grow"); |
125 } | 125 } |
126 | 126 |
127 ALWAYS_INLINE ComputedStyle::ComputedStyle(InitialStyleTag) | 127 ALWAYS_INLINE ComputedStyle::ComputedStyle(InitialStyleTag) |
128 { | 128 { |
129 setBitDefaults(); | 129 setBitDefaults(); |
130 | 130 |
131 m_box.init(); | 131 m_box.init(); |
132 visual.init(); | 132 m_visual.init(); |
133 m_background.init(); | 133 m_background.init(); |
134 surround.init(); | 134 m_surround.init(); |
135 rareNonInheritedData.init(); | 135 m_rareNonInheritedData.init(); |
136 rareNonInheritedData.access()->m_deprecatedFlexibleBox.init(); | 136 m_rareNonInheritedData.access()->m_deprecatedFlexibleBox.init(); |
137 rareNonInheritedData.access()->m_flexibleBox.init(); | 137 m_rareNonInheritedData.access()->m_flexibleBox.init(); |
138 rareNonInheritedData.access()->m_multiCol.init(); | 138 m_rareNonInheritedData.access()->m_multiCol.init(); |
139 rareNonInheritedData.access()->m_transform.init(); | 139 m_rareNonInheritedData.access()->m_transform.init(); |
140 rareNonInheritedData.access()->m_willChange.init(); | 140 m_rareNonInheritedData.access()->m_willChange.init(); |
141 rareNonInheritedData.access()->m_filter.init(); | 141 m_rareNonInheritedData.access()->m_filter.init(); |
142 rareNonInheritedData.access()->m_backdropFilter.init(); | 142 m_rareNonInheritedData.access()->m_backdropFilter.init(); |
143 rareNonInheritedData.access()->m_grid.init(); | 143 m_rareNonInheritedData.access()->m_grid.init(); |
144 rareNonInheritedData.access()->m_gridItem.init(); | 144 m_rareNonInheritedData.access()->m_gridItem.init(); |
145 rareNonInheritedData.access()->m_scrollSnap.init(); | 145 m_rareNonInheritedData.access()->m_scrollSnap.init(); |
146 rareInheritedData.init(); | 146 m_rareInheritedData.init(); |
147 inherited.init(); | 147 m_styleInheritedData.init(); |
148 m_svgStyle.init(); | 148 m_svgStyle.init(); |
149 } | 149 } |
150 | 150 |
151 ALWAYS_INLINE ComputedStyle::ComputedStyle(const ComputedStyle& o) | 151 ALWAYS_INLINE ComputedStyle::ComputedStyle(const ComputedStyle& o) |
152 : RefCounted<ComputedStyle>() | 152 : RefCounted<ComputedStyle>() |
153 , m_box(o.m_box) | 153 , m_box(o.m_box) |
154 , visual(o.visual) | 154 , m_visual(o.m_visual) |
155 , m_background(o.m_background) | 155 , m_background(o.m_background) |
156 , surround(o.surround) | 156 , m_surround(o.m_surround) |
157 , rareNonInheritedData(o.rareNonInheritedData) | 157 , m_rareNonInheritedData(o.m_rareNonInheritedData) |
158 , rareInheritedData(o.rareInheritedData) | 158 , m_rareInheritedData(o.m_rareInheritedData) |
159 , inherited(o.inherited) | 159 , m_styleInheritedData(o.m_styleInheritedData) |
160 , m_svgStyle(o.m_svgStyle) | 160 , m_svgStyle(o.m_svgStyle) |
161 , inherited_data(o.inherited_data) | 161 , m_inheritedData(o.m_inheritedData) |
162 , noninherited_data(o.noninherited_data) | 162 , m_nonInheritedData(o.m_nonInheritedData) |
163 { | 163 { |
164 } | 164 } |
165 | 165 |
166 static StyleRecalcChange diffPseudoStyles(const ComputedStyle& oldStyle, const C
omputedStyle& newStyle) | 166 static StyleRecalcChange diffPseudoStyles(const ComputedStyle& oldStyle, const C
omputedStyle& newStyle) |
167 { | 167 { |
168 // If the pseudoStyles have changed, we want any StyleRecalcChange that is n
ot NoChange | 168 // If the pseudoStyles have changed, we want any StyleRecalcChange that is n
ot NoChange |
169 // because setStyle will do the right thing with anything else. | 169 // because setStyle will do the right thing with anything else. |
170 if (!oldStyle.hasAnyPublicPseudoStyles()) | 170 if (!oldStyle.hasAnyPublicPseudoStyles()) |
171 return NoChange; | 171 return NoChange; |
172 for (PseudoId pseudoId = FirstPublicPseudoId; pseudoId < FirstInternalPseudo
Id; pseudoId = static_cast<PseudoId>(pseudoId + 1)) { | 172 for (PseudoId pseudoId = FirstPublicPseudoId; pseudoId < FirstInternalPseudo
Id; pseudoId = static_cast<PseudoId>(pseudoId + 1)) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 ContentDistributionType ComputedStyle::resolvedAlignContentDistribution(const St
yleContentAlignmentData& normalValueBehavior) const | 264 ContentDistributionType ComputedStyle::resolvedAlignContentDistribution(const St
yleContentAlignmentData& normalValueBehavior) const |
265 { | 265 { |
266 return resolvedContentAlignmentDistribution(alignContent(), normalValueBehav
ior); | 266 return resolvedContentAlignmentDistribution(alignContent(), normalValueBehav
ior); |
267 } | 267 } |
268 | 268 |
269 void ComputedStyle::inheritFrom(const ComputedStyle& inheritParent, IsAtShadowBo
undary isAtShadowBoundary) | 269 void ComputedStyle::inheritFrom(const ComputedStyle& inheritParent, IsAtShadowBo
undary isAtShadowBoundary) |
270 { | 270 { |
271 if (isAtShadowBoundary == AtShadowBoundary) { | 271 if (isAtShadowBoundary == AtShadowBoundary) { |
272 // Even if surrounding content is user-editable, shadow DOM should act a
s a single unit, and not necessarily be editable | 272 // Even if surrounding content is user-editable, shadow DOM should act a
s a single unit, and not necessarily be editable |
273 EUserModify currentUserModify = userModify(); | 273 EUserModify currentUserModify = userModify(); |
274 rareInheritedData = inheritParent.rareInheritedData; | 274 m_rareInheritedData = inheritParent.m_rareInheritedData; |
275 setUserModify(currentUserModify); | 275 setUserModify(currentUserModify); |
276 } else { | 276 } else { |
277 rareInheritedData = inheritParent.rareInheritedData; | 277 m_rareInheritedData = inheritParent.m_rareInheritedData; |
278 } | 278 } |
279 inherited = inheritParent.inherited; | 279 m_styleInheritedData = inheritParent.m_styleInheritedData; |
280 inherited_data = inheritParent.inherited_data; | 280 m_inheritedData = inheritParent.m_inheritedData; |
281 if (m_svgStyle != inheritParent.m_svgStyle) | 281 if (m_svgStyle != inheritParent.m_svgStyle) |
282 m_svgStyle.access()->inheritFrom(inheritParent.m_svgStyle.get()); | 282 m_svgStyle.access()->inheritFrom(inheritParent.m_svgStyle.get()); |
283 } | 283 } |
284 | 284 |
285 void ComputedStyle::copyNonInheritedFromCached(const ComputedStyle& other) | 285 void ComputedStyle::copyNonInheritedFromCached(const ComputedStyle& other) |
286 { | 286 { |
287 m_box = other.m_box; | 287 m_box = other.m_box; |
288 visual = other.visual; | 288 m_visual = other.m_visual; |
289 m_background = other.m_background; | 289 m_background = other.m_background; |
290 surround = other.surround; | 290 m_surround = other.m_surround; |
291 rareNonInheritedData = other.rareNonInheritedData; | 291 m_rareNonInheritedData = other.m_rareNonInheritedData; |
292 | 292 |
293 // The flags are copied one-by-one because noninherited_data.m_contains a bu
nch of stuff other than real style data. | 293 // The flags are copied one-by-one because m_nonInheritedData.m_contains a b
unch of stuff other than real style data. |
294 // See comments for each skipped flag below. | 294 // See comments for each skipped flag below. |
295 noninherited_data.m_effectiveDisplay = other.noninherited_data.m_effectiveDi
splay; | 295 m_nonInheritedData.m_effectiveDisplay = other.m_nonInheritedData.m_effective
Display; |
296 noninherited_data.m_originalDisplay = other.noninherited_data.m_originalDisp
lay; | 296 m_nonInheritedData.m_originalDisplay = other.m_nonInheritedData.m_originalDi
splay; |
297 noninherited_data.m_overflowX = other.noninherited_data.m_overflowX; | 297 m_nonInheritedData.m_overflowX = other.m_nonInheritedData.m_overflowX; |
298 noninherited_data.m_overflowY = other.noninherited_data.m_overflowY; | 298 m_nonInheritedData.m_overflowY = other.m_nonInheritedData.m_overflowY; |
299 noninherited_data.m_verticalAlign = other.noninherited_data.m_verticalAlign; | 299 m_nonInheritedData.m_verticalAlign = other.m_nonInheritedData.m_verticalAlig
n; |
300 noninherited_data.m_clear = other.noninherited_data.m_clear; | 300 m_nonInheritedData.m_clear = other.m_nonInheritedData.m_clear; |
301 noninherited_data.m_position = other.noninherited_data.m_position; | 301 m_nonInheritedData.m_position = other.m_nonInheritedData.m_position; |
302 noninherited_data.m_floating = other.noninherited_data.m_floating; | 302 m_nonInheritedData.m_floating = other.m_nonInheritedData.m_floating; |
303 noninherited_data.m_tableLayout = other.noninherited_data.m_tableLayout; | 303 m_nonInheritedData.m_tableLayout = other.m_nonInheritedData.m_tableLayout; |
304 noninherited_data.m_unicodeBidi = other.noninherited_data.m_unicodeBidi; | 304 m_nonInheritedData.m_unicodeBidi = other.m_nonInheritedData.m_unicodeBidi; |
305 noninherited_data.m_hasViewportUnits = other.noninherited_data.m_hasViewport
Units; | 305 m_nonInheritedData.m_hasViewportUnits = other.m_nonInheritedData.m_hasViewpo
rtUnits; |
306 noninherited_data.m_breakBefore = other.noninherited_data.m_breakBefore; | 306 m_nonInheritedData.m_breakBefore = other.m_nonInheritedData.m_breakBefore; |
307 noninherited_data.m_breakAfter = other.noninherited_data.m_breakAfter; | 307 m_nonInheritedData.m_breakAfter = other.m_nonInheritedData.m_breakAfter; |
308 noninherited_data.m_breakInside = other.noninherited_data.m_breakInside; | 308 m_nonInheritedData.m_breakInside = other.m_nonInheritedData.m_breakInside; |
309 noninherited_data.m_hasRemUnits = other.noninherited_data.m_hasRemUnits; | 309 m_nonInheritedData.m_hasRemUnits = other.m_nonInheritedData.m_hasRemUnits; |
310 | 310 |
311 // Correctly set during selector matching: | 311 // Correctly set during selector matching: |
312 // noninherited_data.m_styleType | 312 // m_nonInheritedData.m_styleType |
313 // noninherited_data.m_pseudoBits | 313 // m_nonInheritedData.m_pseudoBits |
314 | 314 |
315 // Set correctly while computing style for children: | 315 // Set correctly while computing style for children: |
316 // noninherited_data.m_explicitInheritance | 316 // m_nonInheritedData.m_explicitInheritance |
317 | 317 |
318 // unique() styles are not cacheable. | 318 // unique() styles are not cacheable. |
319 DCHECK(!other.noninherited_data.m_unique); | 319 DCHECK(!other.m_nonInheritedData.m_unique); |
320 | 320 |
321 // styles with non inherited properties that reference variables are not | 321 // styles with non inherited properties that reference variables are not |
322 // cacheable. | 322 // cacheable. |
323 DCHECK(!other.noninherited_data.m_variableReference); | 323 DCHECK(!other.m_nonInheritedData.m_variableReference); |
324 | 324 |
325 // The following flags are set during matching before we decide that we get
a | 325 // The following flags are set during matching before we decide that we get
a |
326 // match in the MatchedPropertiesCache which in turn calls this method. The | 326 // match in the MatchedPropertiesCache which in turn calls this method. The |
327 // reason why we don't copy these flags is that they're already correctly se
t | 327 // reason why we don't copy these flags is that they're already correctly se
t |
328 // and that they may differ between elements which have the same set of matc
hed | 328 // and that they may differ between elements which have the same set of matc
hed |
329 // properties. For instance, given the rule: | 329 // properties. For instance, given the rule: |
330 // | 330 // |
331 // :-webkit-any(:hover, :focus) { background-color: green }" | 331 // :-webkit-any(:hover, :focus) { background-color: green }" |
332 // | 332 // |
333 // A hovered element, and a focused element may use the same cached matched | 333 // A hovered element, and a focused element may use the same cached matched |
334 // properties here, but the affectedBy flags will be set differently based o
n | 334 // properties here, but the affectedBy flags will be set differently based o
n |
335 // the matching order of the :-webkit-any components. | 335 // the matching order of the :-webkit-any components. |
336 // | 336 // |
337 // noninherited_data.m_emptyState | 337 // m_nonInheritedData.m_emptyState |
338 // noninherited_data.m_affectedByFocus | 338 // m_nonInheritedData.m_affectedByFocus |
339 // noninherited_data.m_affectedByHover | 339 // m_nonInheritedData.m_affectedByHover |
340 // noninherited_data.m_affectedByActive | 340 // m_nonInheritedData.m_affectedByActive |
341 // noninherited_data.m_affectedByDrag | 341 // m_nonInheritedData.m_affectedByDrag |
342 // noninherited_data.m_isLink | 342 // m_nonInheritedData.m_isLink |
343 | 343 |
344 if (m_svgStyle != other.m_svgStyle) | 344 if (m_svgStyle != other.m_svgStyle) |
345 m_svgStyle.access()->copyNonInheritedFromCached(other.m_svgStyle.get()); | 345 m_svgStyle.access()->copyNonInheritedFromCached(other.m_svgStyle.get()); |
346 DCHECK_EQ(zoom(), initialZoom()); | 346 DCHECK_EQ(zoom(), initialZoom()); |
347 } | 347 } |
348 | 348 |
349 bool ComputedStyle::operator==(const ComputedStyle& o) const | 349 bool ComputedStyle::operator==(const ComputedStyle& o) const |
350 { | 350 { |
351 return inheritedEqual(o) | 351 return inheritedEqual(o) |
352 && nonInheritedEqual(o); | 352 && nonInheritedEqual(o); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 ComputedStyle* pseudoStyle = m_cachedPseudoStyles->at(i).get(); | 413 ComputedStyle* pseudoStyle = m_cachedPseudoStyles->at(i).get(); |
414 if (pseudoStyle->styleType() == pid) { | 414 if (pseudoStyle->styleType() == pid) { |
415 m_cachedPseudoStyles->remove(i); | 415 m_cachedPseudoStyles->remove(i); |
416 return; | 416 return; |
417 } | 417 } |
418 } | 418 } |
419 } | 419 } |
420 | 420 |
421 bool ComputedStyle::inheritedEqual(const ComputedStyle& other) const | 421 bool ComputedStyle::inheritedEqual(const ComputedStyle& other) const |
422 { | 422 { |
423 return inherited_data == other.inherited_data | 423 return m_inheritedData == other.m_inheritedData |
424 && inherited == other.inherited | 424 && m_styleInheritedData == other.m_styleInheritedData |
425 && m_svgStyle->inheritedEqual(*other.m_svgStyle) | 425 && m_svgStyle->inheritedEqual(*other.m_svgStyle) |
426 && rareInheritedData == other.rareInheritedData; | 426 && m_rareInheritedData == other.m_rareInheritedData; |
427 } | 427 } |
428 | 428 |
429 bool ComputedStyle::loadingCustomFontsEqual(const ComputedStyle& other) const | 429 bool ComputedStyle::loadingCustomFontsEqual(const ComputedStyle& other) const |
430 { | 430 { |
431 return font().loadingCustomFonts() == other.font().loadingCustomFonts(); | 431 return font().loadingCustomFonts() == other.font().loadingCustomFonts(); |
432 } | 432 } |
433 | 433 |
434 bool ComputedStyle::nonInheritedEqual(const ComputedStyle& other) const | 434 bool ComputedStyle::nonInheritedEqual(const ComputedStyle& other) const |
435 { | 435 { |
436 // compare everything except the pseudoStyle pointer | 436 // compare everything except the pseudoStyle pointer |
437 return noninherited_data == other.noninherited_data | 437 return m_nonInheritedData == other.m_nonInheritedData |
438 && m_box == other.m_box | 438 && m_box == other.m_box |
439 && visual == other.visual | 439 && m_visual == other.m_visual |
440 && m_background == other.m_background | 440 && m_background == other.m_background |
441 && surround == other.surround | 441 && m_surround == other.m_surround |
442 && rareNonInheritedData == other.rareNonInheritedData | 442 && m_rareNonInheritedData == other.m_rareNonInheritedData |
443 && m_svgStyle->nonInheritedEqual(*other.m_svgStyle); | 443 && m_svgStyle->nonInheritedEqual(*other.m_svgStyle); |
444 } | 444 } |
445 | 445 |
446 bool ComputedStyle::inheritedDataShared(const ComputedStyle& other) const | 446 bool ComputedStyle::inheritedDataShared(const ComputedStyle& other) const |
447 { | 447 { |
448 // This is a fast check that only looks if the data structures are shared. | 448 // This is a fast check that only looks if the data structures are shared. |
449 return inherited_data == other.inherited_data | 449 return m_inheritedData == other.m_inheritedData |
450 && inherited.get() == other.inherited.get() | 450 && m_styleInheritedData.get() == other.m_styleInheritedData.get() |
451 && m_svgStyle.get() == other.m_svgStyle.get() | 451 && m_svgStyle.get() == other.m_svgStyle.get() |
452 && rareInheritedData.get() == other.rareInheritedData.get(); | 452 && m_rareInheritedData.get() == other.m_rareInheritedData.get(); |
453 } | 453 } |
454 | 454 |
455 static bool dependenceOnContentHeightHasChanged(const ComputedStyle& a, const Co
mputedStyle& b) | 455 static bool dependenceOnContentHeightHasChanged(const ComputedStyle& a, const Co
mputedStyle& b) |
456 { | 456 { |
457 // If top or bottom become auto/non-auto then it means we either have to sol
ve height based | 457 // If top or bottom become auto/non-auto then it means we either have to sol
ve height based |
458 // on the content or stop doing so (http://www.w3.org/TR/CSS2/visudet.html#a
bs-non-replaced-height) | 458 // on the content or stop doing so (http://www.w3.org/TR/CSS2/visudet.html#a
bs-non-replaced-height) |
459 // - either way requires a layout. | 459 // - either way requires a layout. |
460 return a.logicalTop().isAuto() != b.logicalTop().isAuto() || a.logicalBottom
().isAuto() != b.logicalBottom().isAuto(); | 460 return a.logicalTop().isAuto() != b.logicalTop().isAuto() || a.logicalBottom
().isAuto() != b.logicalBottom().isAuto(); |
461 } | 461 } |
462 | 462 |
463 StyleDifference ComputedStyle::visualInvalidationDiff(const ComputedStyle& other
) const | 463 StyleDifference ComputedStyle::visualInvalidationDiff(const ComputedStyle& other
) const |
464 { | 464 { |
465 // Note, we use .get() on each DataRef below because DataRef::operator== wil
l do a deep | 465 // Note, we use .get() on each DataRef below because DataRef::operator== wil
l do a deep |
466 // compare, which is duplicate work when we're going to compare each propert
y inside | 466 // compare, which is duplicate work when we're going to compare each propert
y inside |
467 // this function anyway. | 467 // this function anyway. |
468 | 468 |
469 StyleDifference diff; | 469 StyleDifference diff; |
470 if (m_svgStyle.get() != other.m_svgStyle.get()) | 470 if (m_svgStyle.get() != other.m_svgStyle.get()) |
471 diff = m_svgStyle->diff(other.m_svgStyle.get()); | 471 diff = m_svgStyle->diff(other.m_svgStyle.get()); |
472 | 472 |
473 if ((!diff.needsFullLayout() || !diff.needsPaintInvalidation()) && diffNeeds
FullLayoutAndPaintInvalidation(other)) { | 473 if ((!diff.needsFullLayout() || !diff.needsPaintInvalidation()) && diffNeeds
FullLayoutAndPaintInvalidation(other)) { |
474 diff.setNeedsFullLayout(); | 474 diff.setNeedsFullLayout(); |
475 diff.setNeedsPaintInvalidationObject(); | 475 diff.setNeedsPaintInvalidationObject(); |
476 } | 476 } |
477 | 477 |
478 if (!diff.needsFullLayout() && diffNeedsFullLayout(other)) | 478 if (!diff.needsFullLayout() && diffNeedsFullLayout(other)) |
479 diff.setNeedsFullLayout(); | 479 diff.setNeedsFullLayout(); |
480 | 480 |
481 if (!diff.needsFullLayout() && surround->margin != other.surround->margin) { | 481 if (!diff.needsFullLayout() && m_surround->margin != other.m_surround->margi
n) { |
482 // Relative-positioned elements collapse their margins so need a full la
yout. | 482 // Relative-positioned elements collapse their margins so need a full la
yout. |
483 if (hasOutOfFlowPosition()) | 483 if (hasOutOfFlowPosition()) |
484 diff.setNeedsPositionedMovementLayout(); | 484 diff.setNeedsPositionedMovementLayout(); |
485 else | 485 else |
486 diff.setNeedsFullLayout(); | 486 diff.setNeedsFullLayout(); |
487 } | 487 } |
488 | 488 |
489 if (!diff.needsFullLayout() && position() != StaticPosition && surround->off
set != other.surround->offset) { | 489 if (!diff.needsFullLayout() && position() != StaticPosition && m_surround->o
ffset != other.m_surround->offset) { |
490 // Optimize for the case where a positioned layer is moving but not chan
ging size. | 490 // Optimize for the case where a positioned layer is moving but not chan
ging size. |
491 if (dependenceOnContentHeightHasChanged(*this, other)) | 491 if (dependenceOnContentHeightHasChanged(*this, other)) |
492 diff.setNeedsFullLayout(); | 492 diff.setNeedsFullLayout(); |
493 else | 493 else |
494 diff.setNeedsPositionedMovementLayout(); | 494 diff.setNeedsPositionedMovementLayout(); |
495 } | 495 } |
496 | 496 |
497 if (diffNeedsPaintInvalidationSubtree(other)) | 497 if (diffNeedsPaintInvalidationSubtree(other)) |
498 diff.setNeedsPaintInvalidationSubtree(); | 498 diff.setNeedsPaintInvalidationSubtree(); |
499 else if (diffNeedsPaintInvalidationObject(other)) | 499 else if (diffNeedsPaintInvalidationObject(other)) |
(...skipping 11 matching lines...) Expand all Loading... |
511 } | 511 } |
512 | 512 |
513 bool ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation(const ComputedStyle&
other) const | 513 bool ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation(const ComputedStyle&
other) const |
514 { | 514 { |
515 // FIXME: Not all cases in this method need both full layout and paint inval
idation. | 515 // FIXME: Not all cases in this method need both full layout and paint inval
idation. |
516 // Should move cases into diffNeedsFullLayout() if | 516 // Should move cases into diffNeedsFullLayout() if |
517 // - don't need paint invalidation at all; | 517 // - don't need paint invalidation at all; |
518 // - or the layoutObject knows how to exactly invalidate paints caused by th
e layout change | 518 // - or the layoutObject knows how to exactly invalidate paints caused by th
e layout change |
519 // instead of forced full paint invalidation. | 519 // instead of forced full paint invalidation. |
520 | 520 |
521 if (surround.get() != other.surround.get()) { | 521 if (m_surround.get() != other.m_surround.get()) { |
522 // If our border widths change, then we need to layout. Other changes to
borders only necessitate a paint invalidation. | 522 // If our border widths change, then we need to layout. Other changes to
borders only necessitate a paint invalidation. |
523 if (borderLeftWidth() != other.borderLeftWidth() | 523 if (borderLeftWidth() != other.borderLeftWidth() |
524 || borderTopWidth() != other.borderTopWidth() | 524 || borderTopWidth() != other.borderTopWidth() |
525 || borderBottomWidth() != other.borderBottomWidth() | 525 || borderBottomWidth() != other.borderBottomWidth() |
526 || borderRightWidth() != other.borderRightWidth()) | 526 || borderRightWidth() != other.borderRightWidth()) |
527 return true; | 527 return true; |
528 } | 528 } |
529 | 529 |
530 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { | 530 if (m_rareNonInheritedData.get() != other.m_rareNonInheritedData.get()) { |
531 if (rareNonInheritedData->m_appearance != other.rareNonInheritedData->m_
appearance | 531 if (m_rareNonInheritedData->m_appearance != other.m_rareNonInheritedData
->m_appearance |
532 || rareNonInheritedData->marginBeforeCollapse != other.rareNonInheri
tedData->marginBeforeCollapse | 532 || m_rareNonInheritedData->marginBeforeCollapse != other.m_rareNonIn
heritedData->marginBeforeCollapse |
533 || rareNonInheritedData->marginAfterCollapse != other.rareNonInherit
edData->marginAfterCollapse | 533 || m_rareNonInheritedData->marginAfterCollapse != other.m_rareNonInh
eritedData->marginAfterCollapse |
534 || rareNonInheritedData->lineClamp != other.rareNonInheritedData->li
neClamp | 534 || m_rareNonInheritedData->lineClamp != other.m_rareNonInheritedData
->lineClamp |
535 || rareNonInheritedData->textOverflow != other.rareNonInheritedData-
>textOverflow | 535 || m_rareNonInheritedData->textOverflow != other.m_rareNonInheritedD
ata->textOverflow |
536 || rareNonInheritedData->m_wrapFlow != other.rareNonInheritedData->m
_wrapFlow | 536 || m_rareNonInheritedData->m_wrapFlow != other.m_rareNonInheritedDat
a->m_wrapFlow |
537 || rareNonInheritedData->m_wrapThrough != other.rareNonInheritedData
->m_wrapThrough | 537 || m_rareNonInheritedData->m_wrapThrough != other.m_rareNonInherited
Data->m_wrapThrough |
538 || rareNonInheritedData->m_shapeMargin != other.rareNonInheritedData
->m_shapeMargin | 538 || m_rareNonInheritedData->m_shapeMargin != other.m_rareNonInherited
Data->m_shapeMargin |
539 || rareNonInheritedData->m_order != other.rareNonInheritedData->m_or
der | 539 || m_rareNonInheritedData->m_order != other.m_rareNonInheritedData->
m_order |
540 || rareNonInheritedData->m_grid.get() != other.rareNonInheritedData-
>m_grid.get() | 540 || m_rareNonInheritedData->m_grid.get() != other.m_rareNonInheritedD
ata->m_grid.get() |
541 || rareNonInheritedData->m_gridItem.get() != other.rareNonInheritedD
ata->m_gridItem.get() | 541 || m_rareNonInheritedData->m_gridItem.get() != other.m_rareNonInheri
tedData->m_gridItem.get() |
542 || rareNonInheritedData->hasFilters() != other.rareNonInheritedData-
>hasFilters()) | 542 || m_rareNonInheritedData->hasFilters() != other.m_rareNonInheritedD
ata->hasFilters()) |
543 return true; | 543 return true; |
544 | 544 |
545 if (rareNonInheritedData->m_deprecatedFlexibleBox.get() != other.rareNon
InheritedData->m_deprecatedFlexibleBox.get() | 545 if (m_rareNonInheritedData->m_deprecatedFlexibleBox.get() != other.m_rar
eNonInheritedData->m_deprecatedFlexibleBox.get() |
546 && *rareNonInheritedData->m_deprecatedFlexibleBox.get() != *other.ra
reNonInheritedData->m_deprecatedFlexibleBox.get()) | 546 && *m_rareNonInheritedData->m_deprecatedFlexibleBox.get() != *other.
m_rareNonInheritedData->m_deprecatedFlexibleBox.get()) |
547 return true; | 547 return true; |
548 | 548 |
549 if (rareNonInheritedData->m_flexibleBox.get() != other.rareNonInheritedD
ata->m_flexibleBox.get() | 549 if (m_rareNonInheritedData->m_flexibleBox.get() != other.m_rareNonInheri
tedData->m_flexibleBox.get() |
550 && *rareNonInheritedData->m_flexibleBox.get() != *other.rareNonInher
itedData->m_flexibleBox.get()) | 550 && *m_rareNonInheritedData->m_flexibleBox.get() != *other.m_rareNonI
nheritedData->m_flexibleBox.get()) |
551 return true; | 551 return true; |
552 | 552 |
553 if (rareNonInheritedData->m_multiCol.get() != other.rareNonInheritedData
->m_multiCol.get() | 553 if (m_rareNonInheritedData->m_multiCol.get() != other.m_rareNonInherited
Data->m_multiCol.get() |
554 && *rareNonInheritedData->m_multiCol.get() != *other.rareNonInherite
dData->m_multiCol.get()) | 554 && *m_rareNonInheritedData->m_multiCol.get() != *other.m_rareNonInhe
ritedData->m_multiCol.get()) |
555 return true; | 555 return true; |
556 | 556 |
557 // If the counter directives change, trigger a relayout to re-calculate
counter values and rebuild the counter node tree. | 557 // If the counter directives change, trigger a relayout to re-calculate
counter values and rebuild the counter node tree. |
558 const CounterDirectiveMap* mapA = rareNonInheritedData->m_counterDirecti
ves.get(); | 558 const CounterDirectiveMap* mapA = m_rareNonInheritedData->m_counterDirec
tives.get(); |
559 const CounterDirectiveMap* mapB = other.rareNonInheritedData->m_counterD
irectives.get(); | 559 const CounterDirectiveMap* mapB = other.m_rareNonInheritedData->m_counte
rDirectives.get(); |
560 if (!(mapA == mapB || (mapA && mapB && *mapA == *mapB))) | 560 if (!(mapA == mapB || (mapA && mapB && *mapA == *mapB))) |
561 return true; | 561 return true; |
562 | 562 |
563 // We only need do layout for opacity changes if adding or losing opacit
y could trigger a change | 563 // We only need do layout for opacity changes if adding or losing opacit
y could trigger a change |
564 // in us being a stacking context. | 564 // in us being a stacking context. |
565 if (isStackingContext() != other.isStackingContext() && rareNonInherited
Data->hasOpacity() != other.rareNonInheritedData->hasOpacity()) { | 565 if (isStackingContext() != other.isStackingContext() && m_rareNonInherit
edData->hasOpacity() != other.m_rareNonInheritedData->hasOpacity()) { |
566 // FIXME: We would like to use SimplifiedLayout here, but we can't q
uite do that yet. | 566 // FIXME: We would like to use SimplifiedLayout here, but we can't q
uite do that yet. |
567 // We need to make sure SimplifiedLayout can operate correctly on La
youtInlines (we will need | 567 // We need to make sure SimplifiedLayout can operate correctly on La
youtInlines (we will need |
568 // to add a selfNeedsSimplifiedLayout bit in order to not get confus
ed and taint every line). | 568 // to add a selfNeedsSimplifiedLayout bit in order to not get confus
ed and taint every line). |
569 // In addition we need to solve the floating object issue when layer
s come and go. Right now | 569 // In addition we need to solve the floating object issue when layer
s come and go. Right now |
570 // a full layout is necessary to keep floating object lists sane. | 570 // a full layout is necessary to keep floating object lists sane. |
571 return true; | 571 return true; |
572 } | 572 } |
573 } | 573 } |
574 | 574 |
575 if (rareInheritedData.get() != other.rareInheritedData.get()) { | 575 if (m_rareInheritedData.get() != other.m_rareInheritedData.get()) { |
576 if (rareInheritedData->highlight != other.rareInheritedData->highlight | 576 if (m_rareInheritedData->highlight != other.m_rareInheritedData->highlig
ht |
577 || rareInheritedData->indent != other.rareInheritedData->indent | 577 || m_rareInheritedData->indent != other.m_rareInheritedData->indent |
578 || rareInheritedData->m_textAlignLast != other.rareInheritedData->m_
textAlignLast | 578 || m_rareInheritedData->m_textAlignLast != other.m_rareInheritedData
->m_textAlignLast |
579 || rareInheritedData->m_textIndentLine != other.rareInheritedData->m
_textIndentLine | 579 || m_rareInheritedData->m_textIndentLine != other.m_rareInheritedDat
a->m_textIndentLine |
580 || rareInheritedData->m_effectiveZoom != other.rareInheritedData->m_
effectiveZoom | 580 || m_rareInheritedData->m_effectiveZoom != other.m_rareInheritedData
->m_effectiveZoom |
581 || rareInheritedData->wordBreak != other.rareInheritedData->wordBrea
k | 581 || m_rareInheritedData->wordBreak != other.m_rareInheritedData->word
Break |
582 || rareInheritedData->overflowWrap != other.rareInheritedData->overf
lowWrap | 582 || m_rareInheritedData->overflowWrap != other.m_rareInheritedData->o
verflowWrap |
583 || rareInheritedData->lineBreak != other.rareInheritedData->lineBrea
k | 583 || m_rareInheritedData->lineBreak != other.m_rareInheritedData->line
Break |
584 || rareInheritedData->textSecurity != other.rareInheritedData->textS
ecurity | 584 || m_rareInheritedData->textSecurity != other.m_rareInheritedData->t
extSecurity |
585 || rareInheritedData->hyphens != other.rareInheritedData->hyphens | 585 || m_rareInheritedData->hyphens != other.m_rareInheritedData->hyphen
s |
586 || rareInheritedData->hyphenationLimitBefore != other.rareInheritedD
ata->hyphenationLimitBefore | 586 || m_rareInheritedData->hyphenationLimitBefore != other.m_rareInheri
tedData->hyphenationLimitBefore |
587 || rareInheritedData->hyphenationLimitAfter != other.rareInheritedDa
ta->hyphenationLimitAfter | 587 || m_rareInheritedData->hyphenationLimitAfter != other.m_rareInherit
edData->hyphenationLimitAfter |
588 || rareInheritedData->hyphenationString != other.rareInheritedData->
hyphenationString | 588 || m_rareInheritedData->hyphenationString != other.m_rareInheritedDa
ta->hyphenationString |
589 || rareInheritedData->m_respectImageOrientation != other.rareInherit
edData->m_respectImageOrientation | 589 || m_rareInheritedData->m_respectImageOrientation != other.m_rareInh
eritedData->m_respectImageOrientation |
590 || rareInheritedData->m_rubyPosition != other.rareInheritedData->m_r
ubyPosition | 590 || m_rareInheritedData->m_rubyPosition != other.m_rareInheritedData-
>m_rubyPosition |
591 || rareInheritedData->textEmphasisMark != other.rareInheritedData->t
extEmphasisMark | 591 || m_rareInheritedData->textEmphasisMark != other.m_rareInheritedDat
a->textEmphasisMark |
592 || rareInheritedData->textEmphasisPosition != other.rareInheritedDat
a->textEmphasisPosition | 592 || m_rareInheritedData->textEmphasisPosition != other.m_rareInherite
dData->textEmphasisPosition |
593 || rareInheritedData->textEmphasisCustomMark != other.rareInheritedD
ata->textEmphasisCustomMark | 593 || m_rareInheritedData->textEmphasisCustomMark != other.m_rareInheri
tedData->textEmphasisCustomMark |
594 || rareInheritedData->m_textJustify != other.rareInheritedData->m_te
xtJustify | 594 || m_rareInheritedData->m_textJustify != other.m_rareInheritedData->
m_textJustify |
595 || rareInheritedData->m_textOrientation != other.rareInheritedData->
m_textOrientation | 595 || m_rareInheritedData->m_textOrientation != other.m_rareInheritedDa
ta->m_textOrientation |
596 || rareInheritedData->m_textCombine != other.rareInheritedData->m_te
xtCombine | 596 || m_rareInheritedData->m_textCombine != other.m_rareInheritedData->
m_textCombine |
597 || rareInheritedData->m_tabSize != other.rareInheritedData->m_tabSiz
e | 597 || m_rareInheritedData->m_tabSize != other.m_rareInheritedData->m_ta
bSize |
598 || rareInheritedData->m_textSizeAdjust != other.rareInheritedData->m
_textSizeAdjust | 598 || m_rareInheritedData->m_textSizeAdjust != other.m_rareInheritedDat
a->m_textSizeAdjust |
599 || rareInheritedData->listStyleImage != other.rareInheritedData->lis
tStyleImage | 599 || m_rareInheritedData->listStyleImage != other.m_rareInheritedData-
>listStyleImage |
600 || rareInheritedData->m_snapHeightUnit != other.rareInheritedData->m
_snapHeightUnit | 600 || m_rareInheritedData->m_snapHeightUnit != other.m_rareInheritedDat
a->m_snapHeightUnit |
601 || rareInheritedData->m_snapHeightPosition != other.rareInheritedDat
a->m_snapHeightPosition | 601 || m_rareInheritedData->m_snapHeightPosition != other.m_rareInherite
dData->m_snapHeightPosition |
602 || rareInheritedData->textStrokeWidth != other.rareInheritedData->te
xtStrokeWidth) | 602 || m_rareInheritedData->textStrokeWidth != other.m_rareInheritedData
->textStrokeWidth) |
603 return true; | 603 return true; |
604 | 604 |
605 if (!rareInheritedData->shadowDataEquivalent(*other.rareInheritedData.ge
t())) | 605 if (!m_rareInheritedData->shadowDataEquivalent(*other.m_rareInheritedDat
a.get())) |
606 return true; | 606 return true; |
607 | 607 |
608 if (!rareInheritedData->quotesDataEquivalent(*other.rareInheritedData.ge
t())) | 608 if (!m_rareInheritedData->quotesDataEquivalent(*other.m_rareInheritedDat
a.get())) |
609 return true; | 609 return true; |
610 } | 610 } |
611 | 611 |
612 if (inherited->textAutosizingMultiplier != other.inherited->textAutosizingMu
ltiplier) | 612 if (m_styleInheritedData->textAutosizingMultiplier != other.m_styleInherited
Data->textAutosizingMultiplier) |
613 return true; | 613 return true; |
614 | 614 |
615 if (inherited->font.loadingCustomFonts() != other.inherited->font.loadingCus
tomFonts()) | 615 if (m_styleInheritedData->font.loadingCustomFonts() != other.m_styleInherite
dData->font.loadingCustomFonts()) |
616 return true; | 616 return true; |
617 | 617 |
618 if (inherited.get() != other.inherited.get()) { | 618 if (m_styleInheritedData.get() != other.m_styleInheritedData.get()) { |
619 if (inherited->line_height != other.inherited->line_height | 619 if (m_styleInheritedData->line_height != other.m_styleInheritedData->lin
e_height |
620 || inherited->font != other.inherited->font | 620 || m_styleInheritedData->font != other.m_styleInheritedData->font |
621 || inherited->horizontal_border_spacing != other.inherited->horizont
al_border_spacing | 621 || m_styleInheritedData->horizontal_border_spacing != other.m_styleI
nheritedData->horizontal_border_spacing |
622 || inherited->vertical_border_spacing != other.inherited->vertical_b
order_spacing) | 622 || m_styleInheritedData->vertical_border_spacing != other.m_styleInh
eritedData->vertical_border_spacing) |
623 return true; | 623 return true; |
624 } | 624 } |
625 | 625 |
626 if (inherited_data.m_boxDirection != other.inherited_data.m_boxDirection | 626 if (m_inheritedData.m_boxDirection != other.m_inheritedData.m_boxDirection |
627 || inherited_data.m_rtlOrdering != other.inherited_data.m_rtlOrdering | 627 || m_inheritedData.m_rtlOrdering != other.m_inheritedData.m_rtlOrdering |
628 || inherited_data.m_textAlign != other.inherited_data.m_textAlign | 628 || m_inheritedData.m_textAlign != other.m_inheritedData.m_textAlign |
629 || inherited_data.m_textTransform != other.inherited_data.m_textTransfor
m | 629 || m_inheritedData.m_textTransform != other.m_inheritedData.m_textTransf
orm |
630 || inherited_data.m_direction != other.inherited_data.m_direction | 630 || m_inheritedData.m_direction != other.m_inheritedData.m_direction |
631 || inherited_data.m_whiteSpace != other.inherited_data.m_whiteSpace | 631 || m_inheritedData.m_whiteSpace != other.m_inheritedData.m_whiteSpace |
632 || inherited_data.m_writingMode != other.inherited_data.m_writingMode) | 632 || m_inheritedData.m_writingMode != other.m_inheritedData.m_writingMode) |
633 return true; | 633 return true; |
634 | 634 |
635 if (noninherited_data.m_overflowX != other.noninherited_data.m_overflowX | 635 if (m_nonInheritedData.m_overflowX != other.m_nonInheritedData.m_overflowX |
636 || noninherited_data.m_overflowY != other.noninherited_data.m_overflowY | 636 || m_nonInheritedData.m_overflowY != other.m_nonInheritedData.m_overflow
Y |
637 || noninherited_data.m_clear != other.noninherited_data.m_clear | 637 || m_nonInheritedData.m_clear != other.m_nonInheritedData.m_clear |
638 || noninherited_data.m_unicodeBidi != other.noninherited_data.m_unicodeB
idi | 638 || m_nonInheritedData.m_unicodeBidi != other.m_nonInheritedData.m_unicod
eBidi |
639 || noninherited_data.m_floating != other.noninherited_data.m_floating | 639 || m_nonInheritedData.m_floating != other.m_nonInheritedData.m_floating |
640 || noninherited_data.m_originalDisplay != other.noninherited_data.m_orig
inalDisplay) | 640 || m_nonInheritedData.m_originalDisplay != other.m_nonInheritedData.m_or
iginalDisplay) |
641 return true; | 641 return true; |
642 | 642 |
643 if (noninherited_data.m_effectiveDisplay >= FIRST_TABLE_DISPLAY && noninheri
ted_data.m_effectiveDisplay <= LAST_TABLE_DISPLAY) { | 643 if (m_nonInheritedData.m_effectiveDisplay >= FIRST_TABLE_DISPLAY && m_nonInh
eritedData.m_effectiveDisplay <= LAST_TABLE_DISPLAY) { |
644 if (inherited_data.m_borderCollapse != other.inherited_data.m_borderColl
apse | 644 if (m_inheritedData.m_borderCollapse != other.m_inheritedData.m_borderCo
llapse |
645 || inherited_data.m_emptyCells != other.inherited_data.m_emptyCells | 645 || m_inheritedData.m_emptyCells != other.m_inheritedData.m_emptyCell
s |
646 || inherited_data.m_captionSide != other.inherited_data.m_captionSid
e | 646 || m_inheritedData.m_captionSide != other.m_inheritedData.m_captionS
ide |
647 || noninherited_data.m_tableLayout != other.noninherited_data.m_tabl
eLayout) | 647 || m_nonInheritedData.m_tableLayout != other.m_nonInheritedData.m_ta
bleLayout) |
648 return true; | 648 return true; |
649 | 649 |
650 // In the collapsing border model, 'hidden' suppresses other borders, wh
ile 'none' | 650 // In the collapsing border model, 'hidden' suppresses other borders, wh
ile 'none' |
651 // does not, so these style differences can be width differences. | 651 // does not, so these style differences can be width differences. |
652 if (inherited_data.m_borderCollapse | 652 if (m_inheritedData.m_borderCollapse |
653 && ((borderTopStyle() == BorderStyleHidden && other.borderTopStyle()
== BorderStyleNone) | 653 && ((borderTopStyle() == BorderStyleHidden && other.borderTopStyle()
== BorderStyleNone) |
654 || (borderTopStyle() == BorderStyleNone && other.borderTopStyle(
) == BorderStyleHidden) | 654 || (borderTopStyle() == BorderStyleNone && other.borderTopStyle(
) == BorderStyleHidden) |
655 || (borderBottomStyle() == BorderStyleHidden && other.borderBott
omStyle() == BorderStyleNone) | 655 || (borderBottomStyle() == BorderStyleHidden && other.borderBott
omStyle() == BorderStyleNone) |
656 || (borderBottomStyle() == BorderStyleNone && other.borderBottom
Style() == BorderStyleHidden) | 656 || (borderBottomStyle() == BorderStyleNone && other.borderBottom
Style() == BorderStyleHidden) |
657 || (borderLeftStyle() == BorderStyleHidden && other.borderLeftSt
yle() == BorderStyleNone) | 657 || (borderLeftStyle() == BorderStyleHidden && other.borderLeftSt
yle() == BorderStyleNone) |
658 || (borderLeftStyle() == BorderStyleNone && other.borderLeftStyl
e() == BorderStyleHidden) | 658 || (borderLeftStyle() == BorderStyleNone && other.borderLeftStyl
e() == BorderStyleHidden) |
659 || (borderRightStyle() == BorderStyleHidden && other.borderRight
Style() == BorderStyleNone) | 659 || (borderRightStyle() == BorderStyleHidden && other.borderRight
Style() == BorderStyleNone) |
660 || (borderRightStyle() == BorderStyleNone && other.borderRightSt
yle() == BorderStyleHidden))) | 660 || (borderRightStyle() == BorderStyleNone && other.borderRightSt
yle() == BorderStyleHidden))) |
661 return true; | 661 return true; |
662 } else if (noninherited_data.m_effectiveDisplay == LIST_ITEM) { | 662 } else if (m_nonInheritedData.m_effectiveDisplay == LIST_ITEM) { |
663 if (inherited_data.m_listStyleType != other.inherited_data.m_listStyleTy
pe | 663 if (m_inheritedData.m_listStyleType != other.m_inheritedData.m_listStyle
Type |
664 || inherited_data.m_listStylePosition != other.inherited_data.m_list
StylePosition) | 664 || m_inheritedData.m_listStylePosition != other.m_inheritedData.m_li
stStylePosition) |
665 return true; | 665 return true; |
666 } | 666 } |
667 | 667 |
668 if ((visibility() == COLLAPSE) != (other.visibility() == COLLAPSE)) | 668 if ((visibility() == COLLAPSE) != (other.visibility() == COLLAPSE)) |
669 return true; | 669 return true; |
670 | 670 |
671 if (hasPseudoStyle(PseudoIdScrollbar) != other.hasPseudoStyle(PseudoIdScroll
bar)) | 671 if (hasPseudoStyle(PseudoIdScrollbar) != other.hasPseudoStyle(PseudoIdScroll
bar)) |
672 return true; | 672 return true; |
673 | 673 |
674 // Movement of non-static-positioned object is special cased in ComputedStyl
e::visualInvalidationDiff(). | 674 // Movement of non-static-positioned object is special cased in ComputedStyl
e::visualInvalidationDiff(). |
(...skipping 12 matching lines...) Expand all Loading... |
687 || m_box->maxHeight() != other.m_box->maxHeight()) | 687 || m_box->maxHeight() != other.m_box->maxHeight()) |
688 return true; | 688 return true; |
689 | 689 |
690 if (m_box->verticalAlign() != other.m_box->verticalAlign()) | 690 if (m_box->verticalAlign() != other.m_box->verticalAlign()) |
691 return true; | 691 return true; |
692 | 692 |
693 if (m_box->boxSizing() != other.m_box->boxSizing()) | 693 if (m_box->boxSizing() != other.m_box->boxSizing()) |
694 return true; | 694 return true; |
695 } | 695 } |
696 | 696 |
697 if (noninherited_data.m_verticalAlign != other.noninherited_data.m_verticalA
lign | 697 if (m_nonInheritedData.m_verticalAlign != other.m_nonInheritedData.m_vertica
lAlign |
698 || noninherited_data.m_position != other.noninherited_data.m_position) | 698 || m_nonInheritedData.m_position != other.m_nonInheritedData.m_position) |
699 return true; | 699 return true; |
700 | 700 |
701 if (surround.get() != other.surround.get()) { | 701 if (m_surround.get() != other.m_surround.get()) { |
702 if (surround->padding != other.surround->padding) | 702 if (m_surround->padding != other.m_surround->padding) |
703 return true; | 703 return true; |
704 } | 704 } |
705 | 705 |
706 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { | 706 if (m_rareNonInheritedData.get() != other.m_rareNonInheritedData.get()) { |
707 if (rareNonInheritedData->m_alignContent != other.rareNonInheritedData->
m_alignContent | 707 if (m_rareNonInheritedData->m_alignContent != other.m_rareNonInheritedDa
ta->m_alignContent |
708 || rareNonInheritedData->m_alignItems != other.rareNonInheritedData-
>m_alignItems | 708 || m_rareNonInheritedData->m_alignItems != other.m_rareNonInheritedD
ata->m_alignItems |
709 || rareNonInheritedData->m_alignSelf != other.rareNonInheritedData->
m_alignSelf | 709 || m_rareNonInheritedData->m_alignSelf != other.m_rareNonInheritedDa
ta->m_alignSelf |
710 || rareNonInheritedData->m_justifyContent != other.rareNonInheritedD
ata->m_justifyContent | 710 || m_rareNonInheritedData->m_justifyContent != other.m_rareNonInheri
tedData->m_justifyContent |
711 || rareNonInheritedData->m_justifyItems != other.rareNonInheritedDat
a->m_justifyItems | 711 || m_rareNonInheritedData->m_justifyItems != other.m_rareNonInherite
dData->m_justifyItems |
712 || rareNonInheritedData->m_justifySelf != other.rareNonInheritedData
->m_justifySelf | 712 || m_rareNonInheritedData->m_justifySelf != other.m_rareNonInherited
Data->m_justifySelf |
713 || rareNonInheritedData->m_contain != other.rareNonInheritedData->m_
contain) | 713 || m_rareNonInheritedData->m_contain != other.m_rareNonInheritedData
->m_contain) |
714 return true; | 714 return true; |
715 | 715 |
716 if (!RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && !rareNonInh
eritedData->reflectionDataEquivalent(*other.rareNonInheritedData.get())) | 716 if (!RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && !m_rareNonI
nheritedData->reflectionDataEquivalent(*other.m_rareNonInheritedData.get())) |
717 return true; | 717 return true; |
718 } | 718 } |
719 | 719 |
720 return false; | 720 return false; |
721 } | 721 } |
722 | 722 |
723 bool ComputedStyle::diffNeedsPaintInvalidationSubtree(const ComputedStyle& other
) const | 723 bool ComputedStyle::diffNeedsPaintInvalidationSubtree(const ComputedStyle& other
) const |
724 { | 724 { |
725 if (position() != StaticPosition && (visual->clip != other.visual->clip || v
isual->hasAutoClip != other.visual->hasAutoClip)) | 725 if (position() != StaticPosition && (m_visual->clip != other.m_visual->clip
|| m_visual->hasAutoClip != other.m_visual->hasAutoClip)) |
726 return true; | 726 return true; |
727 | 727 |
728 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { | 728 if (m_rareNonInheritedData.get() != other.m_rareNonInheritedData.get()) { |
729 if (rareNonInheritedData->m_effectiveBlendMode != other.rareNonInherited
Data->m_effectiveBlendMode | 729 if (m_rareNonInheritedData->m_effectiveBlendMode != other.m_rareNonInher
itedData->m_effectiveBlendMode |
730 || rareNonInheritedData->m_isolation != other.rareNonInheritedData->
m_isolation) | 730 || m_rareNonInheritedData->m_isolation != other.m_rareNonInheritedDa
ta->m_isolation) |
731 return true; | 731 return true; |
732 | 732 |
733 if (rareNonInheritedData->m_mask != other.rareNonInheritedData->m_mask | 733 if (m_rareNonInheritedData->m_mask != other.m_rareNonInheritedData->m_ma
sk |
734 || rareNonInheritedData->m_maskBoxImage != other.rareNonInheritedDat
a->m_maskBoxImage) | 734 || m_rareNonInheritedData->m_maskBoxImage != other.m_rareNonInherite
dData->m_maskBoxImage) |
735 return true; | 735 return true; |
736 | 736 |
737 if (!RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && !rareNonInh
eritedData->reflectionDataEquivalent(*other.rareNonInheritedData.get())) | 737 if (!RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && !m_rareNonI
nheritedData->reflectionDataEquivalent(*other.m_rareNonInheritedData.get())) |
738 return true; | 738 return true; |
739 } | 739 } |
740 | 740 |
741 return false; | 741 return false; |
742 } | 742 } |
743 | 743 |
744 bool ComputedStyle::diffNeedsPaintInvalidationObject(const ComputedStyle& other)
const | 744 bool ComputedStyle::diffNeedsPaintInvalidationObject(const ComputedStyle& other)
const |
745 { | 745 { |
746 if (!m_background->outline().visuallyEqual(other.m_background->outline())) | 746 if (!m_background->outline().visuallyEqual(other.m_background->outline())) |
747 return true; | 747 return true; |
748 | 748 |
749 if (inherited_data.m_visibility != other.inherited_data.m_visibility | 749 if (m_inheritedData.m_visibility != other.m_inheritedData.m_visibility |
750 || inherited_data.m_printColorAdjust != other.inherited_data.m_printColo
rAdjust | 750 || m_inheritedData.m_printColorAdjust != other.m_inheritedData.m_printCo
lorAdjust |
751 || inherited_data.m_insideLink != other.inherited_data.m_insideLink | 751 || m_inheritedData.m_insideLink != other.m_inheritedData.m_insideLink |
752 || !surround->border.visuallyEqual(other.surround->border) | 752 || !m_surround->border.visuallyEqual(other.m_surround->border) |
753 || !m_background->visuallyEqual(*other.m_background)) | 753 || !m_background->visuallyEqual(*other.m_background)) |
754 return true; | 754 return true; |
755 | 755 |
756 if (rareInheritedData.get() != other.rareInheritedData.get()) { | 756 if (m_rareInheritedData.get() != other.m_rareInheritedData.get()) { |
757 if (rareInheritedData->userModify != other.rareInheritedData->userModify | 757 if (m_rareInheritedData->userModify != other.m_rareInheritedData->userMo
dify |
758 || rareInheritedData->userSelect != other.rareInheritedData->userSel
ect | 758 || m_rareInheritedData->userSelect != other.m_rareInheritedData->use
rSelect |
759 || rareInheritedData->m_imageRendering != other.rareInheritedData->m
_imageRendering) | 759 || m_rareInheritedData->m_imageRendering != other.m_rareInheritedDat
a->m_imageRendering) |
760 return true; | 760 return true; |
761 } | 761 } |
762 | 762 |
763 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { | 763 if (m_rareNonInheritedData.get() != other.m_rareNonInheritedData.get()) { |
764 if (rareNonInheritedData->userDrag != other.rareNonInheritedData->userDr
ag | 764 if (m_rareNonInheritedData->userDrag != other.m_rareNonInheritedData->us
erDrag |
765 || rareNonInheritedData->m_objectFit != other.rareNonInheritedData->
m_objectFit | 765 || m_rareNonInheritedData->m_objectFit != other.m_rareNonInheritedDa
ta->m_objectFit |
766 || rareNonInheritedData->m_objectPosition != other.rareNonInheritedD
ata->m_objectPosition | 766 || m_rareNonInheritedData->m_objectPosition != other.m_rareNonInheri
tedData->m_objectPosition |
767 || !rareNonInheritedData->shadowDataEquivalent(*other.rareNonInherit
edData.get()) | 767 || !m_rareNonInheritedData->shadowDataEquivalent(*other.m_rareNonInh
eritedData.get()) |
768 || !rareNonInheritedData->shapeOutsideDataEquivalent(*other.rareNonI
nheritedData.get()) | 768 || !m_rareNonInheritedData->shapeOutsideDataEquivalent(*other.m_rare
NonInheritedData.get()) |
769 || !rareNonInheritedData->clipPathDataEquivalent(*other.rareNonInher
itedData.get()) | 769 || !m_rareNonInheritedData->clipPathDataEquivalent(*other.m_rareNonI
nheritedData.get()) |
770 || (visitedLinkBorderLeftColor() != other.visitedLinkBorderLeftColor
() && borderLeftWidth()) | 770 || (visitedLinkBorderLeftColor() != other.visitedLinkBorderLeftColor
() && borderLeftWidth()) |
771 || (visitedLinkBorderRightColor() != other.visitedLinkBorderRightCol
or() && borderRightWidth()) | 771 || (visitedLinkBorderRightColor() != other.visitedLinkBorderRightCol
or() && borderRightWidth()) |
772 || (visitedLinkBorderBottomColor() != other.visitedLinkBorderBottomC
olor() && borderBottomWidth()) | 772 || (visitedLinkBorderBottomColor() != other.visitedLinkBorderBottomC
olor() && borderBottomWidth()) |
773 || (visitedLinkBorderTopColor() != other.visitedLinkBorderTopColor()
&& borderTopWidth()) | 773 || (visitedLinkBorderTopColor() != other.visitedLinkBorderTopColor()
&& borderTopWidth()) |
774 || (visitedLinkOutlineColor() != other.visitedLinkOutlineColor() &&
outlineWidth()) | 774 || (visitedLinkOutlineColor() != other.visitedLinkOutlineColor() &&
outlineWidth()) |
775 || (visitedLinkBackgroundColor() != other.visitedLinkBackgroundColor
())) | 775 || (visitedLinkBackgroundColor() != other.visitedLinkBackgroundColor
())) |
776 return true; | 776 return true; |
777 } | 777 } |
778 | 778 |
779 if (resize() != other.resize()) | 779 if (resize() != other.resize()) |
780 return true; | 780 return true; |
781 | 781 |
782 if (rareNonInheritedData->m_paintImages) { | 782 if (m_rareNonInheritedData->m_paintImages) { |
783 for (const auto& image : *rareNonInheritedData->m_paintImages) { | 783 for (const auto& image : *m_rareNonInheritedData->m_paintImages) { |
784 if (diffNeedsPaintInvalidationObjectForPaintImage(image, other)) | 784 if (diffNeedsPaintInvalidationObjectForPaintImage(image, other)) |
785 return true; | 785 return true; |
786 } | 786 } |
787 } | 787 } |
788 | 788 |
789 return false; | 789 return false; |
790 } | 790 } |
791 | 791 |
792 bool ComputedStyle::diffNeedsPaintInvalidationObjectForPaintImage(const StyleIma
ge* image, const ComputedStyle& other) const | 792 bool ComputedStyle::diffNeedsPaintInvalidationObjectForPaintImage(const StyleIma
ge* image, const ComputedStyle& other) const |
793 { | 793 { |
(...skipping 23 matching lines...) Expand all Loading... |
817 } | 817 } |
818 | 818 |
819 return false; | 819 return false; |
820 } | 820 } |
821 | 821 |
822 void ComputedStyle::updatePropertySpecificDifferences(const ComputedStyle& other
, StyleDifference& diff) const | 822 void ComputedStyle::updatePropertySpecificDifferences(const ComputedStyle& other
, StyleDifference& diff) const |
823 { | 823 { |
824 if (m_box->zIndex() != other.m_box->zIndex() || isStackingContext() != other
.isStackingContext()) | 824 if (m_box->zIndex() != other.m_box->zIndex() || isStackingContext() != other
.isStackingContext()) |
825 diff.setZIndexChanged(); | 825 diff.setZIndexChanged(); |
826 | 826 |
827 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { | 827 if (m_rareNonInheritedData.get() != other.m_rareNonInheritedData.get()) { |
828 if (!transformDataEquivalent(other)) | 828 if (!transformDataEquivalent(other)) |
829 diff.setTransformChanged(); | 829 diff.setTransformChanged(); |
830 | 830 |
831 if (rareNonInheritedData->opacity != other.rareNonInheritedData->opacity
) | 831 if (m_rareNonInheritedData->opacity != other.m_rareNonInheritedData->opa
city) |
832 diff.setOpacityChanged(); | 832 diff.setOpacityChanged(); |
833 | 833 |
834 if (rareNonInheritedData->m_filter != other.rareNonInheritedData->m_filt
er) | 834 if (m_rareNonInheritedData->m_filter != other.m_rareNonInheritedData->m_
filter) |
835 diff.setFilterChanged(); | 835 diff.setFilterChanged(); |
836 | 836 |
837 if (!rareNonInheritedData->shadowDataEquivalent(*other.rareNonInheritedD
ata.get())) | 837 if (!m_rareNonInheritedData->shadowDataEquivalent(*other.m_rareNonInheri
tedData.get())) |
838 diff.setNeedsRecomputeOverflow(); | 838 diff.setNeedsRecomputeOverflow(); |
839 | 839 |
840 if (rareNonInheritedData->m_backdropFilter != other.rareNonInheritedData
->m_backdropFilter) | 840 if (m_rareNonInheritedData->m_backdropFilter != other.m_rareNonInherited
Data->m_backdropFilter) |
841 diff.setBackdropFilterChanged(); | 841 diff.setBackdropFilterChanged(); |
842 | 842 |
843 if (RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && !rareNonInhe
ritedData->reflectionDataEquivalent(*other.rareNonInheritedData.get())) | 843 if (RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && !m_rareNonIn
heritedData->reflectionDataEquivalent(*other.m_rareNonInheritedData.get())) |
844 diff.setFilterChanged(); | 844 diff.setFilterChanged(); |
845 } | 845 } |
846 | 846 |
847 if (!m_background->outline().visuallyEqual(other.m_background->outline()) ||
!surround->border.visualOverflowEqual(other.surround->border)) | 847 if (!m_background->outline().visuallyEqual(other.m_background->outline()) ||
!m_surround->border.visualOverflowEqual(other.m_surround->border)) |
848 diff.setNeedsRecomputeOverflow(); | 848 diff.setNeedsRecomputeOverflow(); |
849 | 849 |
850 if (!diff.needsPaintInvalidation()) { | 850 if (!diff.needsPaintInvalidation()) { |
851 if (inherited->color != other.inherited->color | 851 if (m_styleInheritedData->color != other.m_styleInheritedData->color |
852 || inherited->visitedLinkColor != other.inherited->visitedLinkColor | 852 || m_styleInheritedData->visitedLinkColor != other.m_styleInheritedD
ata->visitedLinkColor |
853 || inherited_data.m_textUnderline != other.inherited_data.m_textUnde
rline | 853 || m_inheritedData.m_textUnderline != other.m_inheritedData.m_textUn
derline |
854 || visual->textDecoration != other.visual->textDecoration) { | 854 || m_visual->textDecoration != other.m_visual->textDecoration) { |
855 diff.setTextDecorationOrColorChanged(); | 855 diff.setTextDecorationOrColorChanged(); |
856 } else if (rareNonInheritedData.get() != other.rareNonInheritedData.get(
) | 856 } else if (m_rareNonInheritedData.get() != other.m_rareNonInheritedData.
get() |
857 && (rareNonInheritedData->m_textDecorationStyle != other.rareNonInhe
ritedData->m_textDecorationStyle | 857 && (m_rareNonInheritedData->m_textDecorationStyle != other.m_rareNon
InheritedData->m_textDecorationStyle |
858 || rareNonInheritedData->m_textDecorationColor != other.rareNonI
nheritedData->m_textDecorationColor | 858 || m_rareNonInheritedData->m_textDecorationColor != other.m_rare
NonInheritedData->m_textDecorationColor |
859 || rareNonInheritedData->m_visitedLinkTextDecorationColor != oth
er.rareNonInheritedData->m_visitedLinkTextDecorationColor)) { | 859 || m_rareNonInheritedData->m_visitedLinkTextDecorationColor != o
ther.m_rareNonInheritedData->m_visitedLinkTextDecorationColor)) { |
860 diff.setTextDecorationOrColorChanged(); | 860 diff.setTextDecorationOrColorChanged(); |
861 } else if (rareInheritedData.get() != other.rareInheritedData.get() | 861 } else if (m_rareInheritedData.get() != other.m_rareInheritedData.get() |
862 && (rareInheritedData->textFillColor() != other.rareInheritedData->t
extFillColor() | 862 && (m_rareInheritedData->textFillColor() != other.m_rareInheritedDat
a->textFillColor() |
863 || rareInheritedData->textStrokeColor() != other.rareInheritedDa
ta->textStrokeColor() | 863 || m_rareInheritedData->textStrokeColor() != other.m_rareInherit
edData->textStrokeColor() |
864 || rareInheritedData->textEmphasisColor() != other.rareInherited
Data->textEmphasisColor() | 864 || m_rareInheritedData->textEmphasisColor() != other.m_rareInher
itedData->textEmphasisColor() |
865 || rareInheritedData->visitedLinkTextFillColor() != other.rareIn
heritedData->visitedLinkTextFillColor() | 865 || m_rareInheritedData->visitedLinkTextFillColor() != other.m_ra
reInheritedData->visitedLinkTextFillColor() |
866 || rareInheritedData->visitedLinkTextStrokeColor() != other.rare
InheritedData->visitedLinkTextStrokeColor() | 866 || m_rareInheritedData->visitedLinkTextStrokeColor() != other.m_
rareInheritedData->visitedLinkTextStrokeColor() |
867 || rareInheritedData->visitedLinkTextEmphasisColor() != other.ra
reInheritedData->visitedLinkTextEmphasisColor() | 867 || m_rareInheritedData->visitedLinkTextEmphasisColor() != other.
m_rareInheritedData->visitedLinkTextEmphasisColor() |
868 || rareInheritedData->textEmphasisFill != other.rareInheritedDat
a->textEmphasisFill | 868 || m_rareInheritedData->textEmphasisFill != other.m_rareInherite
dData->textEmphasisFill |
869 || rareInheritedData->appliedTextDecorations != other.rareInheri
tedData->appliedTextDecorations)) { | 869 || m_rareInheritedData->appliedTextDecorations != other.m_rareIn
heritedData->appliedTextDecorations)) { |
870 diff.setTextDecorationOrColorChanged(); | 870 diff.setTextDecorationOrColorChanged(); |
871 } | 871 } |
872 } | 872 } |
873 } | 873 } |
874 | 874 |
875 void ComputedStyle::addPaintImage(StyleImage* image) | 875 void ComputedStyle::addPaintImage(StyleImage* image) |
876 { | 876 { |
877 if (!rareNonInheritedData.access()->m_paintImages) | 877 if (!m_rareNonInheritedData.access()->m_paintImages) |
878 rareNonInheritedData.access()->m_paintImages = WTF::wrapUnique(new Vecto
r<Persistent<StyleImage>>()); | 878 m_rareNonInheritedData.access()->m_paintImages = WTF::wrapUnique(new Vec
tor<Persistent<StyleImage>>()); |
879 rareNonInheritedData.access()->m_paintImages->append(image); | 879 m_rareNonInheritedData.access()->m_paintImages->append(image); |
880 } | 880 } |
881 | 881 |
882 void ComputedStyle::addCursor(StyleImage* image, bool hotSpotSpecified, const In
tPoint& hotSpot) | 882 void ComputedStyle::addCursor(StyleImage* image, bool hotSpotSpecified, const In
tPoint& hotSpot) |
883 { | 883 { |
884 if (!rareInheritedData.access()->cursorData) | 884 if (!m_rareInheritedData.access()->cursorData) |
885 rareInheritedData.access()->cursorData = new CursorList; | 885 m_rareInheritedData.access()->cursorData = new CursorList; |
886 rareInheritedData.access()->cursorData->append(CursorData(image, hotSpotSpec
ified, hotSpot)); | 886 m_rareInheritedData.access()->cursorData->append(CursorData(image, hotSpotSp
ecified, hotSpot)); |
887 } | 887 } |
888 | 888 |
889 void ComputedStyle::setCursorList(CursorList* other) | 889 void ComputedStyle::setCursorList(CursorList* other) |
890 { | 890 { |
891 rareInheritedData.access()->cursorData = other; | 891 m_rareInheritedData.access()->cursorData = other; |
892 } | 892 } |
893 | 893 |
894 void ComputedStyle::setQuotes(PassRefPtr<QuotesData> q) | 894 void ComputedStyle::setQuotes(PassRefPtr<QuotesData> q) |
895 { | 895 { |
896 rareInheritedData.access()->quotes = q; | 896 m_rareInheritedData.access()->quotes = q; |
897 } | 897 } |
898 | 898 |
899 void ComputedStyle::clearCursorList() | 899 void ComputedStyle::clearCursorList() |
900 { | 900 { |
901 if (rareInheritedData->cursorData) | 901 if (m_rareInheritedData->cursorData) |
902 rareInheritedData.access()->cursorData = nullptr; | 902 m_rareInheritedData.access()->cursorData = nullptr; |
903 } | 903 } |
904 | 904 |
905 static bool hasPropertyThatCreatesStackingContext(const Vector<CSSPropertyID>& p
roperties) | 905 static bool hasPropertyThatCreatesStackingContext(const Vector<CSSPropertyID>& p
roperties) |
906 { | 906 { |
907 for (CSSPropertyID property : properties) { | 907 for (CSSPropertyID property : properties) { |
908 switch (property) { | 908 switch (property) { |
909 case CSSPropertyOpacity: | 909 case CSSPropertyOpacity: |
910 case CSSPropertyTransform: | 910 case CSSPropertyTransform: |
911 case CSSPropertyAliasWebkitTransform: | 911 case CSSPropertyAliasWebkitTransform: |
912 case CSSPropertyTransformStyle: | 912 case CSSPropertyTransformStyle: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 || hasIsolation() | 950 || hasIsolation() |
951 || hasViewportConstrainedPosition() | 951 || hasViewportConstrainedPosition() |
952 || hasPropertyThatCreatesStackingContext(willChangeProperties()) | 952 || hasPropertyThatCreatesStackingContext(willChangeProperties()) |
953 || containsPaint()) { | 953 || containsPaint()) { |
954 setIsStackingContext(true); | 954 setIsStackingContext(true); |
955 } | 955 } |
956 } | 956 } |
957 | 957 |
958 void ComputedStyle::addCallbackSelector(const String& selector) | 958 void ComputedStyle::addCallbackSelector(const String& selector) |
959 { | 959 { |
960 if (!rareNonInheritedData->m_callbackSelectors.contains(selector)) | 960 if (!m_rareNonInheritedData->m_callbackSelectors.contains(selector)) |
961 rareNonInheritedData.access()->m_callbackSelectors.append(selector); | 961 m_rareNonInheritedData.access()->m_callbackSelectors.append(selector); |
962 } | 962 } |
963 | 963 |
964 void ComputedStyle::setContent(ContentData* contentData) | 964 void ComputedStyle::setContent(ContentData* contentData) |
965 { | 965 { |
966 SET_VAR(rareNonInheritedData, m_content, contentData); | 966 SET_VAR(m_rareNonInheritedData, m_content, contentData); |
967 } | 967 } |
968 | 968 |
969 bool ComputedStyle::hasWillChangeCompositingHint() const | 969 bool ComputedStyle::hasWillChangeCompositingHint() const |
970 { | 970 { |
971 for (size_t i = 0; i < rareNonInheritedData->m_willChange->m_properties.size
(); ++i) { | 971 for (size_t i = 0; i < m_rareNonInheritedData->m_willChange->m_properties.si
ze(); ++i) { |
972 switch (rareNonInheritedData->m_willChange->m_properties[i]) { | 972 switch (m_rareNonInheritedData->m_willChange->m_properties[i]) { |
973 case CSSPropertyOpacity: | 973 case CSSPropertyOpacity: |
974 case CSSPropertyTransform: | 974 case CSSPropertyTransform: |
975 case CSSPropertyAliasWebkitTransform: | 975 case CSSPropertyAliasWebkitTransform: |
976 case CSSPropertyTop: | 976 case CSSPropertyTop: |
977 case CSSPropertyLeft: | 977 case CSSPropertyLeft: |
978 case CSSPropertyBottom: | 978 case CSSPropertyBottom: |
979 case CSSPropertyRight: | 979 case CSSPropertyRight: |
980 return true; | 980 return true; |
981 default: | 981 default: |
982 break; | 982 break; |
983 } | 983 } |
984 } | 984 } |
985 return false; | 985 return false; |
986 } | 986 } |
987 | 987 |
988 bool ComputedStyle::hasWillChangeTransformHint() const | 988 bool ComputedStyle::hasWillChangeTransformHint() const |
989 { | 989 { |
990 for (const auto& property: rareNonInheritedData->m_willChange->m_properties)
{ | 990 for (const auto& property: m_rareNonInheritedData->m_willChange->m_propertie
s) { |
991 switch (property) { | 991 switch (property) { |
992 case CSSPropertyTransform: | 992 case CSSPropertyTransform: |
993 case CSSPropertyAliasWebkitTransform: | 993 case CSSPropertyAliasWebkitTransform: |
994 return true; | 994 return true; |
995 default: | 995 default: |
996 break; | 996 break; |
997 } | 997 } |
998 } | 998 } |
999 return false; | 999 return false; |
1000 } | 1000 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 for (unsigned i = 0; i < size; ++i) | 1070 for (unsigned i = 0; i < size; ++i) |
1071 transformOperations[i]->apply(result, boundingBox.size()); | 1071 transformOperations[i]->apply(result, boundingBox.size()); |
1072 | 1072 |
1073 if (applyTransformOrigin) { | 1073 if (applyTransformOrigin) { |
1074 result.translate3d(-originX, -originY, -originZ); | 1074 result.translate3d(-originX, -originY, -originZ); |
1075 } | 1075 } |
1076 } | 1076 } |
1077 | 1077 |
1078 void ComputedStyle::applyMotionPathTransform(float originX, float originY, Trans
formationMatrix& transform) const | 1078 void ComputedStyle::applyMotionPathTransform(float originX, float originY, Trans
formationMatrix& transform) const |
1079 { | 1079 { |
1080 const StyleMotionData& motionData = rareNonInheritedData->m_transform->m_mot
ion; | 1080 const StyleMotionData& motionData = m_rareNonInheritedData->m_transform->m_m
otion; |
1081 ASSERT(motionData.m_path); | 1081 ASSERT(motionData.m_path); |
1082 const StylePath& motionPath = *motionData.m_path; | 1082 const StylePath& motionPath = *motionData.m_path; |
1083 float pathLength = motionPath.length(); | 1083 float pathLength = motionPath.length(); |
1084 float distance = floatValueForLength(motionData.m_offset, pathLength); | 1084 float distance = floatValueForLength(motionData.m_offset, pathLength); |
1085 float computedDistance; | 1085 float computedDistance; |
1086 if (motionPath.isClosed() && pathLength > 0) { | 1086 if (motionPath.isClosed() && pathLength > 0) { |
1087 computedDistance = fmod(distance, pathLength); | 1087 computedDistance = fmod(distance, pathLength); |
1088 if (computedDistance < 0) | 1088 if (computedDistance < 0) |
1089 computedDistance += pathLength; | 1089 computedDistance += pathLength; |
1090 } else { | 1090 } else { |
1091 computedDistance = clampTo<float>(distance, 0, pathLength); | 1091 computedDistance = clampTo<float>(distance, 0, pathLength); |
1092 } | 1092 } |
1093 | 1093 |
1094 FloatPoint point; | 1094 FloatPoint point; |
1095 float angle; | 1095 float angle; |
1096 motionPath.path().pointAndNormalAtLength(computedDistance, point, angle); | 1096 motionPath.path().pointAndNormalAtLength(computedDistance, point, angle); |
1097 | 1097 |
1098 if (motionData.m_rotation.type == MotionRotationFixed) | 1098 if (motionData.m_rotation.type == MotionRotationFixed) |
1099 angle = 0; | 1099 angle = 0; |
1100 | 1100 |
1101 transform.translate(point.x() - originX, point.y() - originY); | 1101 transform.translate(point.x() - originX, point.y() - originY); |
1102 transform.rotate(angle + motionData.m_rotation.angle); | 1102 transform.rotate(angle + motionData.m_rotation.angle); |
1103 } | 1103 } |
1104 | 1104 |
1105 void ComputedStyle::setTextShadow(PassRefPtr<ShadowList> s) | 1105 void ComputedStyle::setTextShadow(PassRefPtr<ShadowList> s) |
1106 { | 1106 { |
1107 rareInheritedData.access()->textShadow = s; | 1107 m_rareInheritedData.access()->textShadow = s; |
1108 } | 1108 } |
1109 | 1109 |
1110 void ComputedStyle::setBoxShadow(PassRefPtr<ShadowList> s) | 1110 void ComputedStyle::setBoxShadow(PassRefPtr<ShadowList> s) |
1111 { | 1111 { |
1112 rareNonInheritedData.access()->m_boxShadow = s; | 1112 m_rareNonInheritedData.access()->m_boxShadow = s; |
1113 } | 1113 } |
1114 | 1114 |
1115 static FloatRoundedRect::Radii calcRadiiFor(const BorderData& border, LayoutSize
size) | 1115 static FloatRoundedRect::Radii calcRadiiFor(const BorderData& border, LayoutSize
size) |
1116 { | 1116 { |
1117 return FloatRoundedRect::Radii( | 1117 return FloatRoundedRect::Radii( |
1118 FloatSize(floatValueForLength(border.topLeft().width(), size.width().toF
loat()), | 1118 FloatSize(floatValueForLength(border.topLeft().width(), size.width().toF
loat()), |
1119 floatValueForLength(border.topLeft().height(), size.height().toFloat
())), | 1119 floatValueForLength(border.topLeft().height(), size.height().toFloat
())), |
1120 FloatSize(floatValueForLength(border.topRight().width(), size.width().to
Float()), | 1120 FloatSize(floatValueForLength(border.topRight().width(), size.width().to
Float()), |
1121 floatValueForLength(border.topRight().height(), size.height().toFloa
t())), | 1121 floatValueForLength(border.topRight().height(), size.height().toFloa
t())), |
1122 FloatSize(floatValueForLength(border.bottomLeft().width(), size.width().
toFloat()), | 1122 FloatSize(floatValueForLength(border.bottomLeft().width(), size.width().
toFloat()), |
1123 floatValueForLength(border.bottomLeft().height(), size.height().toFl
oat())), | 1123 floatValueForLength(border.bottomLeft().height(), size.height().toFl
oat())), |
1124 FloatSize(floatValueForLength(border.bottomRight().width(), size.width()
.toFloat()), | 1124 FloatSize(floatValueForLength(border.bottomRight().width(), size.width()
.toFloat()), |
1125 floatValueForLength(border.bottomRight().height(), size.height().toF
loat()))); | 1125 floatValueForLength(border.bottomRight().height(), size.height().toF
loat()))); |
1126 } | 1126 } |
1127 | 1127 |
1128 StyleImage* ComputedStyle::listStyleImage() const { return rareInheritedData->li
stStyleImage.get(); } | 1128 StyleImage* ComputedStyle::listStyleImage() const { return m_rareInheritedData->
listStyleImage.get(); } |
1129 void ComputedStyle::setListStyleImage(StyleImage* v) | 1129 void ComputedStyle::setListStyleImage(StyleImage* v) |
1130 { | 1130 { |
1131 if (rareInheritedData->listStyleImage != v) | 1131 if (m_rareInheritedData->listStyleImage != v) |
1132 rareInheritedData.access()->listStyleImage = v; | 1132 m_rareInheritedData.access()->listStyleImage = v; |
1133 } | 1133 } |
1134 | 1134 |
1135 Color ComputedStyle::color() const { return inherited->color; } | 1135 Color ComputedStyle::color() const { return m_styleInheritedData->color; } |
1136 Color ComputedStyle::visitedLinkColor() const { return inherited->visitedLinkCol
or; } | 1136 Color ComputedStyle::visitedLinkColor() const { return m_styleInheritedData->vis
itedLinkColor; } |
1137 void ComputedStyle::setColor(const Color& v) { SET_VAR(inherited, color, v); } | 1137 void ComputedStyle::setColor(const Color& v) { SET_VAR(m_styleInheritedData, col
or, v); } |
1138 void ComputedStyle::setVisitedLinkColor(const Color& v) { SET_VAR(inherited, vis
itedLinkColor, v); } | 1138 void ComputedStyle::setVisitedLinkColor(const Color& v) { SET_VAR(m_styleInherit
edData, visitedLinkColor, v); } |
1139 | 1139 |
1140 short ComputedStyle::horizontalBorderSpacing() const { return inherited->horizon
tal_border_spacing; } | 1140 short ComputedStyle::horizontalBorderSpacing() const { return m_styleInheritedDa
ta->horizontal_border_spacing; } |
1141 short ComputedStyle::verticalBorderSpacing() const { return inherited->vertical_
border_spacing; } | 1141 short ComputedStyle::verticalBorderSpacing() const { return m_styleInheritedData
->vertical_border_spacing; } |
1142 void ComputedStyle::setHorizontalBorderSpacing(short v) { SET_VAR(inherited, hor
izontal_border_spacing, v); } | 1142 void ComputedStyle::setHorizontalBorderSpacing(short v) { SET_VAR(m_styleInherit
edData, horizontal_border_spacing, v); } |
1143 void ComputedStyle::setVerticalBorderSpacing(short v) { SET_VAR(inherited, verti
cal_border_spacing, v); } | 1143 void ComputedStyle::setVerticalBorderSpacing(short v) { SET_VAR(m_styleInherited
Data, vertical_border_spacing, v); } |
1144 | 1144 |
1145 FloatRoundedRect ComputedStyle::getRoundedBorderFor(const LayoutRect& borderRect
, | 1145 FloatRoundedRect ComputedStyle::getRoundedBorderFor(const LayoutRect& borderRect
, |
1146 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const | 1146 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const |
1147 { | 1147 { |
1148 FloatRoundedRect roundedRect(pixelSnappedIntRect(borderRect)); | 1148 FloatRoundedRect roundedRect(pixelSnappedIntRect(borderRect)); |
1149 if (hasBorderRadius()) { | 1149 if (hasBorderRadius()) { |
1150 FloatRoundedRect::Radii radii = calcRadiiFor(surround->border, borderRec
t.size()); | 1150 FloatRoundedRect::Radii radii = calcRadiiFor(m_surround->border, borderR
ect.size()); |
1151 roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includ
eLogicalLeftEdge, includeLogicalRightEdge); | 1151 roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includ
eLogicalLeftEdge, includeLogicalRightEdge); |
1152 roundedRect.constrainRadii(); | 1152 roundedRect.constrainRadii(); |
1153 } | 1153 } |
1154 return roundedRect; | 1154 return roundedRect; |
1155 } | 1155 } |
1156 | 1156 |
1157 FloatRoundedRect ComputedStyle::getRoundedInnerBorderFor(const LayoutRect& borde
rRect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const | 1157 FloatRoundedRect ComputedStyle::getRoundedInnerBorderFor(const LayoutRect& borde
rRect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const |
1158 { | 1158 { |
1159 bool horizontal = isHorizontalWritingMode(); | 1159 bool horizontal = isHorizontalWritingMode(); |
1160 | 1160 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 return true; | 1199 return true; |
1200 } | 1200 } |
1201 | 1201 |
1202 bool ComputedStyle::hasEntirelyFixedBackground() const | 1202 bool ComputedStyle::hasEntirelyFixedBackground() const |
1203 { | 1203 { |
1204 return allLayersAreFixed(backgroundLayers()); | 1204 return allLayersAreFixed(backgroundLayers()); |
1205 } | 1205 } |
1206 | 1206 |
1207 const CounterDirectiveMap* ComputedStyle::counterDirectives() const | 1207 const CounterDirectiveMap* ComputedStyle::counterDirectives() const |
1208 { | 1208 { |
1209 return rareNonInheritedData->m_counterDirectives.get(); | 1209 return m_rareNonInheritedData->m_counterDirectives.get(); |
1210 } | 1210 } |
1211 | 1211 |
1212 CounterDirectiveMap& ComputedStyle::accessCounterDirectives() | 1212 CounterDirectiveMap& ComputedStyle::accessCounterDirectives() |
1213 { | 1213 { |
1214 std::unique_ptr<CounterDirectiveMap>& map = rareNonInheritedData.access()->m
_counterDirectives; | 1214 std::unique_ptr<CounterDirectiveMap>& map = m_rareNonInheritedData.access()-
>m_counterDirectives; |
1215 if (!map) | 1215 if (!map) |
1216 map = wrapUnique(new CounterDirectiveMap); | 1216 map = wrapUnique(new CounterDirectiveMap); |
1217 return *map; | 1217 return *map; |
1218 } | 1218 } |
1219 | 1219 |
1220 const CounterDirectives ComputedStyle::getCounterDirectives(const AtomicString&
identifier) const | 1220 const CounterDirectives ComputedStyle::getCounterDirectives(const AtomicString&
identifier) const |
1221 { | 1221 { |
1222 if (const CounterDirectiveMap* directives = counterDirectives()) | 1222 if (const CounterDirectiveMap* directives = counterDirectives()) |
1223 return directives->get(identifier); | 1223 return directives->get(identifier); |
1224 return CounterDirectives(); | 1224 return CounterDirectives(); |
(...skipping 22 matching lines...) Expand all Loading... |
1247 CounterDirectiveMap& map = accessCounterDirectives(); | 1247 CounterDirectiveMap& map = accessCounterDirectives(); |
1248 typedef CounterDirectiveMap::iterator Iterator; | 1248 typedef CounterDirectiveMap::iterator Iterator; |
1249 | 1249 |
1250 Iterator end = map.end(); | 1250 Iterator end = map.end(); |
1251 for (Iterator it = map.begin(); it != end; ++it) | 1251 for (Iterator it = map.begin(); it != end; ++it) |
1252 it->value.clearReset(); | 1252 it->value.clearReset(); |
1253 } | 1253 } |
1254 | 1254 |
1255 const AtomicString& ComputedStyle::hyphenString() const | 1255 const AtomicString& ComputedStyle::hyphenString() const |
1256 { | 1256 { |
1257 const AtomicString& hyphenationString = rareInheritedData.get()->hyphenation
String; | 1257 const AtomicString& hyphenationString = m_rareInheritedData.get()->hyphenati
onString; |
1258 if (!hyphenationString.isNull()) | 1258 if (!hyphenationString.isNull()) |
1259 return hyphenationString; | 1259 return hyphenationString; |
1260 | 1260 |
1261 // FIXME: This should depend on locale. | 1261 // FIXME: This should depend on locale. |
1262 DEFINE_STATIC_LOCAL(AtomicString, hyphenMinusString, (&hyphenMinusCharacter,
1)); | 1262 DEFINE_STATIC_LOCAL(AtomicString, hyphenMinusString, (&hyphenMinusCharacter,
1)); |
1263 DEFINE_STATIC_LOCAL(AtomicString, hyphenString, (&hyphenCharacter, 1)); | 1263 DEFINE_STATIC_LOCAL(AtomicString, hyphenString, (&hyphenCharacter, 1)); |
1264 const SimpleFontData* primaryFont = font().primaryFont(); | 1264 const SimpleFontData* primaryFont = font().primaryFont(); |
1265 ASSERT(primaryFont); | 1265 ASSERT(primaryFont); |
1266 return primaryFont->glyphForCharacter(hyphenCharacter) ? hyphenString : hyph
enMinusString; | 1266 return primaryFont->glyphForCharacter(hyphenCharacter) ? hyphenString : hyph
enMinusString; |
1267 } | 1267 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 ASSERT_NOT_REACHED(); | 1302 ASSERT_NOT_REACHED(); |
1303 return nullAtom; | 1303 return nullAtom; |
1304 } | 1304 } |
1305 | 1305 |
1306 ASSERT_NOT_REACHED(); | 1306 ASSERT_NOT_REACHED(); |
1307 return nullAtom; | 1307 return nullAtom; |
1308 } | 1308 } |
1309 | 1309 |
1310 CSSAnimationData& ComputedStyle::accessAnimations() | 1310 CSSAnimationData& ComputedStyle::accessAnimations() |
1311 { | 1311 { |
1312 if (!rareNonInheritedData.access()->m_animations) | 1312 if (!m_rareNonInheritedData.access()->m_animations) |
1313 rareNonInheritedData.access()->m_animations = CSSAnimationData::create()
; | 1313 m_rareNonInheritedData.access()->m_animations = CSSAnimationData::create
(); |
1314 return *rareNonInheritedData->m_animations; | 1314 return *m_rareNonInheritedData->m_animations; |
1315 } | 1315 } |
1316 | 1316 |
1317 CSSTransitionData& ComputedStyle::accessTransitions() | 1317 CSSTransitionData& ComputedStyle::accessTransitions() |
1318 { | 1318 { |
1319 if (!rareNonInheritedData.access()->m_transitions) | 1319 if (!m_rareNonInheritedData.access()->m_transitions) |
1320 rareNonInheritedData.access()->m_transitions = CSSTransitionData::create
(); | 1320 m_rareNonInheritedData.access()->m_transitions = CSSTransitionData::crea
te(); |
1321 return *rareNonInheritedData->m_transitions; | 1321 return *m_rareNonInheritedData->m_transitions; |
1322 } | 1322 } |
1323 | 1323 |
1324 const Font& ComputedStyle::font() const { return inherited->font; } | 1324 const Font& ComputedStyle::font() const { return m_styleInheritedData->font; } |
1325 const FontMetrics& ComputedStyle::getFontMetrics() const { return inherited->fon
t.getFontMetrics(); } | 1325 const FontMetrics& ComputedStyle::getFontMetrics() const { return m_styleInherit
edData->font.getFontMetrics(); } |
1326 const FontDescription& ComputedStyle::getFontDescription() const { return inheri
ted->font.getFontDescription(); } | 1326 const FontDescription& ComputedStyle::getFontDescription() const { return m_styl
eInheritedData->font.getFontDescription(); } |
1327 float ComputedStyle::specifiedFontSize() const { return getFontDescription().spe
cifiedSize(); } | 1327 float ComputedStyle::specifiedFontSize() const { return getFontDescription().spe
cifiedSize(); } |
1328 float ComputedStyle::computedFontSize() const { return getFontDescription().comp
utedSize(); } | 1328 float ComputedStyle::computedFontSize() const { return getFontDescription().comp
utedSize(); } |
1329 int ComputedStyle::fontSize() const { return getFontDescription().computedPixelS
ize(); } | 1329 int ComputedStyle::fontSize() const { return getFontDescription().computedPixelS
ize(); } |
1330 float ComputedStyle::fontSizeAdjust() const { return getFontDescription().sizeAd
just(); } | 1330 float ComputedStyle::fontSizeAdjust() const { return getFontDescription().sizeAd
just(); } |
1331 bool ComputedStyle::hasFontSizeAdjust() const { return getFontDescription().hasS
izeAdjust(); } | 1331 bool ComputedStyle::hasFontSizeAdjust() const { return getFontDescription().hasS
izeAdjust(); } |
1332 FontWeight ComputedStyle::fontWeight() const { return getFontDescription().weigh
t(); } | 1332 FontWeight ComputedStyle::fontWeight() const { return getFontDescription().weigh
t(); } |
1333 FontStretch ComputedStyle::fontStretch() const { return getFontDescription().str
etch(); } | 1333 FontStretch ComputedStyle::fontStretch() const { return getFontDescription().str
etch(); } |
1334 | 1334 |
1335 TextDecoration ComputedStyle::textDecorationsInEffect() const | 1335 TextDecoration ComputedStyle::textDecorationsInEffect() const |
1336 { | 1336 { |
1337 int decorations = 0; | 1337 int decorations = 0; |
1338 | 1338 |
1339 const Vector<AppliedTextDecoration>& applied = appliedTextDecorations(); | 1339 const Vector<AppliedTextDecoration>& applied = appliedTextDecorations(); |
1340 | 1340 |
1341 for (size_t i = 0; i < applied.size(); ++i) | 1341 for (size_t i = 0; i < applied.size(); ++i) |
1342 decorations |= applied[i].line(); | 1342 decorations |= applied[i].line(); |
1343 | 1343 |
1344 return static_cast<TextDecoration>(decorations); | 1344 return static_cast<TextDecoration>(decorations); |
1345 } | 1345 } |
1346 | 1346 |
1347 const Vector<AppliedTextDecoration>& ComputedStyle::appliedTextDecorations() con
st | 1347 const Vector<AppliedTextDecoration>& ComputedStyle::appliedTextDecorations() con
st |
1348 { | 1348 { |
1349 if (!inherited_data.m_textUnderline && !rareInheritedData->appliedTextDecora
tions) { | 1349 if (!m_inheritedData.m_textUnderline && !m_rareInheritedData->appliedTextDec
orations) { |
1350 DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, empty, ()); | 1350 DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, empty, ()); |
1351 return empty; | 1351 return empty; |
1352 } | 1352 } |
1353 if (inherited_data.m_textUnderline) { | 1353 if (m_inheritedData.m_textUnderline) { |
1354 DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, underline, (1, Applie
dTextDecoration(TextDecorationUnderline))); | 1354 DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, underline, (1, Applie
dTextDecoration(TextDecorationUnderline))); |
1355 return underline; | 1355 return underline; |
1356 } | 1356 } |
1357 | 1357 |
1358 return rareInheritedData->appliedTextDecorations->vector(); | 1358 return m_rareInheritedData->appliedTextDecorations->vector(); |
1359 } | 1359 } |
1360 | 1360 |
1361 StyleVariableData* ComputedStyle::variables() const | 1361 StyleVariableData* ComputedStyle::variables() const |
1362 { | 1362 { |
1363 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); | 1363 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); |
1364 return rareInheritedData->variables.get(); | 1364 return m_rareInheritedData->variables.get(); |
1365 } | 1365 } |
1366 | 1366 |
1367 void ComputedStyle::setVariable(const AtomicString& name, PassRefPtr<CSSVariable
Data> value) | 1367 void ComputedStyle::setVariable(const AtomicString& name, PassRefPtr<CSSVariable
Data> value) |
1368 { | 1368 { |
1369 RefPtr<StyleVariableData>& variables = rareInheritedData.access()->variables
; | 1369 RefPtr<StyleVariableData>& variables = m_rareInheritedData.access()->variabl
es; |
1370 if (!variables) | 1370 if (!variables) |
1371 variables = StyleVariableData::create(); | 1371 variables = StyleVariableData::create(); |
1372 else if (!variables->hasOneRef()) | 1372 else if (!variables->hasOneRef()) |
1373 variables = variables->copy(); | 1373 variables = variables->copy(); |
1374 variables->setVariable(name, value); | 1374 variables->setVariable(name, value); |
1375 } | 1375 } |
1376 | 1376 |
1377 void ComputedStyle::removeVariable(const AtomicString& name) | 1377 void ComputedStyle::removeVariable(const AtomicString& name) |
1378 { | 1378 { |
1379 RefPtr<StyleVariableData>& variables = rareInheritedData.access()->variables
; | 1379 RefPtr<StyleVariableData>& variables = m_rareInheritedData.access()->variabl
es; |
1380 if (!variables) | 1380 if (!variables) |
1381 return; | 1381 return; |
1382 if (!variables->hasOneRef()) | 1382 if (!variables->hasOneRef()) |
1383 variables = variables->copy(); | 1383 variables = variables->copy(); |
1384 variables->removeVariable(name); | 1384 variables->removeVariable(name); |
1385 } | 1385 } |
1386 | 1386 |
1387 float ComputedStyle::wordSpacing() const { return getFontDescription().wordSpaci
ng(); } | 1387 float ComputedStyle::wordSpacing() const { return getFontDescription().wordSpaci
ng(); } |
1388 float ComputedStyle::letterSpacing() const { return getFontDescription().letterS
pacing(); } | 1388 float ComputedStyle::letterSpacing() const { return getFontDescription().letterS
pacing(); } |
1389 | 1389 |
1390 bool ComputedStyle::setFontDescription(const FontDescription& v) | 1390 bool ComputedStyle::setFontDescription(const FontDescription& v) |
1391 { | 1391 { |
1392 if (inherited->font.getFontDescription() != v) { | 1392 if (m_styleInheritedData->font.getFontDescription() != v) { |
1393 inherited.access()->font = Font(v); | 1393 m_styleInheritedData.access()->font = Font(v); |
1394 return true; | 1394 return true; |
1395 } | 1395 } |
1396 return false; | 1396 return false; |
1397 } | 1397 } |
1398 | 1398 |
1399 void ComputedStyle::setFont(const Font& font) | 1399 void ComputedStyle::setFont(const Font& font) |
1400 { | 1400 { |
1401 inherited.access()->font = font; | 1401 m_styleInheritedData.access()->font = font; |
1402 } | 1402 } |
1403 | 1403 |
1404 const Length& ComputedStyle::specifiedLineHeight() const { return inherited->lin
e_height; } | 1404 const Length& ComputedStyle::specifiedLineHeight() const { return m_styleInherit
edData->line_height; } |
1405 Length ComputedStyle::lineHeight() const | 1405 Length ComputedStyle::lineHeight() const |
1406 { | 1406 { |
1407 const Length& lh = inherited->line_height; | 1407 const Length& lh = m_styleInheritedData->line_height; |
1408 // Unlike getFontDescription().computedSize() and hence fontSize(), this is | 1408 // Unlike getFontDescription().computedSize() and hence fontSize(), this is |
1409 // recalculated on demand as we only store the specified line height. | 1409 // recalculated on demand as we only store the specified line height. |
1410 // FIXME: Should consider scaling the fixed part of any calc expressions | 1410 // FIXME: Should consider scaling the fixed part of any calc expressions |
1411 // too, though this involves messily poking into CalcExpressionLength. | 1411 // too, though this involves messily poking into CalcExpressionLength. |
1412 if (lh.isFixed()) { | 1412 if (lh.isFixed()) { |
1413 float multiplier = textAutosizingMultiplier(); | 1413 float multiplier = textAutosizingMultiplier(); |
1414 return Length(TextAutosizer::computeAutosizedFontSize(lh.value(), multip
lier), Fixed); | 1414 return Length(TextAutosizer::computeAutosizedFontSize(lh.value(), multip
lier), Fixed); |
1415 } | 1415 } |
1416 | 1416 |
1417 return lh; | 1417 return lh; |
1418 } | 1418 } |
1419 | 1419 |
1420 void ComputedStyle::setLineHeight(const Length& specifiedLineHeight) { SET_VAR(i
nherited, line_height, specifiedLineHeight); } | 1420 void ComputedStyle::setLineHeight(const Length& specifiedLineHeight) { SET_VAR(m
_styleInheritedData, line_height, specifiedLineHeight); } |
1421 | 1421 |
1422 int ComputedStyle::computedLineHeight() const | 1422 int ComputedStyle::computedLineHeight() const |
1423 { | 1423 { |
1424 const Length& lh = lineHeight(); | 1424 const Length& lh = lineHeight(); |
1425 | 1425 |
1426 // Negative value means the line height is not set. Use the font's built-in | 1426 // Negative value means the line height is not set. Use the font's built-in |
1427 // spacing, if avalible. | 1427 // spacing, if avalible. |
1428 if (lh.isNegative() && font().primaryFont()) | 1428 if (lh.isNegative() && font().primaryFont()) |
1429 return getFontMetrics().lineSpacing(); | 1429 return getFontMetrics().lineSpacing(); |
1430 | 1430 |
(...skipping 16 matching lines...) Expand all Loading... |
1447 { | 1447 { |
1448 FontSelector* currentFontSelector = font().getFontSelector(); | 1448 FontSelector* currentFontSelector = font().getFontSelector(); |
1449 FontDescription desc(getFontDescription()); | 1449 FontDescription desc(getFontDescription()); |
1450 desc.setLetterSpacing(letterSpacing); | 1450 desc.setLetterSpacing(letterSpacing); |
1451 setFontDescription(desc); | 1451 setFontDescription(desc); |
1452 font().update(currentFontSelector); | 1452 font().update(currentFontSelector); |
1453 } | 1453 } |
1454 | 1454 |
1455 void ComputedStyle::setTextAutosizingMultiplier(float multiplier) | 1455 void ComputedStyle::setTextAutosizingMultiplier(float multiplier) |
1456 { | 1456 { |
1457 SET_VAR(inherited, textAutosizingMultiplier, multiplier); | 1457 SET_VAR(m_styleInheritedData, textAutosizingMultiplier, multiplier); |
1458 | 1458 |
1459 float size = specifiedFontSize(); | 1459 float size = specifiedFontSize(); |
1460 | 1460 |
1461 ASSERT(std::isfinite(size)); | 1461 ASSERT(std::isfinite(size)); |
1462 if (!std::isfinite(size) || size < 0) | 1462 if (!std::isfinite(size) || size < 0) |
1463 size = 0; | 1463 size = 0; |
1464 else | 1464 else |
1465 size = std::min(maximumAllowedFontSize, size); | 1465 size = std::min(maximumAllowedFontSize, size); |
1466 | 1466 |
1467 FontSelector* currentFontSelector = font().getFontSelector(); | 1467 FontSelector* currentFontSelector = font().getFontSelector(); |
1468 FontDescription desc(getFontDescription()); | 1468 FontDescription desc(getFontDescription()); |
1469 desc.setSpecifiedSize(size); | 1469 desc.setSpecifiedSize(size); |
1470 desc.setComputedSize(size); | 1470 desc.setComputedSize(size); |
1471 | 1471 |
1472 float autosizedFontSize = TextAutosizer::computeAutosizedFontSize(size, mult
iplier); | 1472 float autosizedFontSize = TextAutosizer::computeAutosizedFontSize(size, mult
iplier); |
1473 desc.setComputedSize(std::min(maximumAllowedFontSize, autosizedFontSize)); | 1473 desc.setComputedSize(std::min(maximumAllowedFontSize, autosizedFontSize)); |
1474 | 1474 |
1475 setFontDescription(desc); | 1475 setFontDescription(desc); |
1476 font().update(currentFontSelector); | 1476 font().update(currentFontSelector); |
1477 } | 1477 } |
1478 | 1478 |
1479 void ComputedStyle::addAppliedTextDecoration(const AppliedTextDecoration& decora
tion) | 1479 void ComputedStyle::addAppliedTextDecoration(const AppliedTextDecoration& decora
tion) |
1480 { | 1480 { |
1481 RefPtr<AppliedTextDecorationList>& list = rareInheritedData.access()->applie
dTextDecorations; | 1481 RefPtr<AppliedTextDecorationList>& list = m_rareInheritedData.access()->appl
iedTextDecorations; |
1482 | 1482 |
1483 if (!list) | 1483 if (!list) |
1484 list = AppliedTextDecorationList::create(); | 1484 list = AppliedTextDecorationList::create(); |
1485 else if (!list->hasOneRef()) | 1485 else if (!list->hasOneRef()) |
1486 list = list->copy(); | 1486 list = list->copy(); |
1487 | 1487 |
1488 if (inherited_data.m_textUnderline) { | 1488 if (m_inheritedData.m_textUnderline) { |
1489 inherited_data.m_textUnderline = false; | 1489 m_inheritedData.m_textUnderline = false; |
1490 list->append(AppliedTextDecoration(TextDecorationUnderline)); | 1490 list->append(AppliedTextDecoration(TextDecorationUnderline)); |
1491 } | 1491 } |
1492 | 1492 |
1493 list->append(decoration); | 1493 list->append(decoration); |
1494 } | 1494 } |
1495 | 1495 |
1496 void ComputedStyle::applyTextDecorations() | 1496 void ComputedStyle::applyTextDecorations() |
1497 { | 1497 { |
1498 if (getTextDecoration() == TextDecorationNone) | 1498 if (getTextDecoration() == TextDecorationNone) |
1499 return; | 1499 return; |
1500 | 1500 |
1501 TextDecorationStyle style = getTextDecorationStyle(); | 1501 TextDecorationStyle style = getTextDecorationStyle(); |
1502 StyleColor styleColor = decorationColorIncludingFallback(insideLink() == Ins
ideVisitedLink); | 1502 StyleColor styleColor = decorationColorIncludingFallback(insideLink() == Ins
ideVisitedLink); |
1503 | 1503 |
1504 int decorations = getTextDecoration(); | 1504 int decorations = getTextDecoration(); |
1505 | 1505 |
1506 if (decorations & TextDecorationUnderline) { | 1506 if (decorations & TextDecorationUnderline) { |
1507 // To save memory, we don't use AppliedTextDecoration objects in the | 1507 // To save memory, we don't use AppliedTextDecoration objects in the |
1508 // common case of a single simple underline. | 1508 // common case of a single simple underline. |
1509 AppliedTextDecoration underline(TextDecorationUnderline, style, styleCol
or); | 1509 AppliedTextDecoration underline(TextDecorationUnderline, style, styleCol
or); |
1510 | 1510 |
1511 if (!rareInheritedData->appliedTextDecorations && underline.isSimpleUnde
rline()) | 1511 if (!m_rareInheritedData->appliedTextDecorations && underline.isSimpleUn
derline()) |
1512 inherited_data.m_textUnderline = true; | 1512 m_inheritedData.m_textUnderline = true; |
1513 else | 1513 else |
1514 addAppliedTextDecoration(underline); | 1514 addAppliedTextDecoration(underline); |
1515 } | 1515 } |
1516 if (decorations & TextDecorationOverline) | 1516 if (decorations & TextDecorationOverline) |
1517 addAppliedTextDecoration(AppliedTextDecoration(TextDecorationOverline, s
tyle, styleColor)); | 1517 addAppliedTextDecoration(AppliedTextDecoration(TextDecorationOverline, s
tyle, styleColor)); |
1518 if (decorations & TextDecorationLineThrough) | 1518 if (decorations & TextDecorationLineThrough) |
1519 addAppliedTextDecoration(AppliedTextDecoration(TextDecorationLineThrough
, style, styleColor)); | 1519 addAppliedTextDecoration(AppliedTextDecoration(TextDecorationLineThrough
, style, styleColor)); |
1520 } | 1520 } |
1521 | 1521 |
1522 void ComputedStyle::clearAppliedTextDecorations() | 1522 void ComputedStyle::clearAppliedTextDecorations() |
1523 { | 1523 { |
1524 inherited_data.m_textUnderline = false; | 1524 m_inheritedData.m_textUnderline = false; |
1525 | 1525 |
1526 if (rareInheritedData->appliedTextDecorations) | 1526 if (m_rareInheritedData->appliedTextDecorations) |
1527 rareInheritedData.access()->appliedTextDecorations = nullptr; | 1527 m_rareInheritedData.access()->appliedTextDecorations = nullptr; |
1528 } | 1528 } |
1529 | 1529 |
1530 void ComputedStyle::clearMultiCol() | 1530 void ComputedStyle::clearMultiCol() |
1531 { | 1531 { |
1532 rareNonInheritedData.access()->m_multiCol = nullptr; | 1532 m_rareNonInheritedData.access()->m_multiCol = nullptr; |
1533 rareNonInheritedData.access()->m_multiCol.init(); | 1533 m_rareNonInheritedData.access()->m_multiCol.init(); |
1534 } | 1534 } |
1535 | 1535 |
1536 StyleColor ComputedStyle::decorationColorIncludingFallback(bool visitedLink) con
st | 1536 StyleColor ComputedStyle::decorationColorIncludingFallback(bool visitedLink) con
st |
1537 { | 1537 { |
1538 StyleColor styleColor = visitedLink ? visitedLinkTextDecorationColor() : tex
tDecorationColor(); | 1538 StyleColor styleColor = visitedLink ? visitedLinkTextDecorationColor() : tex
tDecorationColor(); |
1539 | 1539 |
1540 if (!styleColor.isCurrentColor()) | 1540 if (!styleColor.isCurrentColor()) |
1541 return styleColor; | 1541 return styleColor; |
1542 | 1542 |
1543 if (textStrokeWidth()) { | 1543 if (textStrokeWidth()) { |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1761 } else { | 1761 } else { |
1762 if (isLeftToRightDirection()) | 1762 if (isLeftToRightDirection()) |
1763 setMarginBottom(margin); | 1763 setMarginBottom(margin); |
1764 else | 1764 else |
1765 setMarginTop(margin); | 1765 setMarginTop(margin); |
1766 } | 1766 } |
1767 } | 1767 } |
1768 | 1768 |
1769 void ComputedStyle::setMotionPath(PassRefPtr<StylePath> path) | 1769 void ComputedStyle::setMotionPath(PassRefPtr<StylePath> path) |
1770 { | 1770 { |
1771 rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = path; | 1771 m_rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = pat
h; |
1772 } | 1772 } |
1773 | 1773 |
1774 int ComputedStyle::outlineOutsetExtent() const | 1774 int ComputedStyle::outlineOutsetExtent() const |
1775 { | 1775 { |
1776 if (!hasOutline()) | 1776 if (!hasOutline()) |
1777 return 0; | 1777 return 0; |
1778 if (outlineStyleIsAuto()) | 1778 if (outlineStyleIsAuto()) |
1779 return GraphicsContext::focusRingOutsetExtent(outlineOffset(), outlineWi
dth()); | 1779 return GraphicsContext::focusRingOutsetExtent(outlineOffset(), outlineWi
dth()); |
1780 return std::max(0, outlineWidth() + outlineOffset()); | 1780 return std::max(0, outlineWidth() + outlineOffset()); |
1781 } | 1781 } |
1782 | 1782 |
1783 bool ComputedStyle::columnRuleEquivalent(const ComputedStyle* otherStyle) const | 1783 bool ComputedStyle::columnRuleEquivalent(const ComputedStyle* otherStyle) const |
1784 { | 1784 { |
1785 return columnRuleStyle() == otherStyle->columnRuleStyle() | 1785 return columnRuleStyle() == otherStyle->columnRuleStyle() |
1786 && columnRuleWidth() == otherStyle->columnRuleWidth() | 1786 && columnRuleWidth() == otherStyle->columnRuleWidth() |
1787 && visitedDependentColor(CSSPropertyColumnRuleColor) == otherStyle->visi
tedDependentColor(CSSPropertyColumnRuleColor); | 1787 && visitedDependentColor(CSSPropertyColumnRuleColor) == otherStyle->visi
tedDependentColor(CSSPropertyColumnRuleColor); |
1788 } | 1788 } |
1789 | 1789 |
1790 TextEmphasisMark ComputedStyle::getTextEmphasisMark() const | 1790 TextEmphasisMark ComputedStyle::getTextEmphasisMark() const |
1791 { | 1791 { |
1792 TextEmphasisMark mark = static_cast<TextEmphasisMark>(rareInheritedData->tex
tEmphasisMark); | 1792 TextEmphasisMark mark = static_cast<TextEmphasisMark>(m_rareInheritedData->t
extEmphasisMark); |
1793 if (mark != TextEmphasisMarkAuto) | 1793 if (mark != TextEmphasisMarkAuto) |
1794 return mark; | 1794 return mark; |
1795 | 1795 |
1796 if (isHorizontalWritingMode()) | 1796 if (isHorizontalWritingMode()) |
1797 return TextEmphasisMarkDot; | 1797 return TextEmphasisMarkDot; |
1798 | 1798 |
1799 return TextEmphasisMarkSesame; | 1799 return TextEmphasisMarkSesame; |
1800 } | 1800 } |
1801 | 1801 |
1802 Color ComputedStyle::initialTapHighlightColor() | 1802 Color ComputedStyle::initialTapHighlightColor() |
(...skipping 17 matching lines...) Expand all Loading... |
1820 { | 1820 { |
1821 return LayoutRectOutsets( | 1821 return LayoutRectOutsets( |
1822 NinePieceImage::computeOutset(image.outset().top(), borderTopWidth()), | 1822 NinePieceImage::computeOutset(image.outset().top(), borderTopWidth()), |
1823 NinePieceImage::computeOutset(image.outset().right(), borderRightWidth()
), | 1823 NinePieceImage::computeOutset(image.outset().right(), borderRightWidth()
), |
1824 NinePieceImage::computeOutset(image.outset().bottom(), borderBottomWidth
()), | 1824 NinePieceImage::computeOutset(image.outset().bottom(), borderBottomWidth
()), |
1825 NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth()))
; | 1825 NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth()))
; |
1826 } | 1826 } |
1827 | 1827 |
1828 void ComputedStyle::setBorderImageSource(StyleImage* image) | 1828 void ComputedStyle::setBorderImageSource(StyleImage* image) |
1829 { | 1829 { |
1830 if (surround->border.m_image.image() == image) | 1830 if (m_surround->border.m_image.image() == image) |
1831 return; | 1831 return; |
1832 surround.access()->border.m_image.setImage(image); | 1832 m_surround.access()->border.m_image.setImage(image); |
1833 } | 1833 } |
1834 | 1834 |
1835 void ComputedStyle::setBorderImageSlices(const LengthBox& slices) | 1835 void ComputedStyle::setBorderImageSlices(const LengthBox& slices) |
1836 { | 1836 { |
1837 if (surround->border.m_image.imageSlices() == slices) | 1837 if (m_surround->border.m_image.imageSlices() == slices) |
1838 return; | 1838 return; |
1839 surround.access()->border.m_image.setImageSlices(slices); | 1839 m_surround.access()->border.m_image.setImageSlices(slices); |
1840 } | 1840 } |
1841 | 1841 |
1842 void ComputedStyle::setBorderImageSlicesFill(bool fill) | 1842 void ComputedStyle::setBorderImageSlicesFill(bool fill) |
1843 { | 1843 { |
1844 if (surround->border.m_image.fill() == fill) | 1844 if (m_surround->border.m_image.fill() == fill) |
1845 return; | 1845 return; |
1846 surround.access()->border.m_image.setFill(fill); | 1846 m_surround.access()->border.m_image.setFill(fill); |
1847 } | 1847 } |
1848 | 1848 |
1849 void ComputedStyle::setBorderImageWidth(const BorderImageLengthBox& slices) | 1849 void ComputedStyle::setBorderImageWidth(const BorderImageLengthBox& slices) |
1850 { | 1850 { |
1851 if (surround->border.m_image.borderSlices() == slices) | 1851 if (m_surround->border.m_image.borderSlices() == slices) |
1852 return; | 1852 return; |
1853 surround.access()->border.m_image.setBorderSlices(slices); | 1853 m_surround.access()->border.m_image.setBorderSlices(slices); |
1854 } | 1854 } |
1855 | 1855 |
1856 void ComputedStyle::setBorderImageOutset(const BorderImageLengthBox& outset) | 1856 void ComputedStyle::setBorderImageOutset(const BorderImageLengthBox& outset) |
1857 { | 1857 { |
1858 if (surround->border.m_image.outset() == outset) | 1858 if (m_surround->border.m_image.outset() == outset) |
1859 return; | 1859 return; |
1860 surround.access()->border.m_image.setOutset(outset); | 1860 m_surround.access()->border.m_image.setOutset(outset); |
1861 } | 1861 } |
1862 | 1862 |
1863 bool ComputedStyle::borderObscuresBackground() const | 1863 bool ComputedStyle::borderObscuresBackground() const |
1864 { | 1864 { |
1865 if (!hasBorder()) | 1865 if (!hasBorder()) |
1866 return false; | 1866 return false; |
1867 | 1867 |
1868 // Bail if we have any border-image for now. We could look at the image alph
a to improve this. | 1868 // Bail if we have any border-image for now. We could look at the image alph
a to improve this. |
1869 if (borderImage().image()) | 1869 if (borderImage().image()) |
1870 return false; | 1870 return false; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 if (value < 0) | 1934 if (value < 0) |
1935 fvalue -= 0.5f; | 1935 fvalue -= 0.5f; |
1936 else | 1936 else |
1937 fvalue += 0.5f; | 1937 fvalue += 0.5f; |
1938 } | 1938 } |
1939 | 1939 |
1940 return roundForImpreciseConversion<int>(fvalue / zoomFactor); | 1940 return roundForImpreciseConversion<int>(fvalue / zoomFactor); |
1941 } | 1941 } |
1942 | 1942 |
1943 } // namespace blink | 1943 } // namespace blink |
OLD | NEW |