OLD | NEW |
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 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1558 // compute margins in order to determine the available height before stretch
ing. | 1558 // compute margins in order to determine the available height before stretch
ing. |
1559 if (childMarginLogicalHeight == 0) | 1559 if (childMarginLogicalHeight == 0) |
1560 childMarginLogicalHeight = computeMarginLogicalHeightForChild(child); | 1560 childMarginLogicalHeight = computeMarginLogicalHeightForChild(child); |
1561 | 1561 |
1562 return gridAreaBreadthForChild - childMarginLogicalHeight; | 1562 return gridAreaBreadthForChild - childMarginLogicalHeight; |
1563 } | 1563 } |
1564 | 1564 |
1565 // FIXME: This logic is shared by LayoutFlexibleBox, so it should be moved to La
youtBox. | 1565 // FIXME: This logic is shared by LayoutFlexibleBox, so it should be moved to La
youtBox. |
1566 void LayoutGrid::applyStretchAlignmentToChildIfNeeded(LayoutBox& child, LayoutUn
it gridAreaBreadthForChild) | 1566 void LayoutGrid::applyStretchAlignmentToChildIfNeeded(LayoutBox& child, LayoutUn
it gridAreaBreadthForChild) |
1567 { | 1567 { |
1568 if (ComputedStyle::resolveAlignment(styleRef(), child.styleRef(), ItemPositi
onStretch) != ItemPositionStretch) | 1568 if (!allowedToStretchLogicalHeightForChild(child) || ComputedStyle::resolveA
lignment(styleRef(), child.styleRef(), ItemPositionStretch) != ItemPositionStret
ch) { |
| 1569 child.clearOverrideLogicalContentHeight(); |
1569 return; | 1570 return; |
| 1571 } |
1570 | 1572 |
1571 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon
talWritingMode(); | 1573 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon
talWritingMode(); |
1572 if (allowedToStretchLogicalHeightForChild(child)) { | 1574 // FIXME: If the child has orthogonal flow, then it already has an override
height set, so use it. |
1573 // FIXME: If the child has orthogonal flow, then it already has an overr
ide height set, so use it. | 1575 // FIXME: grid track sizing and positioning do not support orthogonal modes
yet. |
1574 // FIXME: grid track sizing and positioning do not support orthogonal mo
des yet. | 1576 if (!hasOrthogonalWritingMode) { |
1575 if (!hasOrthogonalWritingMode) { | 1577 LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildBefor
eStretching(gridAreaBreadthForChild, child); |
1576 LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildB
eforeStretching(gridAreaBreadthForChild, child); | 1578 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinMax(s
tretchedLogicalHeight, -1); |
1577 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinM
ax(stretchedLogicalHeight, -1); | |
1578 | 1579 |
1579 // FIXME: Can avoid laying out here in some cases. See https://webki
t.org/b/87905. | 1580 // FIXME: Can avoid laying out here in some cases. See https://webkit.or
g/b/87905. |
1580 bool childNeedsRelayout = desiredLogicalHeight != child.logicalHeigh
t(); | 1581 bool childNeedsRelayout = desiredLogicalHeight != child.logicalHeight(); |
1581 if (childNeedsRelayout || !child.hasOverrideLogicalContentHeight()) | 1582 if (childNeedsRelayout || !child.hasOverrideLogicalContentHeight()) |
1582 child.setOverrideLogicalContentHeight(desiredLogicalHeight - chi
ld.borderAndPaddingLogicalHeight()); | 1583 child.setOverrideLogicalContentHeight(desiredLogicalHeight - child.b
orderAndPaddingLogicalHeight()); |
1583 if (childNeedsRelayout) { | 1584 if (childNeedsRelayout) { |
1584 child.setLogicalHeight(0); | 1585 child.setLogicalHeight(0); |
1585 child.setNeedsLayout(LayoutInvalidationReason::GridChanged); | 1586 child.setNeedsLayout(LayoutInvalidationReason::GridChanged); |
1586 } | |
1587 } | 1587 } |
1588 } | 1588 } |
1589 } | 1589 } |
1590 | 1590 |
1591 LayoutUnit LayoutGrid::rowPositionForChild(const LayoutBox& child) const | 1591 LayoutUnit LayoutGrid::rowPositionForChild(const LayoutBox& child) const |
1592 { | 1592 { |
1593 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon
talWritingMode(); | 1593 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon
talWritingMode(); |
1594 switch (ComputedStyle::resolveAlignment(styleRef(), child.styleRef(), ItemPo
sitionStretch)) { | 1594 switch (ComputedStyle::resolveAlignment(styleRef(), child.styleRef(), ItemPo
sitionStretch)) { |
1595 case ItemPositionSelfStart: | 1595 case ItemPositionSelfStart: |
1596 // If orthogonal writing-modes, this computes to 'start'. | 1596 // If orthogonal writing-modes, this computes to 'start'. |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 | 1829 |
1830 return LayoutPoint(columnPosition, rowPositionForChild(child)); | 1830 return LayoutPoint(columnPosition, rowPositionForChild(child)); |
1831 } | 1831 } |
1832 | 1832 |
1833 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) | 1833 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) |
1834 { | 1834 { |
1835 GridPainter(*this).paintChildren(paintInfo, paintOffset); | 1835 GridPainter(*this).paintChildren(paintInfo, paintOffset); |
1836 } | 1836 } |
1837 | 1837 |
1838 } // namespace blink | 1838 } // namespace blink |
OLD | NEW |