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

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

Issue 2135733002: [css-flexbox] Don't over-invalidate flex items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 5 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 | « no previous file | 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 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 Vector<LineContext> lineContexts; 844 Vector<LineContext> lineContexts;
845 OrderedFlexItemList orderedChildren; 845 OrderedFlexItemList orderedChildren;
846 LayoutUnit sumFlexBaseSize; 846 LayoutUnit sumFlexBaseSize;
847 double totalFlexGrow; 847 double totalFlexGrow;
848 double totalFlexShrink; 848 double totalFlexShrink;
849 double totalWeightedFlexShrink; 849 double totalWeightedFlexShrink;
850 LayoutUnit sumHypotheticalMainSize; 850 LayoutUnit sumHypotheticalMainSize;
851 851
852 Vector<LayoutUnit, 16> childSizes; 852 Vector<LayoutUnit, 16> childSizes;
853 853
854 dirtyForLayoutFromPercentageHeightDescendants(layoutScope);
855
856 m_orderIterator.first(); 854 m_orderIterator.first();
857 LayoutUnit crossAxisOffset = flowAwareBorderBefore() + flowAwarePaddingBefor e(); 855 LayoutUnit crossAxisOffset = flowAwareBorderBefore() + flowAwarePaddingBefor e();
858 while (computeNextFlexLine(orderedChildren, sumFlexBaseSize, totalFlexGrow, totalFlexShrink, totalWeightedFlexShrink, sumHypotheticalMainSize, relayoutChild ren)) { 856 while (computeNextFlexLine(orderedChildren, sumFlexBaseSize, totalFlexGrow, totalFlexShrink, totalWeightedFlexShrink, sumHypotheticalMainSize, relayoutChild ren)) {
859 LayoutUnit containerMainInnerSize = mainAxisContentExtent(sumHypothetica lMainSize); 857 LayoutUnit containerMainInnerSize = mainAxisContentExtent(sumHypothetica lMainSize);
860 // availableFreeSpace is the initial amount of free space in this flexbo x. 858 // availableFreeSpace is the initial amount of free space in this flexbo x.
861 // remainingFreeSpace starts out at the same value but as we place and l ay out 859 // remainingFreeSpace starts out at the same value but as we place and l ay out
862 // flex items we subtract from it. Note that both values can be negative . 860 // flex items we subtract from it. Note that both values can be negative .
863 const LayoutUnit availableFreeSpace = containerMainInnerSize - sumFlexBa seSize; 861 const LayoutUnit availableFreeSpace = containerMainInnerSize - sumFlexBa seSize;
864 LayoutUnit remainingFreeSpace = availableFreeSpace; 862 LayoutUnit remainingFreeSpace = availableFreeSpace;
865 FlexSign flexSign = (sumHypotheticalMainSize < containerMainInnerSize) ? PositiveFlexibility : NegativeFlexibility; 863 FlexSign flexSign = (sumHypotheticalMainSize < containerMainInnerSize) ? PositiveFlexibility : NegativeFlexibility;
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 1569
1572 LayoutUnit childPreferredSize = childSizes[i] + mainAxisBorderAndPadding ExtentForChild(*child); 1570 LayoutUnit childPreferredSize = childSizes[i] + mainAxisBorderAndPadding ExtentForChild(*child);
1573 setOverrideMainAxisSizeForChild(*child, childPreferredSize); 1571 setOverrideMainAxisSizeForChild(*child, childPreferredSize);
1574 if (childPreferredSize != mainAxisExtentForChild(*child)) { 1572 if (childPreferredSize != mainAxisExtentForChild(*child)) {
1575 child->setChildNeedsLayout(MarkOnlyThis); 1573 child->setChildNeedsLayout(MarkOnlyThis);
1576 } else { 1574 } else {
1577 // To avoid double applying margin changes in updateAutoMarginsInCro ssAxis, we reset the margins here. 1575 // To avoid double applying margin changes in updateAutoMarginsInCro ssAxis, we reset the margins here.
1578 resetAutoMarginsAndLogicalTopInCrossAxis(*child); 1576 resetAutoMarginsAndLogicalTopInCrossAxis(*child);
1579 } 1577 }
1580 // We may have already forced relayout for orthogonal flowing children i n computeInnerFlexBaseSizeForChild. 1578 // We may have already forced relayout for orthogonal flowing children i n computeInnerFlexBaseSizeForChild.
1581 bool forceChildRelayout = relayoutChildren && !childFlexBaseSizeRequires Layout(*child); 1579 bool forceChildRelayout = relayoutChildren && !m_relaidOutChildren.conta ins(child);
1582 if (child->isLayoutBlock() && toLayoutBlock(*child).hasPercentHeightDesc endants() && m_relaidOutChildren.contains(child)) { 1580 if (child->isLayoutBlock() && toLayoutBlock(*child).hasPercentHeightDesc endants()) {
1583 // Have to force another relayout even though the child is sized cor rectly, because 1581 // Have to force another relayout even though the child is sized cor rectly, because
1584 // its descendants are not sized correctly yet. Our previous layout of the child was 1582 // its descendants are not sized correctly yet. Our previous layout of the child was
1585 // done without an override height set. So, redo it here. 1583 // done without an override height set. So, redo it here.
1586 forceChildRelayout = true; 1584 forceChildRelayout = true;
1587 } 1585 }
1588 updateBlockChildDirtyBitsBeforeLayout(forceChildRelayout, *child); 1586 updateBlockChildDirtyBitsBeforeLayout(forceChildRelayout, *child);
1589 if (!child->needsLayout()) 1587 if (!child->needsLayout())
1590 child->markForPaginationRelayoutIfNeeded(layoutScope); 1588 child->markForPaginationRelayoutIfNeeded(layoutScope);
1591 if (child->needsLayout()) 1589 if (child->needsLayout())
1592 m_relaidOutChildren.add(child); 1590 m_relaidOutChildren.add(child);
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 ASSERT(child); 1858 ASSERT(child);
1861 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1859 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1862 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1860 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1863 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1861 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1864 adjustAlignmentForChild(*child, newOffset - originalOffset); 1862 adjustAlignmentForChild(*child, newOffset - originalOffset);
1865 } 1863 }
1866 } 1864 }
1867 } 1865 }
1868 1866
1869 } // namespace blink 1867 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698