Chromium Code Reviews| 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(PseudoIdFirstLetter) != newStyle->hasPseudoS tyle(PseudoIdFirstLetter) | 187 || oldStyle->hasPseudoStyle(PseudoIdFirstLetter) != newStyle->hasPseudoS tyle(PseudoIdFirstLetter) |
| 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) |
| 193 || oldStyle->alignItems() != newStyle->alignItems() | |
| 194 || oldStyle->justifyItems() != newStyle->justifyItems()) | |
| 194 return Inherit; | 195 return Inherit; |
| 195 | 196 |
| 196 if (*oldStyle == *newStyle) | 197 if (*oldStyle == *newStyle) |
| 197 return diffPseudoStyles(*oldStyle, *newStyle); | 198 return diffPseudoStyles(*oldStyle, *newStyle); |
| 198 | 199 |
| 199 if (oldStyle->hasExplicitlyInheritedProperties()) | 200 if (oldStyle->hasExplicitlyInheritedProperties()) |
| 200 return Inherit; | 201 return Inherit; |
| 201 | 202 |
| 202 return NoInherit; | 203 return NoInherit; |
| 203 } | 204 } |
| 204 | 205 |
| 205 ItemPosition ComputedStyle::resolveAlignment(const ComputedStyle& parentStyle, c onst ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject ) | 206 static const StyleSelfAlignmentData resolvedSelfAlignment(const StyleSelfAlignme ntData& value, ItemPosition normalValueBehavior) |
| 206 { | 207 { |
| 207 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto". | 208 // To avoid needing to copy the RareNonInheritedData, we could repurporse th e 'auto' flag to not just mean 'auto' prior to running the StyleAdjuster but als o mean 'normal' after running it. |
| 208 if (childStyle.alignSelfPosition() == ItemPositionAuto) | 209 if (value.position() == ItemPositionNormal || value.position() == ItemPositi onAuto) |
| 209 return (parentStyle.alignItemsPosition() == ItemPositionAuto) ? resolved AutoPositionForLayoutObject : parentStyle.alignItemsPosition(); | 210 return {normalValueBehavior, OverflowAlignmentDefault}; |
| 210 return childStyle.alignSelfPosition(); | 211 return value; |
| 211 } | 212 } |
| 212 | 213 |
| 213 const StyleSelfAlignmentData ComputedStyle::resolvedAlignment(const ComputedStyl e& parentStyle, ItemPosition resolvedAutoPositionForLayoutObject) const | 214 const StyleSelfAlignmentData ComputedStyle::resolvedAlignItems(ItemPosition norm alValueBehaviour) const |
| 214 { | 215 { |
| 215 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto". | 216 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 } | 217 } |
| 223 | 218 |
| 224 ItemPosition ComputedStyle::resolveJustification(const ComputedStyle& parentStyl e, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutOb ject) | 219 const StyleSelfAlignmentData ComputedStyle::resolvedAlignSelf(const ComputedStyl e& parentStyle, ItemPosition normalValueBehaviour) const |
| 225 { | 220 { |
| 226 if (childStyle.justifySelfPosition() == ItemPositionAuto) | 221 // The auto keyword computes to the parent's align-items computed value. |
| 227 return (parentStyle.justifyItemsPosition() == ItemPositionAuto) ? resolv edAutoPositionForLayoutObject : parentStyle.justifyItemsPosition(); | 222 // We will return the behaviour of 'normal' value if needed, which is specif ic of each layout model. |
| 228 return childStyle.justifySelfPosition(); | 223 if (alignSelfPosition() == ItemPositionAuto) |
|
Timothy Loh
2016/05/23 05:45:39
I think this branch is no longer needed (or correc
jfernandez
2016/05/25 18:26:49
I think you're right. However, we'd may need this
| |
| 224 return parentStyle.resolvedAlignItems(normalValueBehaviour); | |
| 225 return resolvedSelfAlignment(alignSelf(), normalValueBehaviour); | |
| 226 } | |
| 227 | |
| 228 const StyleSelfAlignmentData ComputedStyle::resolvedJustifyItems(ItemPosition no rmalValueBehaviour) const | |
| 229 { | |
| 230 return resolvedSelfAlignment(justifyItems(), normalValueBehaviour); | |
| 231 } | |
| 232 | |
| 233 | |
| 234 const StyleSelfAlignmentData ComputedStyle::resolvedJustifySelf(const ComputedSt yle& parentStyle, ItemPosition normalValueBehaviour) const | |
| 235 { | |
| 236 // The auto keyword computes to the parent's justify-items computed value. | |
| 237 // We will return the behaviour of 'normal' value if needed, which is specif ic of each layout model. | |
| 238 if (justifySelfPosition() == ItemPositionAuto) | |
|
Timothy Loh
2016/05/23 05:45:39
this one too
jfernandez
2016/05/25 18:26:49
Done.
| |
| 239 return parentStyle.resolvedJustifyItems(normalValueBehaviour); | |
| 240 return resolvedSelfAlignment(justifySelf(), normalValueBehaviour); | |
| 229 } | 241 } |
| 230 | 242 |
| 231 static inline ContentPosition resolvedContentAlignmentPosition(const StyleConten tAlignmentData& value, const StyleContentAlignmentData& normalValueBehavior) | 243 static inline ContentPosition resolvedContentAlignmentPosition(const StyleConten tAlignmentData& value, const StyleContentAlignmentData& normalValueBehavior) |
| 232 { | 244 { |
| 233 return (value.position() == ContentPositionNormal && value.distribution() == ContentDistributionDefault) ? normalValueBehavior.position() : value.position() ; | 245 return (value.position() == ContentPositionNormal && value.distribution() == ContentDistributionDefault) ? normalValueBehavior.position() : value.position() ; |
| 234 } | 246 } |
| 235 | 247 |
| 236 static inline ContentDistributionType resolvedContentAlignmentDistribution(const StyleContentAlignmentData& value, const StyleContentAlignmentData& normalValueB ehavior) | 248 static inline ContentDistributionType resolvedContentAlignmentDistribution(const StyleContentAlignmentData& value, const StyleContentAlignmentData& normalValueB ehavior) |
| 237 { | 249 { |
| 238 return (value.position() == ContentPositionNormal && value.distribution() == ContentDistributionDefault) ? normalValueBehavior.distribution() : value.distri bution(); | 250 return (value.position() == ContentPositionNormal && value.distribution() == ContentDistributionDefault) ? normalValueBehavior.distribution() : value.distri bution(); |
| (...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1806 if (!shadowList) | 1818 if (!shadowList) |
| 1807 return false; | 1819 return false; |
| 1808 for (size_t i = shadowList->shadows().size(); i--; ) { | 1820 for (size_t i = shadowList->shadows().size(); i--; ) { |
| 1809 if (shadowList->shadows()[i].color().isCurrentColor()) | 1821 if (shadowList->shadows()[i].color().isCurrentColor()) |
| 1810 return true; | 1822 return true; |
| 1811 } | 1823 } |
| 1812 return false; | 1824 return false; |
| 1813 } | 1825 } |
| 1814 | 1826 |
| 1815 } // namespace blink | 1827 } // namespace blink |
| OLD | NEW |