return;
}
+ bool is_any_handle_visible = start_selection_.visible() ||
+ end_selection_.visible();
+
// Is in edit field and no text is selected. show only single handle
if (selection_data_->IsInEditField() && left == right) {
if (!GetSelectionEditable())
CHECK(start_selection_ == end_selection_);
- if (GetCaretSelectionStatus() && start_selection_.visible()) {
+ if (GetCaretSelectionStatus() && is_any_handle_visible) {
gfx::Rect left = selection_data_->GetLeftRect();
input_handle_->SetBasePosition(gfx::Point(left.x(), left.y()));
input_handle_->Move(left.bottom_right());
QuerySelectionStyle();
- bool show_context_menu = effective_reason != Reason::ScrollOrZoomGestureEnded &&
+ bool show_context_menu = is_any_handle_visible &&
+ effective_reason != Reason::ScrollOrZoomGestureEnded &&
effective_reason != Reason::Tap &&
effective_reason != Reason::Irrelevant;
if (!handle_being_dragged_ && show_context_menu)
else
end_handle->Hide();
- // Do not show the context menu during selection extend
- if (!handle_being_dragged_ && effective_reason != Reason::Irrelevant)
+ // Do not show the context menu during selection extend and
+ // offscreen selection.
+ if (!handle_being_dragged_ && effective_reason != Reason::Irrelevant &&
+ is_any_handle_visible)
ShowContextMenu();
QuerySelectionStyle();
wcve->QuerySelectionStyle();
}
-bool SelectionControllerEfl::IsAnyHandleOnScreen() const {
- int webview_x, webview_y, webview_width, webview_height;
- evas_object_geometry_get(GetParentView(),
- &webview_x, &webview_y, &webview_width, &webview_height);
-
- gfx::Rect left_handle_rect = selection_data_->GetLeftRect();
- left_handle_rect.Offset(webview_x, webview_y);
-
- gfx::Rect viewport_rect = gfx::Rect(webview_x, webview_y, webview_width, webview_height);
- if (viewport_rect.Contains(left_handle_rect.x(), left_handle_rect.y()))
- return true;
-
- gfx::Rect right_handle_rect = selection_data_->GetRightRect();
- right_handle_rect.Offset(webview_x, webview_y);
- return viewport_rect.Contains(right_handle_rect.x(), right_handle_rect.y());
-}
-
void SelectionControllerEfl::ShowContextMenu() {
- // If there is no handles on screen, do not show context
- // menu, but also do not leave selection mode.
- if (!IsAnyHandleOnScreen())
- return;
-
content::ContextMenuParams convertedParams = *(selection_data_->GetContextMenuParams());
RenderWidgetHostViewEfl* rwhv =