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

Side by Side Diff: third_party/WebKit/Source/web/InspectorOverlay.cpp

Issue 2818883002: [DevTools] Swallow mouse up in inspect mode (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/web/InspectorOverlay.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 * 7 *
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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 OverlayMainFrame()->GetEventHandler().HandleGestureEvent(transformed_event); 256 OverlayMainFrame()->GetEventHandler().HandleGestureEvent(transformed_event);
257 } 257 }
258 if (WebInputEvent::IsMouseEventType(input_event.GetType())) { 258 if (WebInputEvent::IsMouseEventType(input_event.GetType())) {
259 WebMouseEvent mouse_event = 259 WebMouseEvent mouse_event =
260 TransformWebMouseEvent(frame_impl_->GetFrameView(), 260 TransformWebMouseEvent(frame_impl_->GetFrameView(),
261 static_cast<const WebMouseEvent&>(input_event)); 261 static_cast<const WebMouseEvent&>(input_event));
262 262
263 if (mouse_event.GetType() == WebInputEvent::kMouseMove) 263 if (mouse_event.GetType() == WebInputEvent::kMouseMove)
264 handled = HandleMouseMove(mouse_event); 264 handled = HandleMouseMove(mouse_event);
265 else if (mouse_event.GetType() == WebInputEvent::kMouseDown) 265 else if (mouse_event.GetType() == WebInputEvent::kMouseDown)
266 handled = HandleMousePress(); 266 handled = HandleMouseDown();
267 else if (mouse_event.GetType() == WebInputEvent::kMouseUp)
268 handled = HandleMouseUp();
267 269
268 if (handled) 270 if (handled)
269 return true; 271 return true;
270 272
271 if (mouse_event.GetType() == WebInputEvent::kMouseMove) { 273 if (mouse_event.GetType() == WebInputEvent::kMouseMove) {
272 handled = OverlayMainFrame()->GetEventHandler().HandleMouseMoveEvent( 274 handled = OverlayMainFrame()->GetEventHandler().HandleMouseMoveEvent(
273 mouse_event, TransformWebMouseEventVector( 275 mouse_event, TransformWebMouseEventVector(
274 frame_impl_->GetFrameView(), 276 frame_impl_->GetFrameView(),
275 std::vector<const WebInputEvent*>())) != 277 std::vector<const WebInputEvent*>())) !=
276 WebInputEventResult::kNotHandled; 278 WebInputEventResult::kNotHandled;
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 hovered_node_for_inspect_mode_ = node; 761 hovered_node_for_inspect_mode_ = node;
760 if (dom_agent_) 762 if (dom_agent_)
761 dom_agent_->NodeHighlightedInOverlay(node); 763 dom_agent_->NodeHighlightedInOverlay(node);
762 HighlightNode(node, event_target, *inspect_mode_highlight_config_, 764 HighlightNode(node, event_target, *inspect_mode_highlight_config_,
763 (event.GetModifiers() & 765 (event.GetModifiers() &
764 (WebInputEvent::kControlKey | WebInputEvent::kMetaKey))); 766 (WebInputEvent::kControlKey | WebInputEvent::kMetaKey)));
765 } 767 }
766 return true; 768 return true;
767 } 769 }
768 770
769 bool InspectorOverlay::HandleMousePress() { 771 bool InspectorOverlay::HandleMouseDown() {
772 return ShouldSearchForNode();
pfeldman 2017/04/14 00:37:39 As of this moment, don't update hovered_node_for_i
773 }
774
775 bool InspectorOverlay::HandleMouseUp() {
770 if (!ShouldSearchForNode()) 776 if (!ShouldSearchForNode())
771 return false; 777 return false;
772 778
773 if (hovered_node_for_inspect_mode_) { 779 if (hovered_node_for_inspect_mode_) {
774 Inspect(hovered_node_for_inspect_mode_.Get()); 780 Inspect(hovered_node_for_inspect_mode_.Get());
775 hovered_node_for_inspect_mode_.Clear(); 781 hovered_node_for_inspect_mode_.Clear();
776 return true; 782 return true;
777 } 783 }
778 return false; 784 return false;
779 } 785 }
(...skipping 25 matching lines...) Expand all
805 bool InspectorOverlay::ShouldSearchForNode() { 811 bool InspectorOverlay::ShouldSearchForNode() {
806 return inspect_mode_ != InspectorDOMAgent::kNotSearching; 812 return inspect_mode_ != InspectorDOMAgent::kNotSearching;
807 } 813 }
808 814
809 void InspectorOverlay::Inspect(Node* node) { 815 void InspectorOverlay::Inspect(Node* node) {
810 if (dom_agent_) 816 if (dom_agent_)
811 dom_agent_->Inspect(node); 817 dom_agent_->Inspect(node);
812 } 818 }
813 819
814 } // namespace blink 820 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/InspectorOverlay.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698