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

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

Issue 433153003: [CSS Grid Layout] Don't resolve align-self and justify-self properties (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Applied suggested comments. 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 263
264 // If the inherited value of justify-items includes the legacy keyword, 'aut o' 264 // If the inherited value of justify-items includes the legacy keyword, 'aut o'
265 // computes to the the inherited value. 265 // computes to the the inherited value.
266 // Otherwise, auto computes to: 266 // Otherwise, auto computes to:
267 // - 'stretch' for flex containers and grid containers. 267 // - 'stretch' for flex containers and grid containers.
268 // - 'start' for everything else. 268 // - 'start' for everything else.
269 if (style.justifyItems() == ItemPositionAuto) { 269 if (style.justifyItems() == ItemPositionAuto) {
270 if (parentStyle.justifyItemsPositionType() == LegacyPosition) { 270 if (parentStyle.justifyItemsPositionType() == LegacyPosition) {
271 style.setJustifyItems(parentStyle.justifyItems()); 271 style.setJustifyItems(parentStyle.justifyItems());
272 style.setJustifyItemsPositionType(parentStyle.justifyItemsPositionTy pe()); 272 style.setJustifyItemsPositionType(parentStyle.justifyItemsPositionTy pe());
273 } else if (isFlexOrGrid) { 273 } else {
274 style.setJustifyItems(ItemPositionStretch); 274 style.setJustifyItems(isFlexOrGrid ? ItemPositionStretch : ItemPosit ionStart);
275 } 275 }
276 } 276 }
277 277
278 // The 'auto' keyword computes to 'stretch' on absolutely-positioned element s, 278 // The 'auto' keyword computes to 'stretch' on absolutely-positioned element s,
279 // and to the computed value of justify-items on the parent (minus 279 // and to the computed value of justify-items on the parent (minus
280 // any legacy keywords) on all other boxes. 280 // any 'legacy' keywords) on all other boxes (to be resolved during the layo ut).
281 if (style.justifySelf() == ItemPositionAuto) { 281 if ((style.justifySelf() == ItemPositionAuto) && absolutePositioned)
282 if (absolutePositioned) { 282 style.setJustifySelf(ItemPositionStretch);
283 style.setJustifySelf(ItemPositionStretch);
284 } else {
285 style.setJustifySelf(parentStyle.justifyItems());
286 style.setJustifySelfOverflowAlignment(parentStyle.justifyItemsOverfl owAlignment());
287 }
288 }
289 283
290 // The 'auto' keyword computes to: 284 // The 'auto' keyword computes to:
291 // - 'stretch' for flex containers and grid containers, 285 // - 'stretch' for flex containers and grid containers,
292 // - 'start' for everything else. 286 // - 'start' for everything else.
293 if (style.alignItems() == ItemPositionAuto) { 287 if (style.alignItems() == ItemPositionAuto)
294 if (isFlexOrGrid) 288 style.setAlignItems(isFlexOrGrid ? ItemPositionStretch : ItemPositionSta rt);
295 style.setAlignItems(ItemPositionStretch);
296 }
297 289
298 // The 'auto' keyword computes to 'stretch' on absolutely-positioned element s, 290 // The 'auto' keyword computes to 'stretch' on absolutely-positioned element s,
299 // and to the computed value of align-items on the parent (minus 291 // and to the computed value of align-items on the parent (minus
300 // any 'legacy' keywords) on all other boxes. 292 // any 'legacy' keywords) on all other boxes (to be resolved during the layo ut).
301 if (style.alignSelf() == ItemPositionAuto) { 293 if ((style.alignSelf() == ItemPositionAuto) && absolutePositioned)
302 if (absolutePositioned) { 294 style.setAlignSelf(ItemPositionStretch);
303 style.setAlignSelf(ItemPositionStretch);
304 } else {
305 style.setAlignSelf(parentStyle.alignItems());
306 style.setAlignSelfOverflowAlignment(parentStyle.alignItemsOverflowAl ignment());
307 }
308 }
309 } 295 }
310 296
311 void StyleAdjuster::adjustStyleForTagName(RenderStyle* style, RenderStyle* paren tStyle, Element& element) 297 void StyleAdjuster::adjustStyleForTagName(RenderStyle* style, RenderStyle* paren tStyle, Element& element)
312 { 298 {
313 // <div> and <span> are the most common elements on the web, we skip all the work for them. 299 // <div> and <span> are the most common elements on the web, we skip all the work for them.
314 if (isHTMLDivElement(element) || isHTMLSpanElement(element)) 300 if (isHTMLDivElement(element) || isHTMLSpanElement(element))
315 return; 301 return;
316 302
317 if (isHTMLTableCellElement(element)) { 303 if (isHTMLTableCellElement(element)) {
318 // If we have a <td> that specifies a float property, in quirks mode we just drop the float property. 304 // If we have a <td> that specifies a float property, in quirks mode we just drop the float property.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 if (style->writingMode() != TopToBottomWritingMode && (style->display() == B OX || style->display() == INLINE_BOX)) 446 if (style->writingMode() != TopToBottomWritingMode && (style->display() == B OX || style->display() == INLINE_BOX))
461 style->setWritingMode(TopToBottomWritingMode); 447 style->setWritingMode(TopToBottomWritingMode);
462 448
463 if (parentStyle->isDisplayFlexibleOrGridBox()) { 449 if (parentStyle->isDisplayFlexibleOrGridBox()) {
464 style->setFloating(NoFloat); 450 style->setFloating(NoFloat);
465 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloa ting(), !m_useQuirksModeStyles)); 451 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloa ting(), !m_useQuirksModeStyles));
466 } 452 }
467 } 453 }
468 454
469 } 455 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSComputedStyleDeclaration.cpp ('k') | Source/core/rendering/RenderFlexibleBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698