| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 unsigned m_width; | 62 unsigned m_width; |
| 63 }; | 63 }; |
| 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 InheritedFlags { | 72 struct InheritedData { |
| 73 unsigned m_bitfields[2]; | 73 unsigned m_bitfields[2]; |
| 74 } inherited_flags; | 74 } inherited_data; |
| 75 | 75 |
| 76 struct NonInheritedFlags { | 76 struct NonInheritedData { |
| 77 unsigned m_bitfields[3]; | 77 unsigned m_bitfields[3]; |
| 78 } noninherited_flags; | 78 } noninherited_data; |
| 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 24 matching lines...) Expand all Loading... |
| 113 : m_box(initialStyle().m_box) | 113 : m_box(initialStyle().m_box) |
| 114 , visual(initialStyle().visual) | 114 , visual(initialStyle().visual) |
| 115 , m_background(initialStyle().m_background) | 115 , m_background(initialStyle().m_background) |
| 116 , surround(initialStyle().surround) | 116 , surround(initialStyle().surround) |
| 117 , rareNonInheritedData(initialStyle().rareNonInheritedData) | 117 , rareNonInheritedData(initialStyle().rareNonInheritedData) |
| 118 , rareInheritedData(initialStyle().rareInheritedData) | 118 , rareInheritedData(initialStyle().rareInheritedData) |
| 119 , inherited(initialStyle().inherited) | 119 , inherited(initialStyle().inherited) |
| 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(InheritedFlags) <= 8), "InheritedFlags should not grow
"); | 123 static_assert((sizeof(InheritedData) <= 8), "InheritedData should not grow")
; |
| 124 static_assert((sizeof(NonInheritedFlags) <= 12), "NonInheritedFlags should n
ot 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 visual.init(); |
| 133 m_background.init(); | 133 m_background.init(); |
| 134 surround.init(); | 134 surround.init(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 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 , visual(o.visual) |
| 155 , m_background(o.m_background) | 155 , m_background(o.m_background) |
| 156 , surround(o.surround) | 156 , surround(o.surround) |
| 157 , rareNonInheritedData(o.rareNonInheritedData) | 157 , rareNonInheritedData(o.rareNonInheritedData) |
| 158 , rareInheritedData(o.rareInheritedData) | 158 , rareInheritedData(o.rareInheritedData) |
| 159 , inherited(o.inherited) | 159 , inherited(o.inherited) |
| 160 , m_svgStyle(o.m_svgStyle) | 160 , m_svgStyle(o.m_svgStyle) |
| 161 , inherited_flags(o.inherited_flags) | 161 , inherited_data(o.inherited_data) |
| 162 , noninherited_flags(o.noninherited_flags) | 162 , noninherited_data(o.noninherited_data) |
| 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 17 matching lines...) Expand all Loading... |
| 190 if (!oldStyle && !newStyle) | 190 if (!oldStyle && !newStyle) |
| 191 return NoChange; | 191 return NoChange; |
| 192 | 192 |
| 193 if (oldStyle->display() != newStyle->display() | 193 if (oldStyle->display() != newStyle->display() |
| 194 || oldStyle->hasPseudoStyle(PseudoIdFirstLetter) != newStyle->hasPseudoS
tyle(PseudoIdFirstLetter) | 194 || oldStyle->hasPseudoStyle(PseudoIdFirstLetter) != newStyle->hasPseudoS
tyle(PseudoIdFirstLetter) |
| 195 || !oldStyle->contentDataEquivalent(newStyle) | 195 || !oldStyle->contentDataEquivalent(newStyle) |
| 196 || oldStyle->hasTextCombine() != newStyle->hasTextCombine() | 196 || oldStyle->hasTextCombine() != newStyle->hasTextCombine() |
| 197 || oldStyle->justifyItems() != newStyle->justifyItems()) // TODO (lajava
): We must avoid this Reattach. | 197 || oldStyle->justifyItems() != newStyle->justifyItems()) // TODO (lajava
): We must avoid this Reattach. |
| 198 return Reattach; | 198 return Reattach; |
| 199 | 199 |
| 200 if (oldStyle->inheritedNotEqual(*newStyle)) | 200 if (!oldStyle->inheritedEqual(*newStyle) |
| 201 || !oldStyle->loadingCustomFontsEqual(*newStyle)) |
| 201 return Inherit; | 202 return Inherit; |
| 202 | 203 |
| 203 if (*oldStyle == *newStyle) | 204 if (*oldStyle == *newStyle) |
| 204 return diffPseudoStyles(*oldStyle, *newStyle); | 205 return diffPseudoStyles(*oldStyle, *newStyle); |
| 205 | 206 |
| 206 if (oldStyle->hasExplicitlyInheritedProperties()) | 207 if (oldStyle->hasExplicitlyInheritedProperties()) |
| 207 return Inherit; | 208 return Inherit; |
| 208 | 209 |
| 209 return NoInherit; | 210 return NoInherit; |
| 210 } | 211 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 { | 270 { |
| 270 if (isAtShadowBoundary == AtShadowBoundary) { | 271 if (isAtShadowBoundary == AtShadowBoundary) { |
| 271 // 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 |
| 272 EUserModify currentUserModify = userModify(); | 273 EUserModify currentUserModify = userModify(); |
| 273 rareInheritedData = inheritParent.rareInheritedData; | 274 rareInheritedData = inheritParent.rareInheritedData; |
| 274 setUserModify(currentUserModify); | 275 setUserModify(currentUserModify); |
| 275 } else { | 276 } else { |
| 276 rareInheritedData = inheritParent.rareInheritedData; | 277 rareInheritedData = inheritParent.rareInheritedData; |
| 277 } | 278 } |
| 278 inherited = inheritParent.inherited; | 279 inherited = inheritParent.inherited; |
| 279 inherited_flags = inheritParent.inherited_flags; | 280 inherited_data = inheritParent.inherited_data; |
| 280 if (m_svgStyle != inheritParent.m_svgStyle) | 281 if (m_svgStyle != inheritParent.m_svgStyle) |
| 281 m_svgStyle.access()->inheritFrom(inheritParent.m_svgStyle.get()); | 282 m_svgStyle.access()->inheritFrom(inheritParent.m_svgStyle.get()); |
| 282 } | 283 } |
| 283 | 284 |
| 284 void ComputedStyle::copyNonInheritedFromCached(const ComputedStyle& other) | 285 void ComputedStyle::copyNonInheritedFromCached(const ComputedStyle& other) |
| 285 { | 286 { |
| 286 m_box = other.m_box; | 287 m_box = other.m_box; |
| 287 visual = other.visual; | 288 visual = other.visual; |
| 288 m_background = other.m_background; | 289 m_background = other.m_background; |
| 289 surround = other.surround; | 290 surround = other.surround; |
| 290 rareNonInheritedData = other.rareNonInheritedData; | 291 rareNonInheritedData = other.rareNonInheritedData; |
| 291 | 292 |
| 292 // The flags are copied one-by-one because noninherited_flags contains a bun
ch of stuff other than real style data. | 293 // The flags are copied one-by-one because noninherited_data.m_contains a bu
nch of stuff other than real style data. |
| 293 // See comments for each skipped flag below. | 294 // See comments for each skipped flag below. |
| 294 noninherited_flags.effectiveDisplay = other.noninherited_flags.effectiveDisp
lay; | 295 noninherited_data.m_effectiveDisplay = other.noninherited_data.m_effectiveDi
splay; |
| 295 noninherited_flags.originalDisplay = other.noninherited_flags.originalDispla
y; | 296 noninherited_data.m_originalDisplay = other.noninherited_data.m_originalDisp
lay; |
| 296 noninherited_flags.overflowX = other.noninherited_flags.overflowX; | 297 noninherited_data.m_overflowX = other.noninherited_data.m_overflowX; |
| 297 noninherited_flags.overflowY = other.noninherited_flags.overflowY; | 298 noninherited_data.m_overflowY = other.noninherited_data.m_overflowY; |
| 298 noninherited_flags.verticalAlign = other.noninherited_flags.verticalAlign; | 299 noninherited_data.m_verticalAlign = other.noninherited_data.m_verticalAlign; |
| 299 noninherited_flags.clear = other.noninherited_flags.clear; | 300 noninherited_data.m_clear = other.noninherited_data.m_clear; |
| 300 noninherited_flags.position = other.noninherited_flags.position; | 301 noninherited_data.m_position = other.noninherited_data.m_position; |
| 301 noninherited_flags.floating = other.noninherited_flags.floating; | 302 noninherited_data.m_floating = other.noninherited_data.m_floating; |
| 302 noninherited_flags.tableLayout = other.noninherited_flags.tableLayout; | 303 noninherited_data.m_tableLayout = other.noninherited_data.m_tableLayout; |
| 303 noninherited_flags.unicodeBidi = other.noninherited_flags.unicodeBidi; | 304 noninherited_data.m_unicodeBidi = other.noninherited_data.m_unicodeBidi; |
| 304 noninherited_flags.hasViewportUnits = other.noninherited_flags.hasViewportUn
its; | 305 noninherited_data.m_hasViewportUnits = other.noninherited_data.m_hasViewport
Units; |
| 305 noninherited_flags.breakBefore = other.noninherited_flags.breakBefore; | 306 noninherited_data.m_breakBefore = other.noninherited_data.m_breakBefore; |
| 306 noninherited_flags.breakAfter = other.noninherited_flags.breakAfter; | 307 noninherited_data.m_breakAfter = other.noninherited_data.m_breakAfter; |
| 307 noninherited_flags.breakInside = other.noninherited_flags.breakInside; | 308 noninherited_data.m_breakInside = other.noninherited_data.m_breakInside; |
| 308 noninherited_flags.hasRemUnits = other.noninherited_flags.hasRemUnits; | 309 noninherited_data.m_hasRemUnits = other.noninherited_data.m_hasRemUnits; |
| 309 | 310 |
| 310 // Correctly set during selector matching: | 311 // Correctly set during selector matching: |
| 311 // noninherited_flags.styleType | 312 // noninherited_data.m_styleType |
| 312 // noninherited_flags.pseudoBits | 313 // noninherited_data.m_pseudoBits |
| 313 | 314 |
| 314 // Set correctly while computing style for children: | 315 // Set correctly while computing style for children: |
| 315 // noninherited_flags.explicitInheritance | 316 // noninherited_data.m_explicitInheritance |
| 316 | 317 |
| 317 // unique() styles are not cacheable. | 318 // unique() styles are not cacheable. |
| 318 ASSERT(!other.noninherited_flags.unique); | 319 DCHECK(!other.noninherited_data.m_unique); |
| 319 | 320 |
| 320 // styles with non inherited properties that reference variables are not | 321 // styles with non inherited properties that reference variables are not |
| 321 // cacheable. | 322 // cacheable. |
| 322 ASSERT(!other.noninherited_flags.variableReference); | 323 DCHECK(!other.noninherited_data.m_variableReference); |
| 323 | 324 |
| 324 // 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 |
| 325 // match in the MatchedPropertiesCache which in turn calls this method. The | 326 // match in the MatchedPropertiesCache which in turn calls this method. The |
| 326 // 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 |
| 327 // 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 |
| 328 // properties. For instance, given the rule: | 329 // properties. For instance, given the rule: |
| 329 // | 330 // |
| 330 // :-webkit-any(:hover, :focus) { background-color: green }" | 331 // :-webkit-any(:hover, :focus) { background-color: green }" |
| 331 // | 332 // |
| 332 // 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 |
| 333 // 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 |
| 334 // the matching order of the :-webkit-any components. | 335 // the matching order of the :-webkit-any components. |
| 335 // | 336 // |
| 336 // noninherited_flags.emptyState | 337 // noninherited_data.m_emptyState |
| 337 // noninherited_flags.affectedByFocus | 338 // noninherited_data.m_affectedByFocus |
| 338 // noninherited_flags.affectedByHover | 339 // noninherited_data.m_affectedByHover |
| 339 // noninherited_flags.affectedByActive | 340 // noninherited_data.m_affectedByActive |
| 340 // noninherited_flags.affectedByDrag | 341 // noninherited_data.m_affectedByDrag |
| 341 // noninherited_flags.isLink | 342 // noninherited_data.m_isLink |
| 342 | 343 |
| 343 if (m_svgStyle != other.m_svgStyle) | 344 if (m_svgStyle != other.m_svgStyle) |
| 344 m_svgStyle.access()->copyNonInheritedFromCached(other.m_svgStyle.get()); | 345 m_svgStyle.access()->copyNonInheritedFromCached(other.m_svgStyle.get()); |
| 345 ASSERT(zoom() == initialZoom()); | 346 DCHECK_EQ(zoom(), initialZoom()); |
| 346 } | 347 } |
| 347 | 348 |
| 348 bool ComputedStyle::operator==(const ComputedStyle& o) const | 349 bool ComputedStyle::operator==(const ComputedStyle& o) const |
| 349 { | 350 { |
| 350 // compare everything except the pseudoStyle pointer | 351 return inheritedEqual(o) |
| 351 return inherited_flags == o.inherited_flags | 352 && nonInheritedEqual(o); |
| 352 && noninherited_flags == o.noninherited_flags | |
| 353 && m_box == o.m_box | |
| 354 && visual == o.visual | |
| 355 && m_background == o.m_background | |
| 356 && surround == o.surround | |
| 357 && rareNonInheritedData == o.rareNonInheritedData | |
| 358 && rareInheritedData == o.rareInheritedData | |
| 359 && inherited == o.inherited | |
| 360 && m_svgStyle == o.m_svgStyle; | |
| 361 } | 353 } |
| 362 | 354 |
| 363 bool ComputedStyle::isStyleAvailable() const | 355 bool ComputedStyle::isStyleAvailable() const |
| 364 { | 356 { |
| 365 return this != StyleResolver::styleNotYetAvailable(); | 357 return this != StyleResolver::styleNotYetAvailable(); |
| 366 } | 358 } |
| 367 | 359 |
| 368 bool ComputedStyle::hasUniquePseudoStyle() const | 360 bool ComputedStyle::hasUniquePseudoStyle() const |
| 369 { | 361 { |
| 370 if (!m_cachedPseudoStyles || styleType() != PseudoIdNone) | 362 if (!m_cachedPseudoStyles || styleType() != PseudoIdNone) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 return; | 411 return; |
| 420 for (size_t i = 0; i < m_cachedPseudoStyles->size(); ++i) { | 412 for (size_t i = 0; i < m_cachedPseudoStyles->size(); ++i) { |
| 421 ComputedStyle* pseudoStyle = m_cachedPseudoStyles->at(i).get(); | 413 ComputedStyle* pseudoStyle = m_cachedPseudoStyles->at(i).get(); |
| 422 if (pseudoStyle->styleType() == pid) { | 414 if (pseudoStyle->styleType() == pid) { |
| 423 m_cachedPseudoStyles->remove(i); | 415 m_cachedPseudoStyles->remove(i); |
| 424 return; | 416 return; |
| 425 } | 417 } |
| 426 } | 418 } |
| 427 } | 419 } |
| 428 | 420 |
| 429 bool ComputedStyle::inheritedNotEqual(const ComputedStyle& other) const | 421 bool ComputedStyle::inheritedEqual(const ComputedStyle& other) const |
| 430 { | 422 { |
| 431 return inherited_flags != other.inherited_flags | 423 return inherited_data == other.inherited_data |
| 432 || inherited != other.inherited | 424 && inherited == other.inherited |
| 433 || font().loadingCustomFonts() != other.font().loadingCustomFonts() | 425 && m_svgStyle->inheritedEqual(*other.m_svgStyle) |
| 434 || m_svgStyle->inheritedNotEqual(other.m_svgStyle.get()) | 426 && rareInheritedData == other.rareInheritedData; |
| 435 || rareInheritedData != other.rareInheritedData; | 427 } |
| 428 |
| 429 bool ComputedStyle::loadingCustomFontsEqual(const ComputedStyle& other) const |
| 430 { |
| 431 return font().loadingCustomFonts() == other.font().loadingCustomFonts(); |
| 432 } |
| 433 |
| 434 bool ComputedStyle::nonInheritedEqual(const ComputedStyle& other) const |
| 435 { |
| 436 // compare everything except the pseudoStyle pointer |
| 437 return noninherited_data == other.noninherited_data |
| 438 && m_box == other.m_box |
| 439 && visual == other.visual |
| 440 && m_background == other.m_background |
| 441 && surround == other.surround |
| 442 && rareNonInheritedData == other.rareNonInheritedData |
| 443 && m_svgStyle->nonInheritedEqual(*other.m_svgStyle); |
| 436 } | 444 } |
| 437 | 445 |
| 438 bool ComputedStyle::inheritedDataShared(const ComputedStyle& other) const | 446 bool ComputedStyle::inheritedDataShared(const ComputedStyle& other) const |
| 439 { | 447 { |
| 440 // 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. |
| 441 return inherited_flags == other.inherited_flags | 449 return inherited_data == other.inherited_data |
| 442 && inherited.get() == other.inherited.get() | 450 && inherited.get() == other.inherited.get() |
| 443 && m_svgStyle.get() == other.m_svgStyle.get() | 451 && m_svgStyle.get() == other.m_svgStyle.get() |
| 444 && rareInheritedData.get() == other.rareInheritedData.get(); | 452 && rareInheritedData.get() == other.rareInheritedData.get(); |
| 445 } | 453 } |
| 446 | 454 |
| 447 static bool dependenceOnContentHeightHasChanged(const ComputedStyle& a, const Co
mputedStyle& b) | 455 static bool dependenceOnContentHeightHasChanged(const ComputedStyle& a, const Co
mputedStyle& b) |
| 448 { | 456 { |
| 449 // 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 |
| 450 // 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) |
| 451 // - either way requires a layout. | 459 // - either way requires a layout. |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 return true; | 616 return true; |
| 609 | 617 |
| 610 if (inherited.get() != other.inherited.get()) { | 618 if (inherited.get() != other.inherited.get()) { |
| 611 if (inherited->line_height != other.inherited->line_height | 619 if (inherited->line_height != other.inherited->line_height |
| 612 || inherited->font != other.inherited->font | 620 || inherited->font != other.inherited->font |
| 613 || inherited->horizontal_border_spacing != other.inherited->horizont
al_border_spacing | 621 || inherited->horizontal_border_spacing != other.inherited->horizont
al_border_spacing |
| 614 || inherited->vertical_border_spacing != other.inherited->vertical_b
order_spacing) | 622 || inherited->vertical_border_spacing != other.inherited->vertical_b
order_spacing) |
| 615 return true; | 623 return true; |
| 616 } | 624 } |
| 617 | 625 |
| 618 if (inherited_flags._box_direction != other.inherited_flags._box_direction | 626 if (inherited_data.m_boxDirection != other.inherited_data.m_boxDirection |
| 619 || inherited_flags.m_rtlOrdering != other.inherited_flags.m_rtlOrdering | 627 || inherited_data.m_rtlOrdering != other.inherited_data.m_rtlOrdering |
| 620 || inherited_flags._text_align != other.inherited_flags._text_align | 628 || inherited_data.m_textAlign != other.inherited_data.m_textAlign |
| 621 || inherited_flags._text_transform != other.inherited_flags._text_transf
orm | 629 || inherited_data.m_textTransform != other.inherited_data.m_textTransfor
m |
| 622 || inherited_flags._direction != other.inherited_flags._direction | 630 || inherited_data.m_direction != other.inherited_data.m_direction |
| 623 || inherited_flags._white_space != other.inherited_flags._white_space | 631 || inherited_data.m_whiteSpace != other.inherited_data.m_whiteSpace |
| 624 || inherited_flags.m_writingMode != other.inherited_flags.m_writingMode) | 632 || inherited_data.m_writingMode != other.inherited_data.m_writingMode) |
| 625 return true; | 633 return true; |
| 626 | 634 |
| 627 if (noninherited_flags.overflowX != other.noninherited_flags.overflowX | 635 if (noninherited_data.m_overflowX != other.noninherited_data.m_overflowX |
| 628 || noninherited_flags.overflowY != other.noninherited_flags.overflowY | 636 || noninherited_data.m_overflowY != other.noninherited_data.m_overflowY |
| 629 || noninherited_flags.clear != other.noninherited_flags.clear | 637 || noninherited_data.m_clear != other.noninherited_data.m_clear |
| 630 || noninherited_flags.unicodeBidi != other.noninherited_flags.unicodeBid
i | 638 || noninherited_data.m_unicodeBidi != other.noninherited_data.m_unicodeB
idi |
| 631 || noninherited_flags.floating != other.noninherited_flags.floating | 639 || noninherited_data.m_floating != other.noninherited_data.m_floating |
| 632 || noninherited_flags.originalDisplay != other.noninherited_flags.origin
alDisplay) | 640 || noninherited_data.m_originalDisplay != other.noninherited_data.m_orig
inalDisplay) |
| 633 return true; | 641 return true; |
| 634 | 642 |
| 635 if (noninherited_flags.effectiveDisplay >= FIRST_TABLE_DISPLAY && noninherit
ed_flags.effectiveDisplay <= LAST_TABLE_DISPLAY) { | 643 if (noninherited_data.m_effectiveDisplay >= FIRST_TABLE_DISPLAY && noninheri
ted_data.m_effectiveDisplay <= LAST_TABLE_DISPLAY) { |
| 636 if (inherited_flags._border_collapse != other.inherited_flags._border_co
llapse | 644 if (inherited_data.m_borderCollapse != other.inherited_data.m_borderColl
apse |
| 637 || inherited_flags._empty_cells != other.inherited_flags._empty_cell
s | 645 || inherited_data.m_emptyCells != other.inherited_data.m_emptyCells |
| 638 || inherited_flags._caption_side != other.inherited_flags._caption_s
ide | 646 || inherited_data.m_captionSide != other.inherited_data.m_captionSid
e |
| 639 || noninherited_flags.tableLayout != other.noninherited_flags.tableL
ayout) | 647 || noninherited_data.m_tableLayout != other.noninherited_data.m_tabl
eLayout) |
| 640 return true; | 648 return true; |
| 641 | 649 |
| 642 // 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' |
| 643 // does not, so these style differences can be width differences. | 651 // does not, so these style differences can be width differences. |
| 644 if (inherited_flags._border_collapse | 652 if (inherited_data.m_borderCollapse |
| 645 && ((borderTopStyle() == BorderStyleHidden && other.borderTopStyle()
== BorderStyleNone) | 653 && ((borderTopStyle() == BorderStyleHidden && other.borderTopStyle()
== BorderStyleNone) |
| 646 || (borderTopStyle() == BorderStyleNone && other.borderTopStyle(
) == BorderStyleHidden) | 654 || (borderTopStyle() == BorderStyleNone && other.borderTopStyle(
) == BorderStyleHidden) |
| 647 || (borderBottomStyle() == BorderStyleHidden && other.borderBott
omStyle() == BorderStyleNone) | 655 || (borderBottomStyle() == BorderStyleHidden && other.borderBott
omStyle() == BorderStyleNone) |
| 648 || (borderBottomStyle() == BorderStyleNone && other.borderBottom
Style() == BorderStyleHidden) | 656 || (borderBottomStyle() == BorderStyleNone && other.borderBottom
Style() == BorderStyleHidden) |
| 649 || (borderLeftStyle() == BorderStyleHidden && other.borderLeftSt
yle() == BorderStyleNone) | 657 || (borderLeftStyle() == BorderStyleHidden && other.borderLeftSt
yle() == BorderStyleNone) |
| 650 || (borderLeftStyle() == BorderStyleNone && other.borderLeftStyl
e() == BorderStyleHidden) | 658 || (borderLeftStyle() == BorderStyleNone && other.borderLeftStyl
e() == BorderStyleHidden) |
| 651 || (borderRightStyle() == BorderStyleHidden && other.borderRight
Style() == BorderStyleNone) | 659 || (borderRightStyle() == BorderStyleHidden && other.borderRight
Style() == BorderStyleNone) |
| 652 || (borderRightStyle() == BorderStyleNone && other.borderRightSt
yle() == BorderStyleHidden))) | 660 || (borderRightStyle() == BorderStyleNone && other.borderRightSt
yle() == BorderStyleHidden))) |
| 653 return true; | 661 return true; |
| 654 } else if (noninherited_flags.effectiveDisplay == LIST_ITEM) { | 662 } else if (noninherited_data.m_effectiveDisplay == LIST_ITEM) { |
| 655 if (inherited_flags._list_style_type != other.inherited_flags._list_styl
e_type | 663 if (inherited_data.m_listStyleType != other.inherited_data.m_listStyleTy
pe |
| 656 || inherited_flags._list_style_position != other.inherited_flags._li
st_style_position) | 664 || inherited_data.m_listStylePosition != other.inherited_data.m_list
StylePosition) |
| 657 return true; | 665 return true; |
| 658 } | 666 } |
| 659 | 667 |
| 660 if ((visibility() == COLLAPSE) != (other.visibility() == COLLAPSE)) | 668 if ((visibility() == COLLAPSE) != (other.visibility() == COLLAPSE)) |
| 661 return true; | 669 return true; |
| 662 | 670 |
| 663 if (hasPseudoStyle(PseudoIdScrollbar) != other.hasPseudoStyle(PseudoIdScroll
bar)) | 671 if (hasPseudoStyle(PseudoIdScrollbar) != other.hasPseudoStyle(PseudoIdScroll
bar)) |
| 664 return true; | 672 return true; |
| 665 | 673 |
| 666 // 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... |
| 679 || m_box->maxHeight() != other.m_box->maxHeight()) | 687 || m_box->maxHeight() != other.m_box->maxHeight()) |
| 680 return true; | 688 return true; |
| 681 | 689 |
| 682 if (m_box->verticalAlign() != other.m_box->verticalAlign()) | 690 if (m_box->verticalAlign() != other.m_box->verticalAlign()) |
| 683 return true; | 691 return true; |
| 684 | 692 |
| 685 if (m_box->boxSizing() != other.m_box->boxSizing()) | 693 if (m_box->boxSizing() != other.m_box->boxSizing()) |
| 686 return true; | 694 return true; |
| 687 } | 695 } |
| 688 | 696 |
| 689 if (noninherited_flags.verticalAlign != other.noninherited_flags.verticalAli
gn | 697 if (noninherited_data.m_verticalAlign != other.noninherited_data.m_verticalA
lign |
| 690 || noninherited_flags.position != other.noninherited_flags.position) | 698 || noninherited_data.m_position != other.noninherited_data.m_position) |
| 691 return true; | 699 return true; |
| 692 | 700 |
| 693 if (surround.get() != other.surround.get()) { | 701 if (surround.get() != other.surround.get()) { |
| 694 if (surround->padding != other.surround->padding) | 702 if (surround->padding != other.surround->padding) |
| 695 return true; | 703 return true; |
| 696 } | 704 } |
| 697 | 705 |
| 698 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { | 706 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { |
| 699 if (rareNonInheritedData->m_alignContent != other.rareNonInheritedData->
m_alignContent | 707 if (rareNonInheritedData->m_alignContent != other.rareNonInheritedData->
m_alignContent |
| 700 || rareNonInheritedData->m_alignItems != other.rareNonInheritedData-
>m_alignItems | 708 || rareNonInheritedData->m_alignItems != other.rareNonInheritedData-
>m_alignItems |
| (...skipping 30 matching lines...) Expand all Loading... |
| 731 } | 739 } |
| 732 | 740 |
| 733 return false; | 741 return false; |
| 734 } | 742 } |
| 735 | 743 |
| 736 bool ComputedStyle::diffNeedsPaintInvalidationObject(const ComputedStyle& other)
const | 744 bool ComputedStyle::diffNeedsPaintInvalidationObject(const ComputedStyle& other)
const |
| 737 { | 745 { |
| 738 if (!m_background->outline().visuallyEqual(other.m_background->outline())) | 746 if (!m_background->outline().visuallyEqual(other.m_background->outline())) |
| 739 return true; | 747 return true; |
| 740 | 748 |
| 741 if (inherited_flags._visibility != other.inherited_flags._visibility | 749 if (inherited_data.m_visibility != other.inherited_data.m_visibility |
| 742 || inherited_flags.m_printColorAdjust != other.inherited_flags.m_printCo
lorAdjust | 750 || inherited_data.m_printColorAdjust != other.inherited_data.m_printColo
rAdjust |
| 743 || inherited_flags._insideLink != other.inherited_flags._insideLink | 751 || inherited_data.m_insideLink != other.inherited_data.m_insideLink |
| 744 || !surround->border.visuallyEqual(other.surround->border) | 752 || !surround->border.visuallyEqual(other.surround->border) |
| 745 || !m_background->visuallyEqual(*other.m_background)) | 753 || !m_background->visuallyEqual(*other.m_background)) |
| 746 return true; | 754 return true; |
| 747 | 755 |
| 748 if (rareInheritedData.get() != other.rareInheritedData.get()) { | 756 if (rareInheritedData.get() != other.rareInheritedData.get()) { |
| 749 if (rareInheritedData->userModify != other.rareInheritedData->userModify | 757 if (rareInheritedData->userModify != other.rareInheritedData->userModify |
| 750 || rareInheritedData->userSelect != other.rareInheritedData->userSel
ect | 758 || rareInheritedData->userSelect != other.rareInheritedData->userSel
ect |
| 751 || rareInheritedData->m_imageRendering != other.rareInheritedData->m
_imageRendering) | 759 || rareInheritedData->m_imageRendering != other.rareInheritedData->m
_imageRendering) |
| 752 return true; | 760 return true; |
| 753 } | 761 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 if (RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && !rareNonInhe
ritedData->reflectionDataEquivalent(*other.rareNonInheritedData.get())) | 844 if (RuntimeEnabledFeatures::cssBoxReflectFilterEnabled() && !rareNonInhe
ritedData->reflectionDataEquivalent(*other.rareNonInheritedData.get())) |
| 837 diff.setFilterChanged(); | 845 diff.setFilterChanged(); |
| 838 } | 846 } |
| 839 | 847 |
| 840 if (!m_background->outline().visuallyEqual(other.m_background->outline()) ||
!surround->border.visualOverflowEqual(other.surround->border)) | 848 if (!m_background->outline().visuallyEqual(other.m_background->outline()) ||
!surround->border.visualOverflowEqual(other.surround->border)) |
| 841 diff.setNeedsRecomputeOverflow(); | 849 diff.setNeedsRecomputeOverflow(); |
| 842 | 850 |
| 843 if (!diff.needsPaintInvalidation()) { | 851 if (!diff.needsPaintInvalidation()) { |
| 844 if (inherited->color != other.inherited->color | 852 if (inherited->color != other.inherited->color |
| 845 || inherited->visitedLinkColor != other.inherited->visitedLinkColor | 853 || inherited->visitedLinkColor != other.inherited->visitedLinkColor |
| 846 || inherited_flags.m_textUnderline != other.inherited_flags.m_textUn
derline | 854 || inherited_data.m_textUnderline != other.inherited_data.m_textUnde
rline |
| 847 || visual->textDecoration != other.visual->textDecoration) { | 855 || visual->textDecoration != other.visual->textDecoration) { |
| 848 diff.setTextDecorationOrColorChanged(); | 856 diff.setTextDecorationOrColorChanged(); |
| 849 } else if (rareNonInheritedData.get() != other.rareNonInheritedData.get(
) | 857 } else if (rareNonInheritedData.get() != other.rareNonInheritedData.get(
) |
| 850 && (rareNonInheritedData->m_textDecorationStyle != other.rareNonInhe
ritedData->m_textDecorationStyle | 858 && (rareNonInheritedData->m_textDecorationStyle != other.rareNonInhe
ritedData->m_textDecorationStyle |
| 851 || rareNonInheritedData->m_textDecorationColor != other.rareNonI
nheritedData->m_textDecorationColor | 859 || rareNonInheritedData->m_textDecorationColor != other.rareNonI
nheritedData->m_textDecorationColor |
| 852 || rareNonInheritedData->m_visitedLinkTextDecorationColor != oth
er.rareNonInheritedData->m_visitedLinkTextDecorationColor)) { | 860 || rareNonInheritedData->m_visitedLinkTextDecorationColor != oth
er.rareNonInheritedData->m_visitedLinkTextDecorationColor)) { |
| 853 diff.setTextDecorationOrColorChanged(); | 861 diff.setTextDecorationOrColorChanged(); |
| 854 } else if (rareInheritedData.get() != other.rareInheritedData.get() | 862 } else if (rareInheritedData.get() != other.rareInheritedData.get() |
| 855 && (rareInheritedData->textFillColor() != other.rareInheritedData->t
extFillColor() | 863 && (rareInheritedData->textFillColor() != other.rareInheritedData->t
extFillColor() |
| 856 || rareInheritedData->textStrokeColor() != other.rareInheritedDa
ta->textStrokeColor() | 864 || rareInheritedData->textStrokeColor() != other.rareInheritedDa
ta->textStrokeColor() |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 const Vector<AppliedTextDecoration>& applied = appliedTextDecorations(); | 1287 const Vector<AppliedTextDecoration>& applied = appliedTextDecorations(); |
| 1280 | 1288 |
| 1281 for (size_t i = 0; i < applied.size(); ++i) | 1289 for (size_t i = 0; i < applied.size(); ++i) |
| 1282 decorations |= applied[i].line(); | 1290 decorations |= applied[i].line(); |
| 1283 | 1291 |
| 1284 return static_cast<TextDecoration>(decorations); | 1292 return static_cast<TextDecoration>(decorations); |
| 1285 } | 1293 } |
| 1286 | 1294 |
| 1287 const Vector<AppliedTextDecoration>& ComputedStyle::appliedTextDecorations() con
st | 1295 const Vector<AppliedTextDecoration>& ComputedStyle::appliedTextDecorations() con
st |
| 1288 { | 1296 { |
| 1289 if (!inherited_flags.m_textUnderline && !rareInheritedData->appliedTextDecor
ations) { | 1297 if (!inherited_data.m_textUnderline && !rareInheritedData->appliedTextDecora
tions) { |
| 1290 DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, empty, ()); | 1298 DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, empty, ()); |
| 1291 return empty; | 1299 return empty; |
| 1292 } | 1300 } |
| 1293 if (inherited_flags.m_textUnderline) { | 1301 if (inherited_data.m_textUnderline) { |
| 1294 DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, underline, (1, Applie
dTextDecoration(TextDecorationUnderline))); | 1302 DEFINE_STATIC_LOCAL(Vector<AppliedTextDecoration>, underline, (1, Applie
dTextDecoration(TextDecorationUnderline))); |
| 1295 return underline; | 1303 return underline; |
| 1296 } | 1304 } |
| 1297 | 1305 |
| 1298 return rareInheritedData->appliedTextDecorations->vector(); | 1306 return rareInheritedData->appliedTextDecorations->vector(); |
| 1299 } | 1307 } |
| 1300 | 1308 |
| 1301 StyleVariableData* ComputedStyle::variables() const | 1309 StyleVariableData* ComputedStyle::variables() const |
| 1302 { | 1310 { |
| 1303 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); | 1311 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled()); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 | 1426 |
| 1419 void ComputedStyle::addAppliedTextDecoration(const AppliedTextDecoration& decora
tion) | 1427 void ComputedStyle::addAppliedTextDecoration(const AppliedTextDecoration& decora
tion) |
| 1420 { | 1428 { |
| 1421 RefPtr<AppliedTextDecorationList>& list = rareInheritedData.access()->applie
dTextDecorations; | 1429 RefPtr<AppliedTextDecorationList>& list = rareInheritedData.access()->applie
dTextDecorations; |
| 1422 | 1430 |
| 1423 if (!list) | 1431 if (!list) |
| 1424 list = AppliedTextDecorationList::create(); | 1432 list = AppliedTextDecorationList::create(); |
| 1425 else if (!list->hasOneRef()) | 1433 else if (!list->hasOneRef()) |
| 1426 list = list->copy(); | 1434 list = list->copy(); |
| 1427 | 1435 |
| 1428 if (inherited_flags.m_textUnderline) { | 1436 if (inherited_data.m_textUnderline) { |
| 1429 inherited_flags.m_textUnderline = false; | 1437 inherited_data.m_textUnderline = false; |
| 1430 list->append(AppliedTextDecoration(TextDecorationUnderline)); | 1438 list->append(AppliedTextDecoration(TextDecorationUnderline)); |
| 1431 } | 1439 } |
| 1432 | 1440 |
| 1433 list->append(decoration); | 1441 list->append(decoration); |
| 1434 } | 1442 } |
| 1435 | 1443 |
| 1436 void ComputedStyle::applyTextDecorations() | 1444 void ComputedStyle::applyTextDecorations() |
| 1437 { | 1445 { |
| 1438 if (getTextDecoration() == TextDecorationNone) | 1446 if (getTextDecoration() == TextDecorationNone) |
| 1439 return; | 1447 return; |
| 1440 | 1448 |
| 1441 TextDecorationStyle style = getTextDecorationStyle(); | 1449 TextDecorationStyle style = getTextDecorationStyle(); |
| 1442 StyleColor styleColor = decorationColorIncludingFallback(insideLink() == Ins
ideVisitedLink); | 1450 StyleColor styleColor = decorationColorIncludingFallback(insideLink() == Ins
ideVisitedLink); |
| 1443 | 1451 |
| 1444 int decorations = getTextDecoration(); | 1452 int decorations = getTextDecoration(); |
| 1445 | 1453 |
| 1446 if (decorations & TextDecorationUnderline) { | 1454 if (decorations & TextDecorationUnderline) { |
| 1447 // To save memory, we don't use AppliedTextDecoration objects in the | 1455 // To save memory, we don't use AppliedTextDecoration objects in the |
| 1448 // common case of a single simple underline. | 1456 // common case of a single simple underline. |
| 1449 AppliedTextDecoration underline(TextDecorationUnderline, style, styleCol
or); | 1457 AppliedTextDecoration underline(TextDecorationUnderline, style, styleCol
or); |
| 1450 | 1458 |
| 1451 if (!rareInheritedData->appliedTextDecorations && underline.isSimpleUnde
rline()) | 1459 if (!rareInheritedData->appliedTextDecorations && underline.isSimpleUnde
rline()) |
| 1452 inherited_flags.m_textUnderline = true; | 1460 inherited_data.m_textUnderline = true; |
| 1453 else | 1461 else |
| 1454 addAppliedTextDecoration(underline); | 1462 addAppliedTextDecoration(underline); |
| 1455 } | 1463 } |
| 1456 if (decorations & TextDecorationOverline) | 1464 if (decorations & TextDecorationOverline) |
| 1457 addAppliedTextDecoration(AppliedTextDecoration(TextDecorationOverline, s
tyle, styleColor)); | 1465 addAppliedTextDecoration(AppliedTextDecoration(TextDecorationOverline, s
tyle, styleColor)); |
| 1458 if (decorations & TextDecorationLineThrough) | 1466 if (decorations & TextDecorationLineThrough) |
| 1459 addAppliedTextDecoration(AppliedTextDecoration(TextDecorationLineThrough
, style, styleColor)); | 1467 addAppliedTextDecoration(AppliedTextDecoration(TextDecorationLineThrough
, style, styleColor)); |
| 1460 } | 1468 } |
| 1461 | 1469 |
| 1462 void ComputedStyle::clearAppliedTextDecorations() | 1470 void ComputedStyle::clearAppliedTextDecorations() |
| 1463 { | 1471 { |
| 1464 inherited_flags.m_textUnderline = false; | 1472 inherited_data.m_textUnderline = false; |
| 1465 | 1473 |
| 1466 if (rareInheritedData->appliedTextDecorations) | 1474 if (rareInheritedData->appliedTextDecorations) |
| 1467 rareInheritedData.access()->appliedTextDecorations = nullptr; | 1475 rareInheritedData.access()->appliedTextDecorations = nullptr; |
| 1468 } | 1476 } |
| 1469 | 1477 |
| 1470 void ComputedStyle::clearMultiCol() | 1478 void ComputedStyle::clearMultiCol() |
| 1471 { | 1479 { |
| 1472 rareNonInheritedData.access()->m_multiCol = nullptr; | 1480 rareNonInheritedData.access()->m_multiCol = nullptr; |
| 1473 rareNonInheritedData.access()->m_multiCol.init(); | 1481 rareNonInheritedData.access()->m_multiCol.init(); |
| 1474 } | 1482 } |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1874 if (value < 0) | 1882 if (value < 0) |
| 1875 fvalue -= 0.5f; | 1883 fvalue -= 0.5f; |
| 1876 else | 1884 else |
| 1877 fvalue += 0.5f; | 1885 fvalue += 0.5f; |
| 1878 } | 1886 } |
| 1879 | 1887 |
| 1880 return roundForImpreciseConversion<int>(fvalue / zoomFactor); | 1888 return roundForImpreciseConversion<int>(fvalue / zoomFactor); |
| 1881 } | 1889 } |
| 1882 | 1890 |
| 1883 } // namespace blink | 1891 } // namespace blink |
| OLD | NEW |