Bug 1464928 - Invalidate border-collapse tables when we remove the border from a cell. r?mstange draft
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 07 Jun 2018 20:31:38 +1200
changeset 805121 198c4983fbeb29b64bf71a4994f997307f8a40d9
parent 804391 0e205f1269a8f14c1319ddc37af885e9266b03fc
push id112569
push usermwoodrow@mozilla.com
push dateThu, 07 Jun 2018 08:32:15 +0000
reviewersmstange
bugs1464928
milestone62.0a1
Bug 1464928 - Invalidate border-collapse tables when we remove the border from a cell. r?mstange MozReview-Commit-ID: 4LWdFJkr72v
layout/reftests/invalidation/reftest.list
layout/reftests/invalidation/table-repaint-e-ref.html
layout/reftests/invalidation/table-repaint-e.html
layout/tables/nsTableCellFrame.cpp
layout/tables/nsTableColFrame.cpp
layout/tables/nsTableColGroupFrame.cpp
layout/tables/nsTableRowFrame.cpp
layout/tables/nsTableRowGroupFrame.cpp
--- a/layout/reftests/invalidation/reftest.list
+++ b/layout/reftests/invalidation/reftest.list
@@ -1,13 +1,14 @@
 == table-repaint-a.html table-repaint-a-ref.html
 == table-repaint-b.html table-repaint-b-ref.html
 == table-repaint-border-collapse.html table-repaint-border-collapse-ref.html
 == table-repaint-c.html table-repaint-c-ref.html
 == table-repaint-d.html table-repaint-d-ref.html
+== table-repaint-e.html table-repaint-e-ref.html
 == table-repaint-non-border-collapse.html table-repaint-non-border-collapse-ref.html
 == 540247-1.xul 540247-1-ref.xul
 == 543681-1.html 543681-1-ref.html
 == 1243409-1.html 1243409-1-ref.html
 skip == test-image-layers.html test-image-layers-ref.html # Bug 1067360
 skip == test-image-layers-multiple-displayitem.html test-image-layers-ref.html # Bug 1067360
 pref(layout.animated-image-layers.enabled,true) skip-if(Android||gtkWidget) == test-animated-image-layers.html test-animated-image-layers-ref.html
 pref(layout.animated-image-layers.enabled,true) skip-if(Android||gtkWidget) == test-animated-image-layers-background.html test-animated-image-layers-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/invalidation/table-repaint-e-ref.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>table-repaint-e</title>
+<style>
+table {
+  border-collapse: collapse;
+}
+tr {
+  border: 1px solid transparent;
+}
+</style>
+</head>
+<body>
+<table
+  <tr>
+    <td>
+      <div>one</div>
+    </td>
+    <td>
+      <div>two</div>
+    </td>
+  </tr
+  <tr>
+    <td>
+      <div>three</div>
+    </td>
+    <td>
+      <div>four</div>
+    </td>
+  </tr>
+</table>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/invalidation/table-repaint-e.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+<title>table-repaint-e</title>
+<style>
+table {
+  border-collapse: collapse;
+}
+tr {
+  border: 1px solid transparent;
+}
+</style>
+</head>
+<body>
+<table
+  <tr>
+    <td>
+      <div>one</div>
+    </td>
+    <td id="x" style="border: 1px solid black">
+      <div>two</div>
+    </td>
+  </tr
+  <tr>
+    <td>
+      <div>three</div>
+    </td>
+    <td>
+      <div>four</div>
+    </td>
+  </tr>
+</table>
+<script>
+  function doTest() {
+    var t = document.getElementById("x");
+    t.style.border = "initial";
+    document.documentElement.removeAttribute("class");
+  }
+document.addEventListener("MozReftestInvalidate", doTest);
+</script>
+</body>
+</html>
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -436,17 +436,17 @@ nsDisplayTableCellBackground::GetBounds(
   // revert from nsDisplayTableItem's implementation ... cell backgrounds
   // don't overflow the cell
   return nsDisplayItem::GetBounds(aBuilder, aSnap);
 }
 
 void nsTableCellFrame::InvalidateFrame(uint32_t aDisplayItemKey, bool aRebuildDisplayItems)
 {
   nsIFrame::InvalidateFrame(aDisplayItemKey, aRebuildDisplayItems);
-  if (GetTableFrame()->IsBorderCollapse() && StyleBorder()->HasBorder()) {
+  if (GetTableFrame()->IsBorderCollapse()) {
     GetParent()->InvalidateFrameWithRect(GetVisualOverflowRect() + GetPosition(), aDisplayItemKey, false);
   }
 }
 
 void nsTableCellFrame::InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey, bool aRebuildDisplayItems)
 {
   nsIFrame::InvalidateFrameWithRect(aRect, aDisplayItemKey, aRebuildDisplayItems);
   // If we have filters applied that would affects our bounds, then
--- a/layout/tables/nsTableColFrame.cpp
+++ b/layout/tables/nsTableColFrame.cpp
@@ -207,17 +207,17 @@ nsTableColFrame::GetSplittableType() con
 {
   return NS_FRAME_NOT_SPLITTABLE;
 }
 
 void
 nsTableColFrame::InvalidateFrame(uint32_t aDisplayItemKey, bool aRebuildDisplayItems)
 {
   nsIFrame::InvalidateFrame(aDisplayItemKey, aRebuildDisplayItems);
-  if (GetTableFrame()->IsBorderCollapse() && StyleBorder()->HasBorder()) {
+  if (GetTableFrame()->IsBorderCollapse()) {
     GetParent()->InvalidateFrameWithRect(GetVisualOverflowRect() + GetPosition(), aDisplayItemKey, false);
   }
 }
 
 void
 nsTableColFrame::InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey, bool aRebuildDisplayItems)
 {
   nsIFrame::InvalidateFrameWithRect(aRect, aDisplayItemKey, aRebuildDisplayItems);
--- a/layout/tables/nsTableColGroupFrame.cpp
+++ b/layout/tables/nsTableColGroupFrame.cpp
@@ -447,17 +447,17 @@ NS_NewTableColGroupFrame(nsIPresShell* a
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsTableColGroupFrame)
 
 void
 nsTableColGroupFrame::InvalidateFrame(uint32_t aDisplayItemKey, bool aRebuildDisplayItems)
 {
   nsIFrame::InvalidateFrame(aDisplayItemKey, aRebuildDisplayItems);
-  if (GetTableFrame()->IsBorderCollapse() && StyleBorder()->HasBorder()) {
+  if (GetTableFrame()->IsBorderCollapse()) {
     GetParent()->InvalidateFrameWithRect(GetVisualOverflowRect() + GetPosition(), aDisplayItemKey, false);
   }
 }
 
 void
 nsTableColGroupFrame::InvalidateFrameWithRect(const nsRect& aRect,
                                               uint32_t aDisplayItemKey,
                                               bool aRebuildDisplayItems)
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -1439,17 +1439,17 @@ void nsTableRowFrame::InitHasCellWithSty
   }
   RemoveStateBits(NS_ROW_HAS_CELL_WITH_STYLE_BSIZE);
 }
 
 void
 nsTableRowFrame::InvalidateFrame(uint32_t aDisplayItemKey, bool aRebuildDisplayItems)
 {
   nsIFrame::InvalidateFrame(aDisplayItemKey, aRebuildDisplayItems);
-  if (GetTableFrame()->IsBorderCollapse() && StyleBorder()->HasBorder()) {
+  if (GetTableFrame()->IsBorderCollapse()) {
     GetParent()->InvalidateFrameWithRect(GetVisualOverflowRect() + GetPosition(), aDisplayItemKey, false);
   }
 }
 
 void
 nsTableRowFrame::InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey, bool aRebuildDisplayItems)
 {
   nsIFrame::InvalidateFrameWithRect(aRect, aDisplayItemKey, aRebuildDisplayItems);
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -1987,17 +1987,17 @@ nsTableRowGroupFrame::FrameCursorData::A
   mOverflowBelow = std::max(mOverflowBelow, overflowBelow);
   return mFrames.AppendElement(aFrame) != nullptr;
 }
 
 void
 nsTableRowGroupFrame::InvalidateFrame(uint32_t aDisplayItemKey, bool aRebuildDisplayItems)
 {
   nsIFrame::InvalidateFrame(aDisplayItemKey, aRebuildDisplayItems);
-  if (GetTableFrame()->IsBorderCollapse() && StyleBorder()->HasBorder()) {
+  if (GetTableFrame()->IsBorderCollapse()) {
     GetParent()->InvalidateFrameWithRect(GetVisualOverflowRect() + GetPosition(), aDisplayItemKey, false);
   }
 }
 
 void
 nsTableRowGroupFrame::InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey, bool aRebuildDisplayItems)
 {
   nsIFrame::InvalidateFrameWithRect(aRect, aDisplayItemKey, aRebuildDisplayItems);