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

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

Issue 1070143002: [Alignment] Single class for holding the alignment data. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased and got back previous setter names. Created 5 years, 7 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 | « Source/core/style/ComputedStyle.h ('k') | Source/core/style/StyleContentAlignmentData.h » ('j') | 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 if (!oldStyle && !newStyle) 173 if (!oldStyle && !newStyle)
174 return NoChange; 174 return NoChange;
175 175
176 if (oldStyle->display() != newStyle->display() 176 if (oldStyle->display() != newStyle->display()
177 || oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FI RST_LETTER) 177 || oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FI RST_LETTER)
178 || oldStyle->columnSpan() != newStyle->columnSpan() 178 || oldStyle->columnSpan() != newStyle->columnSpan()
179 || !oldStyle->contentDataEquivalent(newStyle) 179 || !oldStyle->contentDataEquivalent(newStyle)
180 || oldStyle->hasTextCombine() != newStyle->hasTextCombine() 180 || oldStyle->hasTextCombine() != newStyle->hasTextCombine()
181 || oldStyle->justifyItems() != newStyle->justifyItems() 181 || oldStyle->justifyItems() != newStyle->justifyItems()
182 || oldStyle->justifyItemsOverflowAlignment() != newStyle->justifyItemsOv erflowAlignment() 182 || oldStyle->alignItems() != newStyle->alignItems())
183 || oldStyle->justifyItemsPositionType() != newStyle->justifyItemsPositio nType()
184 || oldStyle->alignItems() != newStyle->alignItems()
185 || oldStyle->alignItemsOverflowAlignment() != newStyle->alignItemsOverfl owAlignment())
186 return Reattach; 183 return Reattach;
187 184
188 if (oldStyle->inheritedNotEqual(*newStyle)) 185 if (oldStyle->inheritedNotEqual(*newStyle))
189 return Inherit; 186 return Inherit;
190 187
191 if (*oldStyle == *newStyle) 188 if (*oldStyle == *newStyle)
192 return diffPseudoStyles(*oldStyle, *newStyle); 189 return diffPseudoStyles(*oldStyle, *newStyle);
193 190
194 if (oldStyle->hasExplicitlyInheritedProperties()) 191 if (oldStyle->hasExplicitlyInheritedProperties())
195 return Inherit; 192 return Inherit;
196 193
197 return NoInherit; 194 return NoInherit;
198 } 195 }
199 196
200 ItemPosition ComputedStyle::resolveAlignment(const ComputedStyle& parentStyle, c onst ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject ) 197 ItemPosition ComputedStyle::resolveAlignment(const ComputedStyle& parentStyle, c onst ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutObject )
201 { 198 {
202 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto". 199 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto".
203 if (childStyle.alignSelf() == ItemPositionAuto) 200 if (childStyle.alignSelfPosition() == ItemPositionAuto)
204 return (parentStyle.alignItems() == ItemPositionAuto) ? resolvedAutoPosi tionForLayoutObject : parentStyle.alignItems(); 201 return (parentStyle.alignItemsPosition() == ItemPositionAuto) ? resolved AutoPositionForLayoutObject : parentStyle.alignItemsPosition();
205 return childStyle.alignSelf(); 202 return childStyle.alignSelfPosition();
206 } 203 }
207 204
208 ItemPosition ComputedStyle::resolveJustification(const ComputedStyle& parentStyl e, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutOb ject) 205 ItemPosition ComputedStyle::resolveJustification(const ComputedStyle& parentStyl e, const ComputedStyle& childStyle, ItemPosition resolvedAutoPositionForLayoutOb ject)
209 { 206 {
210 if (childStyle.justifySelf() == ItemPositionAuto) 207 if (childStyle.justifySelfPosition() == ItemPositionAuto)
211 return (parentStyle.justifyItems() == ItemPositionAuto) ? resolvedAutoPo sitionForLayoutObject : parentStyle.justifyItems(); 208 return (parentStyle.justifyItemsPosition() == ItemPositionAuto) ? resolv edAutoPositionForLayoutObject : parentStyle.justifyItemsPosition();
212 return childStyle.justifySelf(); 209 return childStyle.justifySelfPosition();
213 } 210 }
214 211
215 void ComputedStyle::inheritFrom(const ComputedStyle& inheritParent, IsAtShadowBo undary isAtShadowBoundary) 212 void ComputedStyle::inheritFrom(const ComputedStyle& inheritParent, IsAtShadowBo undary isAtShadowBoundary)
216 { 213 {
217 if (isAtShadowBoundary == AtShadowBoundary) { 214 if (isAtShadowBoundary == AtShadowBoundary) {
218 // Even if surrounding content is user-editable, shadow DOM should act a s a single unit, and not necessarily be editable 215 // Even if surrounding content is user-editable, shadow DOM should act a s a single unit, and not necessarily be editable
219 EUserModify currentUserModify = userModify(); 216 EUserModify currentUserModify = userModify();
220 rareInheritedData = inheritParent.rareInheritedData; 217 rareInheritedData = inheritParent.rareInheritedData;
221 setUserModify(currentUserModify); 218 setUserModify(currentUserModify);
222 } else { 219 } else {
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 || noninherited_flags.position != other.noninherited_flags.position) 639 || noninherited_flags.position != other.noninherited_flags.position)
643 return true; 640 return true;
644 641
645 if (surround.get() != other.surround.get()) { 642 if (surround.get() != other.surround.get()) {
646 if (surround->padding != other.surround->padding) 643 if (surround->padding != other.surround->padding)
647 return true; 644 return true;
648 } 645 }
649 646
650 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) { 647 if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) {
651 if (rareNonInheritedData->m_alignContent != other.rareNonInheritedData-> m_alignContent 648 if (rareNonInheritedData->m_alignContent != other.rareNonInheritedData-> m_alignContent
652 || rareNonInheritedData->m_alignContentDistribution != other.rareNon InheritedData->m_alignContentDistribution
653 || rareNonInheritedData->m_alignItems != other.rareNonInheritedData- >m_alignItems 649 || rareNonInheritedData->m_alignItems != other.rareNonInheritedData- >m_alignItems
654 || rareNonInheritedData->m_alignSelf != other.rareNonInheritedData-> m_alignSelf 650 || rareNonInheritedData->m_alignSelf != other.rareNonInheritedData-> m_alignSelf
655 || rareNonInheritedData->m_alignSelfOverflowAlignment != other.rareN onInheritedData->m_alignSelfOverflowAlignment
656 || rareNonInheritedData->m_justifyContent != other.rareNonInheritedD ata->m_justifyContent 651 || rareNonInheritedData->m_justifyContent != other.rareNonInheritedD ata->m_justifyContent
657 || rareNonInheritedData->m_justifyContentDistribution != other.rareN onInheritedData->m_justifyContentDistribution) 652 || rareNonInheritedData->m_justifyItems != other.rareNonInheritedDat a->m_justifyItems
653 || rareNonInheritedData->m_justifySelf != other.rareNonInheritedData ->m_justifySelf)
658 return true; 654 return true;
659 } 655 }
660 656
661 return false; 657 return false;
662 } 658 }
663 659
664 bool ComputedStyle::diffNeedsPaintInvalidationLayer(const ComputedStyle& other) const 660 bool ComputedStyle::diffNeedsPaintInvalidationLayer(const ComputedStyle& other) const
665 { 661 {
666 if (position() != StaticPosition && (visual->clip != other.visual->clip || v isual->hasAutoClip != other.visual->hasAutoClip)) 662 if (position() != StaticPosition && (visual->clip != other.visual->clip || v isual->hasAutoClip != other.visual->hasAutoClip))
667 return true; 663 return true;
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
1732 horizontal || includeLogicalRightEdge); 1728 horizontal || includeLogicalRightEdge);
1733 1729
1734 edges[BSLeft] = BorderEdge(borderLeftWidth(), 1730 edges[BSLeft] = BorderEdge(borderLeftWidth(),
1735 visitedDependentColor(CSSPropertyBorderLeftColor), 1731 visitedDependentColor(CSSPropertyBorderLeftColor),
1736 borderLeftStyle(), 1732 borderLeftStyle(),
1737 borderLeftIsTransparent(), 1733 borderLeftIsTransparent(),
1738 !horizontal || includeLogicalLeftEdge); 1734 !horizontal || includeLogicalLeftEdge);
1739 } 1735 }
1740 1736
1741 } // namespace blink 1737 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/style/ComputedStyle.h ('k') | Source/core/style/StyleContentAlignmentData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698