Bug 959847. Part 2. Don't ignore "ignore viewport scrolling" on subdocuments. r=roc
authorTimothy Nikkel <tnikkel@gmail.com>
Thu, 27 Feb 2014 16:01:52 -0600
changeset 171554 ffb2d1363821b26766c088adefa48c17a9b0ecdd
parent 171553 a11ecf90de1ab273d77d94ba82fec07aa63a01c7
child 171555 522ba2d5437b8866ce6bbd3582c1eae3cb400404
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersroc
bugs959847
milestone30.0a1
Bug 959847. Part 2. Don't ignore "ignore viewport scrolling" on subdocuments. r=roc This means that the layer we create in nsSubDocumentFrame::BuildDisplayList becomes the scrollable layer for the document and we early early from ScrollFrameHelper::BuildDisplayList before it gets to the nsDisplayScrollLayer creation.
layout/generic/nsSubDocumentFrame.cpp
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -368,30 +368,39 @@ nsSubDocumentFrame::BuildDisplayList(nsD
 
   nsPresContext* presContext = presShell->GetPresContext();
 
   int32_t parentAPD = PresContext()->AppUnitsPerDevPixel();
   int32_t subdocAPD = presContext->AppUnitsPerDevPixel();
 
   nsRect dirty;
   bool haveDisplayPort = false;
+  bool ignoreViewportScrolling = false;
+  nsIFrame* savedIgnoreScrollFrame = nullptr;
   if (subdocRootFrame) {
     nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame();
     nsIContent* content = rootScrollFrame ? rootScrollFrame->GetContent() : nullptr;
     nsRect displayPort;
     if (content && nsLayoutUtils::GetDisplayPort(content, &displayPort)) {
       haveDisplayPort = true;
       dirty = displayPort;
     } else {
       // get the dirty rect relative to the root frame of the subdoc
       dirty = aDirtyRect + GetOffsetToCrossDoc(subdocRootFrame);
       // and convert into the appunits of the subdoc
       dirty = dirty.ConvertAppUnitsRoundOut(parentAPD, subdocAPD);
     }
 
+    ignoreViewportScrolling =
+      rootScrollFrame && presShell->IgnoringViewportScrolling();
+    if (ignoreViewportScrolling) {
+      savedIgnoreScrollFrame = aBuilder->GetIgnoreScrollFrame();
+      aBuilder->SetIgnoreScrollFrame(rootScrollFrame);
+    }
+
     aBuilder->EnterPresShell(subdocRootFrame, dirty);
   }
 
   DisplayListClipState::AutoSaveRestore clipState(aBuilder);
   if (ShouldClipSubdocument()) {
     clipState.ClipContainingBlockDescendantsToContentBox(aBuilder, this);
   }
 
@@ -474,16 +483,20 @@ nsSubDocumentFrame::BuildDisplayList(nsD
     nsDisplayOwnLayer* layerItem = new (aBuilder) nsDisplayOwnLayer(
       aBuilder, subdocRootFrame ? subdocRootFrame : this,
       &childItems, nsDisplayOwnLayer::GENERATE_SUBDOC_INVALIDATIONS);
     childItems.AppendToTop(layerItem);
   }
 
   if (subdocRootFrame) {
     aBuilder->LeavePresShell(subdocRootFrame, dirty);
+
+    if (ignoreViewportScrolling) {
+      aBuilder->SetIgnoreScrollFrame(savedIgnoreScrollFrame);
+    }
   }
 
   if (aBuilder->IsForImageVisibility()) {
     // We don't add the childItems to the return list as we're dealing with them here.
     presShell->RebuildImageVisibility(childItems);
     childItems.DeleteAll();
   } else {
     aLists.Content()->AppendToTop(&childItems);