Bug 959847. Part 5. Only call RecordFrameMetrics for subdocuments if we are ignoring viewport scrolling so that we don't call it twice for the same scroll frame (the other one being the scroll layers created by nsGfxScrollFrame). r=roc
authorTimothy Nikkel <tnikkel@gmail.com>
Thu, 27 Feb 2014 16:01:53 -0600
changeset 171557 c984b7ac2a845b4734f6e4731473df7c6c6c905a
parent 171556 95590431aebb015eb2f2e6c9e00c7e2a39bdfb16
child 171558 ed8cade5616fb0039c9ca5d31d1d129d576b3496
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersroc
bugs959847
milestone30.0a1
Bug 959847. Part 5. Only call RecordFrameMetrics for subdocuments if we are ignoring viewport scrolling so that we don't call it twice for the same scroll frame (the other one being the scroll layers created by nsGfxScrollFrame). r=roc
layout/generic/nsSubDocumentFrame.cpp
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -459,42 +459,48 @@ nsSubDocumentFrame::BuildDisplayList(nsD
       }
     }
   }
 
   // Generate a resolution and/or zoom item if needed. If one or both of those is
   // created, we don't need to create a separate nsDisplaySubDocument.
 
   uint32_t flags = nsDisplayOwnLayer::GENERATE_SUBDOC_INVALIDATIONS;
-  // We also want to add nsDisplayOwnLayer::GENERATE_SCROLLABLE_LAYER to whatever
-  // layer becomes the topmost. We do this below.
+  // If ignoreViewportScrolling is true then the top most layer we create here
+  // is going to become the scrollable layer for the root scroll frame, so we
+  // want to add nsDisplayOwnLayer::GENERATE_SCROLLABLE_LAYER to whatever layer
+  // becomes the topmost. We do this below.
   if (constructZoomItem) {
+    uint32_t zoomFlags = flags;
+    if (ignoreViewportScrolling && !constructResolutionItem) {
+      zoomFlags |= nsDisplayOwnLayer::GENERATE_SCROLLABLE_LAYER;
+    }
     nsDisplayZoom* zoomItem =
       new (aBuilder) nsDisplayZoom(aBuilder, subdocRootFrame, &childItems,
-                                   subdocAPD, parentAPD,
-                                   flags |
-                                    (constructResolutionItem ?
-                                      0 : nsDisplayOwnLayer::GENERATE_SCROLLABLE_LAYER));
+                                   subdocAPD, parentAPD, zoomFlags);
     childItems.AppendToTop(zoomItem);
     needsOwnLayer = false;
   }
   // Wrap the zoom item in the resolution item if we have both because we want the
   // resolution scale applied on top of the app units per dev pixel conversion.
+  if (ignoreViewportScrolling) {
+    flags |= nsDisplayOwnLayer::GENERATE_SCROLLABLE_LAYER;
+  }
   if (constructResolutionItem) {
     nsDisplayResolution* resolutionItem =
       new (aBuilder) nsDisplayResolution(aBuilder, subdocRootFrame, &childItems,
-        flags | nsDisplayOwnLayer::GENERATE_SCROLLABLE_LAYER);
+                                         flags);
     childItems.AppendToTop(resolutionItem);
     needsOwnLayer = false;
   }
   if (needsOwnLayer) {
     // We always want top level content documents to be in their own layer.
     nsDisplaySubDocument* layerItem = new (aBuilder) nsDisplaySubDocument(
       aBuilder, subdocRootFrame ? subdocRootFrame : this,
-      &childItems, flags | nsDisplayOwnLayer::GENERATE_SCROLLABLE_LAYER);
+      &childItems, flags);
     childItems.AppendToTop(layerItem);
   }
 
   if (subdocRootFrame) {
     aBuilder->LeavePresShell(subdocRootFrame, dirty);
 
     if (ignoreViewportScrolling) {
       aBuilder->SetIgnoreScrollFrame(savedIgnoreScrollFrame);