diff --git a/content/html/document/src/htmldocument.gqi b/content/html/document/src/htmldocument.gqi index 5bf150627931..b08a1c0858f6 100644 --- a/content/html/document/src/htmldocument.gqi +++ b/content/html/document/src/htmldocument.gqi @@ -7,7 +7,7 @@ #include "nsHTMLDocument.h" %} -%pseudo-iid nsIHTMLDocument 48546d61-6097-462b-89b1-57e2221444dc +%pseudo-iid nsIHTMLDocument 61e989a8-70cd-4582-845e-6e5e12559a83 NS_INTERFACE_MAP_BEGIN(nsHTMLDocument, nsDocument) NS_INTERFACE_MAP_ENTRY(nsIHTMLDocument) diff --git a/content/html/document/src/nsHTMLDocument.cpp b/content/html/document/src/nsHTMLDocument.cpp index bac60e4d8715..b90f7265fdde 100644 --- a/content/html/document/src/nsHTMLDocument.cpp +++ b/content/html/document/src/nsHTMLDocument.cpp @@ -3561,12 +3561,6 @@ nsHTMLDocument::ResolveName(const nsAString& aName, //---------------------------- -/* virtual */ nsIContent* -nsHTMLDocument::GetBodyContentExternal() -{ - return GetBodyContent(); -} - nsIContent* nsHTMLDocument::GetBodyContent() { diff --git a/content/html/document/src/nsHTMLDocument.h b/content/html/document/src/nsHTMLDocument.h index 4ef02cd2293a..e31f41681102 100644 --- a/content/html/document/src/nsHTMLDocument.h +++ b/content/html/document/src/nsHTMLDocument.h @@ -212,8 +212,6 @@ public: mDisableCookieAccess = PR_TRUE; } - virtual nsIContent* GetBodyContentExternal(); - void EndUpdate(nsUpdateType aUpdateType); NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsHTMLDocument, nsDocument) diff --git a/content/html/document/src/nsIHTMLDocument.h b/content/html/document/src/nsIHTMLDocument.h index 5180b821b598..86f809435cf2 100644 --- a/content/html/document/src/nsIHTMLDocument.h +++ b/content/html/document/src/nsIHTMLDocument.h @@ -54,11 +54,9 @@ class nsIContent; class nsIDOMHTMLBodyElement; class nsIScriptElement; -// Update htmldocument.gqi when updating this IID! -// 48546d61-6097-462b-89b1-57e2221444dc #define NS_IHTMLDOCUMENT_IID \ -{ 0x48546d61, 0x6097, 0x462b, \ - { 0x89, 0xb1, 0x57, 0xe2, 0x22, 0x14, 0x44, 0xdc } } +{ 0x61e989a8, 0x70cd, 0x4582, \ + { 0x84, 0x5e, 0x6e, 0x5e, 0x12, 0x55, 0x9a, 0x83 } } /** * HTML document extensions to nsIDocument. @@ -175,12 +173,6 @@ public: * Disables getting and setting cookies */ virtual void DisableCookieAccess() = 0; - - /** - * Get the first child of the root , but don't do - * anything -related (like nsIDOMHTMLDocument::GetBody). - */ - virtual nsIContent* GetBodyContentExternal() = 0; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIHTMLDocument, NS_IHTMLDOCUMENT_IID) diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index f29361499747..e1909c0875fe 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -65,7 +65,8 @@ #include "nsITheme.h" #include "nsThemeConstants.h" #include "nsIServiceManager.h" -#include "nsIHTMLDocument.h" +#include "nsIDOMHTMLBodyElement.h" +#include "nsIDOMHTMLDocument.h" #include "nsLayoutUtils.h" #include "nsINameSpaceManager.h" @@ -3146,23 +3147,27 @@ FindCanvasBackground(nsIFrame* aForFrame, if (content) { // Use |GetOwnerDoc| so it works during destruction. nsIDocument* document = content->GetOwnerDoc(); - nsCOMPtr htmlDoc = do_QueryInterface(document); + nsCOMPtr htmlDoc = do_QueryInterface(document); if (htmlDoc) { - nsIContent* bodyContent = htmlDoc->GetBodyContentExternal(); - // We need to null check the body node (bug 118829) since - // there are cases, thanks to the fix for bug 5569, where we - // will reflow a document with no body. In particular, if a - // SCRIPT element in the head blocks the parser and then has a - // SCRIPT that does "document.location.href = 'foo'", then - // nsParser::Terminate will call |DidBuildModel| methods - // through to the content sink, which will call |StartLayout| - // and thus |InitialReflow| on the pres shell. See bug 119351 - // for the ugly details. - if (bodyContent) { - nsIFrame *bodyFrame = aForFrame->PresContext()->GetPresShell()-> - GetPrimaryFrameFor(bodyContent); - if (bodyFrame) - result = bodyFrame->GetStyleBackground(); + if (!document->IsCaseSensitive()) { // HTML, not XHTML + nsCOMPtr body; + htmlDoc->GetBody(getter_AddRefs(body)); + nsCOMPtr bodyContent = do_QueryInterface(body); + // We need to null check the body node (bug 118829) since + // there are cases, thanks to the fix for bug 5569, where we + // will reflow a document with no body. In particular, if a + // SCRIPT element in the head blocks the parser and then has a + // SCRIPT that does "document.location.href = 'foo'", then + // nsParser::Terminate will call |DidBuildModel| methods + // through to the content sink, which will call |StartLayout| + // and thus |InitialReflow| on the pres shell. See bug 119351 + // for the ugly details. + if (bodyContent) { + nsIFrame *bodyFrame = aForFrame->PresContext()->GetPresShell()-> + GetPrimaryFrameFor(bodyContent); + if (bodyFrame) + result = bodyFrame->GetStyleBackground(); + } } } } @@ -3212,11 +3217,16 @@ FindElementBackground(nsIFrame* aForFrame, // We should only look at the background if we're in an HTML document nsIDocument* document = content->GetOwnerDoc(); - nsCOMPtr htmlDoc = do_QueryInterface(document); + nsCOMPtr htmlDoc = do_QueryInterface(document); if (!htmlDoc) return PR_TRUE; - nsIContent* bodyContent = htmlDoc->GetBodyContentExternal(); + if (document->IsCaseSensitive()) // XHTML, not HTML + return PR_TRUE; + + nsCOMPtr body; + htmlDoc->GetBody(getter_AddRefs(body)); + nsCOMPtr bodyContent = do_QueryInterface(body); if (bodyContent != content) return PR_TRUE; // this wasn't the background that was propagated diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index dd00c35ceb08..1858d499b7e9 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -70,7 +70,7 @@ #include "nsPresState.h" #include "nsIGlobalHistory3.h" #include "nsDocShellCID.h" -#include "nsIHTMLDocument.h" +#include "nsIDOMHTMLDocument.h" #include "nsEventDispatcher.h" #include "nsContentUtils.h" #include "nsLayoutUtils.h" @@ -2107,9 +2107,11 @@ nsGfxScrollFrameInner::IsLTR() const nsIContent *root = document->GetRootContent(); // But for HTML we want the body element. - nsCOMPtr htmlDoc = do_QueryInterface(document); - if (htmlDoc) { - nsIContent *bodyContent = htmlDoc->GetBodyContentExternal(); + nsCOMPtr htmlDoc = do_QueryInterface(document); + if (htmlDoc && !document->IsCaseSensitive()) { // HTML, not XHTML + nsCOMPtr body; + htmlDoc->GetBody(getter_AddRefs(body)); + nsCOMPtr bodyContent = do_QueryInterface(body); if (bodyContent) root = bodyContent; // we can trust the document to hold on to it } diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index b374361469c7..cce19e61a5b9 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -501,10 +501,6 @@ random-if(MOZ_WIDGET_TOOLKIT=="cocoa") == 379316-2.html 379316-2-ref.html # bug == 379361-1.html 379361-1-ref.html == 379361-2.html 379361-2-ref.html == 379361-3.html 379361-3-ref.html -== 379461-1.xhtml 379461-1.html -== 379461-2.xhtml 379461-2.html -== 379461-3.xhtml 379461-3.html -!= 379461-3.xhtml about:blank # there is a scrollbar == 380004-1.html 380004-1-ref.html == 380227-1.html 380227-1-ref.html == 380842-1.html 380842-1-ref.html