#include "ui/events/event_switches.h"
#include "ui/gfx/geometry/dip_util.h"
#include "ui/gfx/geometry/vector2d_f.h"
+#include "ui/ozone/platform/efl/efl_event_handler.h"
#include "ui/platform_window/platform_window_init_properties.h"
#include "web_contents_delegate_efl.h"
#include "web_contents_efl_delegate_ewk.h"
return WebViewDelegateEwk::GetInstance().GetWebViewFromEvasObject(eo);
}
-#if !defined(USE_AURA)
-RenderWidgetHostViewEfl* EWebView::rwhv() const {
- return static_cast<RenderWidgetHostViewEfl*>(
- web_contents_->GetRenderWidgetHostView());
-}
-#endif
-
void EWebView::OnViewFocusIn(void* data, Evas*, Evas_Object*, void*) {
auto view = static_cast<EWebView*>(data);
view->SetFocus(EINA_TRUE);
: context_(context),
evas_object_(object),
native_view_(object),
- touch_events_enabled_(false),
mouse_events_enabled_(false),
text_zoom_factor_(1.0),
formIsNavigating_(false),
void EWebView::HandleTouchEvents(Ewk_Touch_Event_Type type,
const Eina_List* points,
const Evas_Modifier* modifiers) {
-#if !defined(USE_AURA)
const Eina_List* l;
void* data;
EINA_LIST_FOREACH(points, l, data) {
// Chromium doesn't expect (and doesn't like) these events.
continue;
}
- if (rwhv()) {
+ if (rwhva()) {
Evas_Coord_Point pt;
pt.x = point->x;
pt.y = point->y;
+
+ int delta_y = 0;
+ evas_object_geometry_get(evas_object(), nullptr, &delta_y, nullptr,
+ nullptr);
ui::TouchEvent touch_event =
- MakeTouchEvent(pt, point->state, point->id, evas_object());
- rwhv()->HandleTouchEvent(&touch_event);
+ ui::MakeTouchEvent(pt, point->state, point->id, 0, delta_y);
+ rwhva()->OnTouchEvent(&touch_event);
}
}
-#endif
}
bool EWebView::TouchEventsEnabled() const {
- return touch_events_enabled_;
+ return rwhva()->offscreen_helper()->TouchEventsEnabled();
}
// TODO: Touch events use the same mouse events in EFL API.
// Figure out how to distinguish touch and mouse events on touch&mice devices.
// Currently mouse and touch support is mutually exclusive.
void EWebView::SetTouchEventsEnabled(bool enabled) {
- if (touch_events_enabled_ == enabled)
+ if (!rwhva() || !rwhva()->offscreen_helper()) {
+ LOG(WARNING) << "RWHV is not created yet!";
return;
+ }
- touch_events_enabled_ = enabled;
-#if !defined(USE_AURA)
- GetWebContentsViewEfl()->SetTouchEventsEnabled(enabled);
-#endif
-#if !defined(EWK_BRINGUP) // FIXME: m94 bringup
- // there is no flag touch_enabled in web preferences
- GetSettings()->getPreferences().touch_enabled = enabled;
+ if (rwhva()->offscreen_helper()->TouchEventsEnabled() == enabled)
+ return;
+
+ rwhva()->offscreen_helper()->SetTouchEventsEnabled(enabled);
+
+ GetSettings()->getPreferences().touch_event_feature_detection_enabled =
+ enabled;
GetSettings()->getPreferences().double_tap_to_zoom_enabled = enabled;
GetSettings()->getPreferences().editing_behavior =
- enabled ? content::EDITING_BEHAVIOR_ANDROID
- : content::EDITING_BEHAVIOR_UNIX;
-#endif
+ enabled ? blink::mojom::EditingBehavior::kEditingAndroidBehavior
+ : blink::mojom::EditingBehavior::kEditingUnixBehavior,
UpdateWebKitPreferences();
}
}
void EWebView::SetMouseEventsEnabled(bool enabled) {
+ if (!rwhva() || !rwhva()->offscreen_helper()) {
+ LOG(WARNING) << "RWHV is not created yet!";
+ return;
+ }
+
if (mouse_events_enabled_ == enabled)
return;
mouse_events_enabled_ = enabled;
-#if !defined(USE_AURA)
- GetWebContentsViewEfl()->SetTouchEventsEnabled(!enabled);
-#endif
+ rwhva()->offscreen_helper()->SetTouchEventsEnabled(!enabled);
}
namespace {
return true;
}
-void EWebView::set_magnifier(bool status) {
-#if !defined(USE_AURA)
- rwhv()->set_magnifier(status);
-#endif
-}
-
#if BUILDFLAG(IS_TIZEN)
bool EWebView::SetPrivateBrowsing(bool incognito) {
if (context_->GetImpl()->browser_context()->IsOffTheRecord() == incognito)
void EWebView::HandleLongPressGesture(
const content::ContextMenuParams& params) {
-#if !defined(USE_AURA)
// This menu is created in renderer process and it does not now anything about
// view scaling factor and it has another calling sequence, so coordinates is
// not updated.
content::ContextMenuParams convertedParams = params;
gfx::Point convertedPoint =
- rwhv()->ConvertPointInViewPix(gfx::Point(params.x, params.y));
+ rwhva()->offscreen_helper()->ConvertPointInViewPix(
+ gfx::Point(params.x, params.y));
convertedParams.x = convertedPoint.x();
convertedParams.y = convertedPoint.y();
if (show_context_menu_now)
ShowContextMenuInternal(convertedParams);
}
-#endif
}
void EWebView::ShowContextMenu(const content::ContextMenuParams& params) {