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

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: Applied suggested changes. Created 4 years, 9 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 195
196 if (*oldStyle == *newStyle) 196 if (*oldStyle == *newStyle)
197 return diffPseudoStyles(*oldStyle, *newStyle); 197 return diffPseudoStyles(*oldStyle, *newStyle);
198 198
199 if (oldStyle->hasExplicitlyInheritedProperties()) 199 if (oldStyle->hasExplicitlyInheritedProperties())
200 return Inherit; 200 return Inherit;
201 201
202 return NoInherit; 202 return NoInherit;
203 } 203 }
204 204
205 ItemPosition ComputedStyle::resolveAlignment(const ComputedStyle& parentStyle, c onst ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject ) 205 static const StyleSelfAlignmentData resolvedSelfAlignment(const StyleSelfAlignme ntData& value, ItemPosition normalValueBehavior)
206 { 206 {
207 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto". 207 ASSERT(value.position() != ItemPositionAuto);
208 if (childStyle.alignSelfPosition() == ItemPositionAuto) 208 if (value.position() == ItemPositionNormal)
209 return (parentStyle.alignItemsPosition() == ItemPositionAuto) ? resolved AutoPositionForLayoutObject : parentStyle.alignItemsPosition(); 209 return {normalValueBehavior, OverflowAlignmentDefault};
210 return childStyle.alignSelfPosition(); 210 return value;
211 } 211 }
212 212
213 const StyleSelfAlignmentData ComputedStyle::resolvedAlignment(const ComputedStyl e& parentStyle, ItemPosition resolvedAutoPositionForLayoutObject) const 213 const StyleSelfAlignmentData ComputedStyle::resolvedAlignItems(ItemPosition norm alValueBehaviour) const
214 { 214 {
215 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto". 215 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 } 216 }
223 217
224 ItemPosition ComputedStyle::resolveJustification(const ComputedStyle& parentStyl e, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutOb ject) 218 const StyleSelfAlignmentData ComputedStyle::resolvedAlignSelf(const ComputedStyl e& parentStyle, ItemPosition normalValueBehaviour) const
225 { 219 {
226 if (childStyle.justifySelfPosition() == ItemPositionAuto) 220 // The auto keyword computes to the parent's align-items computed value.
227 return (parentStyle.justifyItemsPosition() == ItemPositionAuto) ? resolv edAutoPositionForLayoutObject : parentStyle.justifyItemsPosition(); 221 // We will return the behaviour of 'normal' value if needed, which is specif ic of each layout model.
228 return childStyle.justifySelfPosition(); 222 if (alignSelfPosition() == ItemPositionAuto)
223 return parentStyle.resolvedAlignItems(normalValueBehaviour);
224 return resolvedSelfAlignment(alignSelf(), normalValueBehaviour);
225 }
226
227 const StyleSelfAlignmentData ComputedStyle::resolvedJustifyItems(ItemPosition no rmalValueBehaviour) const
228 {
229 return resolvedSelfAlignment(justifyItems(), normalValueBehaviour);
230 }
231
232
233 const StyleSelfAlignmentData ComputedStyle::resolvedJustifySelf(const ComputedSt yle& parentStyle, ItemPosition normalValueBehaviour) const
234 {
235 // The auto keyword computes to the parent's justify-items computed value.
236 // We will return the behaviour of 'normal' value if needed, which is specif ic of each layout model.
237 if (justifySelfPosition() == ItemPositionAuto)
238 return parentStyle.resolvedJustifyItems(normalValueBehaviour);
239 return resolvedSelfAlignment(justifySelf(), normalValueBehaviour);
229 } 240 }
230 241
231 static inline ContentPosition resolvedContentAlignmentPosition(const StyleConten tAlignmentData& value, const StyleContentAlignmentData& normalValueBehavior) 242 static inline ContentPosition resolvedContentAlignmentPosition(const StyleConten tAlignmentData& value, const StyleContentAlignmentData& normalValueBehavior)
232 { 243 {
233 return (value.position() == ContentPositionNormal && value.distribution() == ContentDistributionDefault) ? normalValueBehavior.position() : value.position() ; 244 return (value.position() == ContentPositionNormal && value.distribution() == ContentDistributionDefault) ? normalValueBehavior.position() : value.position() ;
234 } 245 }
235 246
236 static inline ContentDistributionType resolvedContentAlignmentDistribution(const StyleContentAlignmentData& value, const StyleContentAlignmentData& normalValueB ehavior) 247 static inline ContentDistributionType resolvedContentAlignmentDistribution(const StyleContentAlignmentData& value, const StyleContentAlignmentData& normalValueB ehavior)
237 { 248 {
238 return (value.position() == ContentPositionNormal && value.distribution() == ContentDistributionDefault) ? normalValueBehavior.distribution() : value.distri bution(); 249 return (value.position() == ContentPositionNormal && value.distribution() == ContentDistributionDefault) ? normalValueBehavior.distribution() : value.distri bution();
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 if (!shadowList) 1892 if (!shadowList)
1882 return false; 1893 return false;
1883 for (size_t i = shadowList->shadows().size(); i--; ) { 1894 for (size_t i = shadowList->shadows().size(); i--; ) {
1884 if (shadowList->shadows()[i].color().isCurrentColor()) 1895 if (shadowList->shadows()[i].color().isCurrentColor())
1885 return true; 1896 return true;
1886 } 1897 }
1887 return false; 1898 return false;
1888 } 1899 }
1889 1900
1890 } // namespace blink 1901 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698