Bug 1464928 - Invalidate border-collapse tables when we remove the border from a cell. r=mstange, a=RyanVM
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 07 Jun 2018 20:31:38 +1200
changeset 449539 45689b759100952aa0f9dfbb0bbda44aa581c174
parent 449538 5b7e2a2b06e1a3ecc50bc566eb733cba085e8357
child 449540 46efbe00b7c03cd9b5df62a74c524983cb60f145
push id91
push userryanvm@gmail.com
push dateMon, 18 Jun 2018 14:13:53 +0000
treeherdermozilla-esr60@7bd079502f7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange, RyanVM
bugs1464928
milestone60.0.3
Bug 1464928 - Invalidate border-collapse tables when we remove the border from a cell. r=mstange, a=RyanVM 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)
 {
   nsIFrame::InvalidateFrame(aDisplayItemKey);
-  if (GetTableFrame()->IsBorderCollapse() && StyleBorder()->HasBorder()) {
+  if (GetTableFrame()->IsBorderCollapse()) {
     GetParent()->InvalidateFrameWithRect(GetVisualOverflowRect() + GetPosition(), aDisplayItemKey);
   }
 }
 
 void nsTableCellFrame::InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey)
 {
   nsIFrame::InvalidateFrameWithRect(aRect, aDisplayItemKey);
   // 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)
 {
   nsIFrame::InvalidateFrame(aDisplayItemKey);
-  if (GetTableFrame()->IsBorderCollapse() && StyleBorder()->HasBorder()) {
+  if (GetTableFrame()->IsBorderCollapse()) {
     GetParent()->InvalidateFrameWithRect(GetVisualOverflowRect() + GetPosition(), aDisplayItemKey);
   }
 }
 
 void
 nsTableColFrame::InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey)
 {
   nsIFrame::InvalidateFrameWithRect(aRect, aDisplayItemKey);
--- a/layout/tables/nsTableColGroupFrame.cpp
+++ b/layout/tables/nsTableColGroupFrame.cpp
@@ -466,17 +466,17 @@ NS_NewTableColGroupFrame(nsIPresShell* a
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsTableColGroupFrame)
 
 void
 nsTableColGroupFrame::InvalidateFrame(uint32_t aDisplayItemKey)
 {
   nsIFrame::InvalidateFrame(aDisplayItemKey);
-  if (GetTableFrame()->IsBorderCollapse() && StyleBorder()->HasBorder()) {
+  if (GetTableFrame()->IsBorderCollapse()) {
     GetParent()->InvalidateFrameWithRect(GetVisualOverflowRect() + GetPosition(), aDisplayItemKey);
   }
 }
 
 void
 nsTableColGroupFrame::InvalidateFrameWithRect(const nsRect& aRect,
                                               uint32_t aDisplayItemKey)
 {
--- 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)
 {
   nsIFrame::InvalidateFrame(aDisplayItemKey);
-  if (GetTableFrame()->IsBorderCollapse() && StyleBorder()->HasBorder()) {
+  if (GetTableFrame()->IsBorderCollapse()) {
     GetParent()->InvalidateFrameWithRect(GetVisualOverflowRect() + GetPosition(), aDisplayItemKey);
   }
 }
 
 void
 nsTableRowFrame::InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey)
 {
   nsIFrame::InvalidateFrameWithRect(aRect, aDisplayItemKey);
--- 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)
 {
   nsIFrame::InvalidateFrame(aDisplayItemKey);
-  if (GetTableFrame()->IsBorderCollapse() && StyleBorder()->HasBorder()) {
+  if (GetTableFrame()->IsBorderCollapse()) {
     GetParent()->InvalidateFrameWithRect(GetVisualOverflowRect() + GetPosition(), aDisplayItemKey);
   }
 }
 
 void
 nsTableRowGroupFrame::InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey)
 {
   nsIFrame::InvalidateFrameWithRect(aRect, aDisplayItemKey);