Bug 684574 - InternalInvalidateThebesLayersInSubtree should recurse on the subdocument root frame. r=roc
authorMats Palmgren <matspal@gmail.com>
Tue, 06 Sep 2011 14:56:45 +0200
changeset 77909 29a2fbfd83699eaf6ed1afc4752cfbd8abe2b6e6
parent 77908 458686d886a5d522f32f71f46dbdb2fb3fc99edc
child 77910 47e7f8b690a5077cc91661590bd678ab4eb189a3
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs684574
milestone9.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 684574 - InternalInvalidateThebesLayersInSubtree should recurse on the subdocument root frame. r=roc
layout/base/FrameLayerBuilder.cpp
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -1898,36 +1898,39 @@ InternalInvalidateThebesLayersInSubtree(
   PRBool foundContainerLayer = PR_FALSE;
   if (aFrame->GetStateBits() & NS_FRAME_HAS_CONTAINER_LAYER) {
     // Delete the invalid region to indicate that all Thebes contents
     // need to be invalidated
     aFrame->Properties().Delete(ThebesLayerInvalidRegionProperty());
     foundContainerLayer = PR_TRUE;
   }
 
-  nsIFrame* frame = aFrame;
-  while (frame) {
-    nsIFrame::ChildListIterator lists(frame);
-    for (; !lists.IsDone(); lists.Next()) {
-      nsFrameList::Enumerator childFrames(lists.CurrentList());
-      for (; !childFrames.AtEnd(); childFrames.Next()) {
-        if (InternalInvalidateThebesLayersInSubtree(childFrames.get())) {
-          foundContainerLayer = PR_TRUE;
-        }
+  nsAutoTArray<nsIFrame::ChildList,4> childListArray;
+  if (!aFrame->GetFirstPrincipalChild()) {
+    nsSubDocumentFrame* subdocumentFrame = do_QueryFrame(aFrame);
+    if (subdocumentFrame) {
+      // Descend into the subdocument
+      nsIFrame* root = subdocumentFrame->GetSubdocumentRootFrame();
+      if (root) {
+        childListArray.AppendElement(nsIFrame::ChildList(
+          nsFrameList(root, nsLayoutUtils::GetLastSibling(root)),
+          nsIFrame::kPrincipalList));
       }
     }
-    if (frame == aFrame && !frame->GetFirstPrincipalChild()) {
-      nsSubDocumentFrame* subdocumentFrame = do_QueryFrame(frame);
-      if (subdocumentFrame) {
-        // Descend into the subdocument
-        frame = subdocumentFrame->GetSubdocumentRootFrame();
-        continue;
+  }
+
+  aFrame->GetChildLists(&childListArray);
+  nsIFrame::ChildListArrayIterator lists(childListArray);
+  for (; !lists.IsDone(); lists.Next()) {
+    nsFrameList::Enumerator childFrames(lists.CurrentList());
+    for (; !childFrames.AtEnd(); childFrames.Next()) {
+      if (InternalInvalidateThebesLayersInSubtree(childFrames.get())) {
+        foundContainerLayer = PR_TRUE;
       }
     }
-    break;
   }
 
   if (!foundContainerLayer) {
     aFrame->RemoveStateBits(NS_FRAME_HAS_CONTAINER_LAYER_DESCENDANT);
   }
   return foundContainerLayer;
 }