Title: [154389] trunk/Source/WebCore
Revision
154389
Author
[email protected]
Date
2013-08-21 09:45:06 -0700 (Wed, 21 Aug 2013)

Log Message

In RenderTableCell::paintCollapsedBorders() check surrounding cells using physical rather than logical direction
https://bugs.webkit.org/show_bug.cgi?id=120074

Reviewed by David Hyatt.

No new tests, covered by existing tests.

The functions cellAbove(), cellBelow() etc. check the logical rather than the physical direction but they're being
used to decide the painting of the physical borders of the cell. As we paint all four sides of every cell, and
the borders of adjoining cells twice over, this has no impact on painting currently but making the check consistent
in its treatment of physical and logical direction will help with webkit.org/b/119759 and make the code less confusing
to the next guy.

* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::cellAtLeft):
(WebCore::RenderTableCell::cellAtRight):
(WebCore::RenderTableCell::cellAtTop):
(WebCore::RenderTableCell::cellAtBottom):
(WebCore::RenderTableCell::paintCollapsedBorders):
* rendering/RenderTableCell.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (154388 => 154389)


--- trunk/Source/WebCore/ChangeLog	2013-08-21 16:32:16 UTC (rev 154388)
+++ trunk/Source/WebCore/ChangeLog	2013-08-21 16:45:06 UTC (rev 154389)
@@ -1,3 +1,26 @@
+2013-08-21  Robert Hogan  <[email protected]>
+
+        In RenderTableCell::paintCollapsedBorders() check surrounding cells using physical rather than logical direction
+        https://bugs.webkit.org/show_bug.cgi?id=120074
+
+        Reviewed by David Hyatt.
+
+        No new tests, covered by existing tests.
+
+        The functions cellAbove(), cellBelow() etc. check the logical rather than the physical direction but they're being
+        used to decide the painting of the physical borders of the cell. As we paint all four sides of every cell, and
+        the borders of adjoining cells twice over, this has no impact on painting currently but making the check consistent
+        in its treatment of physical and logical direction will help with webkit.org/b/119759 and make the code less confusing
+        to the next guy.
+
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::cellAtLeft):
+        (WebCore::RenderTableCell::cellAtRight):
+        (WebCore::RenderTableCell::cellAtTop):
+        (WebCore::RenderTableCell::cellAtBottom):
+        (WebCore::RenderTableCell::paintCollapsedBorders):
+        * rendering/RenderTableCell.h:
+
 2013-08-21  RĂ³bert Sipka  <[email protected]>
 
         <https://webkit.org/b/120109> [curl] only include WebCoreBundleWin on Windows

Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (154388 => 154389)


--- trunk/Source/WebCore/rendering/RenderTableCell.cpp	2013-08-21 16:32:16 UTC (rev 154388)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp	2013-08-21 16:45:06 UTC (rev 154389)
@@ -895,6 +895,34 @@
     return styleForCellFlow->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSEnd) : section()->cachedCollapsedBorder(this, CBSStart);
 }
 
+inline RenderTableCell* RenderTableCell::cellAtLeft(const RenderStyle* styleForCellFlow) const
+{
+    if (styleForCellFlow->isHorizontalWritingMode())
+        return styleForCellFlow->isLeftToRightDirection() ? table()->cellBefore(this) : table()->cellAfter(this);
+    return styleForCellFlow->isFlippedBlocksWritingMode() ? table()->cellBelow(this) : table()->cellAbove(this);
+}
+
+inline RenderTableCell* RenderTableCell::cellAtRight(const RenderStyle* styleForCellFlow) const
+{
+    if (styleForCellFlow->isHorizontalWritingMode())
+        return styleForCellFlow->isLeftToRightDirection() ? table()->cellAfter(this) : table()->cellBefore(this);
+    return styleForCellFlow->isFlippedBlocksWritingMode() ? table()->cellAbove(this) : table()->cellBelow(this);
+}
+
+inline RenderTableCell* RenderTableCell::cellAtTop(const RenderStyle* styleForCellFlow) const
+{
+    if (styleForCellFlow->isHorizontalWritingMode())
+        return styleForCellFlow->isFlippedBlocksWritingMode() ? table()->cellBelow(this) : table()->cellAbove(this);
+    return styleForCellFlow->isLeftToRightDirection() ? table()->cellBefore(this) : table()->cellAfter(this);
+}
+
+inline RenderTableCell* RenderTableCell::cellAtBottom(const RenderStyle* styleForCellFlow) const
+{
+    if (styleForCellFlow->isHorizontalWritingMode())
+        return styleForCellFlow->isFlippedBlocksWritingMode() ? table()->cellAbove(this) : table()->cellBelow(this);
+    return styleForCellFlow->isLeftToRightDirection() ? table()->cellAfter(this) : table()->cellBefore(this);
+}
+
 int RenderTableCell::borderLeft() const
 {
     return table()->collapseBorders() ? borderHalfLeft(false) : RenderBlock::borderLeft();
@@ -1172,19 +1200,19 @@
     bool shouldDrawLeftBorder = true;
     bool shouldDrawRightBorder = true;
 
-    if (RenderTableCell* top = table()->cellAbove(this)) {
+    if (RenderTableCell* top = cellAtTop(styleForCellFlow)) {
         shouldDrawTopBorder = top->alignLeftRightBorderPaintRect(leftXOffsetTop, rightXOffsetTop);
         if (this->colSpan() > 1)
             shouldDrawTopBorder = false;
     }
 
-    if (RenderTableCell* bottom = table()->cellBelow(this))
+    if (RenderTableCell* bottom = cellAtBottom(styleForCellFlow))
         bottom->alignLeftRightBorderPaintRect(leftXOffsetBottom, rightXOffsetBottom);
 
-    if (RenderTableCell* left = table()->cellBefore(this))
+    if (RenderTableCell* left = cellAtLeft(styleForCellFlow))
         shouldDrawLeftBorder = left->alignTopBottomBorderPaintRect(topYOffsetLeft, bottomYOffsetLeft);
 
-    if (RenderTableCell* right = table()->cellAfter(this))
+    if (RenderTableCell* right = cellAtRight(styleForCellFlow))
         shouldDrawRightBorder = right->alignTopBottomBorderPaintRect(topYOffsetRight, bottomYOffsetRight);
 
     IntRect cellRect = pixelSnappedIntRect(paintRect.x(), paintRect.y(), paintRect.width(), paintRect.height());

Modified: trunk/Source/WebCore/rendering/RenderTableCell.h (154388 => 154389)


--- trunk/Source/WebCore/rendering/RenderTableCell.h	2013-08-21 16:32:16 UTC (rev 154388)
+++ trunk/Source/WebCore/rendering/RenderTableCell.h	2013-08-21 16:45:06 UTC (rev 154389)
@@ -266,6 +266,11 @@
     CollapsedBorderValue computeCollapsedBeforeBorder(IncludeBorderColorOrNot = IncludeBorderColor) const;
     CollapsedBorderValue computeCollapsedAfterBorder(IncludeBorderColorOrNot = IncludeBorderColor) const;
 
+    RenderTableCell* cellAtLeft(const RenderStyle*) const;
+    RenderTableCell* cellAtRight(const RenderStyle*) const;
+    RenderTableCell* cellAtTop(const RenderStyle*) const;
+    RenderTableCell* cellAtBottom(const RenderStyle*) const;
+
     Length logicalWidthFromColumns(RenderTableCol* firstColForThisCell, Length widthFromStyle) const;
 
     void updateColAndRowSpanFlags();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to