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

Side by Side Diff: Source/core/html/shadow/ClearButtonElement.cpp

Issue 594093002: Fix for mouse capture and release on ClearButtonElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 HTMLDivElement::defaultEventHandler(event); 78 HTMLDivElement::defaultEventHandler(event);
79 return; 79 return;
80 } 80 }
81 81
82 if (!m_clearButtonOwner->shouldClearButtonRespondToMouseEvents()) { 82 if (!m_clearButtonOwner->shouldClearButtonRespondToMouseEvents()) {
83 if (!event->defaultHandled()) 83 if (!event->defaultHandled())
84 HTMLDivElement::defaultEventHandler(event); 84 HTMLDivElement::defaultEventHandler(event);
85 return; 85 return;
86 } 86 }
87 87
88 if (event->type() == EventTypeNames::mousedown && event->isMouseEvent() && t oMouseEvent(event)->button() == LeftButton) { 88 if (event->type() == EventTypeNames::click) {
89 if (renderer() && renderer()->visibleToHitTesting()) {
90 if (LocalFrame* frame = document().frame()) {
91 frame->eventHandler().setCapturingMouseEventsNode(this);
Habib Virji 2014/09/26 13:59:13 setCapturingMouseEventsNode and m_capturing are no
92 m_capturing = true;
93 }
94 }
95 m_clearButtonOwner->focusAndSelectClearButtonOwner(); 89 m_clearButtonOwner->focusAndSelectClearButtonOwner();
96 event->setDefaultHandled(); 90 event->setDefaultHandled();
97 } 91 if (hovered()) {
98 if (event->type() == EventTypeNames::mouseup && event->isMouseEvent() && toM ouseEvent(event)->button() == LeftButton) { 92 m_clearButtonOwner->clearValue();
99 if (m_capturing) { 93 event->setDefaultHandled();
100 if (LocalFrame* frame = document().frame()) {
101 frame->eventHandler().setCapturingMouseEventsNode(nullptr);
102 m_capturing = false;
103 }
104 if (hovered()) {
105 m_clearButtonOwner->clearValue();
106 event->setDefaultHandled();
107 }
108 } 94 }
109 } 95 }
110 96
111 if (!event->defaultHandled()) 97 if (!event->defaultHandled())
112 HTMLDivElement::defaultEventHandler(event); 98 HTMLDivElement::defaultEventHandler(event);
113 } 99 }
114 100
115 bool ClearButtonElement::isClearButtonElement() const 101 bool ClearButtonElement::isClearButtonElement() const
116 { 102 {
117 return true; 103 return true;
118 } 104 }
119 105
120 void ClearButtonElement::trace(Visitor* visitor) 106 void ClearButtonElement::trace(Visitor* visitor)
121 { 107 {
122 visitor->trace(m_clearButtonOwner); 108 visitor->trace(m_clearButtonOwner);
123 HTMLDivElement::trace(visitor); 109 HTMLDivElement::trace(visitor);
124 } 110 }
125 111
126 } 112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698