зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1542929 - Remove mReferenceFrame from nsDisplayItem. r=miko
Differential Revision: https://phabricator.services.mozilla.com/D124009
This commit is contained in:
Родитель
51b371636c
Коммит
9bdea2da6b
|
@ -275,7 +275,7 @@ Maybe<wr::WrSpatialId> ClipManager::DefineScrollLayers(
|
|||
|
||||
Maybe<ScrollMetadata> metadata =
|
||||
aASR->mScrollableFrame->ComputeScrollMetadata(
|
||||
mManager, aItem->ReferenceFrame(), nullptr);
|
||||
mManager, aItem->Frame(), aItem->ToReferenceFrame(), nullptr);
|
||||
if (!metadata) {
|
||||
MOZ_ASSERT_UNREACHABLE("Expected scroll metadata to be available!");
|
||||
return ancestorSpace;
|
||||
|
@ -289,7 +289,8 @@ Maybe<wr::WrSpatialId> ClipManager::DefineScrollLayers(
|
|||
|
||||
nsIScrollableFrame* scrollableFrame = aASR->mScrollableFrame;
|
||||
nsIFrame* scrollFrame = do_QueryFrame(scrollableFrame);
|
||||
nsPoint offset = scrollFrame->GetOffsetToCrossDoc(aItem->ReferenceFrame());
|
||||
nsPoint offset = scrollFrame->GetOffsetToCrossDoc(aItem->Frame()) +
|
||||
aItem->ToReferenceFrame();
|
||||
float auPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel();
|
||||
nsRect scrollPort = scrollableFrame->GetScrollPortRect() + offset;
|
||||
LayoutDeviceRect clipBounds =
|
||||
|
|
|
@ -64,7 +64,8 @@ void WebRenderLayerScrollData::Initialize(
|
|||
} else {
|
||||
Maybe<ScrollMetadata> metadata =
|
||||
asr->mScrollableFrame->ComputeScrollMetadata(
|
||||
aOwner.GetManager(), aItem->ReferenceFrame(), nullptr);
|
||||
aOwner.GetManager(), aItem->Frame(), aItem->ToReferenceFrame(),
|
||||
nullptr);
|
||||
aOwner.GetBuilder()->AddScrollFrameToNotify(asr->mScrollableFrame);
|
||||
if (metadata) {
|
||||
MOZ_ASSERT(metadata->GetMetrics().GetScrollId() == scrollId);
|
||||
|
|
|
@ -60,8 +60,6 @@ static void PrintDisplayItemTo(nsDisplayListBuilder* aBuilder,
|
|||
}
|
||||
bool snap;
|
||||
nsRect rect = aItem->GetBounds(aBuilder, &snap);
|
||||
nsRect layerRect = rect - (*aItem->GetAnimatedGeometryRoot())
|
||||
->GetOffsetToCrossDoc(aItem->ReferenceFrame());
|
||||
nsRect component = aItem->GetComponentAlphaBounds(aBuilder);
|
||||
nsDisplayList* list = aItem->GetChildren();
|
||||
const DisplayItemClip& clip = aItem->GetClip();
|
||||
|
@ -79,18 +77,16 @@ static void PrintDisplayItemTo(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
aStream << nsPrintfCString(
|
||||
"%s p=0x%p f=0x%p(%s) key=%d %sbounds(%d,%d,%d,%d) "
|
||||
"layerBounds(%d,%d,%d,%d) "
|
||||
"componentAlpha(%d,%d,%d,%d) clip(%s) asr(%s) clipChain(%s)%s ref=0x%p "
|
||||
"componentAlpha(%d,%d,%d,%d) clip(%s) asr(%s) clipChain(%s)%s "
|
||||
"agr=0x%p",
|
||||
aItem->Name(), aItem, (void*)f, NS_ConvertUTF16toUTF8(contentData).get(),
|
||||
aItem->GetPerFrameKey(),
|
||||
(aItem->ZIndex() ? nsPrintfCString("z=%d ", aItem->ZIndex()).get() : ""),
|
||||
rect.x, rect.y, rect.width, rect.height, layerRect.x, layerRect.y,
|
||||
layerRect.width, layerRect.height, component.x, component.y,
|
||||
rect.x, rect.y, rect.width, rect.height, component.x, component.y,
|
||||
component.width, component.height, clip.ToString().get(),
|
||||
ActiveScrolledRoot::ToString(aItem->GetActiveScrolledRoot()).get(),
|
||||
DisplayItemClipChain::ToString(aItem->GetClipChain()).get(),
|
||||
aItem->IsUniform(aBuilder) ? " uniform" : "", aItem->ReferenceFrame(),
|
||||
aItem->IsUniform(aBuilder) ? " uniform" : "",
|
||||
aItem->GetAnimatedGeometryRoot()->mFrame);
|
||||
|
||||
for (auto iter = opaque.RectIter(); !iter.Done(); iter.Next()) {
|
||||
|
|
|
@ -8540,7 +8540,8 @@ bool nsLayoutUtils::CanScrollOriginClobberApz(ScrollOrigin aScrollOrigin) {
|
|||
/* static */
|
||||
ScrollMetadata nsLayoutUtils::ComputeScrollMetadata(
|
||||
const nsIFrame* aForFrame, const nsIFrame* aScrollFrame,
|
||||
nsIContent* aContent, const nsIFrame* aReferenceFrame,
|
||||
nsIContent* aContent, const nsIFrame* aItemFrame,
|
||||
const nsPoint& aOffsetToReferenceFrame,
|
||||
WebRenderLayerManager* aLayerManager, ViewID aScrollParentId,
|
||||
const nsSize& aScrollPortSize, const Maybe<nsRect>& aClipRect,
|
||||
bool aIsRootContent) {
|
||||
|
@ -8798,8 +8799,8 @@ ScrollMetadata nsLayoutUtils::ComputeScrollMetadata(
|
|||
const nsIFrame* frameForCompositionBoundsCalculation =
|
||||
aScrollFrame ? aScrollFrame : aForFrame;
|
||||
nsRect compositionBounds(
|
||||
frameForCompositionBoundsCalculation->GetOffsetToCrossDoc(
|
||||
aReferenceFrame),
|
||||
frameForCompositionBoundsCalculation->GetOffsetToCrossDoc(aItemFrame) +
|
||||
aOffsetToReferenceFrame,
|
||||
frameForCompositionBoundsCalculation->GetSize());
|
||||
if (scrollableFrame) {
|
||||
// If we have a scrollable frame, restrict the composition bounds to its
|
||||
|
@ -8962,9 +8963,10 @@ Maybe<ScrollMetadata> nsLayoutUtils::GetRootMetadata(
|
|||
scrollPortSize = scrollableFrame->GetScrollPortRect().Size();
|
||||
}
|
||||
return Some(nsLayoutUtils::ComputeScrollMetadata(
|
||||
frame, rootScrollFrame, content, aBuilder->FindReferenceFrameFor(frame),
|
||||
aLayerManager, ScrollableLayerGuid::NULL_SCROLL_ID, scrollPortSize,
|
||||
Nothing(), isRootContent));
|
||||
frame, rootScrollFrame, content, frame,
|
||||
aBuilder->ToReferenceFrame(frame), aLayerManager,
|
||||
ScrollableLayerGuid::NULL_SCROLL_ID, scrollPortSize, Nothing(),
|
||||
isRootContent));
|
||||
}
|
||||
|
||||
return Nothing();
|
||||
|
|
|
@ -2760,7 +2760,8 @@ class nsLayoutUtils {
|
|||
|
||||
static ScrollMetadata ComputeScrollMetadata(
|
||||
const nsIFrame* aForFrame, const nsIFrame* aScrollFrame,
|
||||
nsIContent* aContent, const nsIFrame* aReferenceFrame,
|
||||
nsIContent* aContent, const nsIFrame* aItemFrame,
|
||||
const nsPoint& aOffsetToReferenceFrame,
|
||||
mozilla::layers::WebRenderLayerManager* aLayerManager,
|
||||
ViewID aScrollParentId, const nsSize& aScrollPortSize,
|
||||
const mozilla::Maybe<nsRect>& aClipRect, bool aIsRoot);
|
||||
|
|
|
@ -166,14 +166,15 @@ class nsDisplayListFocus : public nsPaintedDisplayItem {
|
|||
// the nsSelectsAreaFrame
|
||||
nsListControlFrame* listFrame = GetEnclosingListFrame(Frame());
|
||||
return listFrame->InkOverflowRectRelativeToSelf() +
|
||||
listFrame->GetOffsetToCrossDoc(ReferenceFrame());
|
||||
listFrame->GetOffsetToCrossDoc(Frame()) + ToReferenceFrame();
|
||||
}
|
||||
virtual void Paint(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aCtx) override {
|
||||
nsListControlFrame* listFrame = GetEnclosingListFrame(Frame());
|
||||
// listFrame must be non-null or we wouldn't get called.
|
||||
listFrame->PaintFocus(aCtx->GetDrawTarget(),
|
||||
aBuilder->ToReferenceFrame(listFrame));
|
||||
listFrame->PaintFocus(
|
||||
aCtx->GetDrawTarget(),
|
||||
listFrame->GetOffsetToCrossDoc(Frame()) + ToReferenceFrame());
|
||||
}
|
||||
NS_DISPLAY_DECL_NAME("ListFocus", TYPE_LIST_FOCUS)
|
||||
};
|
||||
|
|
|
@ -4498,8 +4498,8 @@ void ScrollFrameHelper::NotifyApzTransaction() {
|
|||
}
|
||||
|
||||
Maybe<ScrollMetadata> ScrollFrameHelper::ComputeScrollMetadata(
|
||||
WebRenderLayerManager* aLayerManager,
|
||||
const nsIFrame* aContainerReferenceFrame,
|
||||
WebRenderLayerManager* aLayerManager, const nsIFrame* aItemFrame,
|
||||
const nsPoint& aOffsetToReferenceFrame,
|
||||
const DisplayItemClip* aClip) const {
|
||||
if (!mWillBuildScrollableLayer) {
|
||||
return Nothing();
|
||||
|
@ -4516,9 +4516,9 @@ Maybe<ScrollMetadata> ScrollFrameHelper::ComputeScrollMetadata(
|
|||
MOZ_ASSERT(mScrolledFrame->GetContent());
|
||||
|
||||
return Some(nsLayoutUtils::ComputeScrollMetadata(
|
||||
mScrolledFrame, mOuter, mOuter->GetContent(), aContainerReferenceFrame,
|
||||
aLayerManager, mScrollParentID, mScrollPort.Size(), parentLayerClip,
|
||||
isRootContent));
|
||||
mScrolledFrame, mOuter, mOuter->GetContent(), aItemFrame,
|
||||
aOffsetToReferenceFrame, aLayerManager, mScrollParentID,
|
||||
mScrollPort.Size(), parentLayerClip, isRootContent));
|
||||
}
|
||||
|
||||
bool ScrollFrameHelper::IsRectNearlyVisible(const nsRect& aRect) const {
|
||||
|
|
|
@ -484,8 +484,8 @@ class ScrollFrameHelper : public nsIReflowCallback {
|
|||
bool aApzAnimationInProgress);
|
||||
bool WantAsyncScroll() const;
|
||||
Maybe<mozilla::layers::ScrollMetadata> ComputeScrollMetadata(
|
||||
WebRenderLayerManager* aLayerManager,
|
||||
const nsIFrame* aContainerReferenceFrame,
|
||||
WebRenderLayerManager* aLayerManager, const nsIFrame* aItemFrame,
|
||||
const nsPoint& aOffsetToReferenceFrame,
|
||||
const mozilla::DisplayItemClip* aClip) const;
|
||||
// nsIScrollbarMediator
|
||||
void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
|
||||
|
@ -1085,10 +1085,10 @@ class nsHTMLScrollFrame : public nsContainerFrame,
|
|||
bool WantAsyncScroll() const final { return mHelper.WantAsyncScroll(); }
|
||||
mozilla::Maybe<mozilla::layers::ScrollMetadata> ComputeScrollMetadata(
|
||||
mozilla::layers::WebRenderLayerManager* aLayerManager,
|
||||
const nsIFrame* aContainerReferenceFrame,
|
||||
const nsIFrame* aItemFrame, const nsPoint& aOffsetToReferenceFrame,
|
||||
const mozilla::DisplayItemClip* aClip) const final {
|
||||
return mHelper.ComputeScrollMetadata(aLayerManager,
|
||||
aContainerReferenceFrame, aClip);
|
||||
return mHelper.ComputeScrollMetadata(aLayerManager, aItemFrame,
|
||||
aOffsetToReferenceFrame, aClip);
|
||||
}
|
||||
void MarkScrollbarsDirtyForReflow() const final {
|
||||
mHelper.MarkScrollbarsDirtyForReflow();
|
||||
|
@ -1563,10 +1563,10 @@ class nsXULScrollFrame final : public nsBoxFrame,
|
|||
bool WantAsyncScroll() const final { return mHelper.WantAsyncScroll(); }
|
||||
mozilla::Maybe<mozilla::layers::ScrollMetadata> ComputeScrollMetadata(
|
||||
mozilla::layers::WebRenderLayerManager* aLayerManager,
|
||||
const nsIFrame* aContainerReferenceFrame,
|
||||
const nsIFrame* aItemFrame, const nsPoint& aOffsetToReferenceFrame,
|
||||
const mozilla::DisplayItemClip* aClip) const final {
|
||||
return mHelper.ComputeScrollMetadata(aLayerManager,
|
||||
aContainerReferenceFrame, aClip);
|
||||
return mHelper.ComputeScrollMetadata(aLayerManager, aItemFrame,
|
||||
aOffsetToReferenceFrame, aClip);
|
||||
}
|
||||
void MarkScrollbarsDirtyForReflow() const final {
|
||||
mHelper.MarkScrollbarsDirtyForReflow();
|
||||
|
|
|
@ -476,7 +476,7 @@ class nsIScrollableFrame : public nsIScrollbarMediator {
|
|||
*/
|
||||
virtual mozilla::Maybe<mozilla::layers::ScrollMetadata> ComputeScrollMetadata(
|
||||
mozilla::layers::WebRenderLayerManager* aLayerManager,
|
||||
const nsIFrame* aContainerReferenceFrame,
|
||||
const nsIFrame* aItemFrame, const nsPoint& aOffsetToReferenceFrame,
|
||||
const mozilla::DisplayItemClip* aClip) const = 0;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1078,12 +1078,8 @@ static bool ProcessFrameInternal(nsIFrame* aFrame,
|
|||
// wrapper item and convert into into coordinate relative to the current
|
||||
// frame.
|
||||
nsRect previousVisible = wrapperItem->GetBuildingRectForChildren();
|
||||
if (wrapperItem->ReferenceFrameForChildren() ==
|
||||
wrapperItem->ReferenceFrame()) {
|
||||
if (wrapperItem->ReferenceFrameForChildren() != wrapperItem->Frame()) {
|
||||
previousVisible -= wrapperItem->ToReferenceFrame();
|
||||
} else {
|
||||
MOZ_ASSERT(wrapperItem->ReferenceFrameForChildren() ==
|
||||
wrapperItem->Frame());
|
||||
}
|
||||
|
||||
if (!previousVisible.Contains(aOverflow)) {
|
||||
|
|
|
@ -2760,7 +2760,7 @@ nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
|||
mFrame->AddDisplayItem(this);
|
||||
}
|
||||
|
||||
mReferenceFrame = aBuilder->FindReferenceFrameFor(aFrame, &mToReferenceFrame);
|
||||
aBuilder->FindReferenceFrameFor(aFrame, &mToReferenceFrame);
|
||||
// This can return the wrong result if the item override
|
||||
// ShouldFixToViewport(), the item needs to set it again in its constructor.
|
||||
mAnimatedGeometryRoot = aBuilder->FindAnimatedGeometryRootFor(aFrame);
|
||||
|
@ -4752,19 +4752,6 @@ nsDisplayWrapList::nsDisplayWrapList(
|
|||
mListPtr->AppendToTop(aList);
|
||||
mOriginalClipChain = mClipChain;
|
||||
nsDisplayWrapList::UpdateBounds(aBuilder);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (!aFrame || !aFrame->IsTransformed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsDisplayItem* item = mListPtr->GetBottom();
|
||||
if (item && item->Frame() == mFrame &&
|
||||
(mListPtr->Count() == 1 ||
|
||||
item->GetType() == DisplayItemType::TYPE_TRANSFORM)) {
|
||||
MOZ_ASSERT(mReferenceFrame == item->ReferenceFrame());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder,
|
||||
|
@ -4788,7 +4775,6 @@ nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
// See the previous nsDisplayWrapList constructor
|
||||
if (aItem->Frame() == aFrame) {
|
||||
mReferenceFrame = aItem->ReferenceFrame();
|
||||
mToReferenceFrame = aItem->ToReferenceFrame();
|
||||
}
|
||||
|
||||
|
@ -5914,7 +5900,8 @@ bool nsDisplayStickyPosition::CreateWebRenderCommands(
|
|||
stickyScrollContainer->GetScrollRanges(mFrame, &outer, &inner);
|
||||
|
||||
nsIFrame* scrollFrame = do_QueryFrame(stickyScrollContainer->ScrollFrame());
|
||||
nsPoint offset = scrollFrame->GetOffsetToCrossDoc(ReferenceFrame());
|
||||
nsPoint offset =
|
||||
scrollFrame->GetOffsetToCrossDoc(Frame()) + ToReferenceFrame();
|
||||
|
||||
// Adjust the scrollPort coordinates to be relative to the reference frame,
|
||||
// so that it is in the same space as everything else.
|
||||
|
@ -6133,9 +6120,9 @@ nsDisplayScrollInfoLayer::nsDisplayScrollInfoLayer(
|
|||
UniquePtr<ScrollMetadata> nsDisplayScrollInfoLayer::ComputeScrollMetadata(
|
||||
nsDisplayListBuilder* aBuilder, WebRenderLayerManager* aLayerManager) {
|
||||
ScrollMetadata metadata = nsLayoutUtils::ComputeScrollMetadata(
|
||||
mScrolledFrame, mScrollFrame, mScrollFrame->GetContent(),
|
||||
ReferenceFrame(), aLayerManager, mScrollParentId, mScrollFrame->GetSize(),
|
||||
Nothing(), false);
|
||||
mScrolledFrame, mScrollFrame, mScrollFrame->GetContent(), Frame(),
|
||||
ToReferenceFrame(), aLayerManager, mScrollParentId,
|
||||
mScrollFrame->GetSize(), Nothing(), false);
|
||||
metadata.GetMetrics().SetIsScrollInfoLayer(true);
|
||||
nsIScrollableFrame* scrollableFrame = mScrollFrame->GetScrollTargetFrame();
|
||||
if (scrollableFrame) {
|
||||
|
@ -6324,11 +6311,9 @@ void nsDisplayTransform::SetReferenceFrameToAncestor(
|
|||
// Can we instead apply the additional offset to us and not our children, like
|
||||
// we do for all other offsets (and how reference frames are supposed to
|
||||
// work)?
|
||||
#ifdef DEBUG
|
||||
nsIFrame* outerFrame = nsLayoutUtils::GetCrossDocParentFrameInProcess(mFrame);
|
||||
MOZ_ASSERT(mReferenceFrame == aBuilder->FindReferenceFrameFor(outerFrame));
|
||||
#endif
|
||||
mToReferenceFrame = mFrame->GetOffsetToCrossDoc(mReferenceFrame);
|
||||
const nsIFrame* referenceFrame = aBuilder->FindReferenceFrameFor(outerFrame);
|
||||
mToReferenceFrame = mFrame->GetOffsetToCrossDoc(referenceFrame);
|
||||
|
||||
if (DisplayPortUtils::IsFixedPosFrameInDisplayPort(mFrame)) {
|
||||
// This is an odd special case. If we are both IsFixedPosFrameInDisplayPort
|
||||
|
|
|
@ -2383,7 +2383,6 @@ class nsDisplayItem : public nsDisplayItemLink {
|
|||
mExtraPageForPageNum(aOther.mExtraPageForPageNum),
|
||||
mPerFrameIndex(aOther.mPerFrameIndex),
|
||||
mBuildingRect(aOther.mBuildingRect),
|
||||
mReferenceFrame(aOther.mReferenceFrame),
|
||||
mToReferenceFrame(aOther.mToReferenceFrame),
|
||||
mAnimatedGeometryRoot(aOther.mAnimatedGeometryRoot),
|
||||
mActiveScrolledRoot(aOther.mActiveScrolledRoot),
|
||||
|
@ -2797,18 +2796,11 @@ class nsDisplayItem : public nsDisplayItemLink {
|
|||
NS_ASSERTION(mFrame, "No frame?");
|
||||
return mToReferenceFrame;
|
||||
}
|
||||
/**
|
||||
* @return the root of the display list's frame (sub)tree, whose origin
|
||||
* establishes the coordinate system for the display list
|
||||
*/
|
||||
const nsIFrame* ReferenceFrame() const { return mReferenceFrame; }
|
||||
|
||||
/**
|
||||
* Returns the reference frame for display item children of this item.
|
||||
*/
|
||||
virtual const nsIFrame* ReferenceFrameForChildren() const {
|
||||
return mReferenceFrame;
|
||||
}
|
||||
virtual const nsIFrame* ReferenceFrameForChildren() const { return nullptr; }
|
||||
|
||||
AnimatedGeometryRoot* GetAnimatedGeometryRoot() const {
|
||||
MOZ_ASSERT(mAnimatedGeometryRoot,
|
||||
|
@ -2953,7 +2945,6 @@ class nsDisplayItem : public nsDisplayItemLink {
|
|||
void SetHasHitTestInfo() { mItemFlags += ItemFlag::HasHitTestInfo; }
|
||||
|
||||
// Result of ToReferenceFrame(mFrame), if mFrame is non-null
|
||||
const nsIFrame* mReferenceFrame;
|
||||
nsPoint mToReferenceFrame;
|
||||
|
||||
RefPtr<AnimatedGeometryRoot> mAnimatedGeometryRoot;
|
||||
|
@ -4982,11 +4973,6 @@ class nsDisplayWrapList : public nsPaintedDisplayItem {
|
|||
nsRect GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder) const override;
|
||||
|
||||
RetainedDisplayList* GetSameCoordinateSystemChildren() const override {
|
||||
NS_ASSERTION(
|
||||
mListPtr->IsEmpty() || !ReferenceFrame() ||
|
||||
!mListPtr->GetBottom()->ReferenceFrame() ||
|
||||
mListPtr->GetBottom()->ReferenceFrame() == ReferenceFrame(),
|
||||
"Children must have same reference frame");
|
||||
return mListPtr;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче