Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTableSection.cpp

Issue 1819073004: Fix table cell background painting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cr fixes, remove tiling algorithm Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 mapLogicalToPhysicalPosition(getCellPosition(row, effectiveColumn));
1666 }
1667
1668 LayoutRect LayoutTableSection::mapLogicalToPhysicalPosition(const LayoutRect& po sition) const
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::positionForBackgroundDrawing() const
1688 {
1689 LayoutRect position;
1690 LayoutTableRow* firstRow = this->firstRow();
1691 LayoutTableRow* lastRow = this->lastRow();
1692 if (firstRow && lastRow) {
1693 position = firstRow->positionForBackgroundDrawing();
1694 position.unite(lastRow->positionForBackgroundDrawing());
1695 }
1696 return position;
1697 }
1698
1650 } // namespace blink 1699 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTableSection.h ('k') | third_party/WebKit/Source/core/paint/TableCellPainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698