Bug 513194 - HTML5 parser ends up parsing inline stylesheets twice. r=bzbarsky.

This commit is contained in:
Henri Sivonen
2009-10-30 10:31:57 +02:00
parent 8dcb85be52
commit 42c2ae50fe
3 changed files with 94 additions and 55 deletions

View File

@@ -230,6 +230,14 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder)
aBuilder->HoldElement(*target = newContent);
if (NS_UNLIKELY(name == nsHtml5Atoms::style || name == nsHtml5Atoms::link)) {
nsCOMPtr<nsIStyleSheetLinkingElement> ssle(do_QueryInterface(newContent));
if (ssle) {
ssle->InitStyleLinkElement(PR_FALSE);
ssle->SetEnableUpdates(PR_FALSE);
}
}
if (!attributes) {
return rv;
}
@@ -242,13 +250,6 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder)
newContent->SetAttr(attributes->getURI(i), localName, attributes->getPrefix(i), *(attributes->getValue(i)), PR_FALSE);
// XXX what to do with nsresult?
}
if (ns != kNameSpaceID_MathML && (name == nsHtml5Atoms::style || (ns == kNameSpaceID_XHTML && name == nsHtml5Atoms::link))) {
nsCOMPtr<nsIStyleSheetLinkingElement> ssle(do_QueryInterface(newContent));
if (ssle) {
ssle->InitStyleLinkElement(PR_FALSE);
ssle->SetEnableUpdates(PR_FALSE);
}
}
return rv;
}
case eTreeOpSetFormElement: {
@@ -351,6 +352,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder)
}
case eTreeOpUpdateStyleSheet: {
nsIContent* node = *(mOne.node);
aBuilder->FlushPendingAppendNotifications();
aBuilder->UpdateStyleSheet(node);
return rv;
}