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

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

Issue 1781463002: Fix table background painting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sample code for improved collapsed border painting Created 3 years, 11 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 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 1276
1277 LayoutRect LayoutTableSection::logicalRectForWritingModeAndDirection(const Layou tRect& rect) const 1277 LayoutRect LayoutTableSection::logicalRectForWritingModeAndDirection(const Layou tRect& rect) const
1278 { 1278 {
1279 LayoutRect tableAlignedRect(rect); 1279 LayoutRect tableAlignedRect(rect);
1280 1280
1281 flipForWritingMode(tableAlignedRect); 1281 flipForWritingMode(tableAlignedRect);
1282 1282
1283 if (!style()->isHorizontalWritingMode()) 1283 if (!style()->isHorizontalWritingMode())
1284 tableAlignedRect = tableAlignedRect.transposedRect(); 1284 tableAlignedRect = tableAlignedRect.transposedRect();
1285 1285
1286
1286 const Vector<int>& columnPos = table()->effectiveColumnPositions(); 1287 const Vector<int>& columnPos = table()->effectiveColumnPositions();
1287 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). 1288 // FIXME: The table's direction should determine our row's direction, not th e section's (see https://bugs.webkit.org/show_bug.cgi?id=96691).
1288 if (!style()->isLeftToRightDirection()) 1289 if (!style()->isLeftToRightDirection())
1289 tableAlignedRect.setX(columnPos[columnPos.size() - 1] - tableAlignedRect .maxX()); 1290 tableAlignedRect.setX(columnPos[columnPos.size() - 1] - tableAlignedRect .maxX());
1290 1291
1291 return tableAlignedRect; 1292 return tableAlignedRect;
1292 } 1293 }
1293 1294
1294 CellSpan LayoutTableSection::dirtiedRows(const LayoutRect& damageRect) const 1295 CellSpan LayoutTableSection::dirtiedRows(const LayoutRect& damageRect) const
1295 { 1296 {
1296 if (m_forceSlowPaintPathWithOverflowingCell) 1297 if (m_forceSlowPaintPathWithOverflowingCell)
1297 return fullTableRowSpan(); 1298 return fullTableRowSpan();
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 1641
1641 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). 1642 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691).
1642 if (!style()->isLeftToRightDirection()) 1643 if (!style()->isLeftToRightDirection())
1643 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing)); 1644 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing));
1644 else 1645 else
1645 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing)); 1646 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing));
1646 1647
1647 cell->setLogicalLocation(cellLocation); 1648 cell->setLogicalLocation(cellLocation);
1648 } 1649 }
1649 1650
1651 LayoutRect LayoutTableSection::getCellPosition(unsigned row, unsigned effectiveC olumn) const
1652 {
1653 LayoutTable * table = this->table();
1654
1655 LayoutUnit left = LayoutUnit(table->effectiveColumnPositions()[effectiveColu mn]);
1656 LayoutUnit top = LayoutUnit(m_rowPos[row]);
1657 LayoutUnit right = LayoutUnit(table->effectiveColumnPositions()[effectiveCol umn+1]);
1658 LayoutUnit bottom = LayoutUnit(m_rowPos[row+1]);
1659 left += LayoutUnit(table->hBorderSpacing());
1660
1661 return LayoutRect(left, top, right - left, bottom - top);
1662 }
1663
1664 LayoutRect LayoutTableSection::getCellPhysicalPosition(unsigned row, unsigned ef fectiveColumn) const
1665 {
1666 return transformLogicalToPhysicalPosition(getCellPosition(row, effectiveColu mn));
1667 }
1668
1669 LayoutRect LayoutTableSection::transformLogicalToPhysicalPosition(const LayoutRe ct& position) const
1670 {
1671 WritingMode writingMode = style()->getWritingMode();
1672 bool isLTR = style()->isLeftToRightDirection();
1673
1674 LayoutRect transformedPosition = position;
1675 if (blink::isHorizontalWritingMode(writingMode)) {
1676 if (!isLTR)
1677 transformedPosition.setX(size().width() - transformedPosition.maxX() );
1678 } else {
1679 transformedPosition = transformedPosition.transposedRect();
1680 if (!isLTR)
1681 transformedPosition.setY(size().height() - transformedPosition.maxY( ));
1682 if (blink::isFlippedBlocksWritingMode(writingMode))
1683 transformedPosition.setX(size().width() - transformedPosition.maxX() );
1684 }
1685 return transformedPosition;
1686 }
1687
1688 LayoutRect LayoutTableSection::positionByCellSpan() const
1689 {
1690 LayoutRect position;
1691 LayoutTableRow* firstRow = this->firstRow();
1692 LayoutTableRow* lastRow = this->lastRow();
1693 if (firstRow && lastRow) {
1694 position = firstRow->positionByCellSpan();
1695 position.unite(lastRow->positionByCellSpan());
1696 }
1697 return position;
1698 }
1699
1650 } // namespace blink 1700 } // 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