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
This commit is contained in:
Emilio Cobos Álvarez 2023-11-26 22:17:28 +00:00
Родитель c1b18f62e8
Коммит 5730ee0ca5
105 изменённых файлов: 543 добавлений и 882 удалений

Просмотреть файл

@ -49,7 +49,7 @@ EffectSet* EffectSet::GetForFrame(const nsIFrame* aFrame,
if (aProperties.IsSubsetOf(nsCSSPropertyIDSet::TransformLikeProperties())) {
// Make sure to return nullptr if we're looking for transform animations on
// the inner table frame.
if (!aFrame->IsFrameOfType(nsIFrame::eSupportsCSSTransforms)) {
if (!aFrame->SupportsCSSTransforms()) {
return nullptr;
}
frameToQuery = nsLayoutUtils::GetStyleFrame(aFrame);

Просмотреть файл

@ -1893,7 +1893,7 @@ bool KeyframeEffect::ContainsAnimatedScale(const nsIFrame* aFrame) const {
// frame. If we are being passed a frame that doesn't support transforms
// (i.e. the inner table frame) we could just return false, but it possibly
// means we looked up the wrong EffectSet so for now we just assert instead.
MOZ_ASSERT(aFrame && aFrame->IsFrameOfType(nsIFrame::eSupportsCSSTransforms),
MOZ_ASSERT(aFrame && aFrame->SupportsCSSTransforms(),
"We should be passed a frame that supports transforms");
if (!IsCurrent()) {

Просмотреть файл

@ -1036,8 +1036,7 @@ nsRect Element::GetClientAreaRect() {
// The display check is OK even though we're not looking at the style
// frame, because the style frame only differs from "frame" for tables,
// and table wrappers have the same display as the table itself.
(!frame->StyleDisplay()->IsInlineFlow() ||
frame->IsFrameOfType(nsIFrame::eReplaced))) {
(!frame->StyleDisplay()->IsInlineFlow() || frame->IsReplaced())) {
// Special case code to make client area work even when there isn't
// a scroll view, see bug 180552, bug 227567.
return frame->GetPaddingRect() - frame->GetPositionIgnoringScrolling();

Просмотреть файл

@ -113,8 +113,7 @@ static AutoTArray<LogicalPixelSize, 1> CalculateBoxSize(
// always return false. (So its observation won't be fired.)
// TODO: Should we use an empty array instead?
// https://github.com/w3c/csswg-drafts/issues/7734
if (!frame->IsFrameOfType(nsIFrame::eReplaced) &&
frame->IsFrameOfType(nsIFrame::eLineParticipant)) {
if (!frame->IsReplaced() && frame->IsLineParticipant()) {
return {LogicalPixelSize()};
}
@ -536,8 +535,7 @@ static void LastRememberedSizeCallback(
aObserver.Unobserve(*target);
continue;
}
MOZ_ASSERT(!frame->IsFrameOfType(nsIFrame::eLineParticipant) ||
frame->IsFrameOfType(nsIFrame::eReplaced),
MOZ_ASSERT(!frame->IsLineParticipant() || frame->IsReplaced(),
"Should have unobserved non-replaced inline.");
MOZ_ASSERT(!frame->HidesContent(),
"Should have unobserved element skipping its contents.");

Просмотреть файл

@ -3053,7 +3053,7 @@ static bool IsVisibleAndNotInReplacedElement(nsIFrame* aFrame) {
if (f->HidesContent()) {
return false;
}
if (f->IsFrameOfType(nsIFrame::eReplaced) &&
if (f->IsReplaced() &&
!f->GetContent()->IsAnyOfHTMLElements(nsGkAtoms::button,
nsGkAtoms::select) &&
!f->GetContent()->IsSVGElement()) {

Просмотреть файл

@ -104,7 +104,7 @@ static bool ShouldZoomToElement(
// Replaced elements are suitable zoom targets because they act like
// inline-blocks instead of inline. (textarea's are the specific reason
// we do this)
!frame->IsFrameOfType(nsIFrame::eReplaced)) {
!frame->IsReplaced()) {
return false;
}
}
@ -190,7 +190,7 @@ static CSSRect AddVMargin(const CSSRect& aRect, const CSSCoord& aMargin,
static bool IsReplacedElement(const nsCOMPtr<dom::Element>& aElement) {
if (nsIFrame* frame = aElement->GetPrimaryFrame()) {
if (frame->IsFrameOfType(nsIFrame::eReplaced)) {
if (frame->IsReplaced()) {
return true;
}
}

Просмотреть файл

@ -38,7 +38,7 @@ CSSPoint MotionPathUtils::ComputeAnchorPointAdjustment(const nsIFrame& aFrame) {
return {};
}
if (aFrame.IsFrameOfType(nsIFrame::eSVGContainer)) {
if (aFrame.IsSVGContainerFrame()) {
nsRect boxRect = nsLayoutUtils::ComputeSVGReferenceRect(
const_cast<nsIFrame*>(&aFrame), StyleGeometryBox::FillBox);
return CSSPoint::FromAppUnits(boxRect.TopLeft());

Просмотреть файл

@ -3264,8 +3264,8 @@ static void AccumulateFrameBounds(nsIFrame* aContainerFrame, nsIFrame* aFrame,
nsIFrame* prevFrame = aFrame;
nsIFrame* f = aFrame;
while (f && f->IsFrameOfType(nsIFrame::eLineParticipant) &&
!f->IsTransformed() && !f->IsAbsPosContainingBlock()) {
while (f && f->IsLineParticipant() && !f->IsTransformed() &&
!f->IsAbsPosContainingBlock()) {
prevFrame = f;
f = prevFrame->GetParent();
}

Просмотреть файл

@ -770,7 +770,7 @@ static nsIFrame* GetFrameForChildrenOnlyTransformHint(nsIFrame* aFrame) {
MOZ_ASSERT(aFrame->IsSVGOuterSVGAnonChildFrame(),
"Where is the SVGOuterSVGFrame's anon child??");
}
MOZ_ASSERT(aFrame->IsFrameOfType(nsIFrame::eSVG | nsIFrame::eSVGContainer),
MOZ_ASSERT(aFrame->IsSVGContainerFrame(),
"Children-only transforms only expected on SVG frames");
return aFrame;
}
@ -1746,8 +1746,7 @@ void RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList) {
hint |= nsChangeHint_RepaintFrame;
}
if ((hint & nsChangeHint_UpdateUsesOpacity) &&
frame->IsFrameOfType(nsIFrame::eTablePart)) {
if ((hint & nsChangeHint_UpdateUsesOpacity) && frame->IsTablePart()) {
NS_ASSERTION(hint & nsChangeHint_UpdateOpacityLayer,
"should only return UpdateUsesOpacity hint "
"when also returning UpdateOpacityLayer hint");
@ -1773,8 +1772,7 @@ void RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList) {
// For most frame types, DLBI can detect background position changes,
// so we only need to schedule a paint.
hint |= nsChangeHint_SchedulePaint;
if (frame->IsFrameOfType(nsIFrame::eTablePart) ||
frame->IsFrameOfType(nsIFrame::eMathML)) {
if (frame->IsTablePart() || frame->IsMathMLFrame()) {
// Table parts and MathML frames don't build display items for their
// backgrounds, so DLBI can't detect background-position changes for
// these frames. Repaint the whole frame.
@ -1847,7 +1845,7 @@ void RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList) {
// inner svg frame, so update the child overflows.
nsIFrame* childFrame = hintFrame->PrincipalChildList().FirstChild();
for (; childFrame; childFrame = childFrame->GetNextSibling()) {
MOZ_ASSERT(childFrame->IsFrameOfType(nsIFrame::eSVG),
MOZ_ASSERT(childFrame->IsSVGFrame(),
"Not expecting non-SVG children");
if (!CanSkipOverflowUpdates(childFrame)) {
mOverflowChangedTracker.AddFrame(

Просмотреть файл

@ -598,7 +598,7 @@ static bool IsBidiSplittable(nsIFrame* aFrame) {
MOZ_ASSERT(aFrame);
// Bidi inline containers should be split, unless they're line frames.
LayoutFrameType frameType = aFrame->Type();
return (aFrame->IsFrameOfType(nsIFrame::eBidiInlineContainer) &&
return (aFrame->IsBidiInlineContainer() &&
frameType != LayoutFrameType::Line) ||
frameType == LayoutFrameType::Text;
}
@ -607,7 +607,7 @@ static bool IsBidiSplittable(nsIFrame* aFrame) {
static bool IsBidiLeaf(const nsIFrame* aFrame) {
nsIFrame* kid = aFrame->PrincipalChildList().FirstChild();
if (kid) {
if (aFrame->IsFrameOfType(nsIFrame::eBidiInlineContainer) ||
if (aFrame->IsBidiInlineContainer() ||
RubyUtils::IsRubyBox(aFrame->Type())) {
return false;
}
@ -1209,8 +1209,7 @@ void nsBidiPresUtils::TraverseFrames(nsIFrame* aCurrentFrame,
char16_t controlChar = 0;
char16_t overrideChar = 0;
LayoutFrameType frameType = frame->Type();
if (frame->IsFrameOfType(nsIFrame::eBidiInlineContainer) ||
RubyUtils::IsRubyBox(frameType)) {
if (frame->IsBidiInlineContainer() || RubyUtils::IsRubyBox(frameType)) {
if (!frame->HasAnyStateBits(NS_FRAME_FIRST_REFLOW)) {
nsContainerFrame* c = static_cast<nsContainerFrame*>(frame);
MOZ_ASSERT(c == do_QueryFrame(frame),

Просмотреть файл

@ -129,6 +129,7 @@ using namespace mozilla::dom;
nsIFrame* NS_NewHTMLCanvasFrame(PresShell* aPresShell, ComputedStyle* aStyle);
nsIFrame* NS_NewHTMLVideoFrame(PresShell* aPresShell, ComputedStyle* aStyle);
nsIFrame* NS_NewHTMLAudioFrame(PresShell* aPresShell, ComputedStyle* aStyle);
nsContainerFrame* NS_NewSVGOuterSVGFrame(PresShell* aPresShell,
ComputedStyle* aStyle);
@ -265,7 +266,7 @@ static void AssertAnonymousFlexOrGridItemParent(const nsIFrame* aChild,
* needs to terminate it).
*/
static bool IsInlineFrame(const nsIFrame* aFrame) {
return aFrame->IsFrameOfType(nsIFrame::eLineParticipant);
return aFrame->IsLineParticipant();
}
/**
@ -284,7 +285,7 @@ static inline bool IsDisplayContents(const nsIContent* aContent) {
* frame being used for SVG text.
*/
static bool IsFrameForSVG(const nsIFrame* aFrame) {
return aFrame->IsFrameOfType(nsIFrame::eSVG) || aFrame->IsInSVGTextSubtree();
return aFrame->IsSVGFrame() || aFrame->IsInSVGTextSubtree();
}
static bool IsLastContinuationForColumnContent(const nsIFrame* aFrame) {
@ -300,8 +301,7 @@ static bool IsLastContinuationForColumnContent(const nsIFrame* aFrame) {
* lower-level descendents inside them, of course).
*/
static bool ShouldSuppressFloatingOfDescendants(nsIFrame* aFrame) {
return aFrame->IsFlexOrGridContainer() ||
aFrame->IsFrameOfType(nsIFrame::eMathML);
return aFrame->IsFlexOrGridContainer() || aFrame->IsMathMLFrame();
}
// Return true if column-span descendants should be suppressed under aFrame's
@ -2329,7 +2329,7 @@ static inline bool NeedFrameFor(const nsFrameConstructorState& aState,
// white-space, where we know we'll be dropping them all anyway, and involve
// an extra walk down the frame construction item list.
auto excludesIgnorableWhitespace = [](nsIFrame* aParentFrame) {
return aParentFrame->IsFrameOfType(nsIFrame::eMathML);
return aParentFrame->IsMathMLFrame();
};
if (!aParentFrame || !excludesIgnorableWhitespace(aParentFrame) ||
aParentFrame->IsGeneratedContentFrame() || !aChildContent->IsText()) {
@ -2585,9 +2585,9 @@ nsIFrame* nsCSSFrameConstructor::ConstructDocElementFrame(
// Still need to process the child content
nsFrameList childList;
NS_ASSERTION(!contentFrame->IsBlockFrameOrSubclass() &&
!contentFrame->IsFrameOfType(nsIFrame::eSVG),
"Only XUL frames should reach here");
NS_ASSERTION(
!contentFrame->IsBlockFrameOrSubclass() && !contentFrame->IsSVGFrame(),
"Only XUL frames should reach here");
nsFrameConstructorSaveState floatSaveState;
state.MaybePushFloatContainingBlock(contentFrame, floatSaveState);
@ -3515,7 +3515,7 @@ nsCSSFrameConstructor::FindHTMLData(const Element& aElement,
PseudoStyleType::buttonContent}},
SIMPLE_TAG_CHAIN(canvas, nsCSSFrameConstructor::FindCanvasData),
SIMPLE_TAG_CREATE(video, NS_NewHTMLVideoFrame),
SIMPLE_TAG_CREATE(audio, NS_NewHTMLVideoFrame),
SIMPLE_TAG_CREATE(audio, NS_NewHTMLAudioFrame),
SIMPLE_TAG_CREATE(progress, NS_NewProgressFrame),
SIMPLE_TAG_CREATE(meter, NS_NewMeterFrame),
SIMPLE_TAG_CHAIN(details, nsCSSFrameConstructor::FindDetailsData),
@ -3972,7 +3972,7 @@ void nsCSSFrameConstructor::ConstructFrameFromItemInternal(
}
}
NS_ASSERTION(newFrame->IsFrameOfType(nsIFrame::eLineParticipant) ==
NS_ASSERTION(newFrame->IsLineParticipant() ==
((bits & FCDATA_IS_LINE_PARTICIPANT) != 0),
"Incorrectly set FCDATA_IS_LINE_PARTICIPANT bits");
@ -5578,7 +5578,7 @@ nsContainerFrame* nsCSSFrameConstructor::GetAbsoluteContainingBlock(
// Starting with aFrame, look for a frame that is absolutely positioned or
// relatively positioned (and transformed, if aType is FIXED)
for (nsIFrame* frame = aFrame; frame; frame = frame->GetParent()) {
if (frame->IsFrameOfType(nsIFrame::eMathML)) {
if (frame->IsMathMLFrame()) {
// If it's mathml, bail out -- no absolute positioning out from inside
// mathml frames. Note that we don't make this part of the loop
// condition because of the stuff at the end of this method...
@ -7472,7 +7472,7 @@ bool nsCSSFrameConstructor::ContentRemoved(nsIContent* aChild,
nsIFrame* possibleMathMLAncestor = parentType == LayoutFrameType::Block
? parentFrame->GetParent()
: parentFrame;
if (possibleMathMLAncestor->IsFrameOfType(nsIFrame::eMathML)) {
if (possibleMathMLAncestor->IsMathMLFrame()) {
LAYOUT_PHASE_TEMP_EXIT();
RecreateFramesForContent(parentFrame->GetContent(), InsertionKind::Async);
LAYOUT_PHASE_TEMP_REENTER();
@ -8435,14 +8435,13 @@ void nsCSSFrameConstructor::UpdateTableCellSpans(nsIContent* aContent) {
static nsIContent* GetTopmostMathMLElement(nsIContent* aMathMLContent) {
MOZ_ASSERT(aMathMLContent->IsMathMLElement());
MOZ_ASSERT(aMathMLContent->GetPrimaryFrame());
MOZ_ASSERT(
aMathMLContent->GetPrimaryFrame()->IsFrameOfType(nsIFrame::eMathML));
MOZ_ASSERT(aMathMLContent->GetPrimaryFrame()->IsMathMLFrame());
nsIContent* root = aMathMLContent;
for (nsIContent* parent = aMathMLContent->GetFlattenedTreeParent(); parent;
parent = parent->GetFlattenedTreeParent()) {
nsIFrame* frame = parent->GetPrimaryFrame();
if (!frame || !frame->IsFrameOfType(nsIFrame::eMathML)) {
if (!frame || !frame->IsMathMLFrame()) {
break;
}
root = parent;
@ -8512,7 +8511,7 @@ void nsCSSFrameConstructor::RecreateFramesForContent(
}
nsIFrame* frame = aContent->GetPrimaryFrame();
if (frame && frame->IsFrameOfType(nsIFrame::eMathML)) {
if (frame && frame->IsMathMLFrame()) {
// Reframe the topmost MathML element to prevent exponential blowup
// (see bug 397518).
aContent = GetTopmostMathMLElement(aContent);
@ -9334,7 +9333,7 @@ static bool FrameWantsToBeInAnonymousItem(const nsIFrame* aContainerFrame,
// Any line-participant frames (e.g. text) definitely want to be wrapped in
// an anonymous flex/grid item.
if (aFrame->IsFrameOfType(nsIFrame::eLineParticipant)) {
if (aFrame->IsLineParticipant()) {
return true;
}
@ -10033,7 +10032,7 @@ nsFirstLetterFrame* nsCSSFrameConstructor::CreateFloatingLetterFrame(
MOZ_ASSERT(aParentStyle);
nsFirstLetterFrame* letterFrame =
NS_NewFirstLetterFrame(mPresShell, aComputedStyle);
NS_NewFloatingFirstLetterFrame(mPresShell, aComputedStyle);
// We don't want to use a text content for a non-text frame (because we want
// its primary frame to be a text frame).
nsIContent* letterContent = aParentFrame->GetContent();
@ -11280,7 +11279,7 @@ bool nsCSSFrameConstructor::WipeInsertionParent(nsContainerFrame* aFrame) {
// FIXME(emilio): This looks terribly inefficient if you insert elements deep
// in a MathML subtree.
if (aFrame->IsFrameOfType(nsIFrame::eMathML)) {
if (aFrame->IsMathMLFrame()) {
TRACE("MathML");
RecreateFramesForContent(aFrame->GetContent(), InsertionKind::Async);
return true;

Просмотреть файл

@ -682,7 +682,7 @@ class nsCSSFrameConstructor final : public nsFrameManager {
inline box. */
#define FCDATA_IS_INLINE 0x1000
/* If FCDATA_IS_LINE_PARTICIPANT is set, the frame is something that will
return true for IsFrameOfType(nsIFrame::eLineParticipant) */
return true for IsLineParticipant() */
#define FCDATA_IS_LINE_PARTICIPANT 0x2000
/* If FCDATA_IS_LINE_BREAK is set, the frame is something that will
induce a line break boundary before and after itself. */

Просмотреть файл

@ -58,9 +58,12 @@ static nsIFrame* CheckForTrailingTextFrameRecursive(nsIFrame* aFrame,
nsIFrame* aStopAtFrame) {
if (aFrame == aStopAtFrame ||
((aFrame->IsTextFrame() &&
(static_cast<nsTextFrame*>(aFrame))->IsAtEndOfLine())))
(static_cast<nsTextFrame*>(aFrame))->IsAtEndOfLine()))) {
return aFrame;
if (!aFrame->IsFrameOfType(nsIFrame::eLineParticipant)) return nullptr;
}
if (!aFrame->IsLineParticipant()) {
return nullptr;
}
for (nsIFrame* f : aFrame->PrincipalChildList()) {
nsIFrame* r = CheckForTrailingTextFrameRecursive(f, aStopAtFrame);
@ -70,7 +73,7 @@ static nsIFrame* CheckForTrailingTextFrameRecursive(nsIFrame* aFrame,
}
static nsLineBox* FindContainingLine(nsIFrame* aFrame) {
while (aFrame && aFrame->IsFrameOfType(nsIFrame::eLineParticipant)) {
while (aFrame && aFrame->IsLineParticipant()) {
nsIFrame* parent = aFrame->GetParent();
nsBlockFrame* blockParent = do_QueryFrame(parent);
if (blockParent) {

Просмотреть файл

@ -5047,10 +5047,10 @@ nscoord nsLayoutUtils::IntrinsicForAxis(
}
if (MOZ_UNLIKELY(aFlags & nsLayoutUtils::MIN_INTRINSIC_ISIZE) &&
// FIXME: Bug 1715681. Should we use eReplacedSizing instead
// because eReplaced is set on some other frames which are
// FIXME: Bug 1715681. Should we use HasReplacedSizing instead
// because IsReplaced is set on some other frames which are
// non-replaced elements, e.g. <select>?
aFrame->IsFrameOfType(nsIFrame::eReplaced)) {
aFrame->IsReplaced()) {
// This is the 'min-width/height:auto' "transferred size" piece of:
// https://drafts.csswg.org/css-flexbox-1/#min-size-auto
// https://drafts.csswg.org/css-grid/#min-size-auto
@ -5079,8 +5079,7 @@ nscoord nsLayoutUtils::IntrinsicForAxis(
// then we can drop the check of eSupportsAspectRatio).
const AspectRatio ar = stylePos->mAspectRatio.ToLayoutRatio();
if (isInlineAxis && ar && nsIFrame::ToExtremumLength(styleISize) &&
aFrame->IsFrameOfType(nsIFrame::eSupportsAspectRatio) &&
!inlineSizeFromAspectRatio) {
aFrame->SupportsAspectRatio() && !inlineSizeFromAspectRatio) {
// This 'B' in |styleBSize| means the block size of |aFrame|. We go into
// this branch only if |aAxis| is the inline axis of |aFrame|.
const StyleSize& styleBSize =
@ -8211,8 +8210,7 @@ static bool ShouldInflateFontsForContainer(const nsIFrame* aFrame) {
// We also want to disable font inflation for containers that have
// preformatted text.
// MathML cells need special treatment. See bug 1002526 comment 56.
(styleText->WhiteSpaceCanWrap(aFrame) ||
aFrame->IsFrameOfType(nsIFrame::eMathML));
(styleText->WhiteSpaceCanWrap(aFrame) || aFrame->IsMathMLFrame());
}
nscoord nsLayoutUtils::InflationMinFontSizeFor(const nsIFrame* aFrame) {
@ -8668,8 +8666,7 @@ AutoMaybeDisableFontInflation::AutoMaybeDisableFontInflation(nsIFrame* aFrame) {
// descendants) width, we could probably disable inflation in
// fewer cases than we currently do.
// MathML cells need special treatment. See bug 1002526 comment 56.
if (aFrame->IsContainerForFontSizeInflation() &&
!aFrame->IsFrameOfType(nsIFrame::eMathML)) {
if (aFrame->IsContainerForFontSizeInflation() && !aFrame->IsMathMLFrame()) {
mPresContext = aFrame->PresContext();
mOldValue = mPresContext->mInflationDisabledForShrinkWrap;
mPresContext->mInflationDisabledForShrinkWrap = true;
@ -9538,7 +9535,7 @@ bool nsLayoutUtils::IsInvisibleBreak(nsINode* aNode,
}
nsContainerFrame* f = frame->GetParent();
while (f && f->IsFrameOfType(nsIFrame::eLineParticipant)) {
while (f && f->IsLineParticipant()) {
f = f->GetParent();
}
nsBlockFrame* blockAncestor = do_QueryFrame(f);
@ -9763,7 +9760,7 @@ nsPoint nsLayoutUtils::ComputeOffsetToUserSpace(nsDisplayListBuilder* aBuilder,
nsPoint offsetToBoundingBox =
aBuilder->ToReferenceFrame(aFrame) -
SVGIntegrationUtils::GetOffsetToBoundingBox(aFrame);
if (!aFrame->IsFrameOfType(nsIFrame::eSVG)) {
if (!aFrame->IsSVGFrame()) {
// Snap the offset if the reference frame is not a SVG frame, since other
// frames will be snapped to pixel when rendering.
offsetToBoundingBox =

Просмотреть файл

@ -27,11 +27,6 @@ class nsCheckboxRadioFrame final : public nsAtomicContainerFrame,
nsPresContext* aPresContext);
// nsIFrame replacements
virtual bool IsFrameOfType(uint32_t aFlags) const override {
return nsAtomicContainerFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;

Просмотреть файл

@ -744,11 +744,6 @@ class nsComboboxDisplayFrame final : public nsBlockFrame {
}
#endif
bool IsFrameOfType(uint32_t aFlags) const final {
return nsBlockFrame::IsFrameOfType(aFlags &
~(nsIFrame::eReplacedContainsBlock));
}
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput, nsReflowStatus& aStatus) final;

Просмотреть файл

@ -94,11 +94,6 @@ class nsComboboxControlFrame final : public nsBlockFrame,
void PaintFocus(DrawTarget& aDrawTarget, nsPoint aPt);
bool IsFrameOfType(uint32_t aFlags) const final {
return nsBlockFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
void Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) final;

Просмотреть файл

@ -47,11 +47,6 @@ class nsDateTimeControlFrame final : public nsContainerFrame {
}
#endif
bool IsFrameOfType(uint32_t aFlags) const override {
return nsContainerFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
// Reflow
nscoord GetMinISize(gfxContext* aRenderingContext) override;

Просмотреть файл

@ -62,10 +62,6 @@ class nsFieldSetFrame final : public nsContainerFrame {
nsIFrame* aOldFrame) override;
#endif
bool IsFrameOfType(uint32_t aFlags) const override {
return nsContainerFrame::IsFrameOfType(
aFlags & ~nsIFrame::eCanContainOverflowContainers);
}
nsIScrollableFrame* GetScrollTargetFrame() const override;
// Return the block wrapper around our kids.

Просмотреть файл

@ -110,11 +110,6 @@ class nsFileControlFrame final : public nsBlockFrame,
bool aSupportsMultiple);
};
bool IsFrameOfType(uint32_t aFlags) const override {
return nsBlockFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
/**
* The text box input.
* @see nsFileControlFrame::CreateAnonymousContent

Просмотреть файл

@ -80,11 +80,6 @@ class nsHTMLButtonControlFrame : public nsContainerFrame,
return PrincipalChildList().FirstChild()->GetContentInsertionFrame();
}
bool IsFrameOfType(uint32_t aFlags) const override {
return nsContainerFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
// Return the ::-moz-button-content anonymous box.
void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;

Просмотреть файл

@ -88,11 +88,6 @@ class nsListControlFrame final : public nsHTMLScrollFrame,
mozilla::dom::HTMLOptionElement* GetCurrentOption() const;
bool IsFrameOfType(uint32_t aFlags) const final {
return nsHTMLScrollFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
#ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const final;
#endif

Просмотреть файл

@ -58,11 +58,6 @@ class nsMeterFrame final : public nsContainerFrame,
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
virtual bool IsFrameOfType(uint32_t aFlags) const override {
return nsContainerFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
/**
* Returns whether the frame and its child should use the native style.
*/

Просмотреть файл

@ -63,11 +63,6 @@ class nsProgressFrame final : public nsContainerFrame,
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
virtual bool IsFrameOfType(uint32_t aFlags) const override {
return nsContainerFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
/**
* Returns whether the frame and its child should use the native style.
*/

Просмотреть файл

@ -87,11 +87,6 @@ class nsRangeFrame final : public nsContainerFrame,
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
virtual bool IsFrameOfType(uint32_t aFlags) const override {
return nsContainerFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
/**
* Returns true if the slider's thumb moves horizontally, or else false if it
* moves vertically.

Просмотреть файл

@ -107,11 +107,6 @@ class nsTextControlFrame : public nsContainerFrame,
}
#endif
bool IsFrameOfType(uint32_t aFlags) const override {
return nsContainerFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
// nsIAnonymousContentCreator
nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,

Просмотреть файл

@ -63,11 +63,6 @@ class BRFrame final : public nsIFrame {
WritingMode aWM, BaselineSharingGroup aBaselineGroup,
BaselineExportContext) const override;
bool IsFrameOfType(uint32_t aFlags) const override {
return nsIFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eLineParticipant));
}
#ifdef ACCESSIBILITY
mozilla::a11y::AccType AccessibleType() override;
#endif

Просмотреть файл

@ -3,22 +3,16 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Leaf constants to pass to Frame's leafness argument.
LEAF = "Leaf"
NOT_LEAF = "NotLeaf"
DYNAMIC_LEAF = "DynamicLeaf"
class FrameClass:
def __init__(self, cls):
self.cls = cls
class Frame(FrameClass):
def __init__(self, cls, ty, leafness):
def __init__(self, cls, ty, flags):
FrameClass.__init__(self, cls)
self.ty = ty
self.leafness = leafness
self.flags = flags
self.is_concrete = True

Просмотреть файл

@ -3,11 +3,37 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Frame class definitions, used to generate FrameIdList.h and FrameTypeList.h
from FrameClass import DYNAMIC_LEAF, LEAF, NOT_LEAF, AbstractFrame, Frame
from FrameClass import AbstractFrame, Frame
# Most frames support these.
COMMON = {"SupportsCSSTransforms", "SupportsContainLayoutAndPaint", "SupportsAspectRatio"}
LEAF = {"Leaf"}
MATHML = {"MathML"}
SVG = {"SVG"}
BLOCK = COMMON | {"CanContainOverflowContainers"}
REPLACED = COMMON | {"Replaced"}
REPLACED_SIZING = REPLACED | {"ReplacedSizing"}
REPLACED_WITH_BLOCK = REPLACED | {"ReplacedContainsBlock"}
REPLACED_SIZING_WITH_BLOCK = REPLACED_SIZING | REPLACED_WITH_BLOCK
TABLE = COMMON - {"SupportsCSSTransforms"}
TABLE_PART = {"SupportsCSSTransforms", "TablePart"}
TABLE_CELL = TABLE_PART | {"SupportsContainLayoutAndPaint"}
MATHML_CONTAINER = (COMMON - {"SupportsContainLayoutAndPaint"}) | MATHML
SVG_CONTENT = (COMMON - {"SupportsContainLayoutAndPaint"}) | SVG
SVG_CONTAINER = SVG_CONTENT | {"SVGContainer"}
# NOTE: Intentionally not including "COMMON" here.
INLINE = {"BidiInlineContainer", "LineParticipant"}
RUBY_CONTENT = {"LineParticipant"}
# FIXME(bug 713387): Shouldn't be Replaced, probably.
TEXT = COMMON | {"Replaced", "LineParticipant"} | LEAF
# See FrameClass.py and GenerateFrameLists.py for implementation details.
# The following is a list of all the frame classes, followed by the frame type,
# and whether they are a leaf.
# and a set of flags.
#
# The frame type is somewhat arbitrary (could literally be anything) but for
# new frame class implementations it's probably a good idea to make it a unique
@ -15,131 +41,134 @@ from FrameClass import DYNAMIC_LEAF, LEAF, NOT_LEAF, AbstractFrame, Frame
#
# See bug 1555477 for some related discussion about the whole Type() set-up.
FRAME_CLASSES = [
Frame("BRFrame", "Br", LEAF),
Frame("nsBCTableCellFrame", "TableCell", NOT_LEAF),
Frame("nsBackdropFrame", "Backdrop", LEAF),
Frame("nsBlockFrame", "Block", NOT_LEAF),
Frame("nsCanvasFrame", "Canvas", NOT_LEAF),
Frame("nsCheckboxRadioFrame", "CheckboxRadio", LEAF),
Frame("nsColorControlFrame", "ColorControl", LEAF),
Frame("nsColumnSetFrame", "ColumnSet", NOT_LEAF),
Frame("ColumnSetWrapperFrame", "ColumnSetWrapper", NOT_LEAF),
Frame("nsComboboxControlFrame", "ComboboxControl", NOT_LEAF),
Frame("nsComboboxDisplayFrame", "ComboboxDisplay", NOT_LEAF),
Frame("nsContinuingTextFrame", "Text", LEAF),
Frame("nsDateTimeControlFrame", "DateTimeControl", NOT_LEAF),
Frame("nsFieldSetFrame", "FieldSet", NOT_LEAF),
Frame("nsFileControlFrame", "Block", LEAF),
Frame("FileControlLabelFrame", "Block", NOT_LEAF),
Frame("nsFirstLetterFrame", "Letter", NOT_LEAF),
Frame("nsFirstLineFrame", "Line", NOT_LEAF),
Frame("nsFlexContainerFrame", "FlexContainer", NOT_LEAF),
Frame("nsIFrame", "None", NOT_LEAF),
Frame("nsGfxButtonControlFrame", "GfxButtonControl", LEAF),
Frame("nsGridContainerFrame", "GridContainer", NOT_LEAF),
Frame("nsHTMLButtonControlFrame", "HTMLButtonControl", NOT_LEAF),
Frame("nsHTMLCanvasFrame", "HTMLCanvas", NOT_LEAF),
Frame("nsHTMLFramesetBlankFrame", "None", LEAF),
Frame("nsHTMLFramesetBorderFrame", "None", LEAF),
Frame("nsHTMLFramesetFrame", "FrameSet", LEAF),
Frame("nsHTMLScrollFrame", "Scroll", NOT_LEAF),
Frame("nsImageControlFrame", "ImageControl", LEAF),
Frame("nsImageFrame", "Image", DYNAMIC_LEAF),
Frame("nsInlineFrame", "Inline", NOT_LEAF),
Frame("nsListControlFrame", "ListControl", NOT_LEAF),
Frame("nsMathMLFrame", "None", NOT_LEAF),
Frame("nsMathMLmactionFrame", "None", NOT_LEAF),
Frame("nsMathMLmathBlockFrame", "Block", NOT_LEAF),
Frame("nsMathMLmathInlineFrame", "Inline", NOT_LEAF),
Frame("nsMathMLmencloseFrame", "None", NOT_LEAF),
Frame("nsMathMLmfracFrame", "None", NOT_LEAF),
Frame("nsMathMLmmultiscriptsFrame", "None", NOT_LEAF),
Frame("nsMathMLmoFrame", "None", NOT_LEAF),
Frame("nsMathMLmpaddedFrame", "None", NOT_LEAF),
Frame("nsMathMLmrootFrame", "None", NOT_LEAF),
Frame("nsMathMLmrowFrame", "None", NOT_LEAF),
Frame("nsMathMLmspaceFrame", "None", LEAF),
Frame("nsMathMLmsqrtFrame", "None", NOT_LEAF),
Frame("nsMathMLmtableFrame", "Table", NOT_LEAF),
Frame("nsMathMLmtableWrapperFrame", "TableWrapper", NOT_LEAF),
Frame("nsMathMLmtdFrame", "TableCell", NOT_LEAF),
Frame("nsMathMLmtdInnerFrame", "Block", NOT_LEAF),
Frame("nsMathMLmtrFrame", "TableRow", NOT_LEAF),
Frame("nsMathMLmunderoverFrame", "None", NOT_LEAF),
Frame("nsMathMLsemanticsFrame", "None", NOT_LEAF),
Frame("nsMathMLTokenFrame", "None", NOT_LEAF),
Frame("nsMenuPopupFrame", "MenuPopup", NOT_LEAF),
Frame("nsMeterFrame", "Meter", LEAF),
Frame("nsNumberControlFrame", "TextInput", LEAF),
Frame("nsPageBreakFrame", "PageBreak", LEAF),
Frame("nsPageContentFrame", "PageContent", NOT_LEAF),
Frame("nsPageFrame", "Page", NOT_LEAF),
Frame("nsPlaceholderFrame", "Placeholder", LEAF),
Frame("nsProgressFrame", "Progress", LEAF),
Frame("nsRangeFrame", "Range", LEAF),
Frame("nsRubyBaseContainerFrame", "RubyBaseContainer", NOT_LEAF),
Frame("nsRubyBaseFrame", "RubyBase", NOT_LEAF),
Frame("nsRubyFrame", "Ruby", NOT_LEAF),
Frame("nsRubyTextContainerFrame", "RubyTextContainer", NOT_LEAF),
Frame("nsRubyTextFrame", "RubyText", NOT_LEAF),
Frame("SimpleXULLeafFrame", "SimpleXULLeaf", LEAF),
Frame("nsScrollbarButtonFrame", "SimpleXULLeaf", LEAF),
Frame("nsScrollbarFrame", "Scrollbar", NOT_LEAF),
Frame("BRFrame", "Br", REPLACED | LEAF | {"LineParticipant"}),
Frame("nsBCTableCellFrame", "TableCell", TABLE_CELL),
Frame("nsBackdropFrame", "Backdrop", COMMON | LEAF),
Frame("nsBlockFrame", "Block", BLOCK),
Frame("nsCanvasFrame", "Canvas", BLOCK),
# FIXME(emilio, bug 1866692): These don't have a block, wtf? Can we remove the "ReplacedContainsBlock" flag
Frame("nsCheckboxRadioFrame", "CheckboxRadio", REPLACED_WITH_BLOCK | LEAF),
Frame("nsColorControlFrame", "ColorControl", REPLACED_WITH_BLOCK | LEAF),
Frame("nsColumnSetFrame", "ColumnSet", COMMON),
Frame("ColumnSetWrapperFrame", "ColumnSetWrapper", BLOCK),
Frame("nsComboboxControlFrame", "ComboboxControl", BLOCK | REPLACED_WITH_BLOCK),
# FIXME(emilio, bug 1362907): Revisit these after that bug, this is the
# only frame that has ReplacedContainsBlock but not Replaced, which is
# sketchy.
Frame("nsComboboxDisplayFrame", "ComboboxDisplay", REPLACED_WITH_BLOCK - {"Replaced"}),
Frame("nsContinuingTextFrame", "Text", TEXT),
Frame("nsDateTimeControlFrame", "DateTimeControl", REPLACED_WITH_BLOCK),
Frame("nsFieldSetFrame", "FieldSet", BLOCK),
Frame("nsFileControlFrame", "Block", REPLACED_WITH_BLOCK | LEAF),
Frame("FileControlLabelFrame", "Block", BLOCK | LEAF),
Frame("nsFirstLetterFrame", "Letter", INLINE),
Frame("nsFloatingFirstLetterFrame", "Letter", INLINE - {"LineParticipant"}),
Frame("nsFirstLineFrame", "Line", INLINE),
Frame("nsFlexContainerFrame", "FlexContainer", BLOCK),
Frame("nsIFrame", "None", COMMON),
Frame("nsGfxButtonControlFrame", "GfxButtonControl", REPLACED_WITH_BLOCK | LEAF),
Frame("nsGridContainerFrame", "GridContainer", BLOCK),
Frame("nsHTMLButtonControlFrame", "HTMLButtonControl", REPLACED_WITH_BLOCK),
Frame("nsHTMLCanvasFrame", "HTMLCanvas", REPLACED_SIZING),
Frame("nsHTMLFramesetBlankFrame", "None", COMMON | LEAF),
Frame("nsHTMLFramesetBorderFrame", "None", COMMON | LEAF),
Frame("nsHTMLFramesetFrame", "FrameSet", COMMON | LEAF),
Frame("nsHTMLScrollFrame", "Scroll", COMMON),
Frame("nsImageControlFrame", "ImageControl", REPLACED_SIZING | LEAF),
Frame("nsImageFrame", "Image", REPLACED_SIZING | {"LeafDynamic"}),
Frame("nsInlineFrame", "Inline", INLINE),
Frame("nsListControlFrame", "ListControl", REPLACED_WITH_BLOCK),
Frame("nsMathMLmathBlockFrame", "Block", BLOCK | MATHML),
Frame("nsMathMLmathInlineFrame", "Inline", INLINE | MATHML),
Frame("nsMathMLmencloseFrame", "None", MATHML_CONTAINER),
Frame("nsMathMLmfracFrame", "None", MATHML_CONTAINER),
Frame("nsMathMLmmultiscriptsFrame", "None", MATHML_CONTAINER),
Frame("nsMathMLmoFrame", "None", MATHML_CONTAINER),
Frame("nsMathMLmpaddedFrame", "None", MATHML_CONTAINER),
Frame("nsMathMLmrootFrame", "None", MATHML_CONTAINER),
Frame("nsMathMLmrowFrame", "None", MATHML_CONTAINER),
Frame("nsMathMLmspaceFrame", "None", MATHML_CONTAINER | LEAF),
Frame("nsMathMLmsqrtFrame", "None", MATHML_CONTAINER),
Frame("nsMathMLmtableFrame", "Table", TABLE | MATHML),
Frame("nsMathMLmtableWrapperFrame", "TableWrapper", BLOCK | MATHML),
Frame("nsMathMLmtdFrame", "TableCell", TABLE_CELL | MATHML),
Frame("nsMathMLmtdInnerFrame", "Block", BLOCK | MATHML),
Frame("nsMathMLmtrFrame", "TableRow", TABLE_PART | MATHML),
Frame("nsMathMLmunderoverFrame", "None", MATHML_CONTAINER),
Frame("nsMathMLTokenFrame", "None", MATHML_CONTAINER),
Frame("nsMenuPopupFrame", "MenuPopup", BLOCK),
Frame("nsMeterFrame", "Meter", REPLACED_WITH_BLOCK | LEAF),
Frame("nsNumberControlFrame", "TextInput", REPLACED_WITH_BLOCK | LEAF),
Frame("nsPageBreakFrame", "PageBreak", COMMON | LEAF),
Frame("nsPageContentFrame", "PageContent", BLOCK),
Frame("nsPageFrame", "Page", COMMON),
Frame("nsPlaceholderFrame", "Placeholder", COMMON | LEAF),
Frame("nsProgressFrame", "Progress", REPLACED_WITH_BLOCK | LEAF),
Frame("nsRangeFrame", "Range", REPLACED_WITH_BLOCK | LEAF),
Frame("nsRubyBaseContainerFrame", "RubyBaseContainer", RUBY_CONTENT),
Frame("nsRubyBaseFrame", "RubyBase", RUBY_CONTENT),
Frame("nsRubyFrame", "Ruby", RUBY_CONTENT),
Frame("nsRubyTextContainerFrame", "RubyTextContainer", {"None"}),
Frame("nsRubyTextFrame", "RubyText", RUBY_CONTENT),
Frame("SimpleXULLeafFrame", "SimpleXULLeaf", COMMON | LEAF),
Frame("nsScrollbarButtonFrame", "SimpleXULLeaf", COMMON | LEAF),
Frame("nsScrollbarFrame", "Scrollbar", COMMON),
Frame("nsSearchControlFrame", "SearchControl", LEAF),
Frame("nsSelectsAreaFrame", "Block", NOT_LEAF),
Frame("nsPageSequenceFrame", "PageSequence", NOT_LEAF),
Frame("nsSliderFrame", "Slider", NOT_LEAF),
Frame("nsSplitterFrame", "SimpleXULLeaf", NOT_LEAF),
Frame("nsSubDocumentFrame", "SubDocument", LEAF),
Frame("PrintedSheetFrame", "PrintedSheet", NOT_LEAF),
Frame("SVGAFrame", "SVGA", NOT_LEAF),
Frame("SVGClipPathFrame", "SVGClipPath", NOT_LEAF),
Frame("SVGContainerFrame", "None", NOT_LEAF),
Frame("SVGFEContainerFrame", "SVGFEContainer", NOT_LEAF),
Frame("SVGFEImageFrame", "SVGFEImage", LEAF),
Frame("SVGFELeafFrame", "SVGFELeaf", LEAF),
Frame("SVGFEUnstyledLeafFrame", "SVGFEUnstyledLeaf", LEAF),
Frame("SVGFilterFrame", "SVGFilter", NOT_LEAF),
Frame("SVGForeignObjectFrame", "SVGForeignObject", NOT_LEAF),
Frame("SVGGenericContainerFrame", "SVGGenericContainer", NOT_LEAF),
Frame("SVGGeometryFrame", "SVGGeometry", LEAF),
Frame("SVGGFrame", "SVGG", NOT_LEAF),
Frame("SVGImageFrame", "SVGImage", LEAF),
Frame("SVGInnerSVGFrame", "SVGInnerSVG", NOT_LEAF),
Frame("SVGLinearGradientFrame", "SVGLinearGradient", NOT_LEAF),
Frame("SVGMarkerFrame", "SVGMarker", NOT_LEAF),
Frame("SVGMarkerAnonChildFrame", "SVGMarkerAnonChild", NOT_LEAF),
Frame("SVGMaskFrame", "SVGMask", NOT_LEAF),
Frame("SVGOuterSVGFrame", "SVGOuterSVG", NOT_LEAF),
Frame("SVGOuterSVGAnonChildFrame", "SVGOuterSVGAnonChild", NOT_LEAF),
Frame("SVGPatternFrame", "SVGPattern", NOT_LEAF),
Frame("SVGRadialGradientFrame", "SVGRadialGradient", NOT_LEAF),
Frame("SVGStopFrame", "SVGStop", LEAF),
Frame("SVGSwitchFrame", "SVGSwitch", NOT_LEAF),
Frame("SVGSymbolFrame", "SVGSymbol", NOT_LEAF),
Frame("SVGTextFrame", "SVGText", NOT_LEAF),
Frame("nsSelectsAreaFrame", "Block", BLOCK),
Frame("nsPageSequenceFrame", "PageSequence", COMMON),
Frame("nsSliderFrame", "Slider", COMMON),
Frame("nsSplitterFrame", "SimpleXULLeaf", COMMON | LEAF),
Frame("nsSubDocumentFrame", "SubDocument", REPLACED_SIZING_WITH_BLOCK | LEAF),
Frame("PrintedSheetFrame", "PrintedSheet", COMMON),
Frame("SVGAFrame", "SVGA", SVG_CONTAINER),
Frame("SVGClipPathFrame", "SVGClipPath", SVG_CONTAINER),
Frame("SVGContainerFrame", "None", SVG_CONTAINER),
Frame("SVGFEContainerFrame", "SVGFEContainer", SVG_CONTENT),
Frame("SVGFEImageFrame", "SVGFEImage", SVG_CONTENT | LEAF),
Frame("SVGFELeafFrame", "SVGFELeaf", SVG_CONTENT | LEAF),
Frame("SVGFEUnstyledLeafFrame", "SVGFEUnstyledLeaf", SVG_CONTENT | LEAF),
Frame("SVGFilterFrame", "SVGFilter", SVG_CONTAINER),
Frame("SVGForeignObjectFrame", "SVGForeignObject", SVG_CONTENT),
Frame("SVGGeometryFrame", "SVGGeometry", SVG_CONTENT | LEAF),
Frame("SVGGFrame", "SVGG", SVG_CONTAINER),
Frame("SVGImageFrame", "SVGImage", SVG_CONTENT | LEAF),
Frame("SVGInnerSVGFrame", "SVGInnerSVG", SVG_CONTAINER),
Frame("SVGLinearGradientFrame", "SVGLinearGradient", SVG_CONTAINER),
Frame("SVGMarkerFrame", "SVGMarker", SVG_CONTAINER),
Frame("SVGMarkerAnonChildFrame", "SVGMarkerAnonChild", SVG_CONTAINER),
Frame("SVGMaskFrame", "SVGMask", SVG_CONTAINER),
Frame("SVGOuterSVGFrame", "SVGOuterSVG", SVG_CONTAINER | {"Replaced", "ReplacedSizing", "SupportsContainLayoutAndPaint"}),
Frame("SVGOuterSVGAnonChildFrame", "SVGOuterSVGAnonChild", SVG_CONTAINER),
Frame("SVGPatternFrame", "SVGPattern", SVG_CONTAINER),
Frame("SVGRadialGradientFrame", "SVGRadialGradient", SVG_CONTAINER),
Frame("SVGStopFrame", "SVGStop", SVG_CONTENT | LEAF),
Frame("SVGSwitchFrame", "SVGSwitch", SVG_CONTAINER),
Frame("SVGSymbolFrame", "SVGSymbol", SVG_CONTAINER),
Frame("SVGTextFrame", "SVGText", SVG_CONTAINER),
# Not a leaf, though it always has a ShadowRoot, so in practice light DOM
# children never render.
Frame("SVGUseFrame", "SVGUse", NOT_LEAF),
Frame("MiddleCroppingLabelFrame", "MiddleCroppingLabel", LEAF),
Frame("SVGViewFrame", "SVGView", LEAF),
Frame("nsTableCellFrame", "TableCell", NOT_LEAF),
Frame("nsTableColFrame", "TableCol", LEAF),
Frame("nsTableColGroupFrame", "TableColGroup", NOT_LEAF),
Frame("nsTableFrame", "Table", NOT_LEAF),
Frame("nsTableWrapperFrame", "TableWrapper", NOT_LEAF),
Frame("nsTableRowFrame", "TableRow", NOT_LEAF),
Frame("nsTableRowGroupFrame", "TableRowGroup", NOT_LEAF),
Frame("nsTextControlFrame", "TextInput", LEAF),
Frame("nsTextFrame", "Text", LEAF),
Frame("nsTreeBodyFrame", "SimpleXULLeaf", LEAF),
Frame("nsVideoFrame", "HTMLVideo", NOT_LEAF),
Frame("ViewportFrame", "Viewport", NOT_LEAF),
Frame("WBRFrame", "Wbr", LEAF),
Frame("SVGUseFrame", "SVGUse", SVG_CONTAINER),
Frame("MiddleCroppingLabelFrame", "MiddleCroppingLabel", BLOCK | LEAF),
Frame("SVGViewFrame", "SVGView", SVG_CONTENT | LEAF),
Frame("nsTableCellFrame", "TableCell", TABLE_CELL),
Frame("nsTableColFrame", "TableCol", TABLE_PART),
Frame("nsTableColGroupFrame", "TableColGroup", TABLE_PART),
Frame("nsTableFrame", "Table", TABLE),
Frame("nsTableWrapperFrame", "TableWrapper", BLOCK),
Frame("nsTableRowFrame", "TableRow", TABLE_PART),
Frame("nsTableRowGroupFrame", "TableRowGroup", TABLE_PART),
Frame("nsTextControlFrame", "TextInput", REPLACED_WITH_BLOCK | LEAF),
Frame("nsTextFrame", "Text", TEXT),
Frame("nsTreeBodyFrame", "SimpleXULLeaf", COMMON | LEAF),
Frame("nsVideoFrame", "HTMLVideo", REPLACED_SIZING),
Frame("nsAudioFrame", "HTMLVideo", REPLACED_SIZING - {"SupportsAspectRatio"}),
Frame("ViewportFrame", "Viewport", COMMON),
Frame("WBRFrame", "Wbr", COMMON | LEAF),
# Non-concrete classes (for FrameIID use)
AbstractFrame("MiddleCroppingBlockFrame"),
AbstractFrame("nsContainerFrame"),
AbstractFrame("nsLeafFrame"),
AbstractFrame("nsMathMLFrame"),
AbstractFrame("nsMathMLContainerFrame"),
AbstractFrame("nsRubyContentFrame"),
AbstractFrame("nsSplittableFrame"),

Просмотреть файл

@ -25,7 +25,7 @@ def generate_frame_id_list_h(output, *ignore):
for group in groups:
for frame in group:
output.write(
"FRAME_ID(%s, %s, %s)\n" % (frame.cls, frame.ty, frame.leafness)
"FRAME_ID(%s, %s, %s)\n" % (frame.cls, frame.ty, "|".join("ClassFlags::%s" % flag for flag in sorted(frame.flags)))
)
for frame in FRAME_CLASSES:
if not frame.is_concrete:

Просмотреть файл

@ -157,9 +157,8 @@ ReflowInput::ReflowInput(nsPresContext* aPresContext,
: SizeComputationInput(aFrame, aParentReflowInput.mRenderingContext),
mParentReflowInput(&aParentReflowInput),
mFloatManager(aParentReflowInput.mFloatManager),
mLineLayout(mFrame->IsFrameOfType(nsIFrame::eLineParticipant)
? aParentReflowInput.mLineLayout
: nullptr),
mLineLayout(mFrame->IsLineParticipant() ? aParentReflowInput.mLineLayout
: nullptr),
mBreakType(aParentReflowInput.mBreakType),
mPercentBSizeObserver(
(aParentReflowInput.mPercentBSizeObserver &&
@ -371,8 +370,7 @@ void ReflowInput::Init(nsPresContext* aPresContext,
return;
}
mFlags.mIsReplaced = mFrame->IsFrameOfType(nsIFrame::eReplaced) ||
mFrame->IsFrameOfType(nsIFrame::eReplacedContainsBlock);
mFlags.mIsReplaced = mFrame->IsReplaced() || mFrame->IsReplacedWithBlock();
InitConstraints(aPresContext, aContainingBlockSize, aBorder, aPadding, type);
@ -449,13 +447,13 @@ void ReflowInput::Init(nsPresContext* aPresContext,
SetAvailableBSize(NS_UNCONSTRAINEDSIZE);
}
LAYOUT_WARN_IF_FALSE((mStyleDisplay->IsInlineOutsideStyle() &&
!mFrame->IsFrameOfType(nsIFrame::eReplaced)) ||
type == LayoutFrameType::Text ||
ComputedISize() != NS_UNCONSTRAINEDSIZE,
"have unconstrained inline-size; this should only "
"result from very large sizes, not attempts at "
"intrinsic inline-size calculation");
LAYOUT_WARN_IF_FALSE(
(mStyleDisplay->IsInlineOutsideStyle() && !mFrame->IsReplaced()) ||
type == LayoutFrameType::Text ||
ComputedISize() != NS_UNCONSTRAINEDSIZE,
"have unconstrained inline-size; this should only "
"result from very large sizes, not attempts at "
"intrinsic inline-size calculation");
}
static bool MightBeContainingBlockFor(nsIFrame* aMaybeContainingBlock,
@ -796,7 +794,7 @@ void ReflowInput::InitDynamicReflowRoot() {
}
bool ReflowInput::ShouldApplyAutomaticMinimumOnBlockAxis() const {
MOZ_ASSERT(!mFrame->IsFrameOfType(nsIFrame::eReplacedSizing));
MOZ_ASSERT(!mFrame->HasReplacedSizing());
return mFlags.mIsBSizeSetByAspectRatio &&
!mStyleDisplay->IsScrollableOverflow() &&
mStylePosition->MinBSize(GetWritingMode()).IsAuto();
@ -1542,7 +1540,7 @@ bool ReflowInput::IsInlineSizeComputableByBlockSizeAndAspectRatio(
// We don't have to compute the inline size by aspect-ratio and the resolved
// block size (from insets) for replaced elements.
if (mFrame->IsFrameOfType(nsIFrame::eReplaced)) {
if (mFrame->IsReplaced()) {
return false;
}

Просмотреть файл

@ -448,8 +448,7 @@ struct ReflowInput : public SizeComputationInput {
struct Flags {
Flags() { memset(this, 0, sizeof(*this)); }
// cached mFrame->IsFrameOfType(nsIFrame::eReplaced) ||
// mFrame->IsFrameOfType(nsIFrame::eReplacedContainsBlock)
// cached mFrame->IsReplaced() || mFrame->IsReplacedWithBlock()
bool mIsReplaced : 1;
// used by tables to communicate special reflow (in process) to handle

Просмотреть файл

@ -606,8 +606,7 @@ ScrollAnchorContainer::ExamineAnchorCandidate(nsIFrame* aFrame) const {
return ExamineResult::Exclude;
}
const bool isReplaced = aFrame->IsFrameOfType(nsIFrame::eReplaced);
const bool isReplaced = aFrame->IsReplaced();
const bool isNonReplacedInline =
aFrame->StyleDisplay()->IsInlineInsideStyle() && !isReplaced;

Просмотреть файл

@ -76,7 +76,7 @@ static bool IsAtomicElement(nsIFrame* aFrame, LayoutFrameType aFrameType) {
"unexpected block frame");
MOZ_ASSERT(aFrameType != LayoutFrameType::Placeholder,
"unexpected placeholder frame");
return !aFrame->IsFrameOfType(nsIFrame::eLineParticipant);
return !aFrame->IsLineParticipant();
}
static bool IsFullyClipped(nsTextFrame* aFrame, nscoord aLeft, nscoord aRight,

Просмотреть файл

@ -222,8 +222,7 @@ void nsAbsoluteContainingBlock::Reflow(nsContainerFrame* aDelegatingFrame,
"ShouldAvoidBreakInside should prevent this from happening");
nsIFrame* nextFrame = kidFrame->GetNextInFlow();
if (!kidStatus.IsFullyComplete() &&
aDelegatingFrame->IsFrameOfType(
nsIFrame::eCanContainOverflowContainers)) {
aDelegatingFrame->CanContainOverflowContainers()) {
// Need a continuation
if (!nextFrame) {
nextFrame = aPresContext->PresShell()

Просмотреть файл

@ -140,7 +140,7 @@ static bool FrameHasVisibleInlineContent(nsIFrame* aFrame) {
return true;
}
if (aFrame->IsFrameOfType(nsIFrame::eLineParticipant)) {
if (aFrame->IsLineParticipant()) {
for (nsIFrame* kid : aFrame->PrincipalChildList()) {
if (kid->StyleVisibility()->IsVisible() ||
FrameHasVisibleInlineContent(kid)) {
@ -188,7 +188,7 @@ static nsRect GetFrameTextArea(nsIFrame* aFrame,
if (!textFrame->IsEntirelyWhitespace()) {
textArea = aFrame->InkOverflowRect();
}
} else if (aFrame->IsFrameOfType(nsIFrame::eLineParticipant)) {
} else if (aFrame->IsLineParticipant()) {
for (nsIFrame* kid : aFrame->PrincipalChildList()) {
nsRect kidTextArea = GetFrameTextArea(kid, aBuilder);
textArea.OrWith(kidTextArea);
@ -7791,7 +7791,7 @@ void nsBlockFrame::SetInitialChildList(ChildListID aListID,
(pseudo == PseudoStyleType::scrolledContent &&
!GetParent()->IsListControlFrame()) ||
pseudo == PseudoStyleType::mozSVGText) &&
!IsComboboxControlFrame() && !IsFrameOfType(eMathML) &&
!IsComboboxControlFrame() && !IsMathMLFrame() &&
!IsColumnSetWrapperFrame() &&
RefPtr<ComputedStyle>(GetFirstLetterStyle(PresContext())) != nullptr;
NS_ASSERTION(haveFirstLetterStyle ==
@ -8053,8 +8053,7 @@ bool nsBlockFrame::BlockNeedsFloatManager(nsIFrame* aBlock) {
/* static */
bool nsBlockFrame::BlockCanIntersectFloats(nsIFrame* aFrame) {
return aFrame->IsBlockFrameOrSubclass() &&
!aFrame->IsFrameOfType(nsIFrame::eReplaced) &&
return aFrame->IsBlockFrameOrSubclass() && !aFrame->IsReplaced() &&
!aFrame->HasAnyStateBits(NS_BLOCK_FLOAT_MGR);
}

Просмотреть файл

@ -141,10 +141,6 @@ class nsBlockFrame : public nsContainerFrame {
bool IsFloatContainingBlock() const override;
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
bool IsFrameOfType(uint32_t aFlags) const override {
return nsContainerFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eCanContainOverflowContainers));
}
void InvalidateFrame(uint32_t aDisplayItemKey = 0,
bool aRebuildDisplayItems = true) override;

Просмотреть файл

@ -63,10 +63,6 @@ class nsCanvasFrame final : public nsContainerFrame,
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
bool IsFrameOfType(uint32_t aFlags) const override {
return nsContainerFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eCanContainOverflowContainers));
}
// nsIAnonymousContentCreator
nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;

Просмотреть файл

@ -276,9 +276,8 @@ void nsContainerFrame::Destroy(DestroyContext& aContext) {
SafelyDestroyFrameListProp(aContext, presShell, OverflowProperty());
}
MOZ_ASSERT(
IsFrameOfType(eCanContainOverflowContainers) || !(hasOC || hasEOC),
"this type of frame shouldn't have overflow containers");
MOZ_ASSERT(CanContainOverflowContainers() || !(hasOC || hasEOC),
"this type of frame shouldn't have overflow containers");
if (hasOC) {
SafelyDestroyFrameListProp(aContext, presShell,
OverflowContainersProperty());
@ -339,13 +338,13 @@ void nsContainerFrame::GetChildLists(nsTArray<ChildList>* aLists) const {
reinterpret_cast<L>(aValue)->AppendIfNonempty(aLists,
FrameChildListID::Overflow);
} else if (aProp == OverflowContainersProperty()) {
MOZ_ASSERT(IsFrameOfType(nsIFrame::eCanContainOverflowContainers),
MOZ_ASSERT(CanContainOverflowContainers(),
"found unexpected OverflowContainersProperty");
Unused << this; // silence clang -Wunused-lambda-capture in opt builds
reinterpret_cast<L>(aValue)->AppendIfNonempty(
aLists, FrameChildListID::OverflowContainers);
} else if (aProp == ExcessOverflowContainersProperty()) {
MOZ_ASSERT(IsFrameOfType(nsIFrame::eCanContainOverflowContainers),
MOZ_ASSERT(CanContainOverflowContainers(),
"found unexpected ExcessOverflowContainersProperty");
Unused << this; // silence clang -Wunused-lambda-capture in opt builds
reinterpret_cast<L>(aValue)->AppendIfNonempty(
@ -817,8 +816,7 @@ LogicalSize nsContainerFrame::ComputeAutoSize(
nscoord availBased =
aAvailableISize - aMargin.ISize(aWM) - aBorderPadding.ISize(aWM);
// replaced elements always shrink-wrap
if (aFlags.contains(ComputeSizeFlag::ShrinkWrap) ||
IsFrameOfType(eReplaced)) {
if (aFlags.contains(ComputeSizeFlag::ShrinkWrap) || IsReplaced()) {
// Only bother computing our 'auto' ISize if the result will be used.
const auto& styleISize = aSizeOverrides.mStyleISize
? *aSizeOverrides.mStyleISize
@ -988,7 +986,7 @@ void nsContainerFrame::FinishReflowChild(
const WritingMode& aWM, const LogicalPoint& aPos,
const nsSize& aContainerSize, nsIFrame::ReflowChildFlags aFlags) {
MOZ_ASSERT(!aReflowInput || aReflowInput->mFrame == aKidFrame);
MOZ_ASSERT(aReflowInput || aKidFrame->IsFrameOfType(eMathML) ||
MOZ_ASSERT(aReflowInput || aKidFrame->IsMathMLFrame() ||
aKidFrame->IsTableCellFrame(),
"aReflowInput should be passed in almost all cases");
@ -2624,8 +2622,7 @@ bool nsContainerFrame::ShouldAvoidBreakInside(
void nsContainerFrame::ConsiderChildOverflow(OverflowAreas& aOverflowAreas,
nsIFrame* aChildFrame) {
if (StyleDisplay()->IsContainLayout() &&
IsFrameOfType(eSupportsContainLayoutAndPaint)) {
if (StyleDisplay()->IsContainLayout() && SupportsContainLayoutAndPaint()) {
// If we have layout containment and are not a non-atomic, inline-level
// principal box, we should only consider our child's ink overflow,
// leaving the scrollable regions of the parent unaffected.

Просмотреть файл

@ -628,7 +628,7 @@ class nsContainerFrame : public nsSplittableFrame {
MOZ_ASSERT(aOverflowContainers.NotEmpty(), "Shouldn't set an empty list!");
MOZ_ASSERT(!GetProperty(OverflowContainersProperty()),
"Shouldn't override existing list!");
MOZ_ASSERT(IsFrameOfType(nsIFrame::eCanContainOverflowContainers),
MOZ_ASSERT(CanContainOverflowContainers(),
"This type of frame can't have overflow containers!");
auto* list = new (PresShell()) nsFrameList(std::move(aOverflowContainers));
SetProperty(OverflowContainersProperty(), list);
@ -640,7 +640,7 @@ class nsContainerFrame : public nsSplittableFrame {
"Shouldn't set an empty list!");
MOZ_ASSERT(!GetProperty(ExcessOverflowContainersProperty()),
"Shouldn't override existing list!");
MOZ_ASSERT(IsFrameOfType(nsIFrame::eCanContainOverflowContainers),
MOZ_ASSERT(CanContainOverflowContainers(),
"This type of frame can't have overflow containers!");
auto* list =
new (PresShell()) nsFrameList(std::move(aExcessOverflowContainers));

Просмотреть файл

@ -33,12 +33,23 @@ nsFirstLetterFrame* NS_NewFirstLetterFrame(PresShell* aPresShell,
nsFirstLetterFrame(aStyle, aPresShell->GetPresContext());
}
nsFirstLetterFrame* NS_NewFloatingFirstLetterFrame(PresShell* aPresShell,
ComputedStyle* aStyle) {
return new (aPresShell)
nsFloatingFirstLetterFrame(aStyle, aPresShell->GetPresContext());
}
NS_IMPL_FRAMEARENA_HELPERS(nsFirstLetterFrame)
NS_QUERYFRAME_HEAD(nsFirstLetterFrame)
NS_QUERYFRAME_ENTRY(nsFirstLetterFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
NS_IMPL_FRAMEARENA_HELPERS(nsFloatingFirstLetterFrame)
NS_QUERYFRAME_HEAD(nsFloatingFirstLetterFrame)
NS_QUERYFRAME_ENTRY(nsFloatingFirstLetterFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsFirstLetterFrame)
#ifdef DEBUG_FRAME_DUMP
nsresult nsFirstLetterFrame::GetFrameName(nsAString& aResult) const {
return MakeFrameName(u"Letter"_ns, aResult);

Просмотреть файл

@ -9,43 +9,38 @@
/* rendering object for CSS :first-letter pseudo-element */
#include "mozilla/Attributes.h"
#include "nsContainerFrame.h"
class nsFirstLetterFrame final : public nsContainerFrame {
class nsFirstLetterFrame : public nsContainerFrame {
public:
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS(nsFirstLetterFrame)
explicit nsFirstLetterFrame(ComputedStyle* aStyle,
nsPresContext* aPresContext)
nsFirstLetterFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
ClassID aClassID)
: nsContainerFrame(aStyle, aPresContext, aClassID) {}
nsFirstLetterFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
: nsContainerFrame(aStyle, aPresContext, kClassID) {}
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) final;
virtual void Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
void SetInitialChildList(ChildListID aListID,
nsFrameList&& aChildList) override;
void Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) final;
void SetInitialChildList(ChildListID aListID, nsFrameList&& aChildList) final;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
nsresult GetFrameName(nsAString& aResult) const final;
#endif
bool IsFloating() const { return HasAnyStateBits(NS_FRAME_OUT_OF_FLOW); }
virtual bool IsFrameOfType(uint32_t aFlags) const override {
if (!IsFloating()) aFlags = aFlags & ~(nsIFrame::eLineParticipant);
return nsContainerFrame::IsFrameOfType(aFlags &
~(nsIFrame::eBidiInlineContainer));
}
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
virtual void AddInlineMinISize(gfxContext* aRenderingContext,
InlineMinISizeData* aData) override;
virtual void AddInlinePrefISize(gfxContext* aRenderingContext,
InlinePrefISizeData* aData) override;
nscoord GetMinISize(gfxContext* aRenderingContext) final;
nscoord GetPrefISize(gfxContext* aRenderingContext) final;
void AddInlineMinISize(gfxContext* aRenderingContext,
InlineMinISizeData* aData) final;
void AddInlinePrefISize(gfxContext* aRenderingContext,
InlinePrefISizeData* aData) final;
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
@ -53,22 +48,21 @@ class nsFirstLetterFrame final : public nsContainerFrame {
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
mozilla::ComputeSizeFlags aFlags) final;
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput, nsReflowStatus& aStatus) final;
virtual bool CanContinueTextRun() const override;
Maybe<nscoord> GetNaturalBaselineBOffset(
mozilla::WritingMode aWM, BaselineSharingGroup aBaselineGroup,
BaselineExportContext) const override;
virtual LogicalSides GetLogicalSkipSides() const override;
bool CanContinueTextRun() const final;
Maybe<nscoord> GetNaturalBaselineBOffset(mozilla::WritingMode aWM,
BaselineSharingGroup aBaselineGroup,
BaselineExportContext) const final;
LogicalSides GetLogicalSkipSides() const final;
// override of nsFrame method
virtual nsresult GetChildFrameContainingOffset(
int32_t inContentOffset, bool inHint, int32_t* outFrameContentOffset,
nsIFrame** outChildFrame) override;
// final of nsFrame method
nsresult GetChildFrameContainingOffset(int32_t inContentOffset, bool inHint,
int32_t* outFrameContentOffset,
nsIFrame** outChildFrame) final;
nscoord GetFirstLetterBaseline() const { return mBaseline; }
@ -90,4 +84,13 @@ class nsFirstLetterFrame final : public nsContainerFrame {
void DrainOverflowFrames(nsPresContext* aPresContext);
};
class nsFloatingFirstLetterFrame : public nsFirstLetterFrame {
public:
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS(nsFloatingFirstLetterFrame)
nsFloatingFirstLetterFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
: nsFirstLetterFrame(aStyle, aPresContext, kClassID) {}
};
#endif /* nsFirstLetterFrame_h__ */

Просмотреть файл

@ -1306,9 +1306,8 @@ StyleAlignFlags nsFlexContainerFrame::CSSAlignmentForAbsPosChild(
// absolutely-positioned boxes, and behaves as 'stretch' on all other
// absolutely-positioned boxes."
// https://drafts.csswg.org/css-align/#align-abspos
alignment = aChildRI.mFrame->IsFrameOfType(nsIFrame::eReplaced)
? StyleAlignFlags::START
: StyleAlignFlags::STRETCH;
alignment = aChildRI.mFrame->IsReplaced() ? StyleAlignFlags::START
: StyleAlignFlags::STRETCH;
}
}
@ -1573,7 +1572,7 @@ static nscoord PartiallyResolveAutoMinSize(
// through the aspect ratio (if the item is replaced, and it has an aspect
// ratio and a definite cross size).
if (const auto& aspectRatio = aFlexItem.GetAspectRatio();
aFlexItem.Frame()->IsFrameOfType(nsIFrame::eReplaced) && aspectRatio &&
aFlexItem.Frame()->IsReplaced() && aspectRatio &&
aFlexItem.IsCrossSizeDefinite(aItemReflowInput)) {
// We have a usable aspect ratio. (not going to divide by 0)
nscoord transferredSizeSuggestion = aspectRatio.ComputeRatioDependentSize(

Просмотреть файл

@ -144,11 +144,6 @@ class nsFlexContainerFrame final : public nsContainerFrame,
void Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
bool IsFrameOfType(uint32_t aFlags) const override {
return nsContainerFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eCanContainOverflowContainers));
}
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;

Просмотреть файл

@ -9575,9 +9575,8 @@ StyleAlignFlags nsGridContainerFrame::CSSAlignmentForAbsPosChild(
// absolutely-positioned boxes."
// https://drafts.csswg.org/css-align/#align-abspos
// https://drafts.csswg.org/css-align/#justify-abspos
alignment = aChildRI.mFrame->IsFrameOfType(nsIFrame::eReplaced)
? StyleAlignFlags::START
: StyleAlignFlags::STRETCH;
alignment = aChildRI.mFrame->IsReplaced() ? StyleAlignFlags::START
: StyleAlignFlags::STRETCH;
} else if (alignment == StyleAlignFlags::FLEX_START) {
alignment = StyleAlignFlags::START;
} else if (alignment == StyleAlignFlags::FLEX_END) {

Просмотреть файл

@ -123,10 +123,6 @@ class nsGridContainerFrame final : public nsContainerFrame,
nscoord GetMinISize(gfxContext* aRenderingContext) override;
nscoord GetPrefISize(gfxContext* aRenderingContext) override;
void MarkIntrinsicISizesDirty() override;
bool IsFrameOfType(uint32_t aFlags) const override {
return nsContainerFrame::IsFrameOfType(
aFlags & ~nsIFrame::eCanContainOverflowContainers);
}
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;

Просмотреть файл

@ -74,11 +74,6 @@ class nsHTMLCanvasFrame final : public nsContainerFrame {
virtual mozilla::a11y::AccType AccessibleType() override;
#endif
virtual bool IsFrameOfType(uint32_t aFlags) const override {
return nsSplittableFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedSizing));
}
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif

Просмотреть файл

@ -118,8 +118,11 @@ nsPageContentFrame* NS_NewPageContentFrame(
nsIFrame* NS_NewPageBreakFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle);
class nsFirstLetterFrame;
nsFirstLetterFrame* NS_NewFirstLetterFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle);
nsFirstLetterFrame* NS_NewFirstLetterFrame(mozilla::PresShell*,
mozilla::ComputedStyle*);
class nsFirstLetterFrame;
nsFirstLetterFrame* NS_NewFloatingFirstLetterFrame(mozilla::PresShell*,
mozilla::ComputedStyle*);
class nsFirstLineFrame;
nsFirstLineFrame* NS_NewFirstLineFrame(mozilla::PresShell* aPresShell,
mozilla::ComputedStyle* aStyle);

Просмотреть файл

@ -170,13 +170,7 @@ nsIFrame* nsILineIterator::LineInfo::GetLastFrameOnLine() const {
return maybeLastFrame;
}
const mozilla::LayoutFrameType nsIFrame::sLayoutFrameTypes[
#define FRAME_ID(...) 1 +
#define ABSTRACT_FRAME_ID(...)
#include "mozilla/FrameIdList.h"
#undef FRAME_ID
#undef ABSTRACT_FRAME_ID
0] = {
const mozilla::LayoutFrameType nsIFrame::sLayoutFrameTypes[kFrameClassCount] = {
#define FRAME_ID(class_, type_, ...) mozilla::LayoutFrameType::type_,
#define ABSTRACT_FRAME_ID(...)
#include "mozilla/FrameIdList.h"
@ -184,23 +178,12 @@ const mozilla::LayoutFrameType nsIFrame::sLayoutFrameTypes[
#undef ABSTRACT_FRAME_ID
};
const nsIFrame::FrameClassBits nsIFrame::sFrameClassBits[
#define FRAME_ID(...) 1 +
const nsIFrame::ClassFlags nsIFrame::sLayoutFrameClassFlags[kFrameClassCount] =
{
#define FRAME_ID(class_, type_, flags_, ...) flags_,
#define ABSTRACT_FRAME_ID(...)
#include "mozilla/FrameIdList.h"
#undef FRAME_ID
#undef ABSTRACT_FRAME_ID
0] = {
#define Leaf eFrameClassBitsLeaf
#define NotLeaf eFrameClassBitsNone
#define DynamicLeaf eFrameClassBitsDynamicLeaf
#define FRAME_ID(class_, type_, leaf_, ...) leaf_,
#define ABSTRACT_FRAME_ID(...)
#include "mozilla/FrameIdList.h"
#undef Leaf
#undef NotLeaf
#undef DynamicLeaf
#undef FRAME_ID
#undef ABSTRACT_FRAME_ID
};
@ -496,10 +479,9 @@ static bool IsFontSizeInflationContainer(nsIFrame* aFrame,
* container.
*
* From a code perspective, the only hard requirement is that frames
* that are line participants
* (nsIFrame::IsFrameOfType(nsIFrame::eLineParticipant)) are never
* containers, since line layout assumes that the inflation is
* consistent within a line.
* that are line participants (nsIFrame::IsLineParticipant) are never
* containers, since line layout assumes that the inflation is consistent
* within a line.
*
* This is not an imposition, since we obviously want a bunch of text
* (possibly with inline elements) flowing within a block to count the
@ -548,12 +530,11 @@ static bool IsFontSizeInflationContainer(nsIFrame* aFrame,
(content->IsAnyOfHTMLElements(nsGkAtoms::option, nsGkAtoms::optgroup,
nsGkAtoms::select, nsGkAtoms::input,
nsGkAtoms::button, nsGkAtoms::textarea)));
NS_ASSERTION(!aFrame->IsFrameOfType(nsIFrame::eLineParticipant) || isInline ||
NS_ASSERTION(!aFrame->IsLineParticipant() || isInline ||
// br frames and mathml frames report being line
// participants even when their position or display is
// set
aFrame->IsBrFrame() ||
aFrame->IsFrameOfType(nsIFrame::eMathML),
aFrame->IsBrFrame() || aFrame->IsMathMLFrame(),
"line participants must not be containers");
return !isInline;
}
@ -611,8 +592,6 @@ void nsIFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) {
MOZ_ASSERT(nsQueryFrame::FrameIID(mClass) == GetFrameId());
MOZ_ASSERT(!mContent, "Double-initing a frame?");
NS_ASSERTION(IsFrameOfType(eDEBUGAllFrames) && !IsFrameOfType(eDEBUGNoFrames),
"IsFrameOfType implementation that doesn't call base class");
mContent = aContent;
mParent = aParent;
@ -690,12 +669,12 @@ void nsIFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
// because when initializng the table wrapper frame, we don't yet have
// access to its children so we can't tell if we have transform
// animations or not.
if (IsFrameOfType(eSupportsCSSTransforms)) {
if (SupportsCSSTransforms()) {
mMayHaveTransformAnimation = true;
AddStateBits(NS_FRAME_MAY_BE_TRANSFORMED);
} else if (aParent && nsLayoutUtils::GetStyleFrame(aParent) == this) {
MOZ_ASSERT(
aParent->IsFrameOfType(eSupportsCSSTransforms),
aParent->SupportsCSSTransforms(),
"Style frames that don't support transforms should have parents"
" that do");
aParent->mMayHaveTransformAnimation = true;
@ -1420,8 +1399,7 @@ void nsIFrame::HandleLastRememberedSize() {
element->RemoveLastRememberedISize();
}
if ((canRememberBSize || canRememberISize) && !HidesContent()) {
bool isNonReplacedInline = IsFrameOfType(nsIFrame::eLineParticipant) &&
!IsFrameOfType(nsIFrame::eReplaced);
bool isNonReplacedInline = IsLineParticipant() && !IsReplaced();
if (!isNonReplacedInline) {
PresContext()->Document()->ObserveForLastRememberedSize(*element);
return;
@ -1709,7 +1687,7 @@ bool nsIFrame::IsCSSTransformed() const {
bool nsIFrame::HasAnimationOfTransform() const {
return IsPrimaryFrame() &&
nsLayoutUtils::HasAnimationOfTransformAndMotionPath(this) &&
IsFrameOfType(eSupportsCSSTransforms);
SupportsCSSTransforms();
}
bool nsIFrame::ChildrenHavePerspective(
@ -1756,7 +1734,7 @@ bool nsIFrame::Extend3DContext(const nsStyleDisplay* aStyleDisplay,
}
const nsStyleDisplay* disp = StyleDisplayWithOptionalParam(aStyleDisplay);
if (disp->mTransformStyle != StyleTransformStyle::Preserve3d ||
!IsFrameOfType(nsIFrame::eSupportsCSSTransforms)) {
!SupportsCSSTransforms()) {
return false;
}
@ -2409,7 +2387,7 @@ static inline bool IsIntrinsicKeyword(const SizeOrMaxSize& aSize) {
bool nsIFrame::CanBeDynamicReflowRoot() const {
const auto& display = *StyleDisplay();
if (IsFrameOfType(nsIFrame::eLineParticipant) || display.mDisplay.IsRuby() ||
if (IsLineParticipant() || display.mDisplay.IsRuby() ||
display.IsInnerTableStyle() ||
display.DisplayInside() == StyleDisplayInside::Table) {
// We have a display type where 'width' and 'height' don't actually set the
@ -3930,7 +3908,7 @@ static bool DescendIntoChild(nsDisplayListBuilder* aBuilder,
return true;
}
if (aChild->IsFrameOfType(nsIFrame::eTablePart)) {
if (aChild->IsTablePart()) {
// Relative positioning and transforms can cause table parts to move, but we
// will still paint the backgrounds for their ancestor parts under them at
// their 'normal' position. That means that we must consider the overflow
@ -3943,7 +3921,7 @@ static bool DescendIntoChild(nsDisplayListBuilder* aBuilder,
const nsIFrame* f = aChild;
nsRect normalPositionOverflowRelativeToTable = overflow;
while (f->IsFrameOfType(nsIFrame::eTablePart)) {
while (f->IsTablePart()) {
normalPositionOverflowRelativeToTable += f->GetNormalPosition();
f = f->GetParent();
}
@ -4166,7 +4144,7 @@ void nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
if (!pseudoStackingContext && !isSVG &&
aFlags.contains(DisplayChildFlag::Inline) &&
!child->IsFrameOfType(eLineParticipant)) {
!child->IsLineParticipant()) {
// child is a non-inline frame in an inline context, i.e.,
// it acts like inline-block or inline-table. Therefore it is a
// pseudo-stacking-context.
@ -4289,10 +4267,9 @@ void nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
child->MarkAbsoluteFramesForDisplayList(aBuilder);
child->SetBuiltDisplayList(true);
if (!awayFromCommonPath &&
// Some SVG frames might change opacity without invalidating the frame,
// so exclude them from the fast-path.
!child->IsFrameOfType(nsIFrame::eSVG)) {
// Some SVG frames might change opacity without invalidating the frame, so
// exclude them from the fast-path.
if (!awayFromCommonPath && !child->IsSVGFrame()) {
// The shortcut is available for the child for next time.
child->AddStateBits(NS_FRAME_SIMPLE_DISPLAYLIST);
}
@ -5853,7 +5830,7 @@ StyleImageRendering nsIFrame::UsedImageRendering() const {
// The touch-action CSS property applies to: all elements except: non-replaced
// inline elements, table rows, row groups, table columns, and column groups.
StyleTouchAction nsIFrame::UsedTouchAction() const {
if (IsFrameOfType(eLineParticipant)) {
if (IsLineParticipant()) {
return StyleTouchAction::AUTO;
}
auto& disp = *StyleDisplay();
@ -6189,7 +6166,7 @@ AspectRatio nsIFrame::GetAspectRatio() const {
// https://drafts.csswg.org/css-sizing-4/#aspect-ratio
// For those frame types that don't support aspect-ratio, they must not have
// the natural ratio, so this early return is fine.
if (!IsFrameOfType(eSupportsAspectRatio)) {
if (!SupportsAspectRatio()) {
return AspectRatio();
}
@ -6496,7 +6473,7 @@ nsIFrame::SizeComputationResult nsIFrame::ComputeSize(
// This means we successfully applied aspect-ratio and now need to check
// if we need to apply the implied minimum size:
// https://drafts.csswg.org/css-sizing-4/#aspect-ratio-minimum
MOZ_ASSERT(!IsFrameOfType(eReplacedSizing),
MOZ_ASSERT(!HasReplacedSizing(),
"aspect-ratio minimums should not apply to replaced elements");
// The inline size computed by aspect-ratio shouldn't less than the content
// size.
@ -6687,7 +6664,7 @@ Maybe<nscoord> nsIFrame::ComputeInlineSizeFromAspectRatio(
aSizeOverrides.mAspectRatio
? *aSizeOverrides.mAspectRatio
: StylePosition()->mAspectRatio.ToLayoutRatio();
if (!IsFrameOfType(eSupportsAspectRatio) || !aspectRatio) {
if (!SupportsAspectRatio() || !aspectRatio) {
return Nothing();
}
@ -7969,7 +7946,7 @@ void nsIFrame::UnionChildOverflow(OverflowAreas& aOverflowAreas) {
// property or preferred size property should be resolved against zero. This is
// handled in IsPercentageResolvedAgainstZero().
inline static bool FormControlShrinksForPercentSize(const nsIFrame* aFrame) {
if (!aFrame->IsFrameOfType(nsIFrame::eReplaced)) {
if (!aFrame->IsReplaced()) {
// Quick test to reject most frames.
return false;
}
@ -8003,7 +7980,7 @@ bool nsIFrame::IsPercentageResolvedAgainstZero(
const StyleSize& aStyleSize, const StyleMaxSize& aStyleMaxSize) const {
const bool sizeHasPercent = aStyleSize.HasPercent();
return ((sizeHasPercent || aStyleMaxSize.HasPercent()) &&
IsFrameOfType(nsIFrame::eReplacedSizing)) ||
HasReplacedSizing()) ||
(sizeHasPercent && FormControlShrinksForPercentSize(this));
}
@ -8023,8 +8000,7 @@ bool nsIFrame::IsPercentageResolvedAgainstZero(const LengthPercentage& aSize,
return true;
}
const bool hasPercentOnReplaced =
aSize.HasPercent() && IsFrameOfType(nsIFrame::eReplacedSizing);
const bool hasPercentOnReplaced = aSize.HasPercent() && HasReplacedSizing();
if (aProperty == SizeProperty::MaxSize) {
return hasPercentOnReplaced;
}
@ -8077,8 +8053,7 @@ bool nsIFrame::IsBlockContainer() const {
//
// If we ever start skipping table row groups from being containing blocks,
// you need to remove the StickyScrollContainer hack referencing bug 1421660.
return !IsFrameOfType(nsIFrame::eLineParticipant) && !IsBlockWrapper() &&
!IsSubgrid() &&
return !IsLineParticipant() && !IsBlockWrapper() && !IsSubgrid() &&
// Table rows are not containing blocks either
!IsTableRowFrame();
}
@ -9853,8 +9828,7 @@ static nsRect ComputeOutlineInnerRect(
// aOutValid is set to false if the returned nsRect is not valid
// and should not be included in the outline rectangle.
aOutValid = !aFrame->HasAnyStateBits(NS_FRAME_SVG_LAYOUT) ||
!aFrame->IsFrameOfType(nsIFrame::eSVGContainer) ||
aFrame->IsSVGTextFrame();
!aFrame->IsSVGContainerFrame() || aFrame->IsSVGTextFrame();
nsRect u;
@ -11001,7 +10975,7 @@ bool nsIFrame::IsStackingContext(const nsStyleDisplay* aStyleDisplay,
auto willChange = aStyleDisplay->mWillChange.bits;
if (aStyleDisplay->IsContainPaint() || aStyleDisplay->IsContainLayout() ||
willChange & StyleWillChangeBits::CONTAIN) {
if (IsFrameOfType(eSupportsContainLayoutAndPaint)) {
if (SupportsContainLayoutAndPaint()) {
return true;
}
}
@ -11009,7 +10983,7 @@ bool nsIFrame::IsStackingContext(const nsStyleDisplay* aStyleDisplay,
// but the spec says it acts like the rest of these
if (aStyleDisplay->HasPerspectiveStyle() ||
willChange & StyleWillChangeBits::PERSPECTIVE) {
if (IsFrameOfType(eSupportsCSSTransforms)) {
if (SupportsCSSTransforms()) {
return true;
}
}
@ -11442,7 +11416,7 @@ nsIFrame::PhysicalAxes nsIFrame::ShouldApplyOverflowClipping(
// 'contain:paint' should prevent all means of escaping that clipping
// (e.g. because it forms a fixed-pos containing block).
if (aDisp->IsContainPaint() && !IsScrollFrame() &&
IsFrameOfType(eSupportsContainLayoutAndPaint)) {
SupportsContainLayoutAndPaint()) {
return PhysicalAxes::Both;
}
@ -11460,7 +11434,7 @@ nsIFrame::PhysicalAxes nsIFrame::ShouldApplyOverflowClipping(
case LayoutFrameType::SVGForeignObject:
return PhysicalAxes::Both;
default:
if (IsFrameOfType(nsIFrame::eReplacedContainsBlock)) {
if (IsReplacedWithBlock()) {
if (type == mozilla::LayoutFrameType::TextInput) {
// It has an anonymous scroll frame that handles any overflow.
return PhysicalAxes::None;

Просмотреть файл

@ -520,6 +520,43 @@ struct MOZ_RAII FrameDestroyContext {
AutoTArray<RefPtr<nsIContent>, 100> mAnonymousContent;
};
/**
* Bit-flags specific to a given layout class id.
*/
enum class LayoutFrameClassFlags : uint16_t {
None = 0,
Leaf = 1 << 0,
LeafDynamic = 1 << 1,
MathML = 1 << 2,
SVG = 1 << 3,
SVGContainer = 1 << 4,
BidiInlineContainer = 1 << 5,
// The frame is for a replaced element, such as an image
Replaced = 1 << 6,
// Frame that contains a block but looks like a replaced element from the
// outside.
ReplacedContainsBlock = 1 << 7,
// A replaced element that has replaced-element sizing characteristics (i.e.,
// like images or iframes), as opposed to inline-block sizing characteristics
// (like form controls).
ReplacedSizing = 1 << 8,
// A frame that participates in inline reflow, i.e., one that requires
// ReflowInput::mLineLayout.
LineParticipant = 1 << 9,
// Whether this frame is a table part (but not a table or table wrapper).
TablePart = 1 << 10,
CanContainOverflowContainers = 1 << 11,
// Whether the frame supports CSS transforms.
SupportsCSSTransforms = 1 << 12,
// Whether this frame class supports 'contain: layout' and 'contain: paint'
// (supporting one is equivalent to supporting the other).
SupportsContainLayoutAndPaint = 1 << 13,
// Whether this frame class supports the `aspect-ratio` property.
SupportsAspectRatio = 1 << 14,
};
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(LayoutFrameClassFlags)
} // namespace mozilla
/**
@ -578,6 +615,8 @@ class nsIFrame : public nsQueryFrame {
typedef nsQueryFrame::ClassID ClassID;
using ClassFlags = mozilla::LayoutFrameClassFlags;
protected:
using ChildList = mozilla::FrameChildList;
using ChildListID = mozilla::FrameChildListID;
@ -3277,6 +3316,60 @@ class nsIFrame : public nsQueryFrame {
return sLayoutFrameTypes[uint8_t(mClass)];
}
/**
* Get the type flags of the frame.
*
* @see mozilla::LayoutFrameType
*/
ClassFlags GetClassFlags() const {
MOZ_ASSERT(uint8_t(mClass) < mozilla::ArrayLength(sLayoutFrameClassFlags));
return sLayoutFrameClassFlags[uint8_t(mClass)];
}
bool HasAnyClassFlag(ClassFlags aFlag) const {
return bool(GetClassFlags() & aFlag);
}
/**
* Is this a leaf frame? Frames that want the frame constructor to be able to
* construct kids for them should return false, all others should return true.
*
* Note that returning true here does not mean that the frame _can't_ have
* kids. It could still have kids created via nsIAnonymousContentCreator.
*
* Returning true indicates that "normal" (non-anonymous, CSS generated
* content, etc) children should not be constructed.
*/
bool IsLeaf() const {
auto bits = GetClassFlags();
if (MOZ_UNLIKELY(bits & ClassFlags::LeafDynamic)) {
return IsLeafDynamic();
}
return bool(bits & ClassFlags::Leaf);
}
virtual bool IsLeafDynamic() const { return false; }
#define CLASS_FLAG_METHOD(name_, flag_) \
bool name_() const { return HasAnyClassFlag(ClassFlags::flag_); }
#define CLASS_FLAG_METHOD0(name_) CLASS_FLAG_METHOD(name_, name_)
CLASS_FLAG_METHOD(IsMathMLFrame, MathML);
CLASS_FLAG_METHOD(IsSVGFrame, SVG);
CLASS_FLAG_METHOD(IsSVGContainerFrame, SVGContainer);
CLASS_FLAG_METHOD(IsBidiInlineContainer, BidiInlineContainer);
CLASS_FLAG_METHOD(IsLineParticipant, LineParticipant);
CLASS_FLAG_METHOD(IsReplaced, Replaced);
CLASS_FLAG_METHOD(IsReplacedWithBlock, ReplacedContainsBlock);
CLASS_FLAG_METHOD(HasReplacedSizing, ReplacedSizing);
CLASS_FLAG_METHOD(IsTablePart, TablePart);
CLASS_FLAG_METHOD0(CanContainOverflowContainers)
CLASS_FLAG_METHOD0(SupportsCSSTransforms);
CLASS_FLAG_METHOD0(SupportsContainLayoutAndPaint)
CLASS_FLAG_METHOD0(SupportsAspectRatio)
#undef CLASS_FLAG_METHOD
#undef CLASS_FLAG_METHOD0
#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wtype-limits"
@ -3331,63 +3424,6 @@ class nsIFrame : public nsQueryFrame {
nsIFrame** aOutAncestor,
uint32_t aFlags = 0) const;
/**
* Bit-flags to pass to IsFrameOfType()
*/
enum {
eMathML = 1 << 0,
eSVG = 1 << 1,
eSVGContainer = 1 << 2,
eBidiInlineContainer = 1 << 3,
// the frame is for a replaced element, such as an image
eReplaced = 1 << 4,
// Frame that contains a block but looks like a replaced element
// from the outside
eReplacedContainsBlock = 1 << 5,
// A frame that participates in inline reflow, i.e., one that
// requires ReflowInput::mLineLayout.
eLineParticipant = 1 << 6,
eCanContainOverflowContainers = 1 << 7,
eTablePart = 1 << 8,
eSupportsCSSTransforms = 1 << 9,
// A replaced element that has replaced-element sizing
// characteristics (i.e., like images or iframes), as opposed to
// inline-block sizing characteristics (like form controls).
eReplacedSizing = 1 << 10,
// Does this frame class support 'contain: layout' and
// 'contain:paint' (supporting one is equivalent to supporting the
// other).
eSupportsContainLayoutAndPaint = 1 << 11,
// Does this frame class support `aspect-ratio` property.
eSupportsAspectRatio = 1 << 12,
// These are to allow nsIFrame::Init to assert that IsFrameOfType
// implementations all call the base class method. They are only
// meaningful in DEBUG builds.
eDEBUGAllFrames = 1 << 30,
eDEBUGNoFrames = 1 << 31
};
/**
* API for doing a quick check if a frame is of a given
* type. Returns true if the frame matches ALL flags passed in.
*
* Implementations should always override with inline virtual
* functions that call the base class's IsFrameOfType method.
*/
virtual bool IsFrameOfType(uint32_t aFlags) const {
return !(aFlags & ~(
#ifdef DEBUG
nsIFrame::eDEBUGAllFrames |
#endif
nsIFrame::eSupportsCSSTransforms |
nsIFrame::eSupportsContainLayoutAndPaint |
nsIFrame::eSupportsAspectRatio));
}
/**
* Return true if this frame's preferred size property or max size property
* contains a percentage value that should be resolved against zero when
@ -3472,26 +3508,6 @@ class nsIFrame : public nsQueryFrame {
*/
virtual bool IsFloatContainingBlock() const { return false; }
/**
* Is this a leaf frame? Frames that want the frame constructor to be able
* to construct kids for them should return false, all others should return
* true. Note that returning true here does not mean that the frame _can't_
* have kids. It could still have kids created via
* nsIAnonymousContentCreator. Returning true indicates that "normal"
* (non-anonymous, CSS generated content, etc) children should not be
* constructed.
*/
bool IsLeaf() const {
MOZ_ASSERT(uint8_t(mClass) < mozilla::ArrayLength(sFrameClassBits));
FrameClassBits bits = sFrameClassBits[uint8_t(mClass)];
if (MOZ_UNLIKELY(bits & eFrameClassBitsDynamicLeaf)) {
return IsLeafDynamic();
}
return bits & eFrameClassBitsLeaf;
}
virtual bool IsLeafDynamic() const { return false; }
/**
* Marks all display items created by this frame as needing a repaint,
* and calls SchedulePaint() if requested and one is not already pending.
@ -5361,28 +5377,18 @@ class nsIFrame : public nsQueryFrame {
const nsStyleEffects* aStyleEffects,
mozilla::EffectSet* aEffectSet = nullptr) const;
// Maps mClass to LayoutFrameType.
static const mozilla::LayoutFrameType sLayoutFrameTypes[
static constexpr size_t kFrameClassCount =
#define FRAME_ID(...) 1 +
#define ABSTRACT_FRAME_ID(...)
#include "mozilla/FrameIdList.h"
#undef FRAME_ID
#undef ABSTRACT_FRAME_ID
0];
0;
enum FrameClassBits {
eFrameClassBitsNone = 0x0,
eFrameClassBitsLeaf = 0x1,
eFrameClassBitsDynamicLeaf = 0x2,
};
// Maps mClass to IsLeaf() flags.
static const FrameClassBits sFrameClassBits[
#define FRAME_ID(...) 1 +
#define ABSTRACT_FRAME_ID(...)
#include "mozilla/FrameIdList.h"
#undef FRAME_ID
#undef ABSTRACT_FRAME_ID
0];
// Maps mClass to LayoutFrameType.
static const mozilla::LayoutFrameType sLayoutFrameTypes[kFrameClassCount];
// Maps mClass to LayoutFrameTypeFlags.
static const ClassFlags sLayoutFrameClassFlags[kFrameClassCount];
#ifdef DEBUG_FRAME_DUMP
public:

Просмотреть файл

@ -115,11 +115,6 @@ class nsImageFrame : public nsAtomicContainerFrame, public nsIReflowCallback {
mozilla::a11y::AccType AccessibleType() override;
#endif
bool IsFrameOfType(uint32_t aFlags) const final {
return nsAtomicContainerFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedSizing));
}
#ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const override;
void List(FILE* out = stderr, const char* aPrefix = "",

Просмотреть файл

@ -44,16 +44,6 @@ class nsInlineFrame : public nsContainerFrame {
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
virtual bool IsFrameOfType(uint32_t aFlags) const override {
if (aFlags & (eSupportsCSSTransforms | eSupportsContainLayoutAndPaint |
eSupportsAspectRatio)) {
return false;
}
return nsContainerFrame::IsFrameOfType(
aFlags &
~(nsIFrame::eBidiInlineContainer | nsIFrame::eLineParticipant));
}
virtual void InvalidateFrame(uint32_t aDisplayItemKey = 0,
bool aRebuildDisplayItems = true) override;
virtual void InvalidateFrameWithRect(

Просмотреть файл

@ -52,13 +52,6 @@ class nsLeafFrame : public nsIFrame {
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override = 0;
virtual bool IsFrameOfType(uint32_t aFlags) const override {
// We don't actually contain a block, but we do always want a
// computed width, so tell a little white lie here.
return nsIFrame::IsFrameOfType(aFlags &
~(nsIFrame::eReplacedContainsBlock));
}
protected:
nsLeafFrame(ComputedStyle* aStyle, nsPresContext* aPresContext, ClassID aID)
: nsIFrame(aStyle, aPresContext, aID) {}

Просмотреть файл

@ -1377,7 +1377,7 @@ void nsLineLayout::PlaceFrame(PerFrameData* pfd, ReflowOutput& aMetrics) {
// vertically aligned, which happens after this.
const auto baselineSource = pfd->mFrame->StyleDisplay()->mBaselineSource;
if (baselineSource == StyleBaselineSource::Auto ||
pfd->mFrame->IsFrameOfType(nsIFrame::eLineParticipant)) {
pfd->mFrame->IsLineParticipant()) {
if (aMetrics.BlockStartAscent() == ReflowOutput::ASK_FOR_BASELINE) {
pfd->mAscent = pfd->mFrame->GetLogicalBaseline(lineWM);
} else {

Просмотреть файл

@ -31,11 +31,6 @@ class nsPageContentFrame final : public mozilla::ViewportFrame {
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
bool IsFrameOfType(uint32_t aFlags) const override {
return ViewportFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eCanContainOverflowContainers));
}
const nsAtom* GetPageName() const { return mPageName; }
void SetSharedPageData(nsSharedPageData* aPD) { mPD = aPD; }

Просмотреть файл

@ -236,16 +236,6 @@ void nsRubyBaseContainerFrame::AddInlinePrefISize(
aData->mCurrentLine += sum;
}
/* virtual */
bool nsRubyBaseContainerFrame::IsFrameOfType(uint32_t aFlags) const {
if (aFlags & (eSupportsCSSTransforms | eSupportsContainLayoutAndPaint |
eSupportsAspectRatio)) {
return false;
}
return nsContainerFrame::IsFrameOfType(aFlags &
~(nsIFrame::eLineParticipant));
}
/* virtual */
bool nsRubyBaseContainerFrame::CanContinueTextRun() const { return true; }

Просмотреть файл

@ -29,7 +29,6 @@ class nsRubyBaseContainerFrame final : public nsContainerFrame {
NS_DECL_QUERYFRAME
// nsIFrame overrides
virtual bool IsFrameOfType(uint32_t aFlags) const override;
virtual bool CanContinueTextRun() const override;
virtual void AddInlineMinISize(gfxContext* aRenderingContext,
InlineMinISizeData* aData) override;

Просмотреть файл

@ -19,14 +19,6 @@ using namespace mozilla;
// nsRubyContentFrame Method Implementations
// ======================================
/* virtual */
bool nsRubyContentFrame::IsFrameOfType(uint32_t aFlags) const {
if (aFlags & eBidiInlineContainer) {
return false;
}
return nsInlineFrame::IsFrameOfType(aFlags);
}
bool nsRubyContentFrame::IsIntraLevelWhitespace() const {
auto pseudoType = Style()->GetPseudoType();
if (pseudoType != PseudoStyleType::rubyBase &&

Просмотреть файл

@ -15,9 +15,6 @@ class nsRubyContentFrame : public nsInlineFrame {
public:
NS_DECL_ABSTRACT_FRAME(nsRubyContentFrame)
// nsIFrame overrides
virtual bool IsFrameOfType(uint32_t aFlags) const override;
// Indicates whether this is an "intra-level whitespace" frame, i.e.
// an anonymous frame that was created to contain non-droppable
// whitespaces directly inside a ruby level container. This impacts

Просмотреть файл

@ -44,14 +44,6 @@ nsContainerFrame* NS_NewRubyFrame(PresShell* aPresShell,
// nsRubyFrame Method Implementations
// ==================================
/* virtual */
bool nsRubyFrame::IsFrameOfType(uint32_t aFlags) const {
if (aFlags & eBidiInlineContainer) {
return false;
}
return nsInlineFrame::IsFrameOfType(aFlags);
}
#ifdef DEBUG_FRAME_DUMP
nsresult nsRubyFrame::GetFrameName(nsAString& aResult) const {
return MakeFrameName(u"Ruby"_ns, aResult);
@ -86,7 +78,7 @@ void nsRubyFrame::AddInlinePrefISize(gfxContext* aRenderingContext,
static nsRubyBaseContainerFrame* FindRubyBaseContainerAncestor(
nsIFrame* aFrame) {
for (nsIFrame* ancestor = aFrame->GetParent();
ancestor && ancestor->IsFrameOfType(nsIFrame::eLineParticipant);
ancestor && ancestor->IsLineParticipant();
ancestor = ancestor->GetParent()) {
if (ancestor->IsRubyBaseContainerFrame()) {
return static_cast<nsRubyBaseContainerFrame*>(ancestor);

Просмотреть файл

@ -29,7 +29,6 @@ class nsRubyFrame final : public nsInlineFrame {
NS_DECL_QUERYFRAME
// nsIFrame overrides
virtual bool IsFrameOfType(uint32_t aFlags) const override;
virtual void AddInlineMinISize(gfxContext* aRenderingContext,
InlineMinISizeData* aData) override;
virtual void AddInlinePrefISize(gfxContext* aRenderingContext,

Просмотреть файл

@ -46,15 +46,6 @@ nsresult nsRubyTextContainerFrame::GetFrameName(nsAString& aResult) const {
}
#endif
/* virtual */
bool nsRubyTextContainerFrame::IsFrameOfType(uint32_t aFlags) const {
if (aFlags & (eSupportsCSSTransforms | eSupportsContainLayoutAndPaint |
eSupportsAspectRatio)) {
return false;
}
return nsContainerFrame::IsFrameOfType(aFlags);
}
/* virtual */
void nsRubyTextContainerFrame::SetInitialChildList(ChildListID aListID,
nsFrameList&& aChildList) {

Просмотреть файл

@ -28,7 +28,6 @@ class nsRubyTextContainerFrame final : public nsContainerFrame {
NS_DECL_QUERYFRAME
// nsIFrame overrides
bool IsFrameOfType(uint32_t aFlags) const override;
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;

Просмотреть файл

@ -44,12 +44,6 @@ class nsSubDocumentFrame final : public nsAtomicContainerFrame,
NS_DECL_QUERYFRAME
bool IsFrameOfType(uint32_t aFlags) const override {
return nsAtomicContainerFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedSizing |
nsIFrame::eReplacedContainsBlock));
}
void Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;

Просмотреть файл

@ -1129,8 +1129,8 @@ class BuildTextRunsScanner {
};
static nsIFrame* FindLineContainer(nsIFrame* aFrame) {
while (aFrame && (aFrame->IsFrameOfType(nsIFrame::eLineParticipant) ||
aFrame->CanContinueTextRun())) {
while (aFrame &&
(aFrame->IsLineParticipant() || aFrame->CanContinueTextRun())) {
aFrame = aFrame->GetParent();
}
return aFrame;
@ -5019,8 +5019,7 @@ static already_AddRefed<gfxTextRun> GenerateTextRunForEmphasisMarks(
static nsRubyFrame* FindFurthestInlineRubyAncestor(nsTextFrame* aFrame) {
nsRubyFrame* rubyFrame = nullptr;
for (nsIFrame* frame = aFrame->GetParent();
frame && frame->IsFrameOfType(nsIFrame::eLineParticipant);
frame = frame->GetParent()) {
frame && frame->IsLineParticipant(); frame = frame->GetParent()) {
if (frame->IsRubyFrame()) {
rubyFrame = static_cast<nsRubyFrame*>(frame);
}

Просмотреть файл

@ -273,13 +273,6 @@ class nsTextFrame : public nsIFrame {
nsTextFrame* LastInFlow() const final;
nsTextFrame* LastContinuation() const final;
bool IsFrameOfType(uint32_t aFlags) const final {
// Set the frame state bit for text frames to mark them as replaced.
// XXX kipp: temporary
return nsIFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eLineParticipant));
}
bool ShouldSuppressLineBreak() const;
void InvalidateFrame(uint32_t aDisplayItemKey = 0,

Просмотреть файл

@ -38,7 +38,20 @@ nsIFrame* NS_NewHTMLVideoFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
return new (aPresShell) nsVideoFrame(aStyle, aPresShell->GetPresContext());
}
nsIFrame* NS_NewHTMLAudioFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
return new (aPresShell) nsAudioFrame(aStyle, aPresShell->GetPresContext());
}
NS_IMPL_FRAMEARENA_HELPERS(nsVideoFrame)
NS_QUERYFRAME_HEAD(nsVideoFrame)
NS_QUERYFRAME_ENTRY(nsVideoFrame)
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
NS_IMPL_FRAMEARENA_HELPERS(nsAudioFrame)
NS_QUERYFRAME_HEAD(nsAudioFrame)
NS_QUERYFRAME_ENTRY(nsAudioFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsVideoFrame)
// A matrix to obtain a correct-rotated video frame.
static Matrix ComputeRotationMatrix(gfxFloat aRotatedWidth,
@ -71,17 +84,19 @@ static void SwapScaleWidthHeightForRotation(IntSize& aSize,
}
}
nsVideoFrame::nsVideoFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
: nsContainerFrame(aStyle, aPresContext, kClassID) {
nsVideoFrame::nsVideoFrame(ComputedStyle* aStyle, nsPresContext* aPc,
ClassID aClassID)
: nsContainerFrame(aStyle, aPc, aClassID),
mIsAudio(aClassID == nsAudioFrame::kClassID) {
EnableVisibilityTracking();
}
nsVideoFrame::~nsVideoFrame() = default;
NS_QUERYFRAME_HEAD(nsVideoFrame)
NS_QUERYFRAME_ENTRY(nsVideoFrame)
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
nsAudioFrame::nsAudioFrame(ComputedStyle* aStyle, nsPresContext* aPc)
: nsVideoFrame(aStyle, aPc, kClassID) {}
nsAudioFrame::~nsAudioFrame() = default;
nsresult nsVideoFrame::CreateAnonymousContent(
nsTArray<ContentInfo>& aElements) {
@ -519,10 +534,6 @@ void nsVideoFrame::OnVisibilityChange(
nsContainerFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction);
}
bool nsVideoFrame::HasVideoElement() const {
return static_cast<HTMLMediaElement*>(GetContent())->IsVideo();
}
bool nsVideoFrame::HasVideoData() const {
if (!HasVideoElement()) {
return false;

Просмотреть файл

@ -19,16 +19,18 @@
class nsPresContext;
class nsDisplayItem;
class nsVideoFrame final : public nsContainerFrame,
public nsIReflowCallback,
public nsIAnonymousContentCreator {
class nsVideoFrame : public nsContainerFrame,
public nsIReflowCallback,
public nsIAnonymousContentCreator {
public:
template <typename T>
using Maybe = mozilla::Maybe<T>;
using Nothing = mozilla::Nothing;
using Visibility = mozilla::Visibility;
explicit nsVideoFrame(ComputedStyle*, nsPresContext*);
nsVideoFrame(ComputedStyle* aStyle, nsPresContext* aPc)
: nsVideoFrame(aStyle, aPc, kClassID) {}
nsVideoFrame(ComputedStyle*, nsPresContext*, ClassID);
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS(nsVideoFrame)
@ -37,51 +39,39 @@ class nsVideoFrame final : public nsContainerFrame,
bool ReflowFinished() final;
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
const nsDisplayListSet& aLists) final;
nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
int32_t aModType) override;
int32_t aModType) final;
void OnVisibilityChange(
Visibility aNewVisibility,
const Maybe<OnNonvisible>& aNonvisibleAction = Nothing()) override;
const Maybe<OnNonvisible>& aNonvisibleAction = Nothing()) final;
/* get the size of the video's display */
mozilla::IntrinsicSize GetIntrinsicSize() override;
mozilla::AspectRatio GetIntrinsicRatio() const override;
mozilla::IntrinsicSize GetIntrinsicSize() final;
mozilla::AspectRatio GetIntrinsicRatio() const final;
SizeComputationResult ComputeSize(
gfxContext* aRenderingContext, mozilla::WritingMode aWM,
const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorderPadding,
const mozilla::StyleSizeOverrides& aSizeOverrides,
mozilla::ComputeSizeFlags aFlags) override;
nscoord GetMinISize(gfxContext* aRenderingContext) override;
nscoord GetPrefISize(gfxContext* aRenderingContext) override;
void Destroy(DestroyContext&) override;
mozilla::ComputeSizeFlags aFlags) final;
nscoord GetMinISize(gfxContext* aRenderingContext) final;
nscoord GetPrefISize(gfxContext* aRenderingContext) final;
void Destroy(DestroyContext&) final;
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
const ReflowInput& aReflowInput, nsReflowStatus& aStatus) final;
#ifdef ACCESSIBILITY
mozilla::a11y::AccType AccessibleType() override;
mozilla::a11y::AccType AccessibleType() final;
#endif
bool IsFrameOfType(uint32_t aFlags) const override {
// audio element with visible controls is an inline element, so we don't
// apply aspect-ratio.
if ((aFlags & nsIFrame::eSupportsAspectRatio) && !HasVideoElement()) {
return false;
}
return nsSplittableFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eReplacedSizing));
}
nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) final;
void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilters) override;
uint32_t aFilters) final;
mozilla::dom::Element* GetPosterImage() const { return mPosterImage; }
@ -97,9 +87,10 @@ class nsVideoFrame final : public nsContainerFrame,
#endif
protected:
// Returns true if we're rendering for a video element. We still create
// nsVideoFrame to render controls for an audio element.
bool HasVideoElement() const;
// Returns true if we're rendering for a video element. We create an
// nsAudioFrame (which is still an nsVideoFrame) to render controls for an
// audio element.
bool HasVideoElement() const { return !mIsAudio; }
// Returns true if there is video data to render. Can return false
// when we're the frame for an audio element, or we've created a video
@ -131,6 +122,21 @@ class nsVideoFrame final : public nsContainerFrame,
nsSize mControlsTrackedSize{-1, -1};
nsSize mCaptionTrackedSize{-1, -1};
bool mReflowCallbackPosted = false;
const bool mIsAudio;
};
// NOTE(emilio): This class here only for the purpose of having different
// ClassFlags for <audio> elements. This frame shouldn't contain extra logic, as
// things are set up now, because <audio> can also use video controls etc.
// In the future we might want to rejigger this to be less weird (e.g, an audio
// frame might not need a caption, or text tracks, or what not).
class nsAudioFrame final : public nsVideoFrame {
public:
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS(nsAudioFrame)
nsAudioFrame(ComputedStyle*, nsPresContext*);
virtual ~nsAudioFrame();
};
#endif /* nsVideoFrame_h___ */

Просмотреть файл

@ -80,7 +80,7 @@ void nsDisplayMathMLError::Paint(nsDisplayListBuilder* aBuilder,
static bool IsForeignChild(const nsIFrame* aFrame) {
// This counts nsMathMLmathBlockFrame as a foreign child, because it
// uses block reflow
return !(aFrame->IsFrameOfType(nsIFrame::eMathML)) || aFrame->IsBlockFrame();
return !aFrame->IsMathMLFrame() || aFrame->IsBlockFrame();
}
NS_DECLARE_FRAME_PROPERTY_DELETABLE(HTMLReflowOutputProperty, ReflowOutput)

Просмотреть файл

@ -65,13 +65,6 @@ class nsMathMLContainerFrame : public nsContainerFrame, public nsMathMLFrame {
// --------------------------------------------------------------------------
// Overloaded nsContainerFrame methods -- see documentation in nsIFrame.h
bool IsFrameOfType(uint32_t aFlags) const override {
if (aFlags & (eLineParticipant | eSupportsContainLayoutAndPaint)) {
return false;
}
return nsContainerFrame::IsFrameOfType(aFlags & ~eMathML);
}
void AppendFrames(ChildListID aListID, nsFrameList&& aFrameList) override;
void InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
@ -428,10 +421,6 @@ class nsMathMLmathBlockFrame final : public nsBlockFrame {
}
}
virtual bool IsFrameOfType(uint32_t aFlags) const override {
return nsBlockFrame::IsFrameOfType(aFlags & ~nsIFrame::eMathML);
}
// See nsIMathMLFrame.h
bool IsMrowLike() {
return mFrames.FirstChild() != mFrames.LastChild() || !mFrames.FirstChild();
@ -503,10 +492,6 @@ class nsMathMLmathInlineFrame final : public nsInlineFrame,
}
}
bool IsFrameOfType(uint32_t aFlags) const override {
return nsInlineFrame::IsFrameOfType(aFlags & ~nsIFrame::eMathML);
}
bool IsMrowLike() override {
return mFrames.FirstChild() != mFrames.LastChild() || !mFrames.FirstChild();
}

Просмотреть файл

@ -97,7 +97,7 @@ void nsMathMLFrame::GetEmbellishDataFrom(nsIFrame* aFrame,
aEmbellishData.leadingSpace = 0;
aEmbellishData.trailingSpace = 0;
if (aFrame && aFrame->IsFrameOfType(nsIFrame::eMathML)) {
if (aFrame && aFrame->IsMathMLFrame()) {
nsIMathMLFrame* mathMLFrame = do_QueryFrame(aFrame);
if (mathMLFrame) {
mathMLFrame->GetEmbellishData(aEmbellishData);
@ -116,7 +116,7 @@ void nsMathMLFrame::GetPresentationDataFrom(
nsIFrame* frame = aFrame;
while (frame) {
if (frame->IsFrameOfType(nsIFrame::eMathML)) {
if (frame->IsMathMLFrame()) {
nsIMathMLFrame* mathMLFrame = do_QueryFrame(frame);
if (mathMLFrame) {
mathMLFrame->GetPresentationData(aPresentationData);

Просмотреть файл

@ -132,9 +132,10 @@ class nsMathMLFrame : public nsIMathMLFrame {
float aFontSizeInflation);
static eMathMLFrameType GetMathMLFrameTypeFor(nsIFrame* aFrame) {
if (aFrame->IsFrameOfType(nsIFrame::eMathML)) {
nsIMathMLFrame* mathMLFrame = do_QueryFrame(aFrame);
if (mathMLFrame) return mathMLFrame->GetMathMLFrameType();
if (aFrame->IsMathMLFrame()) {
if (nsIMathMLFrame* mathMLFrame = do_QueryFrame(aFrame)) {
return mathMLFrame->GetMathMLFrameType();
}
}
return eMathMLFrameType_UNKNOWN;
}

Просмотреть файл

@ -43,10 +43,6 @@ class nsMathMLmtableWrapperFrame final : public nsTableWrapperFrame,
nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
int32_t aModType) override;
bool IsFrameOfType(uint32_t aFlags) const override {
return nsTableWrapperFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
}
protected:
explicit nsMathMLmtableWrapperFrame(ComputedStyle* aStyle,
nsPresContext* aPresContext)
@ -94,10 +90,6 @@ class nsMathMLmtableFrame final : public nsTableFrame {
RestyleTable();
}
bool IsFrameOfType(uint32_t aFlags) const override {
return nsTableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
}
// helper to restyle and reflow the table when a row is changed -- since
// MathML attributes are inter-dependent and row/colspan can affect the table,
// it is safer (albeit grossly suboptimal) to just relayout the whole thing.
@ -191,14 +183,10 @@ class nsMathMLmtrFrame final : public nsTableRowFrame {
RestyleTable();
}
bool IsFrameOfType(uint32_t aFlags) const override {
return nsTableRowFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
}
// helper to restyle and reflow the table -- @see nsMathMLmtableFrame.
void RestyleTable() {
nsTableFrame* tableFrame = GetTableFrame();
if (tableFrame && tableFrame->IsFrameOfType(nsIFrame::eMathML)) {
if (tableFrame && tableFrame->IsMathMLFrame()) {
// relayout the table
((nsMathMLmtableFrame*)tableFrame)->RestyleTable();
}
@ -234,10 +222,6 @@ class nsMathMLmtdFrame final : public nsTableCellFrame {
mozilla::nsDisplayListBuilder* aBuilder,
const mozilla::nsDisplayListSet& aLists) override;
bool IsFrameOfType(uint32_t aFlags) const override {
return nsTableCellFrame::IsFrameOfType(aFlags & ~(nsIFrame::eMathML));
}
LogicalMargin GetBorderWidth(WritingMode aWM) const override;
nsMargin GetBorderOverflow() override;
@ -274,10 +258,6 @@ class nsMathMLmtdInnerFrame final : public nsBlockFrame, public nsMathMLFrame {
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
bool IsFrameOfType(uint32_t aFlags) const override {
return nsBlockFrame::IsFrameOfType(aFlags & ~nsIFrame::eMathML);
}
const nsStyleText* StyleTextForLineLayout() override;
void DidSetComputedStyle(ComputedStyle* aOldComputedStyle) override;

Просмотреть файл

@ -339,8 +339,7 @@ struct InlineBackgroundData {
if (mBidiEnabled) {
// Find the line container frame
mLineContainer = aFrame;
while (mLineContainer &&
mLineContainer->IsFrameOfType(nsIFrame::eLineParticipant)) {
while (mLineContainer && mLineContainer->IsLineParticipant()) {
mLineContainer = mLineContainer->GetParent();
}

Просмотреть файл

@ -2910,8 +2910,7 @@ nsDisplayBackgroundImage::nsDisplayBackgroundImage(
if (mBackgroundStyle && mBackgroundStyle != mFrame->Style()) {
// If this changes, then you also need to adjust css::ImageLoader to
// invalidate mFrame as needed.
MOZ_ASSERT(mFrame->IsCanvasFrame() ||
mFrame->IsFrameOfType(nsIFrame::eTablePart));
MOZ_ASSERT(mFrame->IsCanvasFrame() || mFrame->IsTablePart());
}
#endif

Просмотреть файл

@ -171,12 +171,11 @@ bool nsImageRenderer::PrepareImage() {
paintElement ? paintElement->GetPrimaryFrame() : nullptr;
// If there's no referenced frame, or the referenced frame is
// non-displayable SVG, then we have nothing valid to paint.
if (!paintServerFrame ||
(paintServerFrame->IsFrameOfType(nsIFrame::eSVG) &&
!static_cast<SVGPaintServerFrame*>(
do_QueryFrame(paintServerFrame)) &&
!static_cast<ISVGDisplayableFrame*>(
do_QueryFrame(paintServerFrame)))) {
if (!paintServerFrame || (paintServerFrame->IsSVGFrame() &&
!static_cast<SVGPaintServerFrame*>(
do_QueryFrame(paintServerFrame)) &&
!static_cast<ISVGDisplayableFrame*>(
do_QueryFrame(paintServerFrame)))) {
mPrepareResult = ImgDrawResult::BAD_IMAGE;
return false;
}
@ -238,7 +237,7 @@ CSSSizeOrRatio nsImageRenderer::ComputeIntrinsicSize() {
// when fixing this!
if (mPaintServerFrame) {
// SVG images have no intrinsic size
if (!mPaintServerFrame->IsFrameOfType(nsIFrame::eSVG)) {
if (!mPaintServerFrame->IsSVGFrame()) {
// The intrinsic image size for a generic nsIFrame paint server is
// the union of the border-box rects of all of its continuations,
// rounded to device pixels.

Просмотреть файл

@ -106,11 +106,11 @@ bool ComputedStyle::IsFixedPosContainingBlock(
}
const auto& disp = *StyleDisplay();
if (disp.IsFixedPosContainingBlockForContainLayoutAndPaintSupportingFrames() &&
aContextFrame->IsFrameOfType(nsIFrame::eSupportsContainLayoutAndPaint)) {
aContextFrame->SupportsContainLayoutAndPaint()) {
return true;
}
if (disp.IsFixedPosContainingBlockForTransformSupportingFrames() &&
aContextFrame->IsFrameOfType(nsIFrame::eSupportsCSSTransforms)) {
aContextFrame->SupportsCSSTransforms()) {
return true;
}
return false;

Просмотреть файл

@ -520,7 +520,7 @@ static void InvalidateImages(nsIFrame* aFrame, imgIRequest* aRequest,
return;
}
if (aFrame->IsFrameOfType(nsIFrame::eTablePart)) {
if (aFrame->IsTablePart()) {
// Tables don't necessarily build border/background display items
// for the individual table part frames, so IterateRetainedDataFor
// might not find the right display item.

Просмотреть файл

@ -881,8 +881,7 @@ bool nsComputedDOMStyle::NeedsToFlushStyle(nsCSSPropertyID aPropID) const {
static bool IsNonReplacedInline(nsIFrame* aFrame) {
// FIXME: this should be IsInlineInsideStyle() since width/height
// doesn't apply to ruby boxes.
return aFrame->StyleDisplay()->IsInlineFlow() &&
!aFrame->IsFrameOfType(nsIFrame::eReplaced) &&
return aFrame->StyleDisplay()->IsInlineFlow() && !aFrame->IsReplaced() &&
!aFrame->IsFieldSetFrame() && !aFrame->IsBlockFrame() &&
!aFrame->IsScrollFrame() && !aFrame->IsColumnSetWrapperFrame();
}

Просмотреть файл

@ -124,7 +124,7 @@ static FontUsageKind FrameFontUsage(nsIFrame* aFrame,
// TODO(emilio): Can we use the restyle-hint machinery instead of this?
static void ScheduleReflow(PresShell* aPresShell, nsIFrame* aFrame) {
nsIFrame* f = aFrame;
if (f->IsFrameOfType(nsIFrame::eSVG) || f->IsInSVGTextSubtree()) {
if (f->IsSVGFrame() || f->IsInSVGTextSubtree()) {
// SVG frames (and the non-SVG descendants of an SVGTextFrame) need special
// reflow handling. We need to search upwards for the first displayed
// SVGOuterSVGFrame or non-SVG frame, which is the frame we can call

Просмотреть файл

@ -3496,8 +3496,7 @@ bool nsStyleDisplay::PrecludesSizeContainmentOrContentVisibilityWithFrame(
const nsIFrame& aFrame) const {
// Note: The spec for size containment says it should have no effect on
// non-atomic, inline-level boxes.
bool isNonReplacedInline = aFrame.IsFrameOfType(nsIFrame::eLineParticipant) &&
!aFrame.IsFrameOfType(nsIFrame::eReplaced);
bool isNonReplacedInline = aFrame.IsLineParticipant() && !aFrame.IsReplaced();
return isNonReplacedInline || IsInternalRubyDisplayType() ||
DisplayInside() == mozilla::StyleDisplayInside::Table ||
IsInnerTableStyle();

Просмотреть файл

@ -77,14 +77,12 @@ bool nsStyleDisplay::IsFloating(const nsIFrame* aContextFrame) const {
bool nsStyleDisplay::HasTransform(const nsIFrame* aContextFrame) const {
NS_ASSERTION(aContextFrame->StyleDisplay() == this,
"unexpected aContextFrame");
return HasTransformStyle() &&
aContextFrame->IsFrameOfType(nsIFrame::eSupportsCSSTransforms);
return HasTransformStyle() && aContextFrame->SupportsCSSTransforms();
}
bool nsStyleDisplay::HasPerspective(const nsIFrame* aContextFrame) const {
MOZ_ASSERT(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame");
return HasPerspectiveStyle() &&
aContextFrame->IsFrameOfType(nsIFrame::eSupportsCSSTransforms);
return HasPerspectiveStyle() && aContextFrame->SupportsCSSTransforms();
}
bool nsStyleDisplay::

Просмотреть файл

@ -105,19 +105,17 @@ void SVGContainerFrame::ReflowSVGNonDisplayText(nsIFrame* aContainer) {
return;
}
MOZ_ASSERT(aContainer->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY) ||
!aContainer->IsFrameOfType(nsIFrame::eSVG),
!aContainer->IsSVGFrame(),
"it is wasteful to call ReflowSVGNonDisplayText on a container "
"frame that is not NS_FRAME_IS_NONDISPLAY or not SVG");
for (nsIFrame* kid : aContainer->PrincipalChildList()) {
LayoutFrameType type = kid->Type();
if (type == LayoutFrameType::SVGText) {
static_cast<SVGTextFrame*>(kid)->ReflowSVGNonDisplayText();
} else {
if (kid->IsFrameOfType(nsIFrame::eSVG | nsIFrame::eSVGContainer) ||
type == LayoutFrameType::SVGForeignObject ||
!kid->IsFrameOfType(nsIFrame::eSVG)) {
ReflowSVGNonDisplayText(kid);
}
} else if (kid->IsSVGContainerFrame() ||
type == LayoutFrameType::SVGForeignObject ||
!kid->IsSVGFrame()) {
ReflowSVGNonDisplayText(kid);
}
}
}
@ -348,8 +346,7 @@ void SVGDisplayContainerFrame::ReflowSVG() {
// SVGTextFrames. We need to cause those to get reflowed in
// case they are the target of a rendering observer.
MOZ_ASSERT(
kid->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY) ||
!kid->IsFrameOfType(nsIFrame::eSVG),
kid->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY) || !kid->IsSVGFrame(),
"expected kid to be a NS_FRAME_IS_NONDISPLAY frame or not SVG");
if (kid->HasAnyStateBits(NS_FRAME_IS_DIRTY)) {
SVGContainerFrame* container = do_QueryFrame(kid);

Просмотреть файл

@ -78,15 +78,6 @@ class SVGContainerFrame : public nsContainerFrame {
nsFrameList&& aFrameList) override;
void RemoveFrame(DestroyContext&, ChildListID, nsIFrame*) override;
bool IsFrameOfType(uint32_t aFlags) const override {
if (aFlags & eSupportsContainLayoutAndPaint) {
return false;
}
return nsContainerFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGContainer));
}
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override {}

Просмотреть файл

@ -38,14 +38,6 @@ class SVGFEContainerFrame final : public nsContainerFrame {
public:
NS_DECL_FRAMEARENA_HELPERS(SVGFEContainerFrame)
bool IsFrameOfType(uint32_t aFlags) const override {
if (aFlags & eSupportsContainLayoutAndPaint) {
return false;
}
return nsContainerFrame::IsFrameOfType(aFlags & ~nsIFrame::eSVG);
}
#ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(u"SVGFEContainer"_ns, aResult);

Просмотреть файл

@ -44,14 +44,6 @@ class SVGFEImageFrame final : public nsIFrame {
nsIFrame* aPrevInFlow) override;
void Destroy(DestroyContext&) override;
bool IsFrameOfType(uint32_t aFlags) const override {
if (aFlags & eSupportsContainLayoutAndPaint) {
return false;
}
return nsIFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
}
#ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(u"SVGFEImage"_ns, aResult);

Просмотреть файл

@ -41,14 +41,6 @@ class SVGFELeafFrame final : public nsIFrame {
nsIFrame* aPrevInFlow) override;
#endif
bool IsFrameOfType(uint32_t aFlags) const override {
if (aFlags & eSupportsContainLayoutAndPaint) {
return false;
}
return nsIFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
}
#ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(u"SVGFELeaf"_ns, aResult);

Просмотреть файл

@ -34,14 +34,6 @@ class SVGFEUnstyledLeafFrame final : public nsIFrame {
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override {}
bool IsFrameOfType(uint32_t aFlags) const override {
if (aFlags & eSupportsContainLayoutAndPaint) {
return false;
}
return nsIFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
}
#ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(u"SVGFEUnstyledLeaf"_ns, aResult);

Просмотреть файл

@ -50,14 +50,6 @@ class SVGForeignObjectFrame final : public nsContainerFrame,
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
bool IsFrameOfType(uint32_t aFlags) const override {
if (aFlags & eSupportsContainLayoutAndPaint) {
return false;
}
return nsContainerFrame::IsFrameOfType(aFlags & ~nsIFrame::eSVG);
}
bool IsSVGTransformed(Matrix* aOwnTransform,
Matrix* aFromParentTransform) const override;

Просмотреть файл

@ -65,14 +65,6 @@ class SVGGeometryFrame final : public nsIFrame, public ISVGDisplayableFrame {
void Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
bool IsFrameOfType(uint32_t aFlags) const override {
if (aFlags & eSupportsContainLayoutAndPaint) {
return false;
}
return nsIFrame::IsFrameOfType(aFlags & ~nsIFrame::eSVG);
}
nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
int32_t aModType) override;

Просмотреть файл

@ -72,14 +72,6 @@ class SVGImageFrame final : public nsIFrame,
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
bool IsFrameOfType(uint32_t aFlags) const override {
if (aFlags & eSupportsContainLayoutAndPaint) {
return false;
}
return nsIFrame::IsFrameOfType(aFlags & ~nsIFrame::eSVG);
}
nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
int32_t aModType) override;

Просмотреть файл

@ -197,7 +197,7 @@ static EffectOffsets ComputeEffectOffset(
result.offsetToBoundingBox =
aParams.builder->ToReferenceFrame(aFrame) -
SVGIntegrationUtils::GetOffsetToBoundingBox(aFrame);
if (!aFrame->IsFrameOfType(nsIFrame::eSVG)) {
if (!aFrame->IsSVGFrame()) {
/* Snap the offset if the reference frame is not a SVG frame,
* since other frames will be snapped to pixel when rendering. */
result.offsetToBoundingBox =
@ -263,8 +263,7 @@ gfxPoint SVGIntegrationUtils::GetOffsetToUserSpaceInDevPx(
/* static */
nsSize SVGIntegrationUtils::GetContinuationUnionSize(nsIFrame* aNonSVGFrame) {
NS_ASSERTION(!aNonSVGFrame->IsFrameOfType(nsIFrame::eSVG),
"SVG frames should not get here");
NS_ASSERTION(!aNonSVGFrame->IsSVGFrame(), "SVG frames should not get here");
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aNonSVGFrame);
return nsLayoutUtils::GetAllInFlowRectsUnion(firstFrame, firstFrame).Size();
@ -272,8 +271,7 @@ nsSize SVGIntegrationUtils::GetContinuationUnionSize(nsIFrame* aNonSVGFrame) {
/* static */ gfx::Size SVGIntegrationUtils::GetSVGCoordContextForNonSVGFrame(
nsIFrame* aNonSVGFrame) {
NS_ASSERTION(!aNonSVGFrame->IsFrameOfType(nsIFrame::eSVG),
"SVG frames should not get here");
NS_ASSERTION(!aNonSVGFrame->IsSVGFrame(), "SVG frames should not get here");
nsIFrame* firstFrame =
nsLayoutUtils::FirstContinuationOrIBSplitSibling(aNonSVGFrame);
nsRect r = nsLayoutUtils::GetAllInFlowRectsUnion(firstFrame, firstFrame);
@ -1193,7 +1191,7 @@ already_AddRefed<gfxDrawable> SVGIntegrationUtils::DrawableFromPaintServer(
return drawable.forget();
}
if (aFrame->IsFrameOfType(nsIFrame::eSVG) &&
if (aFrame->IsSVGFrame() &&
!static_cast<ISVGDisplayableFrame*>(do_QueryFrame(aFrame))) {
MOZ_ASSERT_UNREACHABLE(
"We should prevent painting of unpaintable SVG "

Просмотреть файл

@ -527,9 +527,8 @@ void SVGTextPathObserver::OnRenderingChange() {
return;
}
MOZ_ASSERT(
frame->IsFrameOfType(nsIFrame::eSVG) || frame->IsInSVGTextSubtree(),
"SVG frame expected");
MOZ_ASSERT(frame->IsSVGFrame() || frame->IsInSVGTextSubtree(),
"SVG frame expected");
MOZ_ASSERT(frame->GetContent()->IsSVGElement(nsGkAtoms::textPath),
"expected frame for a <textPath> element");
@ -601,7 +600,7 @@ void SVGMarkerObserver::OnRenderingChange() {
return;
}
MOZ_ASSERT(frame->IsFrameOfType(nsIFrame::eSVG), "SVG frame expected");
MOZ_ASSERT(frame->IsSVGFrame(), "SVG frame expected");
// Don't need to request ReflowFrame if we're being reflowed.
// Because mRect for SVG frames includes the bounds of any markers
@ -1814,8 +1813,8 @@ void SVGObserverUtils::InvalidateRenderingObservers(nsIFrame* aFrame) {
// Check ancestor SVG containers. The root frame cannot be of type
// eSVGContainer so we don't have to check f for null here.
for (nsIFrame* f = aFrame->GetParent();
f->IsFrameOfType(nsIFrame::eSVGContainer); f = f->GetParent()) {
for (nsIFrame* f = aFrame->GetParent(); f->IsSVGContainerFrame();
f = f->GetParent()) {
if (auto* element = Element::FromNode(f->GetContent())) {
if (auto* observers = GetObserverSet(element)) {
observers->InvalidateAll();

Просмотреть файл

@ -74,12 +74,6 @@ class SVGOuterSVGFrame final : public SVGDisplayContainerFrame,
void Init(nsIContent* aContent, nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
bool IsFrameOfType(uint32_t aFlags) const override {
return SVGDisplayContainerFrame::IsFrameOfType(
aFlags &
~(eSupportsContainLayoutAndPaint | eReplaced | eReplacedSizing));
}
#ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(u"SVGOuterSVG"_ns, aResult);

Просмотреть файл

@ -47,14 +47,6 @@ class SVGStopFrame : public nsIFrame {
nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
int32_t aModType) override;
bool IsFrameOfType(uint32_t aFlags) const override {
if (aFlags & eSupportsContainLayoutAndPaint) {
return false;
}
return nsIFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
}
#ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(u"SVGStop"_ns, aResult);

Просмотреть файл

@ -119,10 +119,9 @@ nsIFrame* SVGSwitchFrame::GetFrameForPoint(const gfxPoint& aPoint) {
return nullptr;
}
static bool shouldReflowSVGTextFrameInside(nsIFrame* aFrame) {
return aFrame->IsFrameOfType(nsIFrame::eSVG | nsIFrame::eSVGContainer) ||
aFrame->IsSVGForeignObjectFrame() ||
!aFrame->IsFrameOfType(nsIFrame::eSVG);
static bool ShouldReflowSVGTextFrameInside(nsIFrame* aFrame) {
return aFrame->IsSVGContainerFrame() || aFrame->IsSVGForeignObjectFrame() ||
!aFrame->IsSVGFrame();
}
void SVGSwitchFrame::AlwaysReflowSVGTextFrameDoForOneKid(nsIFrame* aKid) {
@ -135,7 +134,7 @@ void SVGSwitchFrame::AlwaysReflowSVGTextFrameDoForOneKid(nsIFrame* aKid) {
"A non-display SVGTextFrame directly contained in a display "
"container?");
static_cast<SVGTextFrame*>(aKid)->ReflowSVG();
} else if (shouldReflowSVGTextFrameInside(aKid)) {
} else if (ShouldReflowSVGTextFrameInside(aKid)) {
if (!aKid->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY)) {
for (nsIFrame* kid : aKid->PrincipalChildList()) {
AlwaysReflowSVGTextFrameDoForOneKid(kid);
@ -205,10 +204,10 @@ void SVGSwitchFrame::ReflowSVG() {
// nsLayoutUtils::UnionChildOverflow since SVG frame's all use the same
// frame list, and we're iterating over that list now anyway.
ConsiderChildOverflow(overflowRects, child);
} else if (child && shouldReflowSVGTextFrameInside(child)) {
MOZ_ASSERT(child->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY) ||
!child->IsFrameOfType(nsIFrame::eSVG),
"Check for this explicitly in the |if|, then");
} else if (child && ShouldReflowSVGTextFrameInside(child)) {
MOZ_ASSERT(
child->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY) || !child->IsSVGFrame(),
"Check for this explicitly in the |if|, then");
ReflowSVGNonDisplayText(child);
}

Просмотреть файл

@ -144,7 +144,7 @@ bool SVGUtils::AnyOuterSVGIsCallingReflowSVG(nsIFrame* aFrame) {
}
void SVGUtils::ScheduleReflowSVG(nsIFrame* aFrame) {
MOZ_ASSERT(aFrame->IsFrameOfType(nsIFrame::eSVG), "Passed bad frame!");
MOZ_ASSERT(aFrame->IsSVGFrame(), "Passed bad frame!");
// If this is triggered, the callers should be fixed to call us before
// ReflowSVG is called. If we try to mark dirty bits on frames while we're
@ -183,8 +183,7 @@ void SVGUtils::ScheduleReflowSVG(nsIFrame* aFrame) {
}
f->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
f = f->GetParent();
MOZ_ASSERT(f->IsFrameOfType(nsIFrame::eSVG),
"IsSVGOuterSVGFrame check above not valid!");
MOZ_ASSERT(f->IsSVGFrame(), "IsSVGOuterSVGFrame check above not valid!");
}
outerSVGFrame = static_cast<SVGOuterSVGFrame*>(f);
@ -209,8 +208,7 @@ void SVGUtils::ScheduleReflowSVG(nsIFrame* aFrame) {
}
bool SVGUtils::NeedsReflowSVG(const nsIFrame* aFrame) {
MOZ_ASSERT(aFrame->IsFrameOfType(nsIFrame::eSVG),
"SVG uses bits differently!");
MOZ_ASSERT(aFrame->IsSVGFrame(), "SVG uses bits differently!");
// The flags we test here may change, hence why we have this separate
// function.
@ -342,7 +340,7 @@ gfxMatrix SVGUtils::GetCanvasTM(nsIFrame* aFrame) {
return containerFrame->GetCanvasTM();
}
MOZ_ASSERT(aFrame->GetParent()->IsFrameOfType(nsIFrame::eSVGContainer));
MOZ_ASSERT(aFrame->GetParent()->IsSVGContainerFrame());
auto* parent = static_cast<SVGContainerFrame*>(aFrame->GetParent());
auto* content = static_cast<SVGElement*>(aFrame->GetContent());
@ -383,12 +381,11 @@ void SVGUtils::NotifyChildrenOfSVGChange(nsIFrame* aFrame, uint32_t aFlags) {
if (SVGFrame) {
SVGFrame->NotifySVGChanged(aFlags);
} else {
NS_ASSERTION(
kid->IsFrameOfType(nsIFrame::eSVG) || kid->IsInSVGTextSubtree(),
"SVG frame expected");
NS_ASSERTION(kid->IsSVGFrame() || kid->IsInSVGTextSubtree(),
"SVG frame expected");
// recurse into the children of container frames e.g. <clipPath>, <mask>
// in case they have child frames with transformation matrices
if (kid->IsFrameOfType(nsIFrame::eSVG)) {
if (kid->IsSVGFrame()) {
NotifyChildrenOfSVGChange(kid, aFlags);
}
}

Просмотреть файл

@ -44,14 +44,6 @@ class SVGViewFrame final : public nsIFrame {
nsIFrame* aPrevInFlow) override;
#endif
bool IsFrameOfType(uint32_t aFlags) const override {
if (aFlags & eSupportsContainLayoutAndPaint) {
return false;
}
return nsIFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
}
#ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(u"SVGView"_ns, aResult);

Просмотреть файл

@ -225,14 +225,6 @@ class nsTableCellFrame : public nsContainerFrame,
bool ComputeCustomOverflow(mozilla::OverflowAreas& aOverflowAreas) override;
bool IsFrameOfType(uint32_t aFlags) const override {
if (aFlags & eSupportsAspectRatio) {
return false;
}
return nsContainerFrame::IsFrameOfType(aFlags & ~(nsIFrame::eTablePart));
}
void InvalidateFrame(uint32_t aDisplayItemKey = 0,
bool aRebuildDisplayItems = true) override;
void InvalidateFrameWithRect(const nsRect& aRect,

Просмотреть файл

@ -260,14 +260,6 @@ class nsTableColFrame final : public nsSplittableFrame {
void SetFinalISize(nscoord aFinalISize) { mFinalISize = aFinalISize; }
nscoord GetFinalISize() { return mFinalISize; }
bool IsFrameOfType(uint32_t aFlags) const override {
if (aFlags & (eSupportsContainLayoutAndPaint | eSupportsAspectRatio)) {
return false;
}
return nsSplittableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eTablePart));
}
void InvalidateFrame(uint32_t aDisplayItemKey = 0,
bool aRebuildDisplayItems = true) override;
void InvalidateFrameWithRect(const nsRect& aRect,

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше