Bug 1236828 part 1 - Apply proper clip state to top layer frames. r?mattwoodrow draft
authorXidorn Quan <quanxunzhen@gmail.com>
Wed, 06 Apr 2016 18:48:31 +1000
changeset 347994 9e1d2f7e3071350ead3dcab797c2424041d15da4
parent 347990 0ae85e2b5a1470e61724a050d44492e62f4e396a
child 347995 4a9145ae958b3c1b3072524c37a6d5a4dc4bbe22
push id14722
push userxquan@mozilla.com
push dateWed, 06 Apr 2016 08:52:56 +0000
reviewersmattwoodrow
bugs1236828
milestone48.0a1
Bug 1236828 part 1 - Apply proper clip state to top layer frames. r?mattwoodrow MozReview-Commit-ID: JW2tAFu4wIP
layout/generic/nsViewportFrame.cpp
--- a/layout/generic/nsViewportFrame.cpp
+++ b/layout/generic/nsViewportFrame.cpp
@@ -94,20 +94,25 @@ ShouldInTopLayerForFullscreen(Element* a
 #endif // DEBUG
 
 static void
 BuildDisplayListForTopLayerFrame(nsDisplayListBuilder* aBuilder,
                                  nsIFrame* aFrame,
                                  nsDisplayList* aList)
 {
   nsRect dirty;
+  DisplayListClipState::AutoClipMultiple clipState(aBuilder);
   nsDisplayListBuilder::OutOfFlowDisplayData*
     savedOutOfFlowData = nsDisplayListBuilder::GetOutOfFlowData(aFrame);
   if (savedOutOfFlowData) {
     dirty = savedOutOfFlowData->mDirtyRect;
+    clipState.SetClipForContainingBlockDescendants(
+      &savedOutOfFlowData->mContainingBlockClip);
+    clipState.SetScrollClipForContainingBlockDescendants(
+      savedOutOfFlowData->mContainingBlockScrollClip);
   }
   nsDisplayList list;
   aFrame->BuildDisplayListForStackingContext(aBuilder, dirty, &list);
   aList->AppendToTop(&list);
 }
 
 void
 ViewportFrame::BuildDisplayListForTopLayer(nsDisplayListBuilder* aBuilder,
@@ -135,17 +140,16 @@ ViewportFrame::BuildDisplayListForTopLay
       // Inner SVG, MathML elements, as well as children of some XUL
       // elements are not allowed to be out-of-flow. They should not
       // be handled as top layer element here.
       if (!(frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
         MOZ_ASSERT(!elem->GetParent()->IsHTMLElement(), "HTML element "
                    "should always be out-of-flow if in the top layer");
         continue;
       }
-      MOZ_ASSERT(frame->GetParent() == this);
       if (nsIFrame* backdropPh =
           frame->GetChildList(kBackdropList).FirstChild()) {
         MOZ_ASSERT(backdropPh->GetType() == nsGkAtoms::placeholderFrame);
         nsIFrame* backdropFrame =
           static_cast<nsPlaceholderFrame*>(backdropPh)->GetOutOfFlowFrame();
         MOZ_ASSERT(backdropFrame);
         BuildDisplayListForTopLayerFrame(aBuilder, backdropFrame, aList);
       }