OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 16 matching lines...) Expand all Loading... |
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 "WebSelectElement.h" | 32 #include "WebSelectElement.h" |
33 | 33 |
34 #include "HTMLNames.h" | 34 #include "HTMLNames.h" |
35 #include "core/html/HTMLOptionElement.h" | 35 #include "core/html/HTMLOptionElement.h" |
36 #include "core/html/HTMLSelectElement.h" | 36 #include "core/html/HTMLSelectElement.h" |
| 37 #include "heap/Handle.h" |
37 #include <public/WebString.h> | 38 #include <public/WebString.h> |
38 #include <wtf/PassRefPtr.h> | 39 #include <wtf/PassRefPtr.h> |
39 | 40 |
40 using namespace WebCore; | 41 using namespace WebCore; |
41 | 42 |
42 namespace WebKit { | 43 namespace WebKit { |
43 | 44 |
44 void WebSelectElement::setValue(const WebString& value) | 45 void WebSelectElement::setValue(const WebString& value) |
45 { | 46 { |
46 unwrap<HTMLSelectElement>()->setValue(value); | 47 unwrap<HTMLSelectElement>()->setValue(value); |
47 } | 48 } |
48 | 49 |
49 WebString WebSelectElement::value() const | 50 WebString WebSelectElement::value() const |
50 { | 51 { |
51 return constUnwrap<HTMLSelectElement>()->value(); | 52 return constUnwrap<HTMLSelectElement>()->value(); |
52 } | 53 } |
53 | 54 |
54 WebVector<WebElement> WebSelectElement::listItems() const | 55 WebVector<WebElement> WebSelectElement::listItems() const |
55 { | 56 { |
56 const Vector<HTMLElement*>& sourceItems = constUnwrap<HTMLSelectElement>()->
listItems(); | 57 const Vector<HTMLElement*>& sourceItems = constUnwrap<HTMLSelectElement>()->
listItems(); |
57 WebVector<WebElement> items(sourceItems.size()); | 58 WebVector<WebElement> items(sourceItems.size()); |
58 for (size_t i = 0; i < sourceItems.size(); ++i) | 59 for (size_t i = 0; i < sourceItems.size(); ++i) |
59 items[i] = WebElement(sourceItems[i]); | 60 items[i] = WebElement(sourceItems[i]); |
60 | 61 |
61 return items; | 62 return items; |
62 } | 63 } |
63 | 64 |
64 WebSelectElement::WebSelectElement(const PassRefPtr<HTMLSelectElement>& elem) | 65 WebSelectElement::WebSelectElement(Handle<HTMLSelectElement> elem) |
65 : WebFormControlElement(elem) | 66 : WebFormControlElement(elem) |
66 { | 67 { |
67 } | 68 } |
68 | 69 |
69 WebSelectElement& WebSelectElement::operator=(const PassRefPtr<HTMLSelectElement
>& elem) | 70 WebSelectElement& WebSelectElement::operator=(Handle<HTMLSelectElement> elem) |
70 { | 71 { |
71 m_private = elem; | 72 m_private = elem.passRefPtr(); |
72 return *this; | 73 return *this; |
73 } | 74 } |
74 | 75 |
75 WebSelectElement::operator PassRefPtr<HTMLSelectElement>() const | 76 WebSelectElement::operator Handle<HTMLSelectElement>() const |
76 { | 77 { |
77 return static_cast<HTMLSelectElement*>(m_private.get()); | 78 return Handle<HTMLSelectElement>(static_cast<HTMLSelectElement*>(m_private.g
et())); |
78 } | 79 } |
79 | 80 |
80 } // namespace WebKit | 81 } // namespace WebKit |
OLD | NEW |