зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1556351 - Part 3: Rename nsGenericHTMLFormElementWithState to nsGenericHTMLFormControlElementWithState; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D124786
This commit is contained in:
Родитель
5ffd708a31
Коммит
6c7f4da558
|
@ -53,7 +53,7 @@ static const nsAttrValue::EnumTable* kButtonDefaultType = &kButtonTypeTable[2];
|
|||
HTMLButtonElement::HTMLButtonElement(
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
FromParser aFromParser)
|
||||
: nsGenericHTMLFormElementWithState(
|
||||
: nsGenericHTMLFormControlElementWithState(
|
||||
std::move(aNodeInfo), aFromParser,
|
||||
FormControlType(kButtonDefaultType->value)),
|
||||
mDisabledChanged(false),
|
||||
|
@ -68,11 +68,12 @@ HTMLButtonElement::~HTMLButtonElement() = default;
|
|||
// nsISupports
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLButtonElement,
|
||||
nsGenericHTMLFormElementWithState, mValidity)
|
||||
nsGenericHTMLFormControlElementWithState,
|
||||
mValidity)
|
||||
|
||||
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLButtonElement,
|
||||
nsGenericHTMLFormElementWithState,
|
||||
nsIConstraintValidation)
|
||||
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(
|
||||
HTMLButtonElement, nsGenericHTMLFormControlElementWithState,
|
||||
nsIConstraintValidation)
|
||||
|
||||
void HTMLButtonElement::SetCustomValidity(const nsAString& aError) {
|
||||
nsIConstraintValidation::SetCustomValidity(aError);
|
||||
|
@ -90,7 +91,7 @@ void HTMLButtonElement::FieldSetDisabledChanged(bool aNotify) {
|
|||
// FieldSetDisabledChanged *has* to be called *before*
|
||||
// UpdateBarredFromConstraintValidation, because the latter depends on our
|
||||
// disabled state.
|
||||
nsGenericHTMLFormElementWithState::FieldSetDisabledChanged(aNotify);
|
||||
nsGenericHTMLFormControlElementWithState::FieldSetDisabledChanged(aNotify);
|
||||
|
||||
UpdateBarredFromConstraintValidation();
|
||||
UpdateState(aNotify);
|
||||
|
@ -115,7 +116,7 @@ int32_t HTMLButtonElement::TabIndexDefault() { return 0; }
|
|||
|
||||
bool HTMLButtonElement::IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
||||
int32_t* aTabIndex) {
|
||||
if (nsGenericHTMLFormElementWithState::IsHTMLFocusable(
|
||||
if (nsGenericHTMLFormControlElementWithState::IsHTMLFocusable(
|
||||
aWithMouse, aIsFocusable, aTabIndex)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -269,7 +270,7 @@ nsresult HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
|
|||
nsresult HTMLButtonElement::BindToTree(BindContext& aContext,
|
||||
nsINode& aParent) {
|
||||
nsresult rv =
|
||||
nsGenericHTMLFormElementWithState::BindToTree(aContext, aParent);
|
||||
nsGenericHTMLFormControlElementWithState::BindToTree(aContext, aParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Update our state; we may now be the default submit element
|
||||
|
@ -279,7 +280,7 @@ nsresult HTMLButtonElement::BindToTree(BindContext& aContext,
|
|||
}
|
||||
|
||||
void HTMLButtonElement::UnbindFromTree(bool aNullParent) {
|
||||
nsGenericHTMLFormElementWithState::UnbindFromTree(aNullParent);
|
||||
nsGenericHTMLFormControlElementWithState::UnbindFromTree(aNullParent);
|
||||
|
||||
// Update our state; we may no longer be the default submit element
|
||||
UpdateState(false);
|
||||
|
@ -338,8 +339,8 @@ nsresult HTMLButtonElement::BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
|||
mDisabledChanged = true;
|
||||
}
|
||||
|
||||
return nsGenericHTMLFormElementWithState::BeforeSetAttr(aNameSpaceID, aName,
|
||||
aValue, aNotify);
|
||||
return nsGenericHTMLFormControlElementWithState::BeforeSetAttr(
|
||||
aNameSpaceID, aName, aValue, aNotify);
|
||||
}
|
||||
|
||||
nsresult HTMLButtonElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
|
@ -367,7 +368,7 @@ nsresult HTMLButtonElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
|||
}
|
||||
}
|
||||
|
||||
return nsGenericHTMLFormElementWithState::AfterSetAttr(
|
||||
return nsGenericHTMLFormControlElementWithState::AfterSetAttr(
|
||||
aNameSpaceID, aName, aValue, aOldValue, aSubjectPrincipal, aNotify);
|
||||
}
|
||||
|
||||
|
@ -394,7 +395,8 @@ bool HTMLButtonElement::RestoreState(PresState* aState) {
|
|||
}
|
||||
|
||||
EventStates HTMLButtonElement::IntrinsicState() const {
|
||||
EventStates state = nsGenericHTMLFormElementWithState::IntrinsicState();
|
||||
EventStates state =
|
||||
nsGenericHTMLFormControlElementWithState::IntrinsicState();
|
||||
|
||||
if (IsCandidateForConstraintValidation()) {
|
||||
if (IsValid()) {
|
||||
|
|
|
@ -17,7 +17,7 @@ class EventChainPreVisitor;
|
|||
namespace dom {
|
||||
class FormData;
|
||||
|
||||
class HTMLButtonElement final : public nsGenericHTMLFormElementWithState,
|
||||
class HTMLButtonElement final : public nsGenericHTMLFormControlElementWithState,
|
||||
public nsIConstraintValidation {
|
||||
public:
|
||||
using nsIConstraintValidation::GetValidationMessage;
|
||||
|
@ -26,8 +26,8 @@ class HTMLButtonElement final : public nsGenericHTMLFormElementWithState,
|
|||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
FromParser aFromParser = NOT_FROM_PARSER);
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLButtonElement,
|
||||
nsGenericHTMLFormElementWithState)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(
|
||||
HTMLButtonElement, nsGenericHTMLFormControlElementWithState)
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
|
|
@ -1159,8 +1159,8 @@ nsresult HTMLInputElement::BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
|||
}
|
||||
}
|
||||
|
||||
return nsGenericHTMLFormElementWithState::BeforeSetAttr(aNameSpaceID, aName,
|
||||
aValue, aNotify);
|
||||
return nsGenericHTMLFormControlElementWithState::BeforeSetAttr(
|
||||
aNameSpaceID, aName, aValue, aNotify);
|
||||
}
|
||||
|
||||
nsresult HTMLInputElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
|
@ -1341,7 +1341,7 @@ nsresult HTMLInputElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
|||
}
|
||||
}
|
||||
|
||||
return nsGenericHTMLFormElementWithState::AfterSetAttr(
|
||||
return nsGenericHTMLFormControlElementWithState::AfterSetAttr(
|
||||
aNameSpaceID, aName, aValue, aOldValue, aSubjectPrincipal, aNotify);
|
||||
}
|
||||
|
||||
|
@ -2731,7 +2731,7 @@ nsresult HTMLInputElement::SetValueInternal(
|
|||
}
|
||||
|
||||
// Treat value == defaultValue for other input elements.
|
||||
return nsGenericHTMLFormElementWithState::SetAttr(
|
||||
return nsGenericHTMLFormControlElementWithState::SetAttr(
|
||||
kNameSpaceID_None, nsGkAtoms::value, aValue, true);
|
||||
|
||||
case VALUE_MODE_FILENAME:
|
||||
|
@ -2975,7 +2975,7 @@ bool HTMLInputElement::IsNodeApzAwareInternal() const {
|
|||
|
||||
bool HTMLInputElement::IsInteractiveHTMLContent() const {
|
||||
return mType != FormControlType::InputHidden ||
|
||||
nsGenericHTMLFormElementWithState::IsInteractiveHTMLContent();
|
||||
nsGenericHTMLFormControlElementWithState::IsInteractiveHTMLContent();
|
||||
}
|
||||
|
||||
void HTMLInputElement::AsyncEventRunning(AsyncEventDispatcher* aEvent) {
|
||||
|
@ -3191,8 +3191,8 @@ void HTMLInputElement::GetEventTargetParent(EventChainPreVisitor& aVisitor) {
|
|||
if (mType == FormControlType::InputRange &&
|
||||
(aVisitor.mEvent->mMessage == eFocus ||
|
||||
aVisitor.mEvent->mMessage == eBlur)) {
|
||||
// Just as nsGenericHTMLFormElementWithState::GetEventTargetParent calls
|
||||
// nsIFormControlFrame::SetFocus, we handle focus here.
|
||||
// Just as nsGenericHTMLFormControlElementWithState::GetEventTargetParent
|
||||
// calls nsIFormControlFrame::SetFocus, we handle focus here.
|
||||
nsIFrame* frame = GetPrimaryFrame();
|
||||
if (frame) {
|
||||
frame->InvalidateFrameSubtree();
|
||||
|
@ -3244,7 +3244,7 @@ void HTMLInputElement::GetEventTargetParent(EventChainPreVisitor& aVisitor) {
|
|||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLFormElementWithState::GetEventTargetParent(aVisitor);
|
||||
nsGenericHTMLFormControlElementWithState::GetEventTargetParent(aVisitor);
|
||||
|
||||
// Stop the event if the related target's first non-native ancestor is the
|
||||
// same as the original target's first non-native ancestor (we are moving
|
||||
|
@ -3274,7 +3274,7 @@ nsresult HTMLInputElement::PreHandleEvent(EventChainVisitor& aVisitor) {
|
|||
MOZ_ASSERT(aVisitor.mEvent->mMessage == eBlur);
|
||||
FireChangeEventIfNeeded();
|
||||
}
|
||||
return nsGenericHTMLFormElementWithState::PreHandleEvent(aVisitor);
|
||||
return nsGenericHTMLFormControlElementWithState::PreHandleEvent(aVisitor);
|
||||
}
|
||||
|
||||
void HTMLInputElement::StartRangeThumbDrag(WidgetGUIEvent* aEvent) {
|
||||
|
@ -4174,7 +4174,7 @@ void HTMLInputElement::MaybeLoadImage() {
|
|||
|
||||
nsresult HTMLInputElement::BindToTree(BindContext& aContext, nsINode& aParent) {
|
||||
nsresult rv =
|
||||
nsGenericHTMLFormElementWithState::BindToTree(aContext, aParent);
|
||||
nsGenericHTMLFormControlElementWithState::BindToTree(aContext, aParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsImageLoadingContent::BindToTree(aContext, aParent);
|
||||
|
@ -4244,8 +4244,8 @@ void HTMLInputElement::UnbindFromTree(bool aNullParent) {
|
|||
}
|
||||
|
||||
// If we have a form and are unbound from it,
|
||||
// nsGenericHTMLFormElementWithState::UnbindFromTree() will unset the form and
|
||||
// that takes care of form's WillRemove so we just have to take care
|
||||
// nsGenericHTMLFormControlElementWithState::UnbindFromTree() will unset the
|
||||
// form and that takes care of form's WillRemove so we just have to take care
|
||||
// of the case where we're removing from the document and we don't
|
||||
// have a form
|
||||
if (!mForm && mType == FormControlType::InputRadio) {
|
||||
|
@ -4257,7 +4257,7 @@ void HTMLInputElement::UnbindFromTree(bool aNullParent) {
|
|||
}
|
||||
|
||||
nsImageLoadingContent::UnbindFromTree(aNullParent);
|
||||
nsGenericHTMLFormElementWithState::UnbindFromTree(aNullParent);
|
||||
nsGenericHTMLFormControlElementWithState::UnbindFromTree(aNullParent);
|
||||
|
||||
// GetCurrentDoc is returning nullptr so we can update the value
|
||||
// missing validity state to reflect we are no longer into a doc.
|
||||
|
@ -5143,25 +5143,25 @@ bool HTMLInputElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
|||
|
||||
void HTMLInputElement::ImageInputMapAttributesIntoRule(
|
||||
const nsMappedAttributes* aAttributes, MappedDeclarations& aDecls) {
|
||||
nsGenericHTMLFormElementWithState::MapImageBorderAttributeInto(aAttributes,
|
||||
aDecls);
|
||||
nsGenericHTMLFormElementWithState::MapImageMarginAttributeInto(aAttributes,
|
||||
aDecls);
|
||||
nsGenericHTMLFormElementWithState::MapImageSizeAttributesInto(
|
||||
nsGenericHTMLFormControlElementWithState::MapImageBorderAttributeInto(
|
||||
aAttributes, aDecls);
|
||||
nsGenericHTMLFormControlElementWithState::MapImageMarginAttributeInto(
|
||||
aAttributes, aDecls);
|
||||
nsGenericHTMLFormControlElementWithState::MapImageSizeAttributesInto(
|
||||
aAttributes, aDecls, MapAspectRatio::Yes);
|
||||
// Images treat align as "float"
|
||||
nsGenericHTMLFormElementWithState::MapImageAlignAttributeInto(aAttributes,
|
||||
aDecls);
|
||||
nsGenericHTMLFormControlElementWithState::MapImageAlignAttributeInto(
|
||||
aAttributes, aDecls);
|
||||
|
||||
nsGenericHTMLFormElementWithState::MapCommonAttributesInto(aAttributes,
|
||||
aDecls);
|
||||
nsGenericHTMLFormControlElementWithState::MapCommonAttributesInto(aAttributes,
|
||||
aDecls);
|
||||
}
|
||||
|
||||
nsChangeHint HTMLInputElement::GetAttributeChangeHint(const nsAtom* aAttribute,
|
||||
int32_t aModType) const {
|
||||
nsChangeHint retval =
|
||||
nsGenericHTMLFormElementWithState::GetAttributeChangeHint(aAttribute,
|
||||
aModType);
|
||||
nsGenericHTMLFormControlElementWithState::GetAttributeChangeHint(
|
||||
aAttribute, aModType);
|
||||
|
||||
const bool isAdditionOrRemoval =
|
||||
aModType == MutationEvent_Binding::ADDITION ||
|
||||
|
@ -5868,7 +5868,8 @@ EventStates HTMLInputElement::IntrinsicState() const {
|
|||
// If you add states here, and they're type-dependent, you need to add them
|
||||
// to the type case in AfterSetAttr.
|
||||
|
||||
EventStates state = nsGenericHTMLFormElementWithState::IntrinsicState();
|
||||
EventStates state =
|
||||
nsGenericHTMLFormControlElementWithState::IntrinsicState();
|
||||
if (mType == FormControlType::InputCheckbox ||
|
||||
mType == FormControlType::InputRadio) {
|
||||
// Check current checked state (:checked)
|
||||
|
@ -6128,7 +6129,7 @@ void HTMLInputElement::WillRemoveFromRadioGroup() {
|
|||
|
||||
bool HTMLInputElement::IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
||||
int32_t* aTabIndex) {
|
||||
if (nsGenericHTMLFormElementWithState::IsHTMLFocusable(
|
||||
if (nsGenericHTMLFormControlElementWithState::IsHTMLFocusable(
|
||||
aWithMouse, aIsFocusable, aTabIndex)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -6685,7 +6686,7 @@ void HTMLInputElement::FieldSetDisabledChanged(bool aNotify) {
|
|||
// This *has* to be called *before* UpdateBarredFromConstraintValidation and
|
||||
// UpdateValueMissingValidityState because these two functions depend on our
|
||||
// disabled state.
|
||||
nsGenericHTMLFormElementWithState::FieldSetDisabledChanged(aNotify);
|
||||
nsGenericHTMLFormControlElementWithState::FieldSetDisabledChanged(aNotify);
|
||||
|
||||
UpdateValueMissingValidityState();
|
||||
UpdateBarredFromConstraintValidation();
|
||||
|
|
|
@ -115,8 +115,8 @@ class HTMLInputElement final : public TextControlElement,
|
|||
friend class InputType;
|
||||
|
||||
public:
|
||||
using nsGenericHTMLFormElementWithState::GetForm;
|
||||
using nsGenericHTMLFormElementWithState::GetFormAction;
|
||||
using nsGenericHTMLFormControlElementWithState::GetForm;
|
||||
using nsGenericHTMLFormControlElementWithState::GetFormAction;
|
||||
using nsIConstraintValidation::GetValidationMessage;
|
||||
using ValueSetterOption = TextControlState::ValueSetterOption;
|
||||
using ValueSetterOptions = TextControlState::ValueSetterOptions;
|
||||
|
@ -862,7 +862,7 @@ class HTMLInputElement final : public TextControlElement,
|
|||
|
||||
// Pull IsSingleLineTextControl into our scope, otherwise it'd be hidden
|
||||
// by the TextControlElement version.
|
||||
using nsGenericHTMLFormElementWithState::IsSingleLineTextControl;
|
||||
using nsGenericHTMLFormControlElementWithState::IsSingleLineTextControl;
|
||||
|
||||
/**
|
||||
* The ValueModeType specifies how the value IDL attribute should behave.
|
||||
|
|
|
@ -108,8 +108,8 @@ SafeOptionListMutation::~SafeOptionListMutation() {
|
|||
HTMLSelectElement::HTMLSelectElement(
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
FromParser aFromParser)
|
||||
: nsGenericHTMLFormElementWithState(std::move(aNodeInfo), aFromParser,
|
||||
FormControlType::Select),
|
||||
: nsGenericHTMLFormControlElementWithState(
|
||||
std::move(aNodeInfo), aFromParser, FormControlType::Select),
|
||||
mOptions(new HTMLOptionsCollection(this)),
|
||||
mAutocompleteAttrState(nsContentUtils::eAutocompleteAttrState_Unknown),
|
||||
mAutocompleteInfoState(nsContentUtils::eAutocompleteAttrState_Unknown),
|
||||
|
@ -139,20 +139,20 @@ HTMLSelectElement::HTMLSelectElement(
|
|||
NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLSelectElement)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(
|
||||
HTMLSelectElement, nsGenericHTMLFormElementWithState)
|
||||
HTMLSelectElement, nsGenericHTMLFormControlElementWithState)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mValidity)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOptions)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSelectedOptions)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(
|
||||
HTMLSelectElement, nsGenericHTMLFormElementWithState)
|
||||
HTMLSelectElement, nsGenericHTMLFormControlElementWithState)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mValidity)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSelectedOptions)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLSelectElement,
|
||||
nsGenericHTMLFormElementWithState,
|
||||
nsIConstraintValidation)
|
||||
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(
|
||||
HTMLSelectElement, nsGenericHTMLFormControlElementWithState,
|
||||
nsIConstraintValidation)
|
||||
|
||||
// nsIDOMHTMLSelectElement
|
||||
|
||||
|
@ -182,8 +182,8 @@ void HTMLSelectElement::InsertChildBefore(nsIContent* aKid,
|
|||
ErrorResult& aRv) {
|
||||
int32_t index = aBeforeThis ? ComputeIndexOf(aBeforeThis) : GetChildCount();
|
||||
SafeOptionListMutation safeMutation(this, this, aKid, index, aNotify);
|
||||
nsGenericHTMLFormElementWithState::InsertChildBefore(aKid, aBeforeThis,
|
||||
aNotify, aRv);
|
||||
nsGenericHTMLFormControlElementWithState::InsertChildBefore(aKid, aBeforeThis,
|
||||
aNotify, aRv);
|
||||
if (aRv.Failed()) {
|
||||
safeMutation.MutationFailed();
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ void HTMLSelectElement::InsertChildBefore(nsIContent* aKid,
|
|||
void HTMLSelectElement::RemoveChildNode(nsIContent* aKid, bool aNotify) {
|
||||
SafeOptionListMutation safeMutation(this, this, nullptr, ComputeIndexOf(aKid),
|
||||
aNotify);
|
||||
nsGenericHTMLFormElementWithState::RemoveChildNode(aKid, aNotify);
|
||||
nsGenericHTMLFormControlElementWithState::RemoveChildNode(aKid, aNotify);
|
||||
}
|
||||
|
||||
void HTMLSelectElement::InsertOptionsIntoList(nsIContent* aOptions,
|
||||
|
@ -956,7 +956,7 @@ int32_t HTMLSelectElement::TabIndexDefault() { return 0; }
|
|||
|
||||
bool HTMLSelectElement::IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
||||
int32_t* aTabIndex) {
|
||||
if (nsGenericHTMLFormElementWithState::IsHTMLFocusable(
|
||||
if (nsGenericHTMLFormControlElementWithState::IsHTMLFocusable(
|
||||
aWithMouse, aIsFocusable, aTabIndex)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -1002,7 +1002,7 @@ bool HTMLSelectElement::SelectSomething(bool aNotify) {
|
|||
nsresult HTMLSelectElement::BindToTree(BindContext& aContext,
|
||||
nsINode& aParent) {
|
||||
nsresult rv =
|
||||
nsGenericHTMLFormElementWithState::BindToTree(aContext, aParent);
|
||||
nsGenericHTMLFormControlElementWithState::BindToTree(aContext, aParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// If there is a disabled fieldset in the parent chain, the element is now
|
||||
|
@ -1018,7 +1018,7 @@ nsresult HTMLSelectElement::BindToTree(BindContext& aContext,
|
|||
}
|
||||
|
||||
void HTMLSelectElement::UnbindFromTree(bool aNullParent) {
|
||||
nsGenericHTMLFormElementWithState::UnbindFromTree(aNullParent);
|
||||
nsGenericHTMLFormControlElementWithState::UnbindFromTree(aNullParent);
|
||||
|
||||
// We might be no longer disabled because our parent chain changed.
|
||||
// XXXbz is this still needed now that fieldset changes always call
|
||||
|
@ -1050,8 +1050,8 @@ nsresult HTMLSelectElement::BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
|||
}
|
||||
}
|
||||
|
||||
return nsGenericHTMLFormElementWithState::BeforeSetAttr(aNameSpaceID, aName,
|
||||
aValue, aNotify);
|
||||
return nsGenericHTMLFormControlElementWithState::BeforeSetAttr(
|
||||
aNameSpaceID, aName, aValue, aNotify);
|
||||
}
|
||||
|
||||
nsresult HTMLSelectElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
||||
|
@ -1088,7 +1088,7 @@ nsresult HTMLSelectElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
|||
}
|
||||
}
|
||||
|
||||
return nsGenericHTMLFormElementWithState::AfterSetAttr(
|
||||
return nsGenericHTMLFormControlElementWithState::AfterSetAttr(
|
||||
aNameSpaceID, aName, aValue, aOldValue, aSubjectPrincipal, aNotify);
|
||||
}
|
||||
|
||||
|
@ -1147,17 +1147,17 @@ bool HTMLSelectElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
|||
|
||||
void HTMLSelectElement::MapAttributesIntoRule(
|
||||
const nsMappedAttributes* aAttributes, MappedDeclarations& aDecls) {
|
||||
nsGenericHTMLFormElementWithState::MapImageAlignAttributeInto(aAttributes,
|
||||
aDecls);
|
||||
nsGenericHTMLFormElementWithState::MapCommonAttributesInto(aAttributes,
|
||||
aDecls);
|
||||
nsGenericHTMLFormControlElementWithState::MapImageAlignAttributeInto(
|
||||
aAttributes, aDecls);
|
||||
nsGenericHTMLFormControlElementWithState::MapCommonAttributesInto(aAttributes,
|
||||
aDecls);
|
||||
}
|
||||
|
||||
nsChangeHint HTMLSelectElement::GetAttributeChangeHint(const nsAtom* aAttribute,
|
||||
int32_t aModType) const {
|
||||
nsChangeHint retval =
|
||||
nsGenericHTMLFormElementWithState::GetAttributeChangeHint(aAttribute,
|
||||
aModType);
|
||||
nsGenericHTMLFormControlElementWithState::GetAttributeChangeHint(
|
||||
aAttribute, aModType);
|
||||
if (aAttribute == nsGkAtoms::multiple || aAttribute == nsGkAtoms::size) {
|
||||
retval |= nsChangeHint_ReconstructFrame;
|
||||
}
|
||||
|
@ -1192,7 +1192,7 @@ void HTMLSelectElement::GetEventTargetParent(EventChainPreVisitor& aVisitor) {
|
|||
return;
|
||||
}
|
||||
|
||||
nsGenericHTMLFormElementWithState::GetEventTargetParent(aVisitor);
|
||||
nsGenericHTMLFormControlElementWithState::GetEventTargetParent(aVisitor);
|
||||
}
|
||||
|
||||
nsresult HTMLSelectElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
|
||||
|
@ -1214,11 +1214,12 @@ nsresult HTMLSelectElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
|
|||
UpdateState(true);
|
||||
}
|
||||
|
||||
return nsGenericHTMLFormElementWithState::PostHandleEvent(aVisitor);
|
||||
return nsGenericHTMLFormControlElementWithState::PostHandleEvent(aVisitor);
|
||||
}
|
||||
|
||||
EventStates HTMLSelectElement::IntrinsicState() const {
|
||||
EventStates state = nsGenericHTMLFormElementWithState::IntrinsicState();
|
||||
EventStates state =
|
||||
nsGenericHTMLFormControlElementWithState::IntrinsicState();
|
||||
|
||||
if (IsCandidateForConstraintValidation()) {
|
||||
if (IsValid()) {
|
||||
|
@ -1550,7 +1551,7 @@ void HTMLSelectElement::FieldSetDisabledChanged(bool aNotify) {
|
|||
// This *has* to be called before UpdateBarredFromConstraintValidation and
|
||||
// UpdateValueMissingValidityState because these two functions depend on our
|
||||
// disabled state.
|
||||
nsGenericHTMLFormElementWithState::FieldSetDisabledChanged(aNotify);
|
||||
nsGenericHTMLFormControlElementWithState::FieldSetDisabledChanged(aNotify);
|
||||
|
||||
UpdateValueMissingValidityState();
|
||||
UpdateBarredFromConstraintValidation();
|
||||
|
|
|
@ -73,7 +73,7 @@ class MOZ_STACK_CLASS SafeOptionListMutation {
|
|||
/**
|
||||
* Implementation of <select>
|
||||
*/
|
||||
class HTMLSelectElement final : public nsGenericHTMLFormElementWithState,
|
||||
class HTMLSelectElement final : public nsGenericHTMLFormControlElementWithState,
|
||||
public nsIConstraintValidation {
|
||||
public:
|
||||
/**
|
||||
|
@ -293,8 +293,8 @@ class HTMLSelectElement final : public nsGenericHTMLFormElementWithState,
|
|||
|
||||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLSelectElement,
|
||||
nsGenericHTMLFormElementWithState)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(
|
||||
HTMLSelectElement, nsGenericHTMLFormControlElementWithState)
|
||||
|
||||
HTMLOptionsCollection* GetOptions() { return mOptions; }
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ HTMLTextAreaElement::SelectAll(nsPresContext* aPresContext) {
|
|||
|
||||
bool HTMLTextAreaElement::IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
|
||||
int32_t* aTabIndex) {
|
||||
if (nsGenericHTMLFormElementWithState::IsHTMLFocusable(
|
||||
if (nsGenericHTMLFormControlElementWithState::IsHTMLFocusable(
|
||||
aWithMouse, aIsFocusable, aTabIndex)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -398,17 +398,17 @@ void HTMLTextAreaElement::MapAttributesIntoRule(
|
|||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLFormElementWithState::MapDivAlignAttributeInto(aAttributes,
|
||||
aDecls);
|
||||
nsGenericHTMLFormElementWithState::MapCommonAttributesInto(aAttributes,
|
||||
aDecls);
|
||||
nsGenericHTMLFormControlElementWithState::MapDivAlignAttributeInto(
|
||||
aAttributes, aDecls);
|
||||
nsGenericHTMLFormControlElementWithState::MapCommonAttributesInto(aAttributes,
|
||||
aDecls);
|
||||
}
|
||||
|
||||
nsChangeHint HTMLTextAreaElement::GetAttributeChangeHint(
|
||||
const nsAtom* aAttribute, int32_t aModType) const {
|
||||
nsChangeHint retval =
|
||||
nsGenericHTMLFormElementWithState::GetAttributeChangeHint(aAttribute,
|
||||
aModType);
|
||||
nsGenericHTMLFormControlElementWithState::GetAttributeChangeHint(
|
||||
aAttribute, aModType);
|
||||
|
||||
const bool isAdditionOrRemoval =
|
||||
aModType == MutationEvent_Binding::ADDITION ||
|
||||
|
@ -470,7 +470,7 @@ void HTMLTextAreaElement::GetEventTargetParent(EventChainPreVisitor& aVisitor) {
|
|||
aVisitor.mWantsPreHandleEvent = true;
|
||||
}
|
||||
|
||||
nsGenericHTMLFormElementWithState::GetEventTargetParent(aVisitor);
|
||||
nsGenericHTMLFormControlElementWithState::GetEventTargetParent(aVisitor);
|
||||
}
|
||||
|
||||
nsresult HTMLTextAreaElement::PreHandleEvent(EventChainVisitor& aVisitor) {
|
||||
|
@ -478,7 +478,7 @@ nsresult HTMLTextAreaElement::PreHandleEvent(EventChainVisitor& aVisitor) {
|
|||
// Fire onchange (if necessary), before we do the blur, bug 370521.
|
||||
FireChangeEventIfNeeded();
|
||||
}
|
||||
return nsGenericHTMLFormElementWithState::PreHandleEvent(aVisitor);
|
||||
return nsGenericHTMLFormControlElementWithState::PreHandleEvent(aVisitor);
|
||||
}
|
||||
|
||||
void HTMLTextAreaElement::FireChangeEventIfNeeded() {
|
||||
|
@ -756,7 +756,8 @@ bool HTMLTextAreaElement::RestoreState(PresState* aState) {
|
|||
}
|
||||
|
||||
EventStates HTMLTextAreaElement::IntrinsicState() const {
|
||||
EventStates state = nsGenericHTMLFormElementWithState::IntrinsicState();
|
||||
EventStates state =
|
||||
nsGenericHTMLFormControlElementWithState::IntrinsicState();
|
||||
|
||||
if (IsCandidateForConstraintValidation()) {
|
||||
if (IsValid()) {
|
||||
|
@ -795,7 +796,7 @@ EventStates HTMLTextAreaElement::IntrinsicState() const {
|
|||
nsresult HTMLTextAreaElement::BindToTree(BindContext& aContext,
|
||||
nsINode& aParent) {
|
||||
nsresult rv =
|
||||
nsGenericHTMLFormElementWithState::BindToTree(aContext, aParent);
|
||||
nsGenericHTMLFormControlElementWithState::BindToTree(aContext, aParent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// If there is a disabled fieldset in the parent chain, the element is now
|
||||
|
@ -810,7 +811,7 @@ nsresult HTMLTextAreaElement::BindToTree(BindContext& aContext,
|
|||
}
|
||||
|
||||
void HTMLTextAreaElement::UnbindFromTree(bool aNullParent) {
|
||||
nsGenericHTMLFormElementWithState::UnbindFromTree(aNullParent);
|
||||
nsGenericHTMLFormControlElementWithState::UnbindFromTree(aNullParent);
|
||||
|
||||
// We might be no longer disabled because of parent chain changed.
|
||||
UpdateValueMissingValidityState();
|
||||
|
@ -828,8 +829,8 @@ nsresult HTMLTextAreaElement::BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
|||
mDisabledChanged = true;
|
||||
}
|
||||
|
||||
return nsGenericHTMLFormElementWithState::BeforeSetAttr(aNameSpaceID, aName,
|
||||
aValue, aNotify);
|
||||
return nsGenericHTMLFormControlElementWithState::BeforeSetAttr(
|
||||
aNameSpaceID, aName, aValue, aNotify);
|
||||
}
|
||||
|
||||
void HTMLTextAreaElement::CharacterDataChanged(nsIContent* aContent,
|
||||
|
@ -902,12 +903,12 @@ nsresult HTMLTextAreaElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
|||
}
|
||||
}
|
||||
|
||||
return nsGenericHTMLFormElementWithState::AfterSetAttr(
|
||||
return nsGenericHTMLFormControlElementWithState::AfterSetAttr(
|
||||
aNameSpaceID, aName, aValue, aOldValue, aSubjectPrincipal, aNotify);
|
||||
}
|
||||
|
||||
nsresult HTMLTextAreaElement::CopyInnerTo(Element* aDest) {
|
||||
nsresult rv = nsGenericHTMLFormElementWithState::CopyInnerTo(aDest);
|
||||
nsresult rv = nsGenericHTMLFormControlElementWithState::CopyInnerTo(aDest);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aDest->OwnerDoc()->IsStaticDocument()) {
|
||||
|
@ -1121,7 +1122,7 @@ void HTMLTextAreaElement::FieldSetDisabledChanged(bool aNotify) {
|
|||
// This *has* to be called before UpdateBarredFromConstraintValidation and
|
||||
// UpdateValueMissingValidityState because these two functions depend on our
|
||||
// disabled state.
|
||||
nsGenericHTMLFormElementWithState::FieldSetDisabledChanged(aNotify);
|
||||
nsGenericHTMLFormControlElementWithState::FieldSetDisabledChanged(aNotify);
|
||||
|
||||
UpdateValueMissingValidityState();
|
||||
UpdateBarredFromConstraintValidation();
|
||||
|
|
|
@ -181,8 +181,8 @@ class HTMLTextAreaElement final : public TextControlElement,
|
|||
void SetDisabled(bool aDisabled, ErrorResult& aError) {
|
||||
SetHTMLBoolAttr(nsGkAtoms::disabled, aDisabled, aError);
|
||||
}
|
||||
// nsGenericHTMLFormElementWithState::GetForm is fine
|
||||
using nsGenericHTMLFormElementWithState::GetForm;
|
||||
// nsGenericHTMLFormControlElementWithState::GetForm is fine
|
||||
using nsGenericHTMLFormControlElementWithState::GetForm;
|
||||
int32_t MaxLength() const { return GetIntAttr(nsGkAtoms::maxlength, -1); }
|
||||
int32_t UsedMaxLength() const final { return MaxLength(); }
|
||||
void SetMaxLength(int32_t aMaxLength, ErrorResult& aError) {
|
||||
|
@ -291,7 +291,7 @@ class HTMLTextAreaElement final : public TextControlElement,
|
|||
MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual ~HTMLTextAreaElement();
|
||||
|
||||
// get rid of the compiler warning
|
||||
using nsGenericHTMLFormElementWithState::IsSingleLineTextControl;
|
||||
using nsGenericHTMLFormControlElementWithState::IsSingleLineTextControl;
|
||||
|
||||
virtual JSObject* WrapNode(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
|
|
@ -26,16 +26,16 @@ class TextEditor;
|
|||
* This abstract class is used for the text control frame to get the editor and
|
||||
* selection controller objects, and some helper properties.
|
||||
*/
|
||||
class TextControlElement : public nsGenericHTMLFormElementWithState {
|
||||
class TextControlElement : public nsGenericHTMLFormControlElementWithState {
|
||||
public:
|
||||
TextControlElement(already_AddRefed<dom::NodeInfo>&& aNodeInfo,
|
||||
dom::FromParser aFromParser, FormControlType aType)
|
||||
: nsGenericHTMLFormElementWithState(std::move(aNodeInfo), aFromParser,
|
||||
aType){};
|
||||
: nsGenericHTMLFormControlElementWithState(std::move(aNodeInfo),
|
||||
aFromParser, aType){};
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TextControlElement,
|
||||
nsGenericHTMLFormElementWithState)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(
|
||||
TextControlElement, nsGenericHTMLFormControlElementWithState)
|
||||
|
||||
bool IsTextControlElement() const final { return true; }
|
||||
|
||||
|
|
|
@ -62,15 +62,15 @@ using ValueSetterOptions = TextControlState::ValueSetterOptions;
|
|||
NS_IMPL_CYCLE_COLLECTION_CLASS(TextControlElement)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(
|
||||
TextControlElement, nsGenericHTMLFormElementWithState)
|
||||
TextControlElement, nsGenericHTMLFormControlElementWithState)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(
|
||||
TextControlElement, nsGenericHTMLFormElementWithState)
|
||||
TextControlElement, nsGenericHTMLFormControlElementWithState)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(
|
||||
TextControlElement, nsGenericHTMLFormElementWithState)
|
||||
TextControlElement, nsGenericHTMLFormControlElementWithState)
|
||||
|
||||
/*static*/
|
||||
bool TextControlElement::GetWrapPropertyEnum(
|
||||
|
|
|
@ -2627,9 +2627,10 @@ nsGenericHTMLFormControlElement::~nsGenericHTMLFormControlElement() = default;
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsGenericHTMLFormElementWithState::nsGenericHTMLFormElementWithState(
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
FromParser aFromParser, FormControlType aType)
|
||||
nsGenericHTMLFormControlElementWithState::
|
||||
nsGenericHTMLFormControlElementWithState(
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
FromParser aFromParser, FormControlType aType)
|
||||
: nsGenericHTMLFormControlElement(std::move(aNodeInfo), aType),
|
||||
mControlNumber(!!(aFromParser & FROM_PARSER_NETWORK)
|
||||
? OwnerDoc()->GetNextControlNumber()
|
||||
|
@ -2637,7 +2638,7 @@ nsGenericHTMLFormElementWithState::nsGenericHTMLFormElementWithState(
|
|||
mStateKey.SetIsVoid(true);
|
||||
}
|
||||
|
||||
void nsGenericHTMLFormElementWithState::GenerateStateKey() {
|
||||
void nsGenericHTMLFormControlElementWithState::GenerateStateKey() {
|
||||
// Keep the key if already computed
|
||||
if (!mStateKey.IsVoid()) {
|
||||
return;
|
||||
|
@ -2660,7 +2661,7 @@ void nsGenericHTMLFormElementWithState::GenerateStateKey() {
|
|||
}
|
||||
}
|
||||
|
||||
PresState* nsGenericHTMLFormElementWithState::GetPrimaryPresState() {
|
||||
PresState* nsGenericHTMLFormControlElementWithState::GetPrimaryPresState() {
|
||||
if (mStateKey.IsEmpty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -2683,7 +2684,7 @@ PresState* nsGenericHTMLFormElementWithState::GetPrimaryPresState() {
|
|||
}
|
||||
|
||||
already_AddRefed<nsILayoutHistoryState>
|
||||
nsGenericHTMLFormElementWithState::GetLayoutHistory(bool aRead) {
|
||||
nsGenericHTMLFormControlElementWithState::GetLayoutHistory(bool aRead) {
|
||||
nsCOMPtr<Document> doc = GetUncomposedDoc();
|
||||
if (!doc) {
|
||||
return nullptr;
|
||||
|
@ -2704,7 +2705,7 @@ nsGenericHTMLFormElementWithState::GetLayoutHistory(bool aRead) {
|
|||
return history.forget();
|
||||
}
|
||||
|
||||
bool nsGenericHTMLFormElementWithState::RestoreFormControlState() {
|
||||
bool nsGenericHTMLFormControlElementWithState::RestoreFormControlState() {
|
||||
MOZ_ASSERT(!mStateKey.IsVoid(),
|
||||
"GenerateStateKey must already have been called");
|
||||
|
||||
|
@ -2728,7 +2729,8 @@ bool nsGenericHTMLFormElementWithState::RestoreFormControlState() {
|
|||
return false;
|
||||
}
|
||||
|
||||
void nsGenericHTMLFormElementWithState::NodeInfoChanged(Document* aOldDoc) {
|
||||
void nsGenericHTMLFormControlElementWithState::NodeInfoChanged(
|
||||
Document* aOldDoc) {
|
||||
nsGenericHTMLFormControlElement::NodeInfoChanged(aOldDoc);
|
||||
|
||||
// We need to regenerate the state key now we're in a new document. Clearing
|
||||
|
@ -2739,7 +2741,7 @@ void nsGenericHTMLFormElementWithState::NodeInfoChanged(Document* aOldDoc) {
|
|||
mStateKey.SetIsVoid(true);
|
||||
}
|
||||
|
||||
void nsGenericHTMLFormElementWithState::GetFormAction(nsString& aValue) {
|
||||
void nsGenericHTMLFormControlElementWithState::GetFormAction(nsString& aValue) {
|
||||
auto type = ControlType();
|
||||
if (!IsInputElement(type) && !IsButtonElement(type)) {
|
||||
return;
|
||||
|
|
|
@ -1129,10 +1129,10 @@ class nsGenericHTMLFormControlElement : public nsGenericHTMLFormElement {
|
|||
virtual ~nsGenericHTMLFormControlElement();
|
||||
};
|
||||
|
||||
class nsGenericHTMLFormElementWithState
|
||||
class nsGenericHTMLFormControlElementWithState
|
||||
: public nsGenericHTMLFormControlElement {
|
||||
public:
|
||||
nsGenericHTMLFormElementWithState(
|
||||
nsGenericHTMLFormControlElementWithState(
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser, FormControlType);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче