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

Side by Side Diff: Source/core/layout/LayoutFlexibleBox.cpp

Issue 1017673002: Flexbox: negatively stretching a flexbox should have border + padding as a minimum (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated Created 5 years, 8 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
« no previous file with comments | « LayoutTests/css3/flexbox/flex-flow-auto-margins-no-available-space-assert-expected.txt ('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 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 } 1336 }
1337 } 1337 }
1338 } 1338 }
1339 1339
1340 void LayoutFlexibleBox::applyStretchAlignmentToChild(LayoutBox& child, LayoutUni t lineCrossAxisExtent) 1340 void LayoutFlexibleBox::applyStretchAlignmentToChild(LayoutBox& child, LayoutUni t lineCrossAxisExtent)
1341 { 1341 {
1342 if (!isColumnFlow() && child.style()->logicalHeight().isAuto()) { 1342 if (!isColumnFlow() && child.style()->logicalHeight().isAuto()) {
1343 // FIXME: If the child has orthogonal flow, then it already has an overr ide height set, so use it. 1343 // FIXME: If the child has orthogonal flow, then it already has an overr ide height set, so use it.
1344 if (!hasOrthogonalFlow(child)) { 1344 if (!hasOrthogonalFlow(child)) {
1345 LayoutUnit heightBeforeStretching = needToStretchChildLogicalHeight( child) ? constrainedChildIntrinsicContentLogicalHeight(child) : child.logicalHei ght(); 1345 LayoutUnit heightBeforeStretching = needToStretchChildLogicalHeight( child) ? constrainedChildIntrinsicContentLogicalHeight(child) : child.logicalHei ght();
1346 LayoutUnit stretchedLogicalHeight = heightBeforeStretching + availab leAlignmentSpaceForChildBeforeStretching(lineCrossAxisExtent, child); 1346 LayoutUnit stretchedLogicalHeight = std::max(child.borderAndPaddingL ogicalHeight(), heightBeforeStretching + availableAlignmentSpaceForChildBeforeSt retching(lineCrossAxisExtent, child));
1347 ASSERT(!child.needsLayout()); 1347 ASSERT(!child.needsLayout());
1348 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinM ax(stretchedLogicalHeight, heightBeforeStretching - child.borderAndPaddingLogica lHeight()); 1348 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinM ax(stretchedLogicalHeight, heightBeforeStretching - child.borderAndPaddingLogica lHeight());
1349 1349
1350 // FIXME: Can avoid laying out here in some cases. See https://webki t.org/b/87905. 1350 // FIXME: Can avoid laying out here in some cases. See https://webki t.org/b/87905.
1351 bool childNeedsRelayout = desiredLogicalHeight != child.logicalHeigh t(); 1351 bool childNeedsRelayout = desiredLogicalHeight != child.logicalHeigh t();
1352 if (childNeedsRelayout || !child.hasOverrideHeight()) 1352 if (childNeedsRelayout || !child.hasOverrideHeight())
1353 child.setOverrideLogicalContentHeight(desiredLogicalHeight - chi ld.borderAndPaddingLogicalHeight()); 1353 child.setOverrideLogicalContentHeight(desiredLogicalHeight - chi ld.borderAndPaddingLogicalHeight());
1354 if (childNeedsRelayout) { 1354 if (childNeedsRelayout) {
1355 child.setLogicalHeight(0); 1355 child.setLogicalHeight(0);
1356 // We cache the child's intrinsic content logical height to avoi d it being reset to the stretched height. 1356 // We cache the child's intrinsic content logical height to avoi d it being reset to the stretched height.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 ASSERT(child); 1401 ASSERT(child);
1402 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1402 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1403 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1403 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1404 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1404 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1405 adjustAlignmentForChild(*child, newOffset - originalOffset); 1405 adjustAlignmentForChild(*child, newOffset - originalOffset);
1406 } 1406 }
1407 } 1407 }
1408 } 1408 }
1409 1409
1410 } 1410 }
OLDNEW
« no previous file with comments | « LayoutTests/css3/flexbox/flex-flow-auto-margins-no-available-space-assert-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698