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() {
WebContentsImpl* wci = static_cast<WebContentsImpl*>(&web_contents_);
WebContentsViewEfl* wcve = static_cast<WebContentsViewEfl*>(wci->GetView());
content::ContextMenuParams convertedParams = *(selection_data_->GetContextMenuParams());
+ // If there is no handles on screen, do not show context
+ // menu, but also do not leave selection mode.
+ if (!IsAnyHandleOnScreen())
+ return;
+
int blinkX, blinkY;
if (rwhv)
rwhv->EvasToBlinkCords(convertedParams.x, convertedParams.y, &blinkX, &blinkY);
// Clears the selection and hides context menu and handles
void ClearSelection();
bool ClearSelectionViaEWebView();
- Evas_Object* GetParentView() { return parent_view_; }
+ Evas_Object* GetParentView() const { return parent_view_; }
void HideHandles();
void HideHandleAndContextMenu();
bool IsAnyHandleVisible() const;
+ bool IsAnyHandleOnScreen() const;
void SetScrollStatus(const bool enable);
bool GetScrollStatus();