Bug 941050 - Don't assume fixed position layers are only created for ContainerLayers owned by the ViewportFrame. r=tn

This commit is contained in:
Matt Woodrow 2013-11-29 18:17:53 +13:00
Родитель 4ad3c462f3
Коммит e347d400d7
1 изменённых файлов: 6 добавлений и 10 удалений

Просмотреть файл

@ -1617,22 +1617,18 @@ ContainerState::FindFixedPosFrameForLayerData(const nsIFrame* aAnimatedGeometryR
nsIntRegion* aVisibleRegion,
bool* aIsSolidColorInVisibleRegion)
{
if (mContainerFrame->GetParent()) {
// Viewports with displayports always get a layer created for the viewport
// frame. (See nsSubdocumentFrame::BuildDisplayList's calculation of
// needsOwnLayer.) The children of that layer are the ones that might
// have fixed-pos frame data. So if we're creating layers for children
// of a frame other than a viewport, there's nothing to do here.
return nullptr;
}
nsIFrame *viewport = mContainerFrame->PresContext()->PresShell()->GetRootFrame();
// Viewports with no fixed-pos frames are not relevant.
if (!mContainerFrame->GetFirstChild(nsIFrame::kFixedList)) {
if (!viewport->GetFirstChild(nsIFrame::kFixedList)) {
return nullptr;
}
nsRect displayPort;
for (const nsIFrame* f = aAnimatedGeometryRoot; f; f = f->GetParent()) {
if (nsLayoutUtils::IsFixedPosFrameInDisplayPort(f, &displayPort)) {
displayPort += mContainerFrame->GetOffsetToCrossDoc(mContainerReferenceFrame);
// Display ports are relative to the viewport, convert it to be relative
// to our reference frame.
displayPort += viewport->GetOffsetToCrossDoc(mContainerReferenceFrame);
nsIntRegion newVisibleRegion;
newVisibleRegion.And(ScaleToOutsidePixels(displayPort, false),
aDrawRegion);