зеркало из https://github.com/mozilla/gecko-dev.git
Bug 827149 - Remove some uses of nsIDOMHTMLBodyElement r=bz
This commit is contained in:
Родитель
0ccc9b3b75
Коммит
9cde6031e7
|
@ -21,6 +21,7 @@ nsIContentIterator.h \
|
|||
nsContentPolicyUtils.h \
|
||||
nsContentUtils.h \
|
||||
nsIDocument.h \
|
||||
nsIDocumentInlines.h \
|
||||
nsDeprecatedOperationList.h \
|
||||
nsIDocumentObserver.h \
|
||||
nsIMutationObserver.h \
|
||||
|
|
|
@ -91,6 +91,7 @@ class DocumentFragment;
|
|||
class DocumentType;
|
||||
class DOMImplementation;
|
||||
class Element;
|
||||
class HTMLBodyElement;
|
||||
class Link;
|
||||
class ProcessingInstruction;
|
||||
class UndoManager;
|
||||
|
@ -580,9 +581,7 @@ public:
|
|||
Element* GetHtmlChildElement(nsIAtom* aTag);
|
||||
// Get the canonical <body> element, or return null if there isn't one (e.g.
|
||||
// if the root isn't <html> or if the <body> isn't there)
|
||||
Element* GetBodyElement() {
|
||||
return GetHtmlChildElement(nsGkAtoms::body);
|
||||
}
|
||||
mozilla::dom::HTMLBodyElement* GetBodyElement();
|
||||
// Get the canonical <head> element, or return null if there isn't one (e.g.
|
||||
// if the root isn't <html> or if the <head> isn't there)
|
||||
Element* GetHeadElement() {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*- */
|
||||
/* vim: set sw=2 sts=2 ts=8 et tw=80 : */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifndef nsIDocumentInlines_h
|
||||
#define nsIDocumentInlines_h
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "mozilla/dom/HTMLBodyElement.h"
|
||||
|
||||
inline mozilla::dom::HTMLBodyElement*
|
||||
nsIDocument::GetBodyElement()
|
||||
{
|
||||
return static_cast<mozilla::dom::HTMLBodyElement*>(GetHtmlChildElement(nsGkAtoms::body));
|
||||
}
|
||||
|
||||
#endif // nsIDocumentInlines_h
|
|
@ -18,7 +18,7 @@
|
|||
#include "nsDOMAttributeMap.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentInlines.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIContentIterator.h"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "nsDOMAttributeMap.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentInlines.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIContentIterator.h"
|
||||
|
|
|
@ -183,8 +183,9 @@
|
|||
#include "nsIAppsService.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/DocumentFragment.h"
|
||||
#include "mozilla/dom/HTMLBodyElement.h"
|
||||
#include "mozilla/dom/UndoManager.h"
|
||||
#include "nsFrame.h"
|
||||
#include "nsFrame.h"
|
||||
#include "nsDOMCaretPosition.h"
|
||||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
#include "nsViewportInfo.h"
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "mozilla/css/StyleRule.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsIDOMHTMLBodyElement.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIDOMAttr.h"
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
|
@ -100,6 +99,7 @@
|
|||
#include "nsHTMLDocument.h"
|
||||
#include "nsDOMTouchEvent.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "mozilla/dom/HTMLBodyElement.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -3025,8 +3025,7 @@ nsGenericHTMLElement::IsCurrentBodyElement()
|
|||
{
|
||||
// TODO Bug 698498: Should this handle the case where GetBody returns a
|
||||
// frameset?
|
||||
nsCOMPtr<nsIDOMHTMLBodyElement> bodyElement = do_QueryInterface(this);
|
||||
if (!bodyElement) {
|
||||
if (!IsHTML(nsGkAtoms::body)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3038,7 +3037,7 @@ nsGenericHTMLElement::IsCurrentBodyElement()
|
|||
|
||||
nsCOMPtr<nsIDOMHTMLElement> htmlElement;
|
||||
htmlDocument->GetBody(getter_AddRefs(htmlElement));
|
||||
return htmlElement == bodyElement;
|
||||
return htmlElement == static_cast<HTMLBodyElement*>(this);
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "nsIImageDocument.h"
|
||||
#include "nsIImageLoadingContent.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIDocumentInlines.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "nsIPresShell.h"
|
||||
#include "nsIObjectFrame.h"
|
||||
#include "nsNPAPIPluginInstance.h"
|
||||
#include "nsIDocumentInlines.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "nsNodeInfoManager.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsHTMLMediaElement.h"
|
||||
#include "nsIDocumentInlines.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
#include "nsIComponentManager.h"
|
||||
#include "nsParserCIID.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsIDOMHTMLBodyElement.h"
|
||||
#include "nsIDOMHTMLHeadElement.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
|
@ -68,6 +67,7 @@
|
|||
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsIDocumentInlines.h"
|
||||
#include "nsIDocumentEncoder.h" //for outputting selection
|
||||
#include "nsICachingChannel.h"
|
||||
#include "nsIJSContextStack.h"
|
||||
|
@ -104,6 +104,7 @@
|
|||
#include "nsHtml5Parser.h"
|
||||
#include "nsIDOMJSWindow.h"
|
||||
#include "nsSandboxFlags.h"
|
||||
#include "mozilla/dom/HTMLBodyElement.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -2057,7 +2058,7 @@ nsHTMLDocument::GetAlinkColor(nsAString& aAlinkColor)
|
|||
{
|
||||
aAlinkColor.Truncate();
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLBodyElement> body = do_QueryInterface(GetBodyElement());
|
||||
HTMLBodyElement* body = GetBodyElement();
|
||||
if (body) {
|
||||
body->GetALink(aAlinkColor);
|
||||
}
|
||||
|
@ -2068,7 +2069,7 @@ nsHTMLDocument::GetAlinkColor(nsAString& aAlinkColor)
|
|||
NS_IMETHODIMP
|
||||
nsHTMLDocument::SetAlinkColor(const nsAString& aAlinkColor)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLBodyElement> body = do_QueryInterface(GetBodyElement());
|
||||
HTMLBodyElement* body = GetBodyElement();
|
||||
if (body) {
|
||||
body->SetALink(aAlinkColor);
|
||||
}
|
||||
|
@ -2081,7 +2082,7 @@ nsHTMLDocument::GetLinkColor(nsAString& aLinkColor)
|
|||
{
|
||||
aLinkColor.Truncate();
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLBodyElement> body = do_QueryInterface(GetBodyElement());
|
||||
HTMLBodyElement* body = GetBodyElement();
|
||||
if (body) {
|
||||
body->GetLink(aLinkColor);
|
||||
}
|
||||
|
@ -2092,7 +2093,7 @@ nsHTMLDocument::GetLinkColor(nsAString& aLinkColor)
|
|||
NS_IMETHODIMP
|
||||
nsHTMLDocument::SetLinkColor(const nsAString& aLinkColor)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLBodyElement> body = do_QueryInterface(GetBodyElement());
|
||||
HTMLBodyElement* body = GetBodyElement();
|
||||
if (body) {
|
||||
body->SetLink(aLinkColor);
|
||||
}
|
||||
|
@ -2105,7 +2106,7 @@ nsHTMLDocument::GetVlinkColor(nsAString& aVlinkColor)
|
|||
{
|
||||
aVlinkColor.Truncate();
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLBodyElement> body = do_QueryInterface(GetBodyElement());
|
||||
HTMLBodyElement* body = GetBodyElement();
|
||||
if (body) {
|
||||
body->GetVLink(aVlinkColor);
|
||||
}
|
||||
|
@ -2116,7 +2117,7 @@ nsHTMLDocument::GetVlinkColor(nsAString& aVlinkColor)
|
|||
NS_IMETHODIMP
|
||||
nsHTMLDocument::SetVlinkColor(const nsAString& aVlinkColor)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLBodyElement> body = do_QueryInterface(GetBodyElement());
|
||||
HTMLBodyElement* body = GetBodyElement();
|
||||
if (body) {
|
||||
body->SetVLink(aVlinkColor);
|
||||
}
|
||||
|
@ -2129,7 +2130,7 @@ nsHTMLDocument::GetBgColor(nsAString& aBgColor)
|
|||
{
|
||||
aBgColor.Truncate();
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLBodyElement> body = do_QueryInterface(GetBodyElement());
|
||||
HTMLBodyElement* body = GetBodyElement();
|
||||
if (body) {
|
||||
body->GetBgColor(aBgColor);
|
||||
}
|
||||
|
@ -2140,7 +2141,7 @@ nsHTMLDocument::GetBgColor(nsAString& aBgColor)
|
|||
NS_IMETHODIMP
|
||||
nsHTMLDocument::SetBgColor(const nsAString& aBgColor)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLBodyElement> body = do_QueryInterface(GetBodyElement());
|
||||
HTMLBodyElement* body = GetBodyElement();
|
||||
if (body) {
|
||||
body->SetBgColor(aBgColor);
|
||||
}
|
||||
|
@ -2153,7 +2154,7 @@ nsHTMLDocument::GetFgColor(nsAString& aFgColor)
|
|||
{
|
||||
aFgColor.Truncate();
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLBodyElement> body = do_QueryInterface(GetBodyElement());
|
||||
HTMLBodyElement* body = GetBodyElement();
|
||||
if (body) {
|
||||
body->GetText(aFgColor);
|
||||
}
|
||||
|
@ -2164,7 +2165,7 @@ nsHTMLDocument::GetFgColor(nsAString& aFgColor)
|
|||
NS_IMETHODIMP
|
||||
nsHTMLDocument::SetFgColor(const nsAString& aFgColor)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLBodyElement> body = do_QueryInterface(GetBodyElement());
|
||||
HTMLBodyElement* body = GetBodyElement();
|
||||
if (body) {
|
||||
body->SetText(aFgColor);
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "nsIAppsService.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIDocumentInlines.h"
|
||||
#include "nsIDOMClassInfo.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
|
@ -427,7 +428,7 @@ TabChild::HandlePossibleViewportChange()
|
|||
float minScale = 1.0f;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> htmlDOMElement = do_QueryInterface(document->GetHtmlElement());
|
||||
nsCOMPtr<nsIDOMElement> bodyDOMElement = do_QueryInterface(document->GetBodyElement());
|
||||
HTMLBodyElement* bodyDOMElement = document->GetBodyElement();
|
||||
|
||||
int32_t htmlWidth = 0, htmlHeight = 0;
|
||||
if (htmlDOMElement) {
|
||||
|
@ -436,8 +437,8 @@ TabChild::HandlePossibleViewportChange()
|
|||
}
|
||||
int32_t bodyWidth = 0, bodyHeight = 0;
|
||||
if (bodyDOMElement) {
|
||||
bodyDOMElement->GetScrollWidth(&bodyWidth);
|
||||
bodyDOMElement->GetScrollHeight(&bodyHeight);
|
||||
bodyWidth = bodyDOMElement->ScrollWidth();
|
||||
bodyHeight = bodyDOMElement->ScrollHeight();
|
||||
}
|
||||
|
||||
float pageWidth, pageHeight;
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
#include "nsIParserService.h"
|
||||
#include "mozilla/Selection.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/HTMLBodyElement.h"
|
||||
#include "nsTextFragment.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "nsCSSAnonBoxes.h"
|
||||
#include "nsTransform2D.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentInlines.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "imgIContainer.h"
|
||||
|
|
|
@ -6028,9 +6028,8 @@ static void ComputeVisualOverflowArea(nsLineList& aLines,
|
|||
bool
|
||||
nsBlockFrame::IsVisibleInSelection(nsISelection* aSelection)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLHtmlElement> html(do_QueryInterface(mContent));
|
||||
nsCOMPtr<nsIDOMHTMLBodyElement> body(do_QueryInterface(mContent));
|
||||
if (html || body)
|
||||
if (mContent->IsHTML() && (mContent->Tag() == nsGkAtoms::html ||
|
||||
mContent->Tag() == nsGkAtoms::body))
|
||||
return true;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(mContent));
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "nsGkAtoms.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsContentList.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentInlines.h"
|
||||
#include "nsFontMetrics.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
#include "nsBoxLayoutState.h"
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "nsStyleSet.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsCSSStyleSheet.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentInlines.h"
|
||||
#include "nsRuleWalker.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
|
|
|
@ -59,7 +59,7 @@ template<class T> class nsReadingIterator;
|
|||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIDOMHTMLBodyElement.h"
|
||||
#include "mozilla/dom/HTMLBodyElement.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLTextAreaElement.h"
|
||||
|
@ -1575,7 +1575,7 @@ TestApp::Init(void)
|
|||
|
||||
// set a background color manually,
|
||||
// otherwise the window might be transparent
|
||||
nsCOMPtr<nsIDOMHTMLBodyElement>(do_QueryInterface(htmlBody))->
|
||||
static_cast<HTMLBodyElement*>(htmlBody)->
|
||||
SetBgColor(NS_LITERAL_STRING("white"));
|
||||
|
||||
widget->Show(true);
|
||||
|
|
Загрузка…
Ссылка в новой задаче