Only propagate the body background to the canvas in HTML documents; don't do it
for XHTML. Bug 214969, r+sr=dbaron
This commit is contained in:
@@ -65,6 +65,7 @@
|
|||||||
#include "nsIDOMHTMLBodyElement.h"
|
#include "nsIDOMHTMLBodyElement.h"
|
||||||
#include "nsIDOMHTMLDocument.h"
|
#include "nsIDOMHTMLDocument.h"
|
||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
|
#include "nsINameSpaceManager.h"
|
||||||
|
|
||||||
#define BORDER_FULL 0 //entire side
|
#define BORDER_FULL 0 //entire side
|
||||||
#define BORDER_INSIDE 1 //inside half
|
#define BORDER_INSIDE 1 //inside half
|
||||||
@@ -2695,25 +2696,29 @@ FindCanvasBackground(nsIPresContext* aPresContext,
|
|||||||
node->GetOwnerDocument(getter_AddRefs(doc));
|
node->GetOwnerDocument(getter_AddRefs(doc));
|
||||||
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(doc);
|
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(doc);
|
||||||
if (htmlDoc) {
|
if (htmlDoc) {
|
||||||
nsCOMPtr<nsIDOMHTMLElement> body;
|
PRInt32 namespaceID;
|
||||||
htmlDoc->GetBody(getter_AddRefs(body));
|
content->GetNameSpaceID(&namespaceID);
|
||||||
nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(body);
|
if (namespaceID == kNameSpaceID_None) { // HTML, not XHTML
|
||||||
// We need to null check the body node (bug 118829) since
|
nsCOMPtr<nsIDOMHTMLElement> body;
|
||||||
// there are cases, thanks to the fix for bug 5569, where we
|
htmlDoc->GetBody(getter_AddRefs(body));
|
||||||
// will reflow a document with no body. In particular, if a
|
nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(body);
|
||||||
// SCRIPT element in the head blocks the parser and then has a
|
// We need to null check the body node (bug 118829) since
|
||||||
// SCRIPT that does "document.location.href = 'foo'", then
|
// there are cases, thanks to the fix for bug 5569, where we
|
||||||
// nsParser::Terminate will call |DidBuildModel| methods
|
// will reflow a document with no body. In particular, if a
|
||||||
// through to the content sink, which will call |StartLayout|
|
// SCRIPT element in the head blocks the parser and then has a
|
||||||
// and thus |InitialReflow| on the pres shell. See bug 119351
|
// SCRIPT that does "document.location.href = 'foo'", then
|
||||||
// for the ugly details.
|
// nsParser::Terminate will call |DidBuildModel| methods
|
||||||
if (bodyContent) {
|
// through to the content sink, which will call |StartLayout|
|
||||||
nsCOMPtr<nsIPresShell> shell;
|
// and thus |InitialReflow| on the pres shell. See bug 119351
|
||||||
aPresContext->GetShell(getter_AddRefs(shell));
|
// for the ugly details.
|
||||||
nsIFrame *bodyFrame;
|
if (bodyContent) {
|
||||||
nsresult rv = shell->GetPrimaryFrameFor(bodyContent, &bodyFrame);
|
nsCOMPtr<nsIPresShell> shell;
|
||||||
if (NS_SUCCEEDED(rv) && bodyFrame)
|
aPresContext->GetShell(getter_AddRefs(shell));
|
||||||
result = bodyFrame->GetStyleBackground();
|
nsIFrame *bodyFrame;
|
||||||
|
nsresult rv = shell->GetPrimaryFrameFor(bodyContent, &bodyFrame);
|
||||||
|
if (NS_SUCCEEDED(rv) && bodyFrame)
|
||||||
|
result = bodyFrame->GetStyleBackground();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2750,6 +2755,11 @@ FindElementBackground(nsIPresContext* aPresContext,
|
|||||||
nsIContent* content = aForFrame->GetContent();
|
nsIContent* content = aForFrame->GetContent();
|
||||||
if (!content || !content->IsContentOfType(nsIContent::eHTML))
|
if (!content || !content->IsContentOfType(nsIContent::eHTML))
|
||||||
return PR_TRUE; // not frame for an HTML element
|
return PR_TRUE; // not frame for an HTML element
|
||||||
|
|
||||||
|
PRInt32 namespaceID;
|
||||||
|
content->GetNameSpaceID(&namespaceID);
|
||||||
|
if (namespaceID != kNameSpaceID_None) // This is XHTML, not HTML
|
||||||
|
return PR_TRUE;
|
||||||
|
|
||||||
if (!parentFrame)
|
if (!parentFrame)
|
||||||
return PR_TRUE; // no parent to look at
|
return PR_TRUE; // no parent to look at
|
||||||
|
|||||||
@@ -65,6 +65,7 @@
|
|||||||
#include "nsIDOMHTMLBodyElement.h"
|
#include "nsIDOMHTMLBodyElement.h"
|
||||||
#include "nsIDOMHTMLDocument.h"
|
#include "nsIDOMHTMLDocument.h"
|
||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
|
#include "nsINameSpaceManager.h"
|
||||||
|
|
||||||
#define BORDER_FULL 0 //entire side
|
#define BORDER_FULL 0 //entire side
|
||||||
#define BORDER_INSIDE 1 //inside half
|
#define BORDER_INSIDE 1 //inside half
|
||||||
@@ -2695,25 +2696,29 @@ FindCanvasBackground(nsIPresContext* aPresContext,
|
|||||||
node->GetOwnerDocument(getter_AddRefs(doc));
|
node->GetOwnerDocument(getter_AddRefs(doc));
|
||||||
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(doc);
|
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(doc);
|
||||||
if (htmlDoc) {
|
if (htmlDoc) {
|
||||||
nsCOMPtr<nsIDOMHTMLElement> body;
|
PRInt32 namespaceID;
|
||||||
htmlDoc->GetBody(getter_AddRefs(body));
|
content->GetNameSpaceID(&namespaceID);
|
||||||
nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(body);
|
if (namespaceID == kNameSpaceID_None) { // HTML, not XHTML
|
||||||
// We need to null check the body node (bug 118829) since
|
nsCOMPtr<nsIDOMHTMLElement> body;
|
||||||
// there are cases, thanks to the fix for bug 5569, where we
|
htmlDoc->GetBody(getter_AddRefs(body));
|
||||||
// will reflow a document with no body. In particular, if a
|
nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(body);
|
||||||
// SCRIPT element in the head blocks the parser and then has a
|
// We need to null check the body node (bug 118829) since
|
||||||
// SCRIPT that does "document.location.href = 'foo'", then
|
// there are cases, thanks to the fix for bug 5569, where we
|
||||||
// nsParser::Terminate will call |DidBuildModel| methods
|
// will reflow a document with no body. In particular, if a
|
||||||
// through to the content sink, which will call |StartLayout|
|
// SCRIPT element in the head blocks the parser and then has a
|
||||||
// and thus |InitialReflow| on the pres shell. See bug 119351
|
// SCRIPT that does "document.location.href = 'foo'", then
|
||||||
// for the ugly details.
|
// nsParser::Terminate will call |DidBuildModel| methods
|
||||||
if (bodyContent) {
|
// through to the content sink, which will call |StartLayout|
|
||||||
nsCOMPtr<nsIPresShell> shell;
|
// and thus |InitialReflow| on the pres shell. See bug 119351
|
||||||
aPresContext->GetShell(getter_AddRefs(shell));
|
// for the ugly details.
|
||||||
nsIFrame *bodyFrame;
|
if (bodyContent) {
|
||||||
nsresult rv = shell->GetPrimaryFrameFor(bodyContent, &bodyFrame);
|
nsCOMPtr<nsIPresShell> shell;
|
||||||
if (NS_SUCCEEDED(rv) && bodyFrame)
|
aPresContext->GetShell(getter_AddRefs(shell));
|
||||||
result = bodyFrame->GetStyleBackground();
|
nsIFrame *bodyFrame;
|
||||||
|
nsresult rv = shell->GetPrimaryFrameFor(bodyContent, &bodyFrame);
|
||||||
|
if (NS_SUCCEEDED(rv) && bodyFrame)
|
||||||
|
result = bodyFrame->GetStyleBackground();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2750,6 +2755,11 @@ FindElementBackground(nsIPresContext* aPresContext,
|
|||||||
nsIContent* content = aForFrame->GetContent();
|
nsIContent* content = aForFrame->GetContent();
|
||||||
if (!content || !content->IsContentOfType(nsIContent::eHTML))
|
if (!content || !content->IsContentOfType(nsIContent::eHTML))
|
||||||
return PR_TRUE; // not frame for an HTML element
|
return PR_TRUE; // not frame for an HTML element
|
||||||
|
|
||||||
|
PRInt32 namespaceID;
|
||||||
|
content->GetNameSpaceID(&namespaceID);
|
||||||
|
if (namespaceID != kNameSpaceID_None) // This is XHTML, not HTML
|
||||||
|
return PR_TRUE;
|
||||||
|
|
||||||
if (!parentFrame)
|
if (!parentFrame)
|
||||||
return PR_TRUE; // no parent to look at
|
return PR_TRUE; // no parent to look at
|
||||||
|
|||||||
Reference in New Issue
Block a user