gecko-dev/layout/generic/FrameClass.py
Emilio Cobos Álvarez 5730ee0ca5 Bug 1364813 - Remove IsFrameOfType, use non-virtual checks. r=jwatt
Extend the per-frame-class bit we have to devirtualize IsLeaf to also
devirtualize IsFrameOfType. That is, move this data to FrameClasses.py.

This was done by going through all the frame classes, trying to preserve
behavior.

The only quirky thing is that I had to add two more trivial frame
classes, `nsAudioFrame` for audio elements, and
`nsFloatingFirstLetterFrame`. That's because these frame classes were
returning different answers at runtime, but they do this only on
conditions that trigger frame reconstruction (floating, and being an
audio element, respectively).

Differential Revision: https://phabricator.services.mozilla.com/D194703
2023-11-26 22:17:28 +00:00

23 lines
593 B
Python

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
class FrameClass:
def __init__(self, cls):
self.cls = cls
class Frame(FrameClass):
def __init__(self, cls, ty, flags):
FrameClass.__init__(self, cls)
self.ty = ty
self.flags = flags
self.is_concrete = True
class AbstractFrame(FrameClass):
def __init__(self, cls):
FrameClass.__init__(self, cls)
self.is_concrete = False