Chromium-efl enters selection mode by a long press gesture.
Such event is only triggered when touch events are enabled.
The upstream counterpart of our SelectionControllerEfl
class is TouchSelectionController (see
ui/touch_selection/touch_selection_controller.cc).
As the name implies, its logic is also tied to touch events.
Patch decouples our context menu logic from the
SelectionControllerEfl class, tying it up to touch
event status. This allows context menus to be shown on
TV and desktop builds.
Original beta/m47 patches:
- http://165.213.202.130/gerrit/#/c/99552/
- http://165.213.202.130/gerrit/#/c/100348/
- http://165.213.202.130/gerrit/#/c/100324/
Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=15220
Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=15393
Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=15414
Reviewed by: g.czajkowski
Change-Id: I949afb612d3fb0806d95c865d34d51101014734b
Signed-off-by: Antonio Gomes <a1.gomes@samsung.com>
// initialized after evas_ is valid
im_context_ = IMContextEfl::Create(this);
- selection_controller_.reset(new SelectionControllerEfl(
- smart_parent_, web_contents_));
-
Init_EvasGL(width, height);
}
}
void RenderWidgetHostViewEfl::SetTouchEventsEnabled(bool enabled) {
+ if (enabled == touch_events_enabled_)
+ return;
+
touch_events_enabled_ = enabled;
SetDoubleTapSupportEnabled(enabled);
+
+ if (enabled) {
+ selection_controller_.reset(new SelectionControllerEfl(
+ smart_parent_, web_contents_));
+ } else {
+ selection_controller_.reset();
+ }
}
void RenderWidgetHostViewEfl::set_magnifier(bool status) {
}
SelectionControllerEfl::~SelectionControllerEfl() {
+ if (GetSelectionStatus())
+ ClearSelectionViaEWebView();
+ HideHandleAndContextMenu();
+
evas_object_event_callback_del(parent_view_, EVAS_CALLBACK_MOVE, &EvasParentViewMoveCallback);
}
return false;
}
- SelectionControllerEfl* controller = webview_->GetSelectionController();
- if (!controller) {
- DeletePopup();
- return false;
- }
-
- int draw_direction;
- controller->ChangeContextMenuPosition(popup_position, draw_direction);
+ int draw_direction = 0;
+ if (SelectionControllerEfl* controller = webview_->GetSelectionController())
+ controller->ChangeContextMenuPosition(popup_position, draw_direction);
if ((popup_position.y() > webview_height + webview_y) ||
(popup_position.x() > webview_width + webview_x))
context_menu_.reset(new content::ContextMenuControllerEfl(this, *web_contents_.get()));
if (!context_menu_->PopulateAndShowContextMenu(params)) {
context_menu_.reset();
- GetSelectionController()->HideHandles();
+ if (GetSelectionController())
+ GetSelectionController()->HideHandles();
}
}
ResetContextMenuController();
rwhv()->SelectionChanged(base::string16(), 0, gfx::Range());
- return GetSelectionController()->ClearSelectionViaEWebView() ? EINA_TRUE : EINA_FALSE;
+
+ if (GetSelectionController())
+ return GetSelectionController()->ClearSelectionViaEWebView();
+
+ return EINA_FALSE;
}
_Ewk_Hit_Test* EWebView::RequestHitTestDataAt(int x, int y,