mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 1022612. Part 30: Expose IsConstructingScrollLayerForScrolledFrame and IsDisplayPortOpaque on nsDisplayScrollLayer. r=mattwoodrow
--HG-- extra : rebase_source : 87d76ad3e9d560f34dad56c25cb96516871e280a
This commit is contained in:
parent
aaeac2837d
commit
808792d22f
@ -3708,6 +3708,7 @@ nsDisplayScrollLayer::nsDisplayScrollLayer(nsDisplayListBuilder* aBuilder,
|
||||
, mScrollFrame(aScrollFrame)
|
||||
, mScrolledFrame(aScrolledFrame)
|
||||
, mScrollParentId(aBuilder->GetCurrentScrollParentId())
|
||||
, mDisplayPortContentsOpaque(false)
|
||||
{
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
MOZ_COUNT_CTOR(nsDisplayScrollLayer);
|
||||
@ -3726,6 +3727,7 @@ nsDisplayScrollLayer::nsDisplayScrollLayer(nsDisplayListBuilder* aBuilder,
|
||||
, mScrollFrame(aScrollFrame)
|
||||
, mScrolledFrame(aScrolledFrame)
|
||||
, mScrollParentId(aBuilder->GetCurrentScrollParentId())
|
||||
, mDisplayPortContentsOpaque(false)
|
||||
{
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
MOZ_COUNT_CTOR(nsDisplayScrollLayer);
|
||||
@ -3743,6 +3745,7 @@ nsDisplayScrollLayer::nsDisplayScrollLayer(nsDisplayListBuilder* aBuilder,
|
||||
, mScrollFrame(aScrollFrame)
|
||||
, mScrolledFrame(aScrolledFrame)
|
||||
, mScrollParentId(aBuilder->GetCurrentScrollParentId())
|
||||
, mDisplayPortContentsOpaque(false)
|
||||
{
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
MOZ_COUNT_CTOR(nsDisplayScrollLayer);
|
||||
@ -3770,6 +3773,22 @@ nsDisplayScrollLayer::GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap)
|
||||
return nsDisplayWrapList::GetBounds(aBuilder, aSnap);
|
||||
}
|
||||
|
||||
nsRect
|
||||
nsDisplayScrollLayer::GetScrolledContentRectToDraw(nsDisplayListBuilder* aBuilder,
|
||||
nsRect* aDisplayPort)
|
||||
{
|
||||
if (aDisplayPort) {
|
||||
// The visible region for the children may be much bigger than the hole we
|
||||
// are viewing the children from, so that the compositor process has enough
|
||||
// content to asynchronously pan while content is being refreshed.
|
||||
// XXX mScrollFrame seems wrong here; we should add the offset of the
|
||||
// scrollport
|
||||
return *aDisplayPort + mScrollFrame->GetOffsetToCrossDoc(ReferenceFrame());
|
||||
}
|
||||
bool snap;
|
||||
return GetBounds(aBuilder, &snap);
|
||||
}
|
||||
|
||||
already_AddRefed<Layer>
|
||||
nsDisplayScrollLayer::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager,
|
||||
@ -3786,9 +3805,26 @@ nsDisplayScrollLayer::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||
RecordFrameMetrics(mScrolledFrame, mScrollFrame, ReferenceFrame(), layer,
|
||||
viewport, false, false, aContainerParameters);
|
||||
|
||||
if (mList.IsOpaque()) {
|
||||
nsRect displayport;
|
||||
bool usingDisplayport =
|
||||
nsLayoutUtils::GetDisplayPort(mScrolledFrame->GetContent(), &displayport);
|
||||
mDisplayPortContentsOpaque = mList.GetBounds(aBuilder).Contains(
|
||||
GetScrolledContentRectToDraw(aBuilder, usingDisplayport ? &displayport : nullptr));
|
||||
} else {
|
||||
mDisplayPortContentsOpaque = false;
|
||||
}
|
||||
|
||||
return layer.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
nsDisplayScrollLayer::IsConstructingScrollLayerForScrolledFrame(const nsIFrame* aScrolledFrame)
|
||||
{
|
||||
FrameProperties props = aScrolledFrame->Properties();
|
||||
return reinterpret_cast<intptr_t>(props.Get(nsIFrame::ScrollLayerCount())) != 0;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDisplayScrollLayer::ShouldBuildLayerEvenIfInvisible(nsDisplayListBuilder* aBuilder)
|
||||
{
|
||||
@ -3807,20 +3843,12 @@ nsDisplayScrollLayer::ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
||||
nsRect displayport;
|
||||
bool usingDisplayPort =
|
||||
nsLayoutUtils::GetDisplayPort(mScrolledFrame->GetContent(), &displayport);
|
||||
nsRegion childVisibleRegion;
|
||||
if (usingDisplayPort) {
|
||||
// The visible region for the children may be much bigger than the hole we
|
||||
// are viewing the children from, so that the compositor process has enough
|
||||
// content to asynchronously pan while content is being refreshed.
|
||||
childVisibleRegion = displayport + mScrollFrame->GetOffsetToCrossDoc(ReferenceFrame());
|
||||
} else {
|
||||
bool snap;
|
||||
childVisibleRegion = GetBounds(aBuilder, &snap);
|
||||
}
|
||||
nsRect scrolledContentRect = GetScrolledContentRectToDraw(aBuilder,
|
||||
usingDisplayPort ? &displayport : nullptr);
|
||||
|
||||
nsRect boundedRect =
|
||||
childVisibleRegion.GetBounds().Intersect(mList.GetBounds(aBuilder));
|
||||
nsRect boundedRect = scrolledContentRect.Intersect(mList.GetBounds(aBuilder));
|
||||
nsRect allowExpansion = boundedRect.Intersect(aAllowVisibleRegionExpansion);
|
||||
nsRegion childVisibleRegion = scrolledContentRect;
|
||||
bool visible = mList.ComputeVisibilityForSublist(
|
||||
aBuilder, &childVisibleRegion, boundedRect, allowExpansion,
|
||||
usingDisplayPort ? mScrollFrame : nullptr);
|
||||
|
@ -3041,6 +3041,8 @@ public:
|
||||
// after merging, all the nsDisplayScrollLayers should flatten away.
|
||||
intptr_t GetScrollLayerCount();
|
||||
|
||||
static bool IsConstructingScrollLayerForScrolledFrame(const nsIFrame* aScrolledFrame);
|
||||
|
||||
virtual nsIFrame* GetScrollFrame() { return mScrollFrame; }
|
||||
virtual nsIFrame* GetScrolledFrame() { return mScrolledFrame; }
|
||||
|
||||
@ -3048,10 +3050,16 @@ public:
|
||||
virtual void WriteDebugInfo(nsACString& aTo) MOZ_OVERRIDE;
|
||||
#endif
|
||||
|
||||
bool IsDisplayPortOpaque() { return mDisplayPortContentsOpaque; }
|
||||
|
||||
protected:
|
||||
nsRect GetScrolledContentRectToDraw(nsDisplayListBuilder* aBuilder,
|
||||
nsRect* aDisplayPort);
|
||||
|
||||
nsIFrame* mScrollFrame;
|
||||
nsIFrame* mScrolledFrame;
|
||||
ViewID mScrollParentId;
|
||||
bool mDisplayPortContentsOpaque;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user