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 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1515 | 1515 |
| 1516 bool startIsAuto = startPosition.isAuto() | 1516 bool startIsAuto = startPosition.isAuto() |
| 1517 || (startPosition.isNamedGridArea() && !GridPositionsResolver::isValidNa medLineOrArea(startPosition.namedGridLine(), styleRef(), GridPositionsResolver:: initialPositionSide(direction))) | 1517 || (startPosition.isNamedGridArea() && !GridPositionsResolver::isValidNa medLineOrArea(startPosition.namedGridLine(), styleRef(), GridPositionsResolver:: initialPositionSide(direction))) |
| 1518 || (startLine < firstExplicitLine) | 1518 || (startLine < firstExplicitLine) |
| 1519 || (startLine > lastExplicitLine); | 1519 || (startLine > lastExplicitLine); |
| 1520 bool endIsAuto = endPosition.isAuto() | 1520 bool endIsAuto = endPosition.isAuto() |
| 1521 || (endPosition.isNamedGridArea() && !GridPositionsResolver::isValidName dLineOrArea(endPosition.namedGridLine(), styleRef(), GridPositionsResolver::fina lPositionSide(direction))) | 1521 || (endPosition.isNamedGridArea() && !GridPositionsResolver::isValidName dLineOrArea(endPosition.namedGridLine(), styleRef(), GridPositionsResolver::fina lPositionSide(direction))) |
| 1522 || (endLine < firstExplicitLine) | 1522 || (endLine < firstExplicitLine) |
| 1523 || (endLine > lastExplicitLine); | 1523 || (endLine > lastExplicitLine); |
| 1524 | 1524 |
| 1525 LayoutUnit start = startIsAuto ? LayoutUnit() : isForColumns ? m_columnPosi tions[startLine] : m_rowPositions[startLine]; | 1525 LayoutUnit start; |
| 1526 LayoutUnit end = endIsAuto ? isForColumns ? logicalWidth() : logicalHeight() : isForColumns ? m_columnPositions[endLine] : m_rowPositions[endLine]; | 1526 if (!startIsAuto) { |
|
svillar
2016/03/29 10:17:58
This deserves a comment about how positions are st
| |
| 1527 if (isForColumns) | |
| 1528 start = m_columnPositions[startLine] - m_columnPositions[0] + paddin gStart(); | |
| 1529 else | |
| 1530 start = m_rowPositions[startLine] - m_rowPositions[0] + paddingBefor e(); | |
| 1531 } | |
| 1532 | |
| 1533 LayoutUnit end = isForColumns ? clientLogicalWidth() : clientLogicalHeight() ; | |
|
svillar
2016/03/29 10:17:58
The previous code was using logicalXXX. Is the cli
Manuel Rego
2016/03/29 10:34:51
Previous code was subtracting the border and we ca
| |
| 1534 if (!endIsAuto) { | |
| 1535 if (isForColumns) | |
| 1536 end = m_columnPositions[endLine] - m_columnPositions[0] + paddingSta rt(); | |
| 1537 else | |
| 1538 end = m_rowPositions[endLine] - m_rowPositions[0] + paddingBefore(); | |
| 1539 } | |
| 1527 | 1540 |
| 1528 breadth = end - start; | 1541 breadth = end - start; |
| 1542 offset = start; | |
| 1529 | 1543 |
| 1530 if (startIsAuto) | 1544 if (isForColumns && !styleRef().isLeftToRightDirection() && !child.styleRef( ).hasStaticInlinePosition(child.isHorizontalWritingMode())) { |
| 1531 breadth -= isForColumns ? borderStart() : borderBefore(); | 1545 // If the child doesn't have a static inline position, we need to calcul ate the offset from the left (even if we're in RTL). |
|
cbiesinger
2016/03/23 19:50:48
Sorry, why do we need to calculate anything when t
Manuel Rego
2016/03/28 08:57:29
Let's use an example.
Imagine that we've a grid wi
svillar
2016/03/29 10:17:58
Perhaps the comment could be improved. Saying "if
Manuel Rego
2016/03/29 10:34:51
Not sure if I agree as the term "static position"
| |
| 1532 else | 1546 if (endIsAuto) { |
| 1533 start -= isForColumns ? borderStart() : borderBefore(); | 1547 offset = LayoutUnit(); |
| 1534 | 1548 } else { |
| 1535 if (endIsAuto) { | 1549 LayoutUnit alignmentOffset = m_columnPositions[0] - borderAndPaddin gStart(); |
| 1536 breadth -= isForColumns ? borderEnd() : borderAfter(); | 1550 LayoutUnit offsetFromLastLine = m_columnPositions[m_columnPositions. size() - 1] - m_columnPositions[endLine]; |
| 1537 breadth -= scrollbarLogicalWidth(); | 1551 offset = paddingLeft() + alignmentOffset + offsetFromLastLine; |
| 1552 } | |
| 1538 } | 1553 } |
| 1539 | 1554 |
| 1540 offset = start; | |
| 1541 | |
| 1542 if (child.parent() == this && !startIsAuto) { | 1555 if (child.parent() == this && !startIsAuto) { |
| 1543 // If column/row start is "auto" the static position has been already se t in prepareChildForPositionedLayout(). | 1556 // If column/row start is "auto" the static position has been already se t in prepareChildForPositionedLayout(). |
| 1544 PaintLayer* childLayer = child.layer(); | 1557 PaintLayer* childLayer = child.layer(); |
| 1545 if (isForColumns) | 1558 if (isForColumns) |
| 1546 childLayer->setStaticInlinePosition(borderStart() + offset); | 1559 childLayer->setStaticInlinePosition(borderStart() + offset); |
| 1547 else | 1560 else |
| 1548 childLayer->setStaticBlockPosition(borderBefore() + offset); | 1561 childLayer->setStaticBlockPosition(borderBefore() + offset); |
| 1549 } | 1562 } |
| 1550 } | 1563 } |
| 1551 | 1564 |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2037 | 2050 |
| 2038 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child, sizingData )); | 2051 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child, sizingData )); |
| 2039 } | 2052 } |
| 2040 | 2053 |
| 2041 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const | 2054 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const |
| 2042 { | 2055 { |
| 2043 GridPainter(*this).paintChildren(paintInfo, paintOffset); | 2056 GridPainter(*this).paintChildren(paintInfo, paintOffset); |
| 2044 } | 2057 } |
| 2045 | 2058 |
| 2046 } // namespace blink | 2059 } // namespace blink |
| OLD | NEW |