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:
Mats Palmgren
2017-05-26 12:11:12 +02:00
parent 1cf5bc6ecb
commit 661649e16a
24 changed files with 18 additions and 77 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -176,12 +176,6 @@ nsGfxButtonControlFrame::AttributeChanged(int32_t aNameSpaceID,
return rv;
}
bool
nsGfxButtonControlFrame::IsLeaf() const
{
return true;
}
nsContainerFrame*
nsGfxButtonControlFrame::GetContentInsertionFrame()
{

View File

@@ -46,8 +46,6 @@ public:
nsIAtom* aAttribute,
int32_t aModType) override;
virtual bool IsLeaf() const override;
virtual nsContainerFrame* GetContentInsertionFrame() override;
protected:

View File

@@ -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,

View File

@@ -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;

View File

@@ -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,

View File

@@ -56,8 +56,6 @@ public:
}
#endif
virtual bool IsLeaf() const override { return true; }
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() override;
#endif

View File

@@ -614,12 +614,6 @@ nsTextControlFrame::IsXULCollapsed()
return false;
}
bool
nsTextControlFrame::IsLeaf() const
{
return true;
}
NS_IMETHODIMP
nsTextControlFrame::ScrollOnFocusEvent::Run()
{

View File

@@ -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

View File

@@ -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);

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -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)

View File

@@ -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)

View File

@@ -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);

View File

@@ -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;

View File

@@ -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,

View File

@@ -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,

View File

@@ -25,12 +25,6 @@ nsMathMLmspaceFrame::~nsMathMLmspaceFrame()
{
}
bool
nsMathMLmspaceFrame::IsLeaf() const
{
return true;
}
void
nsMathMLmspaceFrame::ProcessAttributes(nsPresContext* aPresContext)
{

View File

@@ -27,8 +27,6 @@ public:
return NS_OK;
}
virtual bool IsLeaf() const override;
virtual void
Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,

View File

@@ -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

View File

@@ -434,7 +434,7 @@ nsMenuPopupFrame::SetInitialChildList(ChildListID aListID,
}
bool
nsMenuPopupFrame::IsLeaf() const
nsMenuPopupFrame::IsLeafDynamic() const
{
if (mGeneratedChildren)
return false;

View File

@@ -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,