Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 1709963002: [css-align] New CSS Value 'normal' for Self Alignment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 { 174 {
175 if ((!oldStyle && newStyle) || (oldStyle && !newStyle)) 175 if ((!oldStyle && newStyle) || (oldStyle && !newStyle))
176 return Reattach; 176 return Reattach;
177 177
178 if (!oldStyle && !newStyle) 178 if (!oldStyle && !newStyle)
179 return NoChange; 179 return NoChange;
180 180
181 if (oldStyle->display() != newStyle->display() 181 if (oldStyle->display() != newStyle->display()
182 || oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FI RST_LETTER) 182 || oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FI RST_LETTER)
183 || !oldStyle->contentDataEquivalent(newStyle) 183 || !oldStyle->contentDataEquivalent(newStyle)
184 || oldStyle->hasTextCombine() != newStyle->hasTextCombine() 184 || oldStyle->hasTextCombine() != newStyle->hasTextCombine())
185 || oldStyle->justifyItems() != newStyle->justifyItems()) // TODO (lajava ): We must avoid this Reattach.
186 return Reattach; 185 return Reattach;
187 186
188 if (oldStyle->inheritedNotEqual(*newStyle)) 187 if (oldStyle->inheritedNotEqual(*newStyle))
189 return Inherit; 188 return Inherit;
190 189
191 if (*oldStyle == *newStyle) 190 if (*oldStyle == *newStyle)
192 return diffPseudoStyles(*oldStyle, *newStyle); 191 return diffPseudoStyles(*oldStyle, *newStyle);
193 192
194 if (oldStyle->hasExplicitlyInheritedProperties()) 193 if (oldStyle->hasExplicitlyInheritedProperties())
195 return Inherit; 194 return Inherit;
196 195
197 return NoInherit; 196 return NoInherit;
198 } 197 }
199 198
200 ItemPosition ComputedStyle::resolveAlignment(const ComputedStyle& parentStyle, c onst ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject ) 199 static const StyleSelfAlignmentData resolvedSelfAlignment(const StyleSelfAlignme ntData& value, ItemPosition normalValueBehavior)
201 { 200 {
202 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto". 201 ASSERT(value.position() != ItemPositionAuto);
203 if (childStyle.alignSelfPosition() == ItemPositionAuto) 202 if (value.position() == ItemPositionNormal)
204 return (parentStyle.alignItemsPosition() == ItemPositionAuto) ? resolved AutoPositionForLayoutObject : parentStyle.alignItemsPosition(); 203 return {normalValueBehavior, OverflowAlignmentDefault};
205 return childStyle.alignSelfPosition(); 204 return value;
206 } 205 }
207 206
208 const StyleSelfAlignmentData ComputedStyle::resolvedAlignment(const ComputedStyl e& parentStyle, ItemPosition resolvedAutoPositionForLayoutObject) const 207 const StyleSelfAlignmentData ComputedStyle::resolvedAlignItems(ItemPosition norm alValueBehaviour) const
209 { 208 {
210 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto". 209 return resolvedSelfAlignment(alignItems(), normalValueBehaviour);
211 if (alignSelfPosition() == ItemPositionAuto) {
212 if (parentStyle.alignItemsPosition() == ItemPositionAuto)
213 return {resolvedAutoPositionForLayoutObject, OverflowAlignmentDefaul t};
214 return parentStyle.alignItems();
215 }
216 return alignSelf();
217 } 210 }
218 211
219 ItemPosition ComputedStyle::resolveJustification(const ComputedStyle& parentStyl e, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutOb ject) 212 const StyleSelfAlignmentData ComputedStyle::resolvedAlignSelf(const ComputedStyl e& parentStyle, ItemPosition normalValueBehaviour) const
220 { 213 {
221 if (childStyle.justifySelfPosition() == ItemPositionAuto) 214 // The auto keyword computes to the parent's align-items computed value.
222 return (parentStyle.justifyItemsPosition() == ItemPositionAuto) ? resolv edAutoPositionForLayoutObject : parentStyle.justifyItemsPosition(); 215 // We will return the behaviour of 'normal' value if needed, which is specif ic of each layout model.
223 return childStyle.justifySelfPosition(); 216 if (alignSelfPosition() == ItemPositionAuto)
217 return parentStyle.resolvedAlignItems(normalValueBehaviour);
218 return resolvedSelfAlignment(alignSelf(), normalValueBehaviour);
219 }
220
221 const StyleSelfAlignmentData ComputedStyle::resolvedJustifyItems(ItemPosition no rmalValueBehaviour) const
222 {
223 return resolvedSelfAlignment(justifyItems(), normalValueBehaviour);
224 }
225
226
227 const StyleSelfAlignmentData ComputedStyle::resolvedJustifySelf(const ComputedSt yle& parentStyle, ItemPosition normalValueBehaviour) const
228 {
229 // The auto keyword computes to the parent's justify-items computed value.
230 // We will return the behaviour of 'normal' value if needed, which is specif ic of each layout model.
231 if (justifySelfPosition() == ItemPositionAuto)
232 return parentStyle.resolvedJustifyItems(normalValueBehaviour);
233 return resolvedSelfAlignment(justifySelf(), normalValueBehaviour);
224 } 234 }
225 235
226 static inline ContentPosition resolvedContentAlignmentPosition(const StyleConten tAlignmentData& value, const StyleContentAlignmentData& normalValueBehavior) 236 static inline ContentPosition resolvedContentAlignmentPosition(const StyleConten tAlignmentData& value, const StyleContentAlignmentData& normalValueBehavior)
227 { 237 {
228 return (value.position() == ContentPositionNormal && value.distribution() == ContentDistributionDefault) ? normalValueBehavior.position() : value.position() ; 238 return (value.position() == ContentPositionNormal && value.distribution() == ContentDistributionDefault) ? normalValueBehavior.position() : value.position() ;
229 } 239 }
230 240
231 static inline ContentDistributionType resolvedContentAlignmentDistribution(const StyleContentAlignmentData& value, const StyleContentAlignmentData& normalValueB ehavior) 241 static inline ContentDistributionType resolvedContentAlignmentDistribution(const StyleContentAlignmentData& value, const StyleContentAlignmentData& normalValueB ehavior)
232 { 242 {
233 return (value.position() == ContentPositionNormal && value.distribution() == ContentDistributionDefault) ? normalValueBehavior.distribution() : value.distri bution(); 243 return (value.position() == ContentPositionNormal && value.distribution() == ContentDistributionDefault) ? normalValueBehavior.distribution() : value.distri bution();
(...skipping 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 if (!shadowList) 1884 if (!shadowList)
1875 return false; 1885 return false;
1876 for (size_t i = shadowList->shadows().size(); i--; ) { 1886 for (size_t i = shadowList->shadows().size(); i--; ) {
1877 if (shadowList->shadows()[i].color().isCurrentColor()) 1887 if (shadowList->shadows()[i].color().isCurrentColor())
1878 return true; 1888 return true;
1879 } 1889 }
1880 return false; 1890 return false;
1881 } 1891 }
1882 1892
1883 } // namespace blink 1893 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698