Index: ui/views/touchui/touch_selection_controller_impl.cc |
diff --git a/ui/views/touchui/touch_selection_controller_impl.cc b/ui/views/touchui/touch_selection_controller_impl.cc |
index 1e80313596406b892fb638a4e9fe3bc6713c5138..201e6d04c8530e48613be392aac8907660e155db 100644 |
--- a/ui/views/touchui/touch_selection_controller_impl.cc |
+++ b/ui/views/touchui/touch_selection_controller_impl.cc |
@@ -237,7 +237,6 @@ class TouchSelectionControllerImpl::EditingHandleView |
draw_invisible_(false), |
weak_ptr_factory_(this) { |
widget_.reset(CreateTouchSelectionPopupWidget(context, this)); |
- widget_->SetContentsView(this); |
aura::Window* window = widget_->GetNativeWindow(); |
window->SetEventTargeter(std::unique_ptr<ui::EventTargeter>( |
@@ -321,6 +320,10 @@ class TouchSelectionControllerImpl::EditingHandleView |
} |
gfx::Size GetPreferredSize() const override { |
+ // This function will be called during widget initialization, i.e. before |
+ // SetBoundInScreen has been called. No-op in that case. |
+ if (selection_bound_.type() == gfx::SelectionBound::EMPTY) |
+ return gfx::Size(); |
return GetSelectionWidgetBounds(selection_bound_).size(); |
} |