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

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

Issue 423133002: Ensure logical height is overridden for stretch-aligned flex-box children (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/flexbox/stretch-align-svg-expected.html ('k') | no next file » | 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 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 { 1339 {
1340 if (!isColumnFlow() && child.style()->logicalHeight().isAuto()) { 1340 if (!isColumnFlow() && child.style()->logicalHeight().isAuto()) {
1341 // FIXME: If the child has orthogonal flow, then it already has an overr ide height set, so use it. 1341 // FIXME: If the child has orthogonal flow, then it already has an overr ide height set, so use it.
1342 if (!hasOrthogonalFlow(child)) { 1342 if (!hasOrthogonalFlow(child)) {
1343 LayoutUnit heightBeforeStretching = needToStretchChildLogicalHeight( child) ? constrainedChildIntrinsicContentLogicalHeight(child) : child.logicalHei ght(); 1343 LayoutUnit heightBeforeStretching = needToStretchChildLogicalHeight( child) ? constrainedChildIntrinsicContentLogicalHeight(child) : child.logicalHei ght();
1344 LayoutUnit stretchedLogicalHeight = heightBeforeStretching + availab leAlignmentSpaceForChildBeforeStretching(lineCrossAxisExtent, child); 1344 LayoutUnit stretchedLogicalHeight = heightBeforeStretching + availab leAlignmentSpaceForChildBeforeStretching(lineCrossAxisExtent, child);
1345 ASSERT(!child.needsLayout()); 1345 ASSERT(!child.needsLayout());
1346 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinM ax(stretchedLogicalHeight, heightBeforeStretching - child.borderAndPaddingLogica lHeight()); 1346 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinM ax(stretchedLogicalHeight, heightBeforeStretching - child.borderAndPaddingLogica lHeight());
1347 1347
1348 // FIXME: Can avoid laying out here in some cases. See https://webki t.org/b/87905. 1348 // FIXME: Can avoid laying out here in some cases. See https://webki t.org/b/87905.
1349 if (desiredLogicalHeight != child.logicalHeight()) { 1349 bool childNeedsRelayout = desiredLogicalHeight != child.logicalHeigh t();
1350 if (childNeedsRelayout || !child.hasOverrideHeight())
1350 child.setOverrideLogicalContentHeight(desiredLogicalHeight - chi ld.borderAndPaddingLogicalHeight()); 1351 child.setOverrideLogicalContentHeight(desiredLogicalHeight - chi ld.borderAndPaddingLogicalHeight());
1352 if (childNeedsRelayout) {
1351 child.setLogicalHeight(0); 1353 child.setLogicalHeight(0);
1352 child.forceChildLayout(); 1354 child.forceChildLayout();
1353 } 1355 }
1354 } 1356 }
1355 } else if (isColumnFlow() && child.style()->logicalWidth().isAuto()) { 1357 } else if (isColumnFlow() && child.style()->logicalWidth().isAuto()) {
1356 // FIXME: If the child doesn't have orthogonal flow, then it already has an override width set, so use it. 1358 // FIXME: If the child doesn't have orthogonal flow, then it already has an override width set, so use it.
1357 if (hasOrthogonalFlow(child)) { 1359 if (hasOrthogonalFlow(child)) {
1358 LayoutUnit childWidth = std::max<LayoutUnit>(0, lineCrossAxisExtent - crossAxisMarginExtentForChild(child)); 1360 LayoutUnit childWidth = std::max<LayoutUnit>(0, lineCrossAxisExtent - crossAxisMarginExtentForChild(child));
1359 childWidth = child.constrainLogicalWidthByMinMax(childWidth, childWi dth, this); 1361 childWidth = child.constrainLogicalWidthByMinMax(childWidth, childWi dth, this);
1360 1362
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 ASSERT(child); 1394 ASSERT(child);
1393 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1395 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1394 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1396 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1395 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1397 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1396 adjustAlignmentForChild(*child, newOffset - originalOffset); 1398 adjustAlignmentForChild(*child, newOffset - originalOffset);
1397 } 1399 }
1398 } 1400 }
1399 } 1401 }
1400 1402
1401 } 1403 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/flexbox/stretch-align-svg-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698