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

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

Issue 363133003: [CSS Grid Layout] Adapting align-self, align-items and justify-self to the last CSS 3 spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: A new approach for resolving auto values. Created 6 years, 4 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 if ((isSVGForeignObjectElement(*e) || isSVGTextElement(*e)) && style->is DisplayInlineType()) 247 if ((isSVGForeignObjectElement(*e) || isSVGTextElement(*e)) && style->is DisplayInlineType())
248 style->setDisplay(BLOCK); 248 style->setDisplay(BLOCK);
249 } 249 }
250 250
251 if (e && e->renderStyle() && e->renderStyle()->textAutosizingMultiplier() != 1) { 251 if (e && e->renderStyle() && e->renderStyle()->textAutosizingMultiplier() != 1) {
252 // Preserve the text autosizing multiplier on style recalc. 252 // Preserve the text autosizing multiplier on style recalc.
253 // (The autosizer will update it during layout if it needs to be changed .) 253 // (The autosizer will update it during layout if it needs to be changed .)
254 style->setTextAutosizingMultiplier(e->renderStyle()->textAutosizingMulti plier()); 254 style->setTextAutosizingMultiplier(e->renderStyle()->textAutosizingMulti plier());
255 style->setUnique(); 255 style->setUnique();
256 } 256 }
257
258 adjustStyleForAlignment(style, *parentStyle);
259 }
260
261 void StyleAdjuster::adjustStyleForAlignment(RenderStyle* style, RenderStyle& par entStyle)
262 {
263 if (style->justifyItems() == ItemPositionAuto)
264 style->resolveJustifyItemsAuto(parentStyle);
265
266 if (style->justifySelf() == ItemPositionAuto)
267 style->resolveJustifySelfAuto(parentStyle);
268
269 if (style->alignItems() == ItemPositionAuto)
270 style->resolveAlignItemsAuto(parentStyle);
271
272 if (style->alignSelf() == ItemPositionAuto)
273 style->resolveAlignSelfAuto(parentStyle);
257 } 274 }
258 275
259 void StyleAdjuster::adjustStyleForTagName(RenderStyle* style, RenderStyle* paren tStyle, Element& element) 276 void StyleAdjuster::adjustStyleForTagName(RenderStyle* style, RenderStyle* paren tStyle, Element& element)
260 { 277 {
261 // <div> and <span> are the most common elements on the web, we skip all the work for them. 278 // <div> and <span> are the most common elements on the web, we skip all the work for them.
262 if (isHTMLDivElement(element) || isHTMLSpanElement(element)) 279 if (isHTMLDivElement(element) || isHTMLSpanElement(element))
263 return; 280 return;
264 281
265 if (isHTMLTableCellElement(element)) { 282 if (isHTMLTableCellElement(element)) {
266 // If we have a <td> that specifies a float property, in quirks mode we just drop the float property. 283 // If we have a <td> that specifies a float property, in quirks mode we just drop the float property.
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 if (style->writingMode() != TopToBottomWritingMode && (style->display() == B OX || style->display() == INLINE_BOX)) 415 if (style->writingMode() != TopToBottomWritingMode && (style->display() == B OX || style->display() == INLINE_BOX))
399 style->setWritingMode(TopToBottomWritingMode); 416 style->setWritingMode(TopToBottomWritingMode);
400 417
401 if (parentStyle->isDisplayFlexibleOrGridBox()) { 418 if (parentStyle->isDisplayFlexibleOrGridBox()) {
402 style->setFloating(NoFloat); 419 style->setFloating(NoFloat);
403 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloa ting(), !m_useQuirksModeStyles)); 420 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloa ting(), !m_useQuirksModeStyles));
404 } 421 }
405 } 422 }
406 423
407 } 424 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698