Bug 686913 - HTMLProgressElement and HTMLMeterElement should not be form controls. r=mounir, a=mfinkle

This commit is contained in:
Matthew Schranz 2012-04-21 17:35:42 -04:00
parent adf465996e
commit 43713e6cef
8 changed files with 13 additions and 47 deletions

View File

@ -58,7 +58,6 @@ enum FormControlsTypes {
NS_FORM_SELECT,
NS_FORM_TEXTAREA,
NS_FORM_OBJECT,
NS_FORM_PROGRESS,
eFormControlsWithoutSubTypesMax,
// After this, all types will have sub-types which introduce new enum lists.
// eFormControlsWithoutSubTypesMax let us know if the previous types values
@ -284,7 +283,6 @@ nsIFormControl::IsLabelableControl() const
// type == NS_FORM_KEYGEN ||
// type == NS_FORM_METER ||
type == NS_FORM_OUTPUT ||
type == NS_FORM_PROGRESS ||
type == NS_FORM_SELECT ||
type == NS_FORM_TEXTAREA;
}

View File

@ -2918,8 +2918,7 @@ nsGenericHTMLFormElement::CanBeDisabled() const
return
type != NS_FORM_LABEL &&
type != NS_FORM_OBJECT &&
type != NS_FORM_OUTPUT &&
type != NS_FORM_PROGRESS;
type != NS_FORM_OUTPUT;
}
bool

View File

@ -160,8 +160,7 @@ nsHTMLFieldSetElement::MatchListedElements(nsIContent* aContent, PRInt32 aNamesp
nsIAtom* aAtom, void* aData)
{
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(aContent);
return formControl && formControl->GetType() != NS_FORM_LABEL &&
formControl->GetType() != NS_FORM_PROGRESS;
return formControl && formControl->GetType() != NS_FORM_LABEL;
}
NS_IMETHODIMP

View File

@ -223,7 +223,6 @@ ShouldBeInElements(nsIFormControl* aFormControl)
//
// NS_FORM_INPUT_IMAGE
// NS_FORM_LABEL
// NS_FORM_PROGRESS
return false;
}

View File

@ -41,7 +41,7 @@
#include "nsEventStateManager.h"
class nsHTMLProgressElement : public nsGenericHTMLFormElement,
class nsHTMLProgressElement : public nsGenericHTMLElement,
public nsIDOMHTMLProgressElement
{
public:
@ -52,22 +52,17 @@ 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::)
// nsIDOMHTMLProgressElement
NS_DECL_NSIDOMHTMLPROGRESSELEMENT
// nsIFormControl
NS_IMETHOD_(PRUint32) GetType() const { return NS_FORM_PROGRESS; }
NS_IMETHOD Reset();
NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission);
nsEventStates IntrinsicState() const;
nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const;
@ -100,7 +95,7 @@ NS_IMPL_NS_NEW_HTML_ELEMENT(Progress)
nsHTMLProgressElement::nsHTMLProgressElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericHTMLFormElement(aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
// We start out indeterminate
AddStatesSilently(NS_EVENT_STATE_INDETERMINATE);
@ -119,7 +114,7 @@ NS_INTERFACE_TABLE_HEAD(nsHTMLProgressElement)
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLProgressElement,
nsIDOMHTMLProgressElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLProgressElement,
nsGenericHTMLFormElement)
nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLProgressElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLProgressElement)
@ -142,7 +137,7 @@ nsHTMLProgressElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
nsEventStates
nsHTMLProgressElement::IntrinsicState() const
{
nsEventStates state = nsGenericHTMLFormElement::IntrinsicState();
nsEventStates state = nsGenericHTMLElement::IntrinsicState();
if (IsIndeterminate()) {
state |= NS_EVENT_STATE_INDETERMINATE;
@ -161,14 +156,8 @@ nsHTMLProgressElement::ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute,
}
}
return nsGenericHTMLFormElement::ParseAttribute(aNamespaceID, aAttribute,
aValue, aResult);
}
NS_IMETHODIMP
nsHTMLProgressElement::GetForm(nsIDOMHTMLFormElement** aForm)
{
return nsGenericHTMLFormElement::GetForm(aForm);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute,
aValue, aResult);
}
NS_IMETHODIMP

View File

@ -29,7 +29,6 @@ function checkFormIDLAttribute(aElement)
{
var form = document.forms[0];
var content = document.getElementById('content');
is(aElement.form, form, "The form IDL attribute should be the parent form");
content.removeChild(form);
content.appendChild(aElement);
@ -226,20 +225,6 @@ function checkFormListedElement(aElement)
is(document.forms[0].elements.length, 0, "the form should have no element");
}
function checkLabelable(aElement)
{
var content = document.getElementById('content');
var label = document.createElement('label');
content.appendChild(label);
label.appendChild(aElement);
is(label.control, aElement, "progress should be labelable");
// Cleaning-up.
content.removeChild(label);
content.appendChild(aElement);
}
function checkNotResetableAndFormSubmission(aElement)
{
// Creating an input element to check the submission worked.
@ -312,8 +297,6 @@ checkIndeterminatePseudoClass();
checkFormListedElement(p);
checkLabelable(p);
checkNotResetableAndFormSubmission(p);
</script>

View File

@ -400,7 +400,7 @@ var forms = [
var elementNames = [
'button', 'fieldset', 'input', 'label', 'object', 'output', 'select',
'textarea', 'progress',
'textarea',
];
var todoElements = [

View File

@ -47,13 +47,12 @@
* @status UNDER_DEVELOPMENT
*/
[scriptable, uuid(842AEE33-8381-4DA4-A347-9E70C797BC3E)]
[scriptable, uuid(275851c9-c3e2-4427-a770-3d2aaad6c546)]
interface nsIDOMHTMLProgressElement : nsIDOMHTMLElement
{
attribute double value;
attribute double max;
readonly attribute double position;
readonly attribute nsIDOMHTMLFormElement form;
/**
* The labels attribute will be done with bug 567740.
*/