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

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

Issue 715083002: Avoid blowing away the intrinsicContentLogicalHeight when stretching height in FlexBox (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: s/EAE likes/I like/ 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderBox.h ('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 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 LayoutUnit stretchedLogicalHeight = heightBeforeStretching + availab leAlignmentSpaceForChildBeforeStretching(lineCrossAxisExtent, child); 1343 LayoutUnit stretchedLogicalHeight = heightBeforeStretching + availab leAlignmentSpaceForChildBeforeStretching(lineCrossAxisExtent, child);
1344 ASSERT(!child.needsLayout()); 1344 ASSERT(!child.needsLayout());
1345 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinM ax(stretchedLogicalHeight, heightBeforeStretching - child.borderAndPaddingLogica lHeight()); 1345 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinM ax(stretchedLogicalHeight, heightBeforeStretching - child.borderAndPaddingLogica lHeight());
1346 1346
1347 // FIXME: Can avoid laying out here in some cases. See https://webki t.org/b/87905. 1347 // FIXME: Can avoid laying out here in some cases. See https://webki t.org/b/87905.
1348 bool childNeedsRelayout = desiredLogicalHeight != child.logicalHeigh t(); 1348 bool childNeedsRelayout = desiredLogicalHeight != child.logicalHeigh t();
1349 if (childNeedsRelayout || !child.hasOverrideHeight()) 1349 if (childNeedsRelayout || !child.hasOverrideHeight())
1350 child.setOverrideLogicalContentHeight(desiredLogicalHeight - chi ld.borderAndPaddingLogicalHeight()); 1350 child.setOverrideLogicalContentHeight(desiredLogicalHeight - chi ld.borderAndPaddingLogicalHeight());
1351 if (childNeedsRelayout) { 1351 if (childNeedsRelayout) {
1352 child.setLogicalHeight(0); 1352 child.setLogicalHeight(0);
1353 // We cache the child's intrinsic content logical height to avoi d it being reset to the stretched height.
1354 // FIXME: This is fragile. RenderBoxes should be smart enough to determine their intrinsic content logical
1355 // height correctly even when there's an overrideHeight.
1356 LayoutUnit childIntrinsicContentLogicalHeight = child.intrinsicC ontentLogicalHeight();
1353 child.forceChildLayout(); 1357 child.forceChildLayout();
1358 child.updateIntrinsicContentLogicalHeight(childIntrinsicContentL ogicalHeight);
1354 } 1359 }
1355 } 1360 }
1356 } else if (isColumnFlow() && child.style()->logicalWidth().isAuto()) { 1361 } else if (isColumnFlow() && child.style()->logicalWidth().isAuto()) {
1357 // FIXME: If the child doesn't have orthogonal flow, then it already has an override width set, so use it. 1362 // FIXME: If the child doesn't have orthogonal flow, then it already has an override width set, so use it.
1358 if (hasOrthogonalFlow(child)) { 1363 if (hasOrthogonalFlow(child)) {
1359 LayoutUnit childWidth = std::max<LayoutUnit>(0, lineCrossAxisExtent - crossAxisMarginExtentForChild(child)); 1364 LayoutUnit childWidth = std::max<LayoutUnit>(0, lineCrossAxisExtent - crossAxisMarginExtentForChild(child));
1360 childWidth = child.constrainLogicalWidthByMinMax(childWidth, childWi dth, this); 1365 childWidth = child.constrainLogicalWidthByMinMax(childWidth, childWi dth, this);
1361 1366
1362 if (childWidth != child.logicalWidth()) { 1367 if (childWidth != child.logicalWidth()) {
1363 child.setOverrideLogicalContentWidth(childWidth - child.borderAn dPaddingLogicalWidth()); 1368 child.setOverrideLogicalContentWidth(childWidth - child.borderAn dPaddingLogicalWidth());
(...skipping 29 matching lines...) Expand all
1393 ASSERT(child); 1398 ASSERT(child);
1394 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1399 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1395 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1400 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1396 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1401 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1397 adjustAlignmentForChild(*child, newOffset - originalOffset); 1402 adjustAlignmentForChild(*child, newOffset - originalOffset);
1398 } 1403 }
1399 } 1404 }
1400 } 1405 }
1401 1406
1402 } 1407 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698