Chromium Code Reviews| 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 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1562 // compute margins in order to determine the available height before stretch ing. | 1562 // compute margins in order to determine the available height before stretch ing. |
| 1563 if (childMarginLogicalHeight == 0) | 1563 if (childMarginLogicalHeight == 0) |
| 1564 childMarginLogicalHeight = computeMarginLogicalHeightForChild(child); | 1564 childMarginLogicalHeight = computeMarginLogicalHeightForChild(child); |
| 1565 | 1565 |
| 1566 return gridAreaBreadthForChild - childMarginLogicalHeight; | 1566 return gridAreaBreadthForChild - childMarginLogicalHeight; |
| 1567 } | 1567 } |
| 1568 | 1568 |
| 1569 // FIXME: This logic is shared by LayoutFlexibleBox, so it should be moved to La youtBox. | 1569 // FIXME: This logic is shared by LayoutFlexibleBox, so it should be moved to La youtBox. |
| 1570 void LayoutGrid::applyStretchAlignmentToChildIfNeeded(LayoutBox& child, LayoutUn it gridAreaBreadthForChild) | 1570 void LayoutGrid::applyStretchAlignmentToChildIfNeeded(LayoutBox& child, LayoutUn it gridAreaBreadthForChild) |
| 1571 { | 1571 { |
| 1572 if (ComputedStyle::resolveAlignment(styleRef(), child.styleRef(), ItemPositi onStretch) != ItemPositionStretch) | 1572 if (!allowedToStretchLogicalHeightForChild(child) || ComputedStyle::resolveA lignment(styleRef(), child.styleRef(), ItemPositionStretch) != ItemPositionStret ch) { |
| 1573 if (child.hasOverrideLogicalContentHeight()) | |
|
Julien - ping for review
2015/06/03 21:33:13
I would just call clearOverrideLogicalContentHeigh
jfernandez
2015/06/05 00:05:30
Done.
| |
| 1574 child.clearOverrideLogicalContentHeight(); | |
|
Julien - ping for review
2015/06/03 21:33:13
Thinking out loud here, we should probably think a
jfernandez
2015/06/05 00:05:30
Yes, I've got the same feeling. I'll add t my TODO
| |
| 1573 return; | 1575 return; |
| 1576 } | |
| 1574 | 1577 |
| 1575 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); | 1578 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); |
| 1576 if (allowedToStretchLogicalHeightForChild(child)) { | 1579 // FIXME: If the child has orthogonal flow, then it already has an override height set, so use it. |
| 1577 // FIXME: If the child has orthogonal flow, then it already has an overr ide height set, so use it. | 1580 // FIXME: grid track sizing and positioning do not support orthogonal modes yet. |
| 1578 // FIXME: grid track sizing and positioning do not support orthogonal mo des yet. | 1581 if (!hasOrthogonalWritingMode) { |
| 1579 if (!hasOrthogonalWritingMode) { | 1582 LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildBefor eStretching(gridAreaBreadthForChild, child); |
| 1580 LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildB eforeStretching(gridAreaBreadthForChild, child); | 1583 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinMax(s tretchedLogicalHeight, -1); |
| 1581 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinM ax(stretchedLogicalHeight, -1); | |
| 1582 | 1584 |
| 1583 // FIXME: Can avoid laying out here in some cases. See https://webki t.org/b/87905. | 1585 // FIXME: Can avoid laying out here in some cases. See https://webkit.or g/b/87905. |
| 1584 bool childNeedsRelayout = desiredLogicalHeight != child.logicalHeigh t(); | 1586 bool childNeedsRelayout = desiredLogicalHeight != child.logicalHeight(); |
| 1585 if (childNeedsRelayout || !child.hasOverrideLogicalContentHeight()) | 1587 if (childNeedsRelayout || !child.hasOverrideLogicalContentHeight()) |
| 1586 child.setOverrideLogicalContentHeight(desiredLogicalHeight - chi ld.borderAndPaddingLogicalHeight()); | 1588 child.setOverrideLogicalContentHeight(desiredLogicalHeight - child.b orderAndPaddingLogicalHeight()); |
| 1587 if (childNeedsRelayout) { | 1589 if (childNeedsRelayout) { |
| 1588 child.setLogicalHeight(0); | 1590 child.setLogicalHeight(0); |
| 1589 child.setNeedsLayout(LayoutInvalidationReason::GridChanged); | 1591 child.setNeedsLayout(LayoutInvalidationReason::GridChanged); |
| 1590 } | |
| 1591 } | 1592 } |
| 1592 } | 1593 } |
| 1593 } | 1594 } |
| 1594 | 1595 |
| 1595 LayoutUnit LayoutGrid::rowPositionForChild(const LayoutBox& child) const | 1596 LayoutUnit LayoutGrid::rowPositionForChild(const LayoutBox& child) const |
| 1596 { | 1597 { |
| 1597 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); | 1598 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); |
| 1598 switch (ComputedStyle::resolveAlignment(styleRef(), child.styleRef(), ItemPo sitionStretch)) { | 1599 switch (ComputedStyle::resolveAlignment(styleRef(), child.styleRef(), ItemPo sitionStretch)) { |
| 1599 case ItemPositionSelfStart: | 1600 case ItemPositionSelfStart: |
| 1600 // If orthogonal writing-modes, this computes to 'start'. | 1601 // If orthogonal writing-modes, this computes to 'start'. |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1833 | 1834 |
| 1834 return LayoutPoint(columnPosition, rowPositionForChild(child)); | 1835 return LayoutPoint(columnPosition, rowPositionForChild(child)); |
| 1835 } | 1836 } |
| 1836 | 1837 |
| 1837 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) | 1838 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) |
| 1838 { | 1839 { |
| 1839 GridPainter(*this).paintChildren(paintInfo, paintOffset); | 1840 GridPainter(*this).paintChildren(paintInfo, paintOffset); |
| 1840 } | 1841 } |
| 1841 | 1842 |
| 1842 } // namespace blink | 1843 } // namespace blink |
| OLD | NEW |