Backing out patches for bug 972713 (changesets b5486b9ed88c and 7829e535cdd7) due to Windows 8 test failure.

This commit is contained in:
Robert O'Callahan 2014-02-18 22:48:18 +13:00
parent 6c1298255a
commit b8b97141df
5 changed files with 70 additions and 54 deletions

View File

@ -2293,16 +2293,18 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList,
{
PROFILER_LABEL("ContainerState", "ProcessDisplayItems");
const nsIFrame* lastAnimatedGeometryRoot = mContainerReferenceFrame;
nsPoint topLeft(0,0);
const nsIFrame* lastAnimatedGeometryRoot = nullptr;
nsPoint topLeft;
// When NO_COMPONENT_ALPHA is set, items will be flattened into a single
// layer, so we need to choose which active scrolled root to use for all
// items.
if (aFlags & NO_COMPONENT_ALPHA) {
if (ChooseAnimatedGeometryRoot(aList, &lastAnimatedGeometryRoot)) {
topLeft = lastAnimatedGeometryRoot->GetOffsetToCrossDoc(mContainerReferenceFrame);
if (!ChooseAnimatedGeometryRoot(aList, &lastAnimatedGeometryRoot)) {
lastAnimatedGeometryRoot = mContainerReferenceFrame;
}
topLeft = lastAnimatedGeometryRoot->GetOffsetToCrossDoc(mContainerReferenceFrame);
}
int32_t maxLayers = nsDisplayItem::MaxActiveLayers();
@ -2342,14 +2344,7 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList,
animatedGeometryRoot = lastAnimatedGeometryRoot;
} else {
forceInactive = false;
if (mManager->IsWidgetLayerManager()) {
animatedGeometryRoot = nsLayoutUtils::GetAnimatedGeometryRootFor(item, mBuilder);
} else {
// For inactive layer subtrees, splitting content into ThebesLayers
// based on animated geometry roots is pointless. It's more efficient
// to build the minimum number of layers.
animatedGeometryRoot = mContainerReferenceFrame;
}
animatedGeometryRoot = nsLayoutUtils::GetAnimatedGeometryRootFor(item, mBuilder);
if (animatedGeometryRoot != lastAnimatedGeometryRoot) {
lastAnimatedGeometryRoot = animatedGeometryRoot;
topLeft = animatedGeometryRoot->GetOffsetToCrossDoc(mContainerReferenceFrame);

View File

@ -2965,23 +2965,18 @@ void nsDisplayWrapList::Paint(nsDisplayListBuilder* aBuilder,
NS_ERROR("nsDisplayWrapList should have been flattened away for painting");
}
/**
* Returns true if all descendant display items can be placed in the same
* ThebesLayer --- GetLayerState returns LAYER_INACTIVE or LAYER_NONE,
* and they all have the expected animated geometry root.
*/
static LayerState
RequiredLayerStateForChildren(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
const ContainerLayerParameters& aParameters,
const nsDisplayList& aList,
nsIFrame* aExpectedAnimatedGeometryRootForChildren)
RequiredLayerStateForChildrenInternal(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
const ContainerLayerParameters& aParameters,
const nsDisplayList& aList,
nsIFrame* aAnimatedGeometryRoot)
{
LayerState result = LAYER_INACTIVE;
for (nsDisplayItem* i = aList.GetBottom(); i; i = i->GetAbove()) {
nsIFrame* f = i->Frame();
if (result == LAYER_INACTIVE &&
nsLayoutUtils::GetAnimatedGeometryRootFor(i, aBuilder) !=
aExpectedAnimatedGeometryRootForChildren) {
nsLayoutUtils::GetAnimatedGeometryRootFor(f) != aAnimatedGeometryRoot) {
result = LAYER_ACTIVE;
}
@ -2997,8 +2992,8 @@ RequiredLayerStateForChildren(nsDisplayListBuilder* aBuilder,
nsDisplayList* list = i->GetSameCoordinateSystemChildren();
if (list) {
LayerState childState =
RequiredLayerStateForChildren(aBuilder, aManager, aParameters, *list,
aExpectedAnimatedGeometryRootForChildren);
RequiredLayerStateForChildrenInternal(aBuilder, aManager, aParameters, *list,
aAnimatedGeometryRoot);
if (childState > result) {
result = childState;
}
@ -3008,6 +3003,18 @@ RequiredLayerStateForChildren(nsDisplayListBuilder* aBuilder,
return result;
}
LayerState
nsDisplayWrapList::RequiredLayerStateForChildren(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
const ContainerLayerParameters& aParameters,
const nsDisplayList& aList,
nsIFrame* aItemFrame)
{
return RequiredLayerStateForChildrenInternal(
aBuilder, aManager, aParameters, aList,
nsLayoutUtils::GetAnimatedGeometryRootFor(aItemFrame));
}
nsRect nsDisplayWrapList::GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder)
{
nsRect bounds;
@ -3183,8 +3190,7 @@ nsDisplayOpacity::GetLayerState(nsDisplayListBuilder* aBuilder,
if (NeedsActiveLayer())
return LAYER_ACTIVE;
return RequiredLayerStateForChildren(aBuilder, aManager, aParameters, mList,
nsLayoutUtils::GetAnimatedGeometryRootFor(this, aBuilder));
return RequiredLayerStateForChildren(aBuilder, aManager, aParameters, mList, mFrame);
}
bool
@ -4472,12 +4478,11 @@ nsDisplayTransform::GetLayerState(nsDisplayListBuilder* aBuilder,
return LAYER_ACTIVE;
}
// Expect the child display items to have this frame as their animated
// geometry root (since it will be their reference frame). If they have a
// different animated geometry root, we'll make this an active layer so the
// animation can be accelerated.
return RequiredLayerStateForChildren(aBuilder, aManager, aParameters,
*mStoredList.GetChildren(), Frame());
return mStoredList.RequiredLayerStateForChildren(aBuilder,
aManager,
aParameters,
*mStoredList.GetChildren(),
mFrame);
}
bool nsDisplayTransform::ComputeVisibility(nsDisplayListBuilder *aBuilder,

View File

@ -2490,6 +2490,17 @@ public:
return nullptr;
}
/**
* Returns true if all descendant display items can be placed in the same
* ThebesLayer --- GetLayerState returns LAYER_INACTIVE or LAYER_NONE,
* and they all have the given aAnimatedGeometryRoot.
*/
static LayerState RequiredLayerStateForChildren(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
const ContainerLayerParameters& aParameters,
const nsDisplayList& aList,
nsIFrame* aItemFrame);
protected:
nsDisplayWrapList() {}

View File

@ -1304,24 +1304,23 @@ nsLayoutUtils::IsFixedPosFrameInDisplayPort(const nsIFrame* aFrame, nsRect* aDis
return ViewportHasDisplayPort(aFrame->PresContext(), aDisplayPort);
}
static nsIFrame*
GetAnimatedGeometryRootForFrame(nsIFrame* aFrame,
const nsIFrame* aStopAtAncestor)
nsIFrame*
nsLayoutUtils::GetAnimatedGeometryRootFor(nsIFrame* aFrame,
const nsIFrame* aStopAtAncestor)
{
nsIFrame* f = aFrame;
nsIFrame* stickyFrame = nullptr;
while (f != aStopAtAncestor) {
if (nsLayoutUtils::IsPopup(f))
if (IsPopup(f))
break;
if (ActiveLayerTracker::IsOffsetOrMarginStyleAnimated(f))
break;
if (!f->GetParent() &&
nsLayoutUtils::ViewportHasDisplayPort(f->PresContext())) {
if (!f->GetParent() && ViewportHasDisplayPort(f->PresContext())) {
// Viewport frames in a display port need to be animated geometry roots
// for background-attachment:fixed elements.
break;
}
nsIFrame* parent = nsLayoutUtils::GetCrossDocParentFrame(f);
nsIFrame* parent = GetCrossDocParentFrame(f);
if (!parent)
break;
nsIAtom* parentType = parent->GetType();
@ -1352,7 +1351,7 @@ GetAnimatedGeometryRootForFrame(nsIFrame* aFrame,
}
}
// Fixed-pos frames are parented by the viewport frame, which has no parent
if (nsLayoutUtils::IsFixedPosFrameInDisplayPort(f)) {
if (IsFixedPosFrameInDisplayPort(f)) {
return f;
}
f = parent;
@ -1369,7 +1368,7 @@ nsLayoutUtils::GetAnimatedGeometryRootFor(nsDisplayItem* aItem,
nsDisplayScrollLayer* scrollLayerItem =
static_cast<nsDisplayScrollLayer*>(aItem);
nsIFrame* scrolledFrame = scrollLayerItem->GetScrolledFrame();
return GetAnimatedGeometryRootForFrame(scrolledFrame,
return nsLayoutUtils::GetAnimatedGeometryRootFor(scrolledFrame,
aBuilder->FindReferenceFrameFor(scrolledFrame));
}
if (aItem->ShouldFixToViewport(aBuilder)) {
@ -1380,10 +1379,10 @@ nsLayoutUtils::GetAnimatedGeometryRootFor(nsDisplayItem* aItem,
nsIFrame* viewportFrame =
nsLayoutUtils::GetClosestFrameOfType(f, nsGkAtoms::viewportFrame);
NS_ASSERTION(viewportFrame, "no viewport???");
return GetAnimatedGeometryRootForFrame(viewportFrame,
return nsLayoutUtils::GetAnimatedGeometryRootFor(viewportFrame,
aBuilder->FindReferenceFrameFor(viewportFrame));
}
return GetAnimatedGeometryRootForFrame(f, aItem->ReferenceFrame());
return nsLayoutUtils::GetAnimatedGeometryRootFor(f, aItem->ReferenceFrame());
}
// static

View File

@ -408,22 +408,28 @@ public:
nsRect* aDisplayPort = nullptr);
/**
* Finds the nearest ancestor frame to aItem that is considered to have (or
* will have) "animated geometry". For example the scrolled frames of
* scrollframes which are actively being scrolled fall into this category.
* Frames with certain CSS properties that are being animated (e.g.
* 'left'/'top' etc) are also placed in this category.
* Finds the nearest ancestor frame that is considered to have (or will have)
* "animated geometry". For example the scrolled frames of scrollframes which
* are actively being scrolled fall into this category. Frames with certain
* CSS properties that are being animated (e.g. 'left'/'top' etc) are also
* placed in this category. Frames with animated CSS transforms are not
* put in this category because they can be handled directly by
* nsDisplayTransform.
* Stop searching at aStopAtAncestor if there is no such ancestor before it
* in the ancestor chain.
* Frames with different active geometry roots are in different ThebesLayers,
* so that we can animate the geometry root by changing its transform (either
* on the main thread or in the compositor).
* The animated geometry root is required to be a descendant (or equal to)
* aItem's ReferenceFrame(), which means that we will fall back to
* returning aItem->ReferenceFrame() when we can't find another animated
* geometry root.
* This function is idempotent: a frame returned by GetAnimatedGeometryRootFor
* is always returned again if you pass it to GetAnimatedGeometryRootFor.
*/
static nsIFrame* GetAnimatedGeometryRootFor(nsIFrame* aFrame,
const nsIFrame* aStopAtAncestor = nullptr);
static nsIFrame* GetAnimatedGeometryRootFor(nsDisplayItem* aItem,
nsDisplayListBuilder* aBuilder);
/**
* GetScrollableFrameFor returns the scrollable frame for a scrolled frame
*/