Closed
Bug 1459034
Opened 7 years ago
Closed 5 years ago
devirtualize some functions in nsIFrame
Categories
(Core :: Layout, enhancement, P3)
Core
Layout
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: froydnj, Assigned: froydnj)
Details
Attachments
(4 files)
|
3.66 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
|
2.86 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
|
3.00 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
|
2.33 KB,
patch
|
dbaron
:
review+
|
Details | Diff | Splinter Review |
This saves a small amount of vtable space and a decent-ish amount of text size,
because subclasses no longer need forwarding thunks.
| Assignee | ||
Comment 1•7 years ago
|
||
nsPluginFrame is the lone overrider of this method, but its
implementation duplicates work done by the primary implementation, and
calls through to the primary implementation anyway. There's no need for
this method to be virtual.
Attachment #8973024 -
Flags: review?(dholbert)
| Assignee | ||
Comment 2•7 years ago
|
||
The default implementation of this function just forwards to
GetContentOffsetsFromPoint, and there are no subclasses that override
this function. I believe the "External" prefix hearkens back to a day
when bits of layout lived in a separate library from everything else,
but that day is long gone. Both reasons are sufficient motivation to
devirtualize this function.
Attachment #8973025 -
Flags: review?(dholbert)
| Assignee | ||
Comment 3•7 years ago
|
||
nsFrame provides the lone implementation of this method, and there are
no other overrides. We might as well move its implementation to
nsIFrame and devirtualize it.
Attachment #8973026 -
Flags: review?(dholbert)
| Assignee | ||
Comment 4•7 years ago
|
||
Nothing overrides these default implementations, and the underlying
GetUsed* methods they call are already virtual. So a subclass needing
to override the GetLogicalUsed* variants seems rather unlikely.
Attachment #8973027 -
Flags: review?(dholbert)
Comment on attachment 8973024 [details] [diff] [review]
part 1 - devirtualize nsIFrame::IsFocusable
I think the commit message should be clearer that you're *removing* the nsPluginFrame override because the override is no longer needed.
The code looks good, though.
(dholbert's away, and since I looked, I may as well review this)
Attachment #8973024 -
Flags: review?(dholbert) → review+
Comment on attachment 8973025 [details] [diff] [review]
part 2 - devirtualize nsIFrame::GetContentOffsetsFromPointExternal
Yeah, this probably dated back to when accessibility was in a different library from layout.
Attachment #8973025 -
Flags: review?(dholbert) → review+
Attachment #8973026 -
Flags: review?(dholbert) → review+
Attachment #8973027 -
Flags: review?(dholbert) → review+
Comment 7•7 years ago
|
||
(In reply to Nathan Froyd [:froydnj] from comment #4)
> Nothing overrides these default implementations, and the underlying
> GetUsed* methods they call are already virtual. So a subclass needing
> to override the GetLogicalUsed* variants seems rather unlikely.
IIRC, the idea was that the classes that override the GetUsed*
methods would be changed to instead override GetLogicalUsed*
so that we could minimize the use of, or remove, the physical
variants eventually. I suspect that these days the logical
variants are used more than the physical ones.
There are also some cases where we first compute the result in
logical coordinates, then convert it to physical, and then back to
logical in GetLogicalUsed*. e.g.
https://searchfox.org/mozilla-central/rev/c0d81882c7941c4ff13a50603e37095cdab0d1ea/layout/tables/nsTableFrame.cpp#2866
| Assignee | ||
Comment 8•7 years ago
|
||
(In reply to Mats Palmgren (:mats) from comment #7)
> (In reply to Nathan Froyd [:froydnj] from comment #4)
> > Nothing overrides these default implementations, and the underlying
> > GetUsed* methods they call are already virtual. So a subclass needing
> > to override the GetLogicalUsed* variants seems rather unlikely.
>
> IIRC, the idea was that the classes that override the GetUsed*
> methods would be changed to instead override GetLogicalUsed*
> so that we could minimize the use of, or remove, the physical
> variants eventually. I suspect that these days the logical
> variants are used more than the physical ones.
>
> There are also some cases where we first compute the result in
> logical coordinates, then convert it to physical, and then back to
> logical in GetLogicalUsed*. e.g.
> https://searchfox.org/mozilla-central/rev/
> c0d81882c7941c4ff13a50603e37095cdab0d1ea/layout/tables/nsTableFrame.cpp#2866
Thanks for the explanation here; I am woefully unfamiliar with layout code, and the history here is helpful.
For avoidance of doubt, are you saying:
a) The patch should not be landed;
b) The patch can be landed, but somebody will probably undo its effects later as part of a (step-wise) refactoring; or
c) The patch is a good idea, but should really be accomplished by removing the physical variants and making the overrides work with logical coordinates instead, and should not be landed in its current state.
?
Flags: needinfo?(mats)
Comment 9•7 years ago
|
||
Sorry for the confusion, please land it.
I suspect somebody will probably switch the roles of GetLogicalUsed*/GetUsed*
eventually though, in terms of which should be virtual and overridable.
Flags: needinfo?(mats)
Updated•7 years ago
|
Priority: -- → P3
Comment 10•6 years ago
|
||
There are some r+ patches which didn't land and no activity in this bug for 2 weeks.
:froydnj, could you have a look please?
Flags: needinfo?(nfroyd)
| Assignee | ||
Updated•5 years ago
|
Status: NEW → RESOLVED
Closed: 5 years ago
Flags: needinfo?(nfroyd)
Resolution: --- → INCOMPLETE
You need to log in
before you can comment on or make changes to this bug.
Description
•