Bug 1097464 - Part 5: Fix preserve3d wording for nsIFrame. r=roc
This commit is contained in:
@@ -337,7 +337,7 @@ ActiveLayerTracker::IsStyleAnimated(nsDisplayListBuilder* aBuilder,
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (aProperty == eCSSProperty_transform && aFrame->Preserves3D()) {
|
||||
if (aProperty == eCSSProperty_transform && aFrame->Combines3DTransformWithAncestors()) {
|
||||
return IsStyleAnimated(aBuilder, aFrame->GetParent(), aProperty);
|
||||
}
|
||||
return nsLayoutUtils::HasCurrentAnimationsForProperties(aFrame, &aProperty, 1);
|
||||
|
||||
@@ -3943,7 +3943,8 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
|
||||
// 3D-transformed layers don't necessarily draw in the order in which
|
||||
// they're added to their parent container layer.
|
||||
bool mayDrawOutOfOrder = itemType == nsDisplayItem::TYPE_TRANSFORM &&
|
||||
(item->Frame()->Preserves3D() || item->Frame()->Preserves3DChildren());
|
||||
(item->Frame()->Combines3DTransformWithAncestors() ||
|
||||
item->Frame()->Extend3DContext());
|
||||
|
||||
// Let mPaintedLayerDataTree know about this item, so that
|
||||
// FindPaintedLayerFor and FindOpaqueBackgroundColor are aware of this
|
||||
|
||||
@@ -934,7 +934,7 @@ nsDisplayListBuilder::MarkPreserve3DFramesForDisplayList(nsIFrame* aDirtyFrame,
|
||||
nsFrameList::Enumerator childFrames(lists.CurrentList());
|
||||
for (; !childFrames.AtEnd(); childFrames.Next()) {
|
||||
nsIFrame *child = childFrames.get();
|
||||
if (child->Preserves3D()) {
|
||||
if (child->Combines3DTransformWithAncestors()) {
|
||||
mFramesMarkedForDisplay.AppendElement(child);
|
||||
nsRect dirty = aDirtyRect - child->GetOffsetTo(aDirtyFrame);
|
||||
|
||||
@@ -1838,7 +1838,7 @@ void nsDisplayList::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
||||
// so we can sort them later, otherwise we add them directly to the output list.
|
||||
nsTArray<nsIFrame*> *writeFrames = aOutFrames;
|
||||
if (item->GetType() == nsDisplayItem::TYPE_TRANSFORM &&
|
||||
item->Frame()->Preserves3D()) {
|
||||
item->Frame()->Combines3DTransformWithAncestors()) {
|
||||
if (outFrames.Length()) {
|
||||
nsDisplayTransform *transform = static_cast<nsDisplayTransform*>(item);
|
||||
nsPoint point = aRect.TopLeft();
|
||||
@@ -3564,7 +3564,7 @@ nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder,
|
||||
// inside this list afterwards (see WrapPreserve3DList in nsFrame.cpp).
|
||||
// In this case we will always be outside of the transform, so share
|
||||
// our parents reference frame.
|
||||
if (aFrame->Preserves3DChildren()) {
|
||||
if (aFrame->Extend3DContext()) {
|
||||
mReferenceFrame =
|
||||
aBuilder->FindReferenceFrameFor(GetTransformRootFrame(aFrame));
|
||||
mToReferenceFrame = aFrame->GetOffsetToCrossDoc(mReferenceFrame);
|
||||
@@ -3610,7 +3610,7 @@ nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder,
|
||||
return;
|
||||
}
|
||||
|
||||
if (aFrame->Preserves3DChildren()) {
|
||||
if (aFrame->Extend3DContext()) {
|
||||
mReferenceFrame =
|
||||
aBuilder->FindReferenceFrameFor(GetTransformRootFrame(aFrame));
|
||||
mToReferenceFrame = aFrame->GetOffsetToCrossDoc(mReferenceFrame);
|
||||
@@ -5051,11 +5051,11 @@ nsDisplayTransform::GetResultingTransformMatrixInternal(const FrameTransformProp
|
||||
}
|
||||
}
|
||||
|
||||
if (frame && frame->Preserves3D()) {
|
||||
if (frame && frame->Combines3DTransformWithAncestors()) {
|
||||
// Include the transform set on our parent
|
||||
NS_ASSERTION(frame->GetParent() &&
|
||||
frame->GetParent()->IsTransformed() &&
|
||||
frame->GetParent()->Preserves3DChildren(),
|
||||
frame->GetParent()->Extend3DContext(),
|
||||
"Preserve3D mismatch!");
|
||||
FrameTransformProperties props(frame->GetParent(),
|
||||
aAppUnitsPerPixel,
|
||||
@@ -5256,7 +5256,7 @@ already_AddRefed<Layer> nsDisplayTransform::BuildLayer(nsDisplayListBuilder *aBu
|
||||
|
||||
// Add the preserve-3d flag for this layer, BuildContainerLayerFor clears all flags,
|
||||
// so we never need to explicitely unset this flag.
|
||||
if (mFrame->Preserves3D() || mFrame->Preserves3DChildren()) {
|
||||
if (mFrame->Combines3DTransformWithAncestors() || mFrame->Extend3DContext()) {
|
||||
container->SetContentFlags(container->GetContentFlags() | Layer::CONTENT_EXTEND_3D_CONTEXT);
|
||||
} else {
|
||||
container->SetContentFlags(container->GetContentFlags() & ~Layer::CONTENT_EXTEND_3D_CONTEXT);
|
||||
@@ -5282,7 +5282,7 @@ nsDisplayTransform::GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
const ContainerLayerParameters& aParameters) {
|
||||
// If the transform is 3d, or the layer takes part in preserve-3d sorting
|
||||
// then we *always* want this to be an active layer.
|
||||
if (!GetTransform().Is2D() || mFrame->Preserves3D()) {
|
||||
if (!GetTransform().Is2D() || mFrame->Combines3DTransformWithAncestors()) {
|
||||
return LAYER_ACTIVE_FORCE;
|
||||
}
|
||||
// Here we check if the *post-transform* bounds of this item are big enough
|
||||
|
||||
@@ -2379,7 +2379,7 @@ nsLayoutUtils::GetTransformToAncestor(nsIFrame *aFrame, const nsIFrame *aAncesto
|
||||
}
|
||||
ctm = aFrame->GetTransformMatrix(aAncestor, &parent);
|
||||
while (parent && parent != aAncestor) {
|
||||
if (!parent->Preserves3DChildren()) {
|
||||
if (!parent->Extend3DContext()) {
|
||||
ctm.ProjectTo2D();
|
||||
}
|
||||
ctm = ctm * parent->GetTransformMatrix(aAncestor, &parent);
|
||||
@@ -2416,7 +2416,7 @@ GetTransformToAncestorExcludingAnimated(nsIFrame* aFrame,
|
||||
if (ActiveLayerTracker::IsScaleSubjectToAnimation(parent)) {
|
||||
return Matrix4x4();
|
||||
}
|
||||
if (!parent->Preserves3DChildren()) {
|
||||
if (!parent->Extend3DContext()) {
|
||||
ctm.ProjectTo2D();
|
||||
}
|
||||
ctm = ctm * parent->GetTransformMatrix(aAncestor, &parent);
|
||||
@@ -2643,7 +2643,7 @@ nsLayoutUtils::GetLayerTransformForFrame(nsIFrame* aFrame,
|
||||
{
|
||||
// FIXME/bug 796690: we can sometimes compute a transform in these
|
||||
// cases, it just increases complexity considerably. Punt for now.
|
||||
if (aFrame->Preserves3DChildren() || aFrame->HasTransformGetter()) {
|
||||
if (aFrame->Extend3DContext() || aFrame->HasTransformGetter()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -6644,7 +6644,7 @@ nsLayoutUtils::GetReferenceFrame(nsIFrame* aFrame)
|
||||
nsLayoutUtils::GetTransformRootFrame(nsIFrame* aFrame)
|
||||
{
|
||||
nsIFrame *parent = nsLayoutUtils::GetCrossDocParentFrame(aFrame);
|
||||
while (parent && parent->Preserves3DChildren()) {
|
||||
while (parent && parent->Extend3DContext()) {
|
||||
parent = nsLayoutUtils::GetCrossDocParentFrame(parent);
|
||||
}
|
||||
return parent;
|
||||
|
||||
@@ -5723,7 +5723,7 @@ PresShell::MarkImagesInSubtreeVisible(nsIFrame* aFrame, const nsRect& aRect)
|
||||
rect = scrollFrame->ExpandRectToNearlyVisible(rect);
|
||||
}
|
||||
|
||||
bool preserves3DChildren = aFrame->Preserves3DChildren();
|
||||
bool preserves3DChildren = aFrame->Extend3DContext();
|
||||
|
||||
// we assume all images in popups are visible elsewhere, so we skip them here
|
||||
const nsIFrame::ChildListIDs skip(nsIFrame::kPopupList |
|
||||
@@ -5741,7 +5741,7 @@ PresShell::MarkImagesInSubtreeVisible(nsIFrame* aFrame, const nsRect& aRect)
|
||||
}
|
||||
if (child->IsTransformed()) {
|
||||
// for children of a preserve3d element we just pass down the same dirty rect
|
||||
if (!preserves3DChildren || !child->Preserves3D()) {
|
||||
if (!preserves3DChildren || !child->Combines3DTransformWithAncestors()) {
|
||||
const nsRect overflow = child->GetVisualOverflowRectRelativeToSelf();
|
||||
nsRect out;
|
||||
if (nsDisplayTransform::UntransformRect(r, overflow, child, nsPoint(0,0), &out)) {
|
||||
|
||||
@@ -1120,7 +1120,7 @@ nsIFrame::IsSVGTransformed(gfx::Matrix *aOwnTransforms,
|
||||
}
|
||||
|
||||
bool
|
||||
nsIFrame::Preserves3DChildren() const
|
||||
nsIFrame::Extend3DContext() const
|
||||
{
|
||||
const nsStyleDisplay* disp = StyleDisplay();
|
||||
if (disp->mTransformStyle != NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D ||
|
||||
@@ -1140,9 +1140,9 @@ nsIFrame::Preserves3DChildren() const
|
||||
}
|
||||
|
||||
bool
|
||||
nsIFrame::Preserves3D() const
|
||||
nsIFrame::Combines3DTransformWithAncestors() const
|
||||
{
|
||||
if (!GetParent() || !GetParent()->Preserves3DChildren()) {
|
||||
if (!GetParent() || !GetParent()->Extend3DContext()) {
|
||||
return false;
|
||||
}
|
||||
return StyleDisplay()->HasTransform(this) || StyleDisplay()->BackfaceIsHidden();
|
||||
@@ -1804,7 +1804,7 @@ WrapPreserve3DListInternal(nsIFrame* aFrame, nsDisplayListBuilder *aBuilder,
|
||||
// nsDisplayTransform.
|
||||
|
||||
if (childFrame->GetParent() &&
|
||||
(childFrame->GetParent()->Preserves3DChildren() || childFrame == aFrame)) {
|
||||
(childFrame->GetParent()->Extend3DContext() || childFrame == aFrame)) {
|
||||
switch (item->GetType()) {
|
||||
case nsDisplayItem::TYPE_TRANSFORM: {
|
||||
if (!aTemp->IsEmpty()) {
|
||||
@@ -2064,7 +2064,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
|
||||
nsDisplayTransform::ShouldPrerenderTransformedContent(aBuilder, this)) {
|
||||
dirtyRect = overflow;
|
||||
} else {
|
||||
if (overflow.IsEmpty() && !Preserves3DChildren()) {
|
||||
if (overflow.IsEmpty() && !Extend3DContext()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2134,7 +2134,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
|
||||
|
||||
// Preserve3DChildren() also guarantees that applyAbsPosClipping and usingSVGEffects are false
|
||||
// We only modify the preserve-3d rect if we are the top of a preserve-3d heirarchy
|
||||
if (Preserves3DChildren()) {
|
||||
if (Extend3DContext()) {
|
||||
aBuilder->MarkPreserve3DFramesForDisplayList(this, aDirtyRect);
|
||||
}
|
||||
|
||||
@@ -2265,7 +2265,7 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
|
||||
buildingDisplayList.SetReferenceFrameAndCurrentOffset(outerReferenceFrame,
|
||||
GetOffsetToCrossDoc(outerReferenceFrame));
|
||||
|
||||
if (Preserves3DChildren()) {
|
||||
if (Extend3DContext()) {
|
||||
WrapPreserve3DList(this, aBuilder, &resultList);
|
||||
} else {
|
||||
resultList.AppendNewToTop(
|
||||
@@ -2400,7 +2400,7 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
|
||||
}
|
||||
pseudoStackingContext = true;
|
||||
}
|
||||
if (child->Preserves3D()) {
|
||||
if (child->Combines3DTransformWithAncestors()) {
|
||||
nsRect* savedDirty = static_cast<nsRect*>
|
||||
(child->Properties().Get(nsDisplayListBuilder::Preserve3DDirtyRectProperty()));
|
||||
if (savedDirty) {
|
||||
@@ -5857,10 +5857,10 @@ nsIFrame::ListGeneric(nsACString& aTo, const char* aPrefix, uint32_t aFlags) con
|
||||
if (ChildrenHavePerspective()) {
|
||||
aTo += nsPrintfCString(" perspective");
|
||||
}
|
||||
if (Preserves3DChildren()) {
|
||||
if (Extend3DContext()) {
|
||||
aTo += nsPrintfCString(" preserves-3d-children");
|
||||
}
|
||||
if (Preserves3D()) {
|
||||
if (Combines3DTransformWithAncestors()) {
|
||||
aTo += nsPrintfCString(" preserves-3d");
|
||||
}
|
||||
if (mContent) {
|
||||
@@ -7514,14 +7514,14 @@ UnionBorderBoxes(nsIFrame* aFrame, bool aApplyTransform,
|
||||
for (nsFrameList::Enumerator e(children); !e.AtEnd(); e.Next()) {
|
||||
nsIFrame* child = e.get();
|
||||
// Note that passing |true| for aApplyTransform when
|
||||
// child->Preserves3D() is incorrect if our aApplyTransform is
|
||||
// false... but the opposite would be as well. This is because
|
||||
// elements within a preserve-3d scene are always transformed up
|
||||
// to the top of the scene. This means we don't have a
|
||||
// mechanism for getting a transform up to an intermediate point
|
||||
// within the scene. We choose to over-transform rather than
|
||||
// under-transform because this is consistent with other
|
||||
// overflow areas.
|
||||
// child->Combines3DTransformWithAncestors() is incorrect if our
|
||||
// aApplyTransform is false... but the opposite would be as
|
||||
// well. This is because elements within a preserve-3d scene
|
||||
// are always transformed up to the top of the scene. This
|
||||
// means we don't have a mechanism for getting a transform up to
|
||||
// an intermediate point within the scene. We choose to
|
||||
// over-transform rather than under-transform because this is
|
||||
// consistent with other overflow areas.
|
||||
nsRect childRect = UnionBorderBoxes(child, true) +
|
||||
child->GetPosition();
|
||||
|
||||
@@ -7536,7 +7536,7 @@ UnionBorderBoxes(nsIFrame* aFrame, bool aApplyTransform,
|
||||
// union. This doesn't match the way we handle overflow areas
|
||||
// with 2-D transforms, though it does match the way we handle
|
||||
// overflow areas in preserve-3d 3-D scenes.
|
||||
if (doTransform && !child->Preserves3D()) {
|
||||
if (doTransform && !child->Combines3DTransformWithAncestors()) {
|
||||
childRect = nsDisplayTransform::TransformRect(childRect, aFrame,
|
||||
nsPoint(0, 0), &bounds);
|
||||
}
|
||||
@@ -7605,7 +7605,7 @@ ComputeAndIncludeOutlineArea(nsIFrame* aFrame, nsOverflowAreas& aOverflowAreas,
|
||||
if (parent == aFrame) {
|
||||
break;
|
||||
}
|
||||
if (parent->IsTransformed() && !f->Preserves3D()) {
|
||||
if (parent->IsTransformed() && !f->Combines3DTransformWithAncestors()) {
|
||||
r = nsDisplayTransform::TransformRect(r, parent, nsPoint(0, 0));
|
||||
}
|
||||
}
|
||||
@@ -7653,7 +7653,7 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
|
||||
nsRect bounds(nsPoint(0, 0), aNewSize);
|
||||
// Store the passed in overflow area if we are a preserve-3d frame or we have
|
||||
// a transform, and it's not just the frame bounds.
|
||||
if (Preserves3D() || IsTransformed()) {
|
||||
if (Combines3DTransformWithAncestors() || IsTransformed()) {
|
||||
if (!aOverflowAreas.VisualOverflow().IsEqualEdges(bounds) ||
|
||||
!aOverflowAreas.ScrollableOverflow().IsEqualEdges(bounds)) {
|
||||
nsOverflowAreas* initial =
|
||||
@@ -7766,7 +7766,7 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
|
||||
nsRect& o = aOverflowAreas.Overflow(otype);
|
||||
o = nsDisplayTransform::TransformRect(o, this, nsPoint(0, 0), &newBounds);
|
||||
}
|
||||
if (Preserves3DChildren()) {
|
||||
if (Extend3DContext()) {
|
||||
ComputePreserve3DChildrenOverflow(aOverflowAreas, newBounds);
|
||||
} else if (sizeChanged && ChildrenHavePerspective()) {
|
||||
RecomputePerspectiveChildrenOverflow(this, &newBounds);
|
||||
@@ -7856,9 +7856,9 @@ RecomputePreserve3DChildrenOverflow(nsIFrame* aFrame, const nsRect* aBounds)
|
||||
if (!FrameMaintainsOverflow(child)) {
|
||||
continue; // frame does not maintain overflow rects
|
||||
}
|
||||
if (child->Preserves3DChildren()) {
|
||||
if (child->Extend3DContext()) {
|
||||
RecomputePreserve3DChildrenOverflow(child, nullptr);
|
||||
} else if (child->Preserves3D()) {
|
||||
} else if (child->Combines3DTransformWithAncestors()) {
|
||||
nsOverflowAreas* overflow =
|
||||
static_cast<nsOverflowAreas*>(child->Properties().Get(nsIFrame::InitialOverflowProperty()));
|
||||
nsRect bounds(nsPoint(0, 0), child->GetSize());
|
||||
@@ -7904,7 +7904,7 @@ nsIFrame::ComputePreserve3DChildrenOverflow(nsOverflowAreas& aOverflowAreas, con
|
||||
// If we're the top frame in a preserve 3d chain then we need to recalculate the overflow
|
||||
// areas of all our children since they will have used our size/offset which was invalid at
|
||||
// the time.
|
||||
if (!Preserves3D()) {
|
||||
if (!Combines3DTransformWithAncestors()) {
|
||||
RecomputePreserve3DChildrenOverflow(this, &aBounds);
|
||||
}
|
||||
|
||||
@@ -7920,7 +7920,7 @@ nsIFrame::ComputePreserve3DChildrenOverflow(nsOverflowAreas& aOverflowAreas, con
|
||||
nsRect scrollable = child->GetScrollableOverflowRect();
|
||||
visual.MoveBy(offset);
|
||||
scrollable.MoveBy(offset);
|
||||
if (child->Preserves3D()) {
|
||||
if (child->Combines3DTransformWithAncestors()) {
|
||||
childVisual = childVisual.Union(visual);
|
||||
childScrollable = childScrollable.Union(scrollable);
|
||||
} else {
|
||||
|
||||
@@ -1247,18 +1247,18 @@ public:
|
||||
Matrix *aFromParentTransforms = nullptr) const;
|
||||
|
||||
/**
|
||||
* Returns whether this frame will attempt to preserve the 3d transforms of its
|
||||
* Returns whether this frame will attempt to extend the 3d transforms of its
|
||||
* children. This requires transform-style: preserve-3d, as well as no clipping
|
||||
* or svg effects.
|
||||
*/
|
||||
bool Preserves3DChildren() const;
|
||||
bool Extend3DContext() const;
|
||||
|
||||
/**
|
||||
* Returns whether this frame has a parent that Preserves3DChildren() and has
|
||||
* Returns whether this frame has a parent that Extend3DContext() and has
|
||||
* its own transform (or hidden backface) to be combined with the parent's
|
||||
* transform.
|
||||
*/
|
||||
bool Preserves3D() const;
|
||||
bool Combines3DTransformWithAncestors() const;
|
||||
|
||||
bool HasPerspective() const;
|
||||
|
||||
|
||||
@@ -537,8 +537,8 @@ AnimationCollection::CanAnimatePropertyOnCompositor(
|
||||
return false;
|
||||
}
|
||||
if (aProperty == eCSSProperty_transform) {
|
||||
if (frame->Preserves3D() ||
|
||||
frame->Preserves3DChildren()) {
|
||||
if (frame->Combines3DTransformWithAncestors() ||
|
||||
frame->Extend3DContext()) {
|
||||
if (shouldLog) {
|
||||
nsCString message;
|
||||
message.AppendLiteral("Gecko bug: Async animation of 'preserve-3d' transforms is not supported. See bug 779598");
|
||||
@@ -548,7 +548,7 @@ AnimationCollection::CanAnimatePropertyOnCompositor(
|
||||
}
|
||||
// Note that testing BackfaceIsHidden() is not a sufficient test for
|
||||
// what we need for animating backface-visibility correctly if we
|
||||
// remove the above test for Preserves3DChildren(); that would require
|
||||
// remove the above test for Extend3DContext(); that would require
|
||||
// looking at backface-visibility on descendants as well.
|
||||
if (frame->StyleDisplay()->BackfaceIsHidden()) {
|
||||
if (shouldLog) {
|
||||
|
||||
Reference in New Issue
Block a user