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

Unified 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 side-by-side diff with in-line comments
Download patch
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..5adff817e7ce80649c206c740e89e696dbf97beb 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
@@ -1283,8 +1283,9 @@ LayoutRect LayoutTableSection::logicalRectForWritingModeAndDirection(const Layou
if (!style()->isHorizontalWritingMode())
tableAlignedRect = tableAlignedRect.transposedRect();
+
const Vector<int>& columnPos = table()->effectiveColumnPositions();
- // FIXME: The table's direction should determine our row's direction, not the section's (see bug 96691).
+ // FIXME: The table's direction should determine our row's direction, not the section's (see https://bugs.webkit.org/show_bug.cgi?id=96691).
if (!style()->isLeftToRightDirection())
tableAlignedRect.setX(columnPos[columnPos.size() - 1] - tableAlignedRect.maxX());
@@ -1647,4 +1648,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
+{
+ 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
« 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