| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 if ((!oldStyle && newStyle) || (oldStyle && !newStyle)) | 170 if ((!oldStyle && newStyle) || (oldStyle && !newStyle)) |
| 171 return Reattach; | 171 return Reattach; |
| 172 | 172 |
| 173 if (!oldStyle && !newStyle) | 173 if (!oldStyle && !newStyle) |
| 174 return NoChange; | 174 return NoChange; |
| 175 | 175 |
| 176 if (oldStyle->display() != newStyle->display() | 176 if (oldStyle->display() != newStyle->display() |
| 177 || oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FI
RST_LETTER) | 177 || oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FI
RST_LETTER) |
| 178 || oldStyle->columnSpan() != newStyle->columnSpan() | 178 || oldStyle->columnSpan() != newStyle->columnSpan() |
| 179 || !oldStyle->contentDataEquivalent(newStyle) | 179 || !oldStyle->contentDataEquivalent(newStyle) |
| 180 || oldStyle->hasTextCombine() != newStyle->hasTextCombine() | 180 || oldStyle->hasTextCombine() != newStyle->hasTextCombine()) |
| 181 || oldStyle->justifyItems() != newStyle->justifyItems() | |
| 182 || oldStyle->alignItems() != newStyle->alignItems()) | |
| 183 return Reattach; | 181 return Reattach; |
| 184 | 182 |
| 185 if (oldStyle->inheritedNotEqual(*newStyle)) | 183 if (oldStyle->inheritedNotEqual(*newStyle)) |
| 186 return Inherit; | 184 return Inherit; |
| 187 | 185 |
| 188 if (*oldStyle == *newStyle) | 186 if (*oldStyle == *newStyle) |
| 189 return diffPseudoStyles(*oldStyle, *newStyle); | 187 return diffPseudoStyles(*oldStyle, *newStyle); |
| 190 | 188 |
| 191 if (oldStyle->hasExplicitlyInheritedProperties()) | 189 if (oldStyle->hasExplicitlyInheritedProperties()) |
| 192 return Inherit; | 190 return Inherit; |
| 193 | 191 |
| 194 return NoInherit; | 192 return NoInherit; |
| 195 } | 193 } |
| 196 | 194 |
| 197 ItemPosition ComputedStyle::resolveAlignment(const ComputedStyle& parentStyle, c
onst ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject
) | 195 ItemPosition ComputedStyle::resolvedAlignSelfPosition(const ComputedStyle& paren
tStyle, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLay
outObject) |
| 198 { | 196 { |
| 199 // The auto keyword computes to the parent's align-items computed value, or
to "stretch", if not set or "auto". | 197 // The auto keyword computes to the parent's align-items computed value, or
to "stretch", if not set or "auto". |
| 200 if (childStyle.alignSelfPosition() == ItemPositionAuto) | 198 if (childStyle.alignSelfPosition() == ItemPositionAuto) |
| 201 return (parentStyle.alignItemsPosition() == ItemPositionAuto) ? resolved
AutoPositionForLayoutObject : parentStyle.alignItemsPosition(); | 199 return (parentStyle.alignItemsPosition() == ItemPositionAuto) ? resolved
AutoPositionForLayoutObject : parentStyle.alignItemsPosition(); |
| 202 return childStyle.alignSelfPosition(); | 200 return childStyle.alignSelfPosition(); |
| 203 } | 201 } |
| 204 | 202 |
| 205 ItemPosition ComputedStyle::resolveJustification(const ComputedStyle& parentStyl
e, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutOb
ject) | 203 OverflowAlignment ComputedStyle::resolvedAlignSelfOverflow(const ComputedStyle&
parentStyle, const ComputedStyle& childStyle) |
| 206 { | 204 { |
| 205 // It computes to the parent's align-items computed value if "auto". |
| 206 return (childStyle.alignSelfPosition() == ItemPositionAuto) ? parentStyle.al
ignItemsOverflowAlignment() : childStyle.alignSelfOverflowAlignment(); |
| 207 } |
| 208 |
| 209 ItemPosition ComputedStyle::resolvedJustifySelfPosition(const ComputedStyle& par
entStyle, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForL
ayoutObject) |
| 210 { |
| 211 // The auto keyword computes to the parent's justify-items computed value, o
r to "stretch", if not set or "auto". |
| 207 if (childStyle.justifySelfPosition() == ItemPositionAuto) | 212 if (childStyle.justifySelfPosition() == ItemPositionAuto) |
| 208 return (parentStyle.justifyItemsPosition() == ItemPositionAuto) ? resolv
edAutoPositionForLayoutObject : parentStyle.justifyItemsPosition(); | 213 return (parentStyle.justifyItemsPosition() == ItemPositionAuto) ? resolv
edAutoPositionForLayoutObject : parentStyle.justifyItemsPosition(); |
| 209 return childStyle.justifySelfPosition(); | 214 return childStyle.justifySelfPosition(); |
| 210 } | 215 } |
| 211 | 216 |
| 217 OverflowAlignment ComputedStyle::resolvedJustifySelfOverflow(const ComputedStyle
& parentStyle, const ComputedStyle& childStyle) |
| 218 { |
| 219 // It computes to the parent's justify-items computed value if "auto". |
| 220 return (childStyle.justifySelfPosition() == ItemPositionAuto) ? parentStyle.
justifyItemsOverflowAlignment() : childStyle.justifySelfOverflowAlignment(); |
| 221 } |
| 222 |
| 223 ContentPosition ComputedStyle::resolvedAlignContentPosition() const |
| 224 { |
| 225 const StyleContentAlignmentData& align = alignContent(); |
| 226 if (align.position() != ContentPositionAuto || align.distribution() != Conte
ntDistributionDefault) |
| 227 return align.position(); |
| 228 // 'auto' computes to 'stretch' for flexbox, hence it's managed by distribut
ion(). |
| 229 return isDisplayFlexibleBox() ? ContentPositionAuto : ContentPositionStart; |
| 230 } |
| 231 |
| 232 ContentDistributionType ComputedStyle::resolvedAlignContentDistribution() const |
| 233 { |
| 234 const StyleContentAlignmentData& align = alignContent(); |
| 235 if (align.position() != ContentPositionAuto || align.distribution() != Conte
ntDistributionDefault) |
| 236 return align.distribution(); |
| 237 return isDisplayFlexibleBox() ? ContentDistributionStretch : ContentDistribu
tionDefault; |
| 238 } |
| 239 |
| 240 ContentPosition ComputedStyle::resolvedJustifyContentPosition() const |
| 241 { |
| 242 const StyleContentAlignmentData& justify = justifyContent(); |
| 243 if (justify.position() != ContentPositionAuto || justify.distribution() != C
ontentDistributionDefault) |
| 244 return justify.position(); |
| 245 // 'auto' computes to 'stretch' for flexbox, but since flexing in the main a
xis is controlled by flex, it behaves as flex-start. |
| 246 return isDisplayFlexibleBox() ? ContentPositionFlexStart : ContentPositionSt
art; |
| 247 } |
| 248 |
| 249 ContentDistributionType ComputedStyle::resolvedJustifyContentDistribution() cons
t |
| 250 { |
| 251 // even that 'auto' computes to 'stretch' for flexbox it behaves as flex-sta
rt, hence it's managed by position(). |
| 252 return justifyContentDistribution(); |
| 253 } |
| 254 |
| 212 void ComputedStyle::inheritFrom(const ComputedStyle& inheritParent, IsAtShadowBo
undary isAtShadowBoundary) | 255 void ComputedStyle::inheritFrom(const ComputedStyle& inheritParent, IsAtShadowBo
undary isAtShadowBoundary) |
| 213 { | 256 { |
| 214 if (isAtShadowBoundary == AtShadowBoundary) { | 257 if (isAtShadowBoundary == AtShadowBoundary) { |
| 215 // Even if surrounding content is user-editable, shadow DOM should act a
s a single unit, and not necessarily be editable | 258 // Even if surrounding content is user-editable, shadow DOM should act a
s a single unit, and not necessarily be editable |
| 216 EUserModify currentUserModify = userModify(); | 259 EUserModify currentUserModify = userModify(); |
| 217 rareInheritedData = inheritParent.rareInheritedData; | 260 rareInheritedData = inheritParent.rareInheritedData; |
| 218 setUserModify(currentUserModify); | 261 setUserModify(currentUserModify); |
| 219 } else { | 262 } else { |
| 220 rareInheritedData = inheritParent.rareInheritedData; | 263 rareInheritedData = inheritParent.rareInheritedData; |
| 221 } | 264 } |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { | 504 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { |
| 462 if (rareNonInheritedData->m_appearance != other.rareNonInheritedData->m_
appearance | 505 if (rareNonInheritedData->m_appearance != other.rareNonInheritedData->m_
appearance |
| 463 || rareNonInheritedData->marginBeforeCollapse != other.rareNonInheri
tedData->marginBeforeCollapse | 506 || rareNonInheritedData->marginBeforeCollapse != other.rareNonInheri
tedData->marginBeforeCollapse |
| 464 || rareNonInheritedData->marginAfterCollapse != other.rareNonInherit
edData->marginAfterCollapse | 507 || rareNonInheritedData->marginAfterCollapse != other.rareNonInherit
edData->marginAfterCollapse |
| 465 || rareNonInheritedData->lineClamp != other.rareNonInheritedData->li
neClamp | 508 || rareNonInheritedData->lineClamp != other.rareNonInheritedData->li
neClamp |
| 466 || rareNonInheritedData->textOverflow != other.rareNonInheritedData-
>textOverflow | 509 || rareNonInheritedData->textOverflow != other.rareNonInheritedData-
>textOverflow |
| 467 || rareNonInheritedData->m_wrapFlow != other.rareNonInheritedData->m
_wrapFlow | 510 || rareNonInheritedData->m_wrapFlow != other.rareNonInheritedData->m
_wrapFlow |
| 468 || rareNonInheritedData->m_wrapThrough != other.rareNonInheritedData
->m_wrapThrough | 511 || rareNonInheritedData->m_wrapThrough != other.rareNonInheritedData
->m_wrapThrough |
| 469 || rareNonInheritedData->m_shapeMargin != other.rareNonInheritedData
->m_shapeMargin | 512 || rareNonInheritedData->m_shapeMargin != other.rareNonInheritedData
->m_shapeMargin |
| 470 || rareNonInheritedData->m_order != other.rareNonInheritedData->m_or
der | 513 || rareNonInheritedData->m_order != other.rareNonInheritedData->m_or
der |
| 471 || rareNonInheritedData->m_grid.get() != other.rareNonInheritedData-
>m_grid.get() | |
| 472 || rareNonInheritedData->m_gridItem.get() != other.rareNonInheritedD
ata->m_gridItem.get() | |
| 473 || rareNonInheritedData->m_textCombine != other.rareNonInheritedData
->m_textCombine | 514 || rareNonInheritedData->m_textCombine != other.rareNonInheritedData
->m_textCombine |
| 474 || rareNonInheritedData->hasFilters() != other.rareNonInheritedData-
>hasFilters()) | 515 || rareNonInheritedData->hasFilters() != other.rareNonInheritedData-
>hasFilters()) |
| 475 return true; | 516 return true; |
| 476 | 517 |
| 518 if ((rareNonInheritedData->m_grid.get() != other.rareNonInheritedData->m
_grid.get() |
| 519 && *rareNonInheritedData->m_grid.get() != *other.rareNonInheritedDat
a->m_grid.get()) |
| 520 || (rareNonInheritedData->m_gridItem.get() != other.rareNonInherited
Data->m_gridItem.get() |
| 521 && *rareNonInheritedData->m_gridItem.get() != *other.rareNonInhe
ritedData->m_gridItem.get())) |
| 522 return true; |
| 523 |
| 477 if (rareNonInheritedData->m_deprecatedFlexibleBox.get() != other.rareNon
InheritedData->m_deprecatedFlexibleBox.get() | 524 if (rareNonInheritedData->m_deprecatedFlexibleBox.get() != other.rareNon
InheritedData->m_deprecatedFlexibleBox.get() |
| 478 && *rareNonInheritedData->m_deprecatedFlexibleBox.get() != *other.ra
reNonInheritedData->m_deprecatedFlexibleBox.get()) | 525 && *rareNonInheritedData->m_deprecatedFlexibleBox.get() != *other.ra
reNonInheritedData->m_deprecatedFlexibleBox.get()) |
| 479 return true; | 526 return true; |
| 480 | 527 |
| 481 if (rareNonInheritedData->m_flexibleBox.get() != other.rareNonInheritedD
ata->m_flexibleBox.get() | 528 if (rareNonInheritedData->m_flexibleBox.get() != other.rareNonInheritedD
ata->m_flexibleBox.get() |
| 482 && *rareNonInheritedData->m_flexibleBox.get() != *other.rareNonInher
itedData->m_flexibleBox.get()) | 529 && *rareNonInheritedData->m_flexibleBox.get() != *other.rareNonInher
itedData->m_flexibleBox.get()) |
| 483 return true; | 530 return true; |
| 484 | 531 |
| 485 // FIXME: We should add an optimized form of layout that just recomputes
visual overflow. | 532 // FIXME: We should add an optimized form of layout that just recomputes
visual overflow. |
| 486 if (!rareNonInheritedData->shadowDataEquivalent(*other.rareNonInheritedD
ata.get())) | 533 if (!rareNonInheritedData->shadowDataEquivalent(*other.rareNonInheritedD
ata.get())) |
| (...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1738 } | 1785 } |
| 1739 | 1786 |
| 1740 void ComputedStyle::copyChildDependentFlagsFrom(const ComputedStyle& other) | 1787 void ComputedStyle::copyChildDependentFlagsFrom(const ComputedStyle& other) |
| 1741 { | 1788 { |
| 1742 setEmptyState(other.emptyState()); | 1789 setEmptyState(other.emptyState()); |
| 1743 if (other.hasExplicitlyInheritedProperties()) | 1790 if (other.hasExplicitlyInheritedProperties()) |
| 1744 setHasExplicitlyInheritedProperties(); | 1791 setHasExplicitlyInheritedProperties(); |
| 1745 } | 1792 } |
| 1746 | 1793 |
| 1747 } // namespace blink | 1794 } // namespace blink |
| OLD | NEW |