Bug 1334247 - Remove nsIAnonymousContentCreator::CreateFrameFor

Tag #1375
This commit is contained in:
Matt A. Tobin 2020-04-14 22:04:32 -04:00 committed by Roy Tam
commit 499252b89f
6 changed files with 19 additions and 60 deletions

View file

@ -249,6 +249,7 @@ nsComboboxControlFrame::~nsComboboxControlFrame()
//--------------------------------------------------------------
NS_QUERYFRAME_HEAD(nsComboboxControlFrame)
NS_QUERYFRAME_ENTRY(nsComboboxControlFrame)
NS_QUERYFRAME_ENTRY(nsIComboboxControlFrame)
NS_QUERYFRAME_ENTRY(nsIFormControlFrame)
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
@ -1352,16 +1353,9 @@ nsComboboxDisplayFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
nsIFrame*
nsComboboxControlFrame::CreateFrameFor(nsIContent* aContent)
nsComboboxControlFrame::CreateFrameForDisplayNode()
{
NS_PRECONDITION(nullptr != aContent, "null ptr");
NS_ASSERTION(mDisplayContent, "mDisplayContent can't be null!");
if (mDisplayContent != aContent) {
// We only handle the frames for mDisplayContent here
return nullptr;
}
MOZ_ASSERT(mDisplayContent);
// Get PresShell
nsIPresShell *shell = PresContext()->PresShell();
@ -1386,7 +1380,7 @@ nsComboboxControlFrame::CreateFrameFor(nsIContent* aContent)
nsIFrame* textFrame = NS_NewTextFrame(shell, textStyleContext);
// initialize the text frame
textFrame->Init(aContent, mDisplayFrame, nullptr);
textFrame->Init(mDisplayContent, mDisplayFrame, nullptr);
mDisplayContent->SetPrimaryFrame(textFrame);
nsFrameList textList(textFrame, textFrame);

View file

@ -54,6 +54,7 @@ class nsComboboxControlFrame final : public nsBlockFrame,
typedef mozilla::gfx::DrawTarget DrawTarget;
public:
NS_DECL_QUERYFRAME_TARGET(nsComboboxControlFrame)
friend nsContainerFrame* NS_NewComboboxControlFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext,
nsFrameState aFlags);
@ -69,7 +70,9 @@ public:
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) override;
virtual nsIFrame* CreateFrameFor(nsIContent* aContent) override;
nsIContent* GetDisplayNode() { return mDisplayContent; }
nsIFrame* CreateFrameForDisplayNode();
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() override;

View file

@ -77,30 +77,6 @@ nsGfxButtonControlFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElemen
}
}
// Create the text content used as label for the button.
// The frame will be generated by the frame constructor.
nsIFrame*
nsGfxButtonControlFrame::CreateFrameFor(nsIContent* aContent)
{
nsIFrame * newFrame = nullptr;
if (aContent == mTextContent) {
nsContainerFrame* parentFrame = do_QueryFrame(mFrames.FirstChild());
nsPresContext* presContext = PresContext();
RefPtr<nsStyleContext> textStyleContext;
textStyleContext = presContext->StyleSet()->
ResolveStyleForText(mTextContent, mStyleContext);
newFrame = NS_NewTextFrame(presContext->PresShell(), textStyleContext);
// initialize the text frame
newFrame->Init(mTextContent, parentFrame, nullptr);
mTextContent->SetPrimaryFrame(newFrame);
}
return newFrame;
}
NS_QUERYFRAME_HEAD(nsGfxButtonControlFrame)
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
NS_QUERYFRAME_TAIL_INHERITING(nsHTMLButtonControlFrame)

View file

@ -42,7 +42,6 @@ public:
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
uint32_t aFilter) override;
virtual nsIFrame* CreateFrameFor(nsIContent* aContent) override;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,