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

Unified Diff: third_party/WebKit/Source/core/input/MouseEventManager.cpp

Issue 2844593002: Protect against lifecycle updates that delete a layout object for autoscroll (Closed)
Patch Set: none 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/input/MouseEventManager.cpp
diff --git a/third_party/WebKit/Source/core/input/MouseEventManager.cpp b/third_party/WebKit/Source/core/input/MouseEventManager.cpp
index bb8830402e73d69301d291bfbb1026d431ac415c..ee3de2fd7e16001c4e98c6baaa0896d032bfda16 100644
--- a/third_party/WebKit/Source/core/input/MouseEventManager.cpp
+++ b/third_party/WebKit/Source/core/input/MouseEventManager.cpp
@@ -738,7 +738,7 @@ WebInputEventResult MouseEventManager::HandleMouseDraggedEvent(
event, mouse_down_pos_, drag_start_pos_, mouse_press_node_.Get(),
last_known_mouse_position_);
- // The call into handleMouseDraggedEvent may have caused a re-layout,
+ // The call into HandleMouseDraggedEvent may have caused a re-layout,
// so get the LayoutObject again.
layout_object = target_node->GetLayoutObject();
@@ -747,8 +747,14 @@ WebInputEventResult MouseEventManager::HandleMouseDraggedEvent(
!frame_->Selection().SelectedHTMLForClipboard().IsEmpty()) {
if (AutoscrollController* controller =
scroll_manager_->GetAutoscrollController()) {
- controller->StartAutoscrollForSelection(layout_object);
- mouse_down_may_start_autoscroll_ = false;
+ // Avoid updating the lifecycle unless it's possible to autoscroll.
+ layout_object->GetFrameView()->UpdateAllLifecyclePhasesExceptPaint();
+
+ // The lifecycle update above may have invalidated the previous layout.
+ 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.
+ controller->StartAutoscrollForSelection(next_layout_object);
+ mouse_down_may_start_autoscroll_ = false;
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698