bug 711359 - mark all subsequent rows as damaged r=mats
authorBernd <bmlk@gmx.de>
Tue, 27 Dec 2011 09:31:09 +0100
changeset 84607 ab799783941933772b8177ee7646a5fa06b7b4e1
parent 84606 c7416f66e61fc92cf41312ac15a3a86e31dc3a2c
child 84608 1f2caed431a0f1d7d8a07e6b55b31305106b5441
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs711359
milestone12.0a1
bug 711359 - mark all subsequent rows as damaged r=mats
layout/reftests/bugs/711359-1-ref.html
layout/reftests/bugs/711359-1.html
layout/reftests/bugs/712849-1-ref.html
layout/reftests/bugs/712849-1.html
layout/reftests/bugs/reftest.list
layout/tables/nsCellMap.cpp
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/711359-1-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<body>
+ <table style="border-collapse: collapse;" border="1">
+  <tbody id="reference">
+   <tr><td>&nbsp;</td></tr>
+   <tr><td>&nbsp;</td></tr>
+   <tr><td>&nbsp;</td></tr>
+  </tbody>
+ </table>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/711359-1.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <script>
+  var lastLang = "";
+  function LangSelect(aLang) {
+    var tbody = document.getElementById("l10ntbody");
+    var child = tbody.firstChild;
+    while (child) {
+      if (child.nodeType == Node.ELEMENT_NODE) {
+        if (aLang == "*" || aLang == child.getAttribute("language"))
+          child.removeAttribute("style");
+        else
+           child.setAttribute("style", "display: none");
+      }
+      child = child.nextSibling;
+    }
+  }
+</script>
+</head>
+
+<body onload="LangSelect('cs');">
+ <table style="border-collapse: collapse;" border="1">
+  <tbody id="l10ntbody">
+   <tr style="display: none;" language="cs"><td>&nbsp;</td></tr>
+   <tr style="display: none;" language="cs"><td>&nbsp;</td></tr>
+   <tr style="display: none;" language="cs"><td>&nbsp;</td></tr>
+  </tbody>
+ </table>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/712849-1-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+   <title>testcase</title>
+<style>
+.tt {
+   border-collapse: collapse;
+}
+.nix {
+   display: none;
+}
+.ref {
+   border: solid 3px darkred;
+}
+
+td {
+   width: 20px;
+   height: 20px;
+}
+
+</style>
+</head>
+<body>
+  <table class="tt">
+    <tr id="1"><td >&nbsp;</td></tr>
+    <tr id="2" class="nix"><td >&nbsp;</td></tr>
+    <tr id="3" class="ref"><td >&nbsp;</td></tr>
+    <tr><td>&nbsp;</td></tr>
+  </table>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/712849-1.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html><head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+   <title>testcase</title>
+<style>
+.tt {
+   border-collapse: collapse;
+}
+.nix {
+   display: none;
+}
+.ref {
+   border: solid 3px darkred;
+}
+
+td {
+   width: 20px;
+   height: 20px;
+}
+
+</style>
+<script>
+
+function test ()
+{
+  document.getElementById ("2").className = "nix";
+  document.getElementById ("3").className = "ref";
+}
+</script>
+</head>
+<body onload="test()">
+  <table class="tt">
+    <tr id="1"><td >&nbsp;</td></tr>
+    <tr id="2"><td >&nbsp;</td></tr>
+    <tr id="3"><td >&nbsp;</td></tr>
+    <tr><td>&nbsp;</td></tr>
+  </table>
+</body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1672,8 +1672,10 @@ fails-if(layersGPUAccelerated&&cocoaWidg
 == 670467-2.html 670467-2-ref.html
 != 691087-1.html 691087-1-ref.html
 == 691571-1.html 691571-1-ref.html
 == 696307-1.html 696307-1-ref.html
 == 696739-1.html 696739-1-ref.html
 needs-focus == 703186-1.html 703186-1-ref.html
 needs-focus == 703186-2.html 703186-2-ref.html
 needs-focus != 703186-1.html 703186-2.html
+== 711359-1.html 711359-1-ref.html
+== 712849-1.html 712849-1-ref.html
--- a/layout/tables/nsCellMap.cpp
+++ b/layout/tables/nsCellMap.cpp
@@ -1855,18 +1855,21 @@ nsCellMap::ExpandWithRows(nsTableCellMap
       if (cellFrame) {
         AppendCell(aMap, cellFrame, rowX, false, aRgFirstRowIndex, aDamageArea,
                    &colIndex);
       }
       cFrame = cFrame->GetNextSibling();
     }
     newRowIndex++;
   }
-  SetDamageArea(0, aRgFirstRowIndex + startRowIndex, aMap.GetColCount(),
-                1 + endRowIndex - startRowIndex, aDamageArea);
+  // mark all following rows damaged, they might contain a previously set
+  // damage area which we can not shift.
+  PRInt32 firstDamagedRow = aRgFirstRowIndex + startRowIndex;
+  SetDamageArea(0, firstDamagedRow, aMap.GetColCount(),
+                aMap.GetRowCount() - firstDamagedRow, aDamageArea);
 }
 
 void nsCellMap::ExpandWithCells(nsTableCellMap&              aMap,
                                 nsTArray<nsTableCellFrame*>& aCellFrames,
                                 PRInt32                      aRowIndex,
                                 PRInt32                      aColIndex,
                                 PRInt32                      aRowSpan, // same for all cells
                                 bool                         aRowSpanIsZero,
@@ -2023,18 +2026,21 @@ void nsCellMap::ShrinkWithoutRows(nsTabl
     }
 
     mRows.RemoveElementAt(rowX);
 
     // Decrement our row and next available index counts.
     mContentRowCount--;
   }
   aMap.RemoveColsAtEnd();
-  SetDamageArea(0, aRgFirstRowIndex + aStartRowIndex, aMap.GetColCount(), 0,
-                aDamageArea);
+  // mark all following rows damaged, they might contain a previously set
+  // damage area which we can not shift.
+  PRInt32 firstDamagedRow = aRgFirstRowIndex + aStartRowIndex;
+  SetDamageArea(0, firstDamagedRow, aMap.GetColCount(),
+                aMap.GetRowCount() - firstDamagedRow, aDamageArea);
 }
 
 PRInt32 nsCellMap::GetColSpanForNewCell(nsTableCellFrame& aCellFrameToAdd,
                                         bool&           aIsZeroColSpan) const
 {
   aIsZeroColSpan = false;
   PRInt32 colSpan = aCellFrameToAdd.GetColSpan();
   if (0 == colSpan) {