Bug 605081 - Editor refuses to insert a <keygen> element; r=ehsan a=roc
authorDaniel Glazman <daniel@glazman.org>
Thu, 21 Oct 2010 17:12:49 -0400
changeset 56338 da4897bd001de8ead0c5e7b82a5bd0b9ea4e8cee
parent 56337 112490ab7b5856dede85e38bf6bef0b9755fc278
child 56339 c81efbbacc62559bac6ad1d7e0ecba7c94cd1a50
push idunknown
push userunknown
push dateunknown
reviewersehsan, roc
bugs605081
milestone2.0b8pre
Bug 605081 - Editor refuses to insert a <keygen> element; r=ehsan a=roc
editor/libeditor/base/nsEditPropertyAtomList.h
editor/libeditor/html/nsHTMLEditUtils.cpp
--- a/editor/libeditor/base/nsEditPropertyAtomList.h
+++ b/editor/libeditor/base/nsEditPropertyAtomList.h
@@ -140,16 +140,17 @@ EDITOR_ATOM(head, "head")
 EDITOR_ATOM(hgroup, "hgroup")
 EDITOR_ATOM(href, "href") // Use to differentiate between "a" for link, "a" for named anchor
 EDITOR_ATOM(hr, "hr")
 EDITOR_ATOM(html, "html")
 EDITOR_ATOM(i, "i")
 EDITOR_ATOM(img, "img")
 EDITOR_ATOM(input, "input")
 EDITOR_ATOM(kbd, "kbd")
+EDITOR_ATOM(keygen, "keygen")
 EDITOR_ATOM(label, "label")
 EDITOR_ATOM(legend, "legend")
 EDITOR_ATOM(li, "li")
 EDITOR_ATOM(map, "map")
 EDITOR_ATOM(mark, "mark")
 EDITOR_ATOM(mozdirty, "_moz_dirty")
 EDITOR_ATOM(mozEditorBogusNode, "_moz_editor_bogus_node")
 EDITOR_ATOM(name, "name")
--- a/editor/libeditor/html/nsHTMLEditUtils.cpp
+++ b/editor/libeditor/html/nsHTMLEditUtils.cpp
@@ -427,16 +427,17 @@ PRBool
 nsHTMLEditUtils::IsFormWidget(nsIDOMNode *node)
 {
   NS_PRECONDITION(node, "null node passed to nsHTMLEditUtils::IsFormWidget");
   nsCOMPtr<nsIAtom> nodeAtom = nsEditor::GetTag(node);
   return (nodeAtom == nsEditProperty::textarea)
       || (nodeAtom == nsEditProperty::select)
       || (nodeAtom == nsEditProperty::button)
       || (nodeAtom == nsEditProperty::output)
+      || (nodeAtom == nsEditProperty::keygen)
       || (nodeAtom == nsEditProperty::input);
 }
 
 PRBool
 nsHTMLEditUtils::SupportsAlignAttr(nsIDOMNode * aNode)
 {
   NS_PRECONDITION(aNode, "null node passed to nsHTMLEditUtils::SupportsAlignAttr");
   nsCOMPtr<nsIAtom> nodeAtom = nsEditor::GetTag(aNode);
@@ -646,17 +647,17 @@ static const nsElementInfo kElements[eHT
        GROUP_FLOW_ELEMENT),
   ELEM(image, PR_FALSE, PR_FALSE, GROUP_NONE, GROUP_NONE),
   ELEM(img, PR_FALSE, PR_FALSE, GROUP_SPECIAL, GROUP_NONE),
   ELEM(input, PR_FALSE, PR_FALSE, GROUP_FORMCONTROL, GROUP_NONE),
   ELEM(ins, PR_TRUE, PR_TRUE, GROUP_PHRASE | GROUP_BLOCK, GROUP_FLOW_ELEMENT),
   ELEM(isindex, PR_FALSE, PR_FALSE, GROUP_BLOCK | GROUP_HEAD_CONTENT,
        GROUP_NONE),
   ELEM(kbd, PR_TRUE, PR_TRUE, GROUP_PHRASE, GROUP_INLINE_ELEMENT),
-  ELEM(keygen, PR_FALSE, PR_FALSE, GROUP_NONE, GROUP_NONE),
+  ELEM(keygen, PR_FALSE, PR_FALSE, GROUP_FORMCONTROL, GROUP_NONE),
   ELEM(label, PR_TRUE, PR_FALSE, GROUP_FORMCONTROL, GROUP_INLINE_ELEMENT),
   ELEM(legend, PR_TRUE, PR_TRUE, GROUP_NONE, GROUP_INLINE_ELEMENT),
   ELEM(li, PR_TRUE, PR_FALSE, GROUP_LI, GROUP_FLOW_ELEMENT),
   ELEM(link, PR_FALSE, PR_FALSE, GROUP_HEAD_CONTENT, GROUP_NONE),
   ELEM(listing, PR_FALSE, PR_FALSE, GROUP_NONE, GROUP_NONE),
   ELEM(map, PR_TRUE, PR_TRUE, GROUP_SPECIAL, GROUP_BLOCK | GROUP_MAP_CONTENT),
   ELEM(mark, PR_TRUE, PR_TRUE, GROUP_PHRASE, GROUP_INLINE_ELEMENT),
   ELEM(marquee, PR_FALSE, PR_FALSE, GROUP_NONE, GROUP_NONE),
@@ -770,17 +771,17 @@ nsHTMLEditUtils::CanContain(PRInt32 aPar
     for (j = 0; j < NS_ARRAY_LENGTH(kButtonExcludeKids); ++j) {
       if (kButtonExcludeKids[j] == aChild) {
         return PR_FALSE;
       }
     }
   }
 
   // Deprecated elements.
-  if (aChild == eHTMLTag_bgsound || aChild == eHTMLTag_keygen) {
+  if (aChild == eHTMLTag_bgsound) {
     return PR_FALSE;
   }
 
   // Bug #67007, dont strip userdefined tags.
   if (aChild == eHTMLTag_userdefined) {
     return PR_TRUE;
   }