Closed Bug 1989117 Opened 2 months ago Closed 2 months ago

Provide a const GetClosestFrameOfType() overload to ensure const correctness

Categories

(Core :: Layout, task)

task

Tracking

()

RESOLVED FIXED
145 Branch
Tracking Status
firefox145 --- fixed

People

(Reporter: TYLin, Assigned: TYLin)

Details

Attachments

(1 file)

nsLayoutUtils::GetClosestFrameOfType() doesn't modify the parameters, and it would be nice for its parameter to accept const nsIFrame* for aFrame and aStopBy, and to return const nsIFrame*.

However, changing it directly would require massive API updates (sprinkling const across many callers, especially in SVG code). A less disruptive
approach is to add a const overload, similar to nsLayoutUtils::GetStyleFrame(). That avoids the needs to const_cast for callers already having const nsIFrame*, e.g. https://phabricator.services.mozilla.com/D265113.

Make GetClosestFrameOfType() const and add back a non-const wrapper for
existing callers. Also make aStopAt const (it's currently unused, but seems
useful to keep), which improves const-correctness for future use.

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 145 Branch
QA Whiteboard: [qa-triage-done-c146/b145]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: