Treat backgrounds on body the same in XHTML as for HTML. b=379461 r+sr=bzbarsky a=schrep
authordbaron@dbaron.org
Tue, 19 Feb 2008 10:46:21 -0800
changeset 11875 c4b9e1ec4695430442021731abb3c4c79af2ef94
parent 11874 f511da014c703895d0db4a2db843953a13a34c50
child 11876 4a945f737c689e6159b1d5d9fee96249a097af10
push idunknown
push userunknown
push dateunknown
reviewersschrep
bugs379461
milestone1.9b4pre
Treat backgrounds on body the same in XHTML as for HTML. b=379461 r+sr=bzbarsky a=schrep
layout/base/nsCSSRendering.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/reftests/bugs/reftest.list
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -3144,35 +3144,33 @@ FindCanvasBackground(nsIFrame* aForFrame
     // Check if we need to do propagation from BODY rather than HTML.
     if (result->IsTransparent()) {
       nsIContent* content = topFrame->GetContent();
       if (content) {
         // Use |GetOwnerDoc| so it works during destruction.
         nsIDocument* document = content->GetOwnerDoc();
         nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(document);
         if (htmlDoc) {
-          if (!document->IsCaseSensitive()) { // HTML, not XHTML
-            nsCOMPtr<nsIDOMHTMLElement> body;
-            htmlDoc->GetBody(getter_AddRefs(body));
-            nsCOMPtr<nsIContent> 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();
-            }
+          nsCOMPtr<nsIDOMHTMLElement> body;
+          htmlDoc->GetBody(getter_AddRefs(body));
+          nsCOMPtr<nsIContent> 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();
           }
         }
       }
     }
 
     *aBackground = result;
   } else {
     // This should always give transparent, so we'll fill it in with the
@@ -3216,19 +3214,16 @@ FindElementBackground(nsIFrame* aForFram
     return PR_TRUE; // not frame for <BODY> element
 
   // We should only look at the <html> background if we're in an HTML document
   nsIDocument* document = content->GetOwnerDoc();
   nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(document);
   if (!htmlDoc)
     return PR_TRUE;
 
-  if (document->IsCaseSensitive()) // XHTML, not HTML
-    return PR_TRUE;
-  
   nsCOMPtr<nsIDOMHTMLElement> body;
   htmlDoc->GetBody(getter_AddRefs(body));
   nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(body);
   if (bodyContent != content)
     return PR_TRUE; // this wasn't the background that was propagated
 
   const nsStyleBackground* htmlBG = parentFrame->GetStyleBackground();
   return !htmlBG->IsTransparent();
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -2103,17 +2103,17 @@ nsGfxScrollFrameInner::IsLTR() const
   if (mIsRoot) {
     // If we're the root scrollframe, we need the root element's style data.
     nsPresContext *presContext = mOuter->PresContext();
     nsIDocument *document = presContext->Document();
     nsIContent *root = document->GetRootContent();
 
     // But for HTML we want the body element.
     nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(document);
-    if (htmlDoc && !document->IsCaseSensitive()) { // HTML, not XHTML
+    if (htmlDoc) {
       nsCOMPtr<nsIDOMHTMLElement> body;
       htmlDoc->GetBody(getter_AddRefs(body));
       nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(body);
       if (bodyContent)
         root = bodyContent; // we can trust the document to hold on to it
     }
 
     if (root) {
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -496,16 +496,20 @@ random-if(MOZ_WIDGET_TOOLKIT=="cocoa") =
 == 379349-1c.xhtml 379349-1-ref.xhtml
 == 379349-2a.xhtml 379349-2-ref.xhtml
 == 379349-2b.xhtml 379349-2-ref.xhtml
 == 379349-3a.xhtml 379349-3-ref.xhtml
 == 379349-3b.xhtml 379349-3-ref.xhtml
 == 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-container-xhtml.html 379461-3-container-html.html
+!= 379461-3-container-xhtml.html 379461-3-container-blank.html # 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
 == 381130-1.html 381130-1-ref.html
 == 381507-1.html 381507-1-ref.html
 == 382600-1.html 382600-1-ref.html
 == 382916-1.html 382916-1-ref.html 
 == 383551-1.html 383551-1-ref.html