Bug 945517 - Make nsIFrame::GetPseudoElementContent return Element* instead of nsIContent*. r=bz

This commit is contained in:
Cameron McCormack 2013-12-03 15:49:03 +11:00
parent 13008130e3
commit 7073170612
19 changed files with 122 additions and 104 deletions

View File

@ -1261,6 +1261,7 @@ public:
* Unbinds the content from the tree and nulls it out if it's not null.
*/
static void DestroyAnonymousContent(nsCOMPtr<nsIContent>* aContent);
static void DestroyAnonymousContent(nsCOMPtr<Element>* aElement);
static void DeferredFinalize(nsISupports* aSupports);
static void DeferredFinalize(mozilla::DeferredFinalizeAppendFunction aAppendFunc,

View File

@ -1960,6 +1960,12 @@ public:
return mCreatingStaticClone;
}
/**
* Creates a new element in the HTML namespace with a local name given by
* aTag.
*/
already_AddRefed<Element> CreateHTMLElement(nsIAtom* aTag);
// WebIDL API
nsIGlobalObject* GetParentObject() const
{

View File

@ -4351,6 +4351,11 @@ public:
mParent = mContent->GetParent();
mDoc = mContent->OwnerDoc();
}
AnonymousContentDestroyer(nsCOMPtr<Element>* aElement) {
mContent = aElement->forget();
mParent = mContent->GetParent();
mDoc = mContent->OwnerDoc();
}
NS_IMETHOD Run() {
mContent->UnbindFromTree();
return NS_OK;
@ -4372,6 +4377,15 @@ nsContentUtils::DestroyAnonymousContent(nsCOMPtr<nsIContent>* aContent)
}
}
/* static */
void
nsContentUtils::DestroyAnonymousContent(nsCOMPtr<Element>* aElement)
{
if (*aElement) {
AddScriptRunner(new AnonymousContentDestroyer(aElement));
}
}
/* static */
void
nsContentUtils::NotifyInstalledMenuKeyboardListener(bool aInstalling)

View File

@ -11458,6 +11458,23 @@ nsIDocument::SetStateObject(nsIStructuredCloneContainer *scContainer)
mStateObjectCached = nullptr;
}
already_AddRefed<Element>
nsIDocument::CreateHTMLElement(nsIAtom* aTag)
{
nsCOMPtr<nsINodeInfo> nodeInfo;
nodeInfo = mNodeInfoManager->GetNodeInfo(aTag, nullptr, kNameSpaceID_XHTML,
nsIDOMNode::ELEMENT_NODE);
MOZ_ASSERT(nodeInfo, "GetNodeInfo should never fail");
nsCOMPtr<nsIContent> content = nullptr;
DebugOnly<nsresult> rv = NS_NewHTMLElement(getter_AddRefs(content),
nodeInfo.forget(),
mozilla::dom::NOT_FROM_PARSER);
MOZ_ASSERT(NS_SUCCEEDED(rv), "NS_NewHTMLElement should never fail");
return dont_AddRef(content.forget().get()->AsElement());
}
bool
MarkDocumentTreeToBeInSyncOperation(nsIDocument* aDoc, void* aData)
{

View File

@ -15,6 +15,8 @@
#include "nsIFormControl.h"
#include "nsStyleSet.h"
using mozilla::dom::Element;
nsColorControlFrame::nsColorControlFrame(nsStyleContext* aContext):
nsColorControlFrameSuper(aContext)
{
@ -60,20 +62,12 @@ nsresult
nsColorControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
{
nsCOMPtr<nsIDocument> doc = mContent->GetCurrentDoc();
nsCOMPtr<nsINodeInfo> nodeInfo =
doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::div, nullptr,
kNameSpaceID_XHTML,
nsIDOMNode::ELEMENT_NODE);
nsresult rv = NS_NewHTMLElement(getter_AddRefs(mColorContent),
nodeInfo.forget(),
mozilla::dom::NOT_FROM_PARSER);
NS_ENSURE_SUCCESS(rv, rv);
mColorContent = doc->CreateHTMLElement(nsGkAtoms::div);
// Mark the element to be native anonymous before setting any attributes.
mColorContent->SetIsNativeAnonymousRoot();
rv = UpdateColor();
nsresult rv = UpdateColor();
NS_ENSURE_SUCCESS(rv, rv);
nsCSSPseudoElements::Type pseudoType = nsCSSPseudoElements::ePseudo_mozColorSwatch;
@ -136,12 +130,12 @@ nsColorControlFrame::GetContentInsertionFrame()
return this;
}
nsIContent*
nsColorControlFrame::GetPseudoElementContent(nsCSSPseudoElements::Type aType)
Element*
nsColorControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
{
if (aType == nsCSSPseudoElements::ePseudo_mozColorSwatch) {
return mColorContent;
}
return nsContainerFrame::GetPseudoElementContent(aType);
return nsContainerFrame::GetPseudoElement(aType);
}

View File

@ -17,6 +17,8 @@ typedef nsHTMLButtonControlFrame nsColorControlFrameSuper;
class nsColorControlFrame MOZ_FINAL : public nsColorControlFrameSuper,
public nsIAnonymousContentCreator
{
typedef mozilla::dom::Element Element;
public:
friend nsIFrame* NS_NewColorControlFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
@ -44,7 +46,7 @@ public:
virtual bool IsLeaf() const MOZ_OVERRIDE { return true; }
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE;
virtual nsIContent* GetPseudoElementContent(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
private:
nsColorControlFrame(nsStyleContext* aContext);
@ -52,7 +54,7 @@ private:
// Update the color swatch
nsresult UpdateColor();
nsCOMPtr<nsIContent> mColorContent;
nsCOMPtr<Element> mColorContent;
};

View File

@ -24,6 +24,7 @@
#include "nsThemeConstants.h"
#include <algorithm>
using mozilla::dom::Element;
using mozilla::dom::HTMLMeterElement;
nsIFrame*
@ -61,16 +62,8 @@ nsMeterFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
// Get the NodeInfoManager and tag necessary to create the meter bar div.
nsCOMPtr<nsIDocument> doc = mContent->GetDocument();
nsCOMPtr<nsINodeInfo> nodeInfo;
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::div, nullptr,
kNameSpaceID_XHTML,
nsIDOMNode::ELEMENT_NODE);
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
// Create the div.
nsresult rv = NS_NewHTMLElement(getter_AddRefs(mBarDiv), nodeInfo.forget(),
mozilla::dom::NOT_FROM_PARSER);
NS_ENSURE_SUCCESS(rv, rv);
mBarDiv = doc->CreateHTMLElement(nsGkAtoms::div);
// Associate ::-moz-meter-bar pseudo-element to the anonymous child.
nsCSSPseudoElements::Type pseudoType = nsCSSPseudoElements::ePseudo_mozMeterBar;
@ -278,12 +271,12 @@ nsMeterFrame::ShouldUseNativeStyle() const
NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND);
}
nsIContent*
nsMeterFrame::GetPseudoElementContent(nsCSSPseudoElements::Type aType)
Element*
nsMeterFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
{
if (aType == nsCSSPseudoElements::ePseudo_mozMeterBar) {
return mBarDiv;
}
return nsContainerFrame::GetPseudoElementContent(aType);
return nsContainerFrame::GetPseudoElement(aType);
}

View File

@ -15,6 +15,8 @@ class nsMeterFrame : public nsContainerFrame,
public nsIAnonymousContentCreator
{
typedef mozilla::dom::Element Element;
public:
NS_DECL_QUERYFRAME_TARGET(nsMeterFrame)
NS_DECL_QUERYFRAME
@ -66,7 +68,7 @@ public:
*/
bool ShouldUseNativeStyle() const;
virtual nsIContent* GetPseudoElementContent(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
protected:
// Helper function which reflow the anonymous div frame.
@ -78,7 +80,7 @@ protected:
* The div used to show the meter bar.
* @see nsMeterFrame::CreateAnonymousContent
*/
nsCOMPtr<nsIContent> mBarDiv;
nsCOMPtr<Element> mBarDiv;
};
#endif

View File

@ -175,7 +175,7 @@ nsNumberControlFrame::AttributeChanged(int32_t aNameSpaceID,
}
nsresult
nsNumberControlFrame::MakeAnonymousElement(nsIContent** aResult,
nsNumberControlFrame::MakeAnonymousElement(Element** aResult,
nsTArray<ContentInfo>& aElements,
nsIAtom* aTagName,
nsCSSPseudoElements::Type aPseudoType,
@ -183,15 +183,7 @@ nsNumberControlFrame::MakeAnonymousElement(nsIContent** aResult,
{
// Get the NodeInfoManager and tag necessary to create the anonymous divs.
nsCOMPtr<nsIDocument> doc = mContent->GetDocument();
nsCOMPtr<nsINodeInfo> nodeInfo;
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(aTagName, nullptr,
kNameSpaceID_XHTML,
nsIDOMNode::ELEMENT_NODE);
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = NS_NewHTMLElement(aResult, nodeInfo.forget(),
dom::NOT_FROM_PARSER);
NS_ENSURE_SUCCESS(rv, rv);
nsRefPtr<Element> resultElement = doc->CreateHTMLElement(aTagName);
// If we legitimately fail this assertion and need to allow
// non-pseudo-element anonymous children, then we'll need to add a branch
@ -200,7 +192,6 @@ nsNumberControlFrame::MakeAnonymousElement(nsIContent** aResult,
NS_ASSERTION(aPseudoType != nsCSSPseudoElements::ePseudo_NotPseudoElement,
"Expecting anonymous children to all be pseudo-elements");
// Associate the pseudo-element with the anonymous child
Element* resultElement = (*aResult)->AsElement();
nsRefPtr<nsStyleContext> newStyleContext =
PresContext()->StyleSet()->ResolvePseudoElementStyle(mContent->AsElement(),
aPseudoType,
@ -210,6 +201,8 @@ nsNumberControlFrame::MakeAnonymousElement(nsIContent** aResult,
if (!aElements.AppendElement(ContentInfo(resultElement, newStyleContext))) {
return NS_ERROR_OUT_OF_MEMORY;
}
resultElement.forget(aResult);
return NS_OK;
}
@ -379,8 +372,8 @@ nsNumberControlFrame::UpdateForValueChange(const nsAString& aValue)
HTMLInputElement::FromContent(mTextField)->SetValue(aValue);
}
nsIContent*
nsNumberControlFrame::GetPseudoElementContent(nsCSSPseudoElements::Type aType)
Element*
nsNumberControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
{
if (aType == nsCSSPseudoElements::ePseudo_mozNumberWrapper) {
return mOuterWrapper;
@ -402,5 +395,5 @@ nsNumberControlFrame::GetPseudoElementContent(nsCSSPseudoElements::Type aType)
return mSpinDown;
}
return nsContainerFrame::GetPseudoElementContent(aType);
return nsContainerFrame::GetPseudoElement(aType);
}

View File

@ -30,6 +30,7 @@ class nsNumberControlFrame MOZ_FINAL : public nsContainerFrame
friend nsIFrame*
NS_NewNumberControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
typedef mozilla::dom::Element Element;
typedef mozilla::dom::HTMLInputElement HTMLInputElement;
typedef mozilla::WidgetEvent WidgetEvent;
typedef mozilla::WidgetGUIEvent WidgetGUIEvent;
@ -105,11 +106,11 @@ public:
void HandleFocusEvent(WidgetEvent* aEvent);
virtual nsIContent* GetPseudoElementContent(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
private:
nsresult MakeAnonymousElement(nsIContent** aResult,
nsresult MakeAnonymousElement(Element** aResult,
nsTArray<ContentInfo>& aElements,
nsIAtom* aTagName,
nsCSSPseudoElements::Type aPseudoType,
@ -124,11 +125,11 @@ private:
* The text field used to edit and show the number.
* @see nsNumberControlFrame::CreateAnonymousContent.
*/
nsCOMPtr<nsIContent> mOuterWrapper;
nsCOMPtr<nsIContent> mTextField;
nsCOMPtr<nsIContent> mSpinBox;
nsCOMPtr<nsIContent> mSpinUp;
nsCOMPtr<nsIContent> mSpinDown;
nsCOMPtr<Element> mOuterWrapper;
nsCOMPtr<Element> mTextField;
nsCOMPtr<Element> mSpinBox;
nsCOMPtr<Element> mSpinUp;
nsCOMPtr<Element> mSpinDown;
bool mHandlingInputEvent;
};

View File

@ -58,19 +58,9 @@ nsProgressFrame::DestroyFrom(nsIFrame* aDestructRoot)
nsresult
nsProgressFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
{
// Get the NodeInfoManager and tag necessary to create the progress bar div.
// Create the progress bar div.
nsCOMPtr<nsIDocument> doc = mContent->GetDocument();
nsCOMPtr<nsINodeInfo> nodeInfo;
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::div, nullptr,
kNameSpaceID_XHTML,
nsIDOMNode::ELEMENT_NODE);
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
// Create the div.
nsresult rv = NS_NewHTMLElement(getter_AddRefs(mBarDiv), nodeInfo.forget(),
mozilla::dom::NOT_FROM_PARSER);
NS_ENSURE_SUCCESS(rv, rv);
mBarDiv = doc->CreateHTMLElement(nsGkAtoms::div);
// Associate ::-moz-progress-bar pseudo-element to the anonymous child.
nsCSSPseudoElements::Type pseudoType = nsCSSPseudoElements::ePseudo_mozProgressBar;
@ -288,12 +278,12 @@ nsProgressFrame::ShouldUseNativeStyle() const
NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND);
}
nsIContent*
nsProgressFrame::GetPseudoElementContent(nsCSSPseudoElements::Type aType)
Element*
nsProgressFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
{
if (aType == nsCSSPseudoElements::ePseudo_mozProgressBar) {
return mBarDiv;
}
return nsContainerFrame::GetPseudoElementContent(aType);
return nsContainerFrame::GetPseudoElement(aType);
}

View File

@ -16,6 +16,8 @@ class nsBaseContentList;
class nsProgressFrame : public nsContainerFrame,
public nsIAnonymousContentCreator
{
typedef mozilla::dom::Element Element;
public:
NS_DECL_QUERYFRAME_TARGET(nsProgressFrame)
NS_DECL_QUERYFRAME
@ -71,7 +73,7 @@ public:
*/
bool ShouldUseNativeStyle() const;
virtual nsIContent* GetPseudoElementContent(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
protected:
// Helper function which reflow the anonymous div frame.
@ -84,7 +86,7 @@ protected:
* The div used to show the progress bar.
* @see nsProgressFrame::CreateAnonymousContent
*/
nsCOMPtr<nsIContent> mBarDiv;
nsCOMPtr<Element> mBarDiv;
};
#endif

View File

@ -33,6 +33,7 @@
#define LONG_SIDE_TO_SHORT_SIDE_RATIO 10
using namespace mozilla;
using namespace mozilla::dom;
nsIFrame*
NS_NewRangeFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
@ -98,31 +99,25 @@ nsRangeFrame::DestroyFrom(nsIFrame* aDestructRoot)
}
nsresult
nsRangeFrame::MakeAnonymousDiv(nsIContent** aResult,
nsRangeFrame::MakeAnonymousDiv(Element** aResult,
nsCSSPseudoElements::Type aPseudoType,
nsTArray<ContentInfo>& aElements)
{
// Get the NodeInfoManager and tag necessary to create the anonymous divs.
nsCOMPtr<nsIDocument> doc = mContent->GetDocument();
nsRefPtr<Element> resultElement = doc->CreateHTMLElement(nsGkAtoms::div);
nsCOMPtr<nsINodeInfo> nodeInfo;
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::div, nullptr,
kNameSpaceID_XHTML,
nsIDOMNode::ELEMENT_NODE);
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = NS_NewHTMLElement(aResult, nodeInfo.forget(),
dom::NOT_FROM_PARSER);
NS_ENSURE_SUCCESS(rv, rv);
// Associate the pseudo-element with the anonymous child.
nsRefPtr<nsStyleContext> newStyleContext =
PresContext()->StyleSet()->ResolvePseudoElementStyle(mContent->AsElement(),
aPseudoType,
StyleContext(),
(*aResult)->AsElement());
resultElement);
if (!aElements.AppendElement(ContentInfo(*aResult, newStyleContext))) {
if (!aElements.AppendElement(ContentInfo(resultElement, newStyleContext))) {
return NS_ERROR_OUT_OF_MEMORY;
}
resultElement.forget(aResult);
return NS_OK;
}
@ -833,8 +828,8 @@ nsRangeFrame::ShouldUseNativeStyle() const
STYLES_DISABLING_NATIVE_THEMING);
}
nsIContent*
nsRangeFrame::GetPseudoElementContent(nsCSSPseudoElements::Type aType)
Element*
nsRangeFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
{
if (aType == nsCSSPseudoElements::ePseudo_mozRangeTrack) {
return mTrackDiv;
@ -848,5 +843,5 @@ nsRangeFrame::GetPseudoElementContent(nsCSSPseudoElements::Type aType)
return mProgressDiv;
}
return nsContainerFrame::GetPseudoElementContent(aType);
return nsContainerFrame::GetPseudoElement(aType);
}

View File

@ -24,6 +24,8 @@ class nsRangeFrame : public nsContainerFrame,
nsRangeFrame(nsStyleContext* aContext);
virtual ~nsRangeFrame();
typedef mozilla::dom::Element Element;
public:
NS_DECL_QUERYFRAME_TARGET(nsRangeFrame)
NS_DECL_QUERYFRAME
@ -122,11 +124,11 @@ public:
*/
void UpdateForValueChange();
virtual nsIContent* GetPseudoElementContent(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
private:
nsresult MakeAnonymousDiv(nsIContent** aResult,
nsresult MakeAnonymousDiv(Element** aResult,
nsCSSPseudoElements::Type aPseudoType,
nsTArray<ContentInfo>& aElements);
@ -145,7 +147,7 @@ private:
* The div used to show the ::-moz-range-track pseudo-element.
* @see nsRangeFrame::CreateAnonymousContent
*/
nsCOMPtr<nsIContent> mTrackDiv;
nsCOMPtr<Element> mTrackDiv;
/**
* The div used to show the ::-moz-range-progress pseudo-element, which is
@ -153,13 +155,13 @@ private:
* thumb's current position.
* @see nsRangeFrame::CreateAnonymousContent
*/
nsCOMPtr<nsIContent> mProgressDiv;
nsCOMPtr<Element> mProgressDiv;
/**
* The div used to show the ::-moz-range-thumb pseudo-element.
* @see nsRangeFrame::CreateAnonymousContent
*/
nsCOMPtr<nsIContent> mThumbDiv;
nsCOMPtr<Element> mThumbDiv;
};
#endif

View File

@ -1432,15 +1432,19 @@ nsTextControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
}
nsIContent*
nsTextControlFrame::GetPseudoElementContent(nsCSSPseudoElements::Type aType)
mozilla::dom::Element*
nsTextControlFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
{
if (aType == nsCSSPseudoElements::ePseudo_mozPlaceholder) {
nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
return txtCtrl->GetPlaceholderNode();
nsIContent* placeholderNode = txtCtrl->GetPlaceholderNode();
if (placeholderNode && placeholderNode->IsElement()) {
return placeholderNode->AsElement();
}
return nullptr;
}
return nsContainerFrame::GetPseudoElementContent(aType);
return nsContainerFrame::GetPseudoElement(aType);
}
NS_IMETHODIMP

View File

@ -94,7 +94,7 @@ public:
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
virtual nsIContent* GetPseudoElementContent(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
virtual mozilla::dom::Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
//==== BEGIN NSIFORMCONTROLFRAME
virtual void SetFocus(bool aOn , bool aRepaint) MOZ_OVERRIDE;

View File

@ -85,9 +85,10 @@
#include "mozilla/gfx/Tools.h"
using namespace mozilla;
using namespace mozilla::css;
using namespace mozilla::dom;
using namespace mozilla::layers;
using namespace mozilla::layout;
using namespace mozilla::css;
// Struct containing cached metrics for box-wrapped frames.
struct nsBoxLayoutMetrics
@ -8105,8 +8106,8 @@ nsIFrame::IsPseudoStackingContextFromStyle() {
disp->IsFloating(this);
}
nsIContent*
nsIFrame::GetPseudoElementContent(nsCSSPseudoElements::Type aType)
Element*
nsIFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
{
nsIFrame* frame = nullptr;
@ -8116,7 +8117,14 @@ nsIFrame::GetPseudoElementContent(nsCSSPseudoElements::Type aType)
frame = nsLayoutUtils::GetAfterFrame(this);
}
return frame ? frame->GetContent() : nullptr;
if (frame) {
nsIContent* content = frame->GetContent();
if (content->IsElement()) {
return content->AsElement();
}
}
return nullptr;
}
nsIFrame::ContentOffsets::ContentOffsets()

View File

@ -3026,7 +3026,7 @@ NS_PTR_TO_INT32(frame->Properties().Get(nsIFrame::ParagraphDepthProperty()))
* generated and which corresponds to the specified pseudo-element type,
* or nullptr if there is no such anonymous content.
*/
virtual nsIContent* GetPseudoElementContent(nsCSSPseudoElements::Type aType);
virtual mozilla::dom::Element* GetPseudoElement(nsCSSPseudoElements::Type aType);
protected:
// Members

View File

@ -488,14 +488,8 @@ nsComputedDOMStyle::GetStyleContextForElementNoFlush(Element* aElement,
if (type >= nsCSSPseudoElements::ePseudo_PseudoElementCount) {
return nullptr;
}
Element* pseudoElement = nullptr;
nsIFrame* frame = nsLayoutUtils::GetStyleFrame(aElement);
if (frame) {
nsIContent* pseudoContent = frame->GetPseudoElementContent(type);
if (pseudoContent && pseudoContent->IsElement()) {
pseudoElement = pseudoContent->AsElement();
}
}
Element* pseudoElement = frame ? frame->GetPseudoElement(type) : nullptr;
sc = styleSet->ResolvePseudoElementStyle(aElement, type, parentContext,
pseudoElement);
} else {