Consider removing nsIFrame::eBlockFrame flag for "IsFrameOfType", in favor of QueryFrame-backed "IsBlockFrameOrSubclass()" method
Categories
(Core :: Layout, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox67 | --- | fixed |
People
(Reporter: dholbert, Assigned: TYLin)
References
Details
Attachments
(1 file)
For now, IsFrameOfType() is a virtual function call (unless/until we act on bug 1364813). So, calls to IsFrameOfType(nsIFrame::eBlockFrame) are kind of expensive.
In bug 1525628, I'm adding a non-virtual function, nsIFrame::IsBlockFrameOrSubclass(), which should serve the same purpose and which is implemented using do_QueryFrame (which is non-virtual as of bug 1364815).
In theory we should be able to remove nsIFrame::eBlockFrame and migrate its IsFrameOfType() callsites to use IsBlockFrameOrSubclass() instead.
One prerequisite: in its initial version, IsBlockFrameOrSubclass() is a non-const method. To make it correctly "const", we should probably also make the QueryFrame machinery become const-friendly. That might be the first part of this bug, and it'll be necessary to make this IsBlockFrameOrSubclass() function callable at some of our IsFrameOfType() callsites, e.g. this one:
(We could also just make IsBlockFrameOrSubclass do a hacky const_cast internally, but it seems like we should attempt to fix QueryFrame first before resorting to that.)
Reporter | ||
Updated•6 years ago
|
Assignee | ||
Comment 1•6 years ago
|
||
do_QueryFrame
becomes more const-friendly in bug 1527519. I think this bug is now doable.
Assignee | ||
Comment 2•6 years ago
|
||
Only nsBlockFrame recognizes the eBlockFrame flag, so we can replace the
usage of IsFrameOfType(nsIFrame::eBlockFrame) with either
nsIFrame::IsBlockFrameOrSubclass() or a do_QueryFrame() call for
nsBlockFrame*.
Updated•6 years ago
|
Comment 4•6 years ago
|
||
bugherder |
Description
•