Closed Bug 1824877 Opened 1 year ago Closed 2 days ago

Rename nsHTMLScrollFrame to mozilla::ScrollContainerFrame

Categories

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

task

Tracking

()

RESOLVED FIXED
128 Branch
Tracking Status
firefox128 --- fixed

People

(Reporter: TYLin, Assigned: TYLin)

References

(Blocks 1 open bug)

Details

Attachments

(6 files)

After bug 1823455, we can rename nsHTMLScrollFrame to mozilla::ScrollFrame, and rename nsGfxScrollFrame.h/cpp to ScrollFrame.h/cpp.

Severity: -- → S3
Priority: -- → P3

Per https://phabricator.services.mozilla.com/D201893#6924920, we should consider removing nsIScrollableFrame since nsHTMLScrollFrame is the only class implementing nsIScrollableFrame.

Blocks: 1896516

Remove the #include from nsFrameState.cpp because it is not used.

  • Change the ScrollFrame::GetFrameName() to return "Scroll" instead of
    "HTMLScroll".

  • Replace NS_NewHTMLScrollFrame() with ScrollFrame::New() because I failed to
    make the friend declaration work after the rename. I keep getting build
    error: "calling a protected constructor of class 'mozilla::ScrollFrame'".

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED

Let's name it ScrollContainerFrame to align with the spec term https://drafts.csswg.org/css-overflow-3/#scroll-container

Summary: Rename nsHTMLScrollFrame to mozilla::ScrollFrame → Rename nsHTMLScrollFrame to mozilla::ScrollContainerFrame
Attachment #9401528 - Attachment description: Bug 1824877 Part 1 - Rename nsGfxScrollFrame.{h,cpp} to ScrollFrame.{h,cpp}. → Bug 1824877 Part 1 - Rename nsGfxScrollFrame.{h,cpp} to ScrollContainerFrame.{h,cpp}. r?#layout
Attachment #9401529 - Attachment description: Bug 1824877 Part 2 - Rename nsHTMLScrollFrame to mozilla::ScrollFrame. → Bug 1824877 Part 2 - Rename nsHTMLScrollFrame to mozilla::ScrollContainerFrame. r?#layout

This effectively changes the IsScrollFrame() helper to
IsScrollContainerFrame().

We can simplify them because ScrollContainerFrame is within mozilla
namespace.

This is to avoid confusion with IsScrollContainerFrame() introduced in Part 3.

A note to performance concern:

We've used IsScrollContainerOrSubclass() in bug 1873414 to avoid expensive
nsIScrollableFrame* sf = do_QueryFrame(). Per [1], casting from nsIFrame* to
nsIScrollableFrame* has no fast path.

Ideally, ScrollContainerFrame* sf = do_QueryFrame() should be fast, and we can
use it to implement IsScrollContainerOrSubclass() like
IsImageFrameOrSubclass(). However, in this patch, I intend to keep the
performance metrics unchanged.

Remove GetAsScrollContainer() since it's only used in MOZ_ASSERT, and I'm
planning to remove nsIScrollableFrame in bug 1896516.

[1] https://searchfox.org/mozilla-central/rev/dd6e430c1bc2db90d9b3b1dd7e5215b4edc4d51a/layout/generic/nsQueryFrame.h#117-121

Pushed by aethanyc@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/416d4c538f83
Part 1 - Rename nsGfxScrollFrame.{h,cpp} to ScrollContainerFrame.{h,cpp}. r=dholbert
https://hg.mozilla.org/integration/autoland/rev/ef4c00fe4624
Part 2 - Rename nsHTMLScrollFrame to mozilla::ScrollContainerFrame. r=dholbert
https://hg.mozilla.org/integration/autoland/rev/ce99fe13a24e
Part 3 - Change ScrollContainerFrame's type from Scroll to ScrollContainer. r=dholbert
https://hg.mozilla.org/integration/autoland/rev/2a498d6dc8b4
Part 4 - Drop unnecessary using declarations and mozilla namespace qualifiers. r=dholbert
https://hg.mozilla.org/integration/autoland/rev/78bbb09a4cc5
Part 5 - Revise build scroll container frame APIs in frame constructor. r=dholbert
https://hg.mozilla.org/integration/autoland/rev/b033344df9c7
Part 6 - Rename IsScrollContainer() to IsScrollContainerOrSubclass(). r=dholbert
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: