Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: Source/core/html/shadow/TextControlInnerElements.cpp

Issue 93863007: Use click event for search field cancel button (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/shadow/TextControlInnerElements.cpp
diff --git a/Source/core/html/shadow/TextControlInnerElements.cpp b/Source/core/html/shadow/TextControlInnerElements.cpp
index 1c057fa46a85a3b07692a960d46bdcd01a818618..fded6f732ec73fb64cc34f7af3c4bb149bdccda0 100644
--- a/Source/core/html/shadow/TextControlInnerElements.cpp
+++ b/Source/core/html/shadow/TextControlInnerElements.cpp
@@ -230,31 +230,12 @@ void SearchFieldCancelButtonElement::defaultEventHandler(Event* event)
return;
}
- if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
- if (renderer() && renderer()->visibleToHitTesting()) {
- if (LocalFrame* frame = document().frame()) {
- frame->eventHandler().setCapturingMouseEventsNode(this);
- m_capturing = true;
- }
- }
- input->focus();
- input->select();
+
+ if (event->type() == EventTypeNames::click && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
+ input->setValueForUser("");
+ input->onSearch();
event->setDefaultHandled();
}
- if (event->type() == EventTypeNames::mouseup && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
- if (m_capturing) {
- if (LocalFrame* frame = document().frame()) {
- frame->eventHandler().setCapturingMouseEventsNode(nullptr);
- m_capturing = false;
- }
- if (hovered()) {
- String oldValue = input->value();
- input->setValueForUser("");
- input->onSearch();
- event->setDefaultHandled();
- }
- }
- }
if (!event->defaultHandled())
HTMLDivElement::defaultEventHandler(event);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698