Open Bug 315173 Opened 14 years ago Updated Last year
IFrame::Is Frame Of Type
The idea is to have something similar to nsIContent::IsContentOfType and use it in place of frame type checks so that we can give subclasses distinct frame types without having to deal with updating lots of places that assume that only an areaFrame or blockFrame can do something or other. The question is what questions we'd want this method to answer. Offhand, it seems to me that we might be able to make some or all of IsContainingBlock(), IsFloatContainingBlock(), and IsLeaf() use this instead. What else? What sort of frametype checks are we doing that we could replace with this? I know we're at least doing one for "inline" frames in WipeContainingBlock, and doing lots of checks for "block or area frame" all over.
In some places we QI to nsIScrollableFrame to see if we're scrollable. Dunno if that's worth optimizing. We should probably have a check for boxframes so we can free up the NS_FRAME_IS_BOX state bit.
That's another question -- which frame state bits should instead be using this function... e.g. the "replaced frame" bit could be, I think.
Ooh, I missed NS_FRAME_REPLACED_ELEMENT. I'd love to free that up. But that's the only other one that is fixed by the frame type, right? All the others depend on things in addition to the frame type.
We should ensure we can distinguish between block-level frames and actual blocks. (The former excludes inline-block, the latter includes it, I guess...)
Yeah, I was hoping that REFLOW_ROOT was based on frame type, but it's not. So just the BOX and REPLACED_ELEMENT flags. For block-level vs block we basically need to know whether the frame looks like a block "from the outside" (block, table; this corresponds to a "block level" box in CSS2.1) and maybe whether it looks like one "from the inside" (inline-block; there's a term for this too, but I can't recall it).
This should subsume and replace nsHTMLReflowState's frame types. See http://lxr.mozilla.org/mozilla/source/layout/generic/nsHTMLReflowState.cpp#469
Also, there should be a bit for "inline or positioned inline or line". This check is used in several places in the frame constructor; just search for nsLayoutAtoms::lineFrame.
It looks like this happened in bug 310436. Do we want to keep this open, or just file bugs on the things we'd like to move to this api?
I think NS_FRAME_EXCLUDE_IGNORABLE_WHITESPACE could be handled via IsFrameOfType too. It's a little tricky because nsCSSFrameConstructor sets it in CreateMathMLFrame, but I think the frames there are all MathML frames (and all MathML frames get it) and tables, which should also all have it.
Component: Layout: Misc Code → Layout
Product: Core Graveyard → Core
You need to log in before you can comment on or make changes to this bug.