| 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 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "core/layout/LayoutFlexibleBox.h" | 31 #include "core/layout/LayoutFlexibleBox.h" |
| 32 | 32 |
| 33 #include "core/frame/UseCounter.h" | 33 #include "core/frame/UseCounter.h" |
| 34 #include "core/layout/LayoutState.h" | 34 #include "core/layout/LayoutState.h" |
| 35 #include "core/layout/LayoutView.h" |
| 35 #include "core/layout/TextAutosizer.h" | 36 #include "core/layout/TextAutosizer.h" |
| 36 #include "core/paint/BlockPainter.h" | 37 #include "core/paint/BlockPainter.h" |
| 37 #include "core/paint/PaintLayer.h" | 38 #include "core/paint/PaintLayer.h" |
| 38 #include "core/style/ComputedStyle.h" | 39 #include "core/style/ComputedStyle.h" |
| 39 #include "platform/LengthFunctions.h" | 40 #include "platform/LengthFunctions.h" |
| 40 #include "wtf/MathExtras.h" | 41 #include "wtf/MathExtras.h" |
| 41 #include <limits> | 42 #include <limits> |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| (...skipping 1807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1852 mainAxisOffset += isHorizontalFlow() ? verticalScrollbarWidth() | 1853 mainAxisOffset += isHorizontalFlow() ? verticalScrollbarWidth() |
| 1853 : horizontalScrollbarHeight(); | 1854 : horizontalScrollbarHeight(); |
| 1854 | 1855 |
| 1855 LayoutUnit totalMainExtent = mainAxisExtent(); | 1856 LayoutUnit totalMainExtent = mainAxisExtent(); |
| 1856 if (!shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | 1857 if (!shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) |
| 1857 totalMainExtent -= isHorizontalFlow() ? verticalScrollbarWidth() | 1858 totalMainExtent -= isHorizontalFlow() ? verticalScrollbarWidth() |
| 1858 : horizontalScrollbarHeight(); | 1859 : horizontalScrollbarHeight(); |
| 1859 LayoutUnit maxAscent, maxDescent; // Used when align-items: baseline. | 1860 LayoutUnit maxAscent, maxDescent; // Used when align-items: baseline. |
| 1860 LayoutUnit maxChildCrossAxisExtent; | 1861 LayoutUnit maxChildCrossAxisExtent; |
| 1861 bool shouldFlipMainAxis = !isColumnFlow() && !isLeftToRightFlow(); | 1862 bool shouldFlipMainAxis = !isColumnFlow() && !isLeftToRightFlow(); |
| 1863 bool isPaginated = view()->layoutState()->isPaginated(); |
| 1862 for (size_t i = 0; i < children.size(); ++i) { | 1864 for (size_t i = 0; i < children.size(); ++i) { |
| 1863 const FlexItem& flexItem = children[i]; | 1865 const FlexItem& flexItem = children[i]; |
| 1864 LayoutBox* child = flexItem.box; | 1866 LayoutBox* child = flexItem.box; |
| 1865 | 1867 |
| 1866 DCHECK(!flexItem.box->isOutOfFlowPositioned()); | 1868 DCHECK(!flexItem.box->isOutOfFlowPositioned()); |
| 1867 | 1869 |
| 1868 child->setMayNeedPaintInvalidation(); | 1870 child->setMayNeedPaintInvalidation(); |
| 1869 | 1871 |
| 1870 setOverrideMainAxisContentSizeForChild(*child, flexItem.flexedContentSize); | 1872 setOverrideMainAxisContentSizeForChild(*child, flexItem.flexedContentSize); |
| 1871 // The flexed content size and the override size include the scrollbar | 1873 // The flexed content size and the override size include the scrollbar |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1933 // on the left. This will be fixed later in flipForRightToLeftColumn. | 1935 // on the left. This will be fixed later in flipForRightToLeftColumn. |
| 1934 LayoutPoint childLocation( | 1936 LayoutPoint childLocation( |
| 1935 shouldFlipMainAxis ? totalMainExtent - mainAxisOffset - childMainExtent | 1937 shouldFlipMainAxis ? totalMainExtent - mainAxisOffset - childMainExtent |
| 1936 : mainAxisOffset, | 1938 : mainAxisOffset, |
| 1937 crossAxisOffset + flowAwareMarginBeforeForChild(*child)); | 1939 crossAxisOffset + flowAwareMarginBeforeForChild(*child)); |
| 1938 setFlowAwareLocationForChild(*child, childLocation); | 1940 setFlowAwareLocationForChild(*child, childLocation); |
| 1939 mainAxisOffset += childMainExtent + flowAwareMarginEndForChild(*child); | 1941 mainAxisOffset += childMainExtent + flowAwareMarginEndForChild(*child); |
| 1940 | 1942 |
| 1941 mainAxisOffset += justifyContentSpaceBetweenChildren( | 1943 mainAxisOffset += justifyContentSpaceBetweenChildren( |
| 1942 availableFreeSpace, distribution, children.size()); | 1944 availableFreeSpace, distribution, children.size()); |
| 1945 |
| 1946 if (isPaginated) |
| 1947 updateFragmentationInfoForChild(*child); |
| 1943 } | 1948 } |
| 1944 | 1949 |
| 1945 if (isColumnFlow()) | 1950 if (isColumnFlow()) |
| 1946 setLogicalHeight(std::max( | 1951 setLogicalHeight(std::max( |
| 1947 logicalHeight(), mainAxisOffset + flowAwareBorderEnd() + | 1952 logicalHeight(), mainAxisOffset + flowAwareBorderEnd() + |
| 1948 flowAwarePaddingEnd() + scrollbarLogicalHeight())); | 1953 flowAwarePaddingEnd() + scrollbarLogicalHeight())); |
| 1949 | 1954 |
| 1950 if (style()->flexDirection() == FlowColumnReverse) { | 1955 if (style()->flexDirection() == FlowColumnReverse) { |
| 1951 // We have to do an extra pass for column-reverse to reposition the flex | 1956 // We have to do an extra pass for column-reverse to reposition the flex |
| 1952 // items since the start depends on the height of the flexbox, which we | 1957 // items since the start depends on the height of the flexbox, which we |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2248 LayoutUnit originalOffset = | 2253 LayoutUnit originalOffset = |
| 2249 lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; | 2254 lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; |
| 2250 LayoutUnit newOffset = | 2255 LayoutUnit newOffset = |
| 2251 contentExtent - originalOffset - lineCrossAxisExtent; | 2256 contentExtent - originalOffset - lineCrossAxisExtent; |
| 2252 adjustAlignmentForChild(*flexItem.box, newOffset - originalOffset); | 2257 adjustAlignmentForChild(*flexItem.box, newOffset - originalOffset); |
| 2253 } | 2258 } |
| 2254 } | 2259 } |
| 2255 } | 2260 } |
| 2256 | 2261 |
| 2257 } // namespace blink | 2262 } // namespace blink |
| OLD | NEW |