Bug 1215360 - Render canvas anonymous content on top of the top layer. r=roc

--HG--
extra : source : 231e0e545afaf3bf4993b0f6d20cd60ee734c899
This commit is contained in:
Xidorn Quan 2015-10-19 11:56:13 +11:00
parent 9a3278a626
commit af8cf1df88
2 changed files with 26 additions and 11 deletions

View File

@ -12,6 +12,7 @@
#include "nsGkAtoms.h"
#include "nsIScrollableFrame.h"
#include "nsSubDocumentFrame.h"
#include "nsCanvasFrame.h"
#include "nsAbsoluteContainingBlock.h"
#include "GeckoProfiler.h"
#include "nsIMozBrowserFrame.h"
@ -91,6 +92,22 @@ ShouldInTopLayerForFullscreen(Element* aElement)
}
#endif // DEBUG
static void
BuildDisplayListForTopLayerFrame(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame,
nsDisplayList* aList)
{
nsRect dirty;
nsDisplayListBuilder::OutOfFlowDisplayData*
savedOutOfFlowData = nsDisplayListBuilder::GetOutOfFlowData(aFrame);
if (savedOutOfFlowData) {
dirty = savedOutOfFlowData->mDirtyRect;
}
nsDisplayList list;
aFrame->BuildDisplayListForStackingContext(aBuilder, dirty, &list);
aList->AppendToTop(&list);
}
void
ViewportFrame::BuildDisplayListForTopLayer(nsDisplayListBuilder* aBuilder,
nsDisplayList* aList)
@ -123,16 +140,16 @@ ViewportFrame::BuildDisplayListForTopLayer(nsDisplayListBuilder* aBuilder,
continue;
}
MOZ_ASSERT(frame->GetParent() == this);
BuildDisplayListForTopLayerFrame(aBuilder, frame, aList);
}
}
nsRect dirty;
nsDisplayListBuilder::OutOfFlowDisplayData*
savedOutOfFlowData = nsDisplayListBuilder::GetOutOfFlowData(frame);
if (savedOutOfFlowData) {
dirty = savedOutOfFlowData->mDirtyRect;
nsIPresShell* shell = PresContext()->PresShell();
if (nsCanvasFrame* canvasFrame = shell->GetCanvasFrame()) {
if (Element* container = canvasFrame->GetCustomContentContainer()) {
if (nsIFrame* frame = container->GetPrimaryFrame()) {
BuildDisplayListForTopLayerFrame(aBuilder, frame, aList);
}
nsDisplayList list;
frame->BuildDisplayListForStackingContext(aBuilder, dirty, &list);
aList->AppendToTop(&list);
}
}
}

View File

@ -514,12 +514,10 @@ div:-moz-native-anonymous.moz-selectioncaret-right.hidden > div {
everything else, not reacting to pointer events. */
div:-moz-native-anonymous.moz-custom-content-container {
pointer-events: none;
-moz-top-layer: top;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 2147483648;
}