Commit 5008ac7c authored by Ella Ge's avatar Ella Ge Committed by Commit Bot

Remove SetCapturingMouseEventsElement

This CL removes function SetCapturingMouseEventsElement().
The only remaining caller are slide thumb element and it's "set capture"
are using SetPointerCapture(kMouseId), so we should use
ReleasePointerCapture here as well.

This CL also removes
event_handler_will_reset_capturing_mouse_events_node_

*will_reset* is a boolean used with capturing_mouse_events_element_
After we remove SetCapturingMouseEventsElement, all remaining setter of
capturing_mouse_events_element_ will set *will_reset_* to true.
Therefore, there is no point to keep *will_reset*

Bug: 919908
Change-Id: Ie1ba43515899a085b82502a907c12d48b3334b1a
Reviewed-on: https://chromium-review.googlesource.com/c/1427220Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarMustaq Ahmed <mustaq@chromium.org>
Reviewed-by: default avatarNavid Zolghadr <nzolghadr@chromium.org>
Commit-Queue: Ella Ge <eirage@chromium.org>
Cr-Commit-Position: refs/heads/master@{#627027}
parent 7c5a5287
......@@ -280,8 +280,10 @@ bool SliderThumbElement::WillRespondToMouseClickEvents() {
void SliderThumbElement::DetachLayoutTree(const AttachContext& context) {
if (in_drag_mode_) {
if (LocalFrame* frame = GetDocument().GetFrame())
frame->GetEventHandler().SetCapturingMouseEventsElement(nullptr);
if (LocalFrame* frame = GetDocument().GetFrame()) {
frame->GetEventHandler().ReleasePointerCapture(
PointerEventFactory::kMouseId, this);
}
}
HTMLDivElement::DetachLayoutTree(context);
}
......
......@@ -149,7 +149,6 @@ EventHandler::EventHandler(LocalFrame& frame)
frame.GetTaskRunner(TaskType::kInternalUserInteraction),
this,
&EventHandler::CursorUpdateTimerFired),
event_handler_will_reset_capturing_mouse_events_node_(0),
should_only_fire_drag_over_event_(false),
event_handler_registry_(
frame_->IsLocalRoot()
......@@ -211,7 +210,6 @@ void EventHandler::Clear() {
mouse_wheel_event_manager_->Clear();
last_show_press_timestamp_.reset();
last_deferred_tap_element_ = nullptr;
event_handler_will_reset_capturing_mouse_events_node_ = false;
should_use_touch_event_adjusted_point_ = false;
touch_adjustment_result_.unique_event_id = 0;
}
......@@ -609,8 +607,7 @@ WebInputEventResult EventHandler::HandleMousePressEvent(
if (mouse_event.button == WebPointerProperties::Button::kNoButton)
return WebInputEventResult::kHandledSuppressed;
if (event_handler_will_reset_capturing_mouse_events_node_)
capturing_mouse_events_element_ = nullptr;
capturing_mouse_events_element_ = nullptr;
mouse_event_manager_->HandleMousePressEventUpdateStates(mouse_event);
if (!frame_->View())
return WebInputEventResult::kNotHandled;
......@@ -643,10 +640,9 @@ WebInputEventResult EventHandler::HandleMousePressEvent(
mouse_event_manager_->SetCapturesDragging(
subframe->GetEventHandler().mouse_event_manager_->CapturesDragging());
if (mouse_event_manager_->MousePressed() &&
mouse_event_manager_->CapturesDragging()) {
mouse_event_manager_->CapturesDragging())
capturing_mouse_events_element_ = mev.InnerElement();
event_handler_will_reset_capturing_mouse_events_node_ = true;
}
mouse_event_manager_->InvalidateClick();
return result;
}
......@@ -837,8 +833,7 @@ WebInputEventResult EventHandler::HandleMouseMoveOrLeaveEvent(
!(mouse_event.GetModifiers() &
WebInputEvent::Modifiers::kRelativeMotionEvent)) {
mouse_event_manager_->ClearDragHeuristicState();
if (event_handler_will_reset_capturing_mouse_events_node_)
capturing_mouse_events_element_ = nullptr;
capturing_mouse_events_element_ = nullptr;
CaptureMouseEventsToWidget(false);
}
......@@ -1036,8 +1031,7 @@ WebInputEventResult EventHandler::HandleMouseReleaseEvent(
mouse_event);
LocalFrame* subframe = event_handling_util::GetTargetSubframe(
mev, capturing_mouse_events_element_.Get());
if (event_handler_will_reset_capturing_mouse_events_node_)
capturing_mouse_events_element_ = nullptr;
capturing_mouse_events_element_ = nullptr;
if (subframe)
return PassMouseReleaseEventToSubframe(mev, subframe);
......@@ -1234,11 +1228,6 @@ void EventHandler::RecomputeMouseHoverState() {
mouse_event_manager_->RecomputeMouseHoverState();
}
void EventHandler::SetCapturingMouseEventsElement(Element* n) {
CaptureMouseEventsToWidget(n);
capturing_mouse_events_element_ = n;
}
Element* EventHandler::EffectiveMouseEventTargetElement(
Element* target_element) {
Element* new_element_under_mouse = target_element;
......
......@@ -112,8 +112,6 @@ class CORE_EXPORT EventHandler final
return mouse_event_manager_->IsMousePositionUnknown();
}
void ClearMouseEventManager() const { mouse_event_manager_->Clear(); }
void SetCapturingMouseEventsElement(
Element*); // A caller is responsible for resetting capturing node to 0.
WebInputEventResult UpdateDragAndDrop(const WebMouseEvent&, DataTransfer*);
void CancelDragAndDrop(const WebMouseEvent&, DataTransfer*);
......@@ -414,7 +412,6 @@ class CORE_EXPORT EventHandler final
TaskRunnerTimer<EventHandler> cursor_update_timer_;
Member<Element> capturing_mouse_events_element_;
bool event_handler_will_reset_capturing_mouse_events_node_;
// Indicates whether the current widget is capturing mouse input.
// Only used for local frame root EventHandlers.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment