mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 545854 - Add the <keygen> macro to the HTML5 parser. r=bnewman.
--HG-- extra : rebase_source : afd36441c60abba7453fd91c32beec4e6e1fd17b
This commit is contained in:
parent
dbe97109e1
commit
56cd24d21e
@ -63,6 +63,7 @@
|
||||
|
||||
GK_ATOM(_empty, "")
|
||||
GK_ATOM(moz, "_moz")
|
||||
GK_ATOM(moztype, "_moz-type")
|
||||
GK_ATOM(mozdirty, "_moz_dirty")
|
||||
GK_ATOM(mozeditorbogusnode, "_moz_editor_bogus_node")
|
||||
GK_ATOM(mozgeneratedcontentbefore, "_moz_generated_content_before")
|
||||
|
@ -58,6 +58,10 @@
|
||||
#include "nsIStyleSheetLinkingElement.h"
|
||||
#include "nsIDOMDocumentType.h"
|
||||
#include "nsIMutationObserver.h"
|
||||
#include "nsIFormProcessor.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
static NS_DEFINE_CID(kFormProcessorCID, NS_FORMPROCESSOR_CID);
|
||||
|
||||
/**
|
||||
* Helper class that opens a notification batch if the current doc
|
||||
@ -363,6 +367,11 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
nsCOMPtr<nsIAtom> name = Reget(mTwo.atom);
|
||||
nsHtml5HtmlAttributes* attributes = mThree.attributes;
|
||||
|
||||
PRBool isKeygen = (name == nsHtml5Atoms::keygen && ns == kNameSpaceID_XHTML);
|
||||
if (NS_UNLIKELY(isKeygen)) {
|
||||
name = nsHtml5Atoms::select;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> newContent;
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo = aBuilder->GetNodeInfoManager()->GetNodeInfo(name, nsnull, ns);
|
||||
NS_ASSERTION(nodeInfo, "Got null nodeinfo.");
|
||||
@ -377,6 +386,44 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
ssle->InitStyleLinkElement(PR_FALSE);
|
||||
ssle->SetEnableUpdates(PR_FALSE);
|
||||
}
|
||||
} else if (NS_UNLIKELY(isKeygen)) {
|
||||
// Adapted from CNavDTD
|
||||
nsCOMPtr<nsIFormProcessor> theFormProcessor =
|
||||
do_GetService(kFormProcessorCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsTArray<nsString> theContent;
|
||||
nsAutoString theAttribute;
|
||||
|
||||
(void) theFormProcessor->ProvideContent(NS_LITERAL_STRING("select"),
|
||||
theContent,
|
||||
theAttribute);
|
||||
|
||||
newContent->SetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::moztype,
|
||||
nsnull,
|
||||
theAttribute,
|
||||
PR_FALSE);
|
||||
|
||||
nsCOMPtr<nsINodeInfo> optionNodeInfo =
|
||||
aBuilder->GetNodeInfoManager()->GetNodeInfo(nsHtml5Atoms::option,
|
||||
nsnull,
|
||||
kNameSpaceID_XHTML);
|
||||
|
||||
for (PRUint32 i = 0; i < theContent.Length(); ++i) {
|
||||
nsCOMPtr<nsIContent> optionElt;
|
||||
NS_NewElement(getter_AddRefs(optionElt),
|
||||
optionNodeInfo->NamespaceID(),
|
||||
optionNodeInfo,
|
||||
PR_TRUE);
|
||||
nsCOMPtr<nsIContent> optionText;
|
||||
NS_NewTextNode(getter_AddRefs(optionText),
|
||||
aBuilder->GetNodeInfoManager());
|
||||
(void) optionText->SetText(theContent[i], PR_FALSE);
|
||||
optionElt->AppendChildTo(optionText, PR_FALSE);
|
||||
newContent->AppendChildTo(optionElt, PR_FALSE);
|
||||
newContent->DoneAddingChildren(PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!attributes) {
|
||||
@ -392,6 +439,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
newContent->SetAttr(attributes->getURI(i), localName, attributes->getPrefix(i), *(attributes->getValue(i)), PR_FALSE);
|
||||
// XXX what to do with nsresult?
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
case eTreeOpSetFormElement: {
|
||||
|
Loading…
Reference in New Issue
Block a user