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

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

Issue 1709963002: [css-align] New CSS Value 'normal' for Self Alignment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unskipped some repaint tests and rebaselined. Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 19 matching lines...) Expand all
30 #include "core/paint/GridPainter.h" 30 #include "core/paint/GridPainter.h"
31 #include "core/paint/PaintLayer.h" 31 #include "core/paint/PaintLayer.h"
32 #include "core/style/ComputedStyle.h" 32 #include "core/style/ComputedStyle.h"
33 #include "core/style/GridArea.h" 33 #include "core/style/GridArea.h"
34 #include "platform/LengthFunctions.h" 34 #include "platform/LengthFunctions.h"
35 #include <algorithm> 35 #include <algorithm>
36 36
37 namespace blink { 37 namespace blink {
38 38
39 static const int infinity = -1; 39 static const int infinity = -1;
40 static const ItemPosition selfAlignmentNormalBehavior = ItemPositionStretch;
40 41
41 class GridItemWithSpan; 42 class GridItemWithSpan;
42 43
43 class GridTrack { 44 class GridTrack {
44 public: 45 public:
45 GridTrack() 46 GridTrack()
46 : m_baseSize(0) 47 : m_baseSize(0)
47 , m_growthLimit(0) 48 , m_growthLimit(0)
48 , m_plannedSize(0) 49 , m_plannedSize(0)
49 , m_sizeDuringDistribution(0) 50 , m_sizeDuringDistribution(0)
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 // the grid and its children are correctly laid out according to the new sty le rules. 1526 // the grid and its children are correctly laid out according to the new sty le rules.
1526 setNeedsLayout(LayoutInvalidationReason::GridChanged); 1527 setNeedsLayout(LayoutInvalidationReason::GridChanged);
1527 1528
1528 m_grid.resize(0); 1529 m_grid.resize(0);
1529 m_gridItemArea.clear(); 1530 m_gridItemArea.clear();
1530 m_gridItemsOverflowingGridArea.resize(0); 1531 m_gridItemsOverflowingGridArea.resize(0);
1531 m_gridItemsIndexesMap.clear(); 1532 m_gridItemsIndexesMap.clear();
1532 m_gridIsDirty = true; 1533 m_gridIsDirty = true;
1533 } 1534 }
1534 1535
1535 static const StyleContentAlignmentData& normalValueBehavior() 1536 static const StyleContentAlignmentData& contentAlignmentNormalBehavior()
1536 { 1537 {
1537 static const StyleContentAlignmentData normalBehavior = {ContentPositionNorm al, ContentDistributionStretch}; 1538 static const StyleContentAlignmentData normalBehavior = {ContentPositionNorm al, ContentDistributionStretch};
1538 return normalBehavior; 1539 return normalBehavior;
1539 } 1540 }
1540 1541
1541 void LayoutGrid::applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection direction, GridSizingData& sizingData) 1542 void LayoutGrid::applyStretchAlignmentToTracksIfNeeded(GridTrackSizingDirection direction, GridSizingData& sizingData)
1542 { 1543 {
1543 LayoutUnit& availableSpace = sizingData.freeSpaceForDirection(direction); 1544 LayoutUnit& availableSpace = sizingData.freeSpaceForDirection(direction);
1544 if (availableSpace <= 0 1545 if (availableSpace <= 0
1545 || (direction == ForColumns && styleRef().resolvedJustifyContentDistribu tion(normalValueBehavior()) != ContentDistributionStretch) 1546 || (direction == ForColumns && styleRef().resolvedJustifyContentDistribu tion(contentAlignmentNormalBehavior()) != ContentDistributionStretch)
1546 || (direction == ForRows && styleRef().resolvedAlignContentDistribution( normalValueBehavior()) != ContentDistributionStretch)) 1547 || (direction == ForRows && styleRef().resolvedAlignContentDistribution( contentAlignmentNormalBehavior()) != ContentDistributionStretch))
1547 return; 1548 return;
1548 1549
1549 // Spec defines auto-sized tracks as the ones with an 'auto' max-sizing func tion. 1550 // Spec defines auto-sized tracks as the ones with an 'auto' max-sizing func tion.
1550 Vector<GridTrack>& tracks = (direction == ForColumns) ? sizingData.columnTra cks : sizingData.rowTracks; 1551 Vector<GridTrack>& tracks = (direction == ForColumns) ? sizingData.columnTra cks : sizingData.rowTracks;
1551 Vector<unsigned> autoSizedTracksIndex; 1552 Vector<unsigned> autoSizedTracksIndex;
1552 for (unsigned i = 0; i < tracks.size(); ++i) { 1553 for (unsigned i = 0; i < tracks.size(); ++i) {
1553 const GridTrackSize& trackSize = gridTrackSize(direction, i); 1554 const GridTrackSize& trackSize = gridTrackSize(direction, i);
1554 if (trackSize.hasAutoMaxTrackBreadth()) 1555 if (trackSize.hasAutoMaxTrackBreadth())
1555 autoSizedTracksIndex.append(i); 1556 autoSizedTracksIndex.append(i);
1556 } 1557 }
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1875 void LayoutGrid::applyStretchAlignmentToChildIfNeeded(LayoutBox& child) 1876 void LayoutGrid::applyStretchAlignmentToChildIfNeeded(LayoutBox& child)
1876 { 1877 {
1877 // We clear height override values because we will decide now whether it's a llowed or 1878 // We clear height override values because we will decide now whether it's a llowed or
1878 // not, evaluating the conditions which might have changed since the old val ues were set. 1879 // not, evaluating the conditions which might have changed since the old val ues were set.
1879 child.clearOverrideLogicalContentHeight(); 1880 child.clearOverrideLogicalContentHeight();
1880 1881
1881 auto& childStyle = child.styleRef(); 1882 auto& childStyle = child.styleRef();
1882 bool isHorizontalMode = isHorizontalWritingMode(); 1883 bool isHorizontalMode = isHorizontalWritingMode();
1883 bool hasAutoSizeInColumnAxis = isHorizontalMode ? childStyle.height().isAuto () : childStyle.width().isAuto(); 1884 bool hasAutoSizeInColumnAxis = isHorizontalMode ? childStyle.height().isAuto () : childStyle.width().isAuto();
1884 bool allowedToStretchChildAlongColumnAxis = hasAutoSizeInColumnAxis && !chil dStyle.marginBeforeUsing(style()).isAuto() && !childStyle.marginAfterUsing(style ()).isAuto(); 1885 bool allowedToStretchChildAlongColumnAxis = hasAutoSizeInColumnAxis && !chil dStyle.marginBeforeUsing(style()).isAuto() && !childStyle.marginAfterUsing(style ()).isAuto();
1885 if (allowedToStretchChildAlongColumnAxis && ComputedStyle::resolveAlignment( styleRef(), childStyle, ItemPositionStretch) == ItemPositionStretch) { 1886 if (allowedToStretchChildAlongColumnAxis && childStyle.resolvedAlignSelf(sty leRef(), selfAlignmentNormalBehavior).position() == ItemPositionStretch) {
1886 // TODO (lajava): If the child has orthogonal flow, then it already has an override height set, so use it. 1887 // TODO (lajava): If the child has orthogonal flow, then it already has an override height set, so use it.
1887 // TODO (lajava): grid track sizing and positioning do not support ortho gonal modes yet. 1888 // TODO (lajava): grid track sizing and positioning do not support ortho gonal modes yet.
1888 if (child.isHorizontalWritingMode() == isHorizontalMode) { 1889 if (child.isHorizontalWritingMode() == isHorizontalMode) {
1889 LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildB eforeStretching(child.overrideContainingBlockContentLogicalHeight(), child); 1890 LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildB eforeStretching(child.overrideContainingBlockContentLogicalHeight(), child);
1890 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinM ax(stretchedLogicalHeight, LayoutUnit(-1)); 1891 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinM ax(stretchedLogicalHeight, LayoutUnit(-1));
1891 child.setOverrideLogicalContentHeight(desiredLogicalHeight - child.b orderAndPaddingLogicalHeight()); 1892 child.setOverrideLogicalContentHeight(desiredLogicalHeight - child.b orderAndPaddingLogicalHeight());
1892 if (desiredLogicalHeight != child.logicalHeight()) { 1893 if (desiredLogicalHeight != child.logicalHeight()) {
1893 // TODO (lajava): Can avoid laying out here in some cases. See h ttps://webkit.org/b/87905. 1894 // TODO (lajava): Can avoid laying out here in some cases. See h ttps://webkit.org/b/87905.
1894 child.setLogicalHeight(LayoutUnit()); 1895 child.setLogicalHeight(LayoutUnit());
1895 child.setNeedsLayout(LayoutInvalidationReason::GridChanged); 1896 child.setNeedsLayout(LayoutInvalidationReason::GridChanged);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 child.setMarginBefore(availableAlignmentSpace, style()); 1954 child.setMarginBefore(availableAlignmentSpace, style());
1954 } else if (marginAfter.isAuto()) { 1955 } else if (marginAfter.isAuto()) {
1955 child.setMarginAfter(availableAlignmentSpace, style()); 1956 child.setMarginAfter(availableAlignmentSpace, style());
1956 } 1957 }
1957 } 1958 }
1958 1959
1959 GridAxisPosition LayoutGrid::columnAxisPositionForChild(const LayoutBox& child) const 1960 GridAxisPosition LayoutGrid::columnAxisPositionForChild(const LayoutBox& child) const
1960 { 1961 {
1961 bool hasSameWritingMode = child.styleRef().getWritingMode() == styleRef().ge tWritingMode(); 1962 bool hasSameWritingMode = child.styleRef().getWritingMode() == styleRef().ge tWritingMode();
1962 1963
1963 switch (ComputedStyle::resolveAlignment(styleRef(), child.styleRef(), ItemPo sitionStretch)) { 1964 switch (child.styleRef().resolvedAlignSelf(styleRef(), selfAlignmentNormalBe havior).position()) {
1964 case ItemPositionSelfStart: 1965 case ItemPositionSelfStart:
1965 // If orthogonal writing-modes, this computes to 'start'. 1966 // If orthogonal writing-modes, this computes to 'start'.
1966 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. 1967 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet.
1967 // self-start is based on the child's block axis direction. That's why w e need to check against the grid container's block flow. 1968 // self-start is based on the child's block axis direction. That's why w e need to check against the grid container's block flow.
1968 return (isOrthogonalChild(child) || hasSameWritingMode) ? GridAxisStart : GridAxisEnd; 1969 return (isOrthogonalChild(child) || hasSameWritingMode) ? GridAxisStart : GridAxisEnd;
1969 case ItemPositionSelfEnd: 1970 case ItemPositionSelfEnd:
1970 // If orthogonal writing-modes, this computes to 'end'. 1971 // If orthogonal writing-modes, this computes to 'end'.
1971 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. 1972 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet.
1972 // self-end is based on the child's block axis direction. That's why we need to check against the grid container's block flow. 1973 // self-end is based on the child's block axis direction. That's why we need to check against the grid container's block flow.
1973 return (isOrthogonalChild(child) || hasSameWritingMode) ? GridAxisEnd : GridAxisStart; 1974 return (isOrthogonalChild(child) || hasSameWritingMode) ? GridAxisEnd : GridAxisStart;
(...skipping 16 matching lines...) Expand all
1990 case ItemPositionEnd: 1991 case ItemPositionEnd:
1991 return GridAxisEnd; 1992 return GridAxisEnd;
1992 case ItemPositionStretch: 1993 case ItemPositionStretch:
1993 return GridAxisStart; 1994 return GridAxisStart;
1994 case ItemPositionBaseline: 1995 case ItemPositionBaseline:
1995 case ItemPositionLastBaseline: 1996 case ItemPositionLastBaseline:
1996 // FIXME: These two require implementing Baseline Alignment. For now, we always 'start' align the child. 1997 // FIXME: These two require implementing Baseline Alignment. For now, we always 'start' align the child.
1997 // crbug.com/234191 1998 // crbug.com/234191
1998 return GridAxisStart; 1999 return GridAxisStart;
1999 case ItemPositionAuto: 2000 case ItemPositionAuto:
2001 case ItemPositionNormal:
2000 break; 2002 break;
2001 } 2003 }
2002 2004
2003 ASSERT_NOT_REACHED(); 2005 ASSERT_NOT_REACHED();
2004 return GridAxisStart; 2006 return GridAxisStart;
2005 } 2007 }
2006 2008
2007 GridAxisPosition LayoutGrid::rowAxisPositionForChild(const LayoutBox& child) con st 2009 GridAxisPosition LayoutGrid::rowAxisPositionForChild(const LayoutBox& child) con st
2008 { 2010 {
2009 bool hasSameDirection = child.styleRef().direction() == styleRef().direction (); 2011 bool hasSameDirection = child.styleRef().direction() == styleRef().direction ();
2010 bool isLTR = styleRef().isLeftToRightDirection(); 2012 bool isLTR = styleRef().isLeftToRightDirection();
2011 2013
2012 switch (ComputedStyle::resolveJustification(styleRef(), child.styleRef(), It emPositionStretch)) { 2014 switch (child.styleRef().resolvedJustifySelf(styleRef(), selfAlignmentNormal Behavior).position()) {
2013 case ItemPositionSelfStart: 2015 case ItemPositionSelfStart:
2014 // For orthogonal writing-modes, this computes to 'start' 2016 // For orthogonal writing-modes, this computes to 'start'
2015 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. 2017 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet.
2016 // self-start is based on the child's direction. That's why we need to c heck against the grid container's direction. 2018 // self-start is based on the child's direction. That's why we need to c heck against the grid container's direction.
2017 return (isOrthogonalChild(child) || hasSameDirection) ? GridAxisStart : GridAxisEnd; 2019 return (isOrthogonalChild(child) || hasSameDirection) ? GridAxisStart : GridAxisEnd;
2018 case ItemPositionSelfEnd: 2020 case ItemPositionSelfEnd:
2019 // For orthogonal writing-modes, this computes to 'start' 2021 // For orthogonal writing-modes, this computes to 'start'
2020 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. 2022 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet.
2021 return (isOrthogonalChild(child) || hasSameDirection) ? GridAxisEnd : Gr idAxisStart; 2023 return (isOrthogonalChild(child) || hasSameDirection) ? GridAxisEnd : Gr idAxisStart;
2022 case ItemPositionLeft: 2024 case ItemPositionLeft:
2023 return isLTR ? GridAxisStart : GridAxisEnd; 2025 return isLTR ? GridAxisStart : GridAxisEnd;
2024 case ItemPositionRight: 2026 case ItemPositionRight:
2025 return isLTR ? GridAxisEnd : GridAxisStart; 2027 return isLTR ? GridAxisEnd : GridAxisStart;
2026 case ItemPositionCenter: 2028 case ItemPositionCenter:
2027 return GridAxisCenter; 2029 return GridAxisCenter;
2028 case ItemPositionFlexStart: // Only used in flex layout, otherwise equivalen t to 'start'. 2030 case ItemPositionFlexStart: // Only used in flex layout, otherwise equivalen t to 'start'.
2029 case ItemPositionStart: 2031 case ItemPositionStart:
2030 return GridAxisStart; 2032 return GridAxisStart;
2031 case ItemPositionFlexEnd: // Only used in flex layout, otherwise equivalent to 'end'. 2033 case ItemPositionFlexEnd: // Only used in flex layout, otherwise equivalent to 'end'.
2032 case ItemPositionEnd: 2034 case ItemPositionEnd:
2033 return GridAxisEnd; 2035 return GridAxisEnd;
2034 case ItemPositionStretch: 2036 case ItemPositionStretch:
2035 return GridAxisStart; 2037 return GridAxisStart;
2036 case ItemPositionBaseline: 2038 case ItemPositionBaseline:
2037 case ItemPositionLastBaseline: 2039 case ItemPositionLastBaseline:
2038 // FIXME: These two require implementing Baseline Alignment. For now, we always 'start' align the child. 2040 // FIXME: These two require implementing Baseline Alignment. For now, we always 'start' align the child.
2039 // crbug.com/234191 2041 // crbug.com/234191
2040 return GridAxisStart; 2042 return GridAxisStart;
2041 case ItemPositionAuto: 2043 case ItemPositionAuto:
2044 case ItemPositionNormal:
2042 break; 2045 break;
2043 } 2046 }
2044 2047
2045 ASSERT_NOT_REACHED(); 2048 ASSERT_NOT_REACHED();
2046 return GridAxisStart; 2049 return GridAxisStart;
2047 } 2050 }
2048 2051
2049 LayoutUnit LayoutGrid::columnAxisOffsetForChild(const LayoutBox& child, GridSizi ngData& sizingData) const 2052 LayoutUnit LayoutGrid::columnAxisOffsetForChild(const LayoutBox& child, GridSizi ngData& sizingData) const
2050 { 2053 {
2051 const GridSpan& rowsSpan = cachedGridSpan(child, ForRows); 2054 const GridSpan& rowsSpan = cachedGridSpan(child, ForRows);
(...skipping 12 matching lines...) Expand all
2064 LayoutUnit endOfRow = m_rowPositions[childEndLine]; 2067 LayoutUnit endOfRow = m_rowPositions[childEndLine];
2065 // m_rowPositions include distribution offset (because of content alignm ent) and gutters 2068 // m_rowPositions include distribution offset (because of content alignm ent) and gutters
2066 // so we need to subtract them to get the actual end position for a give n row 2069 // so we need to subtract them to get the actual end position for a give n row
2067 // (this does not have to be done for the last track as there are no mor e m_columnPositions after it). 2070 // (this does not have to be done for the last track as there are no mor e m_columnPositions after it).
2068 LayoutUnit trackGap = guttersSize(ForRows, 2); 2071 LayoutUnit trackGap = guttersSize(ForRows, 2);
2069 if (childEndLine < m_rowPositions.size() - 1) { 2072 if (childEndLine < m_rowPositions.size() - 1) {
2070 endOfRow -= trackGap; 2073 endOfRow -= trackGap;
2071 endOfRow -= m_offsetBetweenRows; 2074 endOfRow -= m_offsetBetweenRows;
2072 } 2075 }
2073 LayoutUnit childBreadth = child.logicalHeight() + child.marginLogicalHei ght(); 2076 LayoutUnit childBreadth = child.logicalHeight() + child.marginLogicalHei ght();
2074 OverflowAlignment overflow = child.styleRef().resolvedAlignment(styleRef (), ItemPositionStretch).overflow(); 2077 OverflowAlignment overflow = child.styleRef().resolvedAlignSelf(styleRef (), selfAlignmentNormalBehavior).overflow();
2075 LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(over flow, endOfRow - startOfRow, childBreadth); 2078 LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(over flow, endOfRow - startOfRow, childBreadth);
2076 return startPosition + (axisPosition == GridAxisEnd ? offsetFromStartPos ition : offsetFromStartPosition / 2); 2079 return startPosition + (axisPosition == GridAxisEnd ? offsetFromStartPos ition : offsetFromStartPosition / 2);
2077 } 2080 }
2078 } 2081 }
2079 2082
2080 ASSERT_NOT_REACHED(); 2083 ASSERT_NOT_REACHED();
2081 return LayoutUnit(); 2084 return LayoutUnit();
2082 } 2085 }
2083 2086
2084 LayoutUnit LayoutGrid::rowAxisOffsetForChild(const LayoutBox& child, GridSizingD ata& sizingData) const 2087 LayoutUnit LayoutGrid::rowAxisOffsetForChild(const LayoutBox& child, GridSizingD ata& sizingData) const
(...skipping 14 matching lines...) Expand all
2099 LayoutUnit endOfColumn = m_columnPositions[childEndLine]; 2102 LayoutUnit endOfColumn = m_columnPositions[childEndLine];
2100 // m_columnPositions include distribution offset (because of content ali gnment) and gutters 2103 // m_columnPositions include distribution offset (because of content ali gnment) and gutters
2101 // so we need to subtract them to get the actual end position for a give n column 2104 // so we need to subtract them to get the actual end position for a give n column
2102 // (this does not have to be done for the last track as there are no mor e m_columnPositions after it). 2105 // (this does not have to be done for the last track as there are no mor e m_columnPositions after it).
2103 LayoutUnit trackGap = guttersSize(ForColumns, 2); 2106 LayoutUnit trackGap = guttersSize(ForColumns, 2);
2104 if (childEndLine < m_columnPositions.size() - 1) { 2107 if (childEndLine < m_columnPositions.size() - 1) {
2105 endOfColumn -= trackGap; 2108 endOfColumn -= trackGap;
2106 endOfColumn -= m_offsetBetweenColumns; 2109 endOfColumn -= m_offsetBetweenColumns;
2107 } 2110 }
2108 LayoutUnit childBreadth = child.logicalWidth() + child.marginLogicalWidt h(); 2111 LayoutUnit childBreadth = child.logicalWidth() + child.marginLogicalWidt h();
2109 LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(chil d.styleRef().justifySelfOverflowAlignment(), endOfColumn - startOfColumn, childB readth); 2112 OverflowAlignment overflow = child.styleRef().resolvedJustifySelf(styleR ef(), selfAlignmentNormalBehavior).overflow();
2113 LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(over flow, endOfColumn - startOfColumn, childBreadth);
2110 return startPosition + (axisPosition == GridAxisEnd ? offsetFromStartPos ition : offsetFromStartPosition / 2); 2114 return startPosition + (axisPosition == GridAxisEnd ? offsetFromStartPos ition : offsetFromStartPosition / 2);
2111 } 2115 }
2112 } 2116 }
2113 2117
2114 ASSERT_NOT_REACHED(); 2118 ASSERT_NOT_REACHED();
2115 return LayoutUnit(); 2119 return LayoutUnit();
2116 } 2120 }
2117 2121
2118 ContentPosition static resolveContentDistributionFallback(ContentDistributionTyp e distribution) 2122 ContentPosition static resolveContentDistributionFallback(ContentDistributionTyp e distribution)
2119 { 2123 {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2161 return {}; 2165 return {};
2162 } 2166 }
2163 2167
2164 ASSERT_NOT_REACHED(); 2168 ASSERT_NOT_REACHED();
2165 return {}; 2169 return {};
2166 } 2170 }
2167 2171
2168 ContentAlignmentData LayoutGrid::computeContentPositionAndDistributionOffset(Gri dTrackSizingDirection direction, const LayoutUnit& availableFreeSpace, unsigned numberOfGridTracks) const 2172 ContentAlignmentData LayoutGrid::computeContentPositionAndDistributionOffset(Gri dTrackSizingDirection direction, const LayoutUnit& availableFreeSpace, unsigned numberOfGridTracks) const
2169 { 2173 {
2170 bool isRowAxis = direction == ForColumns; 2174 bool isRowAxis = direction == ForColumns;
2171 ContentPosition position = isRowAxis ? styleRef().resolvedJustifyContentPosi tion(normalValueBehavior()) : styleRef().resolvedAlignContentPosition(normalValu eBehavior()); 2175 ContentPosition position = isRowAxis ? styleRef().resolvedJustifyContentPosi tion(contentAlignmentNormalBehavior()) : styleRef().resolvedAlignContentPosition (contentAlignmentNormalBehavior());
2172 ContentDistributionType distribution = isRowAxis ? styleRef().resolvedJustif yContentDistribution(normalValueBehavior()) : styleRef().resolvedAlignContentDis tribution(normalValueBehavior()); 2176 ContentDistributionType distribution = isRowAxis ? styleRef().resolvedJustif yContentDistribution(contentAlignmentNormalBehavior()) : styleRef().resolvedAlig nContentDistribution(contentAlignmentNormalBehavior());
2173 // If <content-distribution> value can't be applied, 'position' will become the associated 2177 // If <content-distribution> value can't be applied, 'position' will become the associated
2174 // <content-position> fallback value. 2178 // <content-position> fallback value.
2175 ContentAlignmentData contentAlignment = contentDistributionOffset(availableF reeSpace, position, distribution, numberOfGridTracks); 2179 ContentAlignmentData contentAlignment = contentDistributionOffset(availableF reeSpace, position, distribution, numberOfGridTracks);
2176 if (contentAlignment.isValid()) 2180 if (contentAlignment.isValid())
2177 return contentAlignment; 2181 return contentAlignment;
2178 2182
2179 OverflowAlignment overflow = isRowAxis ? styleRef().justifyContentOverflowAl ignment() : styleRef().alignContentOverflowAlignment(); 2183 OverflowAlignment overflow = isRowAxis ? styleRef().justifyContentOverflowAl ignment() : styleRef().alignContentOverflowAlignment();
2180 if (availableFreeSpace <= 0 && overflow == OverflowAlignmentSafe) 2184 if (availableFreeSpace <= 0 && overflow == OverflowAlignmentSafe)
2181 return {LayoutUnit(), LayoutUnit()}; 2185 return {LayoutUnit(), LayoutUnit()};
2182 2186
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 2239
2236 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child, sizingData )); 2240 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child, sizingData ));
2237 } 2241 }
2238 2242
2239 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const 2243 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const
2240 { 2244 {
2241 GridPainter(*this).paintChildren(paintInfo, paintOffset); 2245 GridPainter(*this).paintChildren(paintInfo, paintOffset);
2242 } 2246 }
2243 2247
2244 } // namespace blink 2248 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698