Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) | 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) |
| 3 * (C) 1997 Torben Weis (weis@kde.org) | 3 * (C) 1997 Torben Weis (weis@kde.org) |
| 4 * (C) 1998 Waldo Bastian (bastian@kde.org) | 4 * (C) 1998 Waldo Bastian (bastian@kde.org) |
| 5 * (C) 1999 Lars Knoll (knoll@kde.org) | 5 * (C) 1999 Lars Knoll (knoll@kde.org) |
| 6 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 6 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 Apple Inc. All r ights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 Apple Inc. All r ights reserved. |
| 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1640 | 1640 |
| 1641 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). | 1641 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). |
| 1642 if (!style()->isLeftToRightDirection()) | 1642 if (!style()->isLeftToRightDirection()) |
| 1643 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing)); | 1643 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing)); |
| 1644 else | 1644 else |
| 1645 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing)); | 1645 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing)); |
| 1646 | 1646 |
| 1647 cell->setLogicalLocation(cellLocation); | 1647 cell->setLogicalLocation(cellLocation); |
| 1648 } | 1648 } |
| 1649 | 1649 |
| 1650 LayoutRect LayoutTableSection::getCellPosition(unsigned row, unsigned effectiveC olumn) const | |
| 1651 { | |
| 1652 LayoutTable * table = this->table(); | |
| 1653 | |
| 1654 LayoutUnit left = LayoutUnit(table->effectiveColumnPositions()[effectiveColu mn]); | |
| 1655 LayoutUnit top = LayoutUnit(m_rowPos[row]); | |
| 1656 LayoutUnit right = LayoutUnit(table->effectiveColumnPositions()[effectiveCol umn+1]); | |
| 1657 LayoutUnit bottom = LayoutUnit(m_rowPos[row+1]); | |
| 1658 left += LayoutUnit(table->hBorderSpacing()); | |
| 1659 | |
| 1660 return LayoutRect(left, top, right - left, bottom - top); | |
| 1661 } | |
| 1662 | |
| 1663 LayoutRect LayoutTableSection::getCellPhysicalPosition(unsigned row, unsigned ef fectiveColumn) const | |
| 1664 { | |
| 1665 return transformLogicalToPhysicalPosition(getCellPosition(row, effectiveColu mn)); | |
| 1666 } | |
| 1667 | |
| 1668 LayoutRect LayoutTableSection::transformLogicalToPhysicalPosition(const LayoutRe ct& 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
| |
| 1669 { | |
| 1670 WritingMode writingMode = style()->getWritingMode(); | |
| 1671 bool isLTR = style()->isLeftToRightDirection(); | |
| 1672 | |
| 1673 LayoutRect transformedPosition = position; | |
| 1674 if (blink::isHorizontalWritingMode(writingMode)) { | |
| 1675 if (!isLTR) | |
| 1676 transformedPosition.setX(size().width() - transformedPosition.maxX() ); | |
| 1677 } else { | |
| 1678 transformedPosition = transformedPosition.transposedRect(); | |
| 1679 if (!isLTR) | |
| 1680 transformedPosition.setY(size().height() - transformedPosition.maxY( )); | |
| 1681 if (blink::isFlippedBlocksWritingMode(writingMode)) | |
| 1682 transformedPosition.setX(size().width() - transformedPosition.maxX() ); | |
| 1683 } | |
| 1684 return transformedPosition; | |
| 1685 } | |
| 1686 | |
| 1687 LayoutRect LayoutTableSection::positionByCellSpan() const | |
| 1688 { | |
| 1689 LayoutRect position; | |
| 1690 LayoutTableRow* firstRow = this->firstRow(); | |
| 1691 LayoutTableRow* lastRow = this->lastRow(); | |
| 1692 if (firstRow && lastRow) { | |
| 1693 position = firstRow->positionByCellSpan(); | |
| 1694 position.unite(lastRow->positionByCellSpan()); | |
| 1695 } | |
| 1696 return position; | |
| 1697 } | |
| 1698 | |
| 1650 } // namespace blink | 1699 } // namespace blink |
| OLD | NEW |