--- a/accessible/base/nsAccessibilityService.cpp
+++ b/accessible/base/nsAccessibilityService.cpp
@@ -1610,17 +1610,17 @@ nsAccessibilityService::CreateAccessible
// accessible HTML table or a direct child of accessible of HTML table.
Accessible* table = aContext->IsTable() ? aContext : nullptr;
if (!table && aContext->Parent() && aContext->Parent()->IsTable())
table = aContext->Parent();
if (table) {
nsIContent* parentContent = aContent->GetParent();
nsIFrame* parentFrame = parentContent->GetPrimaryFrame();
- if (parentFrame->GetType() != FrameType::TableWrapper) {
+ if (!parentFrame->IsTableWrapperFrame()) {
parentContent = parentContent->GetParent();
parentFrame = parentContent->GetPrimaryFrame();
}
if (parentFrame->IsTableWrapperFrame() &&
table->GetContent() == parentContent) {
newAcc = new HTMLTableRowAccessible(aContent, document);
}
--- a/accessible/generic/HyperTextAccessible.cpp
+++ b/accessible/generic/HyperTextAccessible.cpp
@@ -91,17 +91,17 @@ HyperTextAccessible::NativeState()
}
nsIntRect
HyperTextAccessible::GetBoundsInFrame(nsIFrame* aFrame,
uint32_t aStartRenderedOffset,
uint32_t aEndRenderedOffset)
{
nsPresContext* presContext = mDoc->PresContext();
- if (aFrame->GetType() != FrameType::Text) {
+ if (!aFrame->IsTextFrame()) {
return aFrame->GetScreenRectInAppUnits().
ToNearestPixels(presContext->AppUnitsPerDevPixel());
}
// Substring must be entirely within the same text node.
int32_t startContentOffset, endContentOffset;
nsresult rv = RenderedToContentOffset(aFrame, aStartRenderedOffset, &startContentOffset);
NS_ENSURE_SUCCESS(rv, nsIntRect());
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -14020,17 +14020,17 @@ nsGlobalWindow::BeginWindowMove(Event& a
MOZ_ASSERT(IsInnerWindow());
nsCOMPtr<nsIWidget> widget;
// if a panel was supplied, use its widget instead.
#ifdef MOZ_XUL
if (aPanel) {
nsIFrame* frame = aPanel->GetPrimaryFrame();
- if (!frame || frame->GetType() != FrameType::MenuPopup) {
+ if (!frame || !frame->IsMenuPopupFrame()) {
return;
}
widget = (static_cast<nsMenuPopupFrame*>(frame))->GetWidget();
}
else {
#endif
widget = GetMainWidget();
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -3524,31 +3524,31 @@ IsLastCellOfRow(nsIFrame* aFrame)
}
}
return true;
}
static bool
IsLastRowOfRowGroup(nsIFrame* aFrame)
{
- if (aFrame->GetType() != FrameType::TableRow) {
+ if (!aFrame->IsTableRowFrame()) {
return true;
}
for (nsIFrame* c = aFrame; c; c = c->GetNextContinuation()) {
if (c->GetNextSibling()) {
return false;
}
}
return true;
}
static bool
IsLastNonemptyRowGroupOfTable(nsIFrame* aFrame)
{
- if (aFrame->GetType() != FrameType::TableRowGroup) {
+ if (!aFrame->IsTableRowGroupFrame()) {
return true;
}
for (nsIFrame* c = aFrame; c; c = c->GetNextContinuation()) {
for (nsIFrame* next = c->GetNextSibling(); next; next = next->GetNextSibling()) {
if (next->PrincipalChildList().FirstChild()) {
return false;
}
}
--- a/dom/events/ContentEventHandler.cpp
+++ b/dom/events/ContentEventHandler.cpp
@@ -951,17 +951,17 @@ ContentEventHandler::ExpandToClusterBoun
}
int32_t startOffset, endOffset;
nsresult rv = frame->GetOffsets(startOffset, endOffset);
NS_ENSURE_SUCCESS(rv, rv);
if (*aXPOffset == static_cast<uint32_t>(startOffset) ||
*aXPOffset == static_cast<uint32_t>(endOffset)) {
return NS_OK;
}
- if (frame->GetType() != FrameType::Text) {
+ if (!frame->IsTextFrame()) {
return NS_ERROR_FAILURE;
}
nsTextFrame* textFrame = static_cast<nsTextFrame*>(frame);
int32_t newOffsetInFrame = *aXPOffset - startOffset;
newOffsetInFrame += aForward ? -1 : 1;
textFrame->PeekOffsetCharacter(aForward, &newOffsetInFrame);
*aXPOffset = startOffset + newOffsetInFrame;
return NS_OK;
@@ -1612,17 +1612,17 @@ ContentEventHandler::GetLastFrameInRange
true, &lastFrame);
if (!lastFrame) {
return FrameAndNodeOffset();
}
// If the last frame is a text frame, we need to check if the range actually
// includes at least one character in the range. Therefore, if it's not a
// text frame, we need to do nothing anymore.
- if (lastFrame->GetType() != FrameType::Text) {
+ if (!lastFrame->IsTextFrame()) {
return FrameAndNodeOffset(lastFrame, nodePosition.mOffset);
}
int32_t start, end;
if (NS_WARN_IF(NS_FAILED(lastFrame->GetOffsets(start, end)))) {
return FrameAndNodeOffset();
}
@@ -1650,17 +1650,17 @@ ContentEventHandler::GetLineBreakerRectB
MOZ_ASSERT(ShouldBreakLineBefore(aFrame->GetContent(), mRootContent) ||
IsMozBR(aFrame->GetContent()));
nsIFrame* frameForFontMetrics = aFrame;
// If it's not a <br> frame, this method computes the line breaker's rect
// outside the frame. Therefore, we need to compute with parent frame's
// font metrics in such case.
- if (aFrame->GetType() != FrameType::Br && aFrame->GetParent()) {
+ if (!aFrame->IsBrFrame() && aFrame->GetParent()) {
frameForFontMetrics = aFrame->GetParent();
}
// Note that <br> element's rect is decided with line-height but we need
// a rect only with font height. Additionally, <br> frame's width and
// height are 0 in quirks mode if it's not an empty line. So, we cannot
// use frame rect information even if it's a <br> frame.
@@ -1695,17 +1695,17 @@ ContentEventHandler::GetLineBreakerRectB
// | I +-<p>----------------- <p>'s border box
// | I |
// | I |
// | |
// ^- caret
//
// However, this is a hack for unusual scenario. This hack shouldn't be
// used as far as possible.
- if (aFrame->GetType() != FrameType::Br) {
+ if (!aFrame->IsBrFrame()) {
if (kWritingMode.IsVertical()) {
if (kWritingMode.IsLineInverted()) {
// above of top-left corner of aFrame.
result.mRect.x = 0;
} else {
// above of top-right corner of aFrame.
result.mRect.x = aFrame->GetRect().XMost() - result.mRect.width;
}
@@ -1934,17 +1934,17 @@ ContentEventHandler::OnQueryTextRectArra
// +------------------------------------+
// Therefore, if the first frame isn't a <br> frame and there is a text
// node before the first node in the queried range, we should compute the
// first rect with the previous character's rect.
// If we already compute a character's rect in the queried range, we can
// compute it with the cached last character's rect. (However, don't
// use this path if it's a <br> frame because trusting <br> frame's rect
// is better than guessing the rect from the previous character.)
- if (firstFrame->GetType() != FrameType::Br &&
+ if (!firstFrame->IsBrFrame() &&
aEvent->mInput.mOffset != offset) {
baseFrame = lastFrame;
brRect = lastCharRect;
if (!wasLineBreaker) {
if (isVertical) {
// Right of the last character.
brRect.y = brRect.YMost() + 1;
brRect.height = 1;
@@ -1953,17 +1953,17 @@ ContentEventHandler::OnQueryTextRectArra
brRect.x = brRect.XMost() + 1;
brRect.width = 1;
}
}
}
// If it's not a <br> frame and it's the first character rect at the
// queried range, we need to the previous character of the start of
// the queried range if there is a text node.
- else if (firstFrame->GetType() != FrameType::Br && lastTextContent) {
+ else if (!firstFrame->IsBrFrame() && lastTextContent) {
FrameRelativeRect brRectRelativeToLastTextFrame =
GuessLineBreakerRectAfter(lastTextContent);
if (NS_WARN_IF(!brRectRelativeToLastTextFrame.IsValid())) {
return NS_ERROR_FAILURE;
}
// Look for the last text frame for lastTextContent.
nsIFrame* primaryFrame = lastTextContent->GetPrimaryFrame();
if (NS_WARN_IF(!primaryFrame)) {
@@ -2271,17 +2271,17 @@ ContentEventHandler::OnQueryTextRect(Wid
// +------------------------------------+
//
// +-<p>--------------------------------+
// |def |
// +------------------------------------+
// Therefore, if the first frame isn't a <br> frame and there is a text
// node before the first node in the queried range, we should compute the
// first rect with the previous character's rect.
- else if (firstFrame->GetType() != FrameType::Br && lastTextContent) {
+ else if (!firstFrame->IsBrFrame() && lastTextContent) {
FrameRelativeRect brRectAfterLastChar =
GuessLineBreakerRectAfter(lastTextContent);
if (NS_WARN_IF(!brRectAfterLastChar.IsValid())) {
return NS_ERROR_FAILURE;
}
rect = brRectAfterLastChar.mRect;
rv = ConvertToRootRelativeOffset(brRectAfterLastChar.mBaseFrame, rect);
if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -2589,17 +2589,17 @@ ContentEventHandler::OnQueryCharacterAtP
NodePosition(tentativeCaretOffsets),
mRootContent,
&aEvent->mReply.mTentativeCaretOffset,
GetLineBreakType(aEvent));
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
- if (targetFrame->GetType() != FrameType::Text) {
+ if (!targetFrame->IsTextFrame()) {
// There is no character at the point but there is tentative caret point.
aEvent->mSucceeded = true;
return NS_OK;
}
MOZ_ASSERT(
aEvent->mReply.mTentativeCaretOffset != WidgetQueryContentEvent::NOT_FOUND,
"The point is inside a character bounding box. Why tentative caret point "
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -233,26 +233,26 @@ nsGenericHTMLElement::GetAccessKeyLabel(
nsAutoString suffix;
GetAccessKey(suffix);
if (!suffix.IsEmpty()) {
EventStateManager::GetAccessKeyLabelPrefix(this, aLabel);
aLabel.Append(suffix);
}
}
-static bool IS_TABLE_CELL(nsIAtom* frameType) {
+static bool IS_TABLE_CELL(FrameType frameType) {
return FrameType::TableCell == frameType ||
FrameType::BCTableCell == frameType;
}
static bool
IsOffsetParent(nsIFrame* aFrame)
{
FrameType frameType = aFrame->Type();
-
+
if (IS_TABLE_CELL(frameType) || frameType == FrameType::Table) {
// Per the IDL for Element, only td, th, and table are acceptable offsetParents
// apart from body or positioned elements; we need to check the content type as
// well as the frame type so we ignore anonymous tables created by an element
// with display: table-cell with no actual table
nsIContent* content = aFrame->GetContent();
return content->IsAnyOfHTMLElements(nsGkAtoms::table,
--- a/layout/base/GeckoRestyleManager.cpp
+++ b/layout/base/GeckoRestyleManager.cpp
@@ -728,17 +728,17 @@ ElementForStyleContext(nsIContent* aPare
if (aPseudoType == CSSPseudoElementType::mozNumberText ||
aPseudoType == CSSPseudoElementType::mozNumberWrapper ||
aPseudoType == CSSPseudoElementType::mozNumberSpinBox ||
aPseudoType == CSSPseudoElementType::mozNumberSpinUp ||
aPseudoType == CSSPseudoElementType::mozNumberSpinDown) {
// Get content for nearest nsNumberControlFrame:
nsIFrame* f = aFrame->GetParent();
MOZ_ASSERT(f);
- while (f->GetType() != FrameType::NumberControl) {
+ while (!f->IsNumberControlFrame()) {
f = f->GetParent();
MOZ_ASSERT(f);
}
return f->GetContent()->AsElement();
}
Element* frameElement = aFrame->GetContent()->AsElement();
if (frameElement->IsNativeAnonymous() &&
@@ -987,17 +987,17 @@ GeckoRestyleManager::ReparentStyleContex
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
for (nsIFrame* child : lists.CurrentList()) {
// only do frames that are in flow
if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW) &&
child != providerChild) {
#ifdef DEBUG
- if (FrameType::Placeholder == child->GetType()) {
+ if (child->IsPlaceholderFrame()) {
nsIFrame* outOfFlowFrame =
nsPlaceholderFrame::GetRealFrameForPlaceholder(child);
NS_ASSERTION(outOfFlowFrame, "no out-of-flow frame");
NS_ASSERTION(outOfFlowFrame != providerChild,
"Out of flow provider?");
}
#endif
@@ -1648,17 +1648,17 @@ ElementRestyler::MoveStyleContextsForCon
if (child->GetStateBits() & NS_FRAME_OUT_OF_FLOW) {
return false;
}
if (GetPrevContinuationWithSameStyle(child)) {
continue;
}
// Bail out if we have placeholder frames.
// FIXME: It is probably safe to just continue here instead of bailing out.
- if (FrameType::Placeholder == child->GetType()) {
+ if (child->IsPlaceholderFrame()) {
return false;
}
nsStyleContext* sc = child->StyleContext();
if (sc->GetParent() != aOldContext) {
return false;
}
FrameType type = child->Type();
if (type == FrameType::Letter ||
@@ -3416,17 +3416,17 @@ ElementRestyler::RestyleContentChildren(
// nsPageFrame that does not have a content.
nsIContent* parent = child->GetContent() ? child->GetContent()->GetParent() : nullptr;
TreeMatchContext::AutoAncestorPusher insertionPointPusher(mTreeMatchContext);
if (parent && nsContentUtils::IsContentInsertionPoint(parent)) {
insertionPointPusher.PushAncestorAndStyleScope(parent);
}
// only do frames that are in flow
- if (FrameType::Placeholder == child->GetType()) { // placeholder
+ if (child->IsPlaceholderFrame()) { // placeholder
// get out of flow frame and recur there
nsIFrame* outOfFlowFrame =
nsPlaceholderFrame::GetRealFrameForPlaceholder(child);
NS_ASSERTION(outOfFlowFrame, "no out-of-flow frame");
NS_ASSERTION(outOfFlowFrame != mResolvedChild,
"out-of-flow frame not a true descendant");
// |nsFrame::GetParentStyleContext| checks being out
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -2468,20 +2468,20 @@ nsIPresShell::GetRootFrameExternal() con
return mFrameConstructor->GetRootFrame();
}
nsIFrame*
nsIPresShell::GetRootScrollFrame() const
{
nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
// Ensure root frame is a viewport frame
- if (!rootFrame || FrameType::Viewport != rootFrame->GetType())
+ if (!rootFrame || !rootFrame->IsViewportFrame())
return nullptr;
nsIFrame* theFrame = rootFrame->PrincipalChildList().FirstChild();
- if (!theFrame || FrameType::Scroll != theFrame->GetType())
+ if (!theFrame || !theFrame->IsScrollFrame())
return nullptr;
return theFrame;
}
nsIScrollableFrame*
nsIPresShell::GetRootScrollFrameAsScrollable() const
{
nsIFrame* frame = GetRootScrollFrame();
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -614,17 +614,17 @@ VerifyStyleTree(nsIFrame* aFrame)
nsStyleContext* context = aFrame->StyleContext();
VerifyContextParent(aFrame, context, nullptr);
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
for (nsIFrame* child : lists.CurrentList()) {
if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
// only do frames that are in flow
- if (FrameType::Placeholder == child->GetType()) {
+ if (child->IsPlaceholderFrame()) {
// placeholder: first recurse and verify the out of flow frame,
// then verify the placeholder's context
nsIFrame* outOfFlowFrame =
nsPlaceholderFrame::GetRealFrameForPlaceholder(child);
// recurse to out of flow frame, letting the parent context get resolved
do {
VerifyStyleTree(outOfFlowFrame);
@@ -1151,17 +1151,17 @@ SyncViewsAndInvalidateDescendants(nsIFra
aFrame->SyncFrameViewProperties();
}
nsIFrame::ChildListIterator lists(aFrame);
for (; !lists.IsDone(); lists.Next()) {
for (nsIFrame* child : lists.CurrentList()) {
if (!(child->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
// only do frames that don't have placeholders
- if (FrameType::Placeholder == child->GetType()) {
+ if (child->IsPlaceholderFrame()) {
// do the out-of-flow frame and its continuations
nsIFrame* outOfFlowFrame =
nsPlaceholderFrame::GetRealFrameForPlaceholder(child);
DoApplyRenderingChangeToTree(outOfFlowFrame, aChange);
} else if (lists.CurrentID() == nsIFrame::kPopupList) {
DoApplyRenderingChangeToTree(child, aChange);
} else { // regular frame
SyncViewsAndInvalidateDescendants(child, aChange);
@@ -1680,18 +1680,17 @@ RestyleManager::ProcessRestyledFrames(ns
#ifdef DEBUG
// reget frame from content since it may have been regenerated...
if (data.mContent) {
nsIFrame* frame = data.mContent->GetPrimaryFrame();
if (frame) {
DebugVerifyStyleTree(frame);
}
- } else if (!data.mFrame ||
- data.mFrame->GetType() != FrameType::Viewport) {
+ } else if (!data.mFrame || !data.mFrame->IsViewportFrame()) {
NS_WARNING("Unable to test style tree integrity -- no content node "
"(and not a viewport frame)");
}
#endif
}
aChangeList.Clear();
}
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -856,18 +856,17 @@ nsBidiPresUtils::ResolveParagraph(BidiPa
for (; ;) {
if (fragmentLength <= 0) {
// Get the next frame from mLogicalFrames
if (++frameIndex >= frameCount) {
break;
}
frame = aBpd->FrameAt(frameIndex);
- if (frame == NS_BIDI_CONTROL_FRAME ||
- FrameType::Text != frame->GetType()) {
+ if (frame == NS_BIDI_CONTROL_FRAME || !frame->IsTextFrame()) {
/*
* Any non-text frame corresponds to a single character in the text buffer
* (a bidi control character, LINE SEPARATOR, or OBJECT SUBSTITUTE)
*/
isTextFrame = false;
fragmentLength = 1;
} else {
currentLine = aBpd->GetLineForFrameAt(frameIndex);
@@ -1064,17 +1063,17 @@ nsBidiPresUtils::TraverseFrames(nsBlockI
* twice.
*/
nsIFrame* nextSibling = childFrame->GetNextSibling();
// If the real frame for a placeholder is a first letter frame, we need to
// drill down into it and include its contents in Bidi resolution.
// If not, we just use the placeholder.
nsIFrame* frame = childFrame;
- if (FrameType::Placeholder == childFrame->GetType()) {
+ if (childFrame->IsPlaceholderFrame()) {
nsIFrame* realFrame =
nsPlaceholderFrame::GetRealFrameForPlaceholder(childFrame);
if (realFrame->IsLetterFrame()) {
frame = realFrame;
}
}
auto DifferentBidiValues = [](nsStyleContext* aSC1, nsIFrame* aFrame2) {
@@ -1702,17 +1701,17 @@ nsBidiPresUtils::RepositionFrame(nsIFram
for (nsFrameList::Enumerator e(aFrame->PrincipalChildList());
!e.AtEnd(); e.Next()) {
icoord += RepositionFrame(e.get(), aIsEvenLevel, icoord,
aContinuationStates,
frameWM, reverseDir, frameSize);
}
icoord += reverseDir ?
borderPadding.IStart(frameWM) : borderPadding.IEnd(frameWM);
- } else if (RubyUtils::IsRubyBox(aFrame->GetType())) {
+ } else if (RubyUtils::IsRubyBox(aFrame->Type())) {
icoord += RepositionRubyFrame(aFrame, aContinuationStates,
aContainerWM, borderPadding);
} else {
icoord +=
frameWM.IsOrthogonalTo(aContainerWM) ? aFrame->BSize() : frameISize;
}
// In the following variables, if aContainerReverseDir is true, i.e.
@@ -1739,17 +1738,17 @@ nsBidiPresUtils::RepositionFrame(nsIFram
void
nsBidiPresUtils::InitContinuationStates(nsIFrame* aFrame,
nsContinuationStates* aContinuationStates)
{
nsFrameContinuationState* state = aContinuationStates->PutEntry(aFrame);
state->mFirstVisualFrame = nullptr;
state->mFrameCount = 0;
- if (!IsBidiLeaf(aFrame) || RubyUtils::IsRubyBox(aFrame->GetType())) {
+ if (!IsBidiLeaf(aFrame) || RubyUtils::IsRubyBox(aFrame->Type())) {
// Continue for child frames
for (nsIFrame* frame : aFrame->PrincipalChildList()) {
InitContinuationStates(frame,
aContinuationStates);
}
}
}
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -349,21 +349,19 @@ IsFlexOrGridContainer(const nsIFrame* aF
}
// Returns true IFF the given nsIFrame is a nsFlexContainerFrame and
// represents a -webkit-{inline-}box container. The frame's GetType() result is
// passed as a separate argument, since in most cases, the caller will have
// looked it up already, and we'd rather not make redundant calls to the
// virtual GetType() method.
static inline bool
-IsFlexContainerForLegacyBox(const nsIFrame* aFrame,
- const nsIAtom* aFrameType)
-{
- MOZ_ASSERT(aFrame->GetType() == aFrameType, "wrong aFrameType was passed");
- return aFrameType == FrameType::FlexContainer &&
+IsFlexContainerForLegacyBox(const nsIFrame* aFrame)
+{
+ return aFrame->IsFlexContainerFrame() &&
aFrame->HasAnyStateBits(NS_STATE_FLEX_IS_LEGACY_WEBKIT_BOX);
}
#if DEBUG
static void
AssertAnonymousFlexOrGridItemParent(const nsIFrame* aChild,
const nsIFrame* aParent)
{
@@ -1972,17 +1970,17 @@ IsRubyPseudo(nsIFrame* aFrame)
static bool
IsTableOrRubyPseudo(nsIFrame* aFrame)
{
return IsTablePseudo(aFrame) || IsRubyPseudo(aFrame);
}
/* static */
nsCSSFrameConstructor::ParentType
-nsCSSFrameConstructor::GetParentType(nsIAtom* aFrameType)
+nsCSSFrameConstructor::GetParentType(FrameType aFrameType)
{
if (aFrameType == FrameType::Table) {
return eTypeTable;
}
if (aFrameType == FrameType::TableRowGroup) {
return eTypeRowGroup;
}
if (aFrameType == FrameType::TableRow) {
@@ -2002,17 +2000,17 @@ nsCSSFrameConstructor::GetParentType(nsI
}
return eTypeBlock;
}
static nsContainerFrame*
AdjustCaptionParentFrame(nsContainerFrame* aParentFrame)
{
- if (FrameType::Table == aParentFrame->GetType()) {
+ if (aParentFrame->IsTableFrame()) {
return aParentFrame->GetParent();
}
return aParentFrame;
}
/**
* If the parent frame is a |tableFrame| and the child is a
* |captionFrame|, then we want to insert the frames beneath the
@@ -3564,25 +3562,25 @@ nsCSSFrameConstructor::FindDataByTag(nsI
#define SIMPLE_TAG_CREATE(_tag, _func) \
{ &nsGkAtoms::_tag, SIMPLE_FCDATA(_func) }
#define SIMPLE_TAG_CHAIN(_tag, _func) \
{ &nsGkAtoms::_tag, FCDATA_DECL(FCDATA_FUNC_IS_DATA_GETTER, _func) }
#define COMPLEX_TAG_CREATE(_tag, _func) \
{ &nsGkAtoms::_tag, FULL_CTOR_FCDATA(0, _func) }
static bool
-IsFrameForFieldSet(nsIFrame* aFrame, nsIAtom* aFrameType)
+IsFrameForFieldSet(nsIFrame* aFrame)
{
nsIAtom* pseudo = aFrame->StyleContext()->GetPseudo();
if (pseudo == nsCSSAnonBoxes::fieldsetContent ||
pseudo == nsCSSAnonBoxes::scrolledContent ||
pseudo == nsCSSAnonBoxes::columnContent) {
- return IsFrameForFieldSet(aFrame->GetParent(), aFrame->GetParent()->GetType());
- }
- return aFrameType == FrameType::FieldSet;
+ return IsFrameForFieldSet(aFrame->GetParent());
+ }
+ return aFrame->IsFieldSetFrame();
}
/* static */
const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindHTMLData(Element* aElement,
nsIAtom* aTag,
int32_t aNameSpaceID,
nsIFrame* aParentFrame,
@@ -3597,17 +3595,17 @@ nsCSSFrameConstructor::FindHTMLData(Elem
NS_ASSERTION(!aParentFrame ||
aParentFrame->StyleContext()->GetPseudo() !=
nsCSSAnonBoxes::fieldsetContent ||
aParentFrame->GetParent()->IsFieldSetFrame(),
"Unexpected parent for fieldset content anon box");
if (aTag == nsGkAtoms::legend &&
(!aParentFrame ||
- !IsFrameForFieldSet(aParentFrame, aParentFrame->GetType()) ||
+ !IsFrameForFieldSet(aParentFrame) ||
aStyleContext->StyleDisplay()->IsFloatingStyle() ||
aStyleContext->StyleDisplay()->IsAbsolutelyPositionedStyle())) {
// <legend> is only special inside fieldset, we only check the frame tree
// parent because the content tree parent may not be a <fieldset> due to
// display:contents, Shadow DOM, or XBL. For floated or absolutely
// positioned legends we want to construct by display type and
// not do special legend stuff.
return nullptr;
@@ -3908,18 +3906,17 @@ nsCSSFrameConstructor::ConstructFrameFro
} else {
newFrame =
(*data->mFunc.mCreationFunc)(mPresShell, styleContext);
bool allowOutOfFlow = !(bits & FCDATA_DISALLOW_OUT_OF_FLOW);
bool isPopup = aItem.mIsPopup;
NS_ASSERTION(!isPopup ||
(aState.mPopupItems.containingBlock &&
- aState.mPopupItems.containingBlock->GetType() ==
- FrameType::PopupSet),
+ aState.mPopupItems.containingBlock->IsPopupSetFrame()),
"Should have a containing block here!");
nsContainerFrame* geometricParent =
isPopup ? aState.mPopupItems.containingBlock :
(allowOutOfFlow ? aState.GetGeometricParent(display, aParentFrame)
: aParentFrame);
// Must init frameToAddToList to null, since it's inout
@@ -5926,17 +5923,17 @@ nsCSSFrameConstructor::AddFrameConstruct
if (data->mBits & FCDATA_SUPPRESS_FRAME) {
SetAsUndisplayedContent(aState, aItems, element, styleContext, isGeneratedContent);
return;
}
#ifdef MOZ_XUL
if ((data->mBits & FCDATA_IS_POPUP) &&
(!aParentFrame || // Parent is inline
- aParentFrame->GetType() != FrameType::Menu)) {
+ !aParentFrame->IsMenuFrame())) {
if (!aState.mPopupItems.containingBlock &&
!aState.mHavePendingPopupgroup) {
SetAsUndisplayedContent(aState, aItems, element, styleContext,
isGeneratedContent);
return;
}
isPopup = true;
@@ -6328,25 +6325,25 @@ nsCSSFrameConstructor::GetAbsoluteContai
}
nsIFrame* absPosCBCandidate = frame;
FrameType type = absPosCBCandidate->Type();
if (type == FrameType::FieldSet) {
absPosCBCandidate = static_cast<nsFieldSetFrame*>(absPosCBCandidate)->GetInner();
if (!absPosCBCandidate) {
continue;
}
- type = absPosCBCandidate->GetType();
+ type = absPosCBCandidate->Type();
}
if (type == FrameType::Scroll) {
nsIScrollableFrame* scrollFrame = do_QueryFrame(absPosCBCandidate);
absPosCBCandidate = scrollFrame->GetScrolledFrame();
if (!absPosCBCandidate) {
continue;
}
- type = absPosCBCandidate->GetType();
+ type = absPosCBCandidate->Type();
}
// Only first continuations can be containing blocks.
absPosCBCandidate = absPosCBCandidate->FirstContinuation();
// Is the frame really an absolute container?
if (!absPosCBCandidate->IsAbsoluteContainer()) {
continue;
}
@@ -6707,17 +6704,17 @@ nsCSSFrameConstructor::IsValidSibling(ns
// siblings.
return false;
}
// Fall through; it's possible that the display type was overridden and
// a different sort of frame was constructed, so we may need to return false
// below.
}
- if (IsFrameForFieldSet(parentFrame, parentType)) {
+ if (IsFrameForFieldSet(parentFrame)) {
// Legends can be sibling of legends but not of other content in the fieldset
if (nsContainerFrame* cif = aSibling->GetContentInsertionFrame()) {
aSibling = cif;
}
FrameType sibType = aSibling->Type();
bool legendContent = aContent->IsHTMLElement(nsGkAtoms::legend);
if ((legendContent && (FrameType::Legend != sibType)) ||
@@ -6834,25 +6831,24 @@ nsCSSFrameConstructor::FindNextSibling(F
}
return nullptr;
}
// For fieldsets, returns the area frame, if the child is not a legend.
static nsContainerFrame*
GetAdjustedParentFrame(nsContainerFrame* aParentFrame,
- nsIAtom* aParentFrameType,
- nsIContent* aChildContent)
-{
- NS_PRECONDITION(FrameType::TableWrapper != aParentFrameType,
+ nsIContent* aChildContent)
+{
+ NS_PRECONDITION(!aParentFrame->IsTableWrapperFrame(),
"Shouldn't be happening!");
nsContainerFrame* newParent = nullptr;
- if (FrameType::FieldSet == aParentFrameType) {
+ if (aParentFrame->IsFieldSetFrame()) {
// If the parent is a fieldSet, use the fieldSet's area frame as the
// parent unless the new content is a legend.
if (!aChildContent->IsHTMLElement(nsGkAtoms::legend)) {
newParent = GetFieldSetBlockFrame(aParentFrame);
}
}
return newParent ? newParent : aParentFrame;
}
@@ -6916,19 +6912,17 @@ nsCSSFrameConstructor::GetInsertionPrevS
if (!nextSibling) {
// Our siblings (if any) does not have a frame to guide us.
// The frame for aChild should be inserted whereever a frame for
// the container would be inserted. This is needed when inserting
// into nested display:contents nodes.
nsIContent* child = aInsertion->mContainer;
nsIContent* parent = child->GetParent();
aInsertion->mParentFrame =
- ::GetAdjustedParentFrame(aInsertion->mParentFrame,
- aInsertion->mParentFrame->GetType(),
- parent);
+ ::GetAdjustedParentFrame(aInsertion->mParentFrame, parent);
InsertionPoint fakeInsertion(aInsertion->mParentFrame, parent);
nsIFrame* result = GetInsertionPrevSibling(&fakeInsertion, child, aIsAppend,
aIsRangeInsertSafe, nullptr, nullptr);
MOZ_ASSERT(aInsertion->mParentFrame->GetContent() ==
fakeInsertion.mParentFrame->GetContent());
// fakeInsertion.mParentFrame may now be a continuation of the frame
// we started with in the ctor above.
aInsertion->mParentFrame = fakeInsertion.mParentFrame;
@@ -6951,19 +6945,17 @@ nsCSSFrameConstructor::GetInsertionPrevS
GetLastIBSplitSibling(aInsertion->mParentFrame, false);
}
// Get continuation that parents the last child. This MUST be done
// before the AdjustAppendParentForAfterContent call.
aInsertion->mParentFrame =
nsLayoutUtils::LastContinuationWithChild(aInsertion->mParentFrame);
// Deal with fieldsets
aInsertion->mParentFrame =
- ::GetAdjustedParentFrame(aInsertion->mParentFrame,
- aInsertion->mParentFrame->GetType(),
- aChild);
+ ::GetAdjustedParentFrame(aInsertion->mParentFrame, aChild);
nsIFrame* appendAfterFrame;
aInsertion->mParentFrame =
::AdjustAppendParentForAfterContent(this, aInsertion->mContainer,
aInsertion->mParentFrame,
aChild, &appendAfterFrame);
prevSibling = ::FindAppendPrevSibling(aInsertion->mParentFrame, appendAfterFrame);
}
}
@@ -7622,18 +7614,17 @@ nsCSSFrameConstructor::ContentAppended(n
}
// Get continuation that parents the last child. This MUST be done
// before the AdjustAppendParentForAfterContent call.
parentFrame = nsLayoutUtils::LastContinuationWithChild(parentFrame);
// We should never get here with fieldsets or details, since they have
// multiple insertion points.
- MOZ_ASSERT(parentFrame->GetType() != FrameType::FieldSet &&
- parentFrame->GetType() != FrameType::Details,
+ MOZ_ASSERT(!parentFrame->IsFieldSetFrame() && !parentFrame->IsDetailsFrame(),
"Parent frame should not be fieldset or details!");
// Deal with possible :after generated content on the parent
nsIFrame* parentAfterFrame;
parentFrame =
::AdjustAppendParentForAfterContent(this, insertion.mContainer, parentFrame,
aFirstNewContent, &parentAfterFrame);
@@ -8086,29 +8077,29 @@ nsCSSFrameConstructor::ContentRangeInser
IssueSingleInsertNofications(aContainer, aStartChild, aEndChild,
aAllowLazyConstruction, aForReconstruction);
LAYOUT_PHASE_TEMP_REENTER();
return;
}
nsIContent* container = insertion.mParentFrame->GetContent();
- nsIAtom* frameType = insertion.mParentFrame->GetType();
+ FrameType frameType = insertion.mParentFrame->Type();
LAYOUT_PHASE_TEMP_EXIT();
if (MaybeRecreateForFrameset(insertion.mParentFrame, aStartChild, aEndChild)) {
LAYOUT_PHASE_TEMP_REENTER();
return;
}
LAYOUT_PHASE_TEMP_REENTER();
// We should only get here with fieldsets when doing a single insert, because
// fieldsets have multiple insertion points.
NS_ASSERTION(isSingleInsert || frameType != FrameType::FieldSet,
"Unexpected parent");
- if (IsFrameForFieldSet(insertion.mParentFrame, frameType) &&
+ if (IsFrameForFieldSet(insertion.mParentFrame) &&
aStartChild->NodeInfo()->NameAtom() == nsGkAtoms::legend) {
// Just reframe the parent, since figuring out whether this
// should be the new legend and then handling it is too complex.
// We could do a little better here --- check if the fieldset already
// has a legend which occurs earlier in its child list than this node,
// and if so, proceed. But we'd have to extend nsFieldSetFrame
// to locate this legend in the inserted frames and extract it.
LAYOUT_PHASE_TEMP_EXIT();
@@ -8225,17 +8216,17 @@ nsCSSFrameConstructor::ContentRangeInser
LAYOUT_PHASE_TEMP_EXIT();
IssueSingleInsertNofications(aContainer, aStartChild, aEndChild,
aAllowLazyConstruction, aForReconstruction);
LAYOUT_PHASE_TEMP_REENTER();
return;
}
container = insertion.mParentFrame->GetContent();
- frameType = insertion.mParentFrame->GetType();
+ frameType = insertion.mParentFrame->Type();
}
}
if (!prevSibling) {
// We're inserting the new frames as the first child. See if the
// parent has a :before pseudo-element
nsIFrame* firstChild = insertion.mParentFrame->PrincipalChildList().FirstChild();
@@ -8411,17 +8402,17 @@ nsCSSFrameConstructor::ContentRangeInser
nsContainerFrame* outerTable = nullptr;
if (GetCaptionAdjustedParent(captionInsertion.mParentFrame,
captionItems.FirstChild(),
&outerTable)) {
// If the parent is not a table wrapper frame we will try to add frames
// to a named child list that the parent does not honor and the frames
// will get lost.
- NS_ASSERTION(FrameType::TableWrapper == outerTable->GetType(),
+ NS_ASSERTION(outerTable->IsTableWrapperFrame(),
"Pseudo frame construction failure; "
"a caption can be only a child of a table wrapper frame");
// If the parent of our current prevSibling is different from the frame
// we'll actually use as the parent, then the calculated insertion
// point is now invalid (bug 341382).
if (captionPrevSibling &&
captionPrevSibling->GetParent() != outerTable) {
@@ -8730,17 +8721,17 @@ nsCSSFrameConstructor::ContentRemoved(ns
childFrame = aChild->GetPrimaryFrame();
if (!childFrame || childFrame->GetContent() != aChild) {
// XXXbz the GetContent() != aChild check is needed due to bug 135040.
// Remove it once that's fixed.
ClearUndisplayedContentIn(aChild, aContainer);
return;
}
parentFrame = childFrame->GetParent();
- parentType = parentFrame->GetType();
+ parentType = parentFrame->Type();
#ifdef NOISY_FIRST_LETTER
printf(" ==> revised parentFrame=");
nsFrame::ListTag(stdout, parentFrame);
printf(" childFrame=");
nsFrame::ListTag(stdout, childFrame);
printf("\n");
#endif
@@ -9214,17 +9205,17 @@ nsCSSFrameConstructor::CreateContinuingF
nsTableFrame::RegisterPositionedTablePart(rowFrame);
}
// Create a continuing frame for each table cell frame
nsFrameItems newChildList;
nsIFrame* cellFrame = aFrame->PrincipalChildList().FirstChild();
while (cellFrame) {
// See if it's a table cell frame
- if (IS_TABLE_CELL(cellFrame->GetType())) {
+ if (IS_TABLE_CELL(cellFrame->Type())) {
nsIFrame* continuingCellFrame =
CreateContinuingFrame(aPresContext, cellFrame, rowFrame);
newChildList.AddChild(continuingCellFrame);
}
cellFrame = cellFrame->GetNextSibling();
}
rowFrame->SetInitialChildList(kPrincipalList, newChildList);
@@ -9898,17 +9889,17 @@ nsCSSFrameConstructor::RecreateFramesFor
nsIAnonymousContentCreator* acc = nullptr;
nsIFrame* ancestor = nsLayoutUtils::GetParentOrPlaceholderFor(frame);
while (!(acc = do_QueryFrame(ancestor))) {
ancestor = nsLayoutUtils::GetParentOrPlaceholderFor(ancestor);
}
NS_ASSERTION(acc, "Where is the nsIAnonymousContentCreator? We may fail "
"to recreate its content correctly");
// nsSVGUseFrame is special, and we know this is unnecessary for it.
- if (ancestor->GetType() != FrameType::SVGUse) {
+ if (!ancestor->IsSVGUseFrame()) {
NS_ASSERTION(aContent->IsInNativeAnonymousSubtree(),
"Why is NS_FRAME_ANONYMOUSCONTENTCREATOR_CONTENT set?");
return RecreateFramesForContent(ancestor->GetContent(), aAsyncInsert,
aFlags, aDestroyedFramesFor);
}
}
nsIFrame* parent = frame->GetParent();
@@ -10157,18 +10148,17 @@ nsCSSFrameConstructor::CreateNeededAnonF
return;
}
const FrameType parentType = aParentFrame->Type();
if (parentType != FrameType::FlexContainer &&
parentType != FrameType::GridContainer) {
return;
}
- const bool isWebkitBox = IsFlexContainerForLegacyBox(aParentFrame,
- parentType);
+ const bool isWebkitBox = IsFlexContainerForLegacyBox(aParentFrame);
FCItemIterator iter(aItems);
do {
// Advance iter past children that don't want to be wrapped
if (iter.SkipItemsThatDontNeedAnonFlexOrGridItem(aState, isWebkitBox)) {
// Hit the end of the items without finding any remaining children that
// need to be wrapped. We're finished!
return;
}
@@ -10854,17 +10844,17 @@ FrameWantsToBeInAnonymousItem(const nsIF
}
#endif
static void
VerifyGridFlexContainerChildren(nsIFrame* aParentFrame,
const nsFrameList& aChildren)
{
#ifdef DEBUG
- auto parentType = aParentFrame->GetType();
+ auto parentType = aParentFrame->Type();
if (parentType != FrameType::FlexContainer &&
parentType != FrameType::GridContainer) {
return;
}
bool prevChildWasAnonItem = false;
for (const nsIFrame* child : aChildren) {
MOZ_ASSERT(!FrameWantsToBeInAnonymousItem(aParentFrame, child),
@@ -11355,17 +11345,17 @@ nsCSSFrameConstructor::AppendFirstLineFr
WrapFramesInFirstLineFrame(aState, aBlockContent,
aBlockFrame, nullptr, aFrameItems);
return;
}
// Examine the last block child - if it's a first-line frame then
// appended frames need special treatment.
nsIFrame* lastBlockKid = blockKids.LastChild();
- if (lastBlockKid->GetType() != FrameType::Line) {
+ if (!lastBlockKid->IsLineFrame()) {
// No first-line frame at the end of the list, therefore there is
// an intervening block between any first-line frame the frames
// we are appending. Therefore, we don't need any special
// treatment of the appended frames.
return;
}
nsFirstLineFrame* lineFrame = static_cast<nsFirstLineFrame*>(lastBlockKid);
@@ -11829,17 +11819,17 @@ nsCSSFrameConstructor::WrapFramesInFirst
}
}
static nsIFrame*
FindFirstLetterFrame(nsIFrame* aFrame, nsIFrame::ChildListID aListID)
{
nsFrameList list = aFrame->GetChildList(aListID);
for (nsFrameList::Enumerator e(list); !e.AtEnd(); e.Next()) {
- if (FrameType::Letter == e.get()->GetType()) {
+ if (e.get()->IsLetterFrame()) {
return e.get();
}
}
return nullptr;
}
void
nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
@@ -11934,17 +11924,17 @@ nsCSSFrameConstructor::RemoveFirstLetter
nsContainerFrame* aFrame,
nsContainerFrame* aBlockFrame,
bool* aStopLooking)
{
nsIFrame* prevSibling = nullptr;
nsIFrame* kid = aFrame->PrincipalChildList().FirstChild();
while (kid) {
- if (FrameType::Letter == kid->GetType()) {
+ if (kid->IsLetterFrame()) {
// Bingo. Found it. First steal away the text frame.
nsIFrame* textFrame = kid->PrincipalChildList().FirstChild();
if (!textFrame) {
break;
}
// Create a new textframe
nsStyleContext* parentSC = aFrame->StyleContext();
@@ -12566,17 +12556,17 @@ nsCSSFrameConstructor::WipeContainingBlo
// flex or grid item.
FrameType frameType = aFrame->Type();
if (frameType == FrameType::FlexContainer ||
frameType == FrameType::GridContainer) {
FCItemIterator iter(aItems);
// Check if we're adding to-be-wrapped content right *after* an existing
// anonymous flex or grid item (which would need to absorb this content).
- const bool isWebkitBox = IsFlexContainerForLegacyBox(aFrame, frameType);
+ const bool isWebkitBox = IsFlexContainerForLegacyBox(aFrame);
if (aPrevSibling && IsAnonymousFlexOrGridItem(aPrevSibling) &&
iter.item().NeedsAnonFlexOrGridItem(aState, isWebkitBox)) {
RecreateFramesForContent(aFrame->GetContent(), true,
REMOVE_FOR_RECONSTRUCTION, nullptr);
return true;
}
// Check if we're adding to-be-wrapped content right *before* an existing
@@ -12606,18 +12596,17 @@ nsCSSFrameConstructor::WipeContainingBlo
// _flex/grid container_ as its parent in the content tree.
nsFrameConstructorSaveState floatSaveState;
aState.PushFloatContainingBlock(nullptr, floatSaveState);
FCItemIterator iter(aItems);
// Skip over things that _do_ need an anonymous flex item, because
// they're perfectly happy to go here -- they won't cause a reframe.
nsIFrame* containerFrame = aFrame->GetParent();
- const bool isWebkitBox =
- IsFlexContainerForLegacyBox(containerFrame, containerFrame->GetType());
+ const bool isWebkitBox = IsFlexContainerForLegacyBox(containerFrame);
if (!iter.SkipItemsThatNeedAnonFlexOrGridItem(aState,
isWebkitBox)) {
// We hit something that _doesn't_ need an anonymous flex item!
// Rebuild the flex container to bust it out.
RecreateFramesForContent(containerFrame->GetContent(), true,
REMOVE_FOR_RECONSTRUCTION, nullptr);
return true;
}
--- a/layout/base/nsCSSFrameConstructor.h
+++ b/layout/base/nsCSSFrameConstructor.h
@@ -606,21 +606,21 @@ private:
#define FCDATA_DESIRED_PARENT_TYPE(_bits) \
ParentType((_bits) >> FCDATA_PARENT_TYPE_OFFSET)
/* Macro to create FrameConstructionData bits out of a desired parent type */
#define FCDATA_DESIRED_PARENT_TYPE_TO_BITS(_type) \
(((uint32_t)(_type)) << FCDATA_PARENT_TYPE_OFFSET)
/* Get the parent type that aParentFrame has. */
static ParentType GetParentType(nsIFrame* aParentFrame) {
- return GetParentType(aParentFrame->GetType());
+ return GetParentType(aParentFrame->Type());
}
/* Get the parent type for the given nsIFrame type atom */
- static ParentType GetParentType(nsIAtom* aFrameType);
+ static ParentType GetParentType(FrameType aFrameType);
static bool IsRubyParentType(ParentType aParentType) {
return (aParentType == eTypeRuby ||
aParentType == eTypeRubyBase ||
aParentType == eTypeRubyBaseContainer ||
aParentType == eTypeRubyText ||
aParentType == eTypeRubyTextContainer);
}
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -2574,18 +2574,18 @@ nsDocumentViewer::FindContainerView()
LAYOUT_WARNING("Subdocument container has no frame");
return nullptr;
}
// subdocFrame might not be a subdocument frame; the frame
// constructor can treat a <frame> as an inline in some XBL
// cases. Treat that as display:none, the document is not
// displayed.
- if (subdocFrame->GetType() != FrameType::SubDocument) {
- NS_WARNING_ASSERTION(!subdocFrame->GetType(),
+ if (!subdocFrame->IsSubDocumentFrame()) {
+ NS_WARNING_ASSERTION(subdocFrame->Type() == FrameType::None,
"Subdocument container has non-subdocument frame");
return nullptr;
}
NS_ASSERTION(subdocFrame->GetView(), "Subdoc frames must have views");
return static_cast<nsSubDocumentFrame*>(subdocFrame)->EnsureInnerView();
}
--- a/layout/base/nsFrameManager.cpp
+++ b/layout/base/nsFrameManager.cpp
@@ -174,30 +174,30 @@ nsFrameManager::GetPlaceholderFrameFor(c
return nullptr;
}
void
nsFrameManager::RegisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame)
{
MOZ_ASSERT(aPlaceholderFrame, "null param unexpected");
- MOZ_ASSERT(FrameType::Placeholder == aPlaceholderFrame->GetType(),
+ MOZ_ASSERT(aPlaceholderFrame->IsPlaceholderFrame(),
"unexpected frame type");
auto entry = static_cast<PlaceholderMapEntry*>
(mPlaceholderMap.Add(aPlaceholderFrame->GetOutOfFlowFrame()));
MOZ_ASSERT(!entry->placeholderFrame,
"Registering a placeholder for a frame that already has a placeholder!");
entry->placeholderFrame = aPlaceholderFrame;
}
void
nsFrameManager::UnregisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame)
{
NS_PRECONDITION(aPlaceholderFrame, "null param unexpected");
- NS_PRECONDITION(FrameType::Placeholder == aPlaceholderFrame->GetType(),
+ NS_PRECONDITION(aPlaceholderFrame->IsPlaceholderFrame(),
"unexpected frame type");
mPlaceholderMap.Remove(aPlaceholderFrame->GetOutOfFlowFrame());
}
void
nsFrameManager::ClearPlaceholderFrameMap()
{
--- a/layout/base/nsFrameTraversal.cpp
+++ b/layout/base/nsFrameTraversal.cpp
@@ -197,17 +197,17 @@ nsFrameIterator::nsFrameIterator(nsPresC
mFollowOOFs(aFollowOOFs),
mSkipPopupChecks(aSkipPopupChecks),
mType(aType),
mStart(aStart),
mCurrent(aStart),
mLast(aStart),
mOffEdge(0)
{
- MOZ_ASSERT(!aFollowOOFs || aStart->GetType() != mozilla::FrameType::Placeholder,
+ MOZ_ASSERT(!aFollowOOFs || !aStart->IsPlaceholderFrame(),
"Caller should have resolved placeholder frame");
}
nsIFrame*
nsFrameIterator::CurrentItem()
{
@@ -229,37 +229,35 @@ void
nsFrameIterator::First()
{
mCurrent = mStart;
}
static bool
IsRootFrame(nsIFrame* aFrame)
{
- mozilla::FrameType atom = aFrame->Type();
- return (atom == mozilla::FrameType::Canvas) ||
- (atom == mozilla::FrameType::Root);
+ return aFrame->IsCanvasFrame() || aFrame->IsRootFrame();
}
void
nsFrameIterator::Last()
{
nsIFrame* result;
nsIFrame* parent = getCurrent();
// If the current frame is a popup, don't move farther up the tree.
// Otherwise, get the nearest root frame or popup.
- if (mSkipPopupChecks || parent->GetType() != mozilla::FrameType::MenuPopup) {
+ if (mSkipPopupChecks || !parent->IsMenuPopupFrame()) {
while (!IsRootFrame(parent) && (result = GetParentFrameNotPopup(parent)))
parent = result;
}
while ((result = GetLastChild(parent))) {
parent = result;
}
-
+
setCurrent(parent);
if (!parent)
setOffEdge(1);
}
void
nsFrameIterator::Next()
{
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -1618,30 +1618,36 @@ nsLayoutUtils::GetAfterFrame(const nsICo
{
Element* pseudo = GetAfterPseudo(aContent);
return pseudo ? pseudo->GetPrimaryFrame() : nullptr;
}
// static
nsIFrame*
nsLayoutUtils::GetClosestFrameOfType(nsIFrame* aFrame,
- nsIAtom* aFrameType,
+ FrameType aFrameType,
nsIFrame* aStopAt)
{
for (nsIFrame* frame = aFrame; frame; frame = frame->GetParent()) {
- if (frame->GetType() == aFrameType) {
+ if (frame->Type() == aFrameType) {
return frame;
}
if (frame == aStopAt) {
break;
}
}
return nullptr;
}
+/* static */ nsIFrame*
+nsLayoutUtils::GetPageFrame(nsIFrame* aFrame)
+{
+ return GetClosestFrameOfType(aFrame, FrameType::Page);
+}
+
// static
nsIFrame*
nsLayoutUtils::GetStyleFrame(nsIFrame* aFrame)
{
if (aFrame->IsTableWrapperFrame()) {
nsIFrame* inner = aFrame->PrincipalChildList().FirstChild();
// inner may be null, if aFrame is mid-destruction
return inner;
@@ -1669,18 +1675,17 @@ nsLayoutUtils::GetRealPrimaryFrameFor(co
return nullptr;
}
return nsPlaceholderFrame::GetRealFrameFor(frame);
}
nsIFrame*
nsLayoutUtils::GetFloatFromPlaceholder(nsIFrame* aFrame) {
- NS_ASSERTION(FrameType::Placeholder == aFrame->GetType(),
- "Must have a placeholder here");
+ NS_ASSERTION(aFrame->IsPlaceholderFrame(), "Must have a placeholder here");
if (aFrame->GetStateBits() & PLACEHOLDER_FOR_FLOAT) {
nsIFrame *outOfFlowFrame =
nsPlaceholderFrame::GetRealFrameForPlaceholder(aFrame);
NS_ASSERTION(outOfFlowFrame->IsFloating(),
"How did that happen?");
return outOfFlowFrame;
}
@@ -7118,17 +7123,17 @@ nsLayoutUtils::GetDeviceContextForScreen
nsLayoutUtils::IsReallyFixedPos(nsIFrame* aFrame)
{
NS_PRECONDITION(aFrame->GetParent(),
"IsReallyFixedPos called on frame not in tree");
NS_PRECONDITION(aFrame->StyleDisplay()->mPosition ==
NS_STYLE_POSITION_FIXED,
"IsReallyFixedPos called on non-'position:fixed' frame");
- nsIAtom *parentType = aFrame->GetParent()->GetType();
+ FrameType parentType = aFrame->GetParent()->Type();
return parentType == FrameType::Viewport ||
parentType == FrameType::PageContent;
}
nsLayoutUtils::SurfaceFromElementResult
nsLayoutUtils::SurfaceFromOffscreenCanvas(OffscreenCanvas* aOffscreenCanvas,
uint32_t aSurfaceFlags,
RefPtr<DrawTarget>& aTarget)
@@ -7551,17 +7556,17 @@ nsLayoutUtils::GetFontFacesForFrames(nsI
nsresult
nsLayoutUtils::GetFontFacesForText(nsIFrame* aFrame,
int32_t aStartOffset, int32_t aEndOffset,
bool aFollowContinuations,
nsFontFaceList* aFontFaceList)
{
NS_PRECONDITION(aFrame, "NULL frame pointer");
- if (aFrame->GetType() != FrameType::Text) {
+ if (!aFrame->IsTextFrame()) {
return NS_OK;
}
nsTextFrame* curr = static_cast<nsTextFrame*>(aFrame);
do {
int32_t fstart = std::max(curr->GetContentOffset(), aStartOffset);
int32_t fend = std::min(curr->GetContentEnd(), aEndOffset);
if (fstart >= fend) {
@@ -8061,17 +8066,17 @@ nsLayoutUtils::InflationMinFontSizeFor(c
return 0;
}
float
nsLayoutUtils::FontSizeInflationFor(const nsIFrame *aFrame)
{
if (nsSVGUtils::IsInSVGTextSubtree(aFrame)) {
const nsIFrame* container = aFrame;
- while (container->GetType() != FrameType::SVGText) {
+ while (!container->IsSVGTextFrame()) {
container = container->GetParent();
}
NS_ASSERTION(container, "expected to find an ancestor SVGTextFrame");
return
static_cast<const SVGTextFrame*>(container)->GetFontSizeScaleFactor();
}
if (!FontSizeInflationEnabled(aFrame->PresContext())) {
@@ -9206,18 +9211,17 @@ LineHasNonEmptyContentWorker(nsIFrame* a
// For inline frames, descend into the children, if any.
if (aFrame->IsInlineFrame()) {
for (nsIFrame* child : aFrame->PrincipalChildList()) {
if (LineHasNonEmptyContentWorker(child)) {
return true;
}
}
} else {
- if (aFrame->GetType() != FrameType::Br &&
- !aFrame->IsEmpty()) {
+ if (!aFrame->IsBrFrame() && !aFrame->IsEmpty()) {
return true;
}
}
return false;
}
static
bool
@@ -9239,17 +9243,17 @@ nsLayoutUtils::IsInvisibleBreak(nsINode*
if (aNextLineFrame) {
*aNextLineFrame = nullptr;
}
if (!aNode->IsElement() || !aNode->IsEditable()) {
return false;
}
nsIFrame* frame = aNode->AsElement()->GetPrimaryFrame();
- if (!frame || frame->GetType() != FrameType::Br) {
+ if (!frame || !frame->IsBrFrame()) {
return false;
}
nsContainerFrame* f = frame->GetParent();
while (f && f->IsFrameOfType(nsBox::eLineParticipant)) {
f = f->GetParent();
}
nsBlockFrame* blockAncestor = do_QueryFrame(f);
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -30,16 +30,17 @@
#include "mozilla/ReflowOutput.h"
#include "ImageContainer.h"
#include "gfx2DGlue.h"
#include "nsStyleConsts.h"
#include "SVGImageContext.h"
#include <limits>
#include <algorithm>
+enum class FrameType : uint8_t;
class nsPresContext;
class nsIContent;
class nsIAtom;
class nsIScrollableFrame;
class nsIDOMEvent;
class nsRegion;
class nsDisplayListBuilder;
enum class nsDisplayListBuilderMode : uint8_t;
@@ -313,31 +314,28 @@ public:
*
* @param aFrame the frame to start at
* @param aFrameType the frame type to look for
* @param aStopAt a frame to stop at after we checked it
* @return a frame of the given type or nullptr if no
* such ancestor exists
*/
static nsIFrame* GetClosestFrameOfType(nsIFrame* aFrame,
- nsIAtom* aFrameType,
+ FrameType aFrameType,
nsIFrame* aStopAt = nullptr);
/**
* Given a frame, search up the frame tree until we find an
* ancestor that (or the frame itself) is a "Page" frame, if any.
*
* @param aFrame the frame to start at
- * @return a frame of type nsGkAtoms::pageFrame or nullptr if no
+ * @return a frame of type FrameType::Page or nullptr if no
* such ancestor exists
*/
- static nsIFrame* GetPageFrame(nsIFrame* aFrame)
- {
- return GetClosestFrameOfType(aFrame, nsGkAtoms::pageFrame);
- }
+ static nsIFrame* GetPageFrame(nsIFrame* aFrame);
/**
* Given a frame which is the primary frame for an element,
* return the frame that has the non-pseudoelement style context for
* the content.
* This is aPrimaryFrame itself except for tableWrapper frames.
*
* Given a non-null input, this will return null if and only if its
--- a/layout/forms/nsColorControlFrame.cpp
+++ b/layout/forms/nsColorControlFrame.cpp
@@ -43,22 +43,16 @@ NS_QUERYFRAME_TAIL_INHERITING(nsHTMLButt
void nsColorControlFrame::DestroyFrom(nsIFrame* aDestructRoot)
{
nsFormControlFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(this), false);
nsContentUtils::DestroyAnonymousContent(&mColorContent);
nsHTMLButtonControlFrame::DestroyFrom(aDestructRoot);
}
-nsIAtom*
-nsColorControlFrame::GetType_() const
-{
- return mozilla::FrameType::ColorControl;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
nsColorControlFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("ColorControl"), aResult);
}
#endif
--- a/layout/forms/nsColorControlFrame.h
+++ b/layout/forms/nsColorControlFrame.h
@@ -27,18 +27,16 @@ public:
nsStyleContext* aContext);
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
NS_DECL_QUERYFRAME_TARGET(nsColorControlFrame)
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) override;
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -903,22 +903,16 @@ nsComboboxControlFrame::Reflow(nsPresCon
// This frame didn't fit inside a fragmentation container. Splitting
// a nsComboboxControlFrame makes no sense, so we override the status here.
aStatus.Reset();
}
}
//--------------------------------------------------------------
-nsIAtom*
-nsComboboxControlFrame::GetType_() const
-{
- return FrameType::ComboboxControl;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
nsComboboxControlFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("ComboboxControl"), aResult);
}
#endif
@@ -1283,20 +1277,16 @@ public:
NS_DECL_FRAMEARENA_HELPERS
nsComboboxDisplayFrame (nsStyleContext* aContext,
nsComboboxControlFrame* aComboBox)
: nsBlockFrame(aContext, FrameType::ComboboxDisplay)
, mComboBox(aComboBox)
{}
- // Need this so that line layout knows that this block's inline size
- // depends on the available inline size.
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("ComboboxDisplay"), aResult);
}
#endif
virtual bool IsFrameOfType(uint32_t aFlags) const override
@@ -1315,22 +1305,16 @@ public:
const nsDisplayListSet& aLists) override;
protected:
nsComboboxControlFrame* mComboBox;
};
NS_IMPL_FRAMEARENA_HELPERS(nsComboboxDisplayFrame)
-nsIAtom*
-nsComboboxDisplayFrame::GetType_() const
-{
- return FrameType::ComboboxDisplay;
-}
-
void
nsComboboxDisplayFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
ReflowInput state(aReflowInput);
if (state.ComputedBSize() == NS_INTRINSICSIZE) {
--- a/layout/forms/nsComboboxControlFrame.h
+++ b/layout/forms/nsComboboxControlFrame.h
@@ -92,21 +92,16 @@ public:
nsEventStatus* aEventStatus) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
void PaintFocus(DrawTarget& aDrawTarget, nsPoint aPt);
- // XXXbz this is only needed to prevent the quirk percent height stuff from
- // leaking out of the combobox. We may be able to get rid of this as more
- // things move to IsFrameOfType.
- virtual nsIAtom* GetType_() const override;
-
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsBlockFrame::IsFrameOfType(aFlags &
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
virtual nsIScrollableFrame* GetScrollTargetFrame() override {
return do_QueryFrame(mDropdownFrame);
--- a/layout/forms/nsDateTimeControlFrame.cpp
+++ b/layout/forms/nsDateTimeControlFrame.cpp
@@ -419,14 +419,8 @@ nsDateTimeControlFrame::AttributeChanged
void
nsDateTimeControlFrame::ContentStatesChanged(EventStates aStates)
{
if (aStates.HasState(NS_EVENT_STATE_DISABLED)) {
nsContentUtils::AddScriptRunner(new SyncDisabledStateEvent(this));
}
}
-
-nsIAtom*
-nsDateTimeControlFrame::GetType_() const
-{
- return FrameType::DateTimeControl;
-}
--- a/layout/forms/nsDateTimeControlFrame.h
+++ b/layout/forms/nsDateTimeControlFrame.h
@@ -45,18 +45,16 @@ public:
NS_DECL_FRAMEARENA_HELPERS
#ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(NS_LITERAL_STRING("DateTimeControl"), aResult);
}
#endif
- nsIAtom* GetType_() const override;
-
bool IsFrameOfType(uint32_t aFlags) const override
{
return nsContainerFrame::IsFrameOfType(aFlags &
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
// Reflow
nscoord GetMinISize(nsRenderingContext* aRenderingContext) override;
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -33,22 +33,16 @@ NS_IMPL_FRAMEARENA_HELPERS(nsFieldSetFra
nsFieldSetFrame::nsFieldSetFrame(nsStyleContext* aContext)
: nsContainerFrame(aContext, FrameType::FieldSet)
, mLegendRect(GetWritingMode())
{
mLegendSpace = 0;
}
-nsIAtom*
-nsFieldSetFrame::GetType_() const
-{
- return FrameType::FieldSet;
-}
-
nsRect
nsFieldSetFrame::VisualBorderRectRelativeToSelf() const
{
WritingMode wm = GetWritingMode();
Side legendSide = wm.PhysicalSide(eLogicalSideBStart);
nscoord legendBorder = StyleBorder()->GetComputedBorderWidth(legendSide);
LogicalRect r(wm, LogicalPoint(wm, 0, 0), GetLogicalSize(wm));
nsSize containerSize = r.Size(wm).GetPhysicalSize(wm);
@@ -75,18 +69,17 @@ nsFieldSetFrame::GetInner() const
nsIFrame*
nsFieldSetFrame::GetLegend() const
{
if (mFrames.FirstChild() == GetInner()) {
MOZ_ASSERT(mFrames.LastChild() == mFrames.FirstChild());
return nullptr;
}
MOZ_ASSERT(mFrames.FirstChild() &&
- mFrames.FirstChild()->GetContentInsertionFrame()->GetType() ==
- FrameType::Legend);
+ mFrames.FirstChild()->GetContentInsertionFrame()->IsLegendFrame());
return mFrames.FirstChild();
}
class nsDisplayFieldSetBorder : public nsDisplayItem {
public:
nsDisplayFieldSetBorder(nsDisplayListBuilder* aBuilder,
nsFieldSetFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
--- a/layout/forms/nsFieldSetFrame.h
+++ b/layout/forms/nsFieldSetFrame.h
@@ -26,21 +26,21 @@ public:
virtual nscoord GetPrefISize(nsRenderingContext* aRenderingContext) override;
/**
* The area to paint box-shadows around. It's the border rect except
* when there's a <legend> we offset the y-position to the center of it.
*/
virtual nsRect VisualBorderRectRelativeToSelf() const override;
- virtual void Reflow(nsPresContext* aPresContext,
- ReflowOutput& aDesiredSize,
+ virtual void Reflow(nsPresContext* aPresContext,
+ ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
- nsReflowStatus& aStatus) override;
-
+ nsReflowStatus& aStatus) override;
+
nscoord GetLogicalBaseline(mozilla::WritingMode aWM) const override;
bool GetVerticalAlignBaseline(mozilla::WritingMode aWM,
nscoord* aBaseline) const override;
bool GetNaturalBaselineBOffset(mozilla::WritingMode aWM,
BaselineSharingGroup aBaselineGroup,
nscoord* aBaseline) const override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
@@ -58,17 +58,16 @@ public:
nsFrameList& aFrameList) override;
virtual void InsertFrames(ChildListID aListID,
nsIFrame* aPrevFrame,
nsFrameList& aFrameList) override;
virtual void RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame) override;
#endif
- virtual nsIAtom* GetType_() const override;
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsContainerFrame::IsFrameOfType(aFlags &
~nsIFrame::eCanContainOverflowContainers);
}
virtual nsIScrollableFrame* GetScrollTargetFrame() override
{
return do_QueryFrame(GetInner());
--- a/layout/forms/nsFormControlFrame.cpp
+++ b/layout/forms/nsFormControlFrame.cpp
@@ -21,22 +21,16 @@ nsFormControlFrame::nsFormControlFrame(n
: nsAtomicContainerFrame(aContext, FrameType::FormControl)
{
}
nsFormControlFrame::~nsFormControlFrame()
{
}
-nsIAtom*
-nsFormControlFrame::GetType_() const
-{
- return FrameType::FormControl;
-}
-
void
nsFormControlFrame::DestroyFrom(nsIFrame* aDestructRoot)
{
// Unregister the access key registered in reflow
nsFormControlFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(this), false);
nsAtomicContainerFrame::DestroyFrom(aDestructRoot);
}
--- a/layout/forms/nsFormControlFrame.h
+++ b/layout/forms/nsFormControlFrame.h
@@ -22,18 +22,16 @@ class nsFormControlFrame : public nsAtom
public:
/**
* Main constructor
* @param aContent the content representing this frame
* @param aParentFrame the parent frame
*/
explicit nsFormControlFrame(nsStyleContext*);
- virtual nsIAtom* GetType_() const override;
-
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsAtomicContainerFrame::IsFrameOfType(aFlags &
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
NS_DECL_QUERYFRAME
NS_DECL_ABSTRACT_FRAME(nsFormControlFrame)
--- a/layout/forms/nsGfxButtonControlFrame.cpp
+++ b/layout/forms/nsGfxButtonControlFrame.cpp
@@ -32,22 +32,16 @@ NS_NewGfxButtonControlFrame(nsIPresShell
NS_IMPL_FRAMEARENA_HELPERS(nsGfxButtonControlFrame)
void nsGfxButtonControlFrame::DestroyFrom(nsIFrame* aDestructRoot)
{
nsContentUtils::DestroyAnonymousContent(&mTextContent);
nsHTMLButtonControlFrame::DestroyFrom(aDestructRoot);
}
-nsIAtom*
-nsGfxButtonControlFrame::GetType_() const
-{
- return FrameType::GfxButtonControl;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
nsGfxButtonControlFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("ButtonControl"), aResult);
}
#endif
--- a/layout/forms/nsGfxButtonControlFrame.h
+++ b/layout/forms/nsGfxButtonControlFrame.h
@@ -25,18 +25,16 @@ public:
explicit nsGfxButtonControlFrame(nsStyleContext* aContext);
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) override;
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
NS_DECL_QUERYFRAME
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -59,22 +59,16 @@ NS_QUERYFRAME_TAIL_INHERITING(nsContaine
#ifdef ACCESSIBILITY
a11y::AccType
nsHTMLButtonControlFrame::AccessibleType()
{
return a11y::eHTMLButtonType;
}
#endif
-nsIAtom*
-nsHTMLButtonControlFrame::GetType_() const
-{
- return FrameType::HTMLButtonControl;
-}
-
void
nsHTMLButtonControlFrame::SetFocus(bool aOn, bool aRepaint)
{
}
nsresult
nsHTMLButtonControlFrame::HandleEvent(nsPresContext* aPresContext,
WidgetGUIEvent* aEvent,
--- a/layout/forms/nsHTMLButtonControlFrame.h
+++ b/layout/forms/nsHTMLButtonControlFrame.h
@@ -72,18 +72,16 @@ public:
virtual void RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame) override;
#endif
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() override;
#endif
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(NS_LITERAL_STRING("HTMLButtonControl"), aResult);
}
#endif
virtual bool HonorPrintBackgroundSettings() override { return false; }
--- a/layout/forms/nsImageControlFrame.cpp
+++ b/layout/forms/nsImageControlFrame.cpp
@@ -25,27 +25,25 @@ public:
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
- virtual void Reflow(nsPresContext* aPresContext,
- ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowInput,
- nsReflowStatus& aStatus) override;
+ virtual void Reflow(nsPresContext* aPresContext,
+ ReflowOutput& aDesiredSize,
+ const ReflowInput& aReflowInput,
+ nsReflowStatus& aStatus) override;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) override;
- virtual nsIAtom* GetType_() const override;
-
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() override;
#endif
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(NS_LITERAL_STRING("ImageControl"), aResult);
}
@@ -113,22 +111,16 @@ nsImageControlFrame::AccessibleType()
if (mContent->IsAnyOfHTMLElements(nsGkAtoms::button, nsGkAtoms::input)) {
return a11y::eHTMLButtonType;
}
return a11y::eNoType;
}
#endif
-nsIAtom*
-nsImageControlFrame::GetType_() const
-{
- return FrameType::ImageControl;
-}
-
void
nsImageControlFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsImageControlFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
--- a/layout/forms/nsLegendFrame.cpp
+++ b/layout/forms/nsLegendFrame.cpp
@@ -23,22 +23,16 @@ NS_NewLegendFrame(nsIPresShell* aPresShe
nsIFrame* f = new (aPresShell) nsLegendFrame(aContext);
f->AddStateBits(NS_BLOCK_FORMATTING_CONTEXT_STATE_BITS);
return f;
}
NS_IMPL_FRAMEARENA_HELPERS(nsLegendFrame)
-nsIAtom*
-nsLegendFrame::GetType_() const
-{
- return mozilla::FrameType::Legend;
-}
-
void
nsLegendFrame::DestroyFrom(nsIFrame* aDestructRoot)
{
nsFormControlFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(this), false);
nsBlockFrame::DestroyFrom(aDestructRoot);
}
NS_QUERYFRAME_HEAD(nsLegendFrame)
--- a/layout/forms/nsLegendFrame.h
+++ b/layout/forms/nsLegendFrame.h
@@ -15,25 +15,23 @@ public:
NS_DECL_QUERYFRAME_TARGET(nsLegendFrame)
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
explicit nsLegendFrame(nsStyleContext* aContext)
: nsBlockFrame(aContext, FrameType::Legend)
{}
- virtual void Reflow(nsPresContext* aPresContext,
- ReflowOutput& aDesiredSize,
+ virtual void Reflow(nsPresContext* aPresContext,
+ ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
- nsReflowStatus& aStatus) override;
+ nsReflowStatus& aStatus) override;
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
int32_t GetLogicalAlign(mozilla::WritingMode aCBWM);
};
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -1531,22 +1531,16 @@ nsListControlFrame::DidReflow(nsPresCont
// scrolling to the selected element, when the ResetList was probably only
// caused by content loading normally.
ResetList(!DidHistoryRestore() || mPostChildrenLoadedReset);
}
mHasPendingInterruptAtStartOfReflow = false;
}
-nsIAtom*
-nsListControlFrame::GetType_() const
-{
- return FrameType::ListControl;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
nsListControlFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("ListControl"), aResult);
}
#endif
--- a/layout/forms/nsListControlFrame.h
+++ b/layout/forms/nsListControlFrame.h
@@ -83,23 +83,16 @@ public:
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual nsContainerFrame* GetContentInsertionFrame() override;
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::scrollFrame
- */
- virtual nsIAtom* GetType_() const override;
-
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsHTMLScrollFrame::IsFrameOfType(aFlags &
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
--- a/layout/forms/nsMeterFrame.cpp
+++ b/layout/forms/nsMeterFrame.cpp
@@ -54,22 +54,16 @@ nsMeterFrame::DestroyFrom(nsIFrame* aDes
NS_ASSERTION(!GetPrevContinuation(),
"nsMeterFrame should not have continuations; if it does we "
"need to call RegUnregAccessKey only for the first.");
nsFormControlFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(this), false);
nsContentUtils::DestroyAnonymousContent(&mBarDiv);
nsContainerFrame::DestroyFrom(aDestructRoot);
}
-nsIAtom*
-nsMeterFrame::GetType_() const
-{
- return FrameType::Meter;
-}
-
nsresult
nsMeterFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
{
// Get the NodeInfoManager and tag necessary to create the meter bar div.
nsCOMPtr<nsIDocument> doc = mContent->GetComposedDoc();
// Create the div.
mBarDiv = doc->CreateHTMLElement(nsGkAtoms::div);
--- a/layout/forms/nsMeterFrame.h
+++ b/layout/forms/nsMeterFrame.h
@@ -28,18 +28,16 @@ public:
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
virtual void Reflow(nsPresContext* aCX,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(NS_LITERAL_STRING("Meter"), aResult);
}
#endif
virtual bool IsLeaf() const override { return true; }
--- a/layout/forms/nsNumberControlFrame.cpp
+++ b/layout/forms/nsNumberControlFrame.cpp
@@ -444,22 +444,16 @@ nsNumberControlFrame::CreateAnonymousCon
nsGkAtoms::div,
CSSPseudoElementType::mozNumberSpinDown);
SyncDisabledState();
return rv;
}
-nsIAtom*
-nsNumberControlFrame::GetType_() const
-{
- return FrameType::NumberControl;
-}
-
void
nsNumberControlFrame::SetFocus(bool aOn, bool aRepaint)
{
GetTextFieldFrame()->SetFocus(aOn, aRepaint);
}
nsresult
nsNumberControlFrame::SetFormProperty(nsIAtom* aName, const nsAString& aValue)
--- a/layout/forms/nsNumberControlFrame.h
+++ b/layout/forms/nsNumberControlFrame.h
@@ -74,18 +74,16 @@ public:
uint32_t aFilter) override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(NS_LITERAL_STRING("NumberControl"), aResult);
}
#endif
- virtual nsIAtom* GetType_() const override;
-
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsContainerFrame::IsFrameOfType(aFlags &
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
// nsIFormControlFrame
virtual void SetFocus(bool aOn, bool aRepaint) override;
--- a/layout/forms/nsProgressFrame.cpp
+++ b/layout/forms/nsProgressFrame.cpp
@@ -53,22 +53,16 @@ nsProgressFrame::DestroyFrom(nsIFrame* a
NS_ASSERTION(!GetPrevContinuation(),
"nsProgressFrame should not have continuations; if it does we "
"need to call RegUnregAccessKey only for the first.");
nsFormControlFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(this), false);
nsContentUtils::DestroyAnonymousContent(&mBarDiv);
nsContainerFrame::DestroyFrom(aDestructRoot);
}
-nsIAtom*
-nsProgressFrame::GetType_() const
-{
- return FrameType::Progress;
-}
-
nsresult
nsProgressFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
{
// Create the progress bar div.
nsCOMPtr<nsIDocument> doc = mContent->GetComposedDoc();
mBarDiv = doc->CreateHTMLElement(nsGkAtoms::div);
// Associate ::-moz-progress-bar pseudo-element to the anonymous child.
--- a/layout/forms/nsProgressFrame.h
+++ b/layout/forms/nsProgressFrame.h
@@ -35,18 +35,16 @@ public:
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual void Reflow(nsPresContext* aCX,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(NS_LITERAL_STRING("Progress"), aResult);
}
#endif
virtual bool IsLeaf() const override { return true; }
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -861,22 +861,16 @@ nsRangeFrame::GetMax() const
}
double
nsRangeFrame::GetValue() const
{
return static_cast<dom::HTMLInputElement*>(mContent)->GetValueAsDecimal().toDouble();
}
-nsIAtom*
-nsRangeFrame::GetType_() const
-{
- return FrameType::Range;
-}
-
#define STYLES_DISABLING_NATIVE_THEMING \
NS_AUTHOR_SPECIFIED_BACKGROUND | \
NS_AUTHOR_SPECIFIED_PADDING | \
NS_AUTHOR_SPECIFIED_BORDER
bool
nsRangeFrame::ShouldUseNativeStyle() const
{
--- a/layout/forms/nsRangeFrame.h
+++ b/layout/forms/nsRangeFrame.h
@@ -80,18 +80,16 @@ public:
const mozilla::LogicalSize& aMargin,
const mozilla::LogicalSize& aBorder,
const mozilla::LogicalSize& aPadding,
ComputeSizeFlags aFlags) override;
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
- virtual nsIAtom* GetType_() const override;
-
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsContainerFrame::IsFrameOfType(aFlags &
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
nsStyleContext* GetAdditionalStyleContext(int32_t aIndex) const override;
void SetAdditionalStyleContext(int32_t aIndex,
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -137,22 +137,16 @@ nsTextControlFrame::DestroyFrom(nsIFrame
NS_ASSERTION(txtCtrl, "Content not a text control element");
txtCtrl->UnbindFromFrame(this);
nsFormControlFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(this), false);
nsContainerFrame::DestroyFrom(aDestructRoot);
}
-nsIAtom*
-nsTextControlFrame::GetType_() const
-{
- return FrameType::TextInput;
-}
-
LogicalSize
nsTextControlFrame::CalcIntrinsicSize(nsRenderingContext* aRenderingContext,
WritingMode aWM,
float aFontSizeInflation) const
{
LogicalSize intrinsicSize(aWM);
// Get leading and the Average/MaxAdvance char width
nscoord lineHeight = 0;
--- a/layout/forms/nsTextControlFrame.h
+++ b/layout/forms/nsTextControlFrame.h
@@ -162,17 +162,16 @@ public:
//==== NSISTATEFULFRAME
NS_IMETHOD SaveState(nsPresState** aState) override;
NS_IMETHOD RestoreState(nsPresState* aState) override;
//=== END NSISTATEFULFRAME
//==== OVERLOAD of nsIFrame
- virtual nsIAtom* GetType_() const override;
/** handler for attribute changes to mContent */
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
nsresult GetText(nsString& aText);
--- a/layout/generic/BRFrame.cpp
+++ b/layout/generic/BRFrame.cpp
@@ -44,17 +44,16 @@ public:
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void AddInlineMinISize(nsRenderingContext *aRenderingContext,
InlineMinISizeData *aData) override;
virtual void AddInlinePrefISize(nsRenderingContext *aRenderingContext,
InlinePrefISizeData *aData) override;
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
- virtual nsIAtom* GetType_() const override;
virtual nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode) const override;
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced |
nsIFrame::eLineParticipant));
}
@@ -204,22 +203,16 @@ BRFrame::GetMinISize(nsRenderingContext
/* virtual */ nscoord
BRFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
{
nscoord result = 0;
DISPLAY_PREF_WIDTH(this, result);
return result;
}
-nsIAtom*
-BRFrame::GetType_() const
-{
- return FrameType::Br;
-}
-
nscoord
BRFrame::GetLogicalBaseline(mozilla::WritingMode aWritingMode) const
{
return mAscent;
}
nsIFrame::ContentOffsets BRFrame::CalcContentOffsetsFromFramePoint(nsPoint aPoint)
{
--- a/layout/generic/BlockReflowInput.cpp
+++ b/layout/generic/BlockReflowInput.cpp
@@ -831,20 +831,20 @@ BlockReflowInput::FlowAndPlaceFloat(nsIF
nsIFrame* prevFrame = nullptr;
while (fc) {
if (fc->mFloat == aFloat) {
break;
}
prevFrame = fc->mFloat;
fc = fc->Next();
}
-
+
if(prevFrame) {
//get the frame type
- if (FrameType::TableWrapper == prevFrame->GetType()) {
+ if (prevFrame->IsTableWrapperFrame()) {
//see if it has "align="
// IE makes a difference between align and he float property
nsIContent* content = prevFrame->GetContent();
if (content) {
// we're interested only if previous frame is align=left
// IE messes things up when "right" (overlapping frames)
if (content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::align,
NS_LITERAL_STRING("left"), eIgnoreCase)) {
--- a/layout/generic/CSSOrderAwareFrameIterator.h
+++ b/layout/generic/CSSOrderAwareFrameIterator.h
@@ -73,24 +73,19 @@ public:
, mArrayIndex(0)
, mItemIndex(0)
, mSkipPlaceholders(aFilter == eSkipPlaceholders)
#ifdef DEBUG
, mContainer(aContainer)
, mListID(aListID)
#endif
{
-#ifdef DEBUG
- {
- const nsIAtom* type = aContainer->GetType();
- MOZ_ASSERT(type == nsGkAtoms::flexContainerFrame ||
- type == nsGkAtoms::gridContainerFrame,
- "Only use this iterator in a container that honors 'order'");
- }
-#endif
+ MOZ_ASSERT(aContainer->IsFlexOrGridContainer(),
+ "Only use this iterator in a container that honors 'order'");
+
size_t count = 0;
bool isOrdered = aState != eKnownUnordered;
if (aState == eUnknownOrder) {
auto maxOrder = std::numeric_limits<int32_t>::min();
for (auto child : mChildren) {
++count;
int32_t order;
@@ -157,17 +152,17 @@ public:
/**
* Return the child index of the current item, placeholders not counted.
* It's forbidden to call this method when the current frame is placeholder.
*/
size_t ItemIndex() const
{
MOZ_ASSERT(!AtEnd());
- MOZ_ASSERT((**this)->GetType() != nsGkAtoms::placeholderFrame,
+ MOZ_ASSERT(!(**this)->IsPlaceholderFrame(),
"MUST not call this when at a placeholder");
MOZ_ASSERT(IsForward() || mItemIndex < *mItemCount,
"Returning an out-of-range mItemIndex...");
return mItemIndex;
}
void SetItemCount(size_t aItemCount)
{
@@ -184,24 +179,24 @@ public:
/**
* Skip over placeholder children.
*/
void SkipPlaceholders()
{
if (mIter.isSome()) {
for (; *mIter != *mIterEnd; ++*mIter) {
nsIFrame* child = **mIter;
- if (child->GetType() != nsGkAtoms::placeholderFrame) {
+ if (!child->IsPlaceholderFrame()) {
return;
}
}
} else {
for (; mArrayIndex < mArray->Length(); ++mArrayIndex) {
nsIFrame* child = (*mArray)[mArrayIndex];
- if (child->GetType() != nsGkAtoms::placeholderFrame) {
+ if (!child->IsPlaceholderFrame()) {
return;
}
}
}
}
bool AtEnd() const
{
@@ -216,18 +211,17 @@ public:
{
#ifdef DEBUG
MOZ_ASSERT(!AtEnd());
nsFrameList list = mContainer->GetChildList(mListID);
MOZ_ASSERT(list.FirstChild() == mChildren.FirstChild() &&
list.LastChild() == mChildren.LastChild(),
"the list of child frames must not change while iterating!");
#endif
- if (mSkipPlaceholders ||
- (**this)->GetType() != nsGkAtoms::placeholderFrame) {
+ if (mSkipPlaceholders || !(**this)->IsPlaceholderFrame()) {
IsForward() ? ++mItemIndex : --mItemIndex;
}
if (mIter.isSome()) {
++*mIter;
} else {
++mArrayIndex;
}
if (mSkipPlaceholders) {
--- a/layout/generic/DetailsFrame.cpp
+++ b/layout/generic/DetailsFrame.cpp
@@ -34,22 +34,16 @@ DetailsFrame::DetailsFrame(nsStyleContex
: nsBlockFrame(aContext, FrameType::Details)
{
}
DetailsFrame::~DetailsFrame()
{
}
-nsIAtom*
-DetailsFrame::GetType_() const
-{
- return FrameType::Details;
-}
-
void
DetailsFrame::SetInitialChildList(ChildListID aListID, nsFrameList& aChildList)
{
#ifdef DEBUG
if (aListID == kPrincipalList) {
CheckValidMainSummary(aChildList);
}
#endif
--- a/layout/generic/DetailsFrame.h
+++ b/layout/generic/DetailsFrame.h
@@ -26,18 +26,16 @@ public:
NS_DECL_FRAMEARENA_HELPERS
NS_DECL_QUERYFRAME_TARGET(DetailsFrame)
NS_DECL_QUERYFRAME
explicit DetailsFrame(nsStyleContext* aContext);
virtual ~DetailsFrame();
- nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("Details"), aResult);
}
#endif
#ifdef DEBUG
--- a/layout/generic/ReflowInput.cpp
+++ b/layout/generic/ReflowInput.cpp
@@ -171,17 +171,17 @@ SizeComputationInput::SizeComputationInp
"We're about to resolve percent margin & padding "
"values against CB inline size, which is incorrect for "
"flex/grid items. "
"Additionally for grid items, this path doesn't handle baseline "
"padding contribution - see SizeComputationInput::InitOffsets");
LogicalSize cbSize(aContainingBlockWritingMode, aContainingBlockISize,
aContainingBlockISize);
ReflowInputFlags flags;
- InitOffsets(aContainingBlockWritingMode, cbSize, mFrame->GetType(), flags);
+ InitOffsets(aContainingBlockWritingMode, cbSize, mFrame->Type(), flags);
}
// Initialize a reflow state for a child frame's reflow. Some state
// is copied from the parent reflow state; the remaining state is
// computed.
ReflowInput::ReflowInput(
nsPresContext* aPresContext,
const ReflowInput& aParentReflowInput,
@@ -511,17 +511,17 @@ void ReflowInput::InitCBReflowInput()
* given reflow state, using its block as a height. (essentially
* returns false for any case in which CalcQuirkContainingBlockHeight
* has a "continue" in its main loop.)
*
* XXX Maybe refactor CalcQuirkContainingBlockHeight so it uses
* this function as well
*/
static bool
-IsQuirkContainingBlockHeight(const ReflowInput* rs, nsIAtom* aFrameType)
+IsQuirkContainingBlockHeight(const ReflowInput* rs, FrameType aFrameType)
{
if (FrameType::Block == aFrameType ||
#ifdef MOZ_XUL
FrameType::XULLabel == aFrameType ||
#endif
FrameType::Scroll == aFrameType) {
// Note: This next condition could change due to a style change,
// but that would cause a style reflow anyway, which means we're ok.
@@ -531,17 +531,17 @@ IsQuirkContainingBlockHeight(const Reflo
}
}
}
return true;
}
void
-ReflowInput::InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameType)
+ReflowInput::InitResizeFlags(nsPresContext* aPresContext, FrameType aFrameType)
{
SetBResize(false);
SetIResize(false);
const WritingMode wm = mWritingMode; // just a shorthand
// We should report that we have a resize in the inline dimension if
// *either* the border-box size or the content-box size in that
// dimension has changed. It might not actually be necessary to do
@@ -737,19 +737,19 @@ ReflowInput::InitResizeFlags(nsPresConte
// If we're the descendant of a table cell that performs special bsize
// reflows and we could be the child that requires them, always set
// the block-axis resize in case this is the first pass before the
// special bsize reflow. However, don't do this if it actually is
// the special bsize reflow, since in that case it will already be
// set correctly above if we need it set.
if (!IsBResize() && mCBReflowInput &&
- (IS_TABLE_CELL(mCBReflowInput->mFrame->GetType()) ||
+ (IS_TABLE_CELL(mCBReflowInput->mFrame->Type()) ||
mCBReflowInput->mFlags.mHeightDependsOnAncestorCell) &&
- !mCBReflowInput->mFlags.mSpecialBSizeReflow &&
+ !mCBReflowInput->mFlags.mSpecialBSizeReflow &&
dependsOnCBBSize) {
SetBResize(true);
mFlags.mHeightDependsOnAncestorCell = true;
}
// Set NS_FRAME_CONTAINS_RELATIVE_BSIZE if it's needed.
// It would be nice to check that |ComputedBSize != NS_AUTOHEIGHT|
@@ -778,17 +778,17 @@ ReflowInput::InitResizeFlags(nsPresConte
hitCBReflowInput = true;
}
// XXX What about orthogonal flows? It doesn't make sense to
// keep propagating this bit across an orthogonal boundary,
// where the meaning of BSize changes. Bug 1175517.
} while (!hitCBReflowInput ||
(eCompatibility_NavQuirks == aPresContext->CompatibilityMode() &&
- !IsQuirkContainingBlockHeight(rs, rs->mFrame->GetType())));
+ !IsQuirkContainingBlockHeight(rs, rs->mFrame->Type())));
// Note: We actually don't need to set the
// NS_FRAME_CONTAINS_RELATIVE_BSIZE bit for the cases
// where we hit the early break statements in
// CalcQuirkContainingBlockHeight. But it doesn't hurt
// us to set the bit in these cases.
}
if (mFrame->GetStateBits() & NS_FRAME_IS_DIRTY) {
@@ -805,17 +805,17 @@ ReflowInput::GetContainingBlockContentIS
return 0;
}
return mCBReflowInput->GetWritingMode().IsOrthogonalTo(aWritingMode)
? mCBReflowInput->ComputedBSize()
: mCBReflowInput->ComputedISize();
}
void
-ReflowInput::InitFrameType(nsIAtom* aFrameType)
+ReflowInput::InitFrameType(FrameType aFrameType)
{
const nsStyleDisplay *disp = mStyleDisplay;
nsCSSFrameType frameType;
// Section 9.7 of the CSS2 spec indicates that absolute position
// takes precedence over float which takes precedence over display.
// XXXldb nsRuleNode::ComputeDisplayData should take care of this, right?
// Make sure the frame was actually moved out of the flow, and don't
@@ -1115,17 +1115,17 @@ struct nsHypotheticalPosition {
// offset from inline-start edge of containing block (which is a padding edge)
nscoord mIStart;
// offset from block-start edge of containing block (which is a padding edge)
nscoord mBStart;
WritingMode mWritingMode;
};
static bool
-GetIntrinsicSizeFor(nsIFrame* aFrame, nsSize& aIntrinsicSize, nsIAtom* aFrameType)
+GetIntrinsicSizeFor(nsIFrame* aFrame, nsSize& aIntrinsicSize, FrameType aFrameType)
{
// See if it is an image frame
bool success = false;
// Currently the only type of replaced frame that we can get the intrinsic
// size for is an image frame
// XXX We should add back the GetReflowOutput() function and one of the
// things should be the intrinsic size...
@@ -1252,17 +1252,17 @@ static bool AreAllEarlierInFlowFramesEmp
// |containingBlock| is the nearest block container of the placeholder frame,
// which may be different from the absolute containing block.
void
ReflowInput::CalculateHypotheticalPosition
(nsPresContext* aPresContext,
nsIFrame* aPlaceholderFrame,
const ReflowInput* cbrs,
nsHypotheticalPosition& aHypotheticalPos,
- nsIAtom* aFrameType) const
+ FrameType aFrameType) const
{
NS_ASSERTION(mStyleDisplay->mOriginalDisplay != StyleDisplay::None,
"mOriginalDisplay has not been properly initialized");
// Find the nearest containing block frame to the placeholder frame,
// and its inline-start edge and width.
nscoord blockIStartContentEdge;
// Dummy writing mode for blockContentSize, will be changed as needed by
@@ -1549,19 +1549,19 @@ ReflowInput::CalculateHypotheticalPositi
aHypotheticalPos.mWritingMode = cbwm;
} else {
aHypotheticalPos.mWritingMode = wm;
}
}
void
ReflowInput::InitAbsoluteConstraints(nsPresContext* aPresContext,
- const ReflowInput* cbrs,
- const LogicalSize& aCBSize,
- nsIAtom* aFrameType)
+ const ReflowInput* cbrs,
+ const LogicalSize& aCBSize,
+ FrameType aFrameType)
{
WritingMode wm = GetWritingMode();
WritingMode cbwm = cbrs->GetWritingMode();
NS_PRECONDITION(aCBSize.BSize(cbwm) != NS_AUTOHEIGHT,
"containing block bsize must be constrained");
NS_ASSERTION(aFrameType != FrameType::Table,
"InitAbsoluteConstraints should not be called on table frames");
@@ -1952,22 +1952,22 @@ static nscoord
CalcQuirkContainingBlockHeight(const ReflowInput* aCBReflowInput)
{
const ReflowInput* firstAncestorRI = nullptr; // a candidate for html frame
const ReflowInput* secondAncestorRI = nullptr; // a candidate for body frame
// initialize the default to NS_AUTOHEIGHT as this is the containings block
// computed height when this function is called. It is possible that we
// don't alter this height especially if we are restricted to one level
- nscoord result = NS_AUTOHEIGHT;
-
+ nscoord result = NS_AUTOHEIGHT;
+
const ReflowInput* rs = aCBReflowInput;
for (; rs; rs = rs->mParentReflowInput) {
- nsIAtom* frameType = rs->mFrame->GetType();
- // if the ancestor is auto height then skip it and continue up if it
+ FrameType frameType = rs->mFrame->Type();
+ // if the ancestor is auto height then skip it and continue up if it
// is the first block frame and possibly the body/html
if (FrameType::Block == frameType ||
#ifdef MOZ_XUL
FrameType::XULLabel == frameType ||
#endif
FrameType::Scroll == frameType) {
secondAncestorRI = firstAncestorRI;
@@ -2030,18 +2030,17 @@ CalcQuirkContainingBlockHeight(const Ref
}
}
#endif
}
// if we got to the html frame (a block child of the canvas) ...
else if (FrameType::Block == frameType &&
rs->mParentReflowInput &&
- FrameType::Canvas ==
- rs->mParentReflowInput->mFrame->GetType()) {
+ rs->mParentReflowInput->mFrame->IsCanvasFrame()) {
// ... then subtract out margin/border/padding for the BODY element
result -= GetBlockMarginBorderPadding(secondAncestorRI);
}
break;
}
// Make sure not to return a negative height here!
return std::max(result, 0);
@@ -2157,20 +2156,20 @@ OffsetPercentBasis(const nsIFrame* aF
return offsetPercentBasis;
}
// XXX refactor this code to have methods for each set of properties
// we are computing: width,height,line-height; margin; offsets
void
ReflowInput::InitConstraints(nsPresContext* aPresContext,
- const LogicalSize& aContainingBlockSize,
- const nsMargin* aBorder,
- const nsMargin* aPadding,
- nsIAtom* aFrameType)
+ const LogicalSize& aContainingBlockSize,
+ const nsMargin* aBorder,
+ const nsMargin* aPadding,
+ FrameType aFrameType)
{
WritingMode wm = GetWritingMode();
DISPLAY_INIT_CONSTRAINTS(mFrame, this,
aContainingBlockSize.ISize(wm),
aContainingBlockSize.BSize(wm),
aBorder, aPadding);
// If this is a reflow root, then set the computed width and
@@ -2209,23 +2208,23 @@ ReflowInput::InitConstraints(nsPresConte
// If we weren't given a containing block width and height, then
// compute one
LogicalSize cbSize = (aContainingBlockSize == LogicalSize(wm, -1, -1))
? ComputeContainingBlockRectangle(aPresContext, cbrs)
: aContainingBlockSize;
// See if the containing block height is based on the size of its
// content
- nsIAtom* fType;
+ FrameType fType;
if (NS_AUTOHEIGHT == cbSize.BSize(wm)) {
// See if the containing block is a cell frame which needs
// to use the mComputedHeight of the cell instead of what the cell block passed in.
// XXX It seems like this could lead to bugs with min-height and friends
if (cbrs->mParentReflowInput) {
- fType = cbrs->mFrame->GetType();
+ fType = cbrs->mFrame->Type();
if (IS_TABLE_CELL(fType)) {
// use the cell's computed block size
cbSize.BSize(wm) = cbrs->ComputedSize(wm).BSize(wm);
}
}
}
// XXX Might need to also pass the CB height (not width) for page boxes,
@@ -2396,27 +2395,25 @@ ReflowInput::InitConstraints(nsPresConte
ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eShrinkWrap);
}
if (mFlags.mUseAutoBSize) {
computeSizeFlags =
ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eUseAutoBSize);
}
nsIFrame* alignCB = mFrame->GetParent();
- nsIAtom* alignCBType = alignCB ? alignCB->GetType() : nullptr;
- if (alignCBType == FrameType::TableWrapper &&
+ if (alignCB &&
+ alignCB->IsTableWrapperFrame() &&
alignCB->GetParent()) {
- auto parentCBType = alignCB->GetParent()->GetType();
// XXX grid-specific for now; maybe remove this check after we address bug 799725
- if (parentCBType == FrameType::GridContainer) {
+ if (alignCB->GetParent()->IsGridContainerFrame()) {
alignCB = alignCB->GetParent();
- alignCBType = parentCBType;
}
}
- if (alignCBType == FrameType::GridContainer) {
+ if (alignCB->IsGridContainerFrame()) {
// Shrink-wrap grid items that will be aligned (rather than stretched)
// in its inline axis.
auto inlineAxisAlignment =
wm.IsOrthogonalTo(cbwm)
? mStylePosition->UsedAlignSelf(alignCB->StyleContext())
: mStylePosition->UsedJustifySelf(alignCB->StyleContext());
if ((inlineAxisAlignment != NS_STYLE_ALIGN_STRETCH &&
inlineAxisAlignment != NS_STYLE_ALIGN_NORMAL) ||
@@ -2435,17 +2432,17 @@ ReflowInput::InitConstraints(nsPresConte
(aFrameType == FrameType::Scroll &&
mFrame->GetContentInsertionFrame()->IsLegendFrame()) ||
(mCBReflowInput &&
mCBReflowInput->GetWritingMode().IsOrthogonalTo(mWritingMode)))) {
computeSizeFlags =
ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eShrinkWrap);
}
- if (alignCBType == FrameType::FlexContainer) {
+ if (alignCB && alignCB->IsFlexContainerFrame()) {
computeSizeFlags =
ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eShrinkWrap);
// If we're inside of a flex container that needs to measure our
// auto height, pass that information along to ComputeSize().
if (mFlags.mIsFlexContainerMeasuringHeight) {
computeSizeFlags =
ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eUseAutoBSize);
@@ -2477,18 +2474,19 @@ ReflowInput::InitConstraints(nsPresConte
NS_ASSERTION(ComputedBSize() == NS_UNCONSTRAINEDSIZE ||
ComputedBSize() >= 0, "Bogus block-size");
// Exclude inline tables, side captions, flex and grid items from block
// margin calculations.
if (isBlock &&
!IsSideCaption(mFrame, mStyleDisplay, cbwm) &&
mStyleDisplay->mDisplay != StyleDisplay::InlineTable &&
- alignCBType != FrameType::FlexContainer &&
- alignCBType != FrameType::GridContainer) {
+ (!alignCB ||
+ (!alignCB->IsFlexContainerFrame() &&
+ !alignCB->IsGridContainerFrame()))) {
CalculateBlockSideMargins(aFrameType);
}
}
}
}
static void
UpdateProp(FrameProperties& aProps,
@@ -2505,21 +2503,21 @@ UpdateProp(FrameProperties& aProps,
}
} else {
aProps.Delete(aProperty);
}
}
void
SizeComputationInput::InitOffsets(WritingMode aWM,
- const LogicalSize& aPercentBasis,
- nsIAtom* aFrameType,
- ReflowInputFlags aFlags,
- const nsMargin* aBorder,
- const nsMargin* aPadding)
+ const LogicalSize& aPercentBasis,
+ FrameType aFrameType,
+ ReflowInputFlags aFlags,
+ const nsMargin* aBorder,
+ const nsMargin* aPadding)
{
DISPLAY_INIT_OFFSETS(mFrame, this, aPercentBasis, aBorder, aPadding);
// Since we are in reflow, we don't need to store these properties anymore
// unless they are dependent on width, in which case we store the new value.
nsPresContext *presContext = mFrame->PresContext();
FrameProperties props(presContext->PropertyTable(), mFrame);
props.Delete(nsIFrame::UsedBorderProperty());
@@ -2649,17 +2647,17 @@ SizeComputationInput::InitOffsets(Writin
// This code enforces section 10.3.3 of the CSS2 spec for this formula:
//
// 'margin-left' + 'border-left-width' + 'padding-left' + 'width' +
// 'padding-right' + 'border-right-width' + 'margin-right'
// = width of containing block
//
// Note: the width unit is not auto when this is called
void
-ReflowInput::CalculateBlockSideMargins(nsIAtom* aFrameType)
+ReflowInput::CalculateBlockSideMargins(FrameType aFrameType)
{
// Calculations here are done in the containing block's writing mode,
// which is where margins will eventually be applied: we're calculating
// margins that will be used by the container in its inline direction,
// which in the case of an orthogonal contained block will correspond to
// the block direction of this reflow state. So in the orthogonal-flow
// case, "CalculateBlock*Side*Margins" will actually end up adjusting
// the BStart/BEnd margins; those are the "sides" of the block from its
@@ -2924,18 +2922,18 @@ SizeComputationInput::ComputeMargin(Writ
SetComputedLogicalMargin(m);
}
return isCBDependent;
}
bool
SizeComputationInput::ComputePadding(WritingMode aWM,
- const LogicalSize& aPercentBasis,
- nsIAtom* aFrameType)
+ const LogicalSize& aPercentBasis,
+ FrameType aFrameType)
{
// If style can provide us the padding directly, then use it.
const nsStylePadding *stylePadding = mFrame->StylePadding();
bool isCBDependent = !stylePadding->GetPadding(ComputedPhysicalPadding());
// a table row/col group, row/col doesn't have padding
// XXXldb Neither do border-collapse tables.
if (FrameType::TableRowGroup == aFrameType ||
FrameType::TableColGroup == aFrameType ||
--- a/layout/generic/ReflowInput.h
+++ b/layout/generic/ReflowInput.h
@@ -288,23 +288,23 @@ private:
* The block size is usually the containing block inline-size, per
* CSS21 sec 8.3 (read in conjunction with CSS Writing Modes sec
* 7.2), but may be the containing block block-size, e.g. in CSS3
* Flexbox and Grid.
* @return true if the padding is dependent on the containing block size.
*/
bool ComputePadding(mozilla::WritingMode aWM,
const mozilla::LogicalSize& aPercentBasis,
- nsIAtom* aFrameType);
+ FrameType aFrameType);
protected:
void InitOffsets(mozilla::WritingMode aWM,
const mozilla::LogicalSize& aPercentBasis,
- nsIAtom* aFrameType,
+ FrameType aFrameType,
ReflowInputFlags aFlags,
const nsMargin* aBorder = nullptr,
const nsMargin* aPadding = nullptr);
/*
* Convert nsStyleCoord to nscoord when percentages depend on the
* inline size of the containing block, and enumerated values are for
* inline size, min-inline-size, or max-inline-size. Does not handle
@@ -961,25 +961,25 @@ public:
static void* DisplayInitFrameTypeEnter(nsIFrame* aFrame,
ReflowInput* aState);
static void DisplayInitFrameTypeExit(nsIFrame* aFrame,
ReflowInput* aState,
void* aValue);
#endif
protected:
- void InitFrameType(nsIAtom* aFrameType);
+ void InitFrameType(FrameType aFrameType);
void InitCBReflowInput();
- void InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameType);
+ void InitResizeFlags(nsPresContext* aPresContext, FrameType aFrameType);
void InitConstraints(nsPresContext* aPresContext,
const mozilla::LogicalSize& aContainingBlockSize,
const nsMargin* aBorder,
const nsMargin* aPadding,
- nsIAtom* aFrameType);
+ FrameType aFrameType);
// Returns the nearest containing block or block frame (whether or not
// it is a containing block) for the specified frame. Also returns
// the inline-start edge and logical size of the containing block's
// content area.
// These are returned in the coordinate space of the containing block.
nsIFrame* GetHypotheticalBoxContainer(nsIFrame* aFrame,
nscoord& aCBIStartEdge,
@@ -989,34 +989,34 @@ protected:
// (for a position:fixed/absolute element) would have been placed if it were
// positioned statically. The hypothetical box position will have a writing
// mode with the same block direction as the absolute containing block
// (cbrs->frame), though it may differ in inline direction.
void CalculateHypotheticalPosition(nsPresContext* aPresContext,
nsIFrame* aPlaceholderFrame,
const ReflowInput* cbrs,
nsHypotheticalPosition& aHypotheticalPos,
- nsIAtom* aFrameType) const;
+ FrameType aFrameType) const;
void InitAbsoluteConstraints(nsPresContext* aPresContext,
const ReflowInput* cbrs,
const mozilla::LogicalSize& aContainingBlockSize,
- nsIAtom* aFrameType);
+ FrameType aFrameType);
// Calculates the computed values for the 'min-Width', 'max-Width',
// 'min-Height', and 'max-Height' properties, and stores them in the assorted
// data members
void ComputeMinMaxValues(const mozilla::LogicalSize& aContainingBlockSize);
// aInsideBoxSizing returns the part of the padding, border, and margin
// in the aAxis dimension that goes inside the edge given by box-sizing;
// aOutsideBoxSizing returns the rest.
void CalculateBorderPaddingMargin(mozilla::LogicalAxis aAxis,
nscoord aContainingBlockSize,
nscoord* aInsideBoxSizing,
nscoord* aOutsideBoxSizing) const;
- void CalculateBlockSideMargins(nsIAtom* aFrameType);
+ void CalculateBlockSideMargins(FrameType aFrameType);
};
} // namespace mozilla
#endif // mozilla_ReflowInput_h
--- a/layout/generic/RubyUtils.cpp
+++ b/layout/generic/RubyUtils.cpp
@@ -84,17 +84,17 @@ RubySegmentEnumerator::RubySegmentEnumer
mBaseContainer = static_cast<nsRubyBaseContainerFrame*>(frame);
}
void
RubySegmentEnumerator::Next()
{
MOZ_ASSERT(mBaseContainer);
nsIFrame* frame = mBaseContainer->GetNextSibling();
- while (frame && frame->GetType() != FrameType::RubyBaseContainer) {
+ while (frame && !frame->IsRubyBaseContainerFrame()) {
frame = frame->GetNextSibling();
}
mBaseContainer = static_cast<nsRubyBaseContainerFrame*>(frame);
}
RubyColumnEnumerator::RubyColumnEnumerator(
nsRubyBaseContainerFrame* aBaseContainer,
const AutoRubyTextContainerArray& aTextContainers)
@@ -143,17 +143,17 @@ RubyColumnEnumerator::Next()
// If we've got intra-level whitespace frames at some levels in the
// current ruby column, we "faked" an anonymous box for all other
// levels for this column. So when we advance off this column, we
// don't advance any of the frames in those levels, because we're
// just advancing across the "fake" frames.
if (frame && (!mAtIntraLevelWhitespace ||
frame->IsIntraLevelWhitespace())) {
nsIFrame* nextSibling = frame->GetNextSibling();
- MOZ_ASSERT(!nextSibling || nextSibling->GetType() == frame->GetType(),
+ MOZ_ASSERT(!nextSibling || nextSibling->Type() == frame->Type(),
"Frame type should be identical among a level");
mFrames[i] = frame = static_cast<nsRubyContentFrame*>(nextSibling);
if (!advancingToIntraLevelWhitespace &&
frame && frame->IsIntraLevelWhitespace()) {
advancingToIntraLevelWhitespace = true;
}
}
}
--- a/layout/generic/RubyUtils.h
+++ b/layout/generic/RubyUtils.h
@@ -50,37 +50,37 @@ namespace mozilla {
* one of its ruby text containers does.
* 3. If a ruby text container has a larger final isize, its children
* must not have.
*/
class RubyUtils
{
public:
- static inline bool IsRubyContentBox(nsIAtom* aFrameType)
+ static inline bool IsRubyContentBox(FrameType aFrameType)
{
- return aFrameType == nsGkAtoms::rubyBaseFrame ||
- aFrameType == nsGkAtoms::rubyTextFrame;
+ return aFrameType == FrameType::RubyBase ||
+ aFrameType == FrameType::RubyText;
}
- static inline bool IsRubyContainerBox(nsIAtom* aFrameType)
+ static inline bool IsRubyContainerBox(FrameType aFrameType)
{
- return aFrameType == nsGkAtoms::rubyBaseContainerFrame ||
- aFrameType == nsGkAtoms::rubyTextContainerFrame;
+ return aFrameType == FrameType::RubyBaseContainer ||
+ aFrameType == FrameType::RubyTextContainer;
}
- static inline bool IsRubyBox(nsIAtom* aFrameType)
+ static inline bool IsRubyBox(FrameType aFrameType)
{
- return aFrameType == nsGkAtoms::rubyFrame ||
+ return aFrameType == FrameType::Ruby ||
IsRubyContentBox(aFrameType) || IsRubyContainerBox(aFrameType);
}
static inline bool IsExpandableRubyBox(nsIFrame* aFrame)
{
- nsIAtom* type = aFrame->GetType();
+ FrameType type = aFrame->Type();
return IsRubyContentBox(type) || IsRubyContainerBox(type);
}
static inline bool IsRubyPseudo(nsIAtom* aPseudo)
{
return aPseudo == nsCSSAnonBoxes::ruby ||
aPseudo == nsCSSAnonBoxes::rubyBase ||
aPseudo == nsCSSAnonBoxes::rubyText ||
--- a/layout/generic/TextOverflow.cpp
+++ b/layout/generic/TextOverflow.cpp
@@ -64,17 +64,17 @@ GetSelfOrNearestBlock(nsIFrame* aFrame)
return nsLayoutUtils::GetAsBlock(aFrame) ? aFrame :
nsLayoutUtils::FindNearestBlockAncestor(aFrame);
}
// Return true if the frame is an atomic inline-level element.
// It's not supposed to be called for block frames since we never
// process block descendants for text-overflow.
static bool
-IsAtomicElement(nsIFrame* aFrame, const nsIAtom* aFrameType)
+IsAtomicElement(nsIFrame* aFrame, FrameType aFrameType)
{
NS_PRECONDITION(!nsLayoutUtils::GetAsBlock(aFrame) ||
!aFrame->IsBlockOutside(),
"unexpected block frame");
NS_PRECONDITION(aFrameType != FrameType::Placeholder,
"unexpected placeholder frame");
return !aFrame->IsFrameOfType(nsIFrame::eLineParticipant);
}
@@ -94,18 +94,17 @@ IsFullyClipped(nsTextFrame* aFrame, nsco
static bool
IsInlineAxisOverflowVisible(nsIFrame* aFrame)
{
NS_PRECONDITION(nsLayoutUtils::GetAsBlock(aFrame) != nullptr,
"expected a block frame");
nsIFrame* f = aFrame;
- while (f && f->StyleContext()->GetPseudo() &&
- f->GetType() != FrameType::Scroll) {
+ while (f && f->StyleContext()->GetPseudo() && !f->IsScrollFrame()) {
f = f->GetParent();
}
if (!f) {
return true;
}
auto overflow = aFrame->GetWritingMode().IsVertical() ?
f->StyleDisplay()->mOverflowY : f->StyleDisplay()->mOverflowX;
return overflow == NS_STYLE_OVERFLOW_VISIBLE;
@@ -386,17 +385,17 @@ TextOverflow::ExamineFrameSubtree(nsIFra
aFramesToHide, aAlignmentEdges,
aFoundVisibleTextOrAtomic,
aClippedMarkerEdges);
}
}
void
TextOverflow::AnalyzeMarkerEdges(nsIFrame* aFrame,
- const nsIAtom* aFrameType,
+ FrameType aFrameType,
const LogicalRect& aInsideMarkersArea,
FrameHashtable* aFramesToHide,
AlignmentEdges* aAlignmentEdges,
bool* aFoundVisibleTextOrAtomic,
InnerClipEdges* aClippedMarkerEdges)
{
LogicalRect borderRect(mBlockWM,
nsRect(aFrame->GetOffsetTo(mBlock),
--- a/layout/generic/TextOverflow.h
+++ b/layout/generic/TextOverflow.h
@@ -170,17 +170,17 @@ class TextOverflow {
* inline-level frames that are inside the area between the markers
* inside aInsideMarkersArea
* @param aFoundVisibleTextOrAtomic is set to true if a text or atomic
* inline-level frame is visible between the marker edges
* @param aClippedMarkerEdges the innermost edges of all text and atomic
* inline-level frames that are clipped by the current marker width
*/
void AnalyzeMarkerEdges(nsIFrame* aFrame,
- const nsIAtom* aFrameType,
+ FrameType aFrameType,
const LogicalRect& aInsideMarkersArea,
FrameHashtable* aFramesToHide,
AlignmentEdges* aAlignmentEdges,
bool* aFoundVisibleTextOrAtomic,
InnerClipEdges* aClippedMarkerEdges);
/**
* Clip or remove items given the final marker edges. ("clip" here just means
--- a/layout/generic/ViewportFrame.cpp
+++ b/layout/generic/ViewportFrame.cpp
@@ -410,21 +410,15 @@ ViewportFrame::ComputeCustomOverflow(nsO
PresContext()->PresShell()->GetRootScrollFrameAsScrollable();
if (rootScrollFrame && !rootScrollFrame->IsIgnoringViewportClipping()) {
return false;
}
return nsContainerFrame::ComputeCustomOverflow(aOverflowAreas);
}
-nsIAtom*
-ViewportFrame::GetType_() const
-{
- return FrameType::Viewport;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
ViewportFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("Viewport"), aResult);
}
#endif
--- a/layout/generic/ViewportFrame.h
+++ b/layout/generic/ViewportFrame.h
@@ -58,27 +58,20 @@ public:
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
void BuildDisplayListForTopLayer(nsDisplayListBuilder* aBuilder,
nsDisplayList* aList);
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
- virtual void Reflow(nsPresContext* aPresContext,
- ReflowOutput& aDesiredSize,
+ virtual void Reflow(nsPresContext* aPresContext,
+ ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
- nsReflowStatus& aStatus) override;
-
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::viewportFrame
- */
- virtual nsIAtom* GetType_() const override;
+ nsReflowStatus& aStatus) override;
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
/**
* Adjust aReflowInput to account for scrollbars and pres shell
* GetScrollPositionClampingScrollPortSizeSet and
* GetContentDocumentFixedPositionMargins adjustments.
* @return the rect to use as containing block rect
--- a/layout/generic/nsAbsoluteContainingBlock.cpp
+++ b/layout/generic/nsAbsoluteContainingBlock.cpp
@@ -681,17 +681,17 @@ nsAbsoluteContainingBlock::ReflowAbsolut
}
if (kidReflowInput.mFlags.mBOffsetsNeedCSSAlign) {
margin.BStart(outerWM) = margin.BEnd(outerWM) = 0;
}
bool constrainBSize = (aReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE)
&& (aFlags & AbsPosReflowFlags::eConstrainHeight)
// Don't split if told not to (e.g. for fixed frames)
- && (aDelegatingFrame->GetType() != FrameType::Inline)
+ && !aDelegatingFrame->IsInlineFrame()
//XXX we don't handle splitting frames for inline absolute containing blocks yet
&& (aKidFrame->GetLogicalRect(aContainingBlock.Size()).BStart(wm) <=
aReflowInput.AvailableBSize());
// Don't split things below the fold. (Ideally we shouldn't *have*
// anything totally below the fold, but we can't position frames
// across next-in-flow breaks yet.
if (constrainBSize) {
kidReflowInput.AvailableBSize() =
--- a/layout/generic/nsBackdropFrame.cpp
+++ b/layout/generic/nsBackdropFrame.cpp
@@ -9,22 +9,16 @@
#include "nsBackdropFrame.h"
#include "nsDisplayList.h"
using namespace mozilla;
NS_IMPL_FRAMEARENA_HELPERS(nsBackdropFrame)
-/* virtual */ nsIAtom*
-nsBackdropFrame::GetType_() const
-{
- return FrameType::Backdrop;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
nsBackdropFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("Backdrop"), aResult);
}
#endif
--- a/layout/generic/nsBackdropFrame.h
+++ b/layout/generic/nsBackdropFrame.h
@@ -15,18 +15,16 @@ class nsBackdropFrame final : public nsF
{
public:
NS_DECL_FRAMEARENA_HELPERS
explicit nsBackdropFrame(nsStyleContext* aContext)
: nsFrame(aContext, FrameType::Backdrop)
{}
- // nsIFrame overrides
- virtual nsIAtom* GetType_() const override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
virtual nsStyleContext*
GetParentStyleContext(nsIFrame** aProviderFrame) const override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -455,22 +455,16 @@ nsFrameState
nsBlockFrame::GetDebugStateBits() const
{
// We don't want to include our cursor flag in the bits the
// regression tester looks at
return nsContainerFrame::GetDebugStateBits() & ~NS_BLOCK_HAS_LINE_CURSOR;
}
#endif
-nsIAtom*
-nsBlockFrame::GetType_() const
-{
- return FrameType::Block;
-}
-
void
nsBlockFrame::InvalidateFrame(uint32_t aDisplayItemKey)
{
if (nsSVGUtils::IsInSVGTextSubtree(this)) {
NS_ASSERTION(GetParent()->IsSVGTextFrame(),
"unexpected block frame in SVG text");
GetParent()->InvalidateFrame();
return;
@@ -1016,34 +1010,34 @@ CalculateContainingBlockSizeForAbsolutes
// Containing block is relative to the padding edge
const LogicalMargin& border =
LogicalMargin(aWM, aReflowInput.ComputedPhysicalBorderPadding() -
aReflowInput.ComputedPhysicalPadding());
cbSize.ISize(aWM) -= border.IStartEnd(aWM);
cbSize.BSize(aWM) -= border.BStartEnd(aWM);
if (frame->GetParent()->GetContent() == frame->GetContent() &&
- frame->GetParent()->GetType() != FrameType::Canvas) {
+ !frame->GetParent()->IsCanvasFrame()) {
// We are a wrapped frame for the content (and the wrapper is not the
// canvas frame, whose size is not meaningful here).
// Use the container's dimensions, if they have been precomputed.
// XXX This is a hack! We really should be waiting until the outermost
// frame is fully reflowed and using the resulting dimensions, even
// if they're intrinsic.
// In fact we should be attaching absolute children to the outermost
// frame and not always sticking them in block frames.
// First, find the reflow state for the outermost frame for this
// content, except for fieldsets where the inner anonymous frame has
// the correct padding area with the legend taken into account.
const ReflowInput* aLastRI = &aReflowInput;
const ReflowInput* lastButOneRI = &aReflowInput;
while (aLastRI->mParentReflowInput &&
aLastRI->mParentReflowInput->mFrame->GetContent() == frame->GetContent() &&
- aLastRI->mParentReflowInput->mFrame->GetType() != FrameType::FieldSet) {
+ !aLastRI->mParentReflowInput->mFrame->IsFieldSetFrame()) {
lastButOneRI = aLastRI;
aLastRI = aLastRI->mParentReflowInput;
}
if (aLastRI != &aReflowInput) {
// Scrollbars need to be specifically excluded, if present, because they are outside the
// padding-edge. We need better APIs for getting the various boxes from a frame.
nsIScrollableFrame* scrollFrame = do_QueryFrame(aLastRI->mFrame);
nsMargin scrollbars(0,0,0,0);
@@ -1653,17 +1647,17 @@ nsBlockFrame::ComputeFinalSize(const Ref
// block-end margin of any floated elements; e.g., inside a table cell.
nscoord floatHeight =
aState.ClearFloats(blockEndEdgeOfChildren, StyleClear::Both,
nullptr, nsFloatManager::DONT_CLEAR_PUSHED_FLOATS);
blockEndEdgeOfChildren = std::max(blockEndEdgeOfChildren, floatHeight);
}
if (NS_UNCONSTRAINEDSIZE != aReflowInput.ComputedBSize()
- && (GetParent()->GetType() != FrameType::ColumnSet ||
+ && (!GetParent()->IsColumnSetFrame() ||
aReflowInput.mParentReflowInput->AvailableBSize() == NS_UNCONSTRAINEDSIZE)) {
ComputeFinalBSize(aReflowInput, &aState.mReflowStatus,
aState.mBCoord + nonCarriedOutBDirMargin,
borderPadding, finalSize, aState.mConsumedBSize);
if (!aState.mReflowStatus.IsComplete()) {
// Use the current height; continuations will take up the rest.
// Do extend the height to at least consume the available
// height, otherwise our left/right borders (for example) won't
@@ -3081,17 +3075,17 @@ nsBlockFrame::AttributeChanged(int32_t
const nsStyleDisplay* styleDisplay = StyleDisplay();
if (mozilla::StyleDisplay::ListItem == styleDisplay->mDisplay) {
// Search for the closest ancestor that's a block frame. We
// make the assumption that all related list items share a
// common block/grid/flex ancestor.
// XXXldb I think that's a bad assumption.
nsContainerFrame* ancestor = GetParent();
for (; ancestor; ancestor = ancestor->GetParent()) {
- auto frameType = ancestor->GetType();
+ auto frameType = ancestor->Type();
if (frameType == FrameType::Block ||
frameType == FrameType::FlexContainer ||
frameType == FrameType::GridContainer) {
break;
}
}
// Tell the ancestor to renumber list items within itself.
if (ancestor) {
@@ -4319,17 +4313,17 @@ nsBlockFrame::ReflowInlineFrame(BlockRef
if (!aLineLayout.GetLineEndsInBR()) {
aLine->SetLineWrapped(true);
}
// If we just ended a first-letter frame or reflowed a placeholder then
// don't split the line and don't stop the line reflow...
// But if we are going to stop anyways we'd better split the line.
if ((!frameReflowStatus.FirstLetterComplete() &&
- FrameType::Placeholder != aFrame->GetType()) ||
+ !aFrame->IsPlaceholderFrame()) ||
*aLineReflowStatus == LineReflowStatus::Stop) {
// Split line after the current frame
*aLineReflowStatus = LineReflowStatus::Stop;
SplitLine(aState, aLineLayout, aLine, aFrame->GetNextSibling(), aLineReflowStatus);
}
}
}
@@ -5455,17 +5449,17 @@ nsBlockFrame::AddFrames(nsFrameList& aFr
frames->InsertFrames(nullptr, aPrevSibling, aFrameList);
// Walk through the new frames being added and update the line data
// structures to fit.
for (nsFrameList::Enumerator e(newFrames); !e.AtEnd(); e.Next()) {
nsIFrame* newFrame = e.get();
NS_ASSERTION(!aPrevSibling || aPrevSibling->GetNextSibling() == newFrame,
"Unexpected aPrevSibling");
- NS_ASSERTION(newFrame->GetType() != FrameType::Placeholder ||
+ NS_ASSERTION(!newFrame->IsPlaceholderFrame() ||
(!newFrame->IsAbsolutelyPositioned() &&
!newFrame->IsFloating()),
"Placeholders should not float or be positioned");
bool isBlock = newFrame->IsBlockOutside();
// If the frame is a block frame, or if there is no previous line or if the
// previous line is a block line we need to make a new line. We also make
@@ -7021,19 +7015,19 @@ nsBlockFrame::SetInitialChildList(ChildL
bool haveFirstLetterStyle =
(!pseudo ||
(pseudo == nsCSSAnonBoxes::cellContent &&
GetParent()->StyleContext()->GetPseudo() == nullptr) ||
pseudo == nsCSSAnonBoxes::fieldsetContent ||
pseudo == nsCSSAnonBoxes::buttonContent ||
pseudo == nsCSSAnonBoxes::columnContent ||
(pseudo == nsCSSAnonBoxes::scrolledContent &&
- GetParent()->GetType() != FrameType::ListControl) ||
+ !GetParent()->IsListControlFrame()) ||
pseudo == nsCSSAnonBoxes::mozSVGText) &&
- GetType() != FrameType::ComboboxControl &&
+ !IsComboboxControlFrame() &&
!IsFrameOfType(eMathML) &&
RefPtr<nsStyleContext>(GetFirstLetterStyle(PresContext())) != nullptr;
NS_ASSERTION(haveFirstLetterStyle ==
((mState & NS_BLOCK_HAS_FIRST_LETTER_STYLE) != 0),
"NS_BLOCK_HAS_FIRST_LETTER_STYLE state out of sync");
#endif
AddFrames(aChildList, nullptr);
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -136,17 +136,16 @@ public:
nscoord* aBaseline) const override;
nscoord GetCaretBaseline() const override;
void DestroyFrom(nsIFrame* aDestructRoot) override;
nsSplittableType GetSplittableType() const override;
bool IsFloatContainingBlock() const override;
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
- nsIAtom* GetType_() const override;
bool IsFrameOfType(uint32_t aFlags) const override
{
return nsContainerFrame::IsFrameOfType(aFlags &
~(nsIFrame::eCanContainOverflowContainers |
nsIFrame::eBlockFrame));
}
void InvalidateFrame(uint32_t aDisplayItemKey = 0) override;
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -80,22 +80,16 @@ nsBulletFrame::DestroyFrom(nsIFrame* aDe
#ifdef DEBUG_FRAME_DUMP
nsresult
nsBulletFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("Bullet"), aResult);
}
#endif
-nsIAtom*
-nsBulletFrame::GetType_() const
-{
- return FrameType::Bullet;
-}
-
bool
nsBulletFrame::IsEmpty()
{
return IsSelfEmpty();
}
bool
nsBulletFrame::IsSelfEmpty()
--- a/layout/generic/nsBulletFrame.h
+++ b/layout/generic/nsBulletFrame.h
@@ -68,17 +68,16 @@ public:
NS_IMETHOD BlockOnload(imgIRequest* aRequest);
NS_IMETHOD UnblockOnload(imgIRequest* aRequest);
// nsIFrame
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
- virtual nsIAtom* GetType_() const override;
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aMetrics,
const ReflowInput& aReflowInput,
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -802,23 +802,17 @@ nsCanvasFrame::Reflow(nsPresContext*
}
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowInput, aStatus);
NS_FRAME_TRACE_REFLOW_OUT("nsCanvasFrame::Reflow", aStatus);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
-nsIAtom*
-nsCanvasFrame::GetType_() const
-{
- return FrameType::Canvas;
-}
-
-nsresult
+nsresult
nsCanvasFrame::GetContentForEvent(WidgetEvent* aEvent,
nsIContent** aContent)
{
NS_ENSURE_ARG_POINTER(aContent);
nsresult rv = nsFrame::GetContentForEvent(aEvent,
aContent);
if (NS_FAILED(rv) || !*aContent) {
nsIFrame* kid = mFrames.FirstChild();
--- a/layout/generic/nsCanvasFrame.h
+++ b/layout/generic/nsCanvasFrame.h
@@ -101,23 +101,16 @@ public:
const nsDisplayListSet& aLists) override;
void PaintFocus(mozilla::gfx::DrawTarget* aRenderingContext, nsPoint aPt);
// nsIScrollPositionListener
virtual void ScrollPositionWillChange(nscoord aX, nscoord aY) override;
virtual void ScrollPositionDidChange(nscoord aX, nscoord aY) override {}
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::canvasFrame
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
virtual nsresult GetContentForEvent(mozilla::WidgetEvent* aEvent,
nsIContent** aContent) override;
nsRect CanvasArea() const;
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -129,22 +129,16 @@ NS_NewColumnSetFrame(nsIPresShell* aPres
NS_IMPL_FRAMEARENA_HELPERS(nsColumnSetFrame)
nsColumnSetFrame::nsColumnSetFrame(nsStyleContext* aContext)
: nsContainerFrame(aContext, FrameType::ColumnSet)
, mLastBalanceBSize(NS_INTRINSICSIZE)
{
}
-nsIAtom*
-nsColumnSetFrame::GetType_() const
-{
- return FrameType::ColumnSet;
-}
-
void
nsColumnSetFrame::CreateBorderRenderers(nsTArray<nsCSSBorderRenderer>& aBorderRenderers,
nsRenderingContext* aCtx,
const nsRect& aDirtyRect,
const nsPoint& aPt)
{
nsIFrame* child = mFrames.FirstChild();
if (!child)
--- a/layout/generic/nsColumnSetFrame.h
+++ b/layout/generic/nsColumnSetFrame.h
@@ -65,18 +65,16 @@ public:
return nsContainerFrame::IsFrameOfType(aFlags &
~(nsIFrame::eCanContainOverflowContainers));
}
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
- virtual nsIAtom* GetType_() const override;
-
/**
* Similar to nsBlockFrame::DrainOverflowLines. Locate any columns not
* handled by our prev-in-flow, and any columns sitting on our own
* overflow list, and put them in our primary child list for reflowing.
*/
void DrainOverflowColumns();
/**
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -1287,17 +1287,17 @@ nsContainerFrame::StealFrame(nsIFrame* a
}
nsFrameList
nsContainerFrame::StealFramesAfter(nsIFrame* aChild)
{
NS_ASSERTION(!aChild ||
!(aChild->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER),
"StealFramesAfter doesn't handle overflow containers");
- NS_ASSERTION(GetType() != FrameType::Block, "unexpected call");
+ NS_ASSERTION(!IsBlockFrame(), "unexpected call");
if (!aChild) {
nsFrameList copy(mFrames);
mFrames.Clear();
return copy;
}
for (nsFrameList::FrameLinkEnumerator iter(mFrames); !iter.AtEnd();
@@ -1326,17 +1326,17 @@ nsContainerFrame::StealFramesAfter(nsIFr
/*
* Create a next-in-flow for aFrame. Will return the newly created
* frame <b>if and only if</b> a new frame is created; otherwise
* nullptr is returned.
*/
nsIFrame*
nsContainerFrame::CreateNextInFlow(nsIFrame* aFrame)
{
- NS_PRECONDITION(GetType() != FrameType::Block,
+ NS_PRECONDITION(!IsBlockFrame(),
"you should have called nsBlockFrame::CreateContinuationFor instead");
NS_PRECONDITION(mFrames.ContainsFrame(aFrame), "expected an in-flow child frame");
nsPresContext* pc = PresContext();
nsIFrame* nextInFlow = aFrame->GetNextInFlow();
if (nullptr == nextInFlow) {
// Create a continuation frame for the child frame and insert it
// into our child list.
--- a/layout/generic/nsFirstLetterFrame.cpp
+++ b/layout/generic/nsFirstLetterFrame.cpp
@@ -37,22 +37,16 @@ NS_QUERYFRAME_TAIL_INHERITING(nsContaine
#ifdef DEBUG_FRAME_DUMP
nsresult
nsFirstLetterFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("Letter"), aResult);
}
#endif
-nsIAtom*
-nsFirstLetterFrame::GetType_() const
-{
- return FrameType::Letter;
-}
-
void
nsFirstLetterFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
BuildDisplayListForInline(aBuilder, aDirtyRect, aLists);
}
--- a/layout/generic/nsFirstLetterFrame.h
+++ b/layout/generic/nsFirstLetterFrame.h
@@ -28,17 +28,16 @@ public:
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
virtual void SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList) override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
- virtual nsIAtom* GetType_() const override;
bool IsFloating() const { return GetStateBits() & NS_FRAME_OUT_OF_FLOW; }
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
if (!IsFloating())
aFlags = aFlags & ~(nsIFrame::eLineParticipant);
return nsContainerFrame::IsFrameOfType(aFlags &
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -1758,17 +1758,17 @@ FlexItem::FlexItem(ReflowInput& aFlexIte
mHadMeasuringReflow(false),
mIsStretched(false),
mIsStrut(false),
// mNeedsMinSizeAutoResolution is initialized in CheckForMinSizeAuto()
mWM(aFlexItemReflowInput.GetWritingMode())
// mAlignSelf, see below
{
MOZ_ASSERT(mFrame, "expecting a non-null child frame");
- MOZ_ASSERT(mFrame->GetType() != FrameType::Placeholder,
+ MOZ_ASSERT(!mFrame->IsPlaceholderFrame(),
"placeholder frames should not be treated as flex items");
MOZ_ASSERT(!(mFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW),
"out-of-flow frames should not be treated as flex items");
const ReflowInput* containerRS = aFlexItemReflowInput.mParentReflowInput;
if (IsLegacyBox(containerRS->mFrame)) {
// For -webkit-box/-webkit-inline-box, we need to:
// (1) Use "-webkit-box-align" instead of "align-items" to determine the
@@ -1856,17 +1856,17 @@ FlexItem::FlexItem(nsIFrame* aChildFrame
mNeedsMinSizeAutoResolution(false),
mWM(aContainerWM),
mAlignSelf(NS_STYLE_ALIGN_FLEX_START)
{
MOZ_ASSERT(mFrame, "expecting a non-null child frame");
MOZ_ASSERT(NS_STYLE_VISIBILITY_COLLAPSE ==
mFrame->StyleVisibility()->mVisible,
"Should only make struts for children with 'visibility:collapse'");
- MOZ_ASSERT(mFrame->GetType() != FrameType::Placeholder,
+ MOZ_ASSERT(!mFrame->IsPlaceholderFrame(),
"placeholder frames should not be treated as flex items");
MOZ_ASSERT(!(mFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW),
"out-of-flow frames should not be treated as flex items");
}
void
FlexItem::CheckForMinSizeAuto(const ReflowInput& aFlexItemReflowInput,
const FlexboxAxisTracker& aAxisTracker)
@@ -2199,23 +2199,16 @@ nsFlexContainerFrame::Init(nsIContent*
isLegacyBox = IsDisplayValueLegacyBox(parentStyleContext->StyleDisplay());
}
if (isLegacyBox) {
AddStateBits(NS_STATE_FLEX_IS_LEGACY_WEBKIT_BOX);
}
}
-/* virtual */
-nsIAtom*
-nsFlexContainerFrame::GetType_() const
-{
- return FrameType::FlexContainer;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
nsFlexContainerFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("FlexContainer"), aResult);
}
#endif
@@ -3901,18 +3894,17 @@ nsFlexContainerFrame::SizeItemInCrossAxi
nscoord crossAxisBorderPadding = aItem.GetBorderPadding().TopBottom();
if (reflowResult.Height() < crossAxisBorderPadding) {
// Child's requested size isn't large enough for its border/padding!
// This is OK for the trivial nsFrame::Reflow() impl, but other frame
// classes should know better. So, if we get here, the child had better be
// an instance of nsFrame (i.e. it should return null from GetType()).
// XXXdholbert Once we've fixed bug 765861, we should upgrade this to an
// assertion that trivially passes if bug 765861's flag has been flipped.
- NS_WARNING_ASSERTION(
- !aItem.Frame()->GetType(),
+ NS_WARNING_ASSERTION(aItem.Frame()->Type() == FrameType::None,
"Child should at least request space for border/padding");
aItem.SetCrossSize(0);
} else {
// (normal case)
aItem.SetCrossSize(reflowResult.Height() - crossAxisBorderPadding);
}
aItem.SetAscent(reflowResult.Ascent());
--- a/layout/generic/nsFlexContainerFrame.h
+++ b/layout/generic/nsFlexContainerFrame.h
@@ -73,17 +73,16 @@ public:
void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
nscoord GetMinISize(nsRenderingContext* aRenderingContext) override;
nscoord GetPrefISize(nsRenderingContext* aRenderingContext) override;
- nsIAtom* GetType_() const override;
#ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const override;
#endif
nscoord GetLogicalBaseline(mozilla::WritingMode aWM) const override;
bool GetVerticalAlignBaseline(mozilla::WritingMode aWM,
nscoord* aBaseline) const override
--- a/layout/generic/nsFontInflationData.cpp
+++ b/layout/generic/nsFontInflationData.cpp
@@ -328,17 +328,17 @@ nsFontInflationData::ScanTextIn(nsIFrame
nsFrameList::Enumerator kids(lists.CurrentList());
for (; !kids.AtEnd(); kids.Next()) {
nsIFrame *kid = kids.get();
if (kid->GetStateBits() & NS_FRAME_FONT_INFLATION_FLOW_ROOT) {
// Goes in a different set of inflation data.
continue;
}
- nsIAtom *fType = kid->GetType();
+ FrameType fType = kid->Type();
if (fType == FrameType::Text) {
nsIContent *content = kid->GetContent();
if (content && kid == content->GetPrimaryFrame()) {
uint32_t len = nsTextFrameUtils::
ComputeApproximateLengthWithWhitespaceCompression(
content, kid->StyleText());
if (len != 0) {
nscoord fontSize = kid->StyleFont()->mFont.size;
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -557,17 +557,17 @@ IsFontSizeInflationContainer(nsIFrame* a
NS_ASSERTION(!aFrame->IsFrameOfType(nsIFrame::eLineParticipant) ||
isInline ||
// br frames and mathml frames report being line
// participants even when their position or display is
// set
aFrame->IsBrFrame() ||
aFrame->IsFrameOfType(nsIFrame::eMathML),
"line participants must not be containers");
- NS_ASSERTION(aFrame->GetType() != FrameType::Bullet || isInline,
+ NS_ASSERTION(!aFrame->IsBulletFrame() || isInline,
"bullets should not be containers");
return !isInline;
}
void
nsFrame::Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow)
@@ -2873,17 +2873,17 @@ nsIFrame::BuildDisplayListForChild(nsDis
uint32_t aFlags) {
// If painting is restricted to just the background of the top level frame,
// then we have nothing to do here.
if (aBuilder->IsBackgroundOnly())
return;
if (aBuilder->IsForGenerateGlyphMask() ||
aBuilder->IsForPaintingSelectionBG()) {
- if (FrameType::Text != aChild->GetType() && aChild->IsLeaf()) {
+ if (!aChild->IsTextFrame() && aChild->IsLeaf()) {
return;
}
}
nsIFrame* child = aChild;
if (child->GetStateBits() & NS_FRAME_TOO_DEEP_IN_FRAME_TREE)
return;
@@ -2899,20 +2899,19 @@ nsIFrame::BuildDisplayListForChild(nsDis
// it acts like inline-block or inline-table. Therefore it is a
// pseudo-stacking-context.
pseudoStackingContext = true;
}
// dirty rect in child-relative coordinates
nsRect dirty = aDirtyRect - child->GetOffsetTo(this);
- FrameType childType = child->Type();
nsDisplayListBuilder::OutOfFlowDisplayData* savedOutOfFlowData = nullptr;
bool isPlaceholder = false;
- if (childType == FrameType::Placeholder) {
+ if (child->IsPlaceholderFrame()) {
isPlaceholder = true;
nsPlaceholderFrame* placeholder = static_cast<nsPlaceholderFrame*>(child);
child = placeholder->GetOutOfFlowFrame();
NS_ASSERTION(child, "No out of flow frame?");
// If 'child' is a pushed float then it's owned by a block that's not an
// ancestor of the placeholder, and it will be painted by that block and
// should not be painted through the placeholder.
if (!child || nsLayoutUtils::IsPopup(child) ||
@@ -2922,36 +2921,32 @@ nsIFrame::BuildDisplayListForChild(nsDis
// If the out-of-flow frame is in the top layer, the viewport frame
// will paint it. Skip it here. Note that, only out-of-flow frames
// with this property should be skipped, because non-HTML elements
// may stop their children from being out-of-flow. Those frames
// should still be handled in the normal in-flow path.
if (placeholder->GetStateBits() & PLACEHOLDER_FOR_TOPLAYER) {
return;
}
- // Make sure that any attempt to use childType below is disappointed. We
- // could call GetType again but since we don't currently need it, let's
- // avoid the virtual call.
- childType = nullptr;
// Recheck NS_FRAME_TOO_DEEP_IN_FRAME_TREE
if (child->GetStateBits() & NS_FRAME_TOO_DEEP_IN_FRAME_TREE)
return;
savedOutOfFlowData = nsDisplayListBuilder::GetOutOfFlowData(child);
if (savedOutOfFlowData) {
dirty = savedOutOfFlowData->mDirtyRect;
} else {
// The out-of-flow frame did not intersect the dirty area. We may still
// need to traverse into it, since it may contain placeholders we need
// to enter to reach other out-of-flow frames that are visible.
dirty.SetEmpty();
}
pseudoStackingContext = true;
}
- NS_ASSERTION(childType != FrameType::Placeholder,
+ NS_ASSERTION(!child->IsPlaceholderFrame(),
"Should have dealt with placeholders already");
if (aBuilder->GetSelectedFramesOnly() &&
child->IsLeaf() &&
!aChild->IsSelected()) {
return;
}
if (aBuilder->GetIncludeAllOutOfFlows() &&
@@ -4959,37 +4954,36 @@ nsFrame::ComputeSize(nsRenderingContext*
}
nscoord boxSizingToMarginEdgeISize =
aMargin.ISize(aWM) + aBorder.ISize(aWM) + aPadding.ISize(aWM) -
boxSizingAdjust.ISize(aWM);
const nsStyleCoord* inlineStyleCoord = &stylePos->ISize(aWM);
const nsStyleCoord* blockStyleCoord = &stylePos->BSize(aWM);
- nsIAtom* parentFrameType = GetParent() ? GetParent()->GetType() : nullptr;
- auto alignCB = GetParent();
- bool isGridItem = (parentFrameType == FrameType::GridContainer &&
- !(GetStateBits() & NS_FRAME_OUT_OF_FLOW));
- if (parentFrameType == FrameType::TableWrapper &&
- IsTableFrame()) {
+ auto parentFrame = GetParent();
+ auto alignCB = parentFrame;
+ bool isGridItem = parentFrame && parentFrame->IsGridContainerFrame() &&
+ !(GetStateBits() & NS_FRAME_OUT_OF_FLOW);
+ if (parentFrame && parentFrame->IsTableWrapperFrame() && IsTableFrame()) {
// An inner table frame is sized as a grid item if its table wrapper is,
// because they actually have the same CB (the wrapper's CB).
// @see ReflowInput::InitCBReflowInput
auto tableWrapper = GetParent();
auto grandParent = tableWrapper->GetParent();
isGridItem = (grandParent->IsGridContainerFrame() &&
!(tableWrapper->GetStateBits() & NS_FRAME_OUT_OF_FLOW));
if (isGridItem) {
// When resolving justify/align-self below, we want to use the grid
// container's justify/align-items value and WritingMode.
alignCB = grandParent;
}
}
- bool isFlexItem = (parentFrameType == FrameType::FlexContainer &&
- !(GetStateBits() & NS_FRAME_OUT_OF_FLOW));
+ bool isFlexItem = parentFrame && parentFrame->IsFlexContainerFrame() &&
+ !(GetStateBits() & NS_FRAME_OUT_OF_FLOW);
bool isInlineFlexItem = false;
if (isFlexItem) {
// Flex items use their "flex-basis" property in place of their main-size
// property (e.g. "width") for sizing purposes, *unless* they have
// "flex-basis:auto", in which case they use their main-size property after
// all.
uint32_t flexDirection = GetParent()->StylePosition()->mFlexDirection;
isInlineFlexItem =
@@ -5205,22 +5199,21 @@ nsFrame::ComputeSizeWithIntrinsicDimensi
const LogicalSize& aMargin,
const LogicalSize& aBorder,
const LogicalSize& aPadding,
ComputeSizeFlags aFlags)
{
const nsStylePosition* stylePos = StylePosition();
const nsStyleCoord* inlineStyleCoord = &stylePos->ISize(aWM);
const nsStyleCoord* blockStyleCoord = &stylePos->BSize(aWM);
- const nsIAtom* parentFrameType =
- GetParent() ? GetParent()->GetType() : nullptr;
- const bool isGridItem = (parentFrameType == FrameType::GridContainer &&
- !(GetStateBits() & NS_FRAME_OUT_OF_FLOW));
- const bool isFlexItem = (parentFrameType == FrameType::FlexContainer &&
- !(GetStateBits() & NS_FRAME_OUT_OF_FLOW));
+ auto* parentFrame = GetParent();
+ const bool isGridItem = parentFrame && parentFrame->IsGridContainerFrame() &&
+ !(GetStateBits() & NS_FRAME_OUT_OF_FLOW);
+ const bool isFlexItem = parentFrame && parentFrame->IsFlexContainerFrame() &&
+ !(GetStateBits() & NS_FRAME_OUT_OF_FLOW);
bool isInlineFlexItem = false;
Maybe<nsStyleCoord> imposedMainSizeStyleCoord;
// If this is a flex item, and we're measuring its cross size after flexing
// to resolve its main size, then we need to use the resolved main size
// that the container provides to us *instead of* the main-size coordinate
// from our style struct. (Otherwise, we'll be using an irrelevant value in
// the aspect-ratio calculations below.)
@@ -6166,22 +6159,16 @@ nsIFrame::GetNearestWidget(nsPoint& aOff
nsPoint offsetToView;
nsPoint offsetToWidget;
nsIWidget* widget =
GetClosestView(&offsetToView)->GetNearestWidget(&offsetToWidget);
aOffset = offsetToView + offsetToWidget;
return widget;
}
-nsIAtom*
-nsFrame::GetType_() const
-{
- return nullptr;
-}
-
bool
nsIFrame::IsLeaf() const
{
return true;
}
Matrix4x4
nsIFrame::GetTransformMatrix(const nsIFrame* aStopAtAncestor,
@@ -9296,25 +9283,25 @@ nsFrame::CorrectStyleParentFrame(nsIFram
nsIFrame* sibling = GetIBSplitSiblingForAnonymousBlock(parent);
if (sibling) {
// |parent| was a block in an {ib} split; use the inline as
// |the style parent.
parent = sibling;
}
}
-
+
nsIAtom* parentPseudo = parent->StyleContext()->GetPseudo();
if (!parentPseudo ||
(!nsCSSAnonBoxes::IsAnonBox(parentPseudo) &&
- // nsPlaceholderFrame pases in FrameType::Placeholder for
+ // nsPlaceholderFrame pases in nsGkAtoms::placeholderFrame for
// aChildPseudo (even though that's not a valid pseudo-type) just to
// trigger this behavior of walking up to the nearest non-pseudo
// ancestor.
- aChildPseudo != FrameType::Placeholder)) {
+ aChildPseudo != nsGkAtoms::placeholderFrame)) {
return parent;
}
parent = parent->GetParent();
} while (parent);
if (aProspectiveParent->StyleContext()->GetPseudo() ==
nsCSSAnonBoxes::viewportScroll) {
@@ -10711,20 +10698,20 @@ struct DR_FrameTypeInfo;
struct DR_FrameTreeNode;
struct DR_Rule;
struct DR_State
{
DR_State();
~DR_State();
void Init();
- void AddFrameTypeInfo(nsIAtom* aFrameType,
+ void AddFrameTypeInfo(FrameType aFrameType,
const char* aFrameNameAbbrev,
const char* aFrameName);
- DR_FrameTypeInfo* GetFrameTypeInfo(nsIAtom* aFrameType);
+ DR_FrameTypeInfo* GetFrameTypeInfo(FrameType aFrameType);
DR_FrameTypeInfo* GetFrameTypeInfo(char* aFrameName);
void InitFrameTypeTable();
DR_FrameTreeNode* CreateTreeNode(nsIFrame* aFrame,
const ReflowInput* aReflowInput);
void FindMatchingRule(DR_FrameTreeNode& aNode);
bool RuleMatches(DR_Rule& aRule,
DR_FrameTreeNode& aNode);
bool GetToken(FILE* aFile,
@@ -10755,78 +10742,84 @@ struct DR_State
nsTArray<DR_Rule*> mWildRules;
nsTArray<DR_FrameTypeInfo> mFrameTypeTable;
// reflow specific state
nsTArray<DR_FrameTreeNode*> mFrameTreeLeaves;
};
static DR_State *DR_state; // the one and only DR_State
-struct DR_RulePart
-{
- explicit DR_RulePart(nsIAtom* aFrameType) : mFrameType(aFrameType), mNext(0) {}
+struct DR_RulePart
+{
+ explicit DR_RulePart(FrameType aFrameType)
+ : mFrameType(aFrameType)
+ , mNext(0)
+ {}
+
void Destroy();
- nsIAtom* mFrameType;
+ FrameType mFrameType;
DR_RulePart* mNext;
};
void DR_RulePart::Destroy()
{
if (mNext) {
mNext->Destroy();
}
delete this;
}
-struct DR_Rule
+struct DR_Rule
{
DR_Rule() : mLength(0), mTarget(nullptr), mDisplay(false) {
MOZ_COUNT_CTOR(DR_Rule);
}
~DR_Rule() {
if (mTarget) mTarget->Destroy();
MOZ_COUNT_DTOR(DR_Rule);
}
- void AddPart(nsIAtom* aFrameType);
+ void AddPart(FrameType aFrameType);
uint32_t mLength;
DR_RulePart* mTarget;
bool mDisplay;
};
-void DR_Rule::AddPart(nsIAtom* aFrameType)
+void DR_Rule::AddPart(FrameType aFrameType)
{
DR_RulePart* newPart = new DR_RulePart(aFrameType);
newPart->mNext = mTarget;
mTarget = newPart;
mLength++;
}
struct DR_FrameTypeInfo
{
- DR_FrameTypeInfo(nsIAtom* aFrmeType, const char* aFrameNameAbbrev, const char* aFrameName);
- ~DR_FrameTypeInfo() {
+ DR_FrameTypeInfo(FrameType aFrameType,
+ const char* aFrameNameAbbrev,
+ const char* aFrameName);
+ ~DR_FrameTypeInfo() {
int32_t numElements;
numElements = mRules.Length();
for (int32_t i = numElements - 1; i >= 0; i--) {
delete mRules.ElementAt(i);
}
}
- nsIAtom* mType;
+ FrameType mType;
char mNameAbbrev[16];
char mName[32];
nsTArray<DR_Rule*> mRules;
private:
DR_FrameTypeInfo& operator=(const DR_FrameTypeInfo&) = delete;
};
-DR_FrameTypeInfo::DR_FrameTypeInfo(nsIAtom* aFrameType,
- const char* aFrameNameAbbrev,
+DR_FrameTypeInfo::DR_FrameTypeInfo(FrameType aFrameType,
+ const char* aFrameNameAbbrev,
const char* aFrameName)
{
mType = aFrameType;
PL_strncpyz(mNameAbbrev, aFrameNameAbbrev, sizeof(mNameAbbrev));
PL_strncpyz(mName, aFrameName, sizeof(mName));
}
struct DR_FrameTreeNode
@@ -10961,30 +10954,30 @@ bool DR_State::GetToken(FILE* aFile,
DR_Rule* DR_State::ParseRule(FILE* aFile)
{
char buf[128];
int32_t doDisplay;
DR_Rule* rule = nullptr;
while (GetToken(aFile, buf, sizeof(buf))) {
if (GetNumber(buf, doDisplay)) {
- if (rule) {
+ if (rule) {
rule->mDisplay = !!doDisplay;
break;
}
else {
printf("unexpected token - %s \n", buf);
}
}
else {
if (!rule) {
rule = new DR_Rule;
}
if (strcmp(buf, "*") == 0) {
- rule->AddPart(nullptr);
+ rule->AddPart(FrameType::None);
}
else {
DR_FrameTypeInfo* info = GetFrameTypeInfo(buf);
if (info) {
rule->AddPart(info->mType);
}
else {
printf("invalid frame type - %s \n", buf);
@@ -11013,44 +11006,42 @@ void DR_State::AddRule(nsTArray<DR_Rule*
void DR_State::ParseRulesFile()
{
char* path = PR_GetEnv("GECKO_DISPLAY_REFLOW_RULES_FILE");
if (path) {
FILE* inFile = fopen(path, "r");
if (inFile) {
for (DR_Rule* rule = ParseRule(inFile); rule; rule = ParseRule(inFile)) {
if (rule->mTarget) {
- nsIAtom* fType = rule->mTarget->mFrameType;
- if (fType) {
- DR_FrameTypeInfo* info = GetFrameTypeInfo(fType);
- if (info) {
- AddRule(info->mRules, *rule);
- }
+ FrameType fType = rule->mTarget->mFrameType;
+ DR_FrameTypeInfo* info = GetFrameTypeInfo(fType);
+ if (info) {
+ AddRule(info->mRules, *rule);
}
else {
AddRule(mWildRules, *rule);
}
mActive = true;
}
}
fclose(inFile);
}
}
}
-void DR_State::AddFrameTypeInfo(nsIAtom* aFrameType,
+void DR_State::AddFrameTypeInfo(FrameType aFrameType,
const char* aFrameNameAbbrev,
const char* aFrameName)
{
mFrameTypeTable.AppendElement(DR_FrameTypeInfo(aFrameType, aFrameNameAbbrev, aFrameName));
}
-DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(nsIAtom* aFrameType)
+DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(FrameType aFrameType)
{
int32_t numEntries = mFrameTypeTable.Length();
NS_ASSERTION(numEntries != 0, "empty FrameTypeTable");
for (int32_t i = 0; i < numEntries; i++) {
DR_FrameTypeInfo& info = mFrameTypeTable.ElementAt(i);
if (info.mType == aFrameType) {
return &info;
}
@@ -11067,17 +11058,17 @@ DR_FrameTypeInfo* DR_State::GetFrameType
if ((strcmp(aFrameName, info.mName) == 0) || (strcmp(aFrameName, info.mNameAbbrev) == 0)) {
return &info;
}
}
return &mFrameTypeTable.ElementAt(numEntries - 1); // return unknown frame type
}
void DR_State::InitFrameTypeTable()
-{
+{
AddFrameTypeInfo(FrameType::Block, "block", "block");
AddFrameTypeInfo(FrameType::Br, "br", "br");
AddFrameTypeInfo(FrameType::Bullet, "bullet", "bullet");
AddFrameTypeInfo(FrameType::ColorControl, "color", "colorControl");
AddFrameTypeInfo(FrameType::GfxButtonControl, "button", "gfxButtonControl");
AddFrameTypeInfo(FrameType::HTMLButtonControl, "HTMLbutton", "HTMLButtonControl");
AddFrameTypeInfo(FrameType::HTMLCanvas, "HTMLCanvas","HTMLCanvas");
AddFrameTypeInfo(FrameType::SubDocument, "subdoc", "subDocument");
@@ -11104,24 +11095,24 @@ void DR_State::InitFrameTypeTable()
AddFrameTypeInfo(FrameType::Text, "text", "text");
AddFrameTypeInfo(FrameType::Viewport, "VP", "viewport");
#ifdef MOZ_XUL
AddFrameTypeInfo(FrameType::XULLabel, "XULLabel", "XULLabel");
AddFrameTypeInfo(FrameType::Box, "Box", "Box");
AddFrameTypeInfo(FrameType::Slider, "Slider", "Slider");
AddFrameTypeInfo(FrameType::PopupSet, "PopupSet", "PopupSet");
#endif
- AddFrameTypeInfo(nullptr, "unknown", "unknown");
+ AddFrameTypeInfo(FrameType::None, "unknown", "unknown");
}
void DR_State::DisplayFrameTypeInfo(nsIFrame* aFrame,
int32_t aIndent)
-{
- DR_FrameTypeInfo* frameTypeInfo = GetFrameTypeInfo(aFrame->GetType());
+{
+ DR_FrameTypeInfo* frameTypeInfo = GetFrameTypeInfo(aFrame->Type());
if (frameTypeInfo) {
for (int32_t i = 0; i < aIndent; i++) {
printf(" ");
}
if(!strcmp(frameTypeInfo->mNameAbbrev, "unknown")) {
if (aFrame) {
nsAutoString name;
aFrame->GetFrameName(name);
@@ -11132,49 +11123,47 @@ void DR_State::DisplayFrameTypeInfo(nsIF
}
}
else {
printf("%s %p ", frameTypeInfo->mNameAbbrev, (void*)aFrame);
}
}
}
-bool DR_State::RuleMatches(DR_Rule& aRule,
- DR_FrameTreeNode& aNode)
+bool DR_State::RuleMatches(DR_Rule& aRule, DR_FrameTreeNode& aNode)
{
NS_ASSERTION(aRule.mTarget, "program error");
DR_RulePart* rulePart;
DR_FrameTreeNode* parentNode;
for (rulePart = aRule.mTarget->mNext, parentNode = aNode.mParent;
rulePart && parentNode;
rulePart = rulePart->mNext, parentNode = parentNode->mParent) {
- if (rulePart->mFrameType) {
+ if (rulePart->mFrameType != FrameType::None) {
if (parentNode->mFrame) {
- if (rulePart->mFrameType != parentNode->mFrame->GetType()) {
+ if (rulePart->mFrameType != parentNode->mFrame->Type()) {
return false;
}
- }
- else NS_ASSERTION(false, "program error");
+ } else NS_ASSERTION(false, "program error");
}
// else wild card match
}
return true;
}
void DR_State::FindMatchingRule(DR_FrameTreeNode& aNode)
{
if (!aNode.mFrame) {
NS_ASSERTION(false, "invalid DR_FrameTreeNode \n");
return;
}
bool matchingRule = false;
- DR_FrameTypeInfo* info = GetFrameTypeInfo(aNode.mFrame->GetType());
+ DR_FrameTypeInfo* info = GetFrameTypeInfo(aNode.mFrame->Type());
NS_ASSERTION(info, "program error");
int32_t numRules = info->mRules.Length();
for (int32_t ruleX = 0; ruleX < numRules; ruleX++) {
DR_Rule* rule = info->mRules.ElementAt(ruleX);
if (rule && RuleMatches(*rule, aNode)) {
aNode.mDisplay = rule->mDisplay;
matchingRule = true;
break;
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -195,17 +195,16 @@ public:
nsIFrame* GetPrevContinuation() const override;
void SetPrevContinuation(nsIFrame*) override;
nsIFrame* GetNextContinuation() const override;
void SetNextContinuation(nsIFrame*) override;
nsIFrame* GetPrevInFlowVirtual() const override;
void SetPrevInFlow(nsIFrame*) override;
nsIFrame* GetNextInFlowVirtual() const override;
void SetNextInFlow(nsIFrame*) override;
- nsIAtom* GetType_() const override;
nsresult GetSelectionController(nsPresContext *aPresContext,
nsISelectionController **aSelCon) override;
FrameSearchResult PeekOffsetNoAmount(bool aForward,
int32_t* aOffset) override;
FrameSearchResult PeekOffsetCharacter(bool aForward, int32_t* aOffset,
bool aRespectClusters = true) override;
@@ -621,52 +620,52 @@ public:
* Returns true if aFrame should apply overflow clipping.
*/
static bool ShouldApplyOverflowClipping(const nsIFrame* aFrame,
const nsStyleDisplay* aDisp)
{
// clip overflow:-moz-hidden-unscrollable, except for nsListControlFrame,
// which is an nsHTMLScrollFrame.
if (MOZ_UNLIKELY(aDisp->mOverflowX == NS_STYLE_OVERFLOW_CLIP &&
- aFrame->GetType() != nsGkAtoms::listControlFrame)) {
+ !aFrame->IsListControlFrame())) {
return true;
}
// and overflow:hidden that we should interpret as -moz-hidden-unscrollable
if (aDisp->mOverflowX == NS_STYLE_OVERFLOW_HIDDEN &&
aDisp->mOverflowY == NS_STYLE_OVERFLOW_HIDDEN) {
// REVIEW: these are the frame types that set up clipping.
- nsIAtom* type = aFrame->GetType();
- if (type == nsGkAtoms::tableFrame ||
- type == nsGkAtoms::tableCellFrame ||
- type == nsGkAtoms::bcTableCellFrame ||
- type == nsGkAtoms::svgOuterSVGFrame ||
- type == nsGkAtoms::svgInnerSVGFrame ||
- type == nsGkAtoms::svgForeignObjectFrame) {
+ FrameType type = aFrame->Type();
+ if (type == FrameType::Table ||
+ type == FrameType::TableCell ||
+ type == FrameType::BCTableCell ||
+ type == FrameType::SVGOuterSVG ||
+ type == FrameType::SVGInnerSVG ||
+ type == FrameType::SVGForeignObject) {
return true;
}
if (aFrame->IsFrameOfType(nsIFrame::eReplacedContainsBlock)) {
- if (type == nsGkAtoms::textInputFrame) {
+ if (type == FrameType::TextInput) {
// It always has an anonymous scroll frame that handles any overflow.
return false;
}
return true;
}
}
if ((aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT)) {
return false;
}
// If we're paginated and a block, and have NS_BLOCK_CLIP_PAGINATED_OVERFLOW
// set, then we want to clip our overflow.
return
(aFrame->GetStateBits() & NS_BLOCK_CLIP_PAGINATED_OVERFLOW) != 0 &&
aFrame->PresContext()->IsPaginated() &&
- aFrame->GetType() == nsGkAtoms::blockFrame;
+ aFrame->IsBlockFrame();
}
nsILineIterator* GetLineIterator() override;
protected:
// Test if we are selecting a table object:
// Most table/cell selection requires that Ctrl (Cmd on Mac) key is down
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -1089,22 +1089,16 @@ nsHTMLFramesetFrame::Reflow(nsPresContex
mDrag.UnSet();
aDesiredSize.SetOverflowAreasToDesiredBounds();
FinishAndStoreOverflow(&aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
-nsIAtom*
-nsHTMLFramesetFrame::GetType_() const
-{
- return FrameType::FrameSet;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
nsHTMLFramesetFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("Frameset"), aResult);
}
#endif
--- a/layout/generic/nsFrameSetFrame.h
+++ b/layout/generic/nsFrameSetFrame.h
@@ -100,17 +100,16 @@ public:
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
- virtual nsIAtom* GetType_() const override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
virtual bool IsLeaf() const override;
void StartMouseDrag(nsPresContext* aPresContext,
nsHTMLFramesetBorderFrame* aBorder,
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -194,22 +194,16 @@ nsHTMLScrollFrame::RemoveFrame(ChildList
}
nsSplittableType
nsHTMLScrollFrame::GetSplittableType() const
{
return NS_FRAME_NOT_SPLITTABLE;
}
-nsIAtom*
-nsHTMLScrollFrame::GetType_() const
-{
- return FrameType::Scroll;
-}
-
/**
HTML scrolling implementation
All other things being equal, we prefer layouts with fewer scrollbars showing.
*/
namespace mozilla {
@@ -1530,22 +1524,16 @@ nsXULScrollFrame::GetSplittableType() co
nsresult
nsXULScrollFrame::GetXULPadding(nsMargin& aMargin)
{
aMargin.SizeTo(0,0,0,0);
return NS_OK;
}
-nsIAtom*
-nsXULScrollFrame::GetType_() const
-{
- return FrameType::Scroll;
-}
-
nscoord
nsXULScrollFrame::GetXULBoxAscent(nsBoxLayoutState& aState)
{
if (!mHelper.mScrolledFrame)
return 0;
nscoord ascent = mHelper.mScrolledFrame->GetXULBoxAscent(aState);
nsMargin m(0,0,0,0);
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -966,23 +966,16 @@ public:
return NS_OK;
}
NS_IMETHOD RestoreState(nsPresState* aState) override {
NS_ENSURE_ARG_POINTER(aState);
mHelper.RestoreState(aState);
return NS_OK;
}
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::scrollFrame
- */
- virtual nsIAtom* GetType_() const override;
-
// nsIScrollbarMediator
virtual void ScrollByPage(nsScrollbarFrame* aScrollbar, int32_t aDirection,
nsIScrollbarMediator::ScrollSnapMode aSnap
= nsIScrollbarMediator::DISABLE_SNAP) override {
mHelper.ScrollByPage(aScrollbar, aDirection, aSnap);
}
virtual void ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
nsIScrollbarMediator::ScrollSnapMode aSnap
@@ -1391,23 +1384,16 @@ public:
return NS_OK;
}
NS_IMETHOD RestoreState(nsPresState* aState) override {
NS_ENSURE_ARG_POINTER(aState);
mHelper.RestoreState(aState);
return NS_OK;
}
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::scrollFrame
- */
- virtual nsIAtom* GetType_() const override;
-
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
// Override bogus IsFrameOfType in nsBoxFrame.
if (aFlags & (nsIFrame::eReplacedContainsBlock | nsIFrame::eReplaced))
return false;
return nsBoxFrame::IsFrameOfType(aFlags);
}
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -4866,19 +4866,18 @@ nsGridContainerFrame::GetNearestFragment
for ( ; cbRI; cbRI = cbRI->mCBReflowInput) {
nsIScrollableFrame* sf = do_QueryFrame(cbRI->mFrame);
if (sf) {
break;
}
if (wm.IsOrthogonalTo(cbRI->GetWritingMode())) {
break;
}
- nsIAtom* frameType = cbRI->mFrame->GetType();
- if ((frameType == FrameType::Canvas &&
- PresContext()->IsPaginated()) ||
+ FrameType frameType = cbRI->mFrame->Type();
+ if ((frameType == FrameType::Canvas && PresContext()->IsPaginated()) ||
frameType == FrameType::ColumnSet) {
data.emplace();
data->mIsTopOfPage = gridRI->mFlags.mIsTopOfPage;
data->mToFragmentainerEnd = aState.mFragBStart +
gridRI->AvailableBSize() - aState.mBorderPadding.BStart(wm);
const auto numRows = aState.mRows.mSizes.Length();
data->mCanBreakAtStart =
numRows > 0 && aState.mRows.mSizes[0].mPosition > 0;
@@ -4913,18 +4912,17 @@ nsGridContainerFrame::ReflowInFlowChild(
nsReflowStatus& aStatus)
{
nsPresContext* pc = PresContext();
nsStyleContext* containerSC = StyleContext();
WritingMode wm = aState.mReflowInput->GetWritingMode();
LogicalMargin pad(aState.mReflowInput->ComputedLogicalPadding());
const LogicalPoint padStart(wm, pad.IStart(wm), pad.BStart(wm));
const bool isGridItem = !!aGridItemInfo;
- auto childType = aChild->GetType();
- MOZ_ASSERT(isGridItem == (childType != FrameType::Placeholder));
+ MOZ_ASSERT(isGridItem == !aChild->IsPlaceholderFrame());
LogicalRect cb(wm);
WritingMode childWM = aChild->GetWritingMode();
bool isConstrainedBSize = false;
nscoord toFragmentainerEnd;
// The part of the child's grid area that's in previous container fragments.
nscoord consumedGridAreaBSize = 0;
const bool isOrthogonal = wm.IsOrthogonalTo(childWM);
if (MOZ_LIKELY(isGridItem)) {
@@ -5031,17 +5029,17 @@ nsGridContainerFrame::ReflowInFlowChild(
// FIXME (perf): It would be faster to do this only if the previous
// reflow of the child was a measuring reflow, and only if the child
// does some of the things that are affected by
// ReflowInput::COMPUTE_SIZE_USE_AUTO_BSIZE.
childRI.SetBResize(true);
// A table-wrapper needs to propagate the CB size we give it to its
// inner table frame later. @see nsTableWrapperFrame::InitChildReflowInput.
- if (childType == FrameType::TableWrapper) {
+ if (aChild->IsTableWrapperFrame()) {
const auto& props = aChild->Properties();
LogicalSize* cb = props.Get(nsTableWrapperFrame::GridItemCBSizeProperty());
if (!cb) {
cb = new LogicalSize(childWM);
props.Set(nsTableWrapperFrame::GridItemCBSizeProperty(), cb);
}
*cb = percentBasis;
}
@@ -5119,17 +5117,17 @@ nsGridContainerFrame::ReflowInFragmentai
// Collect our grid items and sort them in row order. Collect placeholders
// and put them in a separate array.
nsTArray<const GridItemInfo*> sortedItems(aState.mGridItems.Length());
nsTArray<nsIFrame*> placeholders(aState.mAbsPosItems.Length());
aState.mIter.Reset(CSSOrderAwareFrameIterator::eIncludeAll);
for (; !aState.mIter.AtEnd(); aState.mIter.Next()) {
nsIFrame* child = *aState.mIter;
- if (child->GetType() != FrameType::Placeholder) {
+ if (!child->IsPlaceholderFrame()) {
const GridItemInfo* info = &aState.mGridItems[aState.mIter.ItemIndex()];
sortedItems.AppendElement(info);
} else {
placeholders.AppendElement(child);
}
}
// NOTE: no need to use stable_sort here, there are no dependencies on
// having content order between items on the same row in the code below.
@@ -5636,17 +5634,17 @@ nsGridContainerFrame::ReflowChildren(Gri
aState.mInFragmentainer = true;
bSize = ReflowInFragmentainer(aState, aContentArea, aDesiredSize, aStatus,
*fragmentainer, containerSize);
} else {
aState.mIter.Reset(CSSOrderAwareFrameIterator::eIncludeAll);
for (; !aState.mIter.AtEnd(); aState.mIter.Next()) {
nsIFrame* child = *aState.mIter;
const GridItemInfo* info = nullptr;
- if (child->GetType() != FrameType::Placeholder) {
+ if (!child->IsPlaceholderFrame()) {
info = &aState.mGridItems[aState.mIter.ItemIndex()];
}
ReflowInFlowChild(*aState.mIter, info, containerSize, Nothing(), nullptr,
aState, aContentArea, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsComplete(), "child should be complete "
"in unconstrained reflow");
}
}
@@ -6350,22 +6348,16 @@ nsGridContainerFrame::MarkIntrinsicISize
mCachedPrefISize = NS_INTRINSIC_WIDTH_UNKNOWN;
mBaseline[0][0] = NS_INTRINSIC_WIDTH_UNKNOWN;
mBaseline[0][1] = NS_INTRINSIC_WIDTH_UNKNOWN;
mBaseline[1][0] = NS_INTRINSIC_WIDTH_UNKNOWN;
mBaseline[1][1] = NS_INTRINSIC_WIDTH_UNKNOWN;
nsContainerFrame::MarkIntrinsicISizesDirty();
}
-nsIAtom*
-nsGridContainerFrame::GetType_() const
-{
- return FrameType::GridContainer;
-}
-
void
nsGridContainerFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
DisplayBorderBackgroundOutline(aBuilder, aLists);
if (GetPrevInFlow()) {
DisplayOverflowContainers(aBuilder, aDirtyRect, aLists);
--- a/layout/generic/nsGridContainerFrame.h
+++ b/layout/generic/nsGridContainerFrame.h
@@ -93,17 +93,16 @@ public:
// nsIFrame overrides
void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
nscoord GetMinISize(nsRenderingContext* aRenderingContext) override;
nscoord GetPrefISize(nsRenderingContext* aRenderingContext) override;
void MarkIntrinsicISizesDirty() override;
- nsIAtom* GetType_() const override;
bool IsFrameOfType(uint32_t aFlags) const override
{
return nsContainerFrame::IsFrameOfType(aFlags &
~nsIFrame::eCanContainOverflowContainers);
}
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
--- a/layout/generic/nsHTMLCanvasFrame.cpp
+++ b/layout/generic/nsHTMLCanvasFrame.cpp
@@ -384,25 +384,19 @@ nsHTMLCanvasFrame::BuildDisplayList(nsDi
aLists.Content()->AppendNewToTop(
new (aBuilder) nsDisplayCanvas(aBuilder, this));
DisplaySelectionOverlay(aBuilder, aLists.Content(),
nsISelectionDisplay::DISPLAY_IMAGES);
}
-nsIAtom*
-nsHTMLCanvasFrame::GetType_() const
-{
- return FrameType::HTMLCanvas;
-}
-
// get the offset into the content area of the image where aImg starts if it is a continuation.
// from nsImageFrame
-nscoord
+nscoord
nsHTMLCanvasFrame::GetContinuationOffset(nscoord* aWidth) const
{
nscoord offset = 0;
if (aWidth) {
*aWidth = 0;
}
if (GetPrevInFlow()) {
--- a/layout/generic/nsHTMLCanvasFrame.h
+++ b/layout/generic/nsHTMLCanvasFrame.h
@@ -78,18 +78,16 @@ public:
nsReflowStatus& aStatus) override;
nsRect GetInnerArea() const;
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() override;
#endif
- virtual nsIAtom* GetType_() const override;
-
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;
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -2636,39 +2636,16 @@ public:
*/
FrameType Type() const { return mType; }
#define FRAME_TYPE(name_, _) \
bool Is##name_##Frame() const { return mType == FrameType::name_; }
#include "mozilla/FrameTypeList.h"
#undef FRAME_TYPE
- nsIAtom* GetType() const {
- MOZ_ASSERT(GetTypeNonVirtual() == GetType_());
- return GetTypeNonVirtual();
- }
-
- nsIAtom* GetTypeNonVirtual() const {
- switch (mType) {
-#define FRAME_TYPE(ty_, atom_) case FrameType::ty_: return atom_;
-#include "mozilla/FrameTypeList.h"
-#undef FRAME_TYPE
- }
- return nullptr;
- }
-
- /**
- * Get the "type" of the frame. May return nullptr.
- *
- * TODO(emilio): Remove.
- *
- * @see nsGkAtoms
- */
- virtual nsIAtom* GetType_() const = 0;
-
/**
* Returns a transformation matrix that converts points in this frame's
* coordinate space to points in some ancestor frame's coordinate space.
* The frame decides which ancestor it will use as a reference point.
* If this frame has no ancestor, aOutAncestor will be set to null.
*
* @param aStopAtAncestor don't look further than aStopAtAncestor. If null,
* all ancestors (including across documents) will be traversed.
--- a/layout/generic/nsIFrameInlines.h
+++ b/layout/generic/nsIFrameInlines.h
@@ -11,27 +11,24 @@
#include "nsPlaceholderFrame.h"
#include "nsStyleStructInlines.h"
#include "nsCSSAnonBoxes.h"
#include "nsFrameManager.h"
bool
nsIFrame::IsFlexItem() const
{
- return GetParent() &&
- GetParent()->GetType() == nsGkAtoms::flexContainerFrame &&
+ return GetParent() && GetParent()->IsFlexContainerFrame() &&
!(GetStateBits() & NS_FRAME_OUT_OF_FLOW);
}
bool
nsIFrame::IsFlexOrGridContainer() const
{
- nsIAtom* t = GetType();
- return t == nsGkAtoms::flexContainerFrame ||
- t == nsGkAtoms::gridContainerFrame;
+ return IsFlexContainerFrame() || IsGridContainerFrame();
}
bool
nsIFrame::IsFlexOrGridItem() const
{
return !(GetStateBits() & NS_FRAME_OUT_OF_FLOW) &&
GetParent() &&
GetParent()->IsFlexOrGridContainer();
@@ -160,17 +157,17 @@ nsIFrame::BaselineBOffset(mozilla::Writi
}
// XXX AlignmentContext::eTable should use content box?
return SynthesizeBaselineBOffsetFromBorderBox(aWM, aBaselineGroup);
}
void
nsIFrame::PropagateRootElementWritingMode(mozilla::WritingMode aRootElemWM)
{
- MOZ_ASSERT(GetType() == nsGkAtoms::canvasFrame);
+ MOZ_ASSERT(IsCanvasFrame());
for (auto f = this; f; f = f->GetParent()) {
f->mWritingMode = aRootElemWM;
}
}
nsContainerFrame*
nsIFrame::GetInFlowParent()
{
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -2124,22 +2124,16 @@ nsImageFrame::OnVisibilityChange(Visibil
if (aNewVisibility == Visibility::APPROXIMATELY_VISIBLE) {
MaybeDecodeForPredictedSize();
}
nsAtomicContainerFrame::OnVisibilityChange(aNewVisibility, aNonvisibleAction);
}
-nsIAtom*
-nsImageFrame::GetType_() const
-{
- return FrameType::Image;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
nsImageFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("ImageFrame"), aResult);
}
void
--- a/layout/generic/nsImageFrame.h
+++ b/layout/generic/nsImageFrame.h
@@ -109,18 +109,16 @@ public:
void OnVisibilityChange(Visibility aNewVisibility,
const Maybe<OnNonvisible>& aNonvisibleAction = Nothing()) override;
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() override;
#endif
- virtual nsIAtom* GetType_() const override;
-
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsAtomicContainerFrame::IsFrameOfType(aFlags &
~(nsIFrame::eReplaced | nsIFrame::eReplacedSizing));
}
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -51,22 +51,16 @@ NS_QUERYFRAME_TAIL_INHERITING(nsContaine
#ifdef DEBUG_FRAME_DUMP
nsresult
nsInlineFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("Inline"), aResult);
}
#endif
-nsIAtom*
-nsInlineFrame::GetType_() const
-{
- return FrameType::Inline;
-}
-
void
nsInlineFrame::InvalidateFrame(uint32_t aDisplayItemKey)
{
if (nsSVGUtils::IsInSVGTextSubtree(this)) {
nsIFrame* svgTextFrame =
nsLayoutUtils::GetClosestFrameOfType(GetParent(),
FrameType::SVGText);
svgTextFrame->InvalidateFrame();
@@ -1129,22 +1123,16 @@ nsFirstLineFrame::Init(nsIContent*
#ifdef DEBUG_FRAME_DUMP
nsresult
nsFirstLineFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("Line"), aResult);
}
#endif
-nsIAtom*
-nsFirstLineFrame::GetType_() const
-{
- return FrameType::Line;
-}
-
nsIFrame*
nsFirstLineFrame::PullOneFrame(nsPresContext* aPresContext, InlineReflowInput& irs,
bool* aIsComplete)
{
nsIFrame* frame = nsInlineFrame::PullOneFrame(aPresContext, irs, aIsComplete);
if (frame && !GetPrevInFlow()) {
// We are a first-line frame. Fixup the child frames
// style-context that we just pulled.
--- a/layout/generic/nsInlineFrame.h
+++ b/layout/generic/nsInlineFrame.h
@@ -36,17 +36,16 @@ public:
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() override;
#endif
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
- virtual nsIAtom* GetType_() const override;
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
if (aFlags & eSupportsCSSTransforms) {
return false;
}
return nsContainerFrame::IsFrameOfType(aFlags &
~(nsIFrame::eBidiInlineContainer | nsIFrame::eLineParticipant));
@@ -215,17 +214,16 @@ public:
NS_DECL_FRAMEARENA_HELPERS
friend nsFirstLineFrame* NS_NewFirstLineFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
- virtual nsIAtom* GetType_() const override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
--- a/layout/generic/nsLineLayout.cpp
+++ b/layout/generic/nsLineLayout.cpp
@@ -74,22 +74,20 @@ nsLineLayout::nsLineLayout(nsPresContext
mInFirstLetter(false),
mHasBullet(false),
mDirtyNextLine(false),
mLineAtStart(false),
mHasRuby(false),
mSuppressLineWrap(nsSVGUtils::IsInSVGTextSubtree(aOuterReflowInput->mFrame))
{
MOZ_ASSERT(aOuterReflowInput, "aOuterReflowInput must not be null");
- NS_ASSERTION(aFloatManager || aOuterReflowInput->mFrame->GetType() ==
- FrameType::Letter,
+ NS_ASSERTION(aFloatManager || aOuterReflowInput->mFrame->IsLetterFrame(),
"float manager should be present");
MOZ_ASSERT((!!mBaseLineLayout) ==
- (aOuterReflowInput->mFrame->GetType() ==
- FrameType::RubyTextContainer),
+ aOuterReflowInput->mFrame->IsRubyTextContainerFrame(),
"Only ruby text container frames have "
"a different base line layout");
MOZ_COUNT_CTOR(nsLineLayout);
// Stash away some style data that we need
nsBlockFrame* blockFrame = do_QueryFrame(aOuterReflowInput->mFrame);
if (blockFrame)
mStyleText = blockFrame->StyleTextForLineLayout();
@@ -366,17 +364,17 @@ nsLineLayout::UpdateBand(WritingMode aWM
for (PerFrameData* pfd = mRootSpan->mFirstFrame; pfd; pfd = pfd->mNext) {
pfd->mBounds.IStart(lineWM) += deltaICoord;
}
}
mBStartEdge = availSpace.BStart(lineWM);
mImpactedByFloats = true;
- mLastFloatWasLetterFrame = FrameType::Letter == aFloatFrame->GetType();
+ mLastFloatWasLetterFrame = aFloatFrame->IsLetterFrame();
}
nsLineLayout::PerSpanData*
nsLineLayout::NewPerSpanData()
{
nsLineLayout* outerLineLayout = GetOutermostLineLayout();
PerSpanData* psd = outerLineLayout->mSpanFreeList;
if (!psd) {
@@ -463,18 +461,18 @@ nsLineLayout::AttachFrameToBaseLineLayou
NS_PRECONDITION(mBaseLineLayout,
"This method must not be called in a base line layout.");
PerFrameData* baseFrame = mBaseLineLayout->LastFrame();
MOZ_ASSERT(aFrame && baseFrame);
MOZ_ASSERT(!aFrame->mIsLinkedToBase,
"The frame must not have been linked with the base");
#ifdef DEBUG
- nsIAtom* baseType = baseFrame->mFrame->GetType();
- nsIAtom* annotationType = aFrame->mFrame->GetType();
+ FrameType baseType = baseFrame->mFrame->Type();
+ FrameType annotationType = aFrame->mFrame->Type();
MOZ_ASSERT((baseType == FrameType::RubyBaseContainer &&
annotationType == FrameType::RubyTextContainer) ||
(baseType == FrameType::RubyBase &&
annotationType == FrameType::RubyText));
#endif
aFrame->mNextAnnotation = baseFrame->mNextAnnotation;
baseFrame->mNextAnnotation = aFrame;
@@ -708,17 +706,17 @@ HasPercentageUnitSide(const nsStyleSides
return false;
}
static bool
IsPercentageAware(const nsIFrame* aFrame)
{
NS_ASSERTION(aFrame, "null frame is not allowed");
- nsIAtom *fType = aFrame->GetType();
+ FrameType fType = aFrame->Type();
if (fType == FrameType::Text) {
// None of these things can ever be true for text frames.
return false;
}
// Some of these things don't apply to non-replaced inline frames
// (that is, fType == FrameType::Inline), but we won't bother making
// things unnecessarily complicated, since they'll probably be set
@@ -837,17 +835,17 @@ nsLineLayout::ReflowFrame(nsIFrame* aFra
// Capture this state *before* we reflow the frame in case it clears
// the state out. We need to know how to treat the current frame
// when breaking.
bool notSafeToBreak = LineIsEmpty() && !mImpactedByFloats;
// Figure out whether we're talking about a textframe here
FrameType frameType = aFrame->Type();
bool isText = frameType == FrameType::Text;
-
+
// Inline-ish and text-ish things don't compute their width;
// everything else does. We need to give them an available width that
// reflects the space left on the line.
LAYOUT_WARN_IF_FALSE(psd->mIEnd != NS_UNCONSTRAINEDSIZE,
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
"calculation");
nscoord availableSpaceOnLine = psd->mIEnd - psd->mICoord;
@@ -931,17 +929,17 @@ nsLineLayout::ReflowFrame(nsIFrame* aFra
pfd->mJustificationInfo = mJustificationInfo;
mJustificationInfo = JustificationInfo();
// See if the frame is a placeholderFrame and if it is process
// the float. At the same time, check if the frame has any non-collapsed-away
// content.
bool placedFloat = false;
bool isEmpty;
- if (!frameType) {
+ if (frameType == FrameType::None) {
isEmpty = pfd->mFrame->IsEmpty();
} else {
if (FrameType::Placeholder == frameType) {
isEmpty = true;
pfd->mSkipWhenTrimmingWhitespace = true;
nsIFrame* outOfFlowFrame = nsLayoutUtils::GetFloatFromPlaceholder(aFrame);
if (outOfFlowFrame) {
// Add mTrimmableISize to the available width since if the line ends
@@ -1329,17 +1327,17 @@ nsLineLayout::CanPlaceFrame(PerFrameData
#ifdef NOISY_CAN_PLACE_FRAME
printf(" ==> empty frame fits\n");
#endif
return true;
}
#ifdef FIX_BUG_50257
// another special case: always place a BR
- if (FrameType::Br == pfd->mFrame->GetType()) {
+ if (pfd->mFrame->IsBrFrame()) {
#ifdef NOISY_CAN_PLACE_FRAME
printf(" ==> BR frame fits\n");
#endif
return true;
}
#endif
if (aNotSafeToBreak) {
@@ -2234,17 +2232,17 @@ nsLineLayout::VerticalAlignFrames(PerSpa
blockEnd = blockStart + logicalBSize;
}
if (!preMode &&
mPresContext->CompatibilityMode() != eCompatibility_FullStandards &&
!logicalBSize) {
// Check if it's a BR frame that is not alone on its line (it
// is given a block size of zero to indicate this), and if so reset
// blockStart and blockEnd so that BR frames don't influence the line.
- if (FrameType::Br == frame->GetType()) {
+ if (frame->IsBrFrame()) {
blockStart = BLOCKDIR_ALIGN_FRAMES_NO_MINIMUM;
blockEnd = BLOCKDIR_ALIGN_FRAMES_NO_MAXIMUM;
}
}
if (blockStart < minBCoord) minBCoord = blockStart;
if (blockEnd > maxBCoord) maxBCoord = blockEnd;
#ifdef NOISY_BLOCKDIR_ALIGN
printf(" [frame]raw: a=%d h=%d bp=%d,%d logical: h=%d leading=%d y=%d minBCoord=%d maxBCoord=%d\n",
@@ -2938,17 +2936,17 @@ nsLineLayout::ApplyFrameJustification(Pe
}
return deltaICoord;
}
static nsIFrame*
FindNearestRubyBaseAncestor(nsIFrame* aFrame)
{
MOZ_ASSERT(aFrame->StyleContext()->ShouldSuppressLineBreak());
- while (aFrame && aFrame->GetType() != FrameType::RubyBase) {
+ while (aFrame && !aFrame->IsRubyBaseFrame()) {
aFrame = aFrame->GetParent();
}
// XXX It is possible that no ruby base ancestor is found because of
// some edge cases like form control or canvas inside ruby text.
// See bug 1138092 comment 4.
NS_WARNING_ASSERTION(aFrame, "no ruby base ancestor?");
return aFrame;
}
--- a/layout/generic/nsPageContentFrame.cpp
+++ b/layout/generic/nsPageContentFrame.cpp
@@ -103,21 +103,15 @@ nsPageContentFrame::Reflow(nsPresContext
if (aReflowInput.ComputedBSize() != NS_UNCONSTRAINEDSIZE) {
aDesiredSize.BSize(wm) = aReflowInput.ComputedBSize();
}
FinishAndStoreOverflow(&aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
-nsIAtom*
-nsPageContentFrame::GetType_() const
-{
- return FrameType::PageContent;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
nsPageContentFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("PageContent"), aResult);
}
#endif
--- a/layout/generic/nsPageContentFrame.h
+++ b/layout/generic/nsPageContentFrame.h
@@ -31,23 +31,16 @@ public:
return ViewportFrame::IsFrameOfType(aFlags &
~(nsIFrame::eCanContainOverflowContainers));
}
virtual void SetSharedPageData(nsSharedPageData* aPD) { mPD = aPD; }
virtual bool HasTransformGetter() const override { return true; }
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::pageContentFrame
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
// Debugging
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
protected:
explicit nsPageContentFrame(nsStyleContext* aContext)
: ViewportFrame(aContext, FrameType::PageContent)
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -56,17 +56,17 @@ nsPageFrame::Reflow(nsPresContext*
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsPageFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
aStatus.Reset(); // initialize out parameter
NS_ASSERTION(mFrames.FirstChild() &&
- FrameType::PageContent == mFrames.FirstChild()->GetType(),
+ mFrames.FirstChild()->IsPageContentFrame(),
"pageFrame must have a pageContentFrame child");
// Resize our frame allowing it only to be as big as we are
// XXX Pay attention to the page's border and padding...
if (mFrames.NotEmpty()) {
nsIFrame* frame = mFrames.FirstChild();
// When the reflow size is NS_UNCONSTRAINEDSIZE it means we are reflowing
// a single page to print selection. So this means we want to use
@@ -164,22 +164,16 @@ nsPageFrame::Reflow(nsPresContext*
FinishAndStoreOverflow(&aDesiredSize);
PR_PL(("PageFrame::Reflow %p ", this));
PR_PL(("[%d,%d]\n", aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight()));
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
-nsIAtom*
-nsPageFrame::GetType_() const
-{
- return FrameType::Page;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
nsPageFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("Page"), aResult);
}
#endif
@@ -730,21 +724,15 @@ nsPageBreakFrame::Reflow(nsPresContext*
aDesiredSize.SetSize(wm, finalSize);
// Note: not using NS_FRAME_FIRST_REFLOW here, since it's not clear whether
// DidReflow will always get called before the next Reflow() call.
mHaveReflowed = true;
aStatus.Reset();
}
-nsIAtom*
-nsPageBreakFrame::GetType_() const
-{
- return FrameType::PageBreak;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
nsPageBreakFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("PageBreak"), aResult);
}
#endif
--- a/layout/generic/nsPageFrame.h
+++ b/layout/generic/nsPageFrame.h
@@ -27,23 +27,16 @@ public:
ReflowOutput& aDesiredSize,
const ReflowInput& aMaxSize,
nsReflowStatus& aStatus) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::pageFrame
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
//////////////////
// For Printing
//////////////////
@@ -106,22 +99,20 @@ protected:
class nsPageBreakFrame : public nsLeafFrame
{
NS_DECL_FRAMEARENA_HELPERS
explicit nsPageBreakFrame(nsStyleContext* aContext);
~nsPageBreakFrame();
- virtual void Reflow(nsPresContext* aPresContext,
- ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowInput,
- nsReflowStatus& aStatus) override;
-
- virtual nsIAtom* GetType_() const override;
+ virtual void Reflow(nsPresContext* aPresContext,
+ ReflowOutput& aDesiredSize,
+ const ReflowInput& aReflowInput,
+ nsReflowStatus& aStatus) override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
protected:
virtual nscoord GetIntrinsicISize() override;
--- a/layout/generic/nsPlaceholderFrame.cpp
+++ b/layout/generic/nsPlaceholderFrame.cpp
@@ -169,22 +169,16 @@ nsPlaceholderFrame::DestroyFrom(nsIFrame
fm->RemoveFrame(listId, oof);
}
// else oof will be destroyed by its parent
}
nsFrame::DestroyFrom(aDestructRoot);
}
-nsIAtom*
-nsPlaceholderFrame::GetType_() const
-{
- return FrameType::Placeholder;
-}
-
/* virtual */ bool
nsPlaceholderFrame::CanContinueTextRun() const
{
if (!mOutOfFlowFrame) {
return false;
}
// first-letter frames can continue text runs, and placeholders for floated
// first-letter frames can too
@@ -220,17 +214,17 @@ nsPlaceholderFrame::GetParentStyleContex
*aProviderFrame = parentFrame;
return parentFrame->StyleContext();
}
// Lie about our pseudo so we can step out of all anon boxes and
// pseudo-elements. The other option would be to reimplement the
// {ib} split gunk here.
*aProviderFrame = CorrectStyleParentFrame(parentFrame,
- FrameType::Placeholder);
+ nsGkAtoms::placeholderFrame);
return *aProviderFrame ? (*aProviderFrame)->StyleContext() : nullptr;
}
#ifdef DEBUG
static void
PaintDebugPlaceholder(nsIFrame* aFrame, DrawTarget* aDrawTarget,
const nsRect& aDirtyRect, nsPoint aPt)
--- a/layout/generic/nsPlaceholderFrame.h
+++ b/layout/generic/nsPlaceholderFrame.h
@@ -111,23 +111,16 @@ public:
const nsDisplayListSet& aLists) override;
#endif // DEBUG || (MOZ_REFLOW_PERF_DSP && MOZ_REFLOW_PERF)
#ifdef DEBUG_FRAME_DUMP
void List(FILE* out = stderr, const char* aPrefix = "", uint32_t aFlags = 0) const override;
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif // DEBUG
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::placeholderFrame
- */
- virtual nsIAtom* GetType_() const override;
-
virtual bool IsEmpty() override { return true; }
virtual bool IsSelfEmpty() override { return true; }
virtual bool CanContinueTextRun() const override;
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() override
{
@@ -149,27 +142,27 @@ public:
}
/**
* @return the out-of-flow for aFrame if aFrame is a placeholder; otherwise
* aFrame
*/
static nsIFrame* GetRealFrameFor(nsIFrame* aFrame) {
NS_PRECONDITION(aFrame, "Must have a frame to work with");
- if (aFrame->GetType() == nsGkAtoms::placeholderFrame) {
+ if (aFrame->IsPlaceholderFrame()) {
return GetRealFrameForPlaceholder(aFrame);
}
return aFrame;
}
/**
* @return the out-of-flow for aFrame, which is known to be a placeholder
*/
static nsIFrame* GetRealFrameForPlaceholder(nsIFrame* aFrame) {
- NS_PRECONDITION(aFrame->GetType() == nsGkAtoms::placeholderFrame,
+ NS_PRECONDITION(aFrame->IsPlaceholderFrame(),
"Must have placeholder frame as input");
nsIFrame* outOfFlow =
static_cast<nsPlaceholderFrame*>(aFrame)->GetOutOfFlowFrame();
NS_ASSERTION(outOfFlow, "Null out-of-flow for placeholder?");
return outOfFlow;
}
protected:
--- a/layout/generic/nsPluginFrame.cpp
+++ b/layout/generic/nsPluginFrame.cpp
@@ -235,22 +235,16 @@ nsPluginFrame::DidSetStyleContext(nsStyl
IsHidden() ? nsViewVisibility_kHide : nsViewVisibility_kShow;
vm->SetViewVisibility(view, visibility);
}
}
nsFrame::DidSetStyleContext(aOldStyleContext);
}
-nsIAtom*
-nsPluginFrame::GetType_() const
-{
- return FrameType::Object;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
nsPluginFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("PluginFrame"), aResult);
}
#endif
--- a/layout/generic/nsPluginFrame.h
+++ b/layout/generic/nsPluginFrame.h
@@ -83,18 +83,16 @@ public:
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) override;
- virtual nsIAtom* GetType_() const override;
-
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsFrame::IsFrameOfType(aFlags &
~(nsIFrame::eReplaced | nsIFrame::eReplacedSizing));
}
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
--- a/layout/generic/nsRubyBaseContainerFrame.cpp
+++ b/layout/generic/nsRubyBaseContainerFrame.cpp
@@ -43,22 +43,16 @@ NS_NewRubyBaseContainerFrame(nsIPresShel
}
//----------------------------------------------------------------------
// nsRubyBaseContainerFrame Method Implementations
// ===============================================
-nsIAtom*
-nsRubyBaseContainerFrame::GetType_() const
-{
- return FrameType::RubyBaseContainer;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
nsRubyBaseContainerFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("RubyBaseContainer"), aResult);
}
#endif
@@ -69,17 +63,17 @@ LineBreakBefore(nsIFrame* aFrame,
const nsLineList::iterator* aLine)
{
for (nsIFrame* child = aFrame; child;
child = child->PrincipalChildList().FirstChild()) {
if (!child->CanContinueTextRun()) {
// It is not an inline element. We can break before it.
return gfxBreakPriority::eNormalBreak;
}
- if (child->GetType() != FrameType::Text) {
+ if (!child->IsTextFrame()) {
continue;
}
auto textFrame = static_cast<nsTextFrame*>(child);
gfxSkipCharsIterator iter =
textFrame->EnsureTextRun(nsTextFrame::eInflated, aDrawTarget,
aLineContainerFrame, aLine);
iter.SetOriginalOffset(textFrame->GetContentOffset());
--- a/layout/generic/nsRubyBaseContainerFrame.h
+++ b/layout/generic/nsRubyBaseContainerFrame.h
@@ -22,17 +22,16 @@ nsContainerFrame* NS_NewRubyBaseContaine
class nsRubyBaseContainerFrame final : public nsContainerFrame
{
public:
NS_DECL_FRAMEARENA_HELPERS
NS_DECL_QUERYFRAME_TARGET(nsRubyBaseContainerFrame)
NS_DECL_QUERYFRAME
// nsIFrame overrides
- virtual nsIAtom* GetType_() const override;
virtual bool IsFrameOfType(uint32_t aFlags) const override;
virtual bool CanContinueTextRun() const override;
virtual void AddInlineMinISize(nsRenderingContext *aRenderingContext,
InlineMinISizeData *aData) override;
virtual void AddInlinePrefISize(nsRenderingContext *aRenderingContext,
InlinePrefISizeData *aData) override;
virtual mozilla::LogicalSize
ComputeSize(nsRenderingContext *aRenderingContext,
--- a/layout/generic/nsRubyBaseFrame.cpp
+++ b/layout/generic/nsRubyBaseFrame.cpp
@@ -34,21 +34,15 @@ NS_NewRubyBaseFrame(nsIPresShell* aPresS
}
//----------------------------------------------------------------------
// nsRubyBaseFrame Method Implementations
// ======================================
-nsIAtom*
-nsRubyBaseFrame::GetType_() const
-{
- return FrameType::RubyBase;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
nsRubyBaseFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("RubyBase"), aResult);
}
#endif
--- a/layout/generic/nsRubyBaseFrame.h
+++ b/layout/generic/nsRubyBaseFrame.h
@@ -20,19 +20,16 @@ nsContainerFrame* NS_NewRubyBaseFrame(ns
class nsRubyBaseFrame final : public nsRubyContentFrame
{
public:
NS_DECL_FRAMEARENA_HELPERS
NS_DECL_QUERYFRAME_TARGET(nsRubyBaseFrame)
NS_DECL_QUERYFRAME
- // nsIFrame overrides
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
protected:
friend nsContainerFrame* NS_NewRubyBaseFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
explicit nsRubyBaseFrame(nsStyleContext* aContext)
--- a/layout/generic/nsRubyFrame.cpp
+++ b/layout/generic/nsRubyFrame.cpp
@@ -37,22 +37,16 @@ NS_NewRubyFrame(nsIPresShell* aPresShell
return new (aPresShell) nsRubyFrame(aContext);
}
//----------------------------------------------------------------------
// nsRubyFrame Method Implementations
// ==================================
-nsIAtom*
-nsRubyFrame::GetType_() const
-{
- return FrameType::Ruby;
-}
-
/* virtual */ bool
nsRubyFrame::IsFrameOfType(uint32_t aFlags) const
{
if (aFlags & eBidiInlineContainer) {
return false;
}
return nsInlineFrame::IsFrameOfType(aFlags);
}
--- a/layout/generic/nsRubyFrame.h
+++ b/layout/generic/nsRubyFrame.h
@@ -22,17 +22,16 @@ nsContainerFrame* NS_NewRubyFrame(nsIPre
class nsRubyFrame final : public nsInlineFrame
{
public:
NS_DECL_FRAMEARENA_HELPERS
NS_DECL_QUERYFRAME_TARGET(nsRubyFrame)
NS_DECL_QUERYFRAME
// nsIFrame overrides
- virtual nsIAtom* GetType_() const override;
virtual bool IsFrameOfType(uint32_t aFlags) const override;
virtual void AddInlineMinISize(nsRenderingContext *aRenderingContext,
InlineMinISizeData *aData) override;
virtual void AddInlinePrefISize(nsRenderingContext *aRenderingContext,
InlinePrefISizeData *aData) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
--- a/layout/generic/nsRubyTextContainerFrame.cpp
+++ b/layout/generic/nsRubyTextContainerFrame.cpp
@@ -35,22 +35,16 @@ NS_NewRubyTextContainerFrame(nsIPresShel
}
//----------------------------------------------------------------------
// nsRubyTextContainerFrame Method Implementations
// ===============================================
-nsIAtom*
-nsRubyTextContainerFrame::GetType_() const
-{
- return FrameType::RubyTextContainer;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
nsRubyTextContainerFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("RubyTextContainer"), aResult);
}
#endif
--- a/layout/generic/nsRubyTextContainerFrame.h
+++ b/layout/generic/nsRubyTextContainerFrame.h
@@ -21,17 +21,16 @@ nsContainerFrame* NS_NewRubyTextContaine
class nsRubyTextContainerFrame final : public nsContainerFrame
{
public:
NS_DECL_FRAMEARENA_HELPERS
NS_DECL_QUERYFRAME_TARGET(nsRubyTextContainerFrame)
NS_DECL_QUERYFRAME
// nsIFrame overrides
- virtual nsIAtom* GetType_() const override;
virtual bool IsFrameOfType(uint32_t aFlags) const override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
--- a/layout/generic/nsRubyTextFrame.cpp
+++ b/layout/generic/nsRubyTextFrame.cpp
@@ -34,22 +34,16 @@ NS_NewRubyTextFrame(nsIPresShell* aPresS
}
//----------------------------------------------------------------------
// nsRubyTextFrame Method Implementations
// ======================================
-nsIAtom*
-nsRubyTextFrame::GetType_() const
-{
- return FrameType::RubyText;
-}
-
/* virtual */ bool
nsRubyTextFrame::CanContinueTextRun() const
{
return false;
}
#ifdef DEBUG_FRAME_DUMP
nsresult
--- a/layout/generic/nsRubyTextFrame.h
+++ b/layout/generic/nsRubyTextFrame.h
@@ -21,17 +21,16 @@ nsContainerFrame* NS_NewRubyTextFrame(ns
class nsRubyTextFrame final : public nsRubyContentFrame
{
public:
NS_DECL_FRAMEARENA_HELPERS
NS_DECL_QUERYFRAME_TARGET(nsRubyTextFrame)
NS_DECL_QUERYFRAME
// nsIFrame overrides
- virtual nsIAtom* GetType_() const override;
virtual bool CanContinueTextRun() const override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
--- a/layout/generic/nsSimplePageSequenceFrame.cpp
+++ b/layout/generic/nsSimplePageSequenceFrame.cpp
@@ -859,22 +859,16 @@ nsSimplePageSequenceFrame::BuildDisplayL
content.AppendNewToTop(new (aBuilder)
nsDisplayTransform(aBuilder, this, &content, content.GetVisibleRect(),
::ComputePageSequenceTransform));
aLists.Content()->AppendToTop(&content);
}
-nsIAtom*
-nsSimplePageSequenceFrame::GetType_() const
-{
- return FrameType::Sequence;
-}
-
//------------------------------------------------------------------------------
void
nsSimplePageSequenceFrame::SetPageNumberFormat(const nsAString& aFormatStr, bool aForPageNumOnly)
{
NS_ASSERTION(mPageData != nullptr, "mPageData string cannot be null!");
if (aForPageNumOnly) {
mPageData->mPageNumFormat = aFormatStr;
--- a/layout/generic/nsSimplePageSequenceFrame.h
+++ b/layout/generic/nsSimplePageSequenceFrame.h
@@ -93,23 +93,16 @@ public:
NS_IMETHOD DoPageEnd() override;
// We must allow Print Preview UI to have a background, no matter what the
// user's settings
bool HonorPrintBackgroundSettings() override { return false; }
bool HasTransformGetter() const override { return true; }
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::sequenceFrame
- */
- nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
nsresult GetFrameName(nsAString& aResult) const override;
#endif
protected:
explicit nsSimplePageSequenceFrame(nsStyleContext* aContext);
virtual ~nsSimplePageSequenceFrame();
--- a/layout/generic/nsSplittableFrame.cpp
+++ b/layout/generic/nsSplittableFrame.cpp
@@ -49,31 +49,34 @@ nsSplittableFrame::GetSplittableType() c
nsIFrame* nsSplittableFrame::GetPrevContinuation() const
{
return mPrevContinuation;
}
void
nsSplittableFrame::SetPrevContinuation(nsIFrame* aFrame)
{
- NS_ASSERTION (!aFrame || GetType() == aFrame->GetType(), "setting a prev continuation with incorrect type!");
- NS_ASSERTION (!IsInPrevContinuationChain(aFrame, this), "creating a loop in continuation chain!");
+ NS_ASSERTION(!aFrame || Type() == aFrame->Type(),
+ "setting a prev continuation with incorrect type!");
+ NS_ASSERTION(!IsInPrevContinuationChain(aFrame, this),
+ "creating a loop in continuation chain!");
mPrevContinuation = aFrame;
RemoveStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
}
nsIFrame* nsSplittableFrame::GetNextContinuation() const
{
return mNextContinuation;
}
void
nsSplittableFrame::SetNextContinuation(nsIFrame* aFrame)
{
- NS_ASSERTION (!aFrame || GetType() == aFrame->GetType(), "setting a next continuation with incorrect type!");
+ NS_ASSERTION(!aFrame || Type() == aFrame->Type(),
+ "setting a next continuation with incorrect type!");
NS_ASSERTION (!IsInNextContinuationChain(aFrame, this), "creating a loop in continuation chain!");
mNextContinuation = aFrame;
if (aFrame)
aFrame->RemoveStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
}
nsIFrame*
nsSplittableFrame::FirstContinuation() const
@@ -128,33 +131,37 @@ bool nsSplittableFrame::IsInNextContinua
nsIFrame* nsSplittableFrame::GetPrevInFlow() const
{
return (GetStateBits() & NS_FRAME_IS_FLUID_CONTINUATION) ? mPrevContinuation : nullptr;
}
void
nsSplittableFrame::SetPrevInFlow(nsIFrame* aFrame)
{
- NS_ASSERTION (!aFrame || GetType() == aFrame->GetType(), "setting a prev in flow with incorrect type!");
- NS_ASSERTION (!IsInPrevContinuationChain(aFrame, this), "creating a loop in continuation chain!");
+ NS_ASSERTION(!aFrame || Type() == aFrame->Type(),
+ "setting a prev in flow with incorrect type!");
+ NS_ASSERTION(!IsInPrevContinuationChain(aFrame, this),
+ "creating a loop in continuation chain!");
mPrevContinuation = aFrame;
AddStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
}
nsIFrame* nsSplittableFrame::GetNextInFlow() const
{
return mNextContinuation && (mNextContinuation->GetStateBits() & NS_FRAME_IS_FLUID_CONTINUATION) ?
mNextContinuation : nullptr;
}
void
nsSplittableFrame::SetNextInFlow(nsIFrame* aFrame)
{
- NS_ASSERTION (!aFrame || GetType() == aFrame->GetType(), "setting a next in flow with incorrect type!");
- NS_ASSERTION (!IsInNextContinuationChain(aFrame, this), "creating a loop in continuation chain!");
+ NS_ASSERTION(!aFrame || Type() == aFrame->Type(),
+ "setting a next in flow with incorrect type!");
+ NS_ASSERTION(!IsInNextContinuationChain(aFrame, this),
+ "creating a loop in continuation chain!");
mNextContinuation = aFrame;
if (aFrame)
aFrame->AddStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
}
nsIFrame*
nsSplittableFrame::FirstInFlow() const
{
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -615,22 +615,16 @@ nsSubDocumentFrame::List(FILE* out, cons
}
nsresult nsSubDocumentFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("FrameOuter"), aResult);
}
#endif
-nsIAtom*
-nsSubDocumentFrame::GetType_() const
-{
- return FrameType::SubDocument;
-}
-
/* virtual */ nscoord
nsSubDocumentFrame::GetMinISize(nsRenderingContext *aRenderingContext)
{
nscoord result;
DISPLAY_MIN_WIDTH(this, result);
nsIFrame* subDocRoot = ObtainIntrinsicSizeFrame();
if (subDocRoot) {
@@ -1083,17 +1077,17 @@ InsertViewsInReverseOrder(nsView* aSibli
vm->InsertChild(aParent, aSibling, nullptr, true);
aSibling = next;
}
}
nsresult
nsSubDocumentFrame::BeginSwapDocShells(nsIFrame* aOther)
{
- if (!aOther || aOther->GetType() != FrameType::SubDocument) {
+ if (!aOther || !aOther->IsSubDocumentFrame()) {
return NS_ERROR_NOT_IMPLEMENTED;
}
nsSubDocumentFrame* other = static_cast<nsSubDocumentFrame*>(aOther);
if (!mFrameLoader || !mDidCreateDoc || mCallingShow ||
!other->mFrameLoader || !other->mDidCreateDoc) {
return NS_ERROR_NOT_IMPLEMENTED;
}
--- a/layout/generic/nsSubDocumentFrame.h
+++ b/layout/generic/nsSubDocumentFrame.h
@@ -26,18 +26,16 @@ public:
#ifdef DEBUG_FRAME_DUMP
void List(FILE* out = stderr, const char* aPrefix = "", uint32_t aFlags = 0) const override;
nsresult GetFrameName(nsAString& aResult) const override;
#endif
NS_DECL_QUERYFRAME
- nsIAtom* GetType_() const override;
-
bool IsFrameOfType(uint32_t aFlags) const override
{
return nsAtomicContainerFrame::IsFrameOfType(aFlags &
~(nsIFrame::eReplaced |
nsIFrame::eReplacedSizing |
nsIFrame::eReplacedContainsBlock));
}
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -1233,24 +1233,22 @@ struct FrameTextTraversal {
} else {
f = nullptr;
}
return f;
}
};
static FrameTextTraversal
-CanTextCrossFrameBoundary(nsIFrame* aFrame, nsIAtom* aType)
-{
- NS_ASSERTION(aType == aFrame->GetType(), "Wrong type");
-
+CanTextCrossFrameBoundary(nsIFrame* aFrame)
+{
FrameTextTraversal result;
bool continuesTextRun = aFrame->CanContinueTextRun();
- if (aType == FrameType::Placeholder) {
+ if (aFrame->IsPlaceholderFrame()) {
// placeholders are "invisible", so a text run should be able to span
// across one. But don't descend into the out-of-flow.
result.mLineBreakerCanCrossFrameBoundary = true;
result.mOverflowFrameToScan = nullptr;
if (continuesTextRun) {
// ... Except for first-letter floats, which are really in-flow
// from the point of view of capitalization etc, so we'd better
// descend into them. But we actually need to break the textrun for
@@ -1271,17 +1269,17 @@ CanTextCrossFrameBoundary(nsIFrame* aFra
aFrame->GetChildList(nsIFrame::kOverflowList).FirstChild();
NS_WARNING_ASSERTION(
!result.mOverflowFrameToScan,
"Scanning overflow inline frames is something we should avoid");
result.mScanSiblings = true;
result.mTextRunCanCrossFrameBoundary = true;
result.mLineBreakerCanCrossFrameBoundary = true;
} else {
- MOZ_ASSERT(aType != FrameType::RubyTextContainer,
+ MOZ_ASSERT(!aFrame->IsRubyTextContainerFrame(),
"Shouldn't call this method for ruby text container");
result.mFrameToScan = nullptr;
result.mOverflowFrameToScan = nullptr;
result.mTextRunCanCrossFrameBoundary = false;
result.mLineBreakerCanCrossFrameBoundary = false;
}
}
return result;
@@ -1328,18 +1326,17 @@ BuildTextRunsScanner::FindBoundaries(nsI
aState->mSeenSpaceForLineBreakingOnThisLine = true;
if (aState->mSeenTextRunBoundaryOnLaterLine)
return FB_FOUND_VALID_TEXTRUN_BOUNDARY;
}
}
return FB_CONTINUE;
}
- FrameTextTraversal traversal =
- CanTextCrossFrameBoundary(aFrame, frameType);
+ FrameTextTraversal traversal = CanTextCrossFrameBoundary(aFrame);
if (!traversal.mTextRunCanCrossFrameBoundary) {
aState->mSeenTextRunBoundaryOnThisLine = true;
if (aState->mSeenSpaceForLineBreakingOnThisLine)
return FB_FOUND_VALID_TEXTRUN_BOUNDARY;
}
for (nsIFrame* f = traversal.NextFrameToScan(); f;
f = traversal.NextFrameToScan()) {
@@ -1414,18 +1411,17 @@ BuildTextRuns(DrawTarget* aDrawTarget, n
aLineContainer, aWhichTextRun);
nsBlockFrame* block = nsLayoutUtils::GetAsBlock(aLineContainer);
if (!block) {
nsIFrame* textRunContainer = aLineContainer;
if (aLineContainer->IsRubyTextContainerFrame()) {
textRunContainer = aForFrame;
- while (textRunContainer &&
- textRunContainer->GetType() != FrameType::RubyText) {
+ while (textRunContainer && !textRunContainer->IsRubyTextFrame()) {
textRunContainer = textRunContainer->GetParent();
}
MOZ_ASSERT(textRunContainer &&
textRunContainer->GetParent() == aLineContainer);
} else {
NS_ASSERTION(
!aLineContainer->GetPrevInFlow() && !aLineContainer->GetNextInFlow(),
"Breakable non-block line containers other than "
@@ -1894,18 +1890,17 @@ void BuildTextRunsScanner::ScanFrame(nsI
AccumulateRunInfo(frame);
if (mMappedFlows.Length() == 1) {
mCurrentFramesAllSameTextRun = frame->GetTextRun(mWhichTextRun);
mCurrentRunContextInfo = mNextRunContextInfo;
}
return;
}
- FrameTextTraversal traversal =
- CanTextCrossFrameBoundary(aFrame, frameType);
+ FrameTextTraversal traversal = CanTextCrossFrameBoundary(aFrame);
bool isBR = frameType == FrameType::Br;
if (!traversal.mLineBreakerCanCrossFrameBoundary) {
// BR frames are special. We do not need or want to record a break opportunity
// before a BR frame.
FlushFrames(true, isBR);
mCommonAncestorWithLastFrame = aFrame;
mNextRunContextInfo &= ~nsTextFrameUtils::INCOMING_WHITESPACE;
mStartOfLine = false;
@@ -4323,31 +4318,31 @@ public:
void DestroyFrom(nsIFrame* aDestructRoot) override;
nsTextFrame* GetPrevContinuation() const override
{
return mPrevContinuation;
}
void SetPrevContinuation(nsIFrame* aPrevContinuation) override
{
- NS_ASSERTION (!aPrevContinuation || GetType() == aPrevContinuation->GetType(),
+ NS_ASSERTION (!aPrevContinuation || Type() == aPrevContinuation->Type(),
"setting a prev continuation with incorrect type!");
NS_ASSERTION (!nsSplittableFrame::IsInPrevContinuationChain(aPrevContinuation, this),
"creating a loop in continuation chain!");
mPrevContinuation = static_cast<nsTextFrame*>(aPrevContinuation);
RemoveStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
}
nsIFrame* GetPrevInFlowVirtual() const override { return GetPrevInFlow(); }
nsTextFrame* GetPrevInFlow() const
{
return (GetStateBits() & NS_FRAME_IS_FLUID_CONTINUATION) ? mPrevContinuation : nullptr;
}
void SetPrevInFlow(nsIFrame* aPrevInFlow) override
{
- NS_ASSERTION (!aPrevInFlow || GetType() == aPrevInFlow->GetType(),
+ NS_ASSERTION (!aPrevInFlow || Type() == aPrevInFlow->Type(),
"setting a prev in flow with incorrect type!");
NS_ASSERTION (!nsSplittableFrame::IsInPrevContinuationChain(aPrevInFlow, this),
"creating a loop in continuation chain!");
mPrevContinuation = static_cast<nsTextFrame*>(aPrevInFlow);
AddStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
}
nsIFrame* FirstInFlow() const override;
nsIFrame* FirstContinuation() const override;
@@ -5460,17 +5455,17 @@ nsTextFrame::GetTextDecorations(
}
}
static float
GetInflationForTextDecorations(nsIFrame* aFrame, nscoord aInflationMinFontSize)
{
if (nsSVGUtils::IsInSVGTextSubtree(aFrame)) {
const nsIFrame* container = aFrame;
- while (container->GetType() != FrameType::SVGText) {
+ while (!container->IsSVGTextFrame()) {
container = container->GetParent();
}
NS_ASSERTION(container, "expected to find an ancestor SVGTextFrame");
return
static_cast<const SVGTextFrame*>(container)->GetFontSizeScaleFactor();
}
return nsLayoutUtils::FontSizeInflationInner(aFrame, aInflationMinFontSize);
}
@@ -8875,17 +8870,17 @@ nsTextFrame::SetLength(int32_t aLength,
(end != f->mContentOffset || (f->GetStateBits() & NS_FRAME_IS_DIRTY))) {
aLineLayout->SetDirtyNextLine();
}
if (end < f->mContentOffset) {
// Our frame is shrinking. Give the text to our next in flow.
if (aLineLayout &&
HasSignificantTerminalNewline() &&
- GetParent()->GetType() != FrameType::Letter &&
+ !GetParent()->IsLetterFrame() &&
(aSetLengthFlags & ALLOW_FRAME_CREATION_AND_DESTRUCTION)) {
// Whatever text we hand to our next-in-flow will end up in a frame all of
// its own, since it ends in a forced linebreak. Might as well just put
// it in a separate frame now. This is important to prevent text run
// churn; if we did not do that, then we'd likely end up rebuilding
// textruns for all our following continuations.
// We skip this optimization when the parent is a first-letter frame
// because it doesn't deal well with more than one child frame.
@@ -9975,22 +9970,16 @@ nsTextFrame::GetRenderedText(uint32_t aS
if (!haveOffsets) {
result.mOffsetWithinNodeText = textFrag->GetLength();
result.mOffsetWithinNodeRenderedText = offsetInRenderedString;
}
return result;
}
-nsIAtom*
-nsTextFrame::GetType_() const
-{
- return FrameType::Text;
-}
-
/* virtual */ bool
nsTextFrame::IsEmpty()
{
NS_ASSERTION(!(mState & TEXT_IS_ONLY_WHITESPACE) ||
!(mState & TEXT_ISNOT_ONLY_WHITESPACE),
"Invalid state");
// XXXldb Should this check compatibility mode as well???
--- a/layout/generic/nsTextFrame.h
+++ b/layout/generic/nsTextFrame.h
@@ -77,18 +77,17 @@ public:
nsresult GetCursor(const nsPoint& aPoint, nsIFrame::Cursor& aCursor) override;
nsresult CharacterDataChanged(CharacterDataChangeInfo* aInfo) final;
nsTextFrame* GetPrevContinuation() const override { return nullptr; }
nsTextFrame* GetNextContinuation() const final { return mNextContinuation; }
void SetNextContinuation(nsIFrame* aNextContinuation) final
{
- NS_ASSERTION(!aNextContinuation ||
- GetType() == aNextContinuation->GetType(),
+ NS_ASSERTION(!aNextContinuation || Type() == aNextContinuation->Type(),
"setting a next continuation with incorrect type!");
NS_ASSERTION(
!nsSplittableFrame::IsInNextContinuationChain(aNextContinuation, this),
"creating a loop in continuation chain!");
mNextContinuation = static_cast<nsTextFrame*>(aNextContinuation);
if (aNextContinuation)
aNextContinuation->RemoveStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
// Setting a non-fluid continuation might affect our flow length (they're
@@ -101,17 +100,17 @@ public:
return mNextContinuation &&
(mNextContinuation->GetStateBits() &
NS_FRAME_IS_FLUID_CONTINUATION)
? mNextContinuation
: nullptr;
}
void SetNextInFlow(nsIFrame* aNextInFlow) final
{
- NS_ASSERTION(!aNextInFlow || GetType() == aNextInFlow->GetType(),
+ NS_ASSERTION(!aNextInFlow || Type() == aNextInFlow->Type(),
"setting a next in flow with incorrect type!");
NS_ASSERTION(
!nsSplittableFrame::IsInNextContinuationChain(aNextInFlow, this),
"creating a loop in continuation chain!");
mNextContinuation = static_cast<nsTextFrame*>(aNextInFlow);
if (mNextContinuation &&
!mNextContinuation->HasAnyStateBits(NS_FRAME_IS_FLUID_CONTINUATION)) {
// Changing from non-fluid to fluid continuation might affect our flow
@@ -125,38 +124,31 @@ public:
nsTextFrame* LastInFlow() const final;
nsTextFrame* LastContinuation() const final;
nsSplittableType GetSplittableType() const final
{
return NS_FRAME_SPLITTABLE;
}
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::textFrame
- */
- nsIAtom* GetType_() 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 nsFrame::IsFrameOfType(
aFlags & ~(nsIFrame::eReplaced | nsIFrame::eLineParticipant));
}
bool ShouldSuppressLineBreak() const
{
// If the parent frame of the text frame is ruby content box, it must
// suppress line break inside. This check is necessary, because when
// a whitespace is only contained by pseudo ruby frames, its style
// context won't have SuppressLineBreak bit set.
- if (mozilla::RubyUtils::IsRubyContentBox(GetParent()->GetType())) {
+ if (mozilla::RubyUtils::IsRubyContentBox(GetParent()->Type())) {
return true;
}
return StyleContext()->ShouldSuppressLineBreak();
}
void InvalidateFrame(uint32_t aDisplayItemKey = 0) override;
void InvalidateFrameWithRect(const nsRect& aRect,
uint32_t aDisplayItemKey = 0) override;
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -521,22 +521,16 @@ nsVideoFrame::BuildDisplayList(nsDisplay
} else if (child->IsBoxFrame()) {
child->BuildDisplayListForStackingContext(aBuilder,
aDirtyRect - child->GetOffsetTo(this),
aLists.Content());
}
}
}
-nsIAtom*
-nsVideoFrame::GetType_() const
-{
- return FrameType::HTMLVideo;
-}
-
#ifdef ACCESSIBILITY
a11y::AccType
nsVideoFrame::AccessibleType()
{
return a11y::eHTMLMediaType;
}
#endif
--- a/layout/generic/nsVideoFrame.h
+++ b/layout/generic/nsVideoFrame.h
@@ -76,18 +76,16 @@ public:
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
#ifdef ACCESSIBILITY
mozilla::a11y::AccType AccessibleType() override;
#endif
- nsIAtom* GetType_() const override;
-
bool IsFrameOfType(uint32_t aFlags) const override
{
return nsSplittableFrame::IsFrameOfType(aFlags &
~(nsIFrame::eReplaced | nsIFrame::eReplacedSizing));
}
nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -580,30 +580,30 @@ MapAllAttributesIntoCSS(nsMathMLmtableFr
ParseFrameAttribute(aTableFrame, nsGkAtoms::columnalign_, true);
ParseFrameAttribute(aTableFrame, nsGkAtoms::columnlines_, true);
// Map mtable rowspacing, columnspacing & framespacing
ParseSpacingAttributes(aTableFrame);
// mtable is simple and only has one (pseudo) row-group
nsIFrame* rgFrame = aTableFrame->PrincipalChildList().FirstChild();
- if (!rgFrame || rgFrame->GetType() != FrameType::TableRowGroup)
+ if (!rgFrame || !rgFrame->IsTableRowGroupFrame())
return;
for (nsIFrame* rowFrame : rgFrame->PrincipalChildList()) {
DEBUG_VERIFY_THAT_FRAME_IS(rowFrame, TableRow);
if (rowFrame->IsTableRowFrame()) {
// Map row rowalign.
ParseFrameAttribute(rowFrame, nsGkAtoms::rowalign_, false);
// Map row columnalign.
ParseFrameAttribute(rowFrame, nsGkAtoms::columnalign_, true);
for (nsIFrame* cellFrame : rowFrame->PrincipalChildList()) {
DEBUG_VERIFY_THAT_FRAME_IS(cellFrame, TableCell);
- if (IS_TABLE_CELL(cellFrame->GetType())) {
+ if (IS_TABLE_CELL(cellFrame->Type())) {
// Map cell rowalign.
ParseFrameAttribute(cellFrame, nsGkAtoms::rowalign_, false);
// Map row columnalign.
ParseFrameAttribute(cellFrame, nsGkAtoms::columnalign_, false);
}
}
}
}
@@ -726,17 +726,17 @@ nsMathMLmtableWrapperFrame::AttributeCha
// columnlines : here
// columnspacing : here
// mtable is simple and only has one (pseudo) row-group inside our inner-table
nsIFrame* tableFrame = mFrames.FirstChild();
NS_ASSERTION(tableFrame && tableFrame->IsTableFrame(),
"should always have an inner table frame");
nsIFrame* rgFrame = tableFrame->PrincipalChildList().FirstChild();
- if (!rgFrame || rgFrame->GetType() != FrameType::TableRowGroup)
+ if (!rgFrame || !rgFrame->IsTableRowGroupFrame())
return NS_OK;
// align - just need to issue a dirty (resize) reflow command
if (aAttribute == nsGkAtoms::align) {
PresContext()->PresShell()->
FrameNeedsReflow(this, nsIPresShell::eResize, NS_FRAME_IS_DIRTY);
return NS_OK;
}
@@ -799,22 +799,22 @@ nsMathMLmtableWrapperFrame::GetRowFrameA
}
// if our inner table says that the index is valid, find the row now
if (0 <= aRowIndex && aRowIndex <= rowCount) {
nsIFrame* tableFrame = mFrames.FirstChild();
NS_ASSERTION(tableFrame && tableFrame->IsTableFrame(),
"should always have an inner table frame");
nsIFrame* rgFrame = tableFrame->PrincipalChildList().FirstChild();
- if (!rgFrame || rgFrame->GetType() != FrameType::TableRowGroup)
+ if (!rgFrame || !rgFrame->IsTableRowGroupFrame())
return nullptr;
for (nsIFrame* rowFrame : rgFrame->PrincipalChildList()) {
if (aRowIndex == 0) {
DEBUG_VERIFY_THAT_FRAME_IS(rowFrame, TableRow);
- if (rowFrame->GetType() != FrameType::TableRow)
+ if (!rowFrame->IsTableRowFrame())
return nullptr;
return rowFrame;
}
--aRowIndex;
}
}
return nullptr;
--- a/layout/painting/nsCSSRendering.cpp
+++ b/layout/painting/nsCSSRendering.cpp
@@ -2130,17 +2130,17 @@ nsCSSRendering::GetImageLayerClip(const
aClipState->mHasRoundedCorners = false;
aClipState->mHasAdditionalBGClipArea = false;
aClipState->mAdditionalBGClipArea.SetEmpty();
aClipState->mCustomClip = false;
StyleGeometryBox layerClip = ComputeBoxValue(aForFrame, aLayer.mClip);
if (IsSVGStyleGeometryBox(layerClip)) {
MOZ_ASSERT(aForFrame->IsFrameOfType(nsIFrame::eSVG) &&
- (aForFrame->GetType() != FrameType::SVGOuterSVG));
+ !aForFrame->IsSVGOuterSVGFrame());
// The coordinate space of clipArea is svg user space.
nsRect clipArea =
nsLayoutUtils::ComputeGeometryBox(aForFrame, layerClip);
nsRect strokeBox = (layerClip == StyleGeometryBox::StrokeBox)
? clipArea
: nsLayoutUtils::ComputeGeometryBox(aForFrame, StyleGeometryBox::StrokeBox);
@@ -2783,17 +2783,17 @@ nsCSSRendering::ComputeImageLayerPositio
// may need it to compute the effective image size for a CSS gradient.
nsRect positionArea;
StyleGeometryBox layerOrigin =
ComputeBoxValue(aForFrame, aLayer.mOrigin);
if (IsSVGStyleGeometryBox(layerOrigin)) {
MOZ_ASSERT(aForFrame->IsFrameOfType(nsIFrame::eSVG) &&
- (aForFrame->GetType() != FrameType::SVGOuterSVG));
+ !aForFrame->IsSVGOuterSVGFrame());
*aAttachedToFrame = aForFrame;
positionArea =
nsLayoutUtils::ComputeGeometryBox(aForFrame, layerOrigin);
nsPoint toStrokeBoxOffset = nsPoint(0, 0);
if (layerOrigin != StyleGeometryBox::StrokeBox) {
nsRect strokeBox =
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -1452,17 +1452,17 @@ IsStickyFrameActive(nsDisplayListBuilder
MOZ_ASSERT(aFrame->StyleDisplay()->mPosition == NS_STYLE_POSITION_STICKY);
// Find the nearest scrollframe.
nsIFrame* cursor = aFrame;
nsIFrame* parent = aParent;
if (!parent) {
parent = nsLayoutUtils::GetCrossDocParentFrame(aFrame);
}
- while (parent->GetType() != FrameType::Scroll) {
+ while (!parent->IsScrollFrame()) {
cursor = parent;
if ((parent = nsLayoutUtils::GetCrossDocParentFrame(cursor)) == nullptr) {
return false;
}
}
nsIScrollableFrame* sf = do_QueryFrame(parent);
return sf->IsScrollingActive(aBuilder) && sf->GetScrolledFrame() == cursor;
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -4978,17 +4978,17 @@ nsComputedDOMStyle::DoGetHeight()
if (mInnerFrame) {
calcHeight = true;
const nsStyleDisplay* displayData = StyleDisplay();
if (displayData->mDisplay == mozilla::StyleDisplay::Inline &&
!(mInnerFrame->IsFrameOfType(nsIFrame::eReplaced)) &&
// An outer SVG frame should behave the same as eReplaced in this case
- mInnerFrame->GetType() != FrameType::SVGOuterSVG) {
+ !mInnerFrame->IsSVGOuterSVGFrame()) {
calcHeight = false;
}
}
if (calcHeight) {
AssertFlushedPendingReflows();
nsMargin adjustedValues = GetAdjustedValuesForBoxSizing();
@@ -5022,17 +5022,17 @@ nsComputedDOMStyle::DoGetWidth()
if (mInnerFrame) {
calcWidth = true;
const nsStyleDisplay *displayData = StyleDisplay();
if (displayData->mDisplay == mozilla::StyleDisplay::Inline &&
!(mInnerFrame->IsFrameOfType(nsIFrame::eReplaced)) &&
// An outer SVG frame should behave the same as eReplaced in this case
- mInnerFrame->GetType() != FrameType::SVGOuterSVG) {
+ !mInnerFrame->IsSVGOuterSVGFrame()) {
calcWidth = false;
}
}
if (calcWidth) {
AssertFlushedPendingReflows();
nsMargin adjustedValues = GetAdjustedValuesForBoxSizing();
@@ -5089,23 +5089,22 @@ nsComputedDOMStyle::ShouldHonorMinSizeAu
// Note: We only need to bother checking one "overflow" subproperty for
// "visible", because a non-"visible" value in either axis would force the
// other axis to also be non-"visible" as well.
if (mOuterFrame) {
nsIFrame* containerFrame = mOuterFrame->GetParent();
if (containerFrame &&
StyleDisplay()->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE) {
- auto containerType = containerFrame->GetType();
- if (containerType == FrameType::FlexContainer &&
+ if (containerFrame->IsFlexContainerFrame() &&
(static_cast<nsFlexContainerFrame*>(containerFrame)->IsHorizontal() ==
(aAxis == eAxisHorizontal))) {
return true;
}
- if (containerType == FrameType::GridContainer) {
+ if (containerFrame->IsGridContainerFrame()) {
return true;
}
}
}
return false;
}
already_AddRefed<CSSValue>
--- a/layout/style/nsStyleStructInlines.h
+++ b/layout/style/nsStyleStructInlines.h
@@ -77,58 +77,58 @@ nsStyleText::WordCanWrap(const nsIFrame*
return WordCanWrapStyle() && !nsSVGUtils::IsInSVGTextSubtree(aContextFrame);
}
bool
nsStyleDisplay::IsBlockInside(const nsIFrame* aContextFrame) const
{
NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame");
if (nsSVGUtils::IsInSVGTextSubtree(aContextFrame)) {
- return aContextFrame->GetType() == nsGkAtoms::blockFrame;
+ return aContextFrame->IsBlockFrame();
}
return IsBlockInsideStyle();
}
bool
nsStyleDisplay::IsBlockOutside(const nsIFrame* aContextFrame) const
{
NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame");
if (nsSVGUtils::IsInSVGTextSubtree(aContextFrame)) {
- return aContextFrame->GetType() == nsGkAtoms::blockFrame;
+ return aContextFrame->IsBlockFrame();
}
return IsBlockOutsideStyle();
}
bool
nsStyleDisplay::IsInlineOutside(const nsIFrame* aContextFrame) const
{
NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame");
if (nsSVGUtils::IsInSVGTextSubtree(aContextFrame)) {
- return aContextFrame->GetType() != nsGkAtoms::blockFrame;
+ return !aContextFrame->IsBlockFrame();
}
return IsInlineOutsideStyle();
}
bool
nsStyleDisplay::IsOriginalDisplayInlineOutside(const nsIFrame* aContextFrame) const
{
NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame");
if (nsSVGUtils::IsInSVGTextSubtree(aContextFrame)) {
- return aContextFrame->GetType() != nsGkAtoms::blockFrame;
+ return !aContextFrame->IsBlockFrame();
}
return IsOriginalDisplayInlineOutsideStyle();
}
mozilla::StyleDisplay
nsStyleDisplay::GetDisplay(const nsIFrame* aContextFrame) const
{
NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame");
if (nsSVGUtils::IsInSVGTextSubtree(aContextFrame) &&
mDisplay != mozilla::StyleDisplay::None) {
- return aContextFrame->GetType() == nsGkAtoms::blockFrame ?
+ return aContextFrame->IsBlockFrame() ?
mozilla::StyleDisplay::Block : mozilla::StyleDisplay::Inline;
}
return mDisplay;
}
bool
nsStyleDisplay::IsFloating(const nsIFrame* aContextFrame) const
{
--- a/layout/svg/SVGFEContainerFrame.cpp
+++ b/layout/svg/SVGFEContainerFrame.cpp
@@ -42,22 +42,16 @@ public:
}
#endif
#ifdef DEBUG
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
#endif
- /**
- * Get the "type" of the frame
- *
- * @see mozilla::FrameType::SVGFEContainer
- */
- virtual nsIAtom* GetType_() const override;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override {
// We don't maintain a visual overflow rect
return false;
@@ -81,22 +75,16 @@ SVGFEContainerFrame::Init(nsIContent*
NS_ASSERTION(aContent->IsNodeOfType(nsINode::eFILTER),
"Trying to construct an SVGFEContainerFrame for a "
"content element that doesn't support the right interfaces");
nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */
-nsIAtom *
-SVGFEContainerFrame::GetType_() const
-{
- return mozilla::FrameType::SVGFEContainer;
-}
-
nsresult
SVGFEContainerFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
{
nsSVGFE *element = static_cast<nsSVGFE*>(mContent);
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
MOZ_ASSERT(GetParent()->IsSVGFilterFrame(),
--- a/layout/svg/SVGFEImageFrame.cpp
+++ b/layout/svg/SVGFEImageFrame.cpp
@@ -48,23 +48,16 @@ public:
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGFEImage"), aResult);
}
#endif
- /**
- * Get the "type" of the frame
- *
- * @see FrameType::SVGFEImage
- */
- virtual nsIAtom* GetType_() const override;
-
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
void OnVisibilityChange(Visibility aNewVisibility,
const Maybe<OnNonvisible>& aNonvisibleAction = Nothing()) override;
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override {
@@ -117,22 +110,16 @@ SVGFEImageFrame::Init(nsIContent*
nsCOMPtr<nsIImageLoadingContent> imageLoader =
do_QueryInterface(nsFrame::mContent);
if (imageLoader) {
imageLoader->FrameCreated(this);
}
}
-nsIAtom *
-SVGFEImageFrame::GetType_() const
-{
- return FrameType::SVGFEImage;
-}
-
nsresult
SVGFEImageFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
{
SVGFEImageElement *element = static_cast<SVGFEImageElement*>(mContent);
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
MOZ_ASSERT(GetParent()->IsSVGFilterFrame(),
--- a/layout/svg/SVGFELeafFrame.cpp
+++ b/layout/svg/SVGFELeafFrame.cpp
@@ -41,23 +41,16 @@ public:
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGFELeaf"), aResult);
}
#endif
- /**
- * Get the "type" of the frame
- *
- * @see mozilla::FrameType::SVGFELeaf
- */
- virtual nsIAtom* GetType_() const override;
-
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override {
// We don't maintain a visual overflow rect
return false;
}
@@ -80,22 +73,16 @@ SVGFELeafFrame::Init(nsIContent* a
NS_ASSERTION(aContent->IsNodeOfType(nsINode::eFILTER),
"Trying to construct an SVGFELeafFrame for a "
"content element that doesn't support the right interfaces");
nsFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */
-nsIAtom *
-SVGFELeafFrame::GetType_() const
-{
- return mozilla::FrameType::SVGFELeaf;
-}
-
nsresult
SVGFELeafFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
{
nsSVGFE *element = static_cast<nsSVGFE*>(mContent);
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
MOZ_ASSERT(GetParent()->IsSVGFilterFrame(),
--- a/layout/svg/SVGFEUnstyledLeafFrame.cpp
+++ b/layout/svg/SVGFEUnstyledLeafFrame.cpp
@@ -35,23 +35,16 @@ public:
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGFEUnstyledLeaf"), aResult);
}
#endif
- /**
- * Get the "type" of the frame
- *
- * @see mozilla::FrameType::SVGFEUnstyledLeaf
- */
- virtual nsIAtom* GetType_() const override;
-
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override {
// We don't maintain a visual overflow rect
return false;
}
@@ -60,22 +53,16 @@ public:
nsIFrame*
NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) SVGFEUnstyledLeafFrame(aContext);
}
NS_IMPL_FRAMEARENA_HELPERS(SVGFEUnstyledLeafFrame)
-nsIAtom *
-SVGFEUnstyledLeafFrame::GetType_() const
-{
- return mozilla::FrameType::SVGFEUnstyledLeaf;
-}
-
nsresult
SVGFEUnstyledLeafFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
{
SVGFEUnstyledElement *element = static_cast<SVGFEUnstyledElement*>(mContent);
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
MOZ_ASSERT(GetParent()->GetParent()->IsSVGFilterFrame(),
--- a/layout/svg/SVGGeometryFrame.cpp
+++ b/layout/svg/SVGGeometryFrame.cpp
@@ -225,22 +225,16 @@ SVGGeometryFrame::DidSetStyleContext(nsS
// Moz2D Path objects are fill-rule specific.
element->ClearAnyCachedPath();
}
}
}
}
}
-nsIAtom *
-SVGGeometryFrame::GetType_() const
-{
- return FrameType::SVGGeometry;
-}
-
bool
SVGGeometryFrame::IsSVGTransformed(gfx::Matrix *aOwnTransform,
gfx::Matrix *aFromParentTransform) const
{
bool foundTransform = false;
// Check if our parent has children-only transforms:
nsIFrame *parent = GetParent();
--- a/layout/svg/SVGGeometryFrame.h
+++ b/layout/svg/SVGGeometryFrame.h
@@ -75,23 +75,16 @@ public:
}
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::svgGeometryFrame
- */
- virtual nsIAtom* GetType_() const override;
-
virtual bool IsSVGTransformed(Matrix *aOwnTransforms = nullptr,
Matrix *aFromParentTransforms = nullptr) const override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGGeometry"), aResult);
}
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -3205,22 +3205,16 @@ SVGTextFrame::AttributeChanged(int32_t a
aAttribute == nsGkAtoms::textLength ||
aAttribute == nsGkAtoms::lengthAdjust) {
NotifyGlyphMetricsChange();
}
return NS_OK;
}
-nsIAtom *
-SVGTextFrame::GetType_() const
-{
- return FrameType::SVGText;
-}
-
void
SVGTextFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
{
if (mState & NS_FRAME_IS_NONDISPLAY) {
// We need this DidSetStyleContext override to handle cases like this:
//
// <defs>
// <g>
--- a/layout/svg/SVGTextFrame.h
+++ b/layout/svg/SVGTextFrame.h
@@ -223,23 +223,16 @@ public:
{
return PrincipalChildList().FirstChild()->GetContentInsertionFrame();
}
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::svgTextFrame
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGText"), aResult);
}
#endif
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
--- a/layout/svg/SVGViewFrame.cpp
+++ b/layout/svg/SVGViewFrame.cpp
@@ -45,23 +45,16 @@ public:
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGView"), aResult);
}
#endif
- /**
- * Get the "type" of the frame
- *
- * @see FrameType::SVGFELeaf
- */
- virtual nsIAtom* GetType_() const override;
-
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override {
// We don't maintain a visual overflow rect
return false;
}
@@ -83,22 +76,16 @@ SVGViewFrame::Init(nsIContent* aCo
{
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::view),
"Content is not an SVG view");
nsFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */
-nsIAtom *
-SVGViewFrame::GetType_() const
-{
- return FrameType::SVGView;
-}
-
nsresult
SVGViewFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
{
// Ignore zoomAndPan as it does not cause the <svg> element to re-render
if (aNameSpaceID == kNameSpaceID_None &&
--- a/layout/svg/nsSVGAFrame.cpp
+++ b/layout/svg/nsSVGAFrame.cpp
@@ -32,23 +32,16 @@ public:
nsIFrame* aPrevInFlow) override;
#endif
// nsIFrame:
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
- /**
- * Get the "type" of the frame
- *
- * @see FrameType::SVGA
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGA"), aResult);
}
#endif
// nsSVGDisplayableFrame interface:
virtual void NotifySVGChanged(uint32_t aFlags) override;
@@ -99,22 +92,16 @@ nsSVGAFrame::AttributeChanged(int32_t
// return nsChangeHint_UpdateOverflow for "transform" attribute changes
// and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
NotifySVGChanged(TRANSFORM_CHANGED);
}
return NS_OK;
}
-nsIAtom *
-nsSVGAFrame::GetType_() const
-{
- return FrameType::SVGA;
-}
-
//----------------------------------------------------------------------
// nsSVGDisplayableFrame methods
void
nsSVGAFrame::NotifySVGChanged(uint32_t aFlags)
{
MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
"Invalidation logic may need adjusting");
--- a/layout/svg/nsSVGClipPathFrame.cpp
+++ b/layout/svg/nsSVGClipPathFrame.cpp
@@ -448,22 +448,16 @@ nsSVGClipPathFrame::Init(nsIContent*
{
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::clipPath),
"Content is not an SVG clipPath!");
AddStateBits(NS_STATE_SVG_CLIPPATH_CHILD);
nsSVGContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
-nsIAtom *
-nsSVGClipPathFrame::GetType_() const
-{
- return FrameType::SVGClipPath;
-}
-
gfxMatrix
nsSVGClipPathFrame::GetCanvasTM()
{
return mMatrixForChildren;
}
gfxMatrix
nsSVGClipPathFrame::GetClipPathTransform(nsIFrame* aClippedFrame)
--- a/layout/svg/nsSVGClipPathFrame.h
+++ b/layout/svg/nsSVGClipPathFrame.h
@@ -119,23 +119,16 @@ public:
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::svgClipPathFrame
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGClipPath"), aResult);
}
#endif
SVGBBox
--- a/layout/svg/nsSVGContainerFrame.cpp
+++ b/layout/svg/nsSVGContainerFrame.cpp
@@ -318,17 +318,17 @@ void
nsSVGDisplayContainerFrame::ReflowSVG()
{
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
"This call is probably a wasteful mistake");
MOZ_ASSERT(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY),
"ReflowSVG mechanism not designed for this");
- MOZ_ASSERT(GetType() != FrameType::SVGOuterSVG,
+ MOZ_ASSERT(!IsSVGOuterSVGFrame(),
"Do not call on outer-<svg>");
if (!nsSVGUtils::NeedsReflowSVG(this)) {
return;
}
// If the NS_FRAME_FIRST_REFLOW bit has been removed from our parent frame,
// then our outer-<svg> has previously had its initial reflow. In that case
--- a/layout/svg/nsSVGEffects.cpp
+++ b/layout/svg/nsSVGEffects.cpp
@@ -77,21 +77,21 @@ nsSVGRenderingObserver::GetReferencedEle
nsIFrame*
nsSVGRenderingObserver::GetReferencedFrame()
{
Element* referencedElement = GetReferencedElement();
return referencedElement ? referencedElement->GetPrimaryFrame() : nullptr;
}
nsIFrame*
-nsSVGRenderingObserver::GetReferencedFrame(nsIAtom* aFrameType, bool* aOK)
+nsSVGRenderingObserver::GetReferencedFrame(FrameType aFrameType, bool* aOK)
{
nsIFrame* frame = GetReferencedFrame();
if (frame) {
- if (frame->GetType() == aFrameType)
+ if (frame->Type() == aFrameType)
return frame;
if (aOK) {
*aOK = false;
}
}
return nullptr;
}
@@ -617,21 +617,21 @@ nsSVGEffects::GetPaintServer(nsIFrame* a
}
}
nsCOMPtr<nsIURI> paintServerURL = nsSVGEffects::GetPaintURI(frame, aPaint);
nsSVGPaintingProperty *property =
nsSVGEffects::GetPaintingProperty(paintServerURL, frame, aType);
if (!property)
return nullptr;
- nsIFrame *result = property->GetReferencedFrame();
+ nsIFrame* result = property->GetReferencedFrame();
if (!result)
return nullptr;
- nsIAtom *type = result->GetType();
+ FrameType type = result->Type();
if (type != FrameType::SVGLinearGradient &&
type != FrameType::SVGRadialGradient &&
type != FrameType::SVGPattern)
return nullptr;
return static_cast<nsSVGPaintServerFrame*>(result);
}
--- a/layout/svg/nsSVGEffects.h
+++ b/layout/svg/nsSVGEffects.h
@@ -71,17 +71,17 @@ public:
bool IsInObserverList() const { return mInObserverList; }
nsIFrame* GetReferencedFrame();
/**
* @param aOK this is only for the convenience of callers. We set *aOK to false
* if the frame is the wrong type
*/
- nsIFrame* GetReferencedFrame(nsIAtom* aFrameType, bool* aOK);
+ nsIFrame* GetReferencedFrame(FrameType aFrameType, bool* aOK);
Element* GetReferencedElement();
virtual bool ObservesReflow() { return true; }
protected:
// Non-virtual protected methods
void StartListening();
--- a/layout/svg/nsSVGFilterFrame.cpp
+++ b/layout/svg/nsSVGFilterFrame.cpp
@@ -193,14 +193,8 @@ nsSVGFilterFrame::Init(nsIContent*
nsIFrame* aPrevInFlow)
{
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::filter),
"Content is not an SVG filter");
nsSVGContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */
-
-nsIAtom *
-nsSVGFilterFrame::GetType_() const
-{
- return FrameType::SVGFilter;
-}
--- a/layout/svg/nsSVGFilterFrame.h
+++ b/layout/svg/nsSVGFilterFrame.h
@@ -53,23 +53,16 @@ public:
int32_t aModType) override;
#ifdef DEBUG
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
#endif
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::svgFilterFrame
- */
- virtual nsIAtom* GetType_() const override;
-
private:
// Parse our xlink:href and set up our nsSVGPaintingProperty if we
// reference another filter and we don't have a property. Return
// the referenced filter's frame if available, null otherwise.
friend class nsSVGFilterInstance;
nsSVGFilterFrame* GetReferencedFilter();
// Accessors to lookup filter attributes
--- a/layout/svg/nsSVGFilterInstance.cpp
+++ b/layout/svg/nsSVGFilterInstance.cpp
@@ -141,17 +141,17 @@ nsSVGFilterInstance::GetFilterFrame(nsIF
Element* element = filterElement.get();
if (!element) {
// The URL points to no element.
return nullptr;
}
// Get the frame of the filter element.
nsIFrame* frame = element->GetPrimaryFrame();
- if (!frame || frame->GetType() != FrameType::SVGFilter) {
+ if (!frame || !frame->IsSVGFilterFrame()) {
// The URL points to an element that's not an SVG filter element, or to an
// element that hasn't had its frame constructed yet.
return nullptr;
}
return static_cast<nsSVGFilterFrame*>(frame);
}
--- a/layout/svg/nsSVGForeignObjectFrame.cpp
+++ b/layout/svg/nsSVGForeignObjectFrame.cpp
@@ -75,22 +75,16 @@ void nsSVGForeignObjectFrame::DestroyFro
{
// Only unregister if we registered in the first place:
if (!(mState & NS_FRAME_IS_NONDISPLAY)) {
nsSVGUtils::GetOuterSVGFrame(this)->UnregisterForeignObject(this);
}
nsContainerFrame::DestroyFrom(aDestructRoot);
}
-nsIAtom *
-nsSVGForeignObjectFrame::GetType_() const
-{
- return FrameType::SVGForeignObject;
-}
-
nsresult
nsSVGForeignObjectFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom *aAttribute,
int32_t aModType)
{
if (aNameSpaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::width ||
aAttribute == nsGkAtoms::height) {
--- a/layout/svg/nsSVGForeignObjectFrame.h
+++ b/layout/svg/nsSVGForeignObjectFrame.h
@@ -45,23 +45,16 @@ public:
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::svgForeignObjectFrame
- */
- virtual nsIAtom* GetType_() const override;
-
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsContainerFrame::IsFrameOfType(aFlags &
~(nsIFrame::eSVG | nsIFrame::eSVGForeignObject));
}
virtual bool IsSVGTransformed(Matrix *aOwnTransform,
Matrix *aFromParentTransform) const override;
--- a/layout/svg/nsSVGGFrame.cpp
+++ b/layout/svg/nsSVGGFrame.cpp
@@ -36,22 +36,16 @@ nsSVGGFrame::Init(nsIContent* aCon
NS_ASSERTION(aContent->IsSVGElement() &&
static_cast<nsSVGElement*>(aContent)->IsTransformable(),
"The element doesn't support nsIDOMSVGTransformable");
nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */
-nsIAtom *
-nsSVGGFrame::GetType_() const
-{
- return FrameType::SVGG;
-}
-
//----------------------------------------------------------------------
// nsSVGDisplayableFrame methods
void
nsSVGGFrame::NotifySVGChanged(uint32_t aFlags)
{
MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
"Invalidation logic may need adjusting");
--- a/layout/svg/nsSVGGFrame.h
+++ b/layout/svg/nsSVGGFrame.h
@@ -28,23 +28,16 @@ public:
NS_DECL_FRAMEARENA_HELPERS
#ifdef DEBUG
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
#endif
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::svgGFrame
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGG"), aResult);
}
#endif
// nsIFrame interface:
--- a/layout/svg/nsSVGGenericContainerFrame.cpp
+++ b/layout/svg/nsSVGGenericContainerFrame.cpp
@@ -31,22 +31,16 @@ nsSVGGenericContainerFrame::AttributeCha
aAttribute->ToString(str);
printf("** nsSVGGenericContainerFrame::AttributeChanged(%s)\n",
NS_LossyConvertUTF16toASCII(str).get());
#endif
return NS_OK;
}
-nsIAtom *
-nsSVGGenericContainerFrame::GetType_() const
-{
- return mozilla::FrameType::SVGGenericContainer;
-}
-
//----------------------------------------------------------------------
// nsSVGContainerFrame methods:
gfxMatrix
nsSVGGenericContainerFrame::GetCanvasTM()
{
NS_ASSERTION(GetParent(), "null parent");
--- a/layout/svg/nsSVGGenericContainerFrame.h
+++ b/layout/svg/nsSVGGenericContainerFrame.h
@@ -30,22 +30,16 @@ protected:
public:
NS_DECL_FRAMEARENA_HELPERS
// nsIFrame:
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::svgGenericContainerFrame
- */
- virtual nsIAtom* GetType_() const override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGGenericContainer"), aResult);
}
#endif
--- a/layout/svg/nsSVGGradientFrame.cpp
+++ b/layout/svg/nsSVGGradientFrame.cpp
@@ -424,22 +424,16 @@ nsSVGLinearGradientFrame::Init(nsIConten
{
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::linearGradient),
"Content is not an SVG linearGradient");
nsSVGGradientFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */
-nsIAtom*
-nsSVGLinearGradientFrame::GetType_() const
-{
- return FrameType::SVGLinearGradient;
-}
-
nsresult
nsSVGLinearGradientFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
{
if (aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::x1 ||
aAttribute == nsGkAtoms::y1 ||
@@ -532,22 +526,16 @@ nsSVGRadialGradientFrame::Init(nsIConten
{
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::radialGradient),
"Content is not an SVG radialGradient");
nsSVGGradientFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */
-nsIAtom*
-nsSVGRadialGradientFrame::GetType_() const
-{
- return FrameType::SVGRadialGradient;
-}
-
nsresult
nsSVGRadialGradientFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
{
if (aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::r ||
aAttribute == nsGkAtoms::cx ||
--- a/layout/svg/nsSVGGradientFrame.h
+++ b/layout/svg/nsSVGGradientFrame.h
@@ -135,18 +135,16 @@ public:
// nsIFrame interface:
#ifdef DEBUG
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
#endif
- virtual nsIAtom* GetType_() const override; // frame type: nsGkAtoms::svgLinearGradientFrame
-
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGLinearGradient"), aResult);
@@ -179,18 +177,16 @@ public:
// nsIFrame interface:
#ifdef DEBUG
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
#endif
- virtual nsIAtom* GetType_() const override; // frame type: nsGkAtoms::svgRadialGradientFrame
-
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGRadialGradient"), aResult);
--- a/layout/svg/nsSVGImageFrame.cpp
+++ b/layout/svg/nsSVGImageFrame.cpp
@@ -84,23 +84,16 @@ public:
void OnVisibilityChange(Visibility aNewVisibility,
const Maybe<OnNonvisible>& aNonvisibleAction = Nothing()) override;
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
- /**
- * Get the "type" of the frame
- *
- * @see FrameType::SVGImage
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGImage"), aResult);
}
#endif
// nsIReflowCallback
@@ -489,22 +482,16 @@ nsSVGImageFrame::GetFrameForPoint(const
return nullptr;
}
}
}
return this;
}
-nsIAtom *
-nsSVGImageFrame::GetType_() const
-{
- return FrameType::SVGImage;
-}
-
//----------------------------------------------------------------------
// SVGGeometryFrame methods:
// Lie about our fill/stroke so that covered region and hit detection work properly
void
nsSVGImageFrame::ReflowSVG()
{
--- a/layout/svg/nsSVGInnerSVGFrame.cpp
+++ b/layout/svg/nsSVGInnerSVGFrame.cpp
@@ -44,22 +44,16 @@ nsSVGInnerSVGFrame::Init(nsIContent*
{
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::svg),
"Content is not an SVG 'svg' element!");
nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */
-nsIAtom *
-nsSVGInnerSVGFrame::GetType_() const
-{
- return FrameType::SVGInnerSVG;
-}
-
//----------------------------------------------------------------------
// nsSVGDisplayableFrame methods
DrawResult
nsSVGInnerSVGFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect,
uint32_t aFlags)
--- a/layout/svg/nsSVGInnerSVGFrame.h
+++ b/layout/svg/nsSVGInnerSVGFrame.h
@@ -28,23 +28,16 @@ public:
NS_DECL_FRAMEARENA_HELPERS
#ifdef DEBUG
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
#endif
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::svgInnerSVGFrame
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGInnerSVG"), aResult);
}
#endif
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
--- a/layout/svg/nsSVGMarkerFrame.cpp
+++ b/layout/svg/nsSVGMarkerFrame.cpp
@@ -56,22 +56,16 @@ nsSVGMarkerFrame::Init(nsIContent*
nsIFrame* aPrevInFlow)
{
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::marker), "Content is not an SVG marker");
nsSVGContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */
-nsIAtom *
-nsSVGMarkerFrame::GetType_() const
-{
- return FrameType::SVGMarker;
-}
-
//----------------------------------------------------------------------
// nsSVGContainerFrame methods:
gfxMatrix
nsSVGMarkerFrame::GetCanvasTM()
{
NS_ASSERTION(mMarkedFrame, "null SVGGeometry frame");
@@ -279,14 +273,8 @@ nsSVGMarkerAnonChildFrame::Init(nsIConte
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow)
{
MOZ_ASSERT(aParent->IsSVGMarkerFrame(),
"Unexpected parent");
nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif
-
-nsIAtom *
-nsSVGMarkerAnonChildFrame::GetType_() const
-{
- return FrameType::SVGMarkerAnonChild;
-}
--- a/layout/svg/nsSVGMarkerFrame.h
+++ b/layout/svg/nsSVGMarkerFrame.h
@@ -53,35 +53,28 @@ public:
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override {}
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::svgMarkerFrame
- */
- virtual nsIAtom* GetType_() const override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGMarker"), aResult);
}
#endif
virtual nsContainerFrame* GetContentInsertionFrame() override {
// Any children must be added to our single anonymous inner frame kid.
MOZ_ASSERT(PrincipalChildList().FirstChild() &&
- PrincipalChildList().FirstChild()->GetType() ==
- nsGkAtoms::svgMarkerAnonChildFrame,
+ PrincipalChildList().FirstChild()->IsSVGMarkerAnonChildFrame(),
"Where is our anonymous child?");
return PrincipalChildList().FirstChild()->GetContentInsertionFrame();
}
// nsSVGMarkerFrame methods:
DrawResult PaintMark(gfxContext& aContext,
const gfxMatrix& aToMarkedFrameUserSpace,
mozilla::SVGGeometryFrame *aMarkedFrame,
@@ -159,22 +152,15 @@ public:
#endif
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(NS_LITERAL_STRING("SVGMarkerAnonChild"), aResult);
}
#endif
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::svgMarkerAnonChildFrame
- */
- virtual nsIAtom* GetType_() const override;
-
// nsSVGContainerFrame methods:
virtual gfxMatrix GetCanvasTM() override
{
return static_cast<nsSVGMarkerFrame*>(GetParent())->GetCanvasTM();
}
};
#endif
--- a/layout/svg/nsSVGMaskFrame.cpp
+++ b/layout/svg/nsSVGMaskFrame.cpp
@@ -381,22 +381,16 @@ nsSVGMaskFrame::Init(nsIContent* a
{
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::mask),
"Content is not an SVG mask");
nsSVGContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */
-nsIAtom *
-nsSVGMaskFrame::GetType_() const
-{
- return FrameType::SVGMask;
-}
-
gfxMatrix
nsSVGMaskFrame::GetCanvasTM()
{
return mMatrixForChildren;
}
gfxMatrix
nsSVGMaskFrame::GetMaskTransform(nsIFrame* aMaskedFrame)
--- a/layout/svg/nsSVGMaskFrame.h
+++ b/layout/svg/nsSVGMaskFrame.h
@@ -87,23 +87,16 @@ public:
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
#endif
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override {}
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::svgMaskFrame
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGMask"), aResult);
}
#endif
private:
--- a/layout/svg/nsSVGOuterSVGFrame.cpp
+++ b/layout/svg/nsSVGOuterSVGFrame.cpp
@@ -793,22 +793,16 @@ nsSVGOuterSVGFrame::BuildDisplayList(nsD
}
nsSplittableType
nsSVGOuterSVGFrame::GetSplittableType() const
{
return NS_FRAME_NOT_SPLITTABLE;
}
-nsIAtom *
-nsSVGOuterSVGFrame::GetType_() const
-{
- return FrameType::SVGOuterSVG;
-}
-
//----------------------------------------------------------------------
// nsISVGSVGFrame methods:
void
nsSVGOuterSVGFrame::NotifyViewportOrTransformChanged(uint32_t aFlags)
{
MOZ_ASSERT(aFlags &&
!(aFlags & ~(COORD_CONTEXT_CHANGED | TRANSFORM_CHANGED |
@@ -870,31 +864,29 @@ nsSVGOuterSVGFrame::NotifyViewportOrTran
// nsSVGDisplayableFrame methods:
DrawResult
nsSVGOuterSVGFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect,
uint32_t aFlags)
{
- NS_ASSERTION(PrincipalChildList().FirstChild()->GetType() ==
- FrameType::SVGOuterSVGAnonChild &&
+ NS_ASSERTION(PrincipalChildList().FirstChild()->IsSVGOuterSVGAnonChildFrame() &&
!PrincipalChildList().FirstChild()->GetNextSibling(),
"We should have a single, anonymous, child");
nsSVGOuterSVGAnonChildFrame *anonKid =
static_cast<nsSVGOuterSVGAnonChildFrame*>(PrincipalChildList().FirstChild());
return anonKid->PaintSVG(aContext, aTransform, aDirtyRect, aFlags);
}
SVGBBox
nsSVGOuterSVGFrame::GetBBoxContribution(const gfx::Matrix &aToBBoxUserspace,
uint32_t aFlags)
{
- NS_ASSERTION(PrincipalChildList().FirstChild()->GetType() ==
- FrameType::SVGOuterSVGAnonChild &&
+ NS_ASSERTION(PrincipalChildList().FirstChild()->IsSVGOuterSVGAnonChildFrame() &&
!PrincipalChildList().FirstChild()->GetNextSibling(),
"We should have a single, anonymous, child");
// We must defer to our child so that we don't include our
// content->PrependLocalTransformsTo() transforms.
nsSVGOuterSVGAnonChildFrame *anonKid =
static_cast<nsSVGOuterSVGAnonChildFrame*>(PrincipalChildList().FirstChild());
return anonKid->GetBBoxContribution(aToBBoxUserspace, aFlags);
}
@@ -1009,22 +1001,16 @@ nsSVGOuterSVGAnonChildFrame::Init(nsICon
nsIFrame* aPrevInFlow)
{
MOZ_ASSERT(aParent->IsSVGOuterSVGFrame(),
"Unexpected parent");
nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif
-nsIAtom *
-nsSVGOuterSVGAnonChildFrame::GetType_() const
-{
- return FrameType::SVGOuterSVGAnonChild;
-}
-
bool
nsSVGOuterSVGAnonChildFrame::IsSVGTransformed(Matrix* aOwnTransform,
Matrix* aFromParentTransform) const
{
// Our elements 'transform' attribute is applied to our nsSVGOuterSVGFrame
// parent, and the element's children-only transforms are applied to us, the
// anonymous child frame. Since we are the child frame, we apply the
// children-only transforms as if they are our own transform.
--- a/layout/svg/nsSVGOuterSVGFrame.h
+++ b/layout/svg/nsSVGOuterSVGFrame.h
@@ -70,39 +70,31 @@ public:
const nsDisplayListSet& aLists) override;
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
virtual nsSplittableType GetSplittableType() const override;
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::svgOuterSVGFrame
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGOuterSVG"), aResult);
}
#endif
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
virtual nsContainerFrame* GetContentInsertionFrame() override {
// Any children must be added to our single anonymous inner frame kid.
MOZ_ASSERT(PrincipalChildList().FirstChild() &&
- PrincipalChildList().FirstChild()->GetType() ==
- nsGkAtoms::svgOuterSVGAnonChildFrame,
+ PrincipalChildList().FirstChild()->IsSVGOuterSVGAnonChildFrame(),
"Where is our anonymous child?");
return PrincipalChildList().FirstChild()->GetContentInsertionFrame();
}
bool IsSVGTransformed(Matrix* aOwnTransform,
Matrix* aFromParentTransform) const override;
// Update the style on our anonymous box child.
@@ -252,23 +244,16 @@ public:
#endif
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(NS_LITERAL_STRING("SVGOuterSVGAnonChild"), aResult);
}
#endif
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::svgOuterSVGAnonChildFrame
- */
- virtual nsIAtom* GetType_() const override;
-
bool IsSVGTransformed(Matrix *aOwnTransform,
Matrix *aFromParentTransform) const override;
// nsSVGContainerFrame methods:
virtual gfxMatrix GetCanvasTM() override {
// GetCanvasTM returns the transform from an SVG frame to the frame's
// nsSVGOuterSVGFrame's content box, so we do not include any x/y offset
// set on us for any CSS border or padding on our nsSVGOuterSVGFrame.
--- a/layout/svg/nsSVGPatternFrame.cpp
+++ b/layout/svg/nsSVGPatternFrame.cpp
@@ -84,22 +84,16 @@ nsSVGPatternFrame::Init(nsIContent*
nsIFrame* aPrevInFlow)
{
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::pattern), "Content is not an SVG pattern");
nsSVGPaintServerFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */
-nsIAtom*
-nsSVGPatternFrame::GetType_() const
-{
- return FrameType::SVGPattern;
-}
-
//----------------------------------------------------------------------
// nsSVGContainerFrame methods:
// If our GetCanvasTM is getting called, we
// need to return *our current* transformation
// matrix, which depends on our units parameters
// and X, Y, Width, and Height
gfxMatrix
--- a/layout/svg/nsSVGPatternFrame.h
+++ b/layout/svg/nsSVGPatternFrame.h
@@ -61,23 +61,16 @@ public:
int32_t aModType) override;
#ifdef DEBUG
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
#endif
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::svgPatternFrame
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGPattern"), aResult);
}
#endif // DEBUG
protected:
--- a/layout/svg/nsSVGStopFrame.cpp
+++ b/layout/svg/nsSVGStopFrame.cpp
@@ -38,23 +38,16 @@ public:
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override {}
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
- /**
- * Get the "type" of the frame
- *
- * @see mozilla::FrameType::SVGStop
- */
- virtual nsIAtom* GetType_() const override;
-
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
}
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
@@ -78,22 +71,16 @@ nsSVGStopFrame::Init(nsIContent* a
nsIFrame* aPrevInFlow)
{
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::stop), "Content is not a stop element");
nsFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */
-nsIAtom *
-nsSVGStopFrame::GetType_() const
-{
- return mozilla::FrameType::SVGStop;
-}
-
nsresult
nsSVGStopFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
{
if (aNameSpaceID == kNameSpaceID_None &&
aAttribute == nsGkAtoms::offset) {
MOZ_ASSERT(GetParent()->IsSVGLinearGradientFrame() ||
--- a/layout/svg/nsSVGSwitchFrame.cpp
+++ b/layout/svg/nsSVGSwitchFrame.cpp
@@ -26,23 +26,16 @@ public:
NS_DECL_FRAMEARENA_HELPERS
#ifdef DEBUG
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
#endif
- /**
- * Get the "type" of the frame
- *
- * @see FrameType::SVGSwitch
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGSwitch"), aResult);
}
#endif
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
@@ -82,22 +75,16 @@ nsSVGSwitchFrame::Init(nsIContent*
{
NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::svgSwitch),
"Content is not an SVG switch");
nsSVGGFrame::Init(aContent, aParent, aPrevInFlow);
}
#endif /* DEBUG */
-nsIAtom *
-nsSVGSwitchFrame::GetType_() const
-{
- return FrameType::SVGSwitch;
-}
-
void
nsSVGSwitchFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
nsIFrame* kid = GetActiveChildFrame();
if (kid) {
BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists);
--- a/layout/svg/nsSVGUseFrame.cpp
+++ b/layout/svg/nsSVGUseFrame.cpp
@@ -34,23 +34,16 @@ public:
nsIFrame* aPrevInFlow) override;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
- /**
- * Get the "type" of the frame
- *
- * @see FrameType::SVGUse
- */
- virtual nsIAtom* GetType_() const override;
-
virtual bool IsLeaf() const override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("SVGUse"), aResult);
}
#endif
@@ -74,22 +67,16 @@ private:
nsIFrame*
NS_NewSVGUseFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) nsSVGUseFrame(aContext);
}
NS_IMPL_FRAMEARENA_HELPERS(nsSVGUseFrame)
-nsIAtom *
-nsSVGUseFrame::GetType_() const
-{
- return FrameType::SVGUse;
-}
-
//----------------------------------------------------------------------
// nsQueryFrame methods
NS_QUERYFRAME_HEAD(nsSVGUseFrame)
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
NS_QUERYFRAME_TAIL_INHERITING(nsSVGGFrame)
//----------------------------------------------------------------------
--- a/layout/svg/nsSVGUtils.cpp
+++ b/layout/svg/nsSVGUtils.cpp
@@ -1106,17 +1106,17 @@ nsSVGUtils::GetBBox(nsIFrame* aFrame, ui
if (nsSVGUtils::IsInSVGTextSubtree(aFrame)) {
// It is possible to apply a gradient, pattern, clipping path, mask or
// filter to text. When one of these facilities is applied to text
// the bounding box is the entire text element in all
// cases.
nsIFrame* ancestor = GetFirstNonAAncestorFrame(aFrame);
if (ancestor && nsSVGUtils::IsInSVGTextSubtree(ancestor)) {
- while (ancestor->GetType() != FrameType::SVGText) {
+ while (!ancestor->IsSVGTextFrame()) {
ancestor = ancestor->GetParent();
}
}
aFrame = ancestor;
}
nsSVGDisplayableFrame* svg = do_QueryFrame(aFrame);
const bool hasSVGLayout = aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT;
@@ -1302,17 +1302,17 @@ nsSVGUtils::GetRelativeRect(uint16_t aUn
}
bool
nsSVGUtils::CanOptimizeOpacity(nsIFrame *aFrame)
{
if (!(aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT)) {
return false;
}
- nsIAtom *type = aFrame->GetType();
+ FrameType type = aFrame->Type();
if (type != FrameType::SVGImage &&
type != FrameType::SVGGeometry) {
return false;
}
if (aFrame->StyleEffects()->HasFilters()) {
return false;
}
// XXX The SVG WG is intending to allow fill, stroke and markers on <image>
@@ -1345,17 +1345,17 @@ nsSVGUtils::AdjustMatrixForUnits(const g
return aMatrix;
}
nsIFrame*
nsSVGUtils::GetFirstNonAAncestorFrame(nsIFrame* aStartFrame)
{
for (nsIFrame *ancestorFrame = aStartFrame; ancestorFrame;
ancestorFrame = ancestorFrame->GetParent()) {
- if (ancestorFrame->GetType() != FrameType::SVGA) {
+ if (!ancestorFrame->IsSVGAFrame()) {
return ancestorFrame;
}
}
return nullptr;
}
bool
nsSVGUtils::GetNonScalingStrokeTransform(nsIFrame *aFrame,
--- a/layout/tables/BasicTableLayoutStrategy.cpp
+++ b/layout/tables/BasicTableLayoutStrategy.cpp
@@ -288,18 +288,17 @@ BasicTableLayoutStrategy::ComputeColumnI
// Consider the isizes on the column-group. Note that we follow
// what the HTML spec says here, and make the isize apply to
// each column in the group, not the group as a whole.
// If column has isize, column-group doesn't override isize.
if (colInfo.minCoord == 0 && colInfo.prefCoord == 0 &&
colInfo.prefPercent == 0.0f) {
- NS_ASSERTION(colFrame->GetParent()->GetType() ==
- FrameType::TableColGroup,
+ NS_ASSERTION(colFrame->GetParent()->IsTableColGroupFrame(),
"expected a column-group");
colInfo = GetColISizeInfo(aRenderingContext,
colFrame->GetParent(), wm);
colFrame->AddCoords(colInfo.minCoord, colInfo.prefCoord,
colInfo.hasSpecifiedISize);
colFrame->AddPrefPercent(colInfo.prefPercent);
}
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -170,17 +170,17 @@ nsTableCellFrame::NeedsToObserve(const R
}
rs = rs->mParentReflowInput;
if (!rs) {
return false;
}
// We always need to let the percent bsize observer be propagated
// from a table wrapper frame to an inner table frame.
- nsIAtom *fType = aReflowInput.mFrame->GetType();
+ FrameType fType = aReflowInput.mFrame->Type();
if (fType == FrameType::Table) {
return true;
}
// We need the observer to be propagated to all children of the cell
// (i.e., children of the child block) in quirks mode, but only to
// tables in standards mode.
// XXX This may not be true in the case of orthogonal flows within
@@ -1093,22 +1093,16 @@ NS_NewTableCellFrame(nsIPresShell* aPr
NS_IMPL_FRAMEARENA_HELPERS(nsBCTableCellFrame)
LogicalMargin
nsTableCellFrame::GetBorderWidth(WritingMode aWM) const
{
return LogicalMargin(aWM, StyleBorder()->GetComputedBorder());
}
-nsIAtom*
-nsTableCellFrame::GetType_() const
-{
- return FrameType::TableCell;
-}
-
void
nsTableCellFrame::DoUpdateStyleOfOwnedAnonBoxes(ServoStyleSet& aStyleSet,
nsStyleChangeList& aChangeList,
nsChangeHint aHintForThisFrame)
{
nsIFrame* kid = mFrames.FirstChild();
MOZ_ASSERT(kid && !kid->GetNextSibling(),
"Table cells should have just one child");
@@ -1131,22 +1125,16 @@ nsBCTableCellFrame::nsBCTableCellFrame(n
{
mBStartBorder = mIEndBorder = mBEndBorder = mIStartBorder = 0;
}
nsBCTableCellFrame::~nsBCTableCellFrame()
{
}
-nsIAtom*
-nsBCTableCellFrame::GetType_() const
-{
- return FrameType::BCTableCell;
-}
-
/* virtual */ nsMargin
nsBCTableCellFrame::GetUsedBorder() const
{
WritingMode wm = GetWritingMode();
return GetBorderWidth(wm).GetPhysicalMargin(wm);
}
/* virtual */ bool
--- a/layout/tables/nsTableCellFrame.h
+++ b/layout/tables/nsTableCellFrame.h
@@ -53,17 +53,17 @@ public:
: nsTableCellFrame(aContext, aTableFrame, FrameType::TableCell)
{}
~nsTableCellFrame();
nsTableRowFrame* GetTableRowFrame() const
{
nsIFrame* parent = GetParent();
- MOZ_ASSERT(parent && parent->GetType() == nsGkAtoms::tableRowFrame);
+ MOZ_ASSERT(parent && parent->IsTableRowFrame());
return static_cast<nsTableRowFrame*>(parent);
}
nsTableFrame* GetTableFrame() const
{
return GetTableRowFrame()->GetTableFrame();
}
@@ -123,23 +123,16 @@ public:
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
virtual IntrinsicISizeOffsetData IntrinsicISizeOffsets() override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
- /**
- * Get the "type" of the frame
- *
- * @see nsLayoutAtoms::tableCellFrame
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
void BlockDirAlignChild(mozilla::WritingMode aWM, nscoord aMaxAscent);
/*
* Get the value of vertical-align adjusted for CSS 2's rules for a
@@ -316,18 +309,16 @@ class nsBCTableCellFrame final : public
typedef mozilla::image::DrawResult DrawResult;
public:
NS_DECL_FRAMEARENA_HELPERS
nsBCTableCellFrame(nsStyleContext* aContext, nsTableFrame* aTableFrame);
~nsBCTableCellFrame();
- virtual nsIAtom* GetType_() const override;
-
virtual nsMargin GetUsedBorder() const override;
virtual bool GetBorderRadii(const nsSize& aFrameSize,
const nsSize& aBorderArea,
Sides aSkipSides,
nscoord aRadii[8]) const override;
// Get the *inner half of the border only*, in twips.
virtual LogicalMargin GetBorderWidth(WritingMode aWM) const override;
--- a/layout/tables/nsTableColFrame.cpp
+++ b/layout/tables/nsTableColFrame.cpp
@@ -174,30 +174,24 @@ NS_NewTableColFrame(nsIPresShell* aPresS
NS_IMPL_FRAMEARENA_HELPERS(nsTableColFrame)
nsTableColFrame*
nsTableColFrame::GetNextCol() const
{
nsIFrame* childFrame = GetNextSibling();
while (childFrame) {
- if (FrameType::TableCol == childFrame->GetType()) {
+ if (childFrame->IsTableColFrame()) {
return (nsTableColFrame*)childFrame;
}
childFrame = childFrame->GetNextSibling();
}
return nullptr;
}
-nsIAtom*
-nsTableColFrame::GetType_() const
-{
- return FrameType::TableCol;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
nsTableColFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("TableCol"), aResult);
}
#endif
--- a/layout/tables/nsTableColFrame.h
+++ b/layout/tables/nsTableColFrame.h
@@ -54,33 +54,26 @@ public:
/**
* Table columns never paint anything, nor receive events.
*/
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override {}
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::tableColFrame
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
virtual nsSplittableType GetSplittableType() const override;
nsTableColGroupFrame* GetTableColGroupFrame() const
{
nsIFrame* parent = GetParent();
- MOZ_ASSERT(parent && parent->GetType() == nsGkAtoms::tableColGroupFrame);
+ MOZ_ASSERT(parent && parent->IsTableColGroupFrame());
return static_cast<nsTableColGroupFrame*>(parent);
}
nsTableFrame* GetTableFrame() const
{
return GetTableColGroupFrame()->GetTableFrame();
}
--- a/layout/tables/nsTableColGroupFrame.cpp
+++ b/layout/tables/nsTableColGroupFrame.cpp
@@ -38,31 +38,31 @@ void nsTableColGroupFrame::SetColType(ns
void nsTableColGroupFrame::ResetColIndices(nsIFrame* aFirstColGroup,
int32_t aFirstColIndex,
nsIFrame* aStartColFrame)
{
nsTableColGroupFrame* colGroupFrame = (nsTableColGroupFrame*)aFirstColGroup;
int32_t colIndex = aFirstColIndex;
while (colGroupFrame) {
- if (FrameType::TableColGroup == colGroupFrame->GetType()) {
+ if (colGroupFrame->IsTableColGroupFrame()) {
// reset the starting col index for the first cg only if we should reset
// the whole colgroup (aStartColFrame defaults to nullptr) or if
// aFirstColIndex is smaller than the existing starting col index
if ((colIndex != aFirstColIndex) ||
(colIndex < colGroupFrame->GetStartColumnIndex()) ||
!aStartColFrame) {
colGroupFrame->SetStartColumnIndex(colIndex);
}
nsIFrame* colFrame = aStartColFrame;
if (!colFrame || (colIndex != aFirstColIndex)) {
colFrame = colGroupFrame->PrincipalChildList().FirstChild();
}
while (colFrame) {
- if (FrameType::TableCol == colFrame->GetType()) {
+ if (colFrame->IsTableColFrame()) {
((nsTableColFrame*)colFrame)->SetColIndex(colIndex);
colIndex++;
}
colFrame = colFrame->GetNextSibling();
}
}
colGroupFrame = static_cast<nsTableColGroupFrame*>
(colGroupFrame->GetNextSibling());
@@ -280,17 +280,17 @@ nsTableColGroupFrame::RemoveFrame(ChildL
{
NS_ASSERTION(aListID == kPrincipalList, "unexpected child list");
if (!aOldFrame) {
return;
}
bool contentRemoval = false;
- if (FrameType::TableCol == aOldFrame->GetType()) {
+ if (aOldFrame->IsTableColFrame()) {
nsTableColFrame* colFrame = (nsTableColFrame*)aOldFrame;
if (colFrame->GetColType() == eColContent) {
contentRemoval = true;
// Remove any anonymous column frames this <col> produced via a colspan
nsTableColFrame* col = colFrame->GetNextCol();
nsTableColFrame* nextCol;
while (col && col->GetColType() == eColAnonymousCol) {
#ifdef DEBUG
@@ -452,30 +452,24 @@ void nsTableColGroupFrame::GetContinuous
nsTableColGroupFrame*
NS_NewTableColGroupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) nsTableColGroupFrame(aContext);
}
NS_IMPL_FRAMEARENA_HELPERS(nsTableColGroupFrame)
-nsIAtom*
-nsTableColGroupFrame::GetType_() const
-{
- return FrameType::TableColGroup;
-}
-
-void
+void
nsTableColGroupFrame::InvalidateFrame(uint32_t aDisplayItemKey)
{
nsIFrame::InvalidateFrame(aDisplayItemKey);
GetParent()->InvalidateFrameWithRect(GetVisualOverflowRect() + GetPosition(), aDisplayItemKey);
}
-void
+void
nsTableColGroupFrame::InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey)
{
nsIFrame::InvalidateFrameWithRect(aRect, aDisplayItemKey);
// If we have filters applied that would affects our bounds, then
// we get an inactive layer created and this is computed
// within FrameLayerBuilder
GetParent()->InvalidateFrameWithRect(aRect + GetPosition(), aDisplayItemKey);
}
--- a/layout/tables/nsTableColGroupFrame.h
+++ b/layout/tables/nsTableColGroupFrame.h
@@ -39,17 +39,17 @@ public:
if (!aPrevInFlow) {
mWritingMode = GetTableFrame()->GetWritingMode();
}
}
nsTableFrame* GetTableFrame() const
{
nsIFrame* parent = GetParent();
- MOZ_ASSERT(parent && parent->GetType() == nsGkAtoms::tableFrame);
+ MOZ_ASSERT(parent && parent->IsTableFrame());
MOZ_ASSERT(!parent->GetPrevInFlow(),
"Col group should always be in a first-in-flow table frame");
return static_cast<nsTableFrame*>(parent);
}
/**
* ColGroups never paint anything, nor receive events.
*/
@@ -106,27 +106,20 @@ public:
bool aResetSubsequentColIndices);
/** reflow of a column group is a trivial matter of reflowing
* the col group's children (columns), and setting this frame
* to 0-size. Since tables are row-centric, column group frames
* don't play directly in the rendering game. They do however
* maintain important state that effects table and cell layout.
*/
- virtual void Reflow(nsPresContext* aPresContext,
- ReflowOutput& aDesiredSize,
+ virtual void Reflow(nsPresContext* aPresContext,
+ ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
- nsReflowStatus& aStatus) override;
-
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::tableColGroupFrame
- */
- virtual nsIAtom* GetType_() const override;
+ nsReflowStatus& aStatus) override;
/** Add column frames to the table storages: colframe cache and cellmap
* this doesn't change the mFrames of the colgroup frame.
* @param aFirstColIndex - the index at which aFirstFrame should be inserted
* into the colframe cache.
* @param aResetSubsequentColIndices - the indices of the col frames
* after the insertion might need
* an update
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -138,24 +138,16 @@ nsTableFrame::GetParentStyleContext(nsIF
// We're the root. We have no style context parent.
*aProviderFrame = nullptr;
return nullptr;
}
return GetParent()->DoGetParentStyleContext(aProviderFrame);
}
-
-nsIAtom*
-nsTableFrame::GetType_() const
-{
- return FrameType::Table;
-}
-
-
nsTableFrame::nsTableFrame(nsStyleContext* aContext)
: nsContainerFrame(aContext, FrameType::Table),
mCellMap(nullptr),
mTableLayoutStrategy(nullptr)
{
memset(&mBits, 0, sizeof(mBits));
}
@@ -251,17 +243,17 @@ nsTableFrame::PageBreakAfter(nsIFrame* a
/* static */ void
nsTableFrame::RegisterPositionedTablePart(nsIFrame* aFrame)
{
// Supporting relative positioning for table parts other than table cells has
// the potential to break sites that apply 'position: relative' to those
// parts, expecting nothing to happen. We warn at the console to make tracking
// down the issue easy.
- if (!IS_TABLE_CELL(aFrame->GetType())) {
+ if (!IS_TABLE_CELL(aFrame->Type())) {
nsIContent* content = aFrame->GetContent();
nsPresContext* presContext = aFrame->PresContext();
if (content && !presContext->HasWarnedAboutPositionedTableParts()) {
presContext->SetHasWarnedAboutPositionedTableParts();
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
NS_LITERAL_CSTRING("Layout: Tables"),
content->OwnerDoc(),
nsContentUtils::eLAYOUT_PROPERTIES,
@@ -333,17 +325,17 @@ nsTableFrame::SetInitialChildList(ChildL
// form for two reasons:
// 1) Both rowgroups and column groups come in on the principal child list.
while (aChildList.NotEmpty()) {
nsIFrame* childFrame = aChildList.FirstChild();
aChildList.RemoveFirstChild();
const nsStyleDisplay* childDisplay = childFrame->StyleDisplay();
if (mozilla::StyleDisplay::TableColumnGroup == childDisplay->mDisplay) {
- NS_ASSERTION(FrameType::TableColGroup == childFrame->GetType(),
+ NS_ASSERTION(childFrame->IsTableColGroupFrame(),
"This is not a colgroup");
mColGroups.AppendFrame(nullptr, childFrame);
}
else { // row groups and unknown frames go on the main list for now
mFrames.AppendFrame(nullptr, childFrame);
}
}
@@ -1264,17 +1256,17 @@ public:
virtual void Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx) override;
NS_DISPLAY_DECL_NAME("TableBorderBackground", TYPE_TABLE_BORDER_BACKGROUND)
};
#ifdef DEBUG
static bool
-IsFrameAllowedInTable(nsIAtom* aType)
+IsFrameAllowedInTable(FrameType aType)
{
return IS_TABLE_CELL(aType) ||
FrameType::TableRow == aType ||
FrameType::TableRowGroup == aType ||
FrameType::Scroll == aType ||
FrameType::Table == aType ||
FrameType::TableCol == aType ||
FrameType::TableColGroup == aType;
@@ -1290,17 +1282,17 @@ nsDisplayTableBorderBackground::Paint(ns
ToReferenceFrame());
nsDisplayTableItemGeometry::UpdateDrawResult(this, result);
}
static int32_t
GetTablePartRank(nsDisplayItem* aItem)
{
- nsIAtom* type = aItem->Frame()->GetType();
+ FrameType type = aItem->Frame()->Type();
if (type == FrameType::Table)
return 0;
if (type == FrameType::TableRowGroup)
return 1;
if (type == FrameType::TableRow)
return 2;
return 3;
}
@@ -1415,17 +1407,17 @@ static inline bool FrameHasBorderOrBackg
}
static bool
AnyTablePartHasBorderOrBackground(nsTableFrame* aTableFrame,
nsIFrame* aStart,
nsIFrame* aEnd)
{
for (nsIFrame* f = aStart; f != aEnd; f = f->GetNextSibling()) {
- NS_ASSERTION(IsFrameAllowedInTable(f->GetType()), "unexpected frame type");
+ NS_ASSERTION(IsFrameAllowedInTable(f->Type()), "unexpected frame type");
if (FrameHasBorderOrBackground(aTableFrame, f))
return true;
nsTableCellFrame *cellFrame = do_QueryFrame(f);
if (cellFrame)
continue;
@@ -1814,18 +1806,18 @@ nsTableFrame::ComputeAutoSize(nsRenderin
// Return true if aParentReflowInput.frame or any of its ancestors within
// the containing table have non-auto bsize. (e.g. pct or fixed bsize)
bool
nsTableFrame::AncestorsHaveStyleBSize(const ReflowInput& aParentReflowInput)
{
WritingMode wm = aParentReflowInput.GetWritingMode();
for (const ReflowInput* rs = &aParentReflowInput;
rs && rs->mFrame; rs = rs->mParentReflowInput) {
- nsIAtom* frameType = rs->mFrame->GetType();
- if (IS_TABLE_CELL(frameType) ||
+ FrameType frameType = rs->mFrame->Type();
+ if (IS_TABLE_CELL(frameType) ||
(FrameType::TableRow == frameType) ||
(FrameType::TableRowGroup == frameType)) {
const nsStyleCoord &bsize = rs->mStylePosition->BSize(wm);
// calc() with percentages treated like 'auto' on internal table elements
if (bsize.GetUnit() != eStyleUnit_Auto &&
(!bsize.IsCalcUnit() || !bsize.HasPercent())) {
return true;
}
@@ -1838,17 +1830,17 @@ nsTableFrame::AncestorsHaveStyleBSize(co
return false;
}
// See if a special block-size reflow needs to occur and if so,
// call RequestSpecialBSizeReflow
void
nsTableFrame::CheckRequestSpecialBSizeReflow(const ReflowInput& aReflowInput)
{
- NS_ASSERTION(IS_TABLE_CELL(aReflowInput.mFrame->GetType()) ||
+ NS_ASSERTION(IS_TABLE_CELL(aReflowInput.mFrame->Type()) ||
aReflowInput.mFrame->IsTableRowFrame() ||
aReflowInput.mFrame->IsTableRowGroupFrame() ||
aReflowInput.mFrame->IsTableFrame(),
"unexpected frame type");
WritingMode wm = aReflowInput.GetWritingMode();
if (!aReflowInput.mFrame->GetPrevInFlow() && // 1st in flow
(NS_UNCONSTRAINEDSIZE == aReflowInput.ComputedBSize() || // no computed bsize
0 == aReflowInput.ComputedBSize()) &&
@@ -1863,17 +1855,17 @@ nsTableFrame::CheckRequestSpecialBSizeRe
// row, or cell returns the last size it was reflowed at. However, the table may
// change the bsize of row groups, rows, cells in DistributeBSizeToRows after.
// And the row group can change the bsize of rows, cells in CalculateRowBSizes.
void
nsTableFrame::RequestSpecialBSizeReflow(const ReflowInput& aReflowInput)
{
// notify the frame and its ancestors of the special reflow, stopping at the containing table
for (const ReflowInput* rs = &aReflowInput; rs && rs->mFrame; rs = rs->mParentReflowInput) {
- nsIAtom* frameType = rs->mFrame->GetType();
+ FrameType frameType = rs->mFrame->Type();
NS_ASSERTION(IS_TABLE_CELL(frameType) ||
FrameType::TableRow == frameType ||
FrameType::TableRowGroup == frameType ||
FrameType::Table == frameType,
"unexpected frame type");
rs->mFrame->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE);
if (FrameType::Table == frameType) {
@@ -3987,17 +3979,17 @@ NS_NewTableFrame(nsIPresShell* aPresShel
NS_IMPL_FRAMEARENA_HELPERS(nsTableFrame)
nsTableFrame*
nsTableFrame::GetTableFrame(nsIFrame* aFrame)
{
for (nsIFrame* ancestor = aFrame->GetParent(); ancestor;
ancestor = ancestor->GetParent()) {
- if (FrameType::Table == ancestor->GetType()) {
+ if (ancestor->IsTableFrame()) {
return static_cast<nsTableFrame*>(ancestor);
}
}
MOZ_CRASH("unable to find table parent");
return nullptr;
}
nsTableFrame*
@@ -4012,17 +4004,17 @@ nsTableFrame::GetTableFramePassingThroug
// Retrieve the table frame, and check if we hit aMustPassThrough on the
// way.
*aDidPassThrough = false;
nsTableFrame* tableFrame = nullptr;
for (nsIFrame* ancestor = aFrame; ancestor; ancestor = ancestor->GetParent()) {
if (ancestor == aMustPassThrough) {
*aDidPassThrough = true;
}
- if (FrameType::Table == ancestor->GetType()) {
+ if (ancestor->IsTableFrame()) {
tableFrame = static_cast<nsTableFrame*>(ancestor);
break;
}
}
MOZ_ASSERT(tableFrame, "Should have a table frame here");
return tableFrame;
}
@@ -4072,34 +4064,34 @@ nsTableFrame::GetFrameName(nsAString& aR
{
return MakeFrameName(NS_LITERAL_STRING("Table"), aResult);
}
#endif
// Find the closet sibling before aPriorChildFrame (including aPriorChildFrame) that
// is of type aChildType
nsIFrame*
-nsTableFrame::GetFrameAtOrBefore(nsIFrame* aParentFrame,
- nsIFrame* aPriorChildFrame,
- nsIAtom* aChildType)
+nsTableFrame::GetFrameAtOrBefore(nsIFrame* aParentFrame,
+ nsIFrame* aPriorChildFrame,
+ FrameType aChildType)
{
nsIFrame* result = nullptr;
if (!aPriorChildFrame) {
return result;
}
- if (aChildType == aPriorChildFrame->GetType()) {
+ if (aChildType == aPriorChildFrame->Type()) {
return aPriorChildFrame;
}
// aPriorChildFrame is not of type aChildType, so we need start from
// the beginnng and find the closest one
nsIFrame* lastMatchingFrame = nullptr;
nsIFrame* childFrame = aParentFrame->PrincipalChildList().FirstChild();
while (childFrame && (childFrame != aPriorChildFrame)) {
- if (aChildType == childFrame->GetType()) {
+ if (aChildType == childFrame->Type()) {
lastMatchingFrame = childFrame;
}
childFrame = childFrame->GetNextSibling();
}
return lastMatchingFrame;
}
#ifdef DEBUG
@@ -4176,17 +4168,17 @@ nsTableFrame::Dump(bool aDump
break;
case eColAnonymousCell:
printf(" anonymous-cell ");
break;
}
}
printf("\n colgroups->");
for (nsIFrame* childFrame : mColGroups) {
- if (FrameType::TableColGroup == childFrame->GetType()) {
+ if (FrameType::TableColGroup == childFrame->Type()) {
nsTableColGroupFrame* colGroupFrame = (nsTableColGroupFrame *)childFrame;
colGroupFrame->Dump(1);
}
}
for (colIdx = 0; colIdx < numCols; colIdx++) {
printf("\n");
nsTableColFrame* colFrame = GetColFrame(colIdx);
colFrame->Dump(1);
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -28,19 +28,19 @@ class nsStyleContext;
namespace mozilla {
class WritingMode;
class LogicalMargin;
struct TableReflowInput;
} // namespace mozilla
struct BCPropertyData;
-static inline bool IS_TABLE_CELL(nsIAtom* frameType) {
- return nsGkAtoms::tableCellFrame == frameType ||
- nsGkAtoms::bcTableCellFrame == frameType;
+static inline bool IS_TABLE_CELL(FrameType frameType) {
+ return frameType == FrameType::TableCell ||
+ frameType == FrameType::BCTableCell;
}
class nsDisplayTableItem : public nsDisplayItem
{
public:
nsDisplayTableItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
bool aDrawsBackground = true) :
nsDisplayItem(aBuilder, aFrame),
@@ -243,19 +243,19 @@ public:
nsFrame* aFrame,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists,
nsDisplayTableItem* aDisplayItem,
DisplayGenericTablePartTraversal aTraversal = GenericTraversal);
// Return the closest sibling of aPriorChildFrame (including aPriroChildFrame)
// of type aChildType.
- static nsIFrame* GetFrameAtOrBefore(nsIFrame* aParentFrame,
- nsIFrame* aPriorChildFrame,
- nsIAtom* aChildType);
+ static nsIFrame* GetFrameAtOrBefore(nsIFrame* aParentFrame,
+ nsIFrame* aPriorChildFrame,
+ FrameType aChildType);
bool IsAutoBSize(mozilla::WritingMode aWM);
/** @return true if aDisplayType represents a rowgroup of any sort
* (header, footer, or body)
*/
bool IsRowGroup(mozilla::StyleDisplay aDisplayType) const;
virtual const nsFrameList& GetChildList(ChildListID aListID) const override;
@@ -372,23 +372,16 @@ public:
nsIFrame*& aLastChildReflowed,
nsReflowStatus& aStatus);
nsFrameList& GetColGroups();
virtual nsStyleContext*
GetParentStyleContext(nsIFrame** aProviderFrame) const override;
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::tableFrame
- */
- virtual nsIAtom* GetType_() const override;
-
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
if (aFlags & eSupportsCSSTransforms) {
return false;
}
return nsContainerFrame::IsFrameOfType(aFlags);
}
--- a/layout/tables/nsTablePainter.cpp
+++ b/layout/tables/nsTablePainter.cpp
@@ -417,17 +417,17 @@ TableBackgroundPainter::PaintRowGroup(ns
// Note that mDirtyRect - mRenderPt is guaranteed to be in the row
// group's coordinate system here, so passing its .y to
// GetFirstRowContaining is ok.
nscoord overflowAbove;
nsIFrame* cursor = aFrame->GetFirstRowContaining(mDirtyRect.y - mRenderPt.y, &overflowAbove);
// Sadly, it seems like there may be non-row frames in there... or something?
// There are certainly null-checks in GetFirstRow() and GetNextRow(). :(
- while (cursor && cursor->GetType() != FrameType::TableRow) {
+ while (cursor && !cursor->IsTableRowFrame()) {
cursor = cursor->GetNextSibling();
}
// It's OK if cursor is null here.
nsTableRowFrame* row = static_cast<nsTableRowFrame*>(cursor);
if (!row) {
// No useful cursor; just start at the top. Don't bother to set up a
// cursor; if we've gotten this far then we've already built the display
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -208,17 +208,17 @@ nsTableRowFrame::AppendFrames(ChildListI
DrainSelfOverflowList(); // ensure the last frame is in mFrames
const nsFrameList::Slice& newCells = mFrames.AppendFrames(nullptr, aFrameList);
// Add the new cell frames to the table
nsTableFrame* tableFrame = GetTableFrame();
for (nsFrameList::Enumerator e(newCells) ; !e.AtEnd(); e.Next()) {
nsIFrame *childFrame = e.get();
- NS_ASSERTION(IS_TABLE_CELL(childFrame->GetType()),
+ NS_ASSERTION(IS_TABLE_CELL(childFrame->Type()),
"Not a table cell frame/pseudo frame construction failure");
tableFrame->AppendCell(static_cast<nsTableCellFrame&>(*childFrame), GetRowIndex());
}
PresContext()->PresShell()->FrameNeedsReflow(this, nsIPresShell::eTreeChange,
NS_FRAME_HAS_DIRTY_CHILDREN);
tableFrame->SetGeometryDirty();
}
@@ -233,22 +233,23 @@ nsTableRowFrame::InsertFrames(ChildListI
NS_ASSERTION(!aPrevFrame || aPrevFrame->GetParent() == this,
"inserting after sibling frame with different parent");
DrainSelfOverflowList(); // ensure aPrevFrame is in mFrames
//Insert Frames in the frame list
const nsFrameList::Slice& newCells = mFrames.InsertFrames(nullptr, aPrevFrame, aFrameList);
// Get the table frame
nsTableFrame* tableFrame = GetTableFrame();
- nsIAtom* cellFrameType = tableFrame->IsBorderCollapse() ? FrameType::BCTableCell : FrameType::TableCell;
+ FrameType cellFrameType = tableFrame->IsBorderCollapse()
+ ? FrameType::BCTableCell : FrameType::TableCell;
nsTableCellFrame* prevCellFrame = (nsTableCellFrame *)nsTableFrame::GetFrameAtOrBefore(this, aPrevFrame, cellFrameType);
nsTArray<nsTableCellFrame*> cellChildren;
for (nsFrameList::Enumerator e(newCells); !e.AtEnd(); e.Next()) {
nsIFrame *childFrame = e.get();
- NS_ASSERTION(IS_TABLE_CELL(childFrame->GetType()),
+ NS_ASSERTION(IS_TABLE_CELL(childFrame->Type()),
"Not a table cell frame/pseudo frame construction failure");
cellChildren.AppendElement(static_cast<nsTableCellFrame*>(childFrame));
}
// insert the cells into the cell map
int32_t colIndex = -1;
if (prevCellFrame) {
prevCellFrame->GetColIndex(colIndex);
}
@@ -304,17 +305,17 @@ GetBSizeOfRowsSpannedBelowFirst(nsTableC
nsTableFrame& aTableFrame,
const WritingMode aWM)
{
nscoord bsize = 0;
int32_t rowSpan = aTableFrame.GetEffectiveRowSpan(aTableCellFrame);
// add in bsize of rows spanned beyond the 1st one
nsIFrame* nextRow = aTableCellFrame.GetParent()->GetNextSibling();
for (int32_t rowX = 1; ((rowX < rowSpan) && nextRow);) {
- if (FrameType::TableRow == nextRow->GetType()) {
+ if (nextRow->IsTableRowFrame()) {
bsize += nextRow->BSize(aWM);
rowX++;
}
bsize += aTableFrame.GetRowSpacing(rowX);
nextRow = nextRow->GetNextSibling();
}
return bsize;
}
@@ -448,17 +449,17 @@ nscoord nsTableRowFrame::GetRowBaseline(
// bp pb
// bp pb
// bppppppppppppppppb
// bbbbbbbbbbbbbbbbbb
nscoord ascent = 0;
nsSize containerSize = GetSize();
for (nsIFrame* childFrame : mFrames) {
- if (IS_TABLE_CELL(childFrame->GetType())) {
+ if (IS_TABLE_CELL(childFrame->Type())) {
nsIFrame* firstKid = childFrame->PrincipalChildList().FirstChild();
ascent = std::max(ascent,
LogicalRect(aWM, firstKid->GetNormalRect(),
containerSize).BEnd(aWM));
}
}
return ascent;
}
@@ -1400,22 +1401,16 @@ nsTableRowFrame::InsertCellFrame(nsTable
priorCell = cellFrame;
}
else break;
}
}
mFrames.InsertFrame(this, priorCell, aFrame);
}
-nsIAtom*
-nsTableRowFrame::GetType_() const
-{
- return FrameType::TableRow;
-}
-
nsTableRowFrame*
nsTableRowFrame::GetNextRow() const
{
nsIFrame* childFrame = GetNextSibling();
while (childFrame) {
nsTableRowFrame *rowFrame = do_QueryFrame(childFrame);
if (rowFrame) {
NS_ASSERTION(mozilla::StyleDisplay::TableRow == childFrame->StyleDisplay()->mDisplay,
--- a/layout/tables/nsTableRowFrame.h
+++ b/layout/tables/nsTableRowFrame.h
@@ -61,17 +61,17 @@ public:
* @return the frame that was created
*/
friend nsTableRowFrame* NS_NewTableRowFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
nsTableRowGroupFrame* GetTableRowGroupFrame() const
{
nsIFrame* parent = GetParent();
- MOZ_ASSERT(parent && parent->GetType() == nsGkAtoms::tableRowGroupFrame);
+ MOZ_ASSERT(parent && parent->IsTableRowGroupFrame());
return static_cast<nsTableRowGroupFrame*>(parent);
}
nsTableFrame* GetTableFrame() const
{
return GetTableRowGroupFrame()->GetTableFrame();
}
@@ -100,23 +100,16 @@ public:
*/
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
void DidResize();
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::tableRowFrame
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
void UpdateBSize(nscoord aBSize,
nscoord aAscent,
nscoord aDescent,
nsTableFrame* aTableFrame = nullptr,
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -1680,22 +1680,16 @@ nsTableRowGroupFrame::IsSimpleRowFrame(n
if (!aTableFrame->RowIsSpannedInto(rowIndex, numEffCols) &&
!aTableFrame->RowHasSpanningCells(rowIndex, numEffCols)) {
return true;
}
return false;
}
-nsIAtom*
-nsTableRowGroupFrame::GetType_() const
-{
- return FrameType::TableRowGroup;
-}
-
/** find page break before the first row **/
bool
nsTableRowGroupFrame::HasInternalBreakBefore() const
{
nsIFrame* firstChild = mFrames.FirstChild();
if (!firstChild)
return false;
return firstChild->StyleDisplay()->mBreakBefore;
--- a/layout/tables/nsTableRowGroupFrame.h
+++ b/layout/tables/nsTableRowGroupFrame.h
@@ -94,34 +94,27 @@ public:
*/
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::tableRowGroupFrame
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
nsTableRowFrame* GetFirstRow();
nsTableRowFrame* GetLastRow();
nsTableFrame* GetTableFrame() const
{
nsIFrame* parent = GetParent();
- MOZ_ASSERT(parent && parent->GetType() == nsGkAtoms::tableFrame);
+ MOZ_ASSERT(parent && parent->IsTableFrame());
return static_cast<nsTableFrame*>(parent);
}
/** return the number of child rows (not necessarily == number of child frames) */
int32_t GetRowCount();
/** return the table-relative row index of the first row in this rowgroup.
* if there are no rows, -1 is returned.
--- a/layout/tables/nsTableWrapperFrame.cpp
+++ b/layout/tables/nsTableWrapperFrame.cpp
@@ -96,17 +96,17 @@ nsTableWrapperFrame::SetInitialChildList
// the frame constructor already checked for table-caption display type
MOZ_ASSERT(mCaptionFrames.IsEmpty(),
"already have child frames in CaptionList");
mCaptionFrames.SetFrames(aChildList);
} else {
MOZ_ASSERT(kPrincipalList != aListID ||
(aChildList.FirstChild() &&
aChildList.FirstChild() == aChildList.LastChild() &&
- FrameType::Table == aChildList.FirstChild()->GetType()),
+ aChildList.FirstChild()->IsTableFrame()),
"expected a single table frame in principal child list");
nsContainerFrame::SetInitialChildList(aListID, aChildList);
}
}
void
nsTableWrapperFrame::AppendFrames(ChildListID aListID,
nsFrameList& aFrameList)
@@ -391,19 +391,18 @@ nsTableWrapperFrame::ChildShrinkWrapISiz
LogicalSize paddingSize =
offsets.ComputedLogicalPadding().Size(childWM).ConvertTo(aWM, childWM);
LogicalSize bpSize =
offsets.ComputedLogicalBorderPadding().Size(childWM).ConvertTo(aWM, childWM);
// Shrink-wrap aChildFrame by default, except if we're a stretched grid item.
auto flags = ComputeSizeFlags::eShrinkWrap;
auto parent = GetParent();
- nsIAtom* parentFrameType = parent ? parent->GetType() : nullptr;
- bool isGridItem = (parentFrameType == FrameType::GridContainer &&
- !HasAnyStateBits(NS_FRAME_OUT_OF_FLOW));
+ bool isGridItem = parent && parent->IsGridContainerFrame() &&
+ !HasAnyStateBits(NS_FRAME_OUT_OF_FLOW);
if (MOZ_UNLIKELY(isGridItem) &&
!StyleMargin()->HasInlineAxisAuto(aWM)) {
auto inlineAxisAlignment = aWM.IsOrthogonalTo(parent->GetWritingMode()) ?
StylePosition()->UsedAlignSelf(parent->StyleContext()) :
StylePosition()->UsedJustifySelf(parent->StyleContext());
if (inlineAxisAlignment == NS_STYLE_ALIGN_NORMAL ||
inlineAxisAlignment == NS_STYLE_ALIGN_STRETCH) {
flags = nsIFrame::ComputeSizeFlags::eDefault;
@@ -1053,22 +1052,16 @@ nsTableWrapperFrame::Reflow(nsPresContex
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aOuterRI, aStatus);
// Return our desired rect
NS_FRAME_SET_TRUNCATION(aStatus, aOuterRI, aDesiredSize);
}
-nsIAtom*
-nsTableWrapperFrame::GetType_() const
-{
- return FrameType::TableWrapper;
-}
-
/* ----- global methods ----- */
nsIContent*
nsTableWrapperFrame::GetCellAt(uint32_t aRowIdx, uint32_t aColIdx) const
{
nsTableCellMap* cellMap = InnerTableFrame()->GetCellMap();
if (!cellMap) {
return nullptr;
--- a/layout/tables/nsTableWrapperFrame.h
+++ b/layout/tables/nsTableWrapperFrame.h
@@ -103,23 +103,16 @@ public:
/** process a reflow command for the table.
* This involves reflowing the caption and the inner table.
* @see nsIFrame::Reflow */
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::tableWrapperFrame
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
virtual nsStyleContext* GetParentStyleContext(nsIFrame** aProviderFrame) const override;
/**
* Return the content for the cell at the given row and column.
--- a/layout/xul/nsBoxFrame.cpp
+++ b/layout/xul/nsBoxFrame.cpp
@@ -1539,22 +1539,16 @@ nsBoxFrame::GetBoxName(nsAutoString& aNa
#ifdef DEBUG_FRAME_DUMP
nsresult
nsBoxFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("Box"), aResult);
}
#endif
-nsIAtom*
-nsBoxFrame::GetType_() const
-{
- return FrameType::Box;
-}
-
#ifdef DEBUG_LAYOUT
nsresult
nsBoxFrame::GetXULDebug(bool& aDebug)
{
aDebug = (mState & NS_STATE_CURRENTLY_IN_DEBUG);
return NS_OK;
}
#endif
--- a/layout/xul/nsBoxFrame.h
+++ b/layout/xul/nsBoxFrame.h
@@ -107,18 +107,16 @@ public:
nsFrameList& aFrameList) override;
virtual void RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame) override;
virtual nsContainerFrame* GetContentInsertionFrame() override;
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
- virtual nsIAtom* GetType_() const override;
-
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
// record that children that are ignorable whitespace should be excluded
// (When content was loaded via the XUL content sink, it's already
// been excluded, but we need this for when the XUL namespace is used
// in other MIME types or when the XUL CSS display types are used with
// non-XUL elements.)
--- a/layout/xul/nsDeckFrame.cpp
+++ b/layout/xul/nsDeckFrame.cpp
@@ -48,22 +48,16 @@ nsDeckFrame::nsDeckFrame(nsStyleContext*
: nsBoxFrame(aContext, FrameType::Deck)
, mIndex(0)
{
nsCOMPtr<nsBoxLayout> layout;
NS_NewStackLayout(layout);
SetXULLayoutManager(layout);
}
-nsIAtom*
-nsDeckFrame::GetType_() const
-{
- return mozilla::FrameType::Deck;
-}
-
nsresult
nsDeckFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
{
nsresult rv = nsBoxFrame::AttributeChanged(aNameSpaceID, aAttribute,
aModType);
--- a/layout/xul/nsDeckFrame.h
+++ b/layout/xul/nsDeckFrame.h
@@ -38,23 +38,21 @@ public:
const nsDisplayListSet& aLists) override;
virtual void RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame) override;
virtual void BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
-
+
virtual void Init(nsIContent* aContent,
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("Deck"), aResult);
}
#endif
explicit nsDeckFrame(nsStyleContext* aContext);
--- a/layout/xul/nsImageBoxFrame.cpp
+++ b/layout/xul/nsImageBoxFrame.cpp
@@ -657,22 +657,16 @@ nsImageBoxFrame::GetXULMinSize(nsBoxLayo
}
nscoord
nsImageBoxFrame::GetXULBoxAscent(nsBoxLayoutState& aState)
{
return GetXULPrefSize(aState).height;
}
-nsIAtom*
-nsImageBoxFrame::GetType_() const
-{
- return FrameType::ImageBox;
-}
-
#ifdef DEBUG_FRAME_DUMP
nsresult
nsImageBoxFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("ImageBox"), aResult);
}
#endif
--- a/layout/xul/nsImageBoxFrame.h
+++ b/layout/xul/nsImageBoxFrame.h
@@ -63,17 +63,16 @@ public:
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
- virtual nsIAtom* GetType_() const override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
/**
* Update mUseSrcAttr from appropriate content attributes or from
* style, throw away the current image, and load the appropriate
* image.
--- a/layout/xul/nsLeafBoxFrame.cpp
+++ b/layout/xul/nsLeafBoxFrame.cpp
@@ -328,22 +328,16 @@ nsLeafBoxFrame::Reflow(nsPresContext*
#ifdef DEBUG_FRAME_DUMP
nsresult
nsLeafBoxFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("LeafBox"), aResult);
}
#endif
-nsIAtom*
-nsLeafBoxFrame::GetType_() const
-{
- return FrameType::LeafBox;
-}
-
nsresult
nsLeafBoxFrame::CharacterDataChanged(CharacterDataChangeInfo* aInfo)
{
MarkIntrinsicISizesDirty();
return nsLeafFrame::CharacterDataChanged(aInfo);
}
/* virtual */ nsSize
--- a/layout/xul/nsLeafBoxFrame.h
+++ b/layout/xul/nsLeafBoxFrame.h
@@ -17,17 +17,16 @@ public:
friend nsIFrame* NS_NewLeafBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
virtual nsSize GetXULPrefSize(nsBoxLayoutState& aState) override;
virtual nsSize GetXULMinSize(nsBoxLayoutState& aState) override;
virtual nsSize GetXULMaxSize(nsBoxLayoutState& aState) override;
virtual nscoord GetXULFlex() override;
virtual nscoord GetXULBoxAscent(nsBoxLayoutState& aState) override;
- virtual nsIAtom* GetType_() const override;
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
// This is bogus, but it's what we've always done.
// Note that nsLeafFrame is also eReplacedContainsBlock.
return nsLeafFrame::IsFrameOfType(aFlags &
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock | nsIFrame::eXULBox));
}
--- a/layout/xul/nsMenuFrame.h
+++ b/layout/xul/nsMenuFrame.h
@@ -103,34 +103,32 @@ public:
virtual const nsFrameList& GetChildList(ChildListID aList) const override;
virtual void GetChildLists(nsTArray<ChildList>* aLists) const override;
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
// Overridden to prevent events from going to children of the menu.
virtual void BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
-
+
// this method can destroy the frame
virtual nsresult HandleEvent(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) override;
virtual void SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList) override;
virtual void AppendFrames(ChildListID aListID,
nsFrameList& aFrameList) override;
virtual void InsertFrames(ChildListID aListID,
nsIFrame* aPrevFrame,
nsFrameList& aFrameList) override;
virtual void RemoveFrame(ChildListID aListID,
nsIFrame* aOldFrame) override;
- virtual nsIAtom* GetType_() const override { return nsGkAtoms::menuFrame; }
-
NS_IMETHOD SelectMenu(bool aActivateFlag);
virtual nsIScrollableFrame* GetScrollTargetFrame() override;
// Retrieve the element that the menu should be anchored to. By default this is
// the menu itself. However, the anchor attribute may refer to the value of an
// anonid within the menu's binding, or, if not found, the id of an element in
// the document.
--- a/layout/xul/nsMenuPopupFrame.h
+++ b/layout/xul/nsMenuPopupFrame.h
@@ -332,18 +332,16 @@ public:
// type the first few letters of an item/s name to select it.
nsMenuFrame* FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent, bool& doAction);
void ClearIncrementalString() { mIncrementalString.Truncate(); }
static bool IsWithinIncrementalTime(DOMTimeStamp time) {
return !sTimeoutOfIncrementalSearch || time - sLastKeyTime <= sTimeoutOfIncrementalSearch;
}
- virtual nsIAtom* GetType_() const override { return nsGkAtoms::menuPopupFrame; }
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("MenuPopup"), aResult);
}
#endif
void EnsureMenuItemIsVisible(nsMenuFrame* aMenuFrame);
--- a/layout/xul/nsPopupSetFrame.cpp
+++ b/layout/xul/nsPopupSetFrame.cpp
@@ -32,22 +32,16 @@ nsPopupSetFrame::Init(nsIContent*
// Normally the root box is our grandparent, but in case of wrapping
// it can be our great-grandparent.
nsIRootBox *rootBox = nsIRootBox::GetRootBox(PresContext()->GetPresShell());
if (rootBox) {
rootBox->SetPopupSetFrame(this);
}
}
-nsIAtom*
-nsPopupSetFrame::GetType_() const
-{
- return mozilla::FrameType::PopupSet;
-}
-
void
nsPopupSetFrame::AppendFrames(ChildListID aListID,
nsFrameList& aFrameList)
{
if (aListID == kPopupList) {
AddPopupFrameList(aFrameList);
return;
}
--- a/layout/xul/nsPopupSetFrame.h
+++ b/layout/xul/nsPopupSetFrame.h
@@ -41,18 +41,16 @@ public:
virtual const nsFrameList& GetChildList(ChildListID aList) const override;
virtual void GetChildLists(nsTArray<ChildList>* aLists) const override;
NS_IMETHOD DoXULLayout(nsBoxLayoutState& aBoxLayoutState) override;
// Used to destroy our popup frames.
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override
{
return MakeFrameName(NS_LITERAL_STRING("PopupSet"), aResult);
}
#endif
protected:
--- a/layout/xul/nsRootBoxFrame.cpp
+++ b/layout/xul/nsRootBoxFrame.cpp
@@ -73,23 +73,16 @@ public:
virtual nsresult HandleEvent(nsPresContext* aPresContext,
WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
- /**
- * Get the "type" of the frame
- *
- * @see FrameType::Root
- */
- virtual nsIAtom* GetType_() const override;
-
virtual bool IsFrameOfType(uint32_t aFlags) const override
{
// Override bogus IsFrameOfType in nsBoxFrame.
if (aFlags & (nsIFrame::eReplacedContainsBlock | nsIFrame::eReplaced))
return false;
return nsBoxFrame::IsFrameOfType(aFlags);
}
@@ -207,24 +200,16 @@ nsRootBoxFrame::HandleEvent(nsPresContex
if (aEvent->mMessage == eMouseUp) {
nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
}
return NS_OK;
}
-// REVIEW: The override here was doing nothing since nsBoxFrame is our
-// parent class
-nsIAtom*
-nsRootBoxFrame::GetType_() const
-{
- return FrameType::Root;
-}
-
nsPopupSetFrame*
nsRootBoxFrame::GetPopupSetFrame()
{
return mPopupSetFrame;
}
void
nsRootBoxFrame::SetPopupSetFrame(nsPopupSetFrame* aPopupSet)
--- a/layout/xul/nsScrollbarFrame.cpp
+++ b/layout/xul/nsScrollbarFrame.cpp
@@ -67,22 +67,16 @@ nsScrollbarFrame::Reflow(nsPresContext*
if (aReflowInput.AvailableWidth() == 0) {
aDesiredSize.Width() = 0;
}
if (aReflowInput.AvailableHeight() == 0) {
aDesiredSize.Height() = 0;
}
}
-nsIAtom*
-nsScrollbarFrame::GetType_() const
-{
- return FrameType::Scrollbar;
-}
-
nsresult
nsScrollbarFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
{
nsresult rv = nsBoxFrame::AttributeChanged(aNameSpaceID, aAttribute,
aModType);
--- a/layout/xul/nsScrollbarFrame.h
+++ b/layout/xul/nsScrollbarFrame.h
@@ -62,18 +62,16 @@ public:
nsContainerFrame* aParent,
nsIFrame* aPrevInFlow) override;
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
- virtual nsIAtom* GetType_() const override;
-
void SetScrollbarMediatorContent(nsIContent* aMediator);
nsIScrollbarMediator* GetScrollbarMediator();
// nsBox methods
/**
* Treat scrollbars as clipping their children; overflowing children
* will not be allowed to set an overflow rect on this
--- a/layout/xul/nsSliderFrame.cpp
+++ b/layout/xul/nsSliderFrame.cpp
@@ -905,22 +905,16 @@ nsSliderFrame::SetCurrentPositionInterna
mUserChanged = false;
#ifdef DEBUG_SLIDER
printf("Current Pos=%d\n",aNewPos);
#endif
}
-nsIAtom*
-nsSliderFrame::GetType_() const
-{
- return FrameType::Slider;
-}
-
void
nsSliderFrame::SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList)
{
nsBoxFrame::SetInitialChildList(aListID, aChildList);
if (aListID == kPrincipalList) {
AddListener();
}
--- a/layout/xul/nsSliderFrame.h
+++ b/layout/xul/nsSliderFrame.h
@@ -79,18 +79,16 @@ public:
nsContainerFrame* aParent,
nsIFrame* asPrevInFlow) override;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) override;
- virtual nsIAtom* GetType_() const override;
-
// nsContainerFrame overrides
virtual void SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList) override;
virtual void AppendFrames(ChildListID aListID,
nsFrameList& aFrameList) override;
virtual void InsertFrames(ChildListID aListID,
nsIFrame* aPrevFrame,
nsFrameList& aFrameList) override;
--- a/layout/xul/nsXULLabelFrame.cpp
+++ b/layout/xul/nsXULLabelFrame.cpp
@@ -91,22 +91,16 @@ nsXULLabelFrame::AttributeChanged(int32_
// If the accesskey changed, register for the new value
// The old value has been unregistered in nsXULElement::SetAttr
if (aAttribute == nsGkAtoms::accesskey || aAttribute == nsGkAtoms::control)
RegUnregAccessKey(true);
return rv;
}
-nsIAtom*
-nsXULLabelFrame::GetType_() const
-{
- return FrameType::XULLabel;
-}
-
/////////////////////////////////////////////////////////////////////////////
// Diagnostics
#ifdef DEBUG_FRAME_DUMP
nsresult
nsXULLabelFrame::GetFrameName(nsAString& aResult) const
{
return MakeFrameName(NS_LITERAL_STRING("XULLabel"), aResult);
--- a/layout/xul/nsXULLabelFrame.h
+++ b/layout/xul/nsXULLabelFrame.h
@@ -29,23 +29,16 @@ public:
nsIFrame* aPrevInFlow) override;
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType) override;
- /**
- * Get the "type" of the frame
- *
- * @see nsGkAtoms::XULLabelFrame
- */
- virtual nsIAtom* GetType_() const override;
-
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
protected:
explicit nsXULLabelFrame(nsStyleContext *aContext)
: nsBlockFrame(aContext, FrameType::XULLabel)
{}
--- a/widget/nsNativeTheme.cpp
+++ b/widget/nsNativeTheme.cpp
@@ -707,17 +707,17 @@ nsNativeTheme::GetAdjacentSiblingFrameWi
return nullptr;
return sibling;
}
bool
nsNativeTheme::IsRangeHorizontal(nsIFrame* aFrame)
{
nsIFrame* rangeFrame = aFrame;
- if (rangeFrame->GetType() != FrameType::Range) {
+ if (!rangeFrame->IsRangeFrame()) {
// If the thumb's frame is passed in, get its range parent:
rangeFrame = aFrame->GetParent();
}
if (rangeFrame->IsRangeFrame()) {
return static_cast<nsRangeFrame*>(rangeFrame)->IsHorizontal();
}
// Not actually a range frame - just use the ratio of the frame's size to
// decide: