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

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: 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // computes to the the inherited value. 264 // computes to the the inherited value.
265 // Otherwise, auto computes to: 265 // Otherwise, auto computes to:
266 // - 'stretch' for flex containers and grid containers. 266 // - 'stretch' for flex containers and grid containers.
267 // - 'start' for everything else. 267 // - 'start' for everything else.
268 if (style.justifyItems() == ItemPositionAuto) { 268 if (style.justifyItems() == ItemPositionAuto) {
269 if (parentStyle.justifyItemsPositionType() == LegacyPosition) { 269 if (parentStyle.justifyItemsPositionType() == LegacyPosition) {
270 style.setJustifyItems(parentStyle.justifyItems()); 270 style.setJustifyItems(parentStyle.justifyItems());
271 style.setJustifyItemsPositionType(parentStyle.justifyItemsPositionTy pe()); 271 style.setJustifyItemsPositionType(parentStyle.justifyItemsPositionTy pe());
272 } else if (isFlexOrGrid) { 272 } else if (isFlexOrGrid) {
273 style.setJustifyItems(ItemPositionStretch); 273 style.setJustifyItems(ItemPositionStretch);
274 } else {
275 style.setJustifyItems(ItemPositionStart);
274 } 276 }
275 } 277 }
276 278
277 // The 'auto' keyword computes to 'stretch' on absolutely-positioned element s, 279 // The 'auto' keyword computes to 'stretch' on absolutely-positioned element s,
278 // and to the computed value of justify-items on the parent (minus 280 // and to the computed value of justify-items on the parent (minus
279 // any legacy keywords) on all other boxes. 281 // any 'legacy' keywords) on all other boxes (to be resolved during the layo ut).
280 if (style.justifySelf() == ItemPositionAuto) { 282 if (style.justifySelf() == ItemPositionAuto) {
281 if (absolutePositioned) { 283 if (absolutePositioned) {
esprehn 2014/08/19 00:56:33 You should combine these if statements now.
jfernandez 2014/08/19 21:00:12 Acknowledged.
282 style.setJustifySelf(ItemPositionStretch); 284 style.setJustifySelf(ItemPositionStretch);
283 } else {
284 style.setJustifySelf(parentStyle.justifyItems());
285 style.setJustifySelfOverflowAlignment(parentStyle.justifyItemsOverfl owAlignment());
286 } 285 }
287 } 286 }
288 287
289 // The 'auto' keyword computes to: 288 // The 'auto' keyword computes to:
290 // - 'stretch' for flex containers and grid containers, 289 // - 'stretch' for flex containers and grid containers,
291 // - 'start' for everything else. 290 // - 'start' for everything else.
292 if (style.alignItems() == ItemPositionAuto) { 291 if (style.alignItems() == ItemPositionAuto) {
293 if (isFlexOrGrid) 292 if (isFlexOrGrid)
294 style.setAlignItems(ItemPositionStretch); 293 style.setAlignItems(ItemPositionStretch);
294 else
295 style.setAlignItems(ItemPositionStart);
esprehn 2014/08/19 00:56:33 Doesn't this go against what your patch says it do
esprehn 2014/08/19 00:56:33 Doesn't this go against what your patch says it do
jfernandez 2014/08/19 21:00:12 Actually not. The patch precisely tries to resolve
295 } 296 }
296 297
297 // The 'auto' keyword computes to 'stretch' on absolutely-positioned element s, 298 // The 'auto' keyword computes to 'stretch' on absolutely-positioned element s,
298 // and to the computed value of align-items on the parent (minus 299 // and to the computed value of align-items on the parent (minus
299 // any 'legacy' keywords) on all other boxes. 300 // any 'legacy' keywords) on all other boxes (to be resolved during the layo ut).
300 if (style.alignSelf() == ItemPositionAuto) { 301 if (style.alignSelf() == ItemPositionAuto) {
301 if (absolutePositioned) { 302 if (absolutePositioned) {
302 style.setAlignSelf(ItemPositionStretch); 303 style.setAlignSelf(ItemPositionStretch);
303 } else {
304 style.setAlignSelf(parentStyle.alignItems());
305 style.setAlignSelfOverflowAlignment(parentStyle.alignItemsOverflowAl ignment());
306 } 304 }
307 } 305 }
308 } 306 }
309 307
310 void StyleAdjuster::adjustStyleForTagName(RenderStyle* style, RenderStyle* paren tStyle, Element& element) 308 void StyleAdjuster::adjustStyleForTagName(RenderStyle* style, RenderStyle* paren tStyle, Element& element)
311 { 309 {
312 // <div> and <span> are the most common elements on the web, we skip all the work for them. 310 // <div> and <span> are the most common elements on the web, we skip all the work for them.
313 if (isHTMLDivElement(element) || isHTMLSpanElement(element)) 311 if (isHTMLDivElement(element) || isHTMLSpanElement(element))
314 return; 312 return;
315 313
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 if (style->writingMode() != TopToBottomWritingMode && (style->display() == B OX || style->display() == INLINE_BOX)) 447 if (style->writingMode() != TopToBottomWritingMode && (style->display() == B OX || style->display() == INLINE_BOX))
450 style->setWritingMode(TopToBottomWritingMode); 448 style->setWritingMode(TopToBottomWritingMode);
451 449
452 if (parentStyle->isDisplayFlexibleOrGridBox()) { 450 if (parentStyle->isDisplayFlexibleOrGridBox()) {
453 style->setFloating(NoFloat); 451 style->setFloating(NoFloat);
454 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloa ting(), !m_useQuirksModeStyles)); 452 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloa ting(), !m_useQuirksModeStyles));
455 } 453 }
456 } 454 }
457 455
458 } 456 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698