Bug 845837: Don't use our dynamic updating for relative positioning on inner table frames, which don't do relative positioning at all. r=ehsan
authorL. David Baron <dbaron@dbaron.org>
Thu, 07 Mar 2013 17:59:32 -0800
changeset 124194 7ebd5b1fa3c36b375d9c81d15039bd59e6f364fe
parent 124193 2aaba07995ed269b6f3cc88e411b0bfec3803b22
child 124195 a114e8c5e9ef8db35134807b2d0bb5b71b58dd9d
push id24412
push userryanvm@gmail.com
push dateSun, 10 Mar 2013 00:01:53 +0000
treeherdermozilla-central@9e6232e86000 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs845837
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 845837: Don't use our dynamic updating for relative positioning on inner table frames, which don't do relative positioning at all. r=ehsan This is somewhat evil, but should get us back into the state we were in before. There are probably other bugs lurking here as well, though, related to other cases where we don't support relative positioning. We really just need to make our relative positioning support more general.
layout/base/nsCSSFrameConstructor.cpp
layout/reftests/abs-pos/reftest.list
layout/reftests/abs-pos/relative-row-animation-1-ref.html
layout/reftests/abs-pos/relative-row-animation-1.html
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -12631,16 +12631,33 @@ nsCSSFrameConstructor::RecomputePosition
   if (display->mPosition == NS_STYLE_POSITION_STATIC) {
     return true;
   }
 
   aFrame->SchedulePaint();
 
   // For relative positioning, we can simply update the frame rect
   if (display->mPosition == NS_STYLE_POSITION_RELATIVE) {
+    switch (display->mDisplay) {
+      case NS_STYLE_DISPLAY_TABLE_CAPTION:
+      case NS_STYLE_DISPLAY_TABLE_CELL:
+      case NS_STYLE_DISPLAY_TABLE_ROW:
+      case NS_STYLE_DISPLAY_TABLE_ROW_GROUP:
+      case NS_STYLE_DISPLAY_TABLE_HEADER_GROUP:
+      case NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP:
+      case NS_STYLE_DISPLAY_TABLE_COLUMN:
+      case NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP:
+        // We don't currently support relative positioning of inner
+        // table elements.  If we apply offsets to things we haven't
+        // previously offset, we'll get confused.  So bail.
+        return true;
+      default:
+        break;
+    }
+
     nsIFrame* cb = aFrame->GetContainingBlock();
     const nsSize size = cb->GetSize();
     const nsPoint oldOffsets = aFrame->GetRelativeOffset();
     nsMargin newOffsets;
 
     // Move the frame
     nsHTMLReflowState::ComputeRelativeOffsets(
         cb->StyleVisibility()->mDirection,
--- a/layout/reftests/abs-pos/reftest.list
+++ b/layout/reftests/abs-pos/reftest.list
@@ -11,8 +11,9 @@ fuzzy-if(/^Windows\x20NT\x206\.1/.test(h
 skip-if(B2G) fuzzy-if(Android,9,39) == scrollframe-2.html scrollframe-2-ref.html #bug 756530
 fuzzy-if(gtk2Widget,1,8) == select-1.html select-1-ref.html
 fuzzy-if(gtk2Widget,1,8) == select-1-dynamic.html select-1-ref.html
 == select-2.html select-2-ref.html
 fuzzy-if(gtk2Widget,1,19) fuzzy-if(Android||B2G,17,726) == select-3.html select-3-ref.html
 == multi-column-1.html multi-column-1-ref.html
 == button-1.html button-1-ref.html
 == button-2.html button-2-ref.html
+== relative-row-animation-1.html relative-row-animation-1-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/abs-pos/relative-row-animation-1-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<title>Testcase, bug 845837</title>
+<meta charset="UTF-8">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=845837
+-->
+
+<div style="height: 20px"></div>
+
+<table border>
+  <tr style="position: relative">
+    <td>hello
+</table>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/abs-pos/relative-row-animation-1.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<title>Testcase, bug 845837</title>
+<meta charset="UTF-8">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=845837
+-->
+
+<div style="height: 20px"></div>
+
+<table border>
+  <tr id="tr" style="position: relative">
+    <td>hello
+</table>
+
+<script>
+var tr = document.getElementById("tr");
+tr.offsetTop;
+tr.style.top = '20px';
+tr.offsetTop;
+tr.style.fontSize = '100px';
+tr.offsetTop;
+tr.style.fontSize = '';
+tr.offsetTop;
+tr.style.top = '0px';
+tr.offsetTop;
+// Just check that we have no relative positioning applied when we're done,
+// since we don't currently support relative positioning on table rows.
+</script>