gecko-dev/dom/html/HTMLSelectElement.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

552 строки
20 KiB
C
Исходник Обычный вид История

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
2012-05-21 15:12:37 +04:00
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_HTMLSelectElement_h
#define mozilla_dom_HTMLSelectElement_h
2007-08-28 11:09:32 +04:00
#include "mozilla/Attributes.h"
2007-08-28 11:09:32 +04:00
#include "nsGenericHTMLElement.h"
#include "nsIConstraintValidation.h"
2007-08-28 11:09:32 +04:00
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/UnionTypes.h"
#include "mozilla/dom/HTMLOptionsCollection.h"
#include "mozilla/ErrorResult.h"
2007-08-28 11:09:32 +04:00
#include "nsCheapSets.h"
#include "nsCOMPtr.h"
#include "nsError.h"
#include "mozilla/dom/HTMLFormElement.h"
#include "nsContentUtils.h"
2007-08-28 11:09:32 +04:00
class nsContentList;
class nsIDOMHTMLOptionElement;
class nsIHTMLCollection;
class nsISelectControlFrame;
2007-08-28 11:09:32 +04:00
namespace mozilla {
class EventChainPostVisitor;
class EventChainPreVisitor;
class SelectContentData;
class PresState;
namespace dom {
class HTMLFormSubmission;
class HTMLSelectElement;
class MOZ_STACK_CLASS SafeOptionListMutation {
2007-08-28 11:09:32 +04:00
public:
/**
* @param aSelect The select element which option list is being mutated.
* Can be null.
* @param aParent The content object which is being mutated.
* @param aKid If not null, a new child element is being inserted to
* aParent. Otherwise a child element will be removed.
* @param aIndex The index of the content object in the parent.
*/
SafeOptionListMutation(nsIContent* aSelect, nsIContent* aParent,
nsIContent* aKid, uint32_t aIndex, bool aNotify);
~SafeOptionListMutation();
void MutationFailed() { mNeedsRebuild = true; }
2007-08-28 11:09:32 +04:00
private:
static void* operator new(size_t) CPP_THROW_NEW { return 0; }
static void operator delete(void*, size_t) {}
/** The select element which option list is being mutated. */
Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat The bulk of this commit was generated with a script, executed at the top level of a typical source code checkout. The only non-machine-generated part was modifying MFBT's moz.build to reflect the new naming. CLOSED TREE makes big refactorings like this a piece of cake. # The main substitution. find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \ xargs perl -p -i -e ' s/nsRefPtr\.h/RefPtr\.h/g; # handle includes s/nsRefPtr ?</RefPtr</g; # handle declarations and variables ' # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h. perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h # Handle nsRefPtr.h itself, a couple places that define constructors # from nsRefPtr, and code generators specially. We do this here, rather # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename # things like nsRefPtrHashtable. perl -p -i -e 's/nsRefPtr/RefPtr/g' \ mfbt/nsRefPtr.h \ xpcom/glue/nsCOMPtr.h \ xpcom/base/OwningNonNull.h \ ipc/ipdl/ipdl/lower.py \ ipc/ipdl/ipdl/builtin.py \ dom/bindings/Codegen.py \ python/lldbutils/lldbutils/utils.py # In our indiscriminate substitution above, we renamed # nsRefPtrGetterAddRefs, the class behind getter_AddRefs. Fix that up. find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \ xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g' if [ -d .git ]; then git mv mfbt/nsRefPtr.h mfbt/RefPtr.h else hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h fi --HG-- rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 08:24:48 +03:00
RefPtr<HTMLSelectElement> mSelect;
/** true if the current mutation is the first one in the stack. */
bool mTopLevelMutation;
/** true if it is known that the option list must be recreated. */
bool mNeedsRebuild;
/** Whether we should be notifying when we make various method calls on
mSelect */
const bool mNotify;
/** The selected index at mutation start. */
int32_t mInitialSelectedIndex;
2007-08-28 11:09:32 +04:00
/** Option list must be recreated if more than one mutation is detected. */
nsMutationGuard mGuard;
};
/**
* Implementation of &lt;select&gt;
*/
class HTMLSelectElement final : public nsGenericHTMLFormElementWithState,
public nsIConstraintValidation {
2007-08-28 11:09:32 +04:00
public:
/**
* IS_SELECTED whether to set the option(s) to true or false
*
* CLEAR_ALL whether to clear all other options (for example, if you
* are normal-clicking on the current option)
*
* SET_DISABLED whether it is permissible to set disabled options
* (for JavaScript)
*
* NOTIFY whether to notify frames and such
*
* NO_RESELECT no need to select something after an option is deselected
* (for reset)
*/
enum OptionType {
IS_SELECTED = 1 << 0,
CLEAR_ALL = 1 << 1,
SET_DISABLED = 1 << 2,
NOTIFY = 1 << 3,
NO_RESELECT = 1 << 4
};
using nsIConstraintValidation::GetValidationMessage;
explicit HTMLSelectElement(
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
FromParser aFromParser = NOT_FROM_PARSER);
2007-08-28 11:09:32 +04:00
NS_IMPL_FROMNODE_HTML_WITH_TAG(HTMLSelectElement, select)
2007-08-28 11:09:32 +04:00
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
virtual int32_t TabIndexDefault() override;
2007-08-28 11:09:32 +04:00
// Element
virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override {
return true;
}
// WebIdl HTMLSelectElement
bool Autofocus() const { return GetBoolAttr(nsGkAtoms::autofocus); }
void SetAutofocus(bool aVal, ErrorResult& aRv) {
SetHTMLBoolAttr(nsGkAtoms::autofocus, aVal, aRv);
}
void GetAutocomplete(DOMString& aValue);
void SetAutocomplete(const nsAString& aValue, ErrorResult& aRv) {
SetHTMLAttr(nsGkAtoms::autocomplete, aValue, aRv);
}
void GetAutocompleteInfo(AutocompleteInfo& aInfo);
bool Disabled() const { return GetBoolAttr(nsGkAtoms::disabled); }
void SetDisabled(bool aVal, ErrorResult& aRv) {
SetHTMLBoolAttr(nsGkAtoms::disabled, aVal, aRv);
}
HTMLFormElement* GetForm() const {
return nsGenericHTMLFormElementWithState::GetForm();
}
bool Multiple() const { return GetBoolAttr(nsGkAtoms::multiple); }
void SetMultiple(bool aVal, ErrorResult& aRv) {
SetHTMLBoolAttr(nsGkAtoms::multiple, aVal, aRv);
}
void GetName(DOMString& aValue) { GetHTMLAttr(nsGkAtoms::name, aValue); }
void SetName(const nsAString& aName, ErrorResult& aRv) {
SetHTMLAttr(nsGkAtoms::name, aName, aRv);
}
bool Required() const { return State().HasState(NS_EVENT_STATE_REQUIRED); }
void SetRequired(bool aVal, ErrorResult& aRv) {
SetHTMLBoolAttr(nsGkAtoms::required, aVal, aRv);
}
uint32_t Size() const { return GetUnsignedIntAttr(nsGkAtoms::size, 0); }
void SetSize(uint32_t aSize, ErrorResult& aRv) {
SetUnsignedIntAttr(nsGkAtoms::size, aSize, 0, aRv);
}
void GetType(nsAString& aValue);
HTMLOptionsCollection* Options() const { return mOptions; }
uint32_t Length() const { return mOptions->Length(); }
void SetLength(uint32_t aLength, ErrorResult& aRv);
Element* IndexedGetter(uint32_t aIdx, bool& aFound) const {
return mOptions->IndexedGetter(aIdx, aFound);
}
HTMLOptionElement* Item(uint32_t aIdx) const {
return mOptions->ItemAsOption(aIdx);
}
HTMLOptionElement* NamedItem(const nsAString& aName) const {
return mOptions->GetNamedItem(aName);
}
void Add(const HTMLOptionElementOrHTMLOptGroupElement& aElement,
const Nullable<HTMLElementOrLong>& aBefore, ErrorResult& aRv);
void Remove(int32_t aIndex);
void IndexedSetter(uint32_t aIndex, HTMLOptionElement* aOption,
ErrorResult& aRv) {
mOptions->IndexedSetter(aIndex, aOption, aRv);
}
static bool MatchSelectedOptions(Element* aElement, int32_t, nsAtom*, void*);
nsIHTMLCollection* SelectedOptions();
int32_t SelectedIndex() const { return mSelectedIndex; }
void SetSelectedIndex(int32_t aIdx) { SetSelectedIndexInternal(aIdx, true); }
void GetValue(DOMString& aValue);
void SetValue(const nsAString& aValue);
// Override SetCustomValidity so we update our state properly when it's called
// via bindings.
void SetCustomValidity(const nsAString& aError);
using nsINode::Remove;
// nsINode
virtual JSObject* WrapNode(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
2007-08-28 11:09:32 +04:00
// nsIContent
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override;
MOZ_CAN_RUN_SCRIPT
nsresult PostHandleEvent(EventChainPostVisitor& aVisitor) override;
2007-08-28 11:09:32 +04:00
virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
int32_t* aTabIndex) override;
virtual nsresult InsertChildBefore(nsIContent* aKid, nsIContent* aBeforeThis,
bool aNotify) override;
virtual void RemoveChildNode(nsIContent* aKid, bool aNotify) override;
2007-08-28 11:09:32 +04:00
// Overriden nsIFormControl methods
NS_IMETHOD Reset() override;
NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
NS_IMETHOD SaveState() override;
virtual bool RestoreState(PresState* aState) override;
virtual bool IsDisabledForEvents(WidgetEvent* aEvent) override;
2007-08-28 11:09:32 +04:00
virtual void FieldSetDisabledChanged(bool aNotify) override;
EventStates IntrinsicState() const override;
/**
* To be called when stuff is added under a child of the select--but *before*
* they are actually added.
*
* @param aOptions the content that was added (usually just an option, but
* could be an optgroup node with many child options)
* @param aParent the parent the options were added to (could be an optgroup)
* @param aContentIndex the index where the options are being added within the
* parent (if the parent is an optgroup, the index within the optgroup)
*/
NS_IMETHOD WillAddOptions(nsIContent* aOptions, nsIContent* aParent,
int32_t aContentIndex, bool aNotify);
/**
* To be called when stuff is removed under a child of the select--but
* *before* they are actually removed.
*
* @param aParent the parent the option(s) are being removed from
* @param aContentIndex the index of the option(s) within the parent (if the
* parent is an optgroup, the index within the optgroup)
*/
NS_IMETHOD WillRemoveOptions(nsIContent* aParent, int32_t aContentIndex,
bool aNotify);
/**
* Checks whether an option is disabled (even if it's part of an optgroup)
*
* @param aIndex the index of the option to check
* @return whether the option is disabled
*/
NS_IMETHOD IsOptionDisabled(int32_t aIndex, bool* aIsDisabled);
bool IsOptionDisabled(HTMLOptionElement* aOption) const;
/**
* Sets multiple options (or just sets startIndex if select is single)
* and handles notifications and cleanup and everything under the sun.
* When this method exits, the select will be in a consistent state. i.e.
* if you set the last option to false, it will select an option anyway.
*
* @param aStartIndex the first index to set
* @param aEndIndex the last index to set (set same as first index for one
* option)
* @param aOptionsMask determines whether to set, clear all or disable
* options and whether frames are to be notified of such.
* @return whether any options were actually changed
*/
bool SetOptionsSelectedByIndex(int32_t aStartIndex, int32_t aEndIndex,
uint32_t aOptionsMask);
2007-08-28 11:09:32 +04:00
/**
* Called when an attribute is about to be changed
*/
Bug 1555216 - Change the signature of BindToTree to be (BindContext&, nsINode& aParentNode). r=bzbarsky BindContext was going to have way more information at first, but then I realized that most of the things I wanted to know were basically a flag away using the parent node. Still I think it's worth it, now experimenting with BindToTree will only mean adding a field to a struct that's included from a couple cpp files, instead of a massive pain. I also think this is clearer, and doing this highlights quite a few inconsistencies in our code which I've left untouched, but commented with FIXMEs. Steps are: $ for file in $(rg 'nsresult BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#nsresult BindToTree(Document\* aDocument, nsIContent\* aParent,#nsresult BindToTree(BindContext\&, nsINode\& aParent)#g' $file; done $ for file in $(rg 'nsresult BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's# nsIContent\* aBindingParent) override#override#g' $file; done $ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#::BindToTree(Document\* aDocument, nsIContent\* aParent,#::BindToTree(BindContext\& aContext, nsINode\& aParent)#g' $file; done $ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#nsIContent\* aBindingParent)##g' $file; done $ for file in $(rg '::BindToTree\(' | cut -d : -f 1 | sort | uniq); do sed -i 's#::BindToTree(aDocument, aParent, aBindingParent)#::BindToTree(aContext, aParent)#g' $file; done $ ./mach clang-format Then manual fixups. Depends on D32948 Differential Revision: https://phabricator.services.mozilla.com/D32949
2019-05-29 07:27:04 +03:00
virtual nsresult BindToTree(BindContext&, nsINode& aParent) override;
virtual void UnbindFromTree(bool aNullParent) override;
virtual nsresult BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
const nsAttrValueOrString* aValue,
bool aNotify) override;
virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
const nsAttrValue* aValue,
const nsAttrValue* aOldValue,
nsIPrincipal* aSubjectPrincipal,
bool aNotify) override;
virtual void DoneAddingChildren(bool aHaveNotified) override;
virtual bool IsDoneAddingChildren() override { return mIsDoneAddingChildren; }
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
2007-08-28 11:09:32 +04:00
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction()
const override;
virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
int32_t aModType) const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
2007-08-28 11:09:32 +04:00
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
2007-08-28 11:09:32 +04:00
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLSelectElement,
nsGenericHTMLFormElementWithState)
2007-08-28 11:09:32 +04:00
HTMLOptionsCollection* GetOptions() { return mOptions; }
// nsIConstraintValidation
nsresult GetValidationMessage(nsAString& aValidationMessage,
ValidityStateType aType) override;
void UpdateValueMissingValidityState();
/**
* Insert aElement before the node given by aBefore
*/
void Add(nsGenericHTMLElement& aElement, nsGenericHTMLElement* aBefore,
ErrorResult& aError);
void Add(nsGenericHTMLElement& aElement, int32_t aIndex,
ErrorResult& aError) {
// If item index is out of range, insert to last.
// (since beforeElement becomes null, it is inserted to last)
nsIContent* beforeContent = mOptions->GetElementAt(aIndex);
return Add(aElement, nsGenericHTMLElement::FromNodeOrNull(beforeContent),
aError);
}
/**
* Is this a combobox?
*/
bool IsCombobox() const { return !Multiple() && Size() <= 1; }
bool OpenInParentProcess();
void SetOpenInParentProcess(bool aVal);
void GetPreviewValue(nsAString& aValue) { aValue = mPreviewValue; }
void SetPreviewValue(const nsAString& aValue);
2007-08-28 11:09:32 +04:00
protected:
virtual ~HTMLSelectElement() = default;
friend class SafeOptionListMutation;
2007-08-28 11:09:32 +04:00
// Helper Methods
/**
* Check whether the option specified by the index is selected
* @param aIndex the index
* @return whether the option at the index is selected
*/
bool IsOptionSelectedByIndex(int32_t aIndex);
2007-08-28 11:09:32 +04:00
/**
* Starting with (and including) aStartIndex, find the first selected index
* and set mSelectedIndex to it.
* @param aStartIndex the index to start with
*/
void FindSelectedIndex(int32_t aStartIndex, bool aNotify);
2007-08-28 11:09:32 +04:00
/**
* Select some option if possible (generally the first non-disabled option).
* @return true if something was selected, false otherwise
*/
bool SelectSomething(bool aNotify);
2007-08-28 11:09:32 +04:00
/**
* Call SelectSomething(), but only if nothing is selected
* @see SelectSomething()
* @return true if something was selected, false otherwise
*/
bool CheckSelectSomething(bool aNotify);
2007-08-28 11:09:32 +04:00
/**
* Called to trigger notifications of frames and fixing selected index
*
* @param aSelectFrame the frame for this content (could be null)
* @param aIndex the index that was selected or deselected
* @param aSelected whether the index was selected or deselected
2007-12-04 20:14:20 +03:00
* @param aChangeOptionState if false, don't do anything to the
* HTMLOptionElement at aIndex. If true, change
2007-12-04 20:14:20 +03:00
* its selected state to aSelected.
2007-08-28 11:09:32 +04:00
* @param aNotify whether to notify the style system and such
*/
void OnOptionSelected(nsISelectControlFrame* aSelectFrame, int32_t aIndex,
bool aSelected, bool aChangeOptionState, bool aNotify);
2007-08-28 11:09:32 +04:00
/**
* Restore state to a particular state string (representing the options)
* @param aNewSelected the state string to restore to
*/
void RestoreStateTo(const SelectContentData& aNewSelected);
2007-08-28 11:09:32 +04:00
// Adding options
/**
* Insert option(s) into the options[] array and perform notifications
* @param aOptions the option or optgroup being added
* @param aListIndex the index to start adding options into the list at
* @param aDepth the depth of aOptions (1=direct child of select ...)
*/
void InsertOptionsIntoList(nsIContent* aOptions, int32_t aListIndex,
int32_t aDepth, bool aNotify);
2007-08-28 11:09:32 +04:00
/**
* Remove option(s) from the options[] array
* @param aOptions the option or optgroup being added
* @param aListIndex the index to start removing options from the list at
* @param aDepth the depth of aOptions (1=direct child of select ...)
*/
nsresult RemoveOptionsFromList(nsIContent* aOptions, int32_t aListIndex,
int32_t aDepth, bool aNotify);
// nsIConstraintValidation
void UpdateBarredFromConstraintValidation();
bool IsValueMissing() const;
2007-08-28 11:09:32 +04:00
/**
* Get the index of the first option at, under or following the content in
* the select, or length of options[] if none are found
* @param aOptions the content
* @return the index of the first option
*/
int32_t GetOptionIndexAt(nsIContent* aOptions);
2007-08-28 11:09:32 +04:00
/**
* Get the next option following the content in question (not at or under)
* (this could include siblings of the current content or siblings of the
* parent or children of siblings of the parent).
* @param aOptions the content
* @return the index of the next option after the content
*/
int32_t GetOptionIndexAfter(nsIContent* aOptions);
2007-08-28 11:09:32 +04:00
/**
* Get the first option index at or under the content in question.
* @param aOptions the content
* @return the index of the first option at or under the content
*/
int32_t GetFirstOptionIndex(nsIContent* aOptions);
2007-08-28 11:09:32 +04:00
/**
* Get the first option index under the content in question, within the
* range specified.
* @param aOptions the content
* @param aStartIndex the first child to look at
* @param aEndIndex the child *after* the last child to look at
* @return the index of the first option at or under the content
*/
int32_t GetFirstChildOptionIndex(nsIContent* aOptions, int32_t aStartIndex,
int32_t aEndIndex);
2007-08-28 11:09:32 +04:00
/**
* Get the frame as an nsISelectControlFrame (MAY RETURN nullptr)
2007-08-28 11:09:32 +04:00
* @return the select frame, or null
*/
nsISelectControlFrame* GetSelectFrame();
2007-08-28 11:09:32 +04:00
/**
* Helper method for dispatching ContentReset notifications to list
* and combo box frames.
*/
void DispatchContentReset();
/**
* Rebuilds the options array from scratch as a fallback in error cases.
*/
void RebuildOptionsArray(bool aNotify);
2007-08-28 11:09:32 +04:00
#ifdef DEBUG
void VerifyOptionsArray();
#endif
void SetSelectedIndexInternal(int32_t aIndex, bool aNotify);
void SetSelectionChanged(bool aValue, bool aNotify);
/**
* Marks the selectedOptions list as dirty, so that it'll populate itself
* again.
*/
void UpdateSelectedOptions();
/**
* Return whether an element should have a validity UI.
* (with :-moz-ui-invalid and :-moz-ui-valid pseudo-classes).
*
* @return Whether the element should have a validity UI.
*/
bool ShouldShowValidityUI() const {
/**
* Always show the validity UI if the form has already tried to be submitted
* but was invalid.
*
* Otherwise, show the validity UI if the selection has been changed.
*/
if (mForm && mForm->HasEverTriedInvalidSubmit()) {
return true;
}
return mSelectionHasChanged;
}
2007-08-28 11:09:32 +04:00
/** The options[] array */
Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat The bulk of this commit was generated with a script, executed at the top level of a typical source code checkout. The only non-machine-generated part was modifying MFBT's moz.build to reflect the new naming. CLOSED TREE makes big refactorings like this a piece of cake. # The main substitution. find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \ xargs perl -p -i -e ' s/nsRefPtr\.h/RefPtr\.h/g; # handle includes s/nsRefPtr ?</RefPtr</g; # handle declarations and variables ' # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h. perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h # Handle nsRefPtr.h itself, a couple places that define constructors # from nsRefPtr, and code generators specially. We do this here, rather # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename # things like nsRefPtrHashtable. perl -p -i -e 's/nsRefPtr/RefPtr/g' \ mfbt/nsRefPtr.h \ xpcom/glue/nsCOMPtr.h \ xpcom/base/OwningNonNull.h \ ipc/ipdl/ipdl/lower.py \ ipc/ipdl/ipdl/builtin.py \ dom/bindings/Codegen.py \ python/lldbutils/lldbutils/utils.py # In our indiscriminate substitution above, we renamed # nsRefPtrGetterAddRefs, the class behind getter_AddRefs. Fix that up. find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \ xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g' if [ -d .git ]; then git mv mfbt/nsRefPtr.h mfbt/RefPtr.h else hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h fi --HG-- rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 08:24:48 +03:00
RefPtr<HTMLOptionsCollection> mOptions;
nsContentUtils::AutocompleteAttrState mAutocompleteAttrState;
nsContentUtils::AutocompleteAttrState mAutocompleteInfoState;
2007-08-28 11:09:32 +04:00
/** false if the parser is in the middle of adding children. */
bool mIsDoneAddingChildren;
2007-08-28 11:09:32 +04:00
/** true if our disabled state has changed from the default **/
bool mDisabledChanged;
2007-08-28 11:09:32 +04:00
/** true if child nodes are being added or removed.
* Used by SafeOptionListMutation.
2007-08-28 11:09:32 +04:00
*/
bool mMutating;
/**
* True if DoneAddingChildren will get called but shouldn't restore state.
*/
bool mInhibitStateRestoration;
/**
* True if the selection has changed since the element's creation.
*/
bool mSelectionHasChanged;
/**
* True if the default selected option has been set.
*/
bool mDefaultSelectionSet;
/**
* True if :-moz-ui-invalid can be shown.
*/
bool mCanShowInvalidUI;
/**
* True if :-moz-ui-valid can be shown.
*/
bool mCanShowValidUI;
2007-08-28 11:09:32 +04:00
/** The number of non-options as children of the select */
uint32_t mNonOptionChildren;
2007-08-28 11:09:32 +04:00
/** The number of optgroups anywhere under the select */
uint32_t mOptGroupCount;
2007-08-28 11:09:32 +04:00
/**
* The current selected index for selectedIndex (will be the first selected
* index if multiple are selected)
*/
int32_t mSelectedIndex;
2007-08-28 11:09:32 +04:00
/**
* The temporary restore state in case we try to restore before parser is
* done adding options
*/
UniquePtr<SelectContentData> mRestoreState;
/**
* The live list of selected options.
*/
Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat The bulk of this commit was generated with a script, executed at the top level of a typical source code checkout. The only non-machine-generated part was modifying MFBT's moz.build to reflect the new naming. CLOSED TREE makes big refactorings like this a piece of cake. # The main substitution. find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \ xargs perl -p -i -e ' s/nsRefPtr\.h/RefPtr\.h/g; # handle includes s/nsRefPtr ?</RefPtr</g; # handle declarations and variables ' # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h. perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h # Handle nsRefPtr.h itself, a couple places that define constructors # from nsRefPtr, and code generators specially. We do this here, rather # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename # things like nsRefPtrHashtable. perl -p -i -e 's/nsRefPtr/RefPtr/g' \ mfbt/nsRefPtr.h \ xpcom/glue/nsCOMPtr.h \ xpcom/base/OwningNonNull.h \ ipc/ipdl/ipdl/lower.py \ ipc/ipdl/ipdl/builtin.py \ dom/bindings/Codegen.py \ python/lldbutils/lldbutils/utils.py # In our indiscriminate substitution above, we renamed # nsRefPtrGetterAddRefs, the class behind getter_AddRefs. Fix that up. find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \ xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g' if [ -d .git ]; then git mv mfbt/nsRefPtr.h mfbt/RefPtr.h else hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h fi --HG-- rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 08:24:48 +03:00
RefPtr<nsContentList> mSelectedOptions;
/**
* The current displayed preview text.
*/
nsString mPreviewValue;
private:
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
MappedDeclarations&);
2007-08-28 11:09:32 +04:00
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_HTMLSelectElement_h