mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1347639. Add nsImageLoadingContent::AsContent to make getting the relevant nsIContent* faster. r=qdot
MozReview-Commit-ID: 9sE3pbHwYbV
This commit is contained in:
parent
e6cb980169
commit
2c3a8eee0b
@ -56,7 +56,10 @@ public:
|
||||
}
|
||||
return nsXMLElement::GetEventTargetParent(aVisitor);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
nsIContent* AsContent() override { return this; }
|
||||
|
||||
private:
|
||||
virtual ~nsGenConImageContent();
|
||||
|
||||
|
@ -836,9 +836,8 @@ nsImageLoadingContent::LoadImage(nsIURI* aNewURI,
|
||||
// We use the principal of aDocument to avoid having to QI |this| an extra
|
||||
// time. It should always be the same as the principal of this node.
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIContent> thisContent = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
MOZ_ASSERT(thisContent &&
|
||||
thisContent->NodePrincipal() == aDocument->NodePrincipal(),
|
||||
nsIContent* thisContent = AsContent();
|
||||
MOZ_ASSERT(thisContent->NodePrincipal() == aDocument->NodePrincipal(),
|
||||
"Principal mismatch?");
|
||||
#endif
|
||||
|
||||
@ -1023,10 +1022,7 @@ nsImageLoadingContent::UpdateImageState(bool aNotify)
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> thisContent = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
if (!thisContent) {
|
||||
return;
|
||||
}
|
||||
nsIContent* thisContent = AsContent();
|
||||
|
||||
mLoading = mBroken = mUserDisabled = mSuppressed = false;
|
||||
|
||||
@ -1090,29 +1086,19 @@ nsImageLoadingContent::UseAsPrimaryRequest(imgRequestProxy* aRequest,
|
||||
nsIDocument*
|
||||
nsImageLoadingContent::GetOurOwnerDoc()
|
||||
{
|
||||
nsCOMPtr<nsIContent> thisContent =
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
NS_ENSURE_TRUE(thisContent, nullptr);
|
||||
|
||||
return thisContent->OwnerDoc();
|
||||
return AsContent()->OwnerDoc();
|
||||
}
|
||||
|
||||
nsIDocument*
|
||||
nsImageLoadingContent::GetOurCurrentDoc()
|
||||
{
|
||||
nsCOMPtr<nsIContent> thisContent =
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
NS_ENSURE_TRUE(thisContent, nullptr);
|
||||
|
||||
return thisContent->GetComposedDoc();
|
||||
return AsContent()->GetComposedDoc();
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsImageLoadingContent::GetOurPrimaryFrame()
|
||||
{
|
||||
nsCOMPtr<nsIContent> thisContent =
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
return thisContent->GetPrimaryFrame();
|
||||
return AsContent()->GetPrimaryFrame();
|
||||
}
|
||||
|
||||
nsPresContext* nsImageLoadingContent::GetFramePresContext()
|
||||
@ -1134,8 +1120,7 @@ nsImageLoadingContent::StringToURI(const nsAString& aSpec,
|
||||
NS_PRECONDITION(aURI, "Null out param");
|
||||
|
||||
// (1) Get the base URI
|
||||
nsCOMPtr<nsIContent> thisContent = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
NS_ASSERTION(thisContent, "An image loading content must be an nsIContent");
|
||||
nsIContent* thisContent = AsContent();
|
||||
nsCOMPtr<nsIURI> baseURL = thisContent->GetBaseURI();
|
||||
|
||||
// (2) Get the charset
|
||||
|
@ -219,6 +219,10 @@ protected:
|
||||
|
||||
void AsyncEventRunning(mozilla::AsyncEventDispatcher* aEvent);
|
||||
|
||||
// Get ourselves as an nsIContent*. Not const because some of the callers
|
||||
// want a non-const nsIContent.
|
||||
virtual nsIContent* AsContent() = 0;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Struct used to manage the image observers.
|
||||
|
@ -350,6 +350,9 @@ protected:
|
||||
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
const nsAttrValue* aValue, bool aNotify) override;
|
||||
|
||||
// Override for nsImageLoadingContent.
|
||||
nsIContent* AsContent() override { return this; }
|
||||
|
||||
// This is a weak reference that this element and the HTMLFormElement
|
||||
// cooperate in maintaining.
|
||||
HTMLFormElement* mForm;
|
||||
|
@ -1495,6 +1495,11 @@ protected:
|
||||
uint32_t* aSelectionEnd,
|
||||
ErrorResult& aRv);
|
||||
|
||||
/**
|
||||
* Override for nsImageLoadingContent.
|
||||
*/
|
||||
nsIContent* AsContent() override { return this; }
|
||||
|
||||
nsCOMPtr<nsIControllers> mControllers;
|
||||
|
||||
/*
|
||||
|
@ -252,6 +252,10 @@ public:
|
||||
*/
|
||||
void StartObjectLoad(bool aNotify, bool aForceLoad);
|
||||
|
||||
protected:
|
||||
// Override for nsImageLoadingContent.
|
||||
nsIContent* AsContent() override { return this; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* Returns if the element is currently focusable regardless of it's tabindex
|
||||
|
@ -200,6 +200,11 @@ public:
|
||||
* Calls LoadObject with the correct arguments to start the plugin load.
|
||||
*/
|
||||
void StartObjectLoad(bool aNotify, bool aForceLoad);
|
||||
|
||||
protected:
|
||||
// Override for nsImageLoadingContent.
|
||||
nsIContent* AsContent() override { return this; }
|
||||
|
||||
private:
|
||||
virtual ~HTMLSharedObjectElement();
|
||||
|
||||
|
@ -85,6 +85,9 @@ protected:
|
||||
virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio() override;
|
||||
virtual StringAttributesInfo GetStringInfo() override;
|
||||
|
||||
// Override for nsImageLoadingContent.
|
||||
nsIContent* AsContent() override { return this; }
|
||||
|
||||
enum { RESULT, HREF, XLINK_HREF };
|
||||
nsSVGString mStringAttributes[3];
|
||||
static StringInfo sStringInfo[3];
|
||||
|
@ -86,6 +86,9 @@ protected:
|
||||
virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio() override;
|
||||
virtual StringAttributesInfo GetStringInfo() override;
|
||||
|
||||
// Override for nsImageLoadingContent.
|
||||
nsIContent* AsContent() override { return this; }
|
||||
|
||||
enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
|
||||
nsSVGLength2 mLengthAttributes[4];
|
||||
static LengthInfo sLengthInfo[4];
|
||||
|
Loading…
Reference in New Issue
Block a user