summaryrefslogtreecommitdiffstats
path: root/WebCore/html/HTMLSelectElement.h
diff options
context:
space:
mode:
authorFeng Qian <fqian@google.com>2009-06-18 18:20:56 -0700
committerFeng Qian <fqian@google.com>2009-06-18 18:20:56 -0700
commit1edef79f87f9c52c21d69c87c19f8e2b140a9119 (patch)
treecad337ef493b0d9710bf3ae478cb87cb534f598d /WebCore/html/HTMLSelectElement.h
parentb83fc086000e27bc227580bd0e35b9d7bee1179a (diff)
parentc9c4d65c1547996ed3748026904d6e7f09aec2b4 (diff)
downloadexternal_webkit-1edef79f87f9c52c21d69c87c19f8e2b140a9119.zip
external_webkit-1edef79f87f9c52c21d69c87c19f8e2b140a9119.tar.gz
external_webkit-1edef79f87f9c52c21d69c87c19f8e2b140a9119.tar.bz2
Merge commit 'goog/master-webkit-merge' into webkit-merge-44544
Diffstat (limited to 'WebCore/html/HTMLSelectElement.h')
-rw-r--r--WebCore/html/HTMLSelectElement.h168
1 files changed, 65 insertions, 103 deletions
diff --git a/WebCore/html/HTMLSelectElement.h b/WebCore/html/HTMLSelectElement.h
index 59e4a4b..df7832c 100644
--- a/WebCore/html/HTMLSelectElement.h
+++ b/WebCore/html/HTMLSelectElement.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 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2009 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -24,10 +24,9 @@
#ifndef HTMLSelectElement_h
#define HTMLSelectElement_h
-#include "Event.h"
-#include "HTMLCollection.h"
+#include "CollectionCache.h"
#include "HTMLFormControlElement.h"
-#include <wtf/Vector.h>
+#include "SelectElement.h"
namespace WebCore {
@@ -35,77 +34,32 @@ class HTMLOptionElement;
class HTMLOptionsCollection;
class KeyboardEvent;
-class HTMLSelectElement : public HTMLFormControlElementWithState {
+class HTMLSelectElement : public HTMLFormControlElementWithState, public SelectElement {
public:
HTMLSelectElement(const QualifiedName&, Document*, HTMLFormElement* = 0);
- virtual int tagPriority() const { return 6; }
- virtual bool checkDTD(const Node* newChild);
-
- virtual const AtomicString& type() const;
-
- virtual bool isKeyboardFocusable(KeyboardEvent*) const;
- virtual bool isMouseFocusable() const;
- virtual bool canSelectAll() const;
- virtual void selectAll();
-
- virtual void recalcStyle(StyleChange);
-
- virtual void dispatchFocusEvent();
- virtual void dispatchBlurEvent();
-
- virtual bool canStartSelection() const { return false; }
-
- int selectedIndex() const;
- void setSelectedIndex(int index, bool deselect = true, bool fireOnChange = false);
- int lastSelectedListIndex() const;
-
- virtual bool isEnumeratable() const { return true; }
+ virtual int selectedIndex() const;
+ virtual void setSelectedIndex(int index, bool deselect = true, bool fireOnChange = false);
unsigned length() const;
- int minWidth() const { return m_minwidth; }
-
- int size() const { return m_size; }
-
- bool multiple() const { return m_multiple; }
+ virtual int size() const { return m_data.size(); }
+ virtual bool multiple() const { return m_data.multiple(); }
void add(HTMLElement* element, HTMLElement* before, ExceptionCode&);
void remove(int index);
String value();
void setValue(const String&);
-
- PassRefPtr<HTMLOptionsCollection> options();
- virtual bool saveState(String& value) const;
- virtual void restoreState(const String&);
+ PassRefPtr<HTMLOptionsCollection> options();
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
- virtual void parseMappedAttribute(MappedAttribute*);
-
- virtual RenderObject* createRenderer(RenderArena*, RenderStyle *);
- virtual bool appendFormData(FormDataList&, bool);
-
- // get the actual listbox index of the optionIndexth option
- int optionToListIndex(int optionIndex) const;
- // reverse of optionToListIndex - get optionIndex from listboxIndex
- int listToOptionIndex(int listIndex) const;
-
void setRecalcListItems();
- const Vector<HTMLElement*>& listItems() const
- {
- if (m_recalcListItems)
- recalcListItems();
- else
- checkListItems();
- return m_listItems;
- }
- virtual void reset();
+ virtual const Vector<Element*>& listItems() const { return m_data.listItems(this); }
- virtual void defaultEventHandler(Event*);
virtual void accessKeyAction(bool sendToAnyElement);
void accessKeySetSelectedIndex(int);
@@ -119,64 +73,72 @@ public:
Node* namedItem(const AtomicString& name);
Node* item(unsigned index);
- HTMLCollection::CollectionInfo* collectionInfo() { return &m_collectionInfo; }
-
- void setActiveSelectionAnchorIndex(int index);
- void setActiveSelectionEndIndex(int index) { m_activeSelectionEndIndex = index; }
- void updateListBoxSelection(bool deselectOtherOptions);
- void listBoxOnChange();
- void menuListOnChange();
+ CollectionCache* collectionInfo() { return &m_collectionInfo; }
+
+ void scrollToSelection();
+
+private:
+ virtual int tagPriority() const { return 6; }
+ virtual bool checkDTD(const Node* newChild);
+
+ virtual const AtomicString& formControlType() const;
- int activeSelectionStartListIndex() const;
- int activeSelectionEndListIndex() const;
+ virtual bool isKeyboardFocusable(KeyboardEvent*) const;
+ virtual bool isMouseFocusable() const;
+ virtual bool canSelectAll() const;
+ virtual void selectAll();
+
+ virtual void recalcStyle(StyleChange);
+
+ virtual void dispatchFocusEvent();
+ virtual void dispatchBlurEvent();
- void scrollToSelection();
+ virtual bool canStartSelection() const { return false; }
+
+ virtual bool isEnumeratable() const { return true; }
+
+ virtual bool saveFormControlState(String& value) const;
+ virtual void restoreFormControlState(const String&);
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle *);
+ virtual bool appendFormData(FormDataList&, bool);
+
+#if PLATFORM(ANDROID)
+public:
+ virtual int listToOptionIndex(int listIndex) const;
+ virtual int optionToListIndex(int optionIndex) const;
private:
+#else
+ virtual int listToOptionIndex(int listIndex) const;
+ virtual int optionToListIndex(int optionIndex) const;
+#endif
+
+ virtual void reset();
+
+ virtual void defaultEventHandler(Event*);
+
+ virtual void setActiveSelectionAnchorIndex(int index);
+ virtual void setActiveSelectionEndIndex(int index);
+ virtual void updateListBoxSelection(bool deselectOtherOptions);
+ virtual void listBoxOnChange();
+ virtual void menuListOnChange();
+
+ virtual int activeSelectionStartListIndex() const;
+ virtual int activeSelectionEndListIndex() const;
+
void recalcListItems(bool updateSelectedStates = true) const;
- void checkListItems() const;
void deselectItems(HTMLOptionElement* excludeElement = 0);
-#ifdef ANDROID_LISTBOX_USES_MENU_LIST
- bool usesMenuList() const { return true; }
-#else
- bool usesMenuList() const { return !m_multiple && m_size <= 1; }
-#endif
- int nextSelectableListIndex(int startIndex);
- int previousSelectableListIndex(int startIndex);
- void menuListDefaultEventHandler(Event*);
- void listBoxDefaultEventHandler(Event*);
void typeAheadFind(KeyboardEvent*);
void saveLastSelection();
- mutable Vector<HTMLElement*> m_listItems;
- Vector<bool> m_cachedStateForActiveSelection;
- Vector<bool> m_lastOnChangeSelection;
- int m_minwidth;
- int m_size;
- bool m_multiple;
- mutable bool m_recalcListItems;
- mutable int m_lastOnChangeIndex;
-
- int m_activeSelectionAnchorIndex;
- int m_activeSelectionEndIndex;
- bool m_activeSelectionState;
-
- // Instance variables for type-ahead find
- UChar m_repeatingChar;
- DOMTimeStamp m_lastCharTime;
- String m_typedString;
-
- HTMLCollection::CollectionInfo m_collectionInfo;
-};
+ virtual void insertedIntoTree(bool);
-#ifdef NDEBUG
-
-inline void HTMLSelectElement::checkListItems() const
-{
-}
-
-#endif
+ SelectElementData m_data;
+ CollectionCache m_collectionInfo;
+};
} // namespace