Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/LayoutTableSection.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp |
| index 89b925af6f41a1551f1d609cd14bd23c85fada16..1e8beb106991432e961305428abbddb8d563c33f 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp |
| @@ -1647,4 +1647,53 @@ void LayoutTableSection::setLogicalPositionForCell(LayoutTableCell* cell, unsign |
| cell->setLogicalLocation(cellLocation); |
| } |
| +LayoutRect LayoutTableSection::getCellPosition(unsigned row, unsigned effectiveColumn) const |
| +{ |
| + LayoutTable * table = this->table(); |
| + |
| + LayoutUnit left = LayoutUnit(table->effectiveColumnPositions()[effectiveColumn]); |
| + LayoutUnit top = LayoutUnit(m_rowPos[row]); |
| + LayoutUnit right = LayoutUnit(table->effectiveColumnPositions()[effectiveColumn+1]); |
| + LayoutUnit bottom = LayoutUnit(m_rowPos[row+1]); |
| + left += LayoutUnit(table->hBorderSpacing()); |
| + |
| + return LayoutRect(left, top, right - left, bottom - top); |
| +} |
| + |
| +LayoutRect LayoutTableSection::getCellPhysicalPosition(unsigned row, unsigned effectiveColumn) const |
| +{ |
| + return transformLogicalToPhysicalPosition(getCellPosition(row, effectiveColumn)); |
| +} |
| + |
| +LayoutRect LayoutTableSection::transformLogicalToPhysicalPosition(const LayoutRect& position) const |
|
Xianzhu
2016/03/28 00:44:42
Can you use LayoutBox::flipForWritingMode() in thi
atotic1
2016/03/29 17:05:16
No. The transformation computed here is more compl
|
| +{ |
| + WritingMode writingMode = style()->getWritingMode(); |
| + bool isLTR = style()->isLeftToRightDirection(); |
| + |
| + LayoutRect transformedPosition = position; |
| + if (blink::isHorizontalWritingMode(writingMode)) { |
| + if (!isLTR) |
| + transformedPosition.setX(size().width() - transformedPosition.maxX()); |
| + } else { |
| + transformedPosition = transformedPosition.transposedRect(); |
| + if (!isLTR) |
| + transformedPosition.setY(size().height() - transformedPosition.maxY()); |
| + if (blink::isFlippedBlocksWritingMode(writingMode)) |
| + transformedPosition.setX(size().width() - transformedPosition.maxX()); |
| + } |
| + return transformedPosition; |
| +} |
| + |
| +LayoutRect LayoutTableSection::positionByCellSpan() const |
| +{ |
| + LayoutRect position; |
| + LayoutTableRow* firstRow = this->firstRow(); |
| + LayoutTableRow* lastRow = this->lastRow(); |
| + if (firstRow && lastRow) { |
| + position = firstRow->positionByCellSpan(); |
| + position.unite(lastRow->positionByCellSpan()); |
| + } |
| + return position; |
| +} |
| + |
| } // namespace blink |