| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 else if (isHTMLTextAreaElement(*m_private)) | 87 else if (isHTMLTextAreaElement(*m_private)) |
| 88 unwrap<HTMLTextAreaElement>()->setValue( | 88 unwrap<HTMLTextAreaElement>()->setValue( |
| 89 value, sendEvents ? DispatchInputAndChangeEvent : DispatchNoEvent); | 89 value, sendEvents ? DispatchInputAndChangeEvent : DispatchNoEvent); |
| 90 else if (isHTMLSelectElement(*m_private)) | 90 else if (isHTMLSelectElement(*m_private)) |
| 91 unwrap<HTMLSelectElement>()->setValue(value, sendEvents); | 91 unwrap<HTMLSelectElement>()->setValue(value, sendEvents); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void WebFormControlElement::setAutofillValue(const WebString& value) { | 94 void WebFormControlElement::setAutofillValue(const WebString& value) { |
| 95 // The input and change events will be sent in setValue. | 95 // The input and change events will be sent in setValue. |
| 96 if (isHTMLInputElement(*m_private) || isHTMLTextAreaElement(*m_private)) { | 96 if (isHTMLInputElement(*m_private) || isHTMLTextAreaElement(*m_private)) { |
| 97 if (!focused()) | 97 if (!focused()) { |
| 98 unwrap<Element>()->dispatchFocusEvent(nullptr, WebFocusTypeForward, | 98 unwrap<Element>()->dispatchFocusEvent(nullptr, WebFocusTypeForward, |
| 99 nullptr); | 99 InputDeviceCapabilities::Null); |
| 100 } |
| 100 unwrap<Element>()->dispatchScopedEvent( | 101 unwrap<Element>()->dispatchScopedEvent( |
| 101 Event::createBubble(EventTypeNames::keydown)); | 102 Event::createBubble(EventTypeNames::keydown)); |
| 102 unwrap<TextControlElement>()->setValue(value, DispatchInputAndChangeEvent); | 103 unwrap<TextControlElement>()->setValue(value, DispatchInputAndChangeEvent); |
| 103 unwrap<Element>()->dispatchScopedEvent( | 104 unwrap<Element>()->dispatchScopedEvent( |
| 104 Event::createBubble(EventTypeNames::keyup)); | 105 Event::createBubble(EventTypeNames::keyup)); |
| 105 if (!focused()) | 106 if (!focused()) { |
| 106 unwrap<Element>()->dispatchBlurEvent(nullptr, WebFocusTypeForward, | 107 unwrap<Element>()->dispatchBlurEvent(nullptr, WebFocusTypeForward, |
| 107 nullptr); | 108 InputDeviceCapabilities::Null); |
| 109 } |
| 108 } else if (isHTMLSelectElement(*m_private)) { | 110 } else if (isHTMLSelectElement(*m_private)) { |
| 109 if (!focused()) | 111 if (!focused()) { |
| 110 unwrap<Element>()->dispatchFocusEvent(nullptr, WebFocusTypeForward, | 112 unwrap<Element>()->dispatchFocusEvent(nullptr, WebFocusTypeForward, |
| 111 nullptr); | 113 InputDeviceCapabilities::Null); |
| 114 } |
| 112 unwrap<HTMLSelectElement>()->setValue(value, true); | 115 unwrap<HTMLSelectElement>()->setValue(value, true); |
| 113 if (!focused()) | 116 if (!focused()) { |
| 114 unwrap<Element>()->dispatchBlurEvent(nullptr, WebFocusTypeForward, | 117 unwrap<Element>()->dispatchBlurEvent(nullptr, WebFocusTypeForward, |
| 115 nullptr); | 118 InputDeviceCapabilities::Null); |
| 119 } |
| 116 } | 120 } |
| 117 } | 121 } |
| 118 | 122 |
| 119 WebString WebFormControlElement::value() const { | 123 WebString WebFormControlElement::value() const { |
| 120 if (isHTMLInputElement(*m_private)) | 124 if (isHTMLInputElement(*m_private)) |
| 121 return constUnwrap<HTMLInputElement>()->value(); | 125 return constUnwrap<HTMLInputElement>()->value(); |
| 122 if (isHTMLTextAreaElement(*m_private)) | 126 if (isHTMLTextAreaElement(*m_private)) |
| 123 return constUnwrap<HTMLTextAreaElement>()->value(); | 127 return constUnwrap<HTMLTextAreaElement>()->value(); |
| 124 if (isHTMLSelectElement(*m_private)) | 128 if (isHTMLSelectElement(*m_private)) |
| 125 return constUnwrap<HTMLSelectElement>()->value(); | 129 return constUnwrap<HTMLSelectElement>()->value(); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 HTMLFormControlElement* elem) { | 215 HTMLFormControlElement* elem) { |
| 212 m_private = elem; | 216 m_private = elem; |
| 213 return *this; | 217 return *this; |
| 214 } | 218 } |
| 215 | 219 |
| 216 WebFormControlElement::operator HTMLFormControlElement*() const { | 220 WebFormControlElement::operator HTMLFormControlElement*() const { |
| 217 return toHTMLFormControlElement(m_private.get()); | 221 return toHTMLFormControlElement(m_private.get()); |
| 218 } | 222 } |
| 219 | 223 |
| 220 } // namespace blink | 224 } // namespace blink |
| OLD | NEW |