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

Side by Side Diff: Source/core/css/resolver/StyleAdjuster.cpp

Issue 547673002: Move resolveAlignment logic to RenderStyle (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 if (RuntimeEnabledFeatures::cssCompositingEnabled()) 145 if (RuntimeEnabledFeatures::cssCompositingEnabled())
146 return true; 146 return true;
147 break; 147 break;
148 default: 148 default:
149 break; 149 break;
150 } 150 }
151 } 151 }
152 return false; 152 return false;
153 } 153 }
154 154
155 ItemPosition StyleAdjuster::resolveAlignment(const RenderStyle* parentStyle, con st RenderStyle* childStyle)
156 {
157 ItemPosition align = childStyle->alignSelf();
158 // The auto keyword computes to the parent's align-items computed value, or to "stretch", if not set or "auto".
159 if (align == ItemPositionAuto)
160 align = (parentStyle->alignItems() == ItemPositionAuto) ? ItemPositionSt retch : parentStyle->alignItems();
esprehn 2014/09/09 10:10:51 This is not style adjuster's job, it's not a place
161 return align;
162 }
163
155 void StyleAdjuster::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty le, Element *e, const CachedUAStyle* cachedUAStyle) 164 void StyleAdjuster::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty le, Element *e, const CachedUAStyle* cachedUAStyle)
156 { 165 {
157 ASSERT(parentStyle); 166 ASSERT(parentStyle);
158 167
159 if (style->display() != NONE) { 168 if (style->display() != NONE) {
160 if (e) 169 if (e)
161 adjustStyleForTagName(style, parentStyle, *e); 170 adjustStyleForTagName(style, parentStyle, *e);
162 171
163 // Per the spec, position 'static' and 'relative' in the top layer compu te to 'absolute'. 172 // Per the spec, position 'static' and 'relative' in the top layer compu te to 'absolute'.
164 if (isInTopLayer(e, style) && (style->position() == StaticPosition || st yle->position() == RelativePosition)) 173 if (isInTopLayer(e, style) && (style->position() == StaticPosition || st yle->position() == RelativePosition))
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 if (style->writingMode() != TopToBottomWritingMode && (style->display() == B OX || style->display() == INLINE_BOX)) 458 if (style->writingMode() != TopToBottomWritingMode && (style->display() == B OX || style->display() == INLINE_BOX))
450 style->setWritingMode(TopToBottomWritingMode); 459 style->setWritingMode(TopToBottomWritingMode);
451 460
452 if (parentStyle->isDisplayFlexibleOrGridBox()) { 461 if (parentStyle->isDisplayFlexibleOrGridBox()) {
453 style->setFloating(NoFloat); 462 style->setFloating(NoFloat);
454 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloa ting(), !m_useQuirksModeStyles)); 463 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloa ting(), !m_useQuirksModeStyles));
455 } 464 }
456 } 465 }
457 466
458 } 467 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698