| OLD | NEW |
| 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 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 Vector<LineContext> lineContexts; | 856 Vector<LineContext> lineContexts; |
| 857 OrderedFlexItemList orderedChildren; | 857 OrderedFlexItemList orderedChildren; |
| 858 LayoutUnit sumFlexBaseSize; | 858 LayoutUnit sumFlexBaseSize; |
| 859 double totalFlexGrow; | 859 double totalFlexGrow; |
| 860 double totalFlexShrink; | 860 double totalFlexShrink; |
| 861 double totalWeightedFlexShrink; | 861 double totalWeightedFlexShrink; |
| 862 LayoutUnit sumHypotheticalMainSize; | 862 LayoutUnit sumHypotheticalMainSize; |
| 863 | 863 |
| 864 PaintLayerScrollableArea::PreventRelayoutScope preventRelayoutScope(layoutSc
ope); | 864 PaintLayerScrollableArea::PreventRelayoutScope preventRelayoutScope(layoutSc
ope); |
| 865 | 865 |
| 866 dirtyForLayoutFromPercentageHeightDescendants(layoutScope); | |
| 867 | |
| 868 m_orderIterator.first(); | 866 m_orderIterator.first(); |
| 869 LayoutUnit crossAxisOffset = flowAwareBorderBefore() + flowAwarePaddingBefor
e(); | 867 LayoutUnit crossAxisOffset = flowAwareBorderBefore() + flowAwarePaddingBefor
e(); |
| 870 while (computeNextFlexLine(orderedChildren, sumFlexBaseSize, totalFlexGrow,
totalFlexShrink, totalWeightedFlexShrink, sumHypotheticalMainSize, relayoutChild
ren)) { | 868 while (computeNextFlexLine(orderedChildren, sumFlexBaseSize, totalFlexGrow,
totalFlexShrink, totalWeightedFlexShrink, sumHypotheticalMainSize, relayoutChild
ren)) { |
| 871 LayoutUnit containerMainInnerSize = mainAxisContentExtent(sumHypothetica
lMainSize); | 869 LayoutUnit containerMainInnerSize = mainAxisContentExtent(sumHypothetica
lMainSize); |
| 872 // availableFreeSpace is the initial amount of free space in this flexbo
x. | 870 // availableFreeSpace is the initial amount of free space in this flexbo
x. |
| 873 // remainingFreeSpace starts out at the same value but as we place and l
ay out | 871 // remainingFreeSpace starts out at the same value but as we place and l
ay out |
| 874 // flex items we subtract from it. Note that both values can be negative
. | 872 // flex items we subtract from it. Note that both values can be negative
. |
| 875 LayoutUnit remainingFreeSpace = containerMainInnerSize - sumFlexBaseSize
; | 873 LayoutUnit remainingFreeSpace = containerMainInnerSize - sumFlexBaseSize
; |
| 876 FlexSign flexSign = (sumHypotheticalMainSize < containerMainInnerSize) ?
PositiveFlexibility : NegativeFlexibility; | 874 FlexSign flexSign = (sumHypotheticalMainSize < containerMainInnerSize) ?
PositiveFlexibility : NegativeFlexibility; |
| 877 freezeInflexibleItems(flexSign, orderedChildren, remainingFreeSpace, tot
alFlexGrow, totalFlexShrink, totalWeightedFlexShrink); | 875 freezeInflexibleItems(flexSign, orderedChildren, remainingFreeSpace, tot
alFlexGrow, totalFlexShrink, totalWeightedFlexShrink); |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1596 | 1594 |
| 1597 LayoutUnit childPreferredSize = flexItem.flexedContentSize + mainAxisBor
derAndPaddingExtentForChild(*child); | 1595 LayoutUnit childPreferredSize = flexItem.flexedContentSize + mainAxisBor
derAndPaddingExtentForChild(*child); |
| 1598 setOverrideMainAxisSizeForChild(*child, childPreferredSize); | 1596 setOverrideMainAxisSizeForChild(*child, childPreferredSize); |
| 1599 if (childPreferredSize != mainAxisExtentForChild(*child)) { | 1597 if (childPreferredSize != mainAxisExtentForChild(*child)) { |
| 1600 child->setChildNeedsLayout(MarkOnlyThis); | 1598 child->setChildNeedsLayout(MarkOnlyThis); |
| 1601 } else { | 1599 } else { |
| 1602 // To avoid double applying margin changes in updateAutoMarginsInCro
ssAxis, we reset the margins here. | 1600 // To avoid double applying margin changes in updateAutoMarginsInCro
ssAxis, we reset the margins here. |
| 1603 resetAutoMarginsAndLogicalTopInCrossAxis(*child); | 1601 resetAutoMarginsAndLogicalTopInCrossAxis(*child); |
| 1604 } | 1602 } |
| 1605 // We may have already forced relayout for orthogonal flowing children i
n computeInnerFlexBaseSizeForChild. | 1603 // We may have already forced relayout for orthogonal flowing children i
n computeInnerFlexBaseSizeForChild. |
| 1606 bool forceChildRelayout = relayoutChildren && !childFlexBaseSizeRequires
Layout(*child); | 1604 bool forceChildRelayout = relayoutChildren && !m_relaidOutChildren.conta
ins(child); |
| 1607 if (child->isLayoutBlock() && toLayoutBlock(*child).hasPercentHeightDesc
endants() && m_relaidOutChildren.contains(child)) { | 1605 if (child->isLayoutBlock() && toLayoutBlock(*child).hasPercentHeightDesc
endants()) { |
| 1608 // Have to force another relayout even though the child is sized cor
rectly, because | 1606 // Have to force another relayout even though the child is sized cor
rectly, because |
| 1609 // its descendants are not sized correctly yet. Our previous layout
of the child was | 1607 // its descendants are not sized correctly yet. Our previous layout
of the child was |
| 1610 // done without an override height set. So, redo it here. | 1608 // done without an override height set. So, redo it here. |
| 1611 forceChildRelayout = true; | 1609 forceChildRelayout = true; |
| 1612 } | 1610 } |
| 1613 updateBlockChildDirtyBitsBeforeLayout(forceChildRelayout, *child); | 1611 updateBlockChildDirtyBitsBeforeLayout(forceChildRelayout, *child); |
| 1614 if (!child->needsLayout()) | 1612 if (!child->needsLayout()) |
| 1615 child->markForPaginationRelayoutIfNeeded(layoutScope); | 1613 child->markForPaginationRelayoutIfNeeded(layoutScope); |
| 1616 if (child->needsLayout()) | 1614 if (child->needsLayout()) |
| 1617 m_relaidOutChildren.add(child); | 1615 m_relaidOutChildren.add(child); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1885 ASSERT(child); | 1883 ASSERT(child); |
| 1886 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; | 1884 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; |
| 1887 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; | 1885 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; |
| 1888 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; | 1886 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; |
| 1889 adjustAlignmentForChild(*child, newOffset - originalOffset); | 1887 adjustAlignmentForChild(*child, newOffset - originalOffset); |
| 1890 } | 1888 } |
| 1891 } | 1889 } |
| 1892 } | 1890 } |
| 1893 | 1891 |
| 1894 } // namespace blink | 1892 } // namespace blink |
| OLD | NEW |