Bug 524925 - Update the overflow for all the affected frames, not just the primary frame. And the ancestors of those. part=2/6 r=roc
authorMats Palmgren <matspal@gmail.com>
Wed, 18 Jan 2012 21:04:51 +0100
changeset 86033 9d0e181c6aa41d15d5bba8a7ac60ca7a7e7cf8b5
parent 86032 8651133cd19662053356aa499f2b0248b04e5bf0
child 86034 4352ce32058423a4860a62a81f6e6af0a0d959b4
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)
reviewersroc
bugs524925
milestone12.0a1
Bug 524925 - Update the overflow for all the affected frames, not just the primary frame. And the ancestors of those. part=2/6 r=roc
layout/base/nsCSSFrameConstructor.cpp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -8015,37 +8015,45 @@ nsCSSFrameConstructor::ProcessRestyledFr
         didReflow = true;
       }
       if (hint & (nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView |
                   nsChangeHint_UpdateOpacityLayer | nsChangeHint_UpdateTransformLayer)) {
         ApplyRenderingChangeToTree(presContext, frame, hint);
         didInvalidate = true;
       }
       if (hint & nsChangeHint_UpdateOverflow) {
-        nsOverflowAreas overflowAreas;
-        nsOverflowAreas* pre = static_cast<nsOverflowAreas*>
-          (frame->Properties().Get(frame->PreTransformOverflowAreasProperty()));
-        if (pre) {
-          // FinishAndStoreOverflow will change the overflow areas passed in,
-          // so make a copy.
-          overflowAreas = *pre;
-        } else {
-          // There is no transform yet on this frame, so we can just use its
-          // current overflow areas.
-          overflowAreas = frame->GetOverflowAreas();
-        }
-
-        frame->FinishAndStoreOverflow(overflowAreas, frame->GetSize());
-
-        // Ancestors' oveflow areas may be affected.
-        for (nsIFrame* ancestor = frame->GetParent(); ancestor;
-             ancestor = ancestor->GetParent()) {
-          if (!ancestor->UpdateOverflow()) {
-            break;
+        while (frame) {
+          nsOverflowAreas overflowAreas;
+          nsOverflowAreas* pre = static_cast<nsOverflowAreas*>
+            (frame->Properties().Get(frame->PreTransformOverflowAreasProperty()));
+          if (pre) {
+            // FinishAndStoreOverflow will change the overflow areas passed in,
+            // so make a copy.
+            overflowAreas = *pre;
+          } else {
+            // There is no transform yet on this frame, so we can just use its
+            // current overflow areas.
+            overflowAreas = frame->GetOverflowAreas();
           }
+
+          frame->FinishAndStoreOverflow(overflowAreas, frame->GetSize());
+
+          nsIFrame* next =
+            nsLayoutUtils::GetNextContinuationOrSpecialSibling(frame);
+          // Update the ancestors' overflow after we have updated the overflow
+          // for all the continuations with the same parent.
+          if (!next || frame->GetParent() != next->GetParent()) {
+            for (nsIFrame* ancestor = frame->GetParent(); ancestor;
+                 ancestor = ancestor->GetParent()) {
+              if (!ancestor->UpdateOverflow()) {
+                break;
+              }
+            }
+          }
+          frame = next;
         }
       }
       if (hint & nsChangeHint_UpdateCursor) {
         mPresShell->SynthesizeMouseMove(false);
       }
     }
   }