OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "public/web/WebElement.h" | 32 #include "public/web/WebElement.h" |
33 | 33 |
34 #include "bindings/core/v8/ExceptionState.h" | 34 #include "bindings/core/v8/ExceptionState.h" |
| 35 #include "core/HTMLNames.h" |
35 #include "core/dom/Element.h" | 36 #include "core/dom/Element.h" |
36 #include "core/dom/Fullscreen.h" | 37 #include "core/dom/Fullscreen.h" |
37 #include "core/dom/NamedNodeMap.h" | |
38 #include "core/dom/custom/CustomElementProcessingStack.h" | 38 #include "core/dom/custom/CustomElementProcessingStack.h" |
| 39 #include "core/html/HTMLTextFormControlElement.h" |
39 #include "platform/graphics/Image.h" | 40 #include "platform/graphics/Image.h" |
40 #include "public/platform/WebRect.h" | 41 #include "public/platform/WebRect.h" |
41 #include "wtf/PassRefPtr.h" | 42 #include "wtf/PassRefPtr.h" |
| 43 #include "wtf/text/AtomicString.h" |
| 44 #include "wtf/text/WTFString.h" |
42 | 45 |
43 namespace blink { | 46 namespace blink { |
44 | 47 |
| 48 using namespace HTMLNames; |
| 49 |
45 bool WebElement::isFormControlElement() const | 50 bool WebElement::isFormControlElement() const |
46 { | 51 { |
47 return constUnwrap<Element>()->isFormControlElement(); | 52 return constUnwrap<Element>()->isFormControlElement(); |
48 } | 53 } |
49 | 54 |
50 bool WebElement::isTextFormControlElement() const | 55 bool WebElement::isTextFormControlElement() const |
51 { | 56 { |
52 return constUnwrap<Element>()->isTextFormControl(); | 57 return constUnwrap<Element>()->isTextFormControl(); |
53 } | 58 } |
54 | 59 |
| 60 bool WebElement::isEditable() const |
| 61 { |
| 62 const Element* element = constUnwrap<Element>(); |
| 63 |
| 64 if (element->isContentEditable()) |
| 65 return true; |
| 66 |
| 67 if (element->isTextFormControl()) { |
| 68 const HTMLTextFormControlElement* input = toHTMLTextFormControlElement(e
lement); |
| 69 if (!input->isDisabledOrReadOnly()) |
| 70 return true; |
| 71 } |
| 72 |
| 73 return equalIgnoringCase(element->getAttribute(roleAttr), "textbox"); |
| 74 } |
| 75 |
55 WebString WebElement::tagName() const | 76 WebString WebElement::tagName() const |
56 { | 77 { |
57 return constUnwrap<Element>()->tagName(); | 78 return constUnwrap<Element>()->tagName(); |
58 } | 79 } |
59 | 80 |
60 bool WebElement::hasHTMLTagName(const WebString& tagName) const | 81 bool WebElement::hasHTMLTagName(const WebString& tagName) const |
61 { | 82 { |
62 // How to create class nodeName localName | 83 // How to create class nodeName localName |
63 // createElement('input') HTMLInputElement INPUT input | 84 // createElement('input') HTMLInputElement INPUT input |
64 // createElement('INPUT') HTMLInputElement INPUT input | 85 // createElement('INPUT') HTMLInputElement INPUT input |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 m_private = elem; | 185 m_private = elem; |
165 return *this; | 186 return *this; |
166 } | 187 } |
167 | 188 |
168 WebElement::operator PassRefPtrWillBeRawPtr<Element>() const | 189 WebElement::operator PassRefPtrWillBeRawPtr<Element>() const |
169 { | 190 { |
170 return toElement(m_private.get()); | 191 return toElement(m_private.get()); |
171 } | 192 } |
172 | 193 |
173 } // namespace blink | 194 } // namespace blink |
OLD | NEW |