Bug 1362886 part 2 - Devirtualize the IsLeaf() method by doing an array lookup instead. r=jfkthame
MozReview-Commit-ID: 1zm9rFhRVZ3
This commit is contained in:
@@ -44,7 +44,6 @@ public:
|
||||
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
int32_t aModType) override;
|
||||
virtual bool IsLeaf() const override { return true; }
|
||||
virtual nsContainerFrame* GetContentInsertionFrame() override;
|
||||
|
||||
virtual Element* GetPseudoElement(CSSPseudoElementType aType) override;
|
||||
|
||||
@@ -55,10 +55,6 @@ public:
|
||||
nsIAtom* aAttribute,
|
||||
int32_t aModType) override;
|
||||
virtual void ContentStatesChanged(mozilla::EventStates aStates) override;
|
||||
virtual bool IsLeaf() const override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// nsIAnonymousContentCreator
|
||||
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
|
||||
|
||||
@@ -176,12 +176,6 @@ nsGfxButtonControlFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool
|
||||
nsGfxButtonControlFrame::IsLeaf() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
nsContainerFrame*
|
||||
nsGfxButtonControlFrame::GetContentInsertionFrame()
|
||||
{
|
||||
|
||||
@@ -46,8 +46,6 @@ public:
|
||||
nsIAtom* aAttribute,
|
||||
int32_t aModType) override;
|
||||
|
||||
virtual bool IsLeaf() const override;
|
||||
|
||||
virtual nsContainerFrame* GetContentInsertionFrame() override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -38,8 +38,6 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual bool IsLeaf() const override { return true; }
|
||||
|
||||
// nsIAnonymousContentCreator
|
||||
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
|
||||
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
|
||||
|
||||
@@ -48,7 +48,6 @@ public:
|
||||
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
|
||||
virtual void ContentStatesChanged(mozilla::EventStates aStates) override;
|
||||
virtual bool IsLeaf() const override { return true; }
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
virtual mozilla::a11y::AccType AccessibleType() override;
|
||||
|
||||
@@ -46,8 +46,6 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual bool IsLeaf() const override { return true; }
|
||||
|
||||
// nsIAnonymousContentCreator
|
||||
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
|
||||
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
|
||||
|
||||
@@ -56,8 +56,6 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual bool IsLeaf() const override { return true; }
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
virtual mozilla::a11y::AccType AccessibleType() override;
|
||||
#endif
|
||||
|
||||
@@ -614,12 +614,6 @@ nsTextControlFrame::IsXULCollapsed()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
nsTextControlFrame::IsLeaf() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextControlFrame::ScrollOnFocusEvent::Run()
|
||||
{
|
||||
|
||||
@@ -88,8 +88,6 @@ public:
|
||||
virtual nsSize GetXULMinSize(nsBoxLayoutState& aBoxLayoutState) override;
|
||||
virtual bool IsXULCollapsed() override;
|
||||
|
||||
virtual bool IsLeaf() const override;
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
virtual mozilla::a11y::AccType AccessibleType() override;
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,6 @@ public:
|
||||
|
||||
// Bypass the nsContainerFrame/nsSplittableFrame impl of the following
|
||||
// methods so we behave like a leaf frame.
|
||||
bool IsLeaf() const override { return true; }
|
||||
FrameSearchResult PeekOffsetNoAmount(bool aForward, int32_t* aOffset) override
|
||||
{
|
||||
return nsFrame::PeekOffsetNoAmount(aForward, aOffset);
|
||||
|
||||
@@ -351,12 +351,6 @@ nsContainerFrame::ChildIsDirty(nsIFrame* aChild)
|
||||
AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
|
||||
}
|
||||
|
||||
bool
|
||||
nsContainerFrame::IsLeaf() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIFrame::FrameSearchResult
|
||||
nsContainerFrame::PeekOffsetNoAmount(bool aForward, int32_t* aOffset)
|
||||
{
|
||||
|
||||
@@ -65,7 +65,6 @@ public:
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
|
||||
virtual void ChildIsDirty(nsIFrame* aChild) override;
|
||||
|
||||
virtual bool IsLeaf() const override;
|
||||
virtual FrameSearchResult PeekOffsetNoAmount(bool aForward, int32_t* aOffset) override;
|
||||
virtual FrameSearchResult PeekOffsetCharacter(bool aForward, int32_t* aOffset,
|
||||
bool aRespectClusters = true) override;
|
||||
|
||||
@@ -6297,12 +6297,6 @@ nsIFrame::GetNearestWidget(nsPoint& aOffset) const
|
||||
return widget;
|
||||
}
|
||||
|
||||
bool
|
||||
nsIFrame::IsLeaf() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Matrix4x4
|
||||
nsIFrame::GetTransformMatrix(const nsIFrame* aStopAtAncestor,
|
||||
nsIFrame** aOutAncestor)
|
||||
|
||||
@@ -1101,13 +1101,6 @@ nsHTMLFramesetFrame::GetFrameName(nsAString& aResult) const
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
nsHTMLFramesetFrame::IsLeaf() const
|
||||
{
|
||||
// We handle constructing our kids manually
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsHTMLFramesetFrame::CanResize(bool aVertical,
|
||||
bool aLeft)
|
||||
|
||||
@@ -108,8 +108,6 @@ public:
|
||||
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
||||
#endif
|
||||
|
||||
virtual bool IsLeaf() const override;
|
||||
|
||||
void StartMouseDrag(nsPresContext* aPresContext,
|
||||
nsHTMLFramesetBorderFrame* aBorder,
|
||||
mozilla::WidgetGUIEvent* aEvent);
|
||||
|
||||
@@ -2838,7 +2838,15 @@ public:
|
||||
* (non-anonymous, XBL-bound, CSS generated content, etc) children should not
|
||||
* be constructed.
|
||||
*/
|
||||
virtual bool IsLeaf() const;
|
||||
bool IsLeaf() const
|
||||
{
|
||||
MOZ_ASSERT(uint8_t(mClass) < mozilla::ArrayLength(sFrameClassBits));
|
||||
FrameClassBits bits = sFrameClassBits[uint8_t(mClass)];
|
||||
if (MOZ_UNLIKELY(bits & eFrameClassBitsDynamicLeaf)) {
|
||||
return IsLeafDynamic();
|
||||
}
|
||||
return bits & eFrameClassBitsLeaf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks all display items created by this frame as needing a repaint,
|
||||
@@ -3820,6 +3828,13 @@ protected:
|
||||
nsView* aNewParentView,
|
||||
nsView* aOldParentView);
|
||||
|
||||
/**
|
||||
* To be overridden by frame classes that have a varying IsLeaf() state and
|
||||
* is indicating that with DynamicLeaf in nsFrameIdList.h.
|
||||
* @see IsLeaf()
|
||||
*/
|
||||
virtual bool IsLeafDynamic() const { return false; }
|
||||
|
||||
// Members
|
||||
nsRect mRect;
|
||||
nsIContent* mContent;
|
||||
|
||||
@@ -182,12 +182,6 @@ nsVideoFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
||||
nsContainerFrame::DestroyFrom(aDestructRoot);
|
||||
}
|
||||
|
||||
bool
|
||||
nsVideoFrame::IsLeaf() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
already_AddRefed<Layer>
|
||||
nsVideoFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager,
|
||||
|
||||
@@ -69,7 +69,6 @@ public:
|
||||
nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
|
||||
nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
|
||||
void DestroyFrom(nsIFrame* aDestructRoot) override;
|
||||
bool IsLeaf() const override;
|
||||
|
||||
void Reflow(nsPresContext* aPresContext,
|
||||
ReflowOutput& aDesiredSize,
|
||||
|
||||
@@ -25,12 +25,6 @@ nsMathMLmspaceFrame::~nsMathMLmspaceFrame()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
nsMathMLmspaceFrame::IsLeaf() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
nsMathMLmspaceFrame::ProcessAttributes(nsPresContext* aPresContext)
|
||||
{
|
||||
|
||||
@@ -27,8 +27,6 @@ public:
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
virtual bool IsLeaf() const override;
|
||||
|
||||
virtual void
|
||||
Reflow(nsPresContext* aPresContext,
|
||||
ReflowOutput& aDesiredSize,
|
||||
|
||||
@@ -40,8 +40,6 @@ public:
|
||||
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
|
||||
|
||||
virtual bool IsLeaf() const override;
|
||||
|
||||
#ifdef DEBUG_FRAME_DUMP
|
||||
virtual nsresult GetFrameName(nsAString& aResult) const override
|
||||
{
|
||||
@@ -157,12 +155,6 @@ nsSVGUseFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
||||
use->DestroyAnonymousContent();
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGUseFrame::IsLeaf() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGDisplayableFrame methods
|
||||
|
||||
@@ -434,7 +434,7 @@ nsMenuPopupFrame::SetInitialChildList(ChildListID aListID,
|
||||
}
|
||||
|
||||
bool
|
||||
nsMenuPopupFrame::IsLeaf() const
|
||||
nsMenuPopupFrame::IsLeafDynamic() const
|
||||
{
|
||||
if (mGeneratedChildren)
|
||||
return false;
|
||||
|
||||
@@ -246,7 +246,7 @@ public:
|
||||
virtual void SetInitialChildList(ChildListID aListID,
|
||||
nsFrameList& aChildList) override;
|
||||
|
||||
virtual bool IsLeaf() const override;
|
||||
virtual bool IsLeafDynamic() const override;
|
||||
|
||||
// layout, position and display the popup as needed
|
||||
void LayoutPopup(nsBoxLayoutState& aState, nsIFrame* aParentMenu,
|
||||
|
||||
Reference in New Issue
Block a user