Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 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 "WebFormControlElement.h" | 32 #include "WebFormControlElement.h" |
| 33 | 33 |
| 34 #include "core/html/HTMLFormControlElement.h" | 34 #include "core/html/HTMLFormControlElement.h" |
| 35 #include "core/html/HTMLFormElement.h" | 35 #include "core/html/HTMLFormElement.h" |
| 36 #include "heap/Handle.h" | |
| 36 #include <wtf/PassRefPtr.h> | 37 #include <wtf/PassRefPtr.h> |
| 37 | 38 |
| 38 using namespace WebCore; | 39 using namespace WebCore; |
| 39 | 40 |
| 40 namespace WebKit { | 41 namespace WebKit { |
| 41 | 42 |
| 42 bool WebFormControlElement::isEnabled() const | 43 bool WebFormControlElement::isEnabled() const |
| 43 { | 44 { |
| 44 return !constUnwrap<HTMLFormControlElement>()->isDisabledFormControl(); | 45 return !constUnwrap<HTMLFormControlElement>()->isDisabledFormControl(); |
| 45 } | 46 } |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 75 if (!trimmedName.isEmpty()) | 76 if (!trimmedName.isEmpty()) |
| 76 return trimmedName; | 77 return trimmedName; |
| 77 return String(); | 78 return String(); |
| 78 } | 79 } |
| 79 | 80 |
| 80 WebFormElement WebFormControlElement::form() const | 81 WebFormElement WebFormControlElement::form() const |
| 81 { | 82 { |
| 82 return WebFormElement(constUnwrap<HTMLFormControlElement>()->form()); | 83 return WebFormElement(constUnwrap<HTMLFormControlElement>()->form()); |
| 83 } | 84 } |
| 84 | 85 |
| 85 WebFormControlElement::WebFormControlElement(const PassRefPtr<HTMLFormControlEle ment>& elem) | 86 WebFormControlElement::WebFormControlElement(Handle<HTMLFormControlElement> elem ) |
| 86 : WebElement(elem) | 87 : WebElement(elem.passRefPtr()) |
| 87 { | 88 { |
| 88 } | 89 } |
| 89 | 90 |
| 90 WebFormControlElement& WebFormControlElement::operator=(const PassRefPtr<HTMLFor mControlElement>& elem) | 91 WebFormControlElement& WebFormControlElement::operator=(Handle<HTMLFormControlEl ement> elem) |
| 91 { | 92 { |
| 92 m_private = elem; | 93 m_private = elem.passRefPtr(); |
| 93 return *this; | 94 return *this; |
| 94 } | 95 } |
| 95 | 96 |
| 96 WebFormControlElement::operator PassRefPtr<HTMLFormControlElement>() const | 97 WebFormControlElement::operator Handle<HTMLFormControlElement>() const |
|
Vyacheslav Egorov (Google)
2013/07/18 16:50:08
I wonder if we want to cast to Handle<T> not to Re
haraken
2013/07/19 02:57:09
I replaced the operator overloading with a normal
| |
| 97 { | 98 { |
| 98 return static_cast<HTMLFormControlElement*>(m_private.get()); | 99 return Handle<HTMLFormControlElement>(static_cast<HTMLFormControlElement*>(m _private.get())); |
| 99 } | 100 } |
| 100 | 101 |
| 101 } // namespace WebKit | 102 } // namespace WebKit |
| OLD | NEW |