mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-06 23:37:31 +09:00
Bug 1276438 part 1. Move the implementation of the .body getter from nsHTMLDocument to nsIDocument.
Tag UXP Issue #1344 Tag UXP Issue #252
This commit is contained in:
parent
0fbfd09291
commit
0ef352d74b
4 changed files with 25 additions and 21 deletions
|
|
@ -6536,6 +6536,26 @@ nsIDocument::GetHtmlChildElement(nsIAtom* aTag)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsGenericHTMLElement*
|
||||||
|
nsIDocument::GetBody()
|
||||||
|
{
|
||||||
|
Element* html = GetHtmlElement();
|
||||||
|
if (!html) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (nsIContent* child = html->GetFirstChild();
|
||||||
|
child;
|
||||||
|
child = child->GetNextSibling()) {
|
||||||
|
if (child->IsHTMLElement(nsGkAtoms::body) ||
|
||||||
|
child->IsHTMLElement(nsGkAtoms::frameset)) {
|
||||||
|
return static_cast<nsGenericHTMLElement*>(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
Element*
|
Element*
|
||||||
nsDocument::GetTitleElement()
|
nsDocument::GetTitleElement()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ class nsFrameLoader;
|
||||||
class nsHTMLCSSStyleSheet;
|
class nsHTMLCSSStyleSheet;
|
||||||
class nsHTMLDocument;
|
class nsHTMLDocument;
|
||||||
class nsHTMLStyleSheet;
|
class nsHTMLStyleSheet;
|
||||||
|
class nsGenericHTMLElement;
|
||||||
class nsIAtom;
|
class nsIAtom;
|
||||||
class nsIBFCacheEntry;
|
class nsIBFCacheEntry;
|
||||||
class nsIChannel;
|
class nsIChannel;
|
||||||
|
|
@ -1036,6 +1037,9 @@ public:
|
||||||
Element* GetHeadElement() {
|
Element* GetHeadElement() {
|
||||||
return GetHtmlChildElement(nsGkAtoms::head);
|
return GetHtmlChildElement(nsGkAtoms::head);
|
||||||
}
|
}
|
||||||
|
// Get the "body" in the sense of document.body: The first <body> or
|
||||||
|
// <frameset> that's a child of a root <html>
|
||||||
|
nsGenericHTMLElement* GetBody();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accessors to the collection of stylesheets owned by this document.
|
* Accessors to the collection of stylesheets owned by this document.
|
||||||
|
|
|
||||||
|
|
@ -1013,26 +1013,6 @@ nsHTMLDocument::SetDomain(const nsAString& aDomain, ErrorResult& rv)
|
||||||
rv = NodePrincipal()->SetDomain(newURI);
|
rv = NodePrincipal()->SetDomain(newURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsGenericHTMLElement*
|
|
||||||
nsHTMLDocument::GetBody()
|
|
||||||
{
|
|
||||||
Element* html = GetHtmlElement();
|
|
||||||
if (!html) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (nsIContent* child = html->GetFirstChild();
|
|
||||||
child;
|
|
||||||
child = child->GetNextSibling()) {
|
|
||||||
if (child->IsHTMLElement(nsGkAtoms::body) ||
|
|
||||||
child->IsHTMLElement(nsGkAtoms::frameset)) {
|
|
||||||
return static_cast<nsGenericHTMLElement*>(child);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLDocument::GetBody(nsIDOMHTMLElement** aBody)
|
nsHTMLDocument::GetBody(nsIDOMHTMLElement** aBody)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ public:
|
||||||
JS::MutableHandle<JSObject*> aRetval,
|
JS::MutableHandle<JSObject*> aRetval,
|
||||||
mozilla::ErrorResult& rv);
|
mozilla::ErrorResult& rv);
|
||||||
void GetSupportedNames(nsTArray<nsString>& aNames);
|
void GetSupportedNames(nsTArray<nsString>& aNames);
|
||||||
nsGenericHTMLElement *GetBody();
|
using nsIDocument::GetBody;
|
||||||
void SetBody(nsGenericHTMLElement* aBody, mozilla::ErrorResult& rv);
|
void SetBody(nsGenericHTMLElement* aBody, mozilla::ErrorResult& rv);
|
||||||
mozilla::dom::HTMLSharedElement *GetHead() {
|
mozilla::dom::HTMLSharedElement *GetHead() {
|
||||||
return static_cast<mozilla::dom::HTMLSharedElement*>(GetHeadElement());
|
return static_cast<mozilla::dom::HTMLSharedElement*>(GetHeadElement());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue