зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1195431 - Extract a couple of helper functions. r=tn
--HG-- extra : commitid : FK958utOKA5
This commit is contained in:
Родитель
d0d01ca3fc
Коммит
d674ba3676
|
@ -3019,6 +3019,25 @@ nsLayoutUtils::CalculateAndSetDisplayPortMargins(nsIScrollableFrame* aScrollFram
|
|||
content, presShell, displayportMargins, 0, aRepaintMode);
|
||||
}
|
||||
|
||||
bool
|
||||
nsLayoutUtils::WantDisplayPort(const nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aScrollFrame)
|
||||
{
|
||||
nsIScrollableFrame* scrollableFrame = do_QueryFrame(aScrollFrame);
|
||||
if (!scrollableFrame) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We perform an optimization where we ensure that at least one
|
||||
// async-scrollable frame (i.e. one that WantAsyncScroll()) has a displayport.
|
||||
// If that's not the case yet, and we are async-scrollable, we will get a
|
||||
// displayport.
|
||||
return aBuilder->IsPaintingToWindow() &&
|
||||
nsLayoutUtils::AsyncPanZoomEnabled(aScrollFrame) &&
|
||||
!aBuilder->HaveScrollableDisplayPort() &&
|
||||
scrollableFrame->WantAsyncScroll();
|
||||
}
|
||||
|
||||
bool
|
||||
nsLayoutUtils::GetOrMaybeCreateDisplayPort(nsDisplayListBuilder& aBuilder,
|
||||
nsIFrame* aScrollFrame,
|
||||
|
@ -3037,17 +3056,7 @@ nsLayoutUtils::GetOrMaybeCreateDisplayPort(nsDisplayListBuilder& aBuilder,
|
|||
|
||||
bool haveDisplayPort = GetDisplayPort(content, aOutDisplayport);
|
||||
|
||||
// We perform an optimization where we ensure that at least one
|
||||
// async-scrollable frame (i.e. one that WantsAsyncScroll()) has a displayport.
|
||||
// If that's not the case yet, and we are async-scrollable, we will get a
|
||||
// displayport.
|
||||
// Note: we only do this in processes where we do subframe scrolling to
|
||||
// begin with (i.e., not in the parent process on B2G).
|
||||
if (aBuilder.IsPaintingToWindow() &&
|
||||
nsLayoutUtils::AsyncPanZoomEnabled(aScrollFrame) &&
|
||||
!aBuilder.HaveScrollableDisplayPort() &&
|
||||
scrollableFrame->WantAsyncScroll()) {
|
||||
|
||||
if (WantDisplayPort(&aBuilder, aScrollFrame)) {
|
||||
// If we don't already have a displayport, calculate and set one.
|
||||
if (!haveDisplayPort) {
|
||||
CalculateAndSetDisplayPortMargins(scrollableFrame, nsLayoutUtils::RepaintMode::DoNotRepaint);
|
||||
|
|
|
@ -2654,6 +2654,12 @@ public:
|
|||
static bool CalculateAndSetDisplayPortMargins(nsIScrollableFrame* aScrollFrame,
|
||||
RepaintMode aRepaintMode);
|
||||
|
||||
/**
|
||||
* Return true if GetOrMaybeCreateDisplayPort would create a displayport.
|
||||
*/
|
||||
static bool WantDisplayPort(const nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aScrollFrame);
|
||||
|
||||
/**
|
||||
* Get the display port for |aScrollFrame|'s content. If |aScrollFrame|
|
||||
* WantsAsyncScroll() and we don't have a scrollable displayport yet (as
|
||||
|
|
|
@ -2778,6 +2778,13 @@ ClipListsExceptCaret(nsDisplayListCollection* aLists,
|
|||
ClipItemsExceptCaret(aLists->Content(), aBuilder, aClipFrame, clip, aUsingDisplayPort);
|
||||
}
|
||||
|
||||
bool
|
||||
ScrollFrameHelper::IsUsingDisplayPort(const nsDisplayListBuilder* aBuilder) const
|
||||
{
|
||||
return aBuilder->IsPaintingToWindow() &&
|
||||
nsLayoutUtils::GetDisplayPort(mOuter->GetContent());
|
||||
}
|
||||
|
||||
void
|
||||
ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aDirtyRect,
|
||||
|
@ -2818,8 +2825,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
bool createLayersForScrollbars = mIsRoot &&
|
||||
mOuter->PresContext()->IsRootContentDocument();
|
||||
|
||||
bool usingDisplayPort = aBuilder->IsPaintingToWindow() &&
|
||||
nsLayoutUtils::GetDisplayPort(mOuter->GetContent());
|
||||
bool usingDisplayPort = IsUsingDisplayPort(aBuilder);
|
||||
|
||||
if (aBuilder->GetIgnoreScrollFrame() == mOuter || IsIgnoringViewportClipping()) {
|
||||
// Root scrollframes have FrameMetrics and clipping on their container
|
||||
|
|
|
@ -81,6 +81,8 @@ public:
|
|||
bool aCreateLayer,
|
||||
bool aPositioned);
|
||||
|
||||
bool IsUsingDisplayPort(const nsDisplayListBuilder* aBuilder) const;
|
||||
|
||||
bool GetBorderRadii(const nsSize& aFrameSize, const nsSize& aBorderArea,
|
||||
Sides aSkipSides, nscoord aRadii[8]) const;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче