OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/input/MouseEventManager.h" | 5 #include "core/input/MouseEventManager.h" |
6 | 6 |
7 #include "core/clipboard/DataObject.h" | 7 #include "core/clipboard/DataObject.h" |
8 #include "core/clipboard/DataTransfer.h" | 8 #include "core/clipboard/DataTransfer.h" |
9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
10 #include "core/dom/ElementTraversal.h" | 10 #include "core/dom/ElementTraversal.h" |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
731 if (!layout_object || !layout_object->IsListBox()) | 731 if (!layout_object || !layout_object->IsListBox()) |
732 return WebInputEventResult::kNotHandled; | 732 return WebInputEventResult::kNotHandled; |
733 } | 733 } |
734 | 734 |
735 mouse_down_may_start_drag_ = false; | 735 mouse_down_may_start_drag_ = false; |
736 | 736 |
737 frame_->GetEventHandler().GetSelectionController().HandleMouseDraggedEvent( | 737 frame_->GetEventHandler().GetSelectionController().HandleMouseDraggedEvent( |
738 event, mouse_down_pos_, drag_start_pos_, mouse_press_node_.Get(), | 738 event, mouse_down_pos_, drag_start_pos_, mouse_press_node_.Get(), |
739 last_known_mouse_position_); | 739 last_known_mouse_position_); |
740 | 740 |
741 // The call into handleMouseDraggedEvent may have caused a re-layout, | 741 // The call into HandleMouseDraggedEvent may have caused a re-layout, |
742 // so get the LayoutObject again. | 742 // so get the LayoutObject again. |
743 layout_object = target_node->GetLayoutObject(); | 743 layout_object = target_node->GetLayoutObject(); |
744 | 744 |
745 if (layout_object && mouse_down_may_start_autoscroll_ && | 745 if (layout_object && mouse_down_may_start_autoscroll_ && |
746 !scroll_manager_->MiddleClickAutoscrollInProgress() && | 746 !scroll_manager_->MiddleClickAutoscrollInProgress() && |
747 !frame_->Selection().SelectedHTMLForClipboard().IsEmpty()) { | 747 !frame_->Selection().SelectedHTMLForClipboard().IsEmpty()) { |
748 if (AutoscrollController* controller = | 748 if (AutoscrollController* controller = |
749 scroll_manager_->GetAutoscrollController()) { | 749 scroll_manager_->GetAutoscrollController()) { |
750 controller->StartAutoscrollForSelection(layout_object); | 750 // Avoid updating the lifecycle unless it's possible to autoscroll. |
751 mouse_down_may_start_autoscroll_ = false; | 751 layout_object->GetFrameView()->UpdateAllLifecyclePhasesExceptPaint(); |
752 | |
753 // The lifecycle update above may have invalidated the previous layout. | |
754 if (LayoutObject* next_layout_object = target_node->GetLayoutObject()) { | |
mstensho (USE GERRIT)
2017/04/27 20:16:11
I suppose you could also re-use layout_object, ins
chrishtr
2017/04/28 02:21:34
Done.
| |
755 controller->StartAutoscrollForSelection(next_layout_object); | |
756 mouse_down_may_start_autoscroll_ = false; | |
757 } | |
752 } | 758 } |
753 } | 759 } |
754 | 760 |
755 return WebInputEventResult::kHandledSystem; | 761 return WebInputEventResult::kHandledSystem; |
756 } | 762 } |
757 | 763 |
758 bool MouseEventManager::HandleDrag(const MouseEventWithHitTestResults& event, | 764 bool MouseEventManager::HandleDrag(const MouseEventWithHitTestResults& event, |
759 DragInitiator initiator) { | 765 DragInitiator initiator) { |
760 DCHECK(event.Event().GetType() == WebInputEvent::kMouseMove); | 766 DCHECK(event.Event().GetType() == WebInputEvent::kMouseMove); |
761 // Callers must protect the reference to FrameView, since this function may | 767 // Callers must protect the reference to FrameView, since this function may |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1025 | 1031 |
1026 void MouseEventManager::SetClickCount(int click_count) { | 1032 void MouseEventManager::SetClickCount(int click_count) { |
1027 click_count_ = click_count; | 1033 click_count_ = click_count; |
1028 } | 1034 } |
1029 | 1035 |
1030 bool MouseEventManager::MouseDownMayStartDrag() { | 1036 bool MouseEventManager::MouseDownMayStartDrag() { |
1031 return mouse_down_may_start_drag_; | 1037 return mouse_down_may_start_drag_; |
1032 } | 1038 } |
1033 | 1039 |
1034 } // namespace blink | 1040 } // namespace blink |
OLD | NEW |