Closed Bug 1896516 Opened 8 months ago Closed 8 months ago

Get rid of nsIScrollableFrame

Categories

(Core :: Layout: Scrolling and Overflow, task, P3)

task

Tracking

()

RESOLVED FIXED
128 Branch
Tracking Status
firefox128 --- fixed

People

(Reporter: TYLin, Assigned: TYLin)

References

Details

Crash Data

Attachments

(14 files, 1 obsolete file)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

Moved from bug 1824877 comment 1: per https://phabricator.services.mozilla.com/D201893#6924920, we should consider removing nsIScrollableFrame since ScrollFrame is the only class implementing nsIScrollableFrame.

Severity: -- → S3
Priority: -- → P3
Assignee: nobody → aethanyc
Status: NEW → ASSIGNED

In theory, changing the return type from nsIFrame* to ScrollContainerFrame*
exposes ScrollContainerFrame to the callers who might not needed, but almost
all of the callers in cpp files are already exposed to nsIScrollableFrame, as
demonstrated in this patch via replacing the #include from
"nsIScrollableFrame.h" to "ScrollContainerFrame.h", so this is OK.

Some callers can be simplified since we no longer need do_QueryFrame to
nsIScrollableFrame.

We are going to switch callers from nsIScrollableFrame to
ScrollContainerFrame, so we need ScrollContainerFrame to have the same
interface as nsIScrollableFrame, including the same default values on params
and the same access privilege of public/protected/private APIs.

This patch is a preparation for later parts so that the code builds
successfully.

Also, simplify some callers of GetScrollTargetFrame() to drop
nsIScrollableFrame* and unnecessary do_QueryFrame. We'll continue removing
more nsIScrollableFrame* in later parts.

This patch starts from renaming PresShell::GetScrollableFrameToScroll() to
PresShell::GetScrollContainerFrameToScroll(), making it return
ScrollContainerFrame*, and then fixing other helpers until everything
compiles. As before, we can remove some do_QueryFrame.

This is a preparation to remove #include "nsIScrollableFrame.h" for
ScrollTimeline.cpp and ViewTimeline.cpp.

Move the implementation of nsListControlFrame::GetMultiple() to cpp. Keeping
it inline requires adding #include "mozilla/dom/Element.h" in the header, and
I don't feel the method is hot enough to be inlined.

Convert nsIScrollableFrame to ScrollContainerFrame for all the APIs in
nsLayoutUtils, and then adapt other callers until everything compiles.

In nsLayoutUtils::CalculateBasicFrameMetrics()'s documentation,
s/ComputeFrameMetrics/ComputeScrollMetadata/ because the method was renamed in
https://hg.mozilla.org/mozilla-central/rev/cb2023f50288

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.

Also, in EventStateManager, convert ComputeScrollTarget() and
ComputeScrollTargetAndMayAdjustWheelEvent() to return ScrollContainerFrame*
so that we can drop more unnecessarily do_QueryFrame.

Due to removing nsIScrollableFrame forward declaration in DOM headers, we have
to add nsIScrollableFrame forward declaration temporarily in
nsMenuPopupFrame.h to make this patch compile, but we'll remove it once we
remove nsIScrollableFrame under layout/.

The motivation of this patch is that we've now switched all the callers from
nsIScrollableFrame to ScrollContainerFrame, and it is better to audit the
access control of ScrollContainerFrame's interface, and I notice almost all
the member variables are public!

This patch shuffle the interface so that there are only one public, protected,
and private section, and all the member variables are moved to the private
section.

AutoMinimumScaleSizeChangeDetector and RemoveDisplayPortCallback need to
access member variables, so by declaring them under ScrollContainerFrame, they
have the privilege to do so.

Ideally, the caller only need to access what are already in
nsIScrollableFrame, so currently we might expose more methods than necessary.
We can audit that in a later part.

This patch moves the documentation from nsIScrollableFrame.h to
ScrollContainerFrame.h. We keep methods in the original order as they were in
nsIScrollableFrame.

Move nsIReflowCallback overridden methods to public section since
ScrollContainerFrame public inherits the interface.

Move reflow related helper methods to protected section.

Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/ea9ecb543e66 Part 1 - Rename PresShell::GetRootScrollFrame(), and make it return ScrollContainerFrame. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/a2d37b98273c Part 2 - Sync the interface between nsIScrollableFrame and ScrollContainerFrame. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/b765169a7a8f Part 3 - Change GetScrollTargetFrame() to return ScrollContainerFrame. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/2f0817331dbe Part 4 - Convert some nsIScrollableFrame usage in PresShell, nsLayoutUtils, and related helpers. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/717dac08b607 Part 5 - Fix build errors after including ScrollContainerFrame.h under dom/animation/. r=layout-reviewers,boris https://hg.mozilla.org/integration/autoland/rev/42e1bbe0ecb6 Part 6 - Remove nsIScrollableFrame usages in nsLayoutUtils. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/7b481b747b7a Part 7 - Remove PresShell::GetRootScrollFrameAsScrollable(). r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/c964fccd5180 Part 8 - Remove nsIScrollableFrame usages under accessible/. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/997c9249dbed Part 9 - Remove nsIScrollableFrame usages under dom/. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/6f7ab8adfa6e Part 10 - Remove nsIScrollableFrame usages under gfx/. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/f63b0c4335fe Part 11 - Remove nsIScrollableFrame usages under layout/, widget/, and toolkit/. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/3c06f22da72b Part 12 - Tidy up ScrollContainerFrame's interface. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/c8a6b0e526d6 Part 13 - Remove nsIScrollableFrame completely. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/2977ff81a23e Part 14 - Minor adjustment to ScrollContainerFrame interfaces. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/fd6904338812 apply code formatting via Lando
Blocks: 1899345

Backed out for causing scrolling crashes on macOS:
https://hg.mozilla.org/mozilla-central/rev/e1da1893a0c56d2752be4e6eb1efa16c58723a55

There are crashes with [@ mozilla::ScrollContainerFrame::ScrollbarActivityStarted] e.g. bp-ada62b65-ccc2-40d7-94c5-e9a910240529

Status: RESOLVED → REOPENED
Crash Signature: [@ mozilla::ScrollContainerFrame::ScrollbarActivityStarted]
Flags: needinfo?(aethanyc)
Resolution: FIXED → ---
Target Milestone: 128 Branch → ---
Regressions: 1899505

It is Part 9 - Remove nsIScrollableFrame usages under dom/ that causes the regression (bug 1899505). See https://phabricator.services.mozilla.com/D211496#7279371 for the root cause.

Flags: needinfo?(aethanyc)
Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/8abd8c6ab1b6 Part 1 - Rename PresShell::GetRootScrollFrame(), and make it return ScrollContainerFrame. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/852253304683 Part 2 - Sync the interface between nsIScrollableFrame and ScrollContainerFrame. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/09981021ee35 Part 3 - Change GetScrollTargetFrame() to return ScrollContainerFrame. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/0ee9d3315ed6 Part 4 - Convert some nsIScrollableFrame usage in PresShell, nsLayoutUtils, and related helpers. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/dd540ee6e824 Part 5 - Fix build errors after including ScrollContainerFrame.h under dom/animation/. r=layout-reviewers,boris https://hg.mozilla.org/integration/autoland/rev/1eac71cfc6a0 Part 6 - Remove nsIScrollableFrame usages in nsLayoutUtils. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/1ad8f3d267ae Part 7 - Remove PresShell::GetRootScrollFrameAsScrollable(). r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/9a67eb7c4248 Part 8 - Remove nsIScrollableFrame usages under accessible/. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/35b0ec410b2d Part 9 - Remove nsIScrollableFrame usages under dom/. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/fa4d373ad546 Part 10 - Remove nsIScrollableFrame usages under gfx/. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/2eac8c029b4b Part 11 - Remove nsIScrollableFrame usages under layout/, widget/, and toolkit/. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/7e98e19cb506 Part 12 - Tidy up ScrollContainerFrame's interface. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/e6f0167db347 Part 13 - Remove nsIScrollableFrame completely. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/fd11ccb1e883 Part 14 - Minor adjustment to ScrollContainerFrame interfaces. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/5eab81fcdd7c apply code formatting via Lando
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: