Bug 782062 - Do not attempt to move frames with views in their subtree without doing a reflow to prevent the view position from getting out of sync; r=roc
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 29 Aug 2012 09:46:09 -0400
changeset 105810 a9858d2ad58bc0e6b1f50c4f8648ba3890bd4b8e
parent 105809 430b14724dca7516a8141486e8a329f682cbd5b8
child 105811 5420af81b778aa2f97705d738fa16fb66bb0ab32
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersroc
bugs782062
milestone18.0a1
Bug 782062 - Do not attempt to move frames with views in their subtree without doing a reflow to prevent the view position from getting out of sync; r=roc
layout/base/nsCSSFrameConstructor.cpp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -12400,16 +12400,25 @@ nsCSSFrameConstructor::RecomputePosition
 {
   // Don't process position changes on table frames, since we already handle
   // the dynamic position change on the outer table frame, and the reflow-based
   // fallback code path also ignores positions on inner table frames.
   if (aFrame->GetType() == nsGkAtoms::tableFrame) {
     return true;
   }
 
+  // Don't process position changes on frames which have views or the ones which
+  // have a view somewhere in their descendants, because the corresponding view
+  // needs to be repositioned properly as well.
+  if (aFrame->HasView() ||
+      (aFrame->GetStateBits() & NS_FRAME_HAS_CHILD_WITH_VIEW)) {
+    StyleChangeReflow(aFrame, nsChangeHint_NeedReflow);
+    return false;
+  }
+
   const nsStyleDisplay* display = aFrame->GetStyleDisplay();
   // Changes to the offsets of a non-positioned element can safely be ignored.
   if (display->mPosition == NS_STYLE_POSITION_STATIC) {
     return true;
   }
 
   // For relative positioning, we can simply update the frame rect
   if (display->mPosition == NS_STYLE_POSITION_RELATIVE) {