fix bug 369828 - html/svg:style sheets don't work in XUL documents(the fix is to special-case these elements in nsXULDocument::ResumeWalkand manually call UpdateStylesheet on them after the element and its subtreeis fully constructed and inserted into the document)r=bz, sr=peterv

This commit is contained in:
asqueella@gmail.com 2007-03-24 22:20:29 -07:00
parent b8c797ca40
commit bde08ec16b
4 changed files with 30 additions and 0 deletions

View File

@ -2868,6 +2868,19 @@ nsXULDocument::ResumeWalk()
// resolved.)
if (mState == eState_Master) {
AddElementToDocumentPost(element);
if (element->NodeInfo()->Equals(nsGkAtoms::style,
kNameSpaceID_XHTML) ||
element->NodeInfo()->Equals(nsGkAtoms::style,
kNameSpaceID_SVG)) {
// XXX sucks that we have to do this -
// see bug 370111
nsCOMPtr<nsIStyleSheetLinkingElement> ssle =
do_QueryInterface(element);
NS_ASSERTION(ssle, "<html:style> doesn't implement "
"nsIStyleSheetLinkingElement?");
ssle->UpdateStyleSheet(nsnull, nsnull);
}
}
#ifdef MOZ_XTF

View File

@ -59,3 +59,5 @@ test020: Same as #018 for <?xml-stylesheet ?>
test021: (bug 363419) Non-XUL elements directly underneath <overlay> should
be merged correctly into the base document.
test022: (bug 369828) <html:style> works in XUL documents

View File

@ -19,3 +19,4 @@
== test019.xul reference-green-window.xul
== test020.xul reference-green-window.xul
== test021.xul reference-green-window.xul
== test022.xul reference-green-window.xul

View File

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<window title="Testcase for bug 369828 - html:style doesn't work in XUL documents"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
style="background-color: red">
<html:style type="text/css">
window {
background-color: green !important;
}
</html:style>
</window>