diff --git a/content/base/src/nsContentAreaDragDrop.cpp b/content/base/src/nsContentAreaDragDrop.cpp index 36318bb9bc6..a9ea2e50468 100644 --- a/content/base/src/nsContentAreaDragDrop.cpp +++ b/content/base/src/nsContentAreaDragDrop.cpp @@ -458,7 +458,6 @@ DragDataProducer::Produce(nsDOMDataTransfer* aDataTransfer, nsCOMPtr form(do_QueryInterface(findFormParent)); if (form && form->GetType() != NS_FORM_OBJECT && form->GetType() != NS_FORM_FIELDSET && - form->GetType() != NS_FORM_LEGEND && form->GetType() != NS_FORM_LABEL && form->GetType() != NS_FORM_OUTPUT) return NS_OK; diff --git a/content/html/content/public/nsIFormControl.h b/content/html/content/public/nsIFormControl.h index 61fdc290b4e..82c89d7c8f1 100644 --- a/content/html/content/public/nsIFormControl.h +++ b/content/html/content/public/nsIFormControl.h @@ -51,7 +51,6 @@ enum FormControlsTypes { NS_FORM_OPTION, NS_FORM_OPTGROUP, NS_FORM_OUTPUT, - NS_FORM_LEGEND, NS_FORM_SELECT, NS_FORM_TEXTAREA, NS_FORM_OBJECT, diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 50e8dff9412..a03043a111a 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -2685,7 +2685,6 @@ nsGenericHTMLFormElement::CanBeDisabled() const // It's easier to test the types that _cannot_ be disabled return type != NS_FORM_LABEL && - type != NS_FORM_LEGEND && type != NS_FORM_FIELDSET && type != NS_FORM_OBJECT && type != NS_FORM_OUTPUT; @@ -2728,8 +2727,7 @@ nsGenericHTMLFormElement::IsLabelableControl() const type != NS_FORM_LABEL && type != NS_FORM_OPTION && type != NS_FORM_OPTGROUP && - type != NS_FORM_OBJECT && - type != NS_FORM_LEGEND; + type != NS_FORM_OBJECT; } PRInt32 diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp index ad712d0f05c..c1573f62934 100644 --- a/content/html/content/src/nsHTMLFormElement.cpp +++ b/content/html/content/src/nsHTMLFormElement.cpp @@ -204,7 +204,6 @@ ShouldBeInElements(nsIFormControl* aFormControl) // NS_FORM_LABEL // NS_FORM_OPTION // NS_FORM_OPTGROUP - // NS_FORM_LEGEND return PR_FALSE; } diff --git a/content/html/content/src/nsHTMLLegendElement.cpp b/content/html/content/src/nsHTMLLegendElement.cpp index 42068e72853..3e25db9077a 100644 --- a/content/html/content/src/nsHTMLLegendElement.cpp +++ b/content/html/content/src/nsHTMLLegendElement.cpp @@ -49,7 +49,7 @@ #include "nsFocusManager.h" #include "nsIFrame.h" -class nsHTMLLegendElement : public nsGenericHTMLFormElement, +class nsHTMLLegendElement : public nsGenericHTMLElement, public nsIDOMHTMLLegendElement { public: @@ -60,23 +60,18 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::) + NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::) + NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFormElement::) + NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::) // nsIDOMHTMLLegendElement NS_DECL_NSIDOMHTMLLEGENDELEMENT - // nsIFormControl - NS_IMETHOD_(PRUint32) GetType() const { return NS_FORM_LEGEND; } - NS_IMETHOD Reset(); - NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission, - nsIContent* aSubmitElement); - + // nsGenericHTMLElement NS_IMETHODIMP Focus(); virtual void PerformAccesskey(PRBool aKeyCausesActivation, @@ -120,7 +115,7 @@ NS_IMPL_NS_NEW_HTML_ELEMENT(Legend) nsHTMLLegendElement::nsHTMLLegendElement(nsINodeInfo *aNodeInfo) - : nsGenericHTMLFormElement(aNodeInfo) + : nsGenericHTMLElement(aNodeInfo) { } @@ -139,7 +134,7 @@ DOMCI_DATA(HTMLLegendElement, nsHTMLLegendElement) NS_INTERFACE_TABLE_HEAD(nsHTMLLegendElement) NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLLegendElement, nsIDOMHTMLLegendElement) NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLLegendElement, - nsGenericHTMLFormElement) + nsGenericHTMLElement) NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLLegendElement) @@ -204,7 +199,7 @@ nsHTMLLegendElement::GetAttributeChangeHint(const nsIAtom* aAttribute, PRInt32 aModType) const { nsChangeHint retval = - nsGenericHTMLFormElement::GetAttributeChangeHint(aAttribute, aModType); + nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType); if (aAttribute == nsGkAtoms::align) { NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW); } @@ -222,8 +217,8 @@ nsHTMLLegendElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, UnregAccessKey(); } - nsresult rv = nsGenericHTMLFormElement::SetAttr(aNameSpaceID, aAttribute, - aPrefix, aValue, aNotify); + nsresult rv = nsGenericHTMLElement::SetAttr(aNameSpaceID, aAttribute, + aPrefix, aValue, aNotify); if (accesskey && !aValue.IsEmpty()) { SetFlags(NODE_HAS_ACCESSKEY); @@ -244,13 +239,7 @@ nsHTMLLegendElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, UnsetFlags(NODE_HAS_ACCESSKEY); } - return nsGenericHTMLFormElement::UnsetAttr(aNameSpaceID, aAttribute, aNotify); -} - -nsresult -nsHTMLLegendElement::Reset() -{ - return NS_OK; + return nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute, aNotify); } nsresult @@ -258,9 +247,9 @@ nsHTMLLegendElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, nsIContent* aBindingParent, PRBool aCompileEventHandlers) { - nsresult rv = nsGenericHTMLFormElement::BindToTree(aDocument, aParent, - aBindingParent, - aCompileEventHandlers); + nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent, + aBindingParent, + aCompileEventHandlers); NS_ENSURE_SUCCESS(rv, rv); if (aDocument) { @@ -277,7 +266,7 @@ nsHTMLLegendElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent) UnregAccessKey(); } - nsGenericHTMLFormElement::UnbindFromTree(aDeep, aNullParent); + nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent); } NS_IMETHODIMP @@ -310,9 +299,3 @@ nsHTMLLegendElement::PerformAccesskey(PRBool aKeyCausesActivation, Focus(); } -NS_IMETHODIMP -nsHTMLLegendElement::SubmitNamesValues(nsFormSubmission* aFormSubmission, - nsIContent* aSubmitElement) -{ - return NS_OK; -} diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 71789adaa84..95606a1dffa 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -7302,17 +7302,32 @@ nsNodeSH::PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *globalObj, native_parent = doc; // But for HTML form controls, use the form as scope parent. - if (nodeIsElement && - node->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) { - nsCOMPtr form_control(do_QueryInterface(node)); + if (nodeIsElement) { + if (node->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) { + nsCOMPtr form_control(do_QueryInterface(node)); - if (form_control) { - nsCOMPtr form; - form_control->GetForm(getter_AddRefs(form)); + if (form_control) { + nsCOMPtr form; + form_control->GetForm(getter_AddRefs(form)); - if (form) { - // Found a form, use it. - native_parent = form; + if (form) { + // Found a form, use it. + native_parent = form; + } + } + // Legend isn't an HTML form control but should have its fieldset form + // as scope parent at least for backward compatibility. + } else if (node->AsElement()->IsHTML() && + node->AsElement()->Tag() == nsGkAtoms::legend) { + nsCOMPtr legend(do_QueryInterface(node)); + + if (legend) { + nsCOMPtr form; + legend->GetForm(getter_AddRefs(form)); + + if (form) { + native_parent = form; + } } } } diff --git a/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp b/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp index 0a9791d1738..82576388dd2 100644 --- a/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp +++ b/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp @@ -228,8 +228,6 @@ EmbedContextMenuInfo::SetFormControlType(nsIDOMEventTarget *originalTarget) break; case NS_FORM_OPTGROUP: break; - case NS_FORM_LEGEND: - break; case NS_FORM_SELECT: break; case NS_FORM_TEXTAREA: