Closed Bug 1356133 Opened 7 years ago Closed 7 years ago

Consider using a few bits for checking common frame types.

Categories

(Core :: Layout, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1360241

People

(Reporter: emilio, Unassigned)

Details

It bugs me a lot seeing code like [1] or [2] all over the place.

We should consider using a few frame bits to either store the type, or at least the types we check the most, like placeholder frames, to avoid doing a virtual call per frame.

I think I've seen/suggested this before, but worth getting a bug on file for it I suppose.

Those two cases are flex and grid specific, but [3] seems to suggest we could avoid doing a virtual call per frame in a lot of hot places (like DL building) if we store a few bits for common frame types to check.

[1]: http://searchfox.org/mozilla-central/rev/944f87c575e8a0bcefc1ed8efff10b34cf7a5169/layout/generic/nsFlexContainerFrame.cpp#3592
[2]: http://searchfox.org/mozilla-central/source/layout/generic/nsGridContainerFrame.cpp#5108
[3]: http://searchfox.org/mozilla-central/search?q=GetType()+%3D%3D+nsGkAtoms&case=true&regexp=false&path=
Yeah, the placeholder tests have bugged me for some time too.
It's at least worth doing that one.  Using 2 bits we could also check
for Grid- and FlexContainerFrame which are also used in a few places.

We should also add convenience methods, IsPlaceholderFrame() etc,
to make the code terse and to abstract away the implementation,
which may change.
Depends on: 1257732
This was fixed in bug 1360241.
Status: NEW → RESOLVED
Closed: 7 years ago
No longer depends on: 1257732
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.