Bug 1896516 Part 7 - Remove PresShell::GetRootScrollFrameAsScrollable(). r=layout-reviewers,emilio

`PresShell::GetRootScrollFrameAsScrollable()` is equivalent to
`PresShell::GetRootScrollContainerFrame()`.

In ScrollContainerFrame.h, `DecideScrollableLayer()` has two versions, one has
four parameters, and the other has five parameters with the fifth parameter
`aDirtyRectHasBeenOverriden` having a default value `nullptr`. When we switch
the caller from `nsIScrollableFrame` to `ScrollContainerFrame`, we need to
remove the default value for the fifth parameter to avoid ambiguity.

Differential Revision: https://phabricator.services.mozilla.com/D211494
This commit is contained in:
Ting-Yu Lin 2024-05-30 06:32:20 +00:00
parent 00acdab2d5
commit 6306934820
29 changed files with 138 additions and 166 deletions

View file

@ -21,6 +21,7 @@
#include "nsIDocShellTreeItem.h"
#include "mozilla/Maybe.h"
#include "mozilla/PresShell.h"
#include "mozilla/ScrollContainerFrame.h"
#include "mozilla/StackWalk.h"
#include "mozilla/ToString.h"
#include "mozilla/dom/BorrowedAttrInfo.h"
@ -194,12 +195,12 @@ static void LogPresShell(dom::Document* aDocumentNode) {
PresShell* presShell = aDocumentNode->GetPresShell();
printf("presshell: %p", static_cast<void*>(presShell));
nsIScrollableFrame* sf = nullptr;
ScrollContainerFrame* sf = nullptr;
if (presShell) {
printf(", is %s destroying", (presShell->IsDestroying() ? "" : "not"));
sf = presShell->GetRootScrollFrameAsScrollable();
sf = presShell->GetRootScrollContainerFrame();
}
printf(", root scroll frame: %p", static_cast<void*>(sf));
printf(", root scroll container frame: %p", static_cast<void*>(sf));
}
static void LogDocLoadGroup(dom::Document* aDocumentNode) {

View file

@ -581,7 +581,7 @@ nsRect DocAccessible::RelativeBounds(nsIFrame** aRelativeFrame) const {
}
nsRect scrollPort;
nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollable();
ScrollContainerFrame* sf = presShell->GetRootScrollContainerFrame();
if (sf) {
scrollPort = sf->GetScrollPortRect();
} else {

View file

@ -3471,7 +3471,7 @@ already_AddRefed<AccAttributes> LocalAccessible::BundleFieldsForCache(
if (nsIFrame* rootFrame = presShell->GetRootFrame()) {
nsTArray<nsIFrame*> frames;
nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollable();
ScrollContainerFrame* sf = presShell->GetRootScrollContainerFrame();
nsRect scrollPort = sf ? sf->GetScrollPortRect() : rootFrame->GetRect();
nsLayoutUtils::GetFramesForArea(

View file

@ -4907,7 +4907,7 @@ void nsDocShell::SetTitleOnHistoryEntry(bool aUpdateEntryInSessionHistory) {
nsPoint nsDocShell::GetCurScrollPos() {
nsPoint scrollPos;
if (nsIScrollableFrame* sf = GetRootScrollFrame()) {
if (ScrollContainerFrame* sf = GetRootScrollContainerFrame()) {
scrollPos = sf->GetVisualViewportOffset();
}
return scrollPos;
@ -4915,7 +4915,7 @@ nsPoint nsDocShell::GetCurScrollPos() {
nsresult nsDocShell::SetCurScrollPosEx(int32_t aCurHorizontalPos,
int32_t aCurVerticalPos) {
nsIScrollableFrame* sf = GetRootScrollFrame();
ScrollContainerFrame* sf = GetRootScrollContainerFrame();
NS_ENSURE_TRUE(sf, NS_ERROR_FAILURE);
ScrollMode scrollMode =
@ -7578,12 +7578,9 @@ nsresult nsDocShell::RestoreFromHistory() {
("resize widget(%d, %d, %d, %d)", newBounds.x, newBounds.y,
newBounds.width, newBounds.height));
mDocumentViewer->SetBounds(newBounds);
} else {
nsIScrollableFrame* rootScrollFrame =
presShell->GetRootScrollFrameAsScrollable();
if (rootScrollFrame) {
rootScrollFrame->PostScrolledAreaEventForCurrentArea();
}
} else if (ScrollContainerFrame* sf =
presShell->GetRootScrollContainerFrame()) {
sf->PostScrolledAreaEventForCurrentArea();
}
}
@ -10707,7 +10704,7 @@ nsresult nsDocShell::ScrollToAnchor(bool aCurHasRef, bool aNewHasRef,
return NS_OK;
}
nsIScrollableFrame* rootScroll = presShell->GetRootScrollFrameAsScrollable();
ScrollContainerFrame* rootScroll = presShell->GetRootScrollContainerFrame();
if (rootScroll) {
rootScroll->ClearDidHistoryRestore();
}
@ -12352,11 +12349,11 @@ nsresult nsDocShell::GetPromptAndStringBundle(nsIPrompt** aPrompt,
return NS_OK;
}
nsIScrollableFrame* nsDocShell::GetRootScrollFrame() {
ScrollContainerFrame* nsDocShell::GetRootScrollContainerFrame() {
PresShell* presShell = GetPresShell();
NS_ENSURE_TRUE(presShell, nullptr);
return presShell->GetRootScrollFrameAsScrollable();
return presShell->GetRootScrollContainerFrame();
}
nsresult nsDocShell::EnsureScriptEnvironment() {

View file

@ -42,6 +42,7 @@ namespace mozilla {
class Encoding;
class HTMLEditor;
class ObservedDocShell;
class ScrollContainerFrame;
enum class TaskCategory;
namespace dom {
class ClientInfo;
@ -63,7 +64,6 @@ class nsIDocumentViewer;
class nsIHttpChannel;
class nsIMutableArray;
class nsIPrompt;
class nsIScrollableFrame;
class nsIStringBundle;
class nsIURIFixup;
class nsIURIFixupInfo;
@ -970,7 +970,7 @@ class nsDocShell final : public nsDocLoader,
bool NavigationBlockedByPrinting(bool aDisplayErrorDialog = true);
bool IsNavigationAllowed(bool aDisplayPrintErrorDialog = true,
bool aCheckIfUnloadFired = true);
nsIScrollableFrame* GetRootScrollFrame();
mozilla::ScrollContainerFrame* GetRootScrollContainerFrame();
nsIChannel* GetCurrentDocChannel();
nsresult EnsureScriptEnvironment();
nsresult EnsureEditorData();

View file

@ -504,9 +504,9 @@ static Maybe<OopIframeMetrics> GetOopIframeMetrics(
}
nsRect inProcessRootRect;
if (nsIScrollableFrame* scrollFrame =
rootPresShell->GetRootScrollFrameAsScrollable()) {
inProcessRootRect = scrollFrame->GetScrollPortRect();
if (ScrollContainerFrame* rootScrollContainerFrame =
rootPresShell->GetRootScrollContainerFrame()) {
inProcessRootRect = rootScrollContainerFrame->GetScrollPortRect();
}
Maybe<LayoutDeviceRect> remoteDocumentVisibleRect =
@ -576,11 +576,11 @@ IntersectionInput DOMIntersectionObserver::ComputeInput(
// handle the OOP iframe positions.
if (PresShell* presShell = rootDocument->GetPresShell()) {
rootFrame = presShell->GetRootFrame();
// We use the root scrollable frame's scroll port to account the
// We use the root scroll container frame's scroll port to account the
// scrollbars in rootRect, if needed.
if (nsIScrollableFrame* scrollFrame =
presShell->GetRootScrollFrameAsScrollable()) {
rootRect = scrollFrame->GetScrollPortRect();
if (ScrollContainerFrame* rootScrollContainerFrame =
presShell->GetRootScrollContainerFrame()) {
rootRect = rootScrollContainerFrame->GetScrollPortRect();
} else if (rootFrame) {
rootRect = rootFrame->GetRectRelativeToSelf();
}

View file

@ -8,8 +8,8 @@
#include "mozilla/EventDispatcher.h"
#include "mozilla/PresShell.h"
#include "mozilla/ScrollContainerFrame.h"
#include "mozilla/ToString.h"
#include "nsIScrollableFrame.h"
#include "nsIDocShell.h"
#include "nsPresContext.h"
#include "nsRefreshDriver.h"
@ -78,7 +78,7 @@ CSSSize VisualViewport::VisualViewportSize() const {
? presShell->GetVisualViewportSizeUpdatedByDynamicToolbar()
: presShell->GetVisualViewportSize());
} else {
nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollable();
ScrollContainerFrame* sf = presShell->GetRootScrollContainerFrame();
if (sf) {
size = CSSRect::FromAppUnits(sf->GetScrollPortRect().Size());
}

View file

@ -1723,7 +1723,7 @@ static nsresult getScrollXYAppUnits(const nsWeakPtr& aWindow, bool aFlushLayout,
}
if (PresShell* presShell = doc->GetPresShell()) {
nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollable();
ScrollContainerFrame* sf = presShell->GetRootScrollContainerFrame();
if (sf) {
aScrollPos = sf->GetScrollPosition();
}
@ -2014,10 +2014,10 @@ nsDOMWindowUtils::GetScrollbarSize(bool aFlushLayout, int32_t* aWidth,
PresShell* presShell = doc->GetPresShell();
NS_ENSURE_TRUE(presShell, NS_ERROR_NOT_AVAILABLE);
nsIScrollableFrame* scrollFrame = presShell->GetRootScrollFrameAsScrollable();
NS_ENSURE_TRUE(scrollFrame, NS_OK);
ScrollContainerFrame* sf = presShell->GetRootScrollContainerFrame();
NS_ENSURE_TRUE(sf, NS_OK);
nsMargin sizes = scrollFrame->GetActualScrollbarSizes();
nsMargin sizes = sf->GetActualScrollbarSizes();
*aWidth = nsPresContext::AppUnitsToIntCSSPixels(sizes.LeftRight());
*aHeight = nsPresContext::AppUnitsToIntCSSPixels(sizes.TopBottom());
@ -2093,7 +2093,7 @@ nsDOMWindowUtils::GetRootBounds(DOMRect** aResult) {
nsRect bounds(0, 0, 0, 0);
PresShell* presShell = doc->GetPresShell();
if (presShell) {
nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollable();
ScrollContainerFrame* sf = presShell->GetRootScrollContainerFrame();
if (sf) {
bounds = sf->GetScrollRange();
bounds.SetWidth(bounds.Width() + sf->GetScrollPortRect().Width());

View file

@ -72,6 +72,7 @@
#include "mozilla/ProcessHangMonitor.h"
#include "mozilla/RefPtr.h"
#include "mozilla/Result.h"
#include "mozilla/ScrollContainerFrame.h"
#include "mozilla/ScrollTypes.h"
#include "mozilla/Components.h"
#include "mozilla/SizeOfState.h"
@ -263,7 +264,6 @@
#include "nsIScriptContext.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsIScrollableFrame.h"
#include "nsISerialEventTarget.h"
#include "nsISimpleEnumerator.h"
#include "nsISizeOfEventTarget.h"
@ -3817,7 +3817,7 @@ void nsGlobalWindowInner::ScrollTo(const ScrollToOptions& aOptions) {
? FlushType::Layout
: FlushType::Frames;
FlushPendingNotifications(flushType);
nsIScrollableFrame* sf = GetScrollFrame();
ScrollContainerFrame* sf = GetScrollContainerFrame();
if (sf) {
CSSIntPoint scrollPos = sf->GetRoundedScrollPositionCSSPixels();
@ -3847,7 +3847,7 @@ void nsGlobalWindowInner::ScrollTo(const CSSIntPoint& aScroll,
FlushType flushType =
(aScroll.x || aScroll.y) ? FlushType::Layout : FlushType::Frames;
FlushPendingNotifications(flushType);
nsIScrollableFrame* sf = GetScrollFrame();
ScrollContainerFrame* sf = GetScrollContainerFrame();
if (sf) {
// Here we calculate what the max pixel value is that we can
@ -3876,7 +3876,7 @@ void nsGlobalWindowInner::ScrollTo(const CSSIntPoint& aScroll,
void nsGlobalWindowInner::ScrollBy(double aXScrollDif, double aYScrollDif) {
FlushPendingNotifications(FlushType::Layout);
nsIScrollableFrame* sf = GetScrollFrame();
ScrollContainerFrame* sf = GetScrollContainerFrame();
if (sf) {
// It seems like it would make more sense for ScrollBy to use
@ -3891,7 +3891,7 @@ void nsGlobalWindowInner::ScrollBy(double aXScrollDif, double aYScrollDif) {
void nsGlobalWindowInner::ScrollBy(const ScrollToOptions& aOptions) {
FlushPendingNotifications(FlushType::Layout);
nsIScrollableFrame* sf = GetScrollFrame();
ScrollContainerFrame* sf = GetScrollContainerFrame();
if (sf) {
CSSIntPoint scrollDelta;
@ -3915,7 +3915,7 @@ void nsGlobalWindowInner::ScrollBy(const ScrollToOptions& aOptions) {
void nsGlobalWindowInner::ScrollByLines(int32_t numLines,
const ScrollOptions& aOptions) {
FlushPendingNotifications(FlushType::Layout);
nsIScrollableFrame* sf = GetScrollFrame();
ScrollContainerFrame* sf = GetScrollContainerFrame();
if (sf) {
// It seems like it would make more sense for ScrollByLines to use
// SMOOTH mode, but tests seem to depend on the synchronous behaviour.
@ -3931,7 +3931,7 @@ void nsGlobalWindowInner::ScrollByLines(int32_t numLines,
void nsGlobalWindowInner::ScrollByPages(int32_t numPages,
const ScrollOptions& aOptions) {
FlushPendingNotifications(FlushType::Layout);
nsIScrollableFrame* sf = GetScrollFrame();
ScrollContainerFrame* sf = GetScrollContainerFrame();
if (sf) {
// It seems like it would make more sense for ScrollByPages to use
// SMOOTH mode, but tests seem to depend on the synchronous behaviour.
@ -3946,7 +3946,7 @@ void nsGlobalWindowInner::ScrollByPages(int32_t numPages,
void nsGlobalWindowInner::MozScrollSnap() {
FlushPendingNotifications(FlushType::Layout);
nsIScrollableFrame* sf = GetScrollFrame();
ScrollContainerFrame* sf = GetScrollContainerFrame();
if (sf) {
sf->ScrollSnap();
}
@ -6379,8 +6379,8 @@ nsGlobalWindowInner::GetWebBrowserChrome() {
return browserChrome.forget();
}
nsIScrollableFrame* nsGlobalWindowInner::GetScrollFrame() {
FORWARD_TO_OUTER(GetScrollFrame, (), nullptr);
ScrollContainerFrame* nsGlobalWindowInner::GetScrollContainerFrame() {
FORWARD_TO_OUTER(GetScrollContainerFrame, (), nullptr);
}
bool nsGlobalWindowInner::IsPrivateBrowsing() {
@ -7592,7 +7592,7 @@ void nsGlobalWindowInner::SetScrollMarks(const nsTArray<uint32_t>& aScrollMarks,
if (mDoc) {
PresShell* presShell = mDoc->GetPresShell();
if (presShell) {
nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollable();
ScrollContainerFrame* sf = presShell->GetRootScrollContainerFrame();
if (sf) {
sf->InvalidateScrollbars();
}

View file

@ -58,7 +58,6 @@ class nsIContent;
class nsICSSDeclaration;
class nsIDocShellTreeOwner;
class nsIDOMWindowUtils;
class nsIScrollableFrame;
class nsIControllers;
class nsIScriptContext;
class nsIScriptTimeoutHandler;
@ -85,6 +84,7 @@ class PromiseDocumentFlushedResolver;
namespace mozilla {
class AbstractThread;
class ScrollContainerFrame;
class ErrorResult;
namespace glean {
@ -431,9 +431,10 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
bool IsChromeWindow() const { return mIsChrome; }
// GetScrollFrame does not flush. Callers should do it themselves as needed,
// depending on which info they actually want off the scrollable frame.
nsIScrollableFrame* GetScrollFrame();
// GetScrollContainerFrame does not flush. Callers should do it themselves as
// needed, depending on which info they actually want off the scroll container
// frame.
mozilla::ScrollContainerFrame* GetScrollContainerFrame();
nsresult Observe(nsISupports* aSubject, const char* aTopic,
const char16_t* aData);

View file

@ -137,7 +137,6 @@
#include "nsDOMString.h"
#include "nsThreadUtils.h"
#include "nsILoadContext.h"
#include "nsIScrollableFrame.h"
#include "nsView.h"
#include "nsViewManager.h"
#include "nsIPrompt.h"
@ -164,6 +163,7 @@
#include "nsIURIMutator.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/ScrollContainerFrame.h"
#include "nsIObserverService.h"
#include "nsFocusManager.h"
#include "nsIAppWindow.h"
@ -3793,7 +3793,7 @@ void nsGlobalWindowOuter::CheckSecurityLeftAndTop(int32_t* aLeft, int32_t* aTop,
int32_t nsGlobalWindowOuter::GetScrollBoundaryOuter(Side aSide) {
FlushPendingNotifications(FlushType::Layout);
if (nsIScrollableFrame* sf = GetScrollFrame()) {
if (ScrollContainerFrame* sf = GetScrollContainerFrame()) {
return nsPresContext::AppUnitsToIntCSSPixels(
sf->GetScrollRange().Edge(aSide));
}
@ -3807,7 +3807,7 @@ CSSPoint nsGlobalWindowOuter::GetScrollXY(bool aDoFlush) {
EnsureSizeAndPositionUpToDate();
}
nsIScrollableFrame* sf = GetScrollFrame();
ScrollContainerFrame* sf = GetScrollContainerFrame();
if (!sf) {
return CSSIntPoint(0, 0);
}
@ -7047,14 +7047,14 @@ nsPIDOMWindowOuter::GetWebBrowserChrome() {
return browserChrome.forget();
}
nsIScrollableFrame* nsGlobalWindowOuter::GetScrollFrame() {
ScrollContainerFrame* nsGlobalWindowOuter::GetScrollContainerFrame() {
if (!mDocShell) {
return nullptr;
}
PresShell* presShell = mDocShell->GetPresShell();
if (presShell) {
return presShell->GetRootScrollFrameAsScrollable();
return presShell->GetRootScrollContainerFrame();
}
return nullptr;
}

View file

@ -57,7 +57,6 @@ class nsIContent;
class nsICSSDeclaration;
class nsIDocShellTreeOwner;
class nsIDOMWindowUtils;
class nsIScrollableFrame;
class nsIControllers;
class nsIPrintSettings;
class nsIScriptContext;
@ -83,6 +82,7 @@ class AbstractThread;
class DOMEventTargetHelper;
class ErrorResult;
class ThrottledEventQueue;
class ScrollContainerFrame;
namespace dom {
class BarProp;
struct ChannelPixelLayout;
@ -412,9 +412,10 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget,
bool IsChromeWindow() const { return mIsChrome; }
// GetScrollFrame does not flush. Callers should do it themselves as needed,
// depending on which info they actually want off the scrollable frame.
nsIScrollableFrame* GetScrollFrame();
// GetScrollContainerFrame does not flush. Callers should do it themselves as
// needed, depending on which info they actually want off the scroll container
// frame.
mozilla::ScrollContainerFrame* GetScrollContainerFrame();
// Outer windows only.
void UnblockScriptedClosing();

View file

@ -29,6 +29,7 @@
#include "mozilla/dom/Event.h"
#include "mozilla/dom/ShadowRoot.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/ScrollContainerFrame.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/SVGUtils.h"
#include "mozilla/SVGOuterSVGFrame.h"
@ -40,7 +41,6 @@
#include "nsIFrame.h"
#include "nsIContent.h"
#include "nsIContentInlines.h"
#include "nsIScrollableFrame.h"
#include "nsJSEnvironment.h"
#include "nsLayoutUtils.h"
#include "nsPIWindowRoot.h"
@ -617,11 +617,8 @@ CSSIntPoint Event::GetPageCoords(nsPresContext* aPresContext,
// If there is some scrolling, add scroll info to client point.
if (aPresContext && aPresContext->GetPresShell()) {
PresShell* presShell = aPresContext->PresShell();
nsIScrollableFrame* scrollframe =
presShell->GetRootScrollFrameAsScrollable();
if (scrollframe) {
pagePoint +=
CSSIntPoint::FromAppUnitsRounded(scrollframe->GetScrollPosition());
if (ScrollContainerFrame* sf = presShell->GetRootScrollContainerFrame()) {
pagePoint += CSSIntPoint::FromAppUnitsRounded(sf->GetScrollPosition());
}
}

View file

@ -3335,8 +3335,7 @@ nsSize EventStateManager::GetScrollAmount(
const bool isPage = aEvent->mDeltaMode == WheelEvent_Binding::DOM_DELTA_PAGE;
if (!aScrollableFrame) {
// If there is no scrollable frame, we should use root, see below.
aScrollableFrame =
aPresContext->PresShell()->GetRootScrollFrameAsScrollable();
aScrollableFrame = aPresContext->PresShell()->GetRootScrollContainerFrame();
}
if (aScrollableFrame) {

View file

@ -15,6 +15,7 @@
#include "mozilla/dom/MouseEvent.h"
#include "mozilla/LoadInfo.h"
#include "mozilla/PresShell.h"
#include "mozilla/ScrollContainerFrame.h"
#include "mozilla/StaticPrefs_browser.h"
#include "nsICSSDeclaration.h"
#include "nsObjectLoadingContent.h"
@ -41,7 +42,6 @@
#include "nsIDocShell.h"
#include "nsIDocumentViewer.h"
#include "nsThreadUtils.h"
#include "nsIScrollableFrame.h"
#include "nsContentUtils.h"
#include "mozilla/Preferences.h"
#include <algorithm>
@ -297,7 +297,7 @@ void ImageDocument::ScrollImageTo(int32_t aX, int32_t aY) {
return;
}
nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollable();
ScrollContainerFrame* sf = presShell->GetRootScrollContainerFrame();
if (!sf) {
return;
}

View file

@ -687,14 +687,14 @@ static PartialPrerenderData GetPartialPrerenderData(
const nsIFrame* clipFrame =
nsLayoutUtils::GetNearestOverflowClipFrame(aFrame->GetParent());
const nsIScrollableFrame* scrollFrame = do_QueryFrame(clipFrame);
const ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(clipFrame);
if (!clipFrame) {
// If there is no suitable clip frame in the same document, use the
// root one.
scrollFrame = aFrame->PresShell()->GetRootScrollFrameAsScrollable();
if (scrollFrame) {
clipFrame = do_QueryFrame(scrollFrame);
scrollContainerFrame = aFrame->PresShell()->GetRootScrollContainerFrame();
if (scrollContainerFrame) {
clipFrame = scrollContainerFrame;
} else {
// If there is no root scroll frame, use the viewport frame.
clipFrame = aFrame->PresShell()->GetRootFrame();
@ -702,8 +702,8 @@ static PartialPrerenderData GetPartialPrerenderData(
}
// If the scroll frame is asyncronously scrollable, try to find the scroll id.
if (scrollFrame &&
!scrollFrame->GetScrollStyles().IsHiddenInBothDirections() &&
if (scrollContainerFrame &&
!scrollContainerFrame->GetScrollStyles().IsHiddenInBothDirections() &&
nsLayoutUtils::AsyncPanZoomEnabled(aFrame)) {
const bool isInPositionFixed =
nsLayoutUtils::IsInPositionFixedSubtree(aFrame);
@ -728,7 +728,7 @@ static PartialPrerenderData GetPartialPrerenderData(
int32_t devPixelsToAppUnits = aFrame->PresContext()->AppUnitsPerDevPixel();
auto [clipRect, transformInClip] = GetClipRectAndTransformForPartialPrerender(
aFrame, devPixelsToAppUnits, clipFrame, scrollFrame);
aFrame, devPixelsToAppUnits, clipFrame, scrollContainerFrame);
return PartialPrerenderData{
LayoutDeviceRect::FromAppUnits(partialPrerenderedRect,

View file

@ -2463,17 +2463,6 @@ ScrollContainerFrame* PresShell::GetRootScrollContainerFrame() const {
return static_cast<ScrollContainerFrame*>(theFrame);
}
nsIScrollableFrame* PresShell::GetRootScrollFrameAsScrollable() const {
nsIFrame* frame = GetRootScrollContainerFrame();
if (!frame) {
return nullptr;
}
nsIScrollableFrame* scrollableFrame = do_QueryFrame(frame);
NS_ASSERTION(scrollableFrame,
"All scroll frames must implement nsIScrollableFrame");
return scrollableFrame;
}
nsPageSequenceFrame* PresShell::GetPageSequenceFrame() const {
return mFrameConstructor->GetPageSequenceFrame();
}
@ -2483,9 +2472,8 @@ nsCanvasFrame* PresShell::GetCanvasFrame() const {
}
void PresShell::RestoreRootScrollPosition() {
nsIScrollableFrame* scrollableFrame = GetRootScrollFrameAsScrollable();
if (scrollableFrame) {
scrollableFrame->ScrollToRestoredPosition();
if (ScrollContainerFrame* sf = GetRootScrollContainerFrame()) {
sf->ScrollToRestoredPosition();
}
}
@ -3125,7 +3113,7 @@ nsresult PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll,
esm->SetContentState(target, ElementState::URLTARGET);
// TODO: Spec probably needs a section to account for this.
if (nsIScrollableFrame* rootScroll = GetRootScrollFrameAsScrollable()) {
if (ScrollContainerFrame* rootScroll = GetRootScrollContainerFrame()) {
if (rootScroll->DidHistoryRestore()) {
// Scroll position restored from history trumps scrolling to anchor.
aScroll = false;
@ -3146,7 +3134,7 @@ nsresult PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll,
ScrollAxis(),
ScrollFlags::AnchorScrollFlags | aAdditionalScrollFlags));
if (nsIScrollableFrame* rootScroll = GetRootScrollFrameAsScrollable()) {
if (ScrollContainerFrame* rootScroll = GetRootScrollContainerFrame()) {
mLastAnchorScrolledTo = target;
mLastAnchorScrollPositionY = rootScroll->GetScrollPosition().y;
}
@ -3227,7 +3215,7 @@ nsresult PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll,
#endif
} else if (nsContentUtils::EqualsIgnoreASCIICase(aAnchorName, u"top"_ns)) {
// 2.2. Scroll to the beginning of the document for the Document.
nsIScrollableFrame* sf = GetRootScrollFrameAsScrollable();
ScrollContainerFrame* sf = GetRootScrollContainerFrame();
// Check |aScroll| after setting |rv| so we set |rv| to the same
// thing whether or not |aScroll| is true.
if (aScroll && sf) {
@ -3250,7 +3238,7 @@ nsresult PresShell::ScrollToAnchor() {
}
NS_ASSERTION(mDidInitialize, "should have done initial reflow by now");
nsIScrollableFrame* rootScroll = GetRootScrollFrameAsScrollable();
ScrollContainerFrame* rootScroll = GetRootScrollContainerFrame();
if (!rootScroll ||
mLastAnchorScrollPositionY != rootScroll->GetScrollPosition().y) {
return NS_OK;
@ -5352,7 +5340,7 @@ void PresShell::AddCanvasBackgroundColorItem(nsDisplayListBuilder* aBuilder,
// nsDisplayCanvasBackground paint it.
bool addedScrollingBackgroundColor = false;
if (isViewport) {
if (nsIScrollableFrame* sf = GetRootScrollFrameAsScrollable()) {
if (ScrollContainerFrame* sf = GetRootScrollContainerFrame()) {
nsCanvasFrame* canvasFrame = do_QueryFrame(sf->GetScrolledFrame());
if (canvasFrame && canvasFrame->IsVisibleForPainting()) {
// TODO: We should be able to set canvas background color during display
@ -11362,9 +11350,8 @@ void PresShell::CompleteChangeToVisualViewportSize() {
// items). Callers that update the visual viewport during a reflow are
// responsible for maintaining these invariants.
if (!mIsReflowing) {
if (nsIScrollableFrame* rootScrollFrame =
GetRootScrollFrameAsScrollable()) {
rootScrollFrame->MarkScrollbarsDirtyForReflow();
if (ScrollContainerFrame* sf = GetRootScrollContainerFrame()) {
sf->MarkScrollbarsDirtyForReflow();
}
MarkFixedFramesForReflow(IntrinsicDirty::None);
}
@ -11402,11 +11389,13 @@ void PresShell::ResetVisualViewportSize() {
bool PresShell::SetVisualViewportOffset(const nsPoint& aScrollOffset,
const nsPoint& aPrevLayoutScrollPos) {
nsPoint newOffset = aScrollOffset;
nsIScrollableFrame* rootScrollFrame = GetRootScrollFrameAsScrollable();
if (rootScrollFrame) {
ScrollContainerFrame* rootScrollContainerFrame =
GetRootScrollContainerFrame();
if (rootScrollContainerFrame) {
// See the comment in ScrollContainerFrame::Reflow above the call to
// SetVisualViewportOffset for why we need to do this.
nsRect scrollRange = rootScrollFrame->GetScrollRangeForUserInputEvents();
nsRect scrollRange =
rootScrollContainerFrame->GetScrollRangeForUserInputEvents();
if (!scrollRange.Contains(newOffset)) {
newOffset.x = std::min(newOffset.x, scrollRange.XMost());
newOffset.x = std::max(newOffset.x, scrollRange.x);
@ -11433,14 +11422,13 @@ bool PresShell::SetVisualViewportOffset(const nsPoint& aScrollOffset,
window->VisualViewport()->PostScrollEvent(prevOffset, aPrevLayoutScrollPos);
}
if (IsVisualViewportSizeSet() && rootScrollFrame) {
rootScrollFrame->Anchor()->UserScrolled();
if (IsVisualViewportSizeSet() && rootScrollContainerFrame) {
rootScrollContainerFrame->Anchor()->UserScrolled();
}
if (gfxPlatform::UseDesktopZoomingScrollbars()) {
if (nsIScrollableFrame* rootScrollFrame =
GetRootScrollFrameAsScrollable()) {
rootScrollFrame->UpdateScrollbarPosition();
if (rootScrollContainerFrame) {
rootScrollContainerFrame->UpdateScrollbarPosition();
}
}
@ -11455,7 +11443,7 @@ void PresShell::ScrollToVisual(const nsPoint& aVisualViewportOffset,
MOZ_ASSERT(aMode == ScrollMode::Instant || aMode == ScrollMode::SmoothMsd);
if (aMode == ScrollMode::SmoothMsd) {
if (nsIScrollableFrame* sf = GetRootScrollFrameAsScrollable()) {
if (ScrollContainerFrame* sf = GetRootScrollContainerFrame()) {
if (sf->SmoothScrollVisual(aVisualViewportOffset, aUpdateType)) {
return;
}
@ -11497,7 +11485,7 @@ nsPoint PresShell::GetVisualViewportOffsetRelativeToLayoutViewport() const {
nsPoint PresShell::GetLayoutViewportOffset() const {
nsPoint result;
if (nsIScrollableFrame* sf = GetRootScrollFrameAsScrollable()) {
if (ScrollContainerFrame* sf = GetRootScrollContainerFrame()) {
result = sf->GetScrollPosition();
}
return result;
@ -11505,7 +11493,7 @@ nsPoint PresShell::GetLayoutViewportOffset() const {
nsSize PresShell::GetLayoutViewportSize() const {
nsSize result;
if (nsIScrollableFrame* sf = GetRootScrollFrameAsScrollable()) {
if (ScrollContainerFrame* sf = GetRootScrollContainerFrame()) {
result = sf->GetScrollPortRect().Size();
}
return result;

View file

@ -436,11 +436,6 @@ class PresShell final : public nsStubDocumentObserver,
*/
ScrollContainerFrame* GetRootScrollContainerFrame() const;
/*
* The same as GetRootScrollFrame, but returns an nsIScrollableFrame
*/
nsIScrollableFrame* GetRootScrollFrameAsScrollable() const;
/**
* Get the current focused content or DOM selection that should be the
* target for scrolling.

View file

@ -19,6 +19,7 @@
#include "mozilla/PresShell.h"
#include "mozilla/PresShellInlines.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/ScrollContainerFrame.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/ServoStyleSetInlines.h"
#include "mozilla/StaticPrefs_layout.h"
@ -1460,8 +1461,8 @@ static inline void TryToDealWithScrollbarChange(nsChangeHint& aHint,
// already exists, so we can simply reflow instead of reframing.
if (nsIScrollableFrame* sf = do_QueryFrame(aFrame)) {
sf->MarkScrollbarsDirtyForReflow();
} else if (nsIScrollableFrame* sf =
aPc->PresShell()->GetRootScrollFrameAsScrollable()) {
} else if (ScrollContainerFrame* sf =
aPc->PresShell()->GetRootScrollContainerFrame()) {
sf->MarkScrollbarsDirtyForReflow();
}
aHint |= nsChangeHint_ReflowHintsForScrollbarChange;

View file

@ -12,11 +12,11 @@
#include "mozilla/layers/ZoomConstraints.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/ScrollContainerFrame.h"
#include "mozilla/StaticPrefs_apz.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/Event.h"
#include "nsIFrame.h"
#include "nsIScrollableFrame.h"
#include "nsLayoutUtils.h"
#include "nsPoint.h"
#include "nsView.h"
@ -275,8 +275,8 @@ void ZoomConstraintsClient::RefreshZoomConstraints() {
// We only ever create a ZoomConstraintsClient for an RCD, so the RSF of
// the presShell must be the RCD-RSF (if it exists).
MOZ_ASSERT(mPresShell->GetPresContext()->IsRootContentDocumentCrossProcess());
if (nsIScrollableFrame* rcdrsf =
mPresShell->GetRootScrollFrameAsScrollable()) {
if (ScrollContainerFrame* rcdrsf =
mPresShell->GetRootScrollContainerFrame()) {
ZCC_LOG("Notifying RCD-RSF that it is zoomable: %d\n",
mZoomConstraints.mAllowZoom);
rcdrsf->SetZoomableByAPZ(mZoomConstraints.mAllowZoom);

View file

@ -48,6 +48,7 @@
#include "mozilla/Encoding.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Preferences.h"
#include "mozilla/ScrollContainerFrame.h"
#include "mozilla/SpinEventLoopUntil.h"
#include "mozilla/WeakPtr.h"
#include "mozilla/StaticPrefs_dom.h"
@ -86,7 +87,6 @@
#include "nsJSEnvironment.h"
#include "nsFocusManager.h"
#include "nsIScrollableFrame.h"
#include "nsStyleSheetService.h"
#include "nsILoadContext.h"
#include "mozilla/ThrottledEventQueue.h"
@ -2954,18 +2954,19 @@ static const nsIFrame* GetTargetPageFrame(int32_t aTargetPageNum,
}
// Calculate the scroll position where the center of |aFrame| is positioned at
// the center of |aScrollable|'s scroll port for the print preview.
// the center of |aScrollContainerFrame|'s scroll port for the print preview.
// So what we do for that is;
// 1) Calculate the position of the center of |aFrame| in the print preview
// coordinates.
// 2) Reduce the half height of the scroll port from the result of 1.
static nscoord ScrollPositionForFrame(const nsIFrame* aFrame,
nsIScrollableFrame* aScrollable,
static nscoord ScrollPositionForFrame(
const nsIFrame* aFrame, ScrollContainerFrame* aScrollContainerFrame,
float aPreviewScale) {
// Note that even if the computed scroll position is out of the range of
// the scroll port, it gets clamped in nsIScrollableFrame::ScrollTo.
return nscoord(aPreviewScale * aFrame->GetRect().Center().y -
float(aScrollable->GetScrollPortRect().height) / 2.0f);
float(aScrollContainerFrame->GetScrollPortRect().height) /
2.0f);
}
//----------------------------------------------------------------------
@ -2974,8 +2975,10 @@ nsDocumentViewer::PrintPreviewScrollToPage(int16_t aType, int32_t aPageNum) {
if (!GetIsPrintPreview() || mPrintJob->GetIsCreatingPrintPreview())
return NS_ERROR_FAILURE;
nsIScrollableFrame* sf = mPresShell->GetRootScrollFrameAsScrollable();
if (!sf) return NS_OK;
ScrollContainerFrame* sf = mPresShell->GetRootScrollContainerFrame();
if (!sf) {
return NS_OK;
}
auto [seqFrame, sheetCount] = mPrintJob->GetSeqFrameAndCountSheets();
Unused << sheetCount;
@ -3048,7 +3051,7 @@ nsDocumentViewer::GetCurrentSheetFrameAndNumber() const {
return {nullptr, 0};
}
nsIScrollableFrame* sf = mPresShell->GetRootScrollFrameAsScrollable();
ScrollContainerFrame* sf = mPresShell->GetRootScrollContainerFrame();
if (!sf) {
// No scrollable contents, returns 1 even if there are multiple sheets.
return {seqFrame->PrincipalChildList().FirstChild(), 1};

View file

@ -3061,14 +3061,12 @@ void nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
aFrame, builder);
}
nsIFrame* rootScrollContainerFrame = presShell->GetRootScrollContainerFrame();
ScrollContainerFrame* rootScrollContainerFrame =
presShell->GetRootScrollContainerFrame();
if (rootScrollContainerFrame && !aFrame->GetParent()) {
nsIScrollableFrame* rootScrollableFrame =
presShell->GetRootScrollFrameAsScrollable();
MOZ_ASSERT(rootScrollableFrame);
nsRect displayPortBase = rootInkOverflow;
nsRect temp = displayPortBase;
Unused << rootScrollableFrame->DecideScrollableLayer(
Unused << rootScrollContainerFrame->DecideScrollableLayer(
builder, &displayPortBase, &temp,
/* aSetBase = */ true);
}
@ -3089,11 +3087,9 @@ void nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
Maybe<nsPoint> originalScrollPosition;
auto maybeResetScrollPosition = MakeScopeExit([&]() {
if (originalScrollPosition && rootScrollContainerFrame) {
nsIScrollableFrame* rootScrollableFrame =
presShell->GetRootScrollFrameAsScrollable();
MOZ_ASSERT(rootScrollableFrame->GetScrolledFrame()->GetPosition() ==
MOZ_ASSERT(rootScrollContainerFrame->GetScrolledFrame()->GetPosition() ==
nsPoint());
rootScrollableFrame->GetScrolledFrame()->SetPosition(
rootScrollContainerFrame->GetScrolledFrame()->SetPosition(
*originalScrollPosition);
}
});
@ -3109,21 +3105,19 @@ void nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
}
if (ignoreViewportScrolling && rootScrollContainerFrame) {
nsIScrollableFrame* rootScrollableFrame =
presShell->GetRootScrollFrameAsScrollable();
if (aFlags & PaintFrameFlags::ResetViewportScrolling) {
// Temporarily scroll the root scroll frame to 0,0 so that position:fixed
// elements will appear fixed to the top-left of the document. We manually
// set the position of the scrolled frame instead of using ScrollTo, since
// the latter fires scroll listeners, which we don't want.
originalScrollPosition.emplace(
rootScrollableFrame->GetScrolledFrame()->GetPosition());
rootScrollableFrame->GetScrolledFrame()->SetPosition(nsPoint());
rootScrollContainerFrame->GetScrolledFrame()->GetPosition());
rootScrollContainerFrame->GetScrolledFrame()->SetPosition(nsPoint());
}
if (aFlags & PaintFrameFlags::DocumentRelative) {
// Make visibleRegion and aRenderingContext relative to the
// scrolled frame instead of the root frame.
nsPoint pos = rootScrollableFrame->GetScrollPosition();
nsPoint pos = rootScrollContainerFrame->GetScrollPosition();
visibleRegion.MoveBy(-pos);
if (aRenderingContext) {
gfxPoint devPixelOffset = nsLayoutUtils::PointToGfxPoint(
@ -3136,7 +3130,7 @@ void nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
builder->SetIgnoreScrollFrame(rootScrollContainerFrame);
nsCanvasFrame* canvasFrame =
do_QueryFrame(rootScrollableFrame->GetScrolledFrame());
do_QueryFrame(rootScrollContainerFrame->GetScrolledFrame());
if (canvasFrame) {
// Use UnionRect here to ensure that areas where the scrollbars
// were are still filled with the background color.

View file

@ -723,8 +723,7 @@ class ScrollContainerFrame : public nsContainerFrame,
nsRect RestrictToRootDisplayPort(const nsRect& aDisplayportBase);
bool DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
nsRect* aVisibleRect, nsRect* aDirtyRect,
bool aSetBase,
bool* aDirtyRectHasBeenOverriden = nullptr);
bool aSetBase, bool* aDirtyRectHasBeenOverriden);
bool AllowDisplayPortExpiration();
void ResetDisplayPortExpiryTimer();

View file

@ -17,6 +17,7 @@
#include "mozilla/layers/RenderRootStateManager.h"
#include "mozilla/layers/StackingContextHelper.h"
#include "mozilla/PresShell.h"
#include "mozilla/ScrollContainerFrame.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/StaticPrefs_layout.h"
#include "nsContainerFrame.h"
@ -27,7 +28,6 @@
#include "nsFrameManager.h"
#include "nsGkAtoms.h"
#include "nsIFrameInlines.h"
#include "nsIScrollableFrame.h"
#include "nsPresContext.h"
using namespace mozilla;
@ -196,8 +196,7 @@ void nsCanvasFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
}
void nsCanvasFrame::Destroy(DestroyContext& aContext) {
nsIScrollableFrame* sf = PresShell()->GetRootScrollFrameAsScrollable();
if (sf) {
if (ScrollContainerFrame* sf = PresShell()->GetRootScrollContainerFrame()) {
sf->RemoveScrollPositionListener(this);
}
@ -222,8 +221,8 @@ nsCanvasFrame::SetHasFocus(bool aHasFocus) {
PresShell()->GetRootFrame()->InvalidateFrameSubtree();
if (!mAddedScrollPositionListener) {
nsIScrollableFrame* sf = PresShell()->GetRootScrollFrameAsScrollable();
if (sf) {
if (ScrollContainerFrame* sf =
PresShell()->GetRootScrollContainerFrame()) {
sf->AddScrollPositionListener(this);
mAddedScrollPositionListener = true;
}

View file

@ -1257,9 +1257,9 @@ void nsIFrame::DidSetComputedStyle(ComputedStyle* aOldComputedStyle) {
}
if (aOldComputedStyle->IsRootElementStyle() &&
disp->mScrollSnapType != oldDisp->mScrollSnapType) {
if (nsIScrollableFrame* scrollableFrame =
PresShell()->GetRootScrollFrameAsScrollable()) {
scrollableFrame->PostPendingResnap();
if (ScrollContainerFrame* sf =
PresShell()->GetRootScrollContainerFrame()) {
sf->PostPendingResnap();
}
}
if (StyleUIReset()->mMozSubtreeHiddenOnlyVisually &&

View file

@ -14,6 +14,7 @@
#include "mozilla/ComputedStyleInlines.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h"
#include "mozilla/ScrollContainerFrame.h"
#include "mozilla/StaticPrefs_layout.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/Document.h"
@ -38,7 +39,6 @@
#include "nsFrameSetFrame.h"
#include "nsNameSpaceManager.h"
#include "nsDisplayList.h"
#include "nsIScrollableFrame.h"
#include "nsIObjectLoadingContent.h"
#include "nsLayoutUtils.h"
#include "nsContentUtils.h"
@ -406,14 +406,12 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
visible = visible.ScaleToOtherAppUnitsRoundOut(parentAPD, subdocAPD);
dirty = dirty.ScaleToOtherAppUnitsRoundOut(parentAPD, subdocAPD);
if (nsIScrollableFrame* rootScrollableFrame =
presShell->GetRootScrollFrameAsScrollable()) {
if (ScrollContainerFrame* sf = presShell->GetRootScrollContainerFrame()) {
// Use a copy, so the rects don't get modified.
nsRect copyOfDirty = dirty;
nsRect copyOfVisible = visible;
// TODO(botond): Can we just axe this DecideScrollableLayer call?
rootScrollableFrame->DecideScrollableLayer(aBuilder, &copyOfVisible,
&copyOfDirty,
sf->DecideScrollableLayer(aBuilder, &copyOfVisible, &copyOfDirty,
/* aSetBase = */ true);
ignoreViewportScrolling = presShell->IgnoringViewportScrolling();
@ -429,7 +427,7 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
clipState.ClipContainingBlockDescendantsToContentBox(aBuilder, this);
nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollable();
ScrollContainerFrame* sf = presShell->GetRootScrollContainerFrame();
bool constructZoomItem = subdocRootFrame && parentAPD != subdocAPD;
bool needsOwnLayer = constructZoomItem ||
presContext->IsRootContentDocumentCrossProcess() ||

View file

@ -8,10 +8,10 @@
#include "RetainedDisplayListBuilder.h"
#include "mozilla/Attributes.h"
#include "mozilla/ScrollContainerFrame.h"
#include "mozilla/StaticPrefs_layout.h"
#include "nsIFrame.h"
#include "nsIFrameInlines.h"
#include "nsIScrollableFrame.h"
#include "nsPlaceholderFrame.h"
#include "nsSubDocumentFrame.h"
#include "nsViewManager.h"
@ -1611,8 +1611,8 @@ PartialUpdateResult RetainedDisplayListBuilder::AttemptPartialUpdate(
// This is normally handled by EnterPresShell, but we skipped it so that we
// didn't call MarkFrameForDisplayIfVisible before ComputeRebuildRegion.
nsIScrollableFrame* sf =
RootReferenceFrame()->PresShell()->GetRootScrollFrameAsScrollable();
ScrollContainerFrame* sf =
RootReferenceFrame()->PresShell()->GetRootScrollContainerFrame();
if (sf) {
nsCanvasFrame* canvasFrame = do_QueryFrame(sf->GetScrolledFrame());
if (canvasFrame) {

View file

@ -23,6 +23,7 @@
#include "mozilla/HashFunctions.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/PresShell.h"
#include "mozilla/ScrollContainerFrame.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/SVGImageContext.h"
#include "gfxFont.h"
@ -43,7 +44,6 @@
#include "nsCSSAnonBoxes.h"
#include "nsIContent.h"
#include "mozilla/dom/DocumentInlines.h"
#include "nsIScrollableFrame.h"
#include "imgIContainer.h"
#include "ImageOps.h"
#include "nsCSSColorUtils.h"
@ -2860,10 +2860,9 @@ nsRect nsCSSRendering::ComputeImageLayerPositioningArea(
if (!pageContentFrame) {
// Subtract the size of scrollbars.
nsIScrollableFrame* scrollableFrame =
aPresContext->PresShell()->GetRootScrollFrameAsScrollable();
if (scrollableFrame) {
nsMargin scrollbars = scrollableFrame->GetActualScrollbarSizes();
if (ScrollContainerFrame* sf =
aPresContext->PresShell()->GetRootScrollContainerFrame()) {
nsMargin scrollbars = sf->GetActualScrollbarSizes();
positionArea.Deflate(scrollbars);
}
}

View file

@ -1084,7 +1084,7 @@ void nsDisplayListBuilder::EnterPresShell(const nsIFrame* aReferenceFrame,
state->mFirstFrameMarkedForDisplay = mFramesMarkedForDisplay.Length();
state->mFirstFrameWithOOFData = mFramesWithOOFData.Length();
nsIScrollableFrame* sf = state->mPresShell->GetRootScrollFrameAsScrollable();
ScrollContainerFrame* sf = state->mPresShell->GetRootScrollContainerFrame();
if (sf && IsInSubdocument()) {
// We are forcing a rebuild of nsDisplayCanvasBackgroundColor to make sure
// that the canvas background color will be set correctly, and that only one