OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 { | 179 { |
180 // If the element is visible, on mouseup, clear the value, and set selection | 180 // If the element is visible, on mouseup, clear the value, and set selection |
181 HTMLInputElement* input(toHTMLInputElement(shadowHost())); | 181 HTMLInputElement* input(toHTMLInputElement(shadowHost())); |
182 if (!input || input->isDisabledOrReadOnly()) { | 182 if (!input || input->isDisabledOrReadOnly()) { |
183 if (!event->defaultHandled()) | 183 if (!event->defaultHandled()) |
184 HTMLDivElement::defaultEventHandler(event); | 184 HTMLDivElement::defaultEventHandler(event); |
185 return; | 185 return; |
186 } | 186 } |
187 | 187 |
188 | 188 |
189 if (event->type() == EventTypeNames::click && event->isMouseEvent() && toMou
seEvent(event)->button() == LeftButton) { | 189 if (event->type() == EventTypeNames::click && event->isMouseEvent() && toMou
seEvent(event)->button() == static_cast<short>(WebPointerProperties::Button::Lef
t)) { |
190 input->setValueForUser(""); | 190 input->setValueForUser(""); |
191 input->setAutofilled(false); | 191 input->setAutofilled(false); |
192 input->onSearch(); | 192 input->onSearch(); |
193 event->setDefaultHandled(); | 193 event->setDefaultHandled(); |
194 } | 194 } |
195 | 195 |
196 if (!event->defaultHandled()) | 196 if (!event->defaultHandled()) |
197 HTMLDivElement::defaultEventHandler(event); | 197 HTMLDivElement::defaultEventHandler(event); |
198 } | 198 } |
199 | 199 |
200 bool SearchFieldCancelButtonElement::willRespondToMouseClickEvents() | 200 bool SearchFieldCancelButtonElement::willRespondToMouseClickEvents() |
201 { | 201 { |
202 const HTMLInputElement* input = toHTMLInputElement(shadowHost()); | 202 const HTMLInputElement* input = toHTMLInputElement(shadowHost()); |
203 if (input && !input->isDisabledOrReadOnly()) | 203 if (input && !input->isDisabledOrReadOnly()) |
204 return true; | 204 return true; |
205 | 205 |
206 return HTMLDivElement::willRespondToMouseClickEvents(); | 206 return HTMLDivElement::willRespondToMouseClickEvents(); |
207 } | 207 } |
208 | 208 |
209 } // namespace blink | 209 } // namespace blink |
OLD | NEW |