diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/WebCore/html/HTMLTextFormControlElement.h | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/WebCore/html/HTMLTextFormControlElement.h')
-rw-r--r-- | Source/WebCore/html/HTMLTextFormControlElement.h | 63 |
1 files changed, 26 insertions, 37 deletions
diff --git a/Source/WebCore/html/HTMLTextFormControlElement.h b/Source/WebCore/html/HTMLTextFormControlElement.h index 7245bd286..976670ad5 100644 --- a/Source/WebCore/html/HTMLTextFormControlElement.h +++ b/Source/WebCore/html/HTMLTextFormControlElement.h @@ -2,7 +2,7 @@ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2000 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2014 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. * * This library is free software; you can redistribute it and/or @@ -34,7 +34,6 @@ class RenderTextControl; class TextControlInnerTextElement; class VisiblePosition; -enum class AutoFillButtonType : uint8_t { None, Credentials, Contacts }; enum TextFieldSelectionDirection { SelectionHasNoDirection, SelectionHasForwardDirection, SelectionHasBackwardDirection }; enum TextFieldEventBehavior { DispatchNoEvent, DispatchChangeEvent, DispatchInputAndChangeEvent }; @@ -45,31 +44,30 @@ public: virtual ~HTMLTextFormControlElement(); - void didEditInnerTextValue(); void forwardEvent(Event*); virtual InsertionNotificationRequest insertedInto(ContainerNode&) override; // The derived class should return true if placeholder processing is needed. - bool isPlaceholderVisible() const { return m_isPlaceholderVisible; } virtual bool supportsPlaceholder() const = 0; String strippedPlaceholder() const; + bool placeholderShouldBeVisible() const; virtual HTMLElement* placeholderElement() const = 0; - void updatePlaceholderVisibility(); + void updatePlaceholderVisibility(bool); int indexForVisiblePosition(const VisiblePosition&) const; - WEBCORE_EXPORT VisiblePosition visiblePositionForIndex(int index) const; + VisiblePosition visiblePositionForIndex(int index) const; int selectionStart() const; int selectionEnd() const; const AtomicString& selectionDirection() const; void setSelectionStart(int); void setSelectionEnd(int); void setSelectionDirection(const String&); - void select(const AXTextStateChangeIntent& = AXTextStateChangeIntent()); + void select(); virtual void setRangeText(const String& replacement, ExceptionCode&); virtual void setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionCode&); - void setSelectionRange(int start, int end, const String& direction, const AXTextStateChangeIntent& = AXTextStateChangeIntent()); - void setSelectionRange(int start, int end, TextFieldSelectionDirection = SelectionHasNoDirection, const AXTextStateChangeIntent& = AXTextStateChangeIntent()); + void setSelectionRange(int start, int end, const String& direction); + void setSelectionRange(int start, int end, TextFieldSelectionDirection = SelectionHasNoDirection); PassRefPtr<Range> selection() const; String selectedText() const; @@ -80,8 +78,8 @@ public: virtual TextControlInnerTextElement* innerTextElement() const = 0; - void selectionChanged(bool shouldFireSelectEvent); - WEBCORE_EXPORT bool lastChangeWasUserEdit() const; + void selectionChanged(bool userTriggered); + bool lastChangeWasUserEdit() const; void setInnerTextValue(const String&); String innerTextValue() const; @@ -89,8 +87,8 @@ public: void setTextAsOfLastFormControlChangeEvent(const String& text) { m_textAsOfLastFormControlChangeEvent = text; } #if PLATFORM(IOS) - WEBCORE_EXPORT void hidePlaceholder(); - WEBCORE_EXPORT void showPlaceholderIfNecessary(); + void hidePlaceholder(); + void showPlaceholderIfNecessary(); #endif protected: @@ -100,10 +98,6 @@ protected: virtual void parseAttribute(const QualifiedName&, const AtomicString&) override; - virtual void disabledStateChanged() override; - virtual void readOnlyAttributeChanged() override; - void updateInnerTextElementEditability(); - void cacheSelection(int start, int end, TextFieldSelectionDirection direction) { m_cachedSelectionStart = start; @@ -111,9 +105,10 @@ protected: m_cachedSelectionDirection = direction; } - void restoreCachedSelection(const AXTextStateChangeIntent& = AXTextStateChangeIntent()); + void restoreCachedSelection(); bool hasCachedSelection() const { return m_cachedSelectionStart >= 0; } + virtual void defaultEventHandler(Event*) override; virtual void subtreeHasChanged() = 0; void setLastChangeWasNotUserEdit() { m_lastChangeWasUserEdit = false; } @@ -121,44 +116,38 @@ protected: String valueWithHardLineBreaks() const; private: - TextFieldSelectionDirection cachedSelectionDirection() const { return static_cast<TextFieldSelectionDirection>(m_cachedSelectionDirection); } - int computeSelectionStart() const; int computeSelectionEnd() const; TextFieldSelectionDirection computeSelectionDirection() const; - virtual void dispatchFocusEvent(RefPtr<Element>&& oldFocusedElement, FocusDirection) override final; - virtual void dispatchBlurEvent(RefPtr<Element>&& newFocusedElement) override final; + virtual void dispatchFocusEvent(PassRefPtr<Element> oldFocusedElement, FocusDirection) override final; + virtual void dispatchBlurEvent(PassRefPtr<Element> newFocusedElement) override final; virtual bool childShouldCreateRenderer(const Node&) const override; - unsigned indexForPosition(const Position&) const; - // Returns true if user-editable value is empty. Used to check placeholder visibility. virtual bool isEmptyValue() const = 0; + // Returns true if suggested value is empty. Used to check placeholder visibility. + virtual bool isEmptySuggestedValue() const { return true; } // Called in dispatchFocusEvent(), after placeholder process, before calling parent's dispatchFocusEvent(). virtual void handleFocusEvent(Node* /* oldFocusedNode */, FocusDirection) { } // Called in dispatchBlurEvent(), after placeholder process, before calling parent's dispatchBlurEvent(). virtual void handleBlurEvent() { } - bool placeholderShouldBeVisible() const; - String m_textAsOfLastFormControlChangeEvent; - + bool m_lastChangeWasUserEdit; + int m_cachedSelectionStart; int m_cachedSelectionEnd; - - unsigned char m_cachedSelectionDirection : 2; - unsigned char m_lastChangeWasUserEdit : 1; - unsigned char m_isPlaceholderVisible : 1; + TextFieldSelectionDirection m_cachedSelectionDirection; }; -HTMLTextFormControlElement* enclosingTextFormControl(const Position&); +void isHTMLTextFormControlElement(const HTMLTextFormControlElement&); // Catch unnecessary runtime check of type known at compile time. +inline bool isHTMLTextFormControlElement(const Element& element) { return element.isTextFormControl(); } +inline bool isHTMLTextFormControlElement(const Node& node) { return node.isElementNode() && toElement(node).isTextFormControl(); } +NODE_TYPE_CASTS(HTMLTextFormControlElement) -} // namespace WebCore +HTMLTextFormControlElement* enclosingTextFormControl(const Position&); -SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::HTMLTextFormControlElement) - static bool isType(const WebCore::Element& element) { return element.isTextFormControl(); } - static bool isType(const WebCore::Node& node) { return is<WebCore::Element>(node) && isType(downcast<WebCore::Element>(node)); } -SPECIALIZE_TYPE_TRAITS_END() +} // namespace #endif |