We have an existing mechanism to post-handle tap events.
This mechanism lives in render_view_observer_efl.cc
and is used by the renderer to inform the browser to
play sound in response to clicking a link.
In order to have the context information, an extra hit
test is performed on the renderer side, and browser gets
notified by a message.
In order to eliminate the last client of the hit test
ping-pong messaging in the text selection code, patch
extends the mechanism described above to provided the
information needed by text selection (read is_content_editable),
in addition to the current link information.
Original beta/m42 patch:
- http://165.213.202.130/gerrit/#/c/86093/ , reviewed by
Janusz Majnert, Arnaud Renevier.
Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=6663
Reviewed by: Janusz Majnert
Change-Id: I0b5d7f0b0d457bd89e911a2768ce0c480f331f9b
Signed-off-by: Antonio Gomes <a1.gomes@samsung.com>
SetShowOnlyLargeHandle(true);
}
case ui::ET_GESTURE_SHOW_PRESS: {
- RwhvAsyncRequestHitTestDataInternalCallback* cb =
- new RwhvAsyncRequestHitTestDataInternalCallback(point,
- &SelectionControllerEfl::HandleTapEvent);
- // below call takes full ownership of cb.
- AsyncRequestHitTestDataAtBlinkCords(x, y, cb);
+ // Do not do anything.
break;
}
default:
&& params.src_url.is_empty()
&& params.is_text_node) {
SetSelectionStatus(true);
+ SetSelectionEditable(false);
HandleLongPressEventPrivate(touch_point);
DVLOG(1) << __PRETTY_FUNCTION__ << ":: link, !image, !media, text";
} else if (!params.src_url.is_empty() && params.has_image_contents) {
ShowHandleAndContextMenuIfRequired();
}
-void SelectionControllerEfl::HandleTapEvent(
- const gfx::Point& touch_point,
- const ViewHostMsg_HitTestAsyncReply_Params& params) {
- if (params.isEditable) {
+void SelectionControllerEfl::PostHandleTapGesture(bool is_content_editable) {
+ if (is_content_editable) {
DVLOG(1) << "DispatchPostponedGestureEvent :: Editable";
SetSelectionStatus(true);
if (GetSelectionEditable()){
void HandleLongPressMoveEvent(const gfx::Point& touch_point);
void HandleLongPressEndEvent();
- void HandleTapEvent(const gfx::Point& touch_point,
- const ViewHostMsg_HitTestAsyncReply_Params& params);
+ void PostHandleTapGesture(bool is_content_editable);
// Set if selection is valid
void SetSelectionStatus(bool enable);
web_view_->InvokePlainTextGetCallback(content_text, plain_text_get_callback_id);
}
- void OnPlayLinkEffect() {
+ void OnHandleTapGestureWithContext(bool is_link, bool is_content_editable) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- sound_effect::playLinkEffect();
+ if (!web_view_)
+ return;
+
+ if (is_link && web_view_->GetSettings()->getWebViewSettings().link_effect_enabled)
+ sound_effect::playLinkEffect();
+ web_view_->HandleTapGestureForSelection(is_content_editable);
}
void OnWebAppIconUrlGet(const std::string &icon_url, int callback_id) {
case EwkViewMsg_DidFailLoadWithError::ID:
case EwkViewHostMsg_HitTestAsyncReply::ID:
case EwkHostMsg_PlainTextGetContents::ID:
- case EwkHostMsg_PlayLinkEffect::ID:
+ case EwkHostMsg_HandleTapGestureWithContext::ID:
case EwkHostMsg_WebAppIconUrlGet::ID:
case EwkHostMsg_WebAppIconUrlsGet::ID:
case EwkHostMsg_WebAppCapableGet::ID:
WebViewBrowserMessageFilterPrivate::OnReceivedDidFailLoadWithError)
IPC_MESSAGE_FORWARD(EwkHostMsg_PlainTextGetContents, private_,
WebViewBrowserMessageFilterPrivate::OnPlainTextGetContents)
- IPC_MESSAGE_FORWARD(EwkHostMsg_PlayLinkEffect, private_,
- WebViewBrowserMessageFilterPrivate::OnPlayLinkEffect)
+ IPC_MESSAGE_FORWARD(EwkHostMsg_HandleTapGestureWithContext, private_,
+ WebViewBrowserMessageFilterPrivate::OnHandleTapGestureWithContext)
IPC_MESSAGE_FORWARD(EwkHostMsg_WebAppIconUrlGet, private_,
WebViewBrowserMessageFilterPrivate::OnWebAppIconUrlGet)
IPC_MESSAGE_FORWARD(EwkHostMsg_WebAppIconUrlsGet, private_,
IPC_MESSAGE_ROUTED1(EflViewMsg_UpdateSettings, WebViewSettings)
-IPC_MESSAGE_ROUTED0(EwkHostMsg_PlayLinkEffect)
+IPC_MESSAGE_ROUTED2(EwkHostMsg_HandleTapGestureWithContext,
+ bool /* is_link */,
+ bool /* is_editable_content */)
IPC_MESSAGE_ROUTED2(EwkHostMsg_PlainTextGetContents,
std::string, /* contentText */
return GetSelectionController()->TextSelectionUp(x, y);
}
+void EWebView::HandleTapGestureForSelection(bool is_content_editable) {
+ if (!GetSelectionController())
+ return;
+
+ GetSelectionController()->PostHandleTapGesture(is_content_editable);
+}
+
void EWebView::HandleZoomGesture(blink::WebGestureEvent& event) {
if (event.type == blink::WebInputEvent::GestureDoubleTap ||
event.type == blink::WebInputEvent::GesturePinchBegin) {
void HandleRendererProcessCrash();
void InvokeWebProcessCrashedCallback();
+ void HandleTapGestureForSelection(bool is_content_editable);
void HandleZoomGesture(blink::WebGestureEvent& event);
private:
void RenderViewObserverEfl::HandleTap(const blink::WebGestureEvent& event)
{
- if (link_effect_enabled_) {
- // In order to closely match our touch adjustment logic, we
- // perform a hit test "for tap" using the same "padding" as the
- // original tap event. That way, touch adjustment picks up a link
- // for clicking, we will emit a click sound.
- blink::WebSize size(event.data.tap.width, event.data.tap.height);
- const blink::WebHitTestResult web_hit_test_result =
- render_view()->GetWebView()->hitTestResultForTap(
- blink::WebPoint(event.x, event.y), size);
-
- if (!web_hit_test_result.absoluteLinkURL().isEmpty()) {
- // we are on a link
- Send(new EwkHostMsg_PlayLinkEffect(render_view()->GetRoutingID()));
- }
- }
+ // In order to closely match our touch adjustment logic, we
+ // perform a hit test "for tap" using the same "padding" as the
+ // original tap event. That way, touch adjustment picks up a link
+ // for clicking, we will emit a click sound.
+ blink::WebSize size(event.data.tap.width, event.data.tap.height);
+ const blink::WebHitTestResult web_hit_test_result =
+ render_view()->GetWebView()->hitTestResultForTap(
+ blink::WebPoint(event.x, event.y), size);
+
+ bool hit_link = !web_hit_test_result.absoluteLinkURL().isEmpty();
+ bool hit_content_editable = web_hit_test_result.isContentEditable();
+ Send(new EwkHostMsg_HandleTapGestureWithContext(render_view()->GetRoutingID(),
+ hit_link, hit_content_editable));
}