From d3dc65034fa99186c74ca12729a53a838a52cf3b Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 26 Jan 2018 01:01:25 -0500 Subject: [PATCH] Bug 1418076 part 9. Eliminate remaining uses of nsIDOMHTMLDocument. r=mystor MozReview-Commit-ID: DqjJPKKRYOx --- dom/html/nsGenericHTMLElement.cpp | 10 ++++------ layout/base/PresShell.cpp | 6 ++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index e4b8f01a6461..77f899f472e4 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -343,12 +343,10 @@ nsGenericHTMLElement::GetOffsetRect(CSSIntRect& aRect) // frame for the HTML element so we fail to find the body in the // parent chain. We want the offset parent in this case to be // the body, so we just get the body element from the document. - - nsCOMPtr html_doc(do_QueryInterface(GetComposedDoc())); - - if (html_doc) { - offsetParent = static_cast(html_doc.get())->GetBody(); - } + // + // We use GetBodyElement() here, not GetBody(), because we don't want to + // end up with framesets here. + offsetParent = GetComposedDoc()->GetBodyElement(); } } diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 2150dca5d453..6f4c1ed84aeb 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -73,7 +73,6 @@ #include "nsIMozBrowserFrame.h" #include "nsCaret.h" #include "AccessibleCaretEventHub.h" -#include "nsIDOMHTMLDocument.h" #include "nsFrameManager.h" #include "nsXPCOM.h" #include "nsILayoutHistoryState.h" @@ -3077,7 +3076,6 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll, return NS_OK; } - nsCOMPtr htmlDoc = do_QueryInterface(mDocument); nsresult rv = NS_OK; nsCOMPtr content; @@ -3087,7 +3085,7 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll, } // Search for an anchor element with a matching "name" attribute - if (!content && htmlDoc) { + if (!content && mDocument->IsHTMLDocument()) { // Find a matching list of named nodes nsCOMPtr list = mDocument->GetElementsByName(aAnchorName); if (list) { @@ -3112,7 +3110,7 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, bool aScroll, } // Search for anchor in the HTML namespace with a matching name - if (!content && !htmlDoc) + if (!content && !mDocument->IsHTMLDocument()) { NS_NAMED_LITERAL_STRING(nameSpace, "http://www.w3.org/1999/xhtml"); // Get the list of anchor elements