|
1 /* |
|
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
|
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
|
4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
|
5 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. |
|
6 * Copyright (C) 2010 Google Inc. All rights reserved. |
|
7 * |
|
8 * This library is free software; you can redistribute it and/or |
|
9 * modify it under the terms of the GNU Library General Public |
|
10 * License as published by the Free Software Foundation; either |
|
11 * version 2 of the License, or (at your option) any later version. |
|
12 * |
|
13 * This library is distributed in the hope that it will be useful, |
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 * Library General Public License for more details. |
|
17 * |
|
18 * You should have received a copy of the GNU Library General Public License |
|
19 * along with this library; see the file COPYING.LIB. If not, write to |
|
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
21 * Boston, MA 02110-1301, USA. |
|
22 * |
|
23 */ |
|
24 #ifndef HTMLOptionElement_h |
|
25 #define HTMLOptionElement_h |
|
26 |
|
27 #include "HTMLFormControlElement.h" |
|
28 #include "OptionElement.h" |
|
29 |
|
30 namespace WebCore { |
|
31 |
|
32 class HTMLSelectElement; |
|
33 |
|
34 class HTMLOptionElement : public HTMLFormControlElement, public OptionElement { |
|
35 friend class HTMLSelectElement; |
|
36 friend class RenderMenuList; |
|
37 |
|
38 public: |
|
39 static PassRefPtr<HTMLOptionElement> create(Document*, HTMLFormElement*); |
|
40 static PassRefPtr<HTMLOptionElement> create(const QualifiedName&, Document*, HTMLFormElement*); |
|
41 static PassRefPtr<HTMLOptionElement> createForJSConstructor(Document*, const String& data, const String& value, |
|
42 bool defaultSelected, bool selected, ExceptionCode&); |
|
43 |
|
44 virtual String text() const; |
|
45 void setText(const String&, ExceptionCode&); |
|
46 |
|
47 int index() const; |
|
48 |
|
49 virtual String value() const; |
|
50 void setValue(const String&); |
|
51 |
|
52 virtual bool selected() const; |
|
53 void setSelected(bool); |
|
54 |
|
55 HTMLSelectElement* ownerSelectElement() const; |
|
56 |
|
57 bool defaultSelected() const; |
|
58 void setDefaultSelected(bool); |
|
59 |
|
60 String label() const; |
|
61 |
|
62 bool ownElementDisabled() const { return HTMLFormControlElement::disabled(); } |
|
63 |
|
64 virtual bool disabled() const; |
|
65 |
|
66 private: |
|
67 HTMLOptionElement(const QualifiedName&, Document*, HTMLFormElement* = 0); |
|
68 |
|
69 virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; } |
|
70 virtual int tagPriority() const { return 2; } |
|
71 virtual bool checkDTD(const Node* newChild); |
|
72 virtual bool supportsFocus() const; |
|
73 virtual bool isFocusable() const; |
|
74 virtual bool rendererIsNeeded(RenderStyle*) { return false; } |
|
75 virtual void attach(); |
|
76 virtual void detach(); |
|
77 virtual void setRenderStyle(PassRefPtr<RenderStyle>); |
|
78 |
|
79 virtual const AtomicString& formControlType() const; |
|
80 |
|
81 virtual void parseMappedAttribute(Attribute*); |
|
82 |
|
83 virtual void setSelectedState(bool); |
|
84 |
|
85 virtual String textIndentedToRespectGroupLabel() const; |
|
86 |
|
87 virtual void insertedIntoTree(bool); |
|
88 virtual void accessKeyAction(bool); |
|
89 |
|
90 virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); |
|
91 |
|
92 virtual RenderStyle* nonRendererRenderStyle() const; |
|
93 |
|
94 OptionElementData m_data; |
|
95 RefPtr<RenderStyle> m_style; |
|
96 }; |
|
97 |
|
98 } //namespace |
|
99 |
|
100 #endif |