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

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

Issue 1625993004: [css-align] Avoid the style Reattach whenever align-items changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Applied suggested changes. 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
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() 185 || oldStyle->justifyItems() != newStyle->justifyItems()) // TODO (lajava ): We must avoid this Reattach.
186 || oldStyle->alignItems() != newStyle->alignItems())
187 return Reattach; 186 return Reattach;
188 187
189 if (oldStyle->inheritedNotEqual(*newStyle)) 188 if (oldStyle->inheritedNotEqual(*newStyle))
190 return Inherit; 189 return Inherit;
191 190
192 if (*oldStyle == *newStyle) 191 if (*oldStyle == *newStyle)
193 return diffPseudoStyles(*oldStyle, *newStyle); 192 return diffPseudoStyles(*oldStyle, *newStyle);
194 193
195 if (oldStyle->hasExplicitlyInheritedProperties()) 194 if (oldStyle->hasExplicitlyInheritedProperties())
196 return Inherit; 195 return Inherit;
197 196
198 return NoInherit; 197 return NoInherit;
199 } 198 }
200 199
201 ItemPosition ComputedStyle::resolveAlignment(const ComputedStyle& parentStyle, c onst ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject ) 200 ItemPosition ComputedStyle::resolveAlignment(const ComputedStyle& parentStyle, c onst ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject )
202 { 201 {
203 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto". 202 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto".
204 if (childStyle.alignSelfPosition() == ItemPositionAuto) 203 if (childStyle.alignSelfPosition() == ItemPositionAuto)
205 return (parentStyle.alignItemsPosition() == ItemPositionAuto) ? resolved AutoPositionForLayoutObject : parentStyle.alignItemsPosition(); 204 return (parentStyle.alignItemsPosition() == ItemPositionAuto) ? resolved AutoPositionForLayoutObject : parentStyle.alignItemsPosition();
206 return childStyle.alignSelfPosition(); 205 return childStyle.alignSelfPosition();
207 } 206 }
208 207
208 const StyleSelfAlignmentData ComputedStyle::resolvedAlignment(const ComputedStyl e& parentStyle, ItemPosition resolvedAutoPositionForLayoutObject) const
209 {
210 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto".
211 if (alignSelfPosition() == ItemPositionAuto) {
212 if (parentStyle.alignItemsPosition() == ItemPositionAuto)
213 return {resolvedAutoPositionForLayoutObject, OverflowAlignmentDefaul t};
214 return parentStyle.alignItems();
215 }
216 return alignSelf();
217 }
218
209 ItemPosition ComputedStyle::resolveJustification(const ComputedStyle& parentStyl e, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutOb ject) 219 ItemPosition ComputedStyle::resolveJustification(const ComputedStyle& parentStyl e, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutOb ject)
210 { 220 {
211 if (childStyle.justifySelfPosition() == ItemPositionAuto) 221 if (childStyle.justifySelfPosition() == ItemPositionAuto)
212 return (parentStyle.justifyItemsPosition() == ItemPositionAuto) ? resolv edAutoPositionForLayoutObject : parentStyle.justifyItemsPosition(); 222 return (parentStyle.justifyItemsPosition() == ItemPositionAuto) ? resolv edAutoPositionForLayoutObject : parentStyle.justifyItemsPosition();
213 return childStyle.justifySelfPosition(); 223 return childStyle.justifySelfPosition();
214 } 224 }
215 225
216 void ComputedStyle::inheritFrom(const ComputedStyle& inheritParent, IsAtShadowBo undary isAtShadowBoundary) 226 void ComputedStyle::inheritFrom(const ComputedStyle& inheritParent, IsAtShadowBo undary isAtShadowBoundary)
217 { 227 {
218 if (isAtShadowBoundary == AtShadowBoundary) { 228 if (isAtShadowBoundary == AtShadowBoundary) {
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 } 1839 }
1830 1840
1831 void ComputedStyle::copyChildDependentFlagsFrom(const ComputedStyle& other) 1841 void ComputedStyle::copyChildDependentFlagsFrom(const ComputedStyle& other)
1832 { 1842 {
1833 setEmptyState(other.emptyState()); 1843 setEmptyState(other.emptyState());
1834 if (other.hasExplicitlyInheritedProperties()) 1844 if (other.hasExplicitlyInheritedProperties())
1835 setHasExplicitlyInheritedProperties(); 1845 setHasExplicitlyInheritedProperties();
1836 } 1846 }
1837 1847
1838 } // namespace blink 1848 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698