From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/html/HTMLSelectElement.h | 141 +++++++++++++++----------------- 1 file changed, 64 insertions(+), 77 deletions(-) (limited to 'Source/WebCore/html/HTMLSelectElement.h') diff --git a/Source/WebCore/html/HTMLSelectElement.h b/Source/WebCore/html/HTMLSelectElement.h index d39610274..7d5dcefe5 100644 --- a/Source/WebCore/html/HTMLSelectElement.h +++ b/Source/WebCore/html/HTMLSelectElement.h @@ -23,51 +23,47 @@ * */ -#ifndef HTMLSelectElement_h -#define HTMLSelectElement_h +#pragma once -#include "Event.h" #include "HTMLFormControlElementWithState.h" #include "TypeAhead.h" -#include namespace WebCore { -class HTMLOptionElement; class HTMLOptionsCollection; -class HTMLSelectElement : public HTMLFormControlElementWithState, public TypeAheadDataSource { +class HTMLSelectElement : public HTMLFormControlElementWithState, private TypeAheadDataSource { public: - static PassRefPtr create(const QualifiedName&, Document&, HTMLFormElement*); + static Ref create(const QualifiedName&, Document&, HTMLFormElement*); - int selectedIndex() const; - void setSelectedIndex(int); + WEBCORE_EXPORT int selectedIndex() const; + WEBCORE_EXPORT void setSelectedIndex(int); - void optionSelectedByUser(int index, bool dispatchChangeEvent, bool allowMultipleSelection = false); + WEBCORE_EXPORT void optionSelectedByUser(int index, bool dispatchChangeEvent, bool allowMultipleSelection = false); - // For ValidityState - virtual String validationMessage() const override; - virtual bool valueMissing() const override; + String validationMessage() const final; + bool valueMissing() const final; - unsigned length() const; + WEBCORE_EXPORT unsigned length() const; - int size() const { return m_size; } + unsigned size() const { return m_size; } bool multiple() const { return m_multiple; } bool usesMenuList() const; - void add(HTMLElement*, HTMLElement* beforeElement, ExceptionCode&); + using OptionOrOptGroupElement = Variant, RefPtr>; + using HTMLElementOrInt = Variant, int>; + WEBCORE_EXPORT ExceptionOr add(const OptionOrOptGroupElement&, const std::optional& before); using Node::remove; - // Should be remove(int) but it conflicts with Node::remove(ExceptionCode&). - void removeByIndex(int); - void remove(HTMLOptionElement*); + ExceptionOr remove(HTMLOptionElement&); + WEBCORE_EXPORT void remove(int); - String value() const; - void setValue(const String&); + WEBCORE_EXPORT String value() const; + WEBCORE_EXPORT void setValue(const String&); - PassRefPtr options(); - PassRefPtr selectedOptions(); + WEBCORE_EXPORT Ref options(); + Ref selectedOptions(); void optionElementChildrenChanged(); @@ -75,29 +71,26 @@ public: void invalidateSelectedItems(); void updateListItemSelectedStates(); - const Vector& listItems() const; + WEBCORE_EXPORT const Vector& listItems() const; - virtual void accessKeyAction(bool sendMouseEvents) override; + void accessKeyAction(bool sendMouseEvents) final; void accessKeySetSelectedIndex(int); - void setMultiple(bool); + WEBCORE_EXPORT void setMultiple(bool); - void setSize(int); + WEBCORE_EXPORT void setSize(unsigned); - void setOption(unsigned index, HTMLOptionElement*, ExceptionCode&); - void setLength(unsigned, ExceptionCode&); + // Called by the bindings for the unnamed index-setter. + ExceptionOr setItem(unsigned index, HTMLOptionElement*); + ExceptionOr setLength(unsigned); - Node* namedItem(const AtomicString& name); - Node* item(unsigned index); + WEBCORE_EXPORT HTMLOptionElement* namedItem(const AtomicString& name); + WEBCORE_EXPORT HTMLOptionElement* item(unsigned index); void scrollToSelection(); void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true); -#if PLATFORM(IOS) - virtual bool willRespondToMouseClickEvents() override; -#endif - bool canSelectAll() const; void selectAll(); int listToOptionIndex(int listIndex) const; @@ -108,56 +101,57 @@ public: void setActiveSelectionAnchorIndex(int); void setActiveSelectionEndIndex(int); void updateListBoxSelection(bool deselectOtherOptions); - + // For use in the implementation of HTMLOptionElement. - void optionSelectionStateChanged(HTMLOptionElement*, bool optionIsSelected); + void optionSelectionStateChanged(HTMLOptionElement&, bool optionIsSelected); bool allowsNonContiguousSelection() const { return m_allowsNonContiguousSelection; }; protected: HTMLSelectElement(const QualifiedName&, Document&, HTMLFormElement*); private: - virtual const AtomicString& formControlType() const override; + const AtomicString& formControlType() const final; - virtual bool isKeyboardFocusable(KeyboardEvent*) const override; - virtual bool isMouseFocusable() const override; + bool isKeyboardFocusable(KeyboardEvent&) const final; + bool isMouseFocusable() const final; - virtual void dispatchFocusEvent(PassRefPtr oldFocusedElement, FocusDirection) override final; - virtual void dispatchBlurEvent(PassRefPtr newFocusedElement) override final; + void dispatchFocusEvent(RefPtr&& oldFocusedElement, FocusDirection) final; + void dispatchBlurEvent(RefPtr&& newFocusedElement) final; - virtual bool canStartSelection() const override { return false; } + bool canStartSelection() const final { return false; } - virtual bool isEnumeratable() const override { return true; } - virtual bool supportLabels() const override { return true; } + bool isEnumeratable() const final { return true; } + bool supportLabels() const final { return true; } - virtual FormControlState saveFormControlState() const override; - virtual void restoreFormControlState(const FormControlState&) override; + FormControlState saveFormControlState() const final; + void restoreFormControlState(const FormControlState&) final; - virtual void parseAttribute(const QualifiedName&, const AtomicString&) override; - virtual bool isPresentationAttribute(const QualifiedName&) const override; + void parseAttribute(const QualifiedName&, const AtomicString&) final; + bool isPresentationAttribute(const QualifiedName&) const final; - virtual bool childShouldCreateRenderer(const Node&) const override; - virtual RenderPtr createElementRenderer(PassRef) override; - virtual bool appendFormData(FormDataList&, bool) override; + bool childShouldCreateRenderer(const Node&) const final; + RenderPtr createElementRenderer(RenderStyle&&, const RenderTreePosition&) final; + bool appendFormData(FormDataList&, bool) final; - virtual void reset() override; + void reset() final; - virtual void defaultEventHandler(Event*) override; + void defaultEventHandler(Event&) final; + bool willRespondToMouseClickEvents() final; void dispatchChangeEventForMenuList(); - virtual void didRecalcStyle(Style::Change) override final; + void didRecalcStyle(Style::Change) final; void recalcListItems(bool updateSelectedStates = true) const; - void deselectItems(HTMLOptionElement* excludeElement = 0); - void typeAheadFind(KeyboardEvent*); + void deselectItems(HTMLOptionElement* excludeElement = nullptr); + void typeAheadFind(KeyboardEvent&); void saveLastSelection(); - virtual InsertionNotificationRequest insertedInto(ContainerNode&) override; + InsertionNotificationRequest insertedInto(ContainerNode&) final; - virtual bool isOptionalFormControl() const override { return !isRequiredFormControl(); } - virtual bool isRequiredFormControl() const override; + bool isOptionalFormControl() const final { return !isRequiredFormControl(); } + bool isRequiredFormControl() const final; bool hasPlaceholderLabelOption() const; @@ -168,20 +162,17 @@ private: }; typedef unsigned SelectOptionFlags; void selectOption(int optionIndex, SelectOptionFlags = 0); - void deselectItemsWithoutValidation(HTMLElement* elementToExclude = 0); + void deselectItemsWithoutValidation(HTMLElement* elementToExclude = nullptr); void parseMultipleAttribute(const AtomicString&); int lastSelectedListIndex() const; void updateSelectedState(int listIndex, bool multi, bool shift); - void menuListDefaultEventHandler(Event*); + void menuListDefaultEventHandler(Event&); bool platformHandleKeydownEvent(KeyboardEvent*); - void listBoxDefaultEventHandler(Event*); + void listBoxDefaultEventHandler(Event&); void setOptionsChangedOnRenderer(); size_t searchOptionsForValue(const String&, size_t listIndexStart, size_t listIndexEnd) const; - enum SkipDirection { - SkipBackwards = -1, - SkipForwards = 1 - }; + enum SkipDirection { SkipBackwards = -1, SkipForwards = 1 }; int nextValidIndex(int listIndex, SkipDirection, int skip) const; int nextSelectableListIndex(int startIndex) const; int previousSelectableListIndex(int startIndex) const; @@ -189,20 +180,20 @@ private: int lastSelectableListIndex() const; int nextSelectableListIndexPageAway(int startIndex, SkipDirection) const; - virtual void childrenChanged(const ChildChange&) override; - virtual bool areAuthorShadowsAllowed() const override { return false; } + void childrenChanged(const ChildChange&) final; // TypeAheadDataSource functions. - virtual int indexOfSelectedOption() const override; - virtual int optionCount() const override; - virtual String optionAtIndex(int index) const override; + int indexOfSelectedOption() const final; + int optionCount() const final; + String optionAtIndex(int index) const final; + // m_listItems contains HTMLOptionElement, HTMLOptGroupElement, and HTMLHRElement objects. mutable Vector m_listItems; Vector m_lastOnChangeSelection; Vector m_cachedStateForActiveSelection; TypeAhead m_typeAhead; - int m_size; + unsigned m_size; int m_lastOnChangeIndex; int m_activeSelectionAnchorIndex; int m_activeSelectionEndIndex; @@ -213,8 +204,4 @@ private: mutable bool m_shouldRecalcListItems; }; -NODE_TYPE_CASTS(HTMLSelectElement) - } // namespace - -#endif -- cgit v1.2.1