Title: [176124] trunk
Revision
176124
Author
[email protected]
Date
2014-11-14 08:53:03 -0800 (Fri, 14 Nov 2014)

Log Message

Table rows repaint entire table when their background color changes.
https://bugs.webkit.org/show_bug.cgi?id=26662

Reviewed by Simon Fraser.

Added fast/repaint/table-row-repaint.html

Source/WebCore:

* rendering/RenderTableCell.h:
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::clippedOverflowRectForRepaint):
Improve table row's function to unite with the cell rects that can possibly
have the the row's background color painted behind them.

LayoutTests:

* fast/repaint/table-row-repaint-expected.txt: Added.
* fast/repaint/table-row-repaint.html: Added.
* platform/mac/accessibility/table-detection-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (176123 => 176124)


--- trunk/LayoutTests/ChangeLog	2014-11-14 16:20:18 UTC (rev 176123)
+++ trunk/LayoutTests/ChangeLog	2014-11-14 16:53:03 UTC (rev 176124)
@@ -1,3 +1,16 @@
+2014-11-11  David Hyatt  <[email protected]>
+
+        Table rows repaint entire table when their background color changes.
+        https://bugs.webkit.org/show_bug.cgi?id=26662
+
+        Reviewed by Simon Fraser.
+
+        Added fast/repaint/table-row-repaint.html
+
+        * fast/repaint/table-row-repaint-expected.txt: Added.
+        * fast/repaint/table-row-repaint.html: Added.
+        * platform/mac/accessibility/table-detection-expected.txt:
+
 2014-11-14  Andrzej Badowski  <[email protected]>
 
         AX: Improve AccessibilityTableCell isColumnHeaderCell function.

Added: trunk/LayoutTests/fast/repaint/table-row-repaint-expected.txt (0 => 176124)


--- trunk/LayoutTests/fast/repaint/table-row-repaint-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/table-row-repaint-expected.txt	2014-11-14 16:53:03 UTC (rev 176124)
@@ -0,0 +1,6 @@
+(repaint rects
+  (rect 8 61 106 15)
+  (rect 8 61 106 15)
+  (rect 8 61 106 15)
+)
+

Added: trunk/LayoutTests/fast/repaint/table-row-repaint.html (0 => 176124)


--- trunk/LayoutTests/fast/repaint/table-row-repaint.html	                        (rev 0)
+++ trunk/LayoutTests/fast/repaint/table-row-repaint.html	2014-11-14 16:53:03 UTC (rev 176124)
@@ -0,0 +1,43 @@
+<html>
+<head>
+    <script src="" type="text/_javascript_"></script>
+    <script type="text/_javascript_">
+        function repaintTest()
+        {
+            var div = document.getElementById("target");
+            div.className = "green";
+        }
+    </script>
+    <style>
+        #target {
+            background-color: red;
+        }
+
+        td {
+            width: 100px;
+            height: 15px;
+        }
+
+        #target.green {
+            background-color:green;
+        }
+    </style>
+</head>
+<body _onload_="runRepaintTest()">
+    <table>
+        <tr><td>
+        <tr><td>
+        <tr><td>
+        
+        <tr id="target">
+            <td>
+            </td>
+        </tr>
+        
+        <tr><td>
+        <tr><td>
+        <tr><td>
+        
+    </table>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/mac/accessibility/table-detection-expected.txt (176123 => 176124)


--- trunk/LayoutTests/platform/mac/accessibility/table-detection-expected.txt	2014-11-14 16:20:18 UTC (rev 176123)
+++ trunk/LayoutTests/platform/mac/accessibility/table-detection-expected.txt	2014-11-14 16:53:03 UTC (rev 176124)
@@ -725,7 +725,7 @@
 AXDOMIdentifier: 
 AXDOMClassList: <array of size 0>
 AXRows: <array of size 24>
-AXVisibleRows: <array of size 24>
+AXVisibleRows: <array of size 13>
 AXColumns: <array of size 1>
 AXVisibleColumns: <array of size 1>
 AXVisibleCells: <array of size 24>

Modified: trunk/Source/WebCore/ChangeLog (176123 => 176124)


--- trunk/Source/WebCore/ChangeLog	2014-11-14 16:20:18 UTC (rev 176123)
+++ trunk/Source/WebCore/ChangeLog	2014-11-14 16:53:03 UTC (rev 176124)
@@ -1,3 +1,18 @@
+2014-11-11  David Hyatt  <[email protected]>
+
+        Table rows repaint entire table when their background color changes.
+        https://bugs.webkit.org/show_bug.cgi?id=26662
+
+        Reviewed by Simon Fraser.
+
+        Added fast/repaint/table-row-repaint.html
+
+        * rendering/RenderTableCell.h:
+        * rendering/RenderTableRow.cpp:
+        (WebCore::RenderTableRow::clippedOverflowRectForRepaint):
+        Improve table row's function to unite with the cell rects that can possibly
+        have the the row's background color painted behind them.
+
 2014-11-14  Zalan Bujtas  <[email protected]>
 
         Simple line layout: Move simple line layout RunResolver and LineResolver implementation to SimpleLineLayoutResolver.cpp

Modified: trunk/Source/WebCore/rendering/RenderTableCell.h (176123 => 176124)


--- trunk/Source/WebCore/rendering/RenderTableCell.h	2014-11-14 16:20:18 UTC (rev 176123)
+++ trunk/Source/WebCore/rendering/RenderTableCell.h	2014-11-14 16:53:03 UTC (rev 176124)
@@ -216,6 +216,9 @@
         return !table()->cellAfter(this) || !table()->cellBefore(this);
     }
 #endif
+    
+    virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const override;
+
 protected:
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
     virtual void computePreferredLogicalWidths() override;
@@ -235,7 +238,6 @@
     virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox*) const override;
 
     virtual LayoutSize offsetFromContainer(RenderElement&, const LayoutPoint&, bool* offsetDependsOnPoint = 0) const override;
-    virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const override;
     virtual void computeRectForRepaint(const RenderLayerModelObject* repaintContainer, LayoutRect&, bool fixed = false) const override;
 
     int borderHalfLeft(bool outer) const;

Modified: trunk/Source/WebCore/rendering/RenderTableRow.cpp (176123 => 176124)


--- trunk/Source/WebCore/rendering/RenderTableRow.cpp	2014-11-14 16:20:18 UTC (rev 176123)
+++ trunk/Source/WebCore/rendering/RenderTableRow.cpp	2014-11-14 16:53:03 UTC (rev 176124)
@@ -195,18 +195,17 @@
 LayoutRect RenderTableRow::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const
 {
     ASSERT(parent());
-
-    if (repaintContainer == this)
-        return RenderBox::clippedOverflowRectForRepaint(repaintContainer);
-
-    // For now, just repaint the whole table.
-    // FIXME: Find a better way to do this, e.g., need to repaint all the cells that we
-    // might have propagated a background color into.
-    // FIXME: do repaintContainer checks here
-    if (RenderTable* parentTable = table())
-        return parentTable->clippedOverflowRectForRepaint(repaintContainer);
-
-    return LayoutRect();
+    
+    // Rows and cells are in the same coordinate space. We need to both compute our overflow rect (which
+    // will accommodate a row outline and any visual effects on the row itself), but we also need to add in
+    // the repaint rects of cells.
+    LayoutRect result = RenderBox::clippedOverflowRectForRepaint(repaintContainer);
+    for (RenderTableCell* cell = firstCell(); cell; cell = cell->nextCell()) {
+        // Even if a cell is a repaint container, it's the row that paints the background behind it.
+        // So we don't care if a cell is a repaintContainer here.
+        result.uniteIfNonZero(cell->clippedOverflowRectForRepaint(repaintContainer));
+    }
+    return result;
 }
 
 // Hit Testing
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to