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

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: Fixed repaint tests. Created 4 years, 6 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 { 182 {
183 if ((!oldStyle && newStyle) || (oldStyle && !newStyle)) 183 if ((!oldStyle && newStyle) || (oldStyle && !newStyle))
184 return Reattach; 184 return Reattach;
185 185
186 if (!oldStyle && !newStyle) 186 if (!oldStyle && !newStyle)
187 return NoChange; 187 return NoChange;
188 188
189 if (oldStyle->display() != newStyle->display() 189 if (oldStyle->display() != newStyle->display()
190 || oldStyle->hasPseudoStyle(PseudoIdFirstLetter) != newStyle->hasPseudoS tyle(PseudoIdFirstLetter) 190 || oldStyle->hasPseudoStyle(PseudoIdFirstLetter) != newStyle->hasPseudoS tyle(PseudoIdFirstLetter)
191 || !oldStyle->contentDataEquivalent(newStyle) 191 || !oldStyle->contentDataEquivalent(newStyle)
192 || oldStyle->hasTextCombine() != newStyle->hasTextCombine() 192 || oldStyle->hasTextCombine() != newStyle->hasTextCombine())
193 || oldStyle->justifyItems() != newStyle->justifyItems()) // TODO (lajava ): We must avoid this Reattach.
194 return Reattach; 193 return Reattach;
195 194
196 if (oldStyle->inheritedNotEqual(*newStyle)) 195 if (oldStyle->inheritedNotEqual(*newStyle)
196 || oldStyle->alignItems() != newStyle->alignItems()
197 || oldStyle->justifyItems() != newStyle->justifyItems())
197 return Inherit; 198 return Inherit;
198 199
199 if (*oldStyle == *newStyle) 200 if (*oldStyle == *newStyle)
200 return diffPseudoStyles(*oldStyle, *newStyle); 201 return diffPseudoStyles(*oldStyle, *newStyle);
201 202
202 if (oldStyle->hasExplicitlyInheritedProperties()) 203 if (oldStyle->hasExplicitlyInheritedProperties())
203 return Inherit; 204 return Inherit;
204 205
205 return NoInherit; 206 return NoInherit;
206 } 207 }
207 208
208 ItemPosition ComputedStyle::resolveAlignment(const ComputedStyle& parentStyle, c onst ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject ) 209 static const StyleSelfAlignmentData resolvedSelfAlignment(const StyleSelfAlignme ntData& value, ItemPosition normalValueBehavior)
209 { 210 {
210 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto". 211 // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto ' flag to not just mean 'auto' prior to running the StyleAdjuster but also mean 'normal' after running it.
211 if (childStyle.alignSelfPosition() == ItemPositionAuto) 212 if (value.position() == ItemPositionNormal || value.position() == ItemPositi onAuto)
212 return (parentStyle.alignItemsPosition() == ItemPositionAuto) ? resolved AutoPositionForLayoutObject : parentStyle.alignItemsPosition(); 213 return {normalValueBehavior, OverflowAlignmentDefault};
213 return childStyle.alignSelfPosition(); 214 return value;
214 } 215 }
215 216
216 const StyleSelfAlignmentData ComputedStyle::resolvedAlignment(const ComputedStyl e& parentStyle, ItemPosition resolvedAutoPositionForLayoutObject) const 217 const StyleSelfAlignmentData ComputedStyle::resolvedAlignItems(ItemPosition norm alValueBehaviour) const
217 { 218 {
218 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto". 219 return resolvedSelfAlignment(alignItems(), normalValueBehaviour);
219 if (alignSelfPosition() == ItemPositionAuto) {
220 if (parentStyle.alignItemsPosition() == ItemPositionAuto)
221 return {resolvedAutoPositionForLayoutObject, OverflowAlignmentDefaul t};
222 return parentStyle.alignItems();
223 }
224 return alignSelf();
225 } 220 }
226 221
227 ItemPosition ComputedStyle::resolveJustification(const ComputedStyle& parentStyl e, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutOb ject) 222 const StyleSelfAlignmentData ComputedStyle::resolvedAlignSelf(ItemPosition norma lValueBehaviour) const
228 { 223 {
229 if (childStyle.justifySelfPosition() == ItemPositionAuto) 224 return resolvedSelfAlignment(alignSelf(), normalValueBehaviour);
230 return (parentStyle.justifyItemsPosition() == ItemPositionAuto) ? resolv edAutoPositionForLayoutObject : parentStyle.justifyItemsPosition(); 225 }
231 return childStyle.justifySelfPosition(); 226
227 const StyleSelfAlignmentData ComputedStyle::resolvedJustifyItems(ItemPosition no rmalValueBehaviour) const
228 {
229 return resolvedSelfAlignment(justifyItems(), normalValueBehaviour);
230 }
231
232 const StyleSelfAlignmentData ComputedStyle::resolvedJustifySelf(ItemPosition nor malValueBehaviour) const
233 {
234 return resolvedSelfAlignment(justifySelf(), normalValueBehaviour);
232 } 235 }
233 236
234 static inline ContentPosition resolvedContentAlignmentPosition(const StyleConten tAlignmentData& value, const StyleContentAlignmentData& normalValueBehavior) 237 static inline ContentPosition resolvedContentAlignmentPosition(const StyleConten tAlignmentData& value, const StyleContentAlignmentData& normalValueBehavior)
235 { 238 {
236 return (value.position() == ContentPositionNormal && value.distribution() == ContentDistributionDefault) ? normalValueBehavior.position() : value.position() ; 239 return (value.position() == ContentPositionNormal && value.distribution() == ContentDistributionDefault) ? normalValueBehavior.position() : value.position() ;
237 } 240 }
238 241
239 static inline ContentDistributionType resolvedContentAlignmentDistribution(const StyleContentAlignmentData& value, const StyleContentAlignmentData& normalValueB ehavior) 242 static inline ContentDistributionType resolvedContentAlignmentDistribution(const StyleContentAlignmentData& value, const StyleContentAlignmentData& normalValueB ehavior)
240 { 243 {
241 return (value.position() == ContentPositionNormal && value.distribution() == ContentDistributionDefault) ? normalValueBehavior.distribution() : value.distri bution(); 244 return (value.position() == ContentPositionNormal && value.distribution() == ContentDistributionDefault) ? normalValueBehavior.distribution() : value.distri bution();
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 if (!shadowList) 1856 if (!shadowList)
1854 return false; 1857 return false;
1855 for (size_t i = shadowList->shadows().size(); i--; ) { 1858 for (size_t i = shadowList->shadows().size(); i--; ) {
1856 if (shadowList->shadows()[i].color().isCurrentColor()) 1859 if (shadowList->shadows()[i].color().isCurrentColor())
1857 return true; 1860 return true;
1858 } 1861 }
1859 return false; 1862 return false;
1860 } 1863 }
1861 1864
1862 } // namespace blink 1865 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698