| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 { | 179 { |
| 180 if ((!oldStyle && newStyle) || (oldStyle && !newStyle)) | 180 if ((!oldStyle && newStyle) || (oldStyle && !newStyle)) |
| 181 return Reattach; | 181 return Reattach; |
| 182 | 182 |
| 183 if (!oldStyle && !newStyle) | 183 if (!oldStyle && !newStyle) |
| 184 return NoChange; | 184 return NoChange; |
| 185 | 185 |
| 186 if (oldStyle->display() != newStyle->display() | 186 if (oldStyle->display() != newStyle->display() |
| 187 || oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FI
RST_LETTER) | 187 || oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FI
RST_LETTER) |
| 188 || !oldStyle->contentDataEquivalent(newStyle) | 188 || !oldStyle->contentDataEquivalent(newStyle) |
| 189 || oldStyle->hasTextCombine() != newStyle->hasTextCombine() | 189 || oldStyle->hasTextCombine() != newStyle->hasTextCombine()) |
| 190 || oldStyle->justifyItems() != newStyle->justifyItems()) // TODO (lajava
): We must avoid this Reattach. | |
| 191 return Reattach; | 190 return Reattach; |
| 192 | 191 |
| 193 if (oldStyle->inheritedNotEqual(*newStyle)) | 192 if (oldStyle->inheritedNotEqual(*newStyle)) |
| 194 return Inherit; | 193 return Inherit; |
| 195 | 194 |
| 196 if (*oldStyle == *newStyle) | 195 if (*oldStyle == *newStyle) |
| 197 return diffPseudoStyles(*oldStyle, *newStyle); | 196 return diffPseudoStyles(*oldStyle, *newStyle); |
| 198 | 197 |
| 199 if (oldStyle->hasExplicitlyInheritedProperties()) | 198 if (oldStyle->hasExplicitlyInheritedProperties()) |
| 200 return Inherit; | 199 return Inherit; |
| 201 | 200 |
| 202 return NoInherit; | 201 return NoInherit; |
| 203 } | 202 } |
| 204 | 203 |
| 205 ItemPosition ComputedStyle::resolveAlignment(const ComputedStyle& parentStyle, c
onst ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject
) | 204 static const StyleSelfAlignmentData resolvedSelfAlignment(const StyleSelfAlignme
ntData& value, ItemPosition normalValueBehavior) |
| 206 { | 205 { |
| 207 // The auto keyword computes to the parent's align-items computed value, or
to "stretch", if not set or "auto". | 206 ASSERT(value.position() != ItemPositionAuto); |
| 208 if (childStyle.alignSelfPosition() == ItemPositionAuto) | 207 if (value.position() == ItemPositionNormal) |
| 209 return (parentStyle.alignItemsPosition() == ItemPositionAuto) ? resolved
AutoPositionForLayoutObject : parentStyle.alignItemsPosition(); | 208 return {normalValueBehavior, OverflowAlignmentDefault}; |
| 210 return childStyle.alignSelfPosition(); | 209 return value; |
| 211 } | 210 } |
| 212 | 211 |
| 213 const StyleSelfAlignmentData ComputedStyle::resolvedAlignment(const ComputedStyl
e& parentStyle, ItemPosition resolvedAutoPositionForLayoutObject) const | 212 const StyleSelfAlignmentData ComputedStyle::resolvedAlignItems(ItemPosition norm
alValueBehaviour) const |
| 214 { | 213 { |
| 215 // The auto keyword computes to the parent's align-items computed value, or
to "stretch", if not set or "auto". | 214 return resolvedSelfAlignment(alignItems(), normalValueBehaviour); |
| 216 if (alignSelfPosition() == ItemPositionAuto) { | |
| 217 if (parentStyle.alignItemsPosition() == ItemPositionAuto) | |
| 218 return {resolvedAutoPositionForLayoutObject, OverflowAlignmentDefaul
t}; | |
| 219 return parentStyle.alignItems(); | |
| 220 } | |
| 221 return alignSelf(); | |
| 222 } | 215 } |
| 223 | 216 |
| 224 ItemPosition ComputedStyle::resolveJustification(const ComputedStyle& parentStyl
e, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutOb
ject) | 217 const StyleSelfAlignmentData ComputedStyle::resolvedAlignSelf(const ComputedStyl
e& parentStyle, ItemPosition normalValueBehaviour) const |
| 225 { | 218 { |
| 226 if (childStyle.justifySelfPosition() == ItemPositionAuto) | 219 // The auto keyword computes to the parent's align-items computed value. |
| 227 return (parentStyle.justifyItemsPosition() == ItemPositionAuto) ? resolv
edAutoPositionForLayoutObject : parentStyle.justifyItemsPosition(); | 220 // We will return the behaviour of 'normal' value if needed, which is specif
ic of each layout model. |
| 228 return childStyle.justifySelfPosition(); | 221 if (alignSelfPosition() == ItemPositionAuto) |
| 222 return parentStyle.resolvedAlignItems(normalValueBehaviour); |
| 223 return resolvedSelfAlignment(alignSelf(), normalValueBehaviour); |
| 224 } |
| 225 |
| 226 const StyleSelfAlignmentData ComputedStyle::resolvedJustifyItems(ItemPosition no
rmalValueBehaviour) const |
| 227 { |
| 228 // FIXME: justify-items 'auto' value is allowed only to provide the 'legacy'
keyword's behavior, which it's still not implemented for layout. |
| 229 // "If the inherited value of justify-items includes the legacy keyword, aut
o computes to the inherited value." |
| 230 // https://drafts.csswg.org/css-align/#justify-items-property |
| 231 if (justifyItemsPosition() == ItemPositionAuto) |
| 232 return {normalValueBehaviour, OverflowAlignmentDefault}; |
| 233 |
| 234 return resolvedSelfAlignment(justifyItems(), normalValueBehaviour); |
| 235 } |
| 236 |
| 237 |
| 238 const StyleSelfAlignmentData ComputedStyle::resolvedJustifySelf(const ComputedSt
yle& parentStyle, ItemPosition normalValueBehaviour) const |
| 239 { |
| 240 // The auto keyword computes to the parent's justify-items computed value. |
| 241 // We will return the behaviour of 'normal' value if needed, which is specif
ic of each layout model. |
| 242 if (justifySelfPosition() == ItemPositionAuto) |
| 243 return parentStyle.resolvedJustifyItems(normalValueBehaviour); |
| 244 return resolvedSelfAlignment(justifySelf(), normalValueBehaviour); |
| 229 } | 245 } |
| 230 | 246 |
| 231 static inline ContentPosition resolvedContentAlignmentPosition(const StyleConten
tAlignmentData& value, const StyleContentAlignmentData& normalValueBehavior) | 247 static inline ContentPosition resolvedContentAlignmentPosition(const StyleConten
tAlignmentData& value, const StyleContentAlignmentData& normalValueBehavior) |
| 232 { | 248 { |
| 233 return (value.position() == ContentPositionNormal && value.distribution() ==
ContentDistributionDefault) ? normalValueBehavior.position() : value.position()
; | 249 return (value.position() == ContentPositionNormal && value.distribution() ==
ContentDistributionDefault) ? normalValueBehavior.position() : value.position()
; |
| 234 } | 250 } |
| 235 | 251 |
| 236 static inline ContentDistributionType resolvedContentAlignmentDistribution(const
StyleContentAlignmentData& value, const StyleContentAlignmentData& normalValueB
ehavior) | 252 static inline ContentDistributionType resolvedContentAlignmentDistribution(const
StyleContentAlignmentData& value, const StyleContentAlignmentData& normalValueB
ehavior) |
| 237 { | 253 { |
| 238 return (value.position() == ContentPositionNormal && value.distribution() ==
ContentDistributionDefault) ? normalValueBehavior.distribution() : value.distri
bution(); | 254 return (value.position() == ContentPositionNormal && value.distribution() ==
ContentDistributionDefault) ? normalValueBehavior.distribution() : value.distri
bution(); |
| (...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 if (!shadowList) | 1897 if (!shadowList) |
| 1882 return false; | 1898 return false; |
| 1883 for (size_t i = shadowList->shadows().size(); i--; ) { | 1899 for (size_t i = shadowList->shadows().size(); i--; ) { |
| 1884 if (shadowList->shadows()[i].color().isCurrentColor()) | 1900 if (shadowList->shadows()[i].color().isCurrentColor()) |
| 1885 return true; | 1901 return true; |
| 1886 } | 1902 } |
| 1887 return false; | 1903 return false; |
| 1888 } | 1904 } |
| 1889 | 1905 |
| 1890 } // namespace blink | 1906 } // namespace blink |
| OLD | NEW |