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

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

Issue 655053002: Fix incorrect assumption about children's flexBasis (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix test 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/relayout-children-when-switching-direction-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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 { 604 {
605 child.clearOverrideSize(); 605 child.clearOverrideSize();
606 606
607 if (child.style()->hasAspectRatio() || child.isImage() || child.isVideo() || child.isCanvas()) 607 if (child.style()->hasAspectRatio() || child.isImage() || child.isVideo() || child.isCanvas())
608 UseCounter::count(document(), UseCounter::AspectRatioFlexItem); 608 UseCounter::count(document(), UseCounter::AspectRatioFlexItem);
609 609
610 Length flexBasis = flexBasisForChild(child); 610 Length flexBasis = flexBasisForChild(child);
611 if (preferredMainAxisExtentDependsOnLayout(flexBasis, hasInfiniteLineLength) ) { 611 if (preferredMainAxisExtentDependsOnLayout(flexBasis, hasInfiniteLineLength) ) {
612 LayoutUnit mainAxisExtent; 612 LayoutUnit mainAxisExtent;
613 if (hasOrthogonalFlow(child)) { 613 if (hasOrthogonalFlow(child)) {
614 if (child.needsLayout() || relayoutChildren) { 614 if (child.needsLayout() || relayoutChildren || !m_intrinsicSizeAlong MainAxis.contains(&child)) {
615 m_intrinsicSizeAlongMainAxis.remove(&child); 615 m_intrinsicSizeAlongMainAxis.remove(&child);
616 child.forceChildLayout(); 616 child.forceChildLayout();
617 m_intrinsicSizeAlongMainAxis.set(&child, child.logicalHeight()); 617 m_intrinsicSizeAlongMainAxis.set(&child, child.logicalHeight());
618 } 618 }
619 ASSERT(m_intrinsicSizeAlongMainAxis.contains(&child));
620 mainAxisExtent = m_intrinsicSizeAlongMainAxis.get(&child); 619 mainAxisExtent = m_intrinsicSizeAlongMainAxis.get(&child);
621 } else { 620 } else {
622 mainAxisExtent = child.maxPreferredLogicalWidth(); 621 mainAxisExtent = child.maxPreferredLogicalWidth();
623 } 622 }
624 ASSERT(mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child) >= 0); 623 ASSERT(mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child) >= 0);
625 return mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child); 624 return mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child);
626 } 625 }
627 return std::max(LayoutUnit(0), computeMainAxisExtentForChild(child, MainOrPr eferredSize, flexBasis)); 626 return std::max(LayoutUnit(0), computeMainAxisExtentForChild(child, MainOrPr eferredSize, flexBasis));
628 } 627 }
629 628
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 ASSERT(child); 1393 ASSERT(child);
1395 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1394 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1396 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1395 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1397 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1396 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1398 adjustAlignmentForChild(*child, newOffset - originalOffset); 1397 adjustAlignmentForChild(*child, newOffset - originalOffset);
1399 } 1398 }
1400 } 1399 }
1401 } 1400 }
1402 1401
1403 } 1402 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/flexbox/relayout-children-when-switching-direction-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698