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

Side by Side Diff: Source/core/rendering/RenderFlexibleBox.cpp

Issue 613273002: [CSS Grid Layout] Stretch value for align and justify properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed some layout tests. Created 6 years, 1 month 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/rendering/RenderBox.cpp ('k') | Source/core/rendering/RenderGrid.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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 201 }
202 202
203 void RenderFlexibleBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) 203 void RenderFlexibleBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
204 { 204 {
205 RenderBlock::styleDidChange(diff, oldStyle); 205 RenderBlock::styleDidChange(diff, oldStyle);
206 206
207 if (oldStyle && oldStyle->alignItems() == ItemPositionStretch && diff.needsF ullLayout()) { 207 if (oldStyle && oldStyle->alignItems() == ItemPositionStretch && diff.needsF ullLayout()) {
208 // Flex items that were previously stretching need to be relayed out so we can compute new available cross axis space. 208 // Flex items that were previously stretching need to be relayed out so we can compute new available cross axis space.
209 // This is only necessary for stretching since other alignment values do n't change the size of the box. 209 // This is only necessary for stretching since other alignment values do n't change the size of the box.
210 for (RenderBox* child = firstChildBox(); child; child = child->nextSibli ngBox()) { 210 for (RenderBox* child = firstChildBox(); child; child = child->nextSibli ngBox()) {
211 ItemPosition previousAlignment = RenderStyle::resolveAlignment(oldSt yle, child->style()); 211 ItemPosition previousAlignment = RenderStyle::resolveAlignment(oldSt yle, child->style(), ItemPositionStretch);
212 if (previousAlignment == ItemPositionStretch && previousAlignment != RenderStyle::resolveAlignment(style(), child->style())) 212 if (previousAlignment == ItemPositionStretch && previousAlignment != RenderStyle::resolveAlignment(style(), child->style(), ItemPositionStretch))
213 child->setChildNeedsLayout(MarkOnlyThis); 213 child->setChildNeedsLayout(MarkOnlyThis);
214 } 214 }
215 } 215 }
216 } 216 }
217 217
218 void RenderFlexibleBox::layoutBlock(bool relayoutChildren) 218 void RenderFlexibleBox::layoutBlock(bool relayoutChildren)
219 { 219 {
220 ASSERT(needsLayout()); 220 ASSERT(needsLayout());
221 221
222 if (!relayoutChildren && simplifiedLayout()) 222 if (!relayoutChildren && simplifiedLayout())
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 LayoutUnit staticBlockPosition = isColumnFlow() ? mainAxisOffset : crossAxis Offset; 996 LayoutUnit staticBlockPosition = isColumnFlow() ? mainAxisOffset : crossAxis Offset;
997 if (childLayer->staticBlockPosition() != staticBlockPosition) { 997 if (childLayer->staticBlockPosition() != staticBlockPosition) {
998 childLayer->setStaticBlockPosition(staticBlockPosition); 998 childLayer->setStaticBlockPosition(staticBlockPosition);
999 if (child.style()->hasStaticBlockPosition(style()->isHorizontalWritingMo de())) 999 if (child.style()->hasStaticBlockPosition(style()->isHorizontalWritingMo de()))
1000 child.setChildNeedsLayout(MarkOnlyThis); 1000 child.setChildNeedsLayout(MarkOnlyThis);
1001 } 1001 }
1002 } 1002 }
1003 1003
1004 ItemPosition RenderFlexibleBox::alignmentForChild(RenderBox& child) const 1004 ItemPosition RenderFlexibleBox::alignmentForChild(RenderBox& child) const
1005 { 1005 {
1006 ItemPosition align = RenderStyle::resolveAlignment(style(), child.style()); 1006 ItemPosition align = RenderStyle::resolveAlignment(style(), child.style(), I temPositionStretch);
1007 1007
1008 if (align == ItemPositionBaseline && hasOrthogonalFlow(child)) 1008 if (align == ItemPositionBaseline && hasOrthogonalFlow(child))
1009 align = ItemPositionFlexStart; 1009 align = ItemPositionFlexStart;
1010 1010
1011 if (style()->flexWrap() == FlexWrapReverse) { 1011 if (style()->flexWrap() == FlexWrapReverse) {
1012 if (align == ItemPositionFlexStart) 1012 if (align == ItemPositionFlexStart)
1013 align = ItemPositionFlexEnd; 1013 align = ItemPositionFlexEnd;
1014 else if (align == ItemPositionFlexEnd) 1014 else if (align == ItemPositionFlexEnd)
1015 align = ItemPositionFlexStart; 1015 align = ItemPositionFlexStart;
1016 } 1016 }
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 ASSERT(child); 1393 ASSERT(child);
1394 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1394 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1395 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1395 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1396 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1396 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1397 adjustAlignmentForChild(*child, newOffset - originalOffset); 1397 adjustAlignmentForChild(*child, newOffset - originalOffset);
1398 } 1398 }
1399 } 1399 }
1400 } 1400 }
1401 1401
1402 } 1402 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.cpp ('k') | Source/core/rendering/RenderGrid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698