Treat backgrounds on body the same in XHTML as for HTML. b=379461 r+sr=bzbarsky a=schrep

This commit is contained in:
dbaron@dbaron.org 2008-02-19 10:46:21 -08:00
parent 55c1ed6c5b
commit f4d4f9cc2b
3 changed files with 22 additions and 23 deletions

View File

@ -3149,25 +3149,23 @@ FindCanvasBackground(nsIFrame* aForFrame,
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();
}
}
}
@ -3221,9 +3219,6 @@ FindElementBackground(nsIFrame* aForFrame,
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);

View File

@ -2108,7 +2108,7 @@ nsGfxScrollFrameInner::IsLTR() const
// 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);

View File

@ -501,6 +501,10 @@ 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-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