Bug 478811. Use the right IsTableRelated check when finding absolute containing blocks. r=bernd, sr=roc
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 17 Feb 2009 12:21:44 -0500
changeset 25069 37405bb5ffd36709f7737540221e18edb11026c2
parent 25068 b9f08098511fd7a5691ed533dd398c5f7963133e
child 25070 df1c424265abde6b78967c43a20f335cc3b17785
push idunknown
push userunknown
push dateunknown
reviewersbernd, roc
bugs478811
milestone1.9.2a1pre
Bug 478811. Use the right IsTableRelated check when finding absolute containing blocks. r=bernd, sr=roc
layout/base/nsCSSFrameConstructor.cpp
layout/reftests/bugs/478811-1-ref.html
layout/reftests/bugs/478811-1.html
layout/reftests/bugs/478811-2-ref.html
layout/reftests/bugs/478811-2.html
layout/reftests/bugs/478811-3-ref.html
layout/reftests/bugs/478811-3.html
layout/reftests/bugs/478811-4-ref.html
layout/reftests/bugs/478811-4.html
layout/reftests/bugs/reftest.list
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -6989,17 +6989,17 @@ nsCSSFrameConstructor::GetAbsoluteContai
     }
     
     // Is it positioned?
     // If it's table-related then ignore it, because for the time
     // being table-related frames are not containers for absolutely
     // positioned child frames.
     const nsStyleDisplay* disp = frame->GetStyleDisplay();
 
-    if (disp->IsPositioned() && !IsTableRelated(disp->mDisplay)) {
+    if (disp->IsPositioned() && !IsTableRelated(frame->GetType(), PR_TRUE)) {
       // Find the outermost wrapped block under this frame
       for (nsIFrame* wrappedFrame = aFrame; wrappedFrame != frame->GetParent();
            wrappedFrame = wrappedFrame->GetParent()) {
         nsIAtom* frameType = wrappedFrame->GetType();
         if (nsGkAtoms::blockFrame == frameType ||
 #ifdef MOZ_XUL
             nsGkAtoms::XULLabelFrame == frameType ||
 #endif
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/478811-1-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html style="height: 100%">
+  <body style="height: 100%">
+    <fieldset style="position: relative; display: table; width: 50%;
+                     height: 50%; top: 25%; left: 25%">
+      <div style="position: absolute; left: 0; right: 0; top: 0; bottom: 0;
+                  background: green"></div>
+    </fieldset>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/478811-1.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html style="height: 100%">
+  <head>
+    <script>
+      function doIt() {
+        var d = document.createElement("div");
+        d.setAttribute("style",
+                       "position: absolute; left: 0; right: 0; top: 0; " +
+                       "bottom: 0; background: green");
+        document.getElementById("x").appendChild(d);
+      }
+    </script>
+  </head>
+  <body style="height: 100%" onload="doIt()">
+    <fieldset id="x" style="position: relative; display: table; width: 50%;
+                            height: 50%; top: 25%; left: 25%">
+    </fieldset>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/478811-2-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html style="height: 100%">
+  <body style="height: 100%">
+    <button style="position: relative; display: table; width: 50%;
+                     height: 50%; top: 25%; left: 25%">
+      <div style="position: absolute; left: 0; right: 0; top: 0; bottom: 0;
+                  background: green"></div>
+    </button>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/478811-2.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html style="height: 100%">
+  <head>
+    <script>
+      function doIt() {
+        var d = document.createElement("div");
+        d.setAttribute("style",
+                       "position: absolute; left: 0; right: 0; top: 0; " +
+                       "bottom: 0; background: green");
+        document.getElementById("x").appendChild(d);
+      }
+    </script>
+  </head>
+  <body style="height: 100%" onload="doIt()">
+    <button id="x" style="position: relative; display: table; width: 50%;
+                          height: 50%; top: 25%; left: 25%">
+    </button>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/478811-3-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html style="height: 100%">
+  <body style="height: 100%">
+    <button style="position: relative; display: table-cell; width: 50%;
+                     height: 50%; top: 25%; left: 25%">
+      <div style="position: absolute; left: 0; right: 0; top: 0; bottom: 0;
+                  background: green"></div>
+    </button>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/478811-3.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html style="height: 100%">
+  <head>
+    <script>
+      function doIt() {
+        var d = document.createElement("div");
+        d.setAttribute("style",
+                       "position: absolute; left: 0; right: 0; top: 0; " +
+                       "bottom: 0; background: green");
+        document.getElementById("x").appendChild(d);
+      }
+    </script>
+  </head>
+  <body style="height: 100%" onload="doIt()">
+    <button id="x" style="position: relative; display: table-cell; width: 50%;
+                          height: 50%; top: 25%; left: 25%">
+    </button>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/478811-4-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html style="height: 100%">
+  <body style="height: 100%">
+    <button style="position: relative; display: table-row; width: 50%;
+                     height: 50%; top: 25%; left: 25%">
+      <div style="position: absolute; left: 0; right: 0; top: 0; bottom: 0;
+                  background: green"></div>
+    </button>
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/478811-4.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html style="height: 100%">
+  <head>
+    <script>
+      function doIt() {
+        var d = document.createElement("div");
+        d.setAttribute("style",
+                       "position: absolute; left: 0; right: 0; top: 0; " +
+                       "bottom: 0; background: green");
+        document.getElementById("x").appendChild(d);
+      }
+    </script>
+  </head>
+  <body style="height: 100%" onload="doIt()">
+    <button id="x" style="position: relative; display: table-row; width: 50%;
+                          height: 50%; top: 25%; left: 25%">
+    </button>
+  </body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1080,8 +1080,12 @@ fails == 461512-1.html 461512-1-ref.html
 == 476063-4.xhtml 476063-4-ref.xhtml
 == 476357-1.html 476357-1-ref.html
 == 476598-1a.html 476598-1-ref.html
 == 476598-1a.html 476598-1-ref2.html
 == 476598-1b.html 476598-1-ref.html
 == 476598-1b.html 476598-1-ref2.html
 != 476598-1-ref.html about:blank
 == 478377-1.xul 478377-1-ref.xul
+== 478811-1.html 478811-1-ref.html
+== 478811-2.html 478811-2-ref.html
+== 478811-3.html 478811-3-ref.html
+== 478811-4.html 478811-4-ref.html