#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/events/keycodes/keyboard_code_conversion_x.h"
-#include <Eina.h>
#include <Ecore.h>
-#include <Ecore_Input.h>
#include <Ecore_X.h>
-#include <Evas.h>
// TODO: Figure out how to avoid this includes.
#include <X11/Xutil.h>
namespace {
-inline void TranslateEvasCoordToWebKitCoord(Evas_Object *web_view, int& x, int& y) {
+static void TranslateEvasCoordToWebKitCoord(Evas_Object *web_view, int& x, int& y) {
Evas_Coord tmpX, tmpY;
evas_object_geometry_get(web_view, &tmpX, &tmpY, 0, 0);
x -= tmpX;
}
}
-namespace content {
-
-static WebMouseEvent::Button EflToWebMouseButton(unsigned int eflButton) {
- switch(eflButton) {
- case 1:
- return WebMouseEvent::ButtonLeft;
- case 2:
- return WebMouseEvent::ButtonMiddle;
- case 3:
- return WebMouseEvent::ButtonRight;
- }
-
- return WebMouseEvent::ButtonNone;
-}
-
-static int EflToWebModifiers(unsigned int eflmodifiers, unsigned int eflbuttons) {
- int flags = 0;
- if (eflmodifiers & ECORE_EVENT_MODIFIER_CTRL)
- flags |= WebInputEvent::ControlKey;
-
- if (eflmodifiers & ECORE_EVENT_MODIFIER_SHIFT)
- flags |= WebInputEvent::ShiftKey;
-
- if (eflmodifiers & ECORE_EVENT_MODIFIER_ALT)
- flags |= WebInputEvent::AltKey;
-
- if (eflbuttons == 1)
- flags |= WebInputEvent::LeftButtonDown;
-
- if (eflbuttons == 2)
- flags |= WebInputEvent::MiddleButtonDown;
-
- if (eflbuttons == 3)
- flags |= WebInputEvent::RightButtonDown;
-
- return flags;
-}
-
-WebMouseEvent WebEventFactoryEfl::toWebMouseEvent(const Ecore_Event_Mouse_Button* ev, bool pressed) {
- WebMouseEvent webKitEvent;
- webKitEvent.timeStampSeconds = (double)ev->timestamp / 1000;
- webKitEvent.button = EflToWebMouseButton(ev->buttons);
- webKitEvent.modifiers = EflToWebModifiers(ev->modifiers, pressed ? ev->buttons : 0);
-
- webKitEvent.x = webKitEvent.windowX = ev->x;
- webKitEvent.y = webKitEvent.windowY = ev->y;
- webKitEvent.globalX = ev->root.x;
- webKitEvent.globalY = ev->root.y;
- webKitEvent.type = pressed ? WebInputEvent::MouseDown : WebInputEvent::MouseUp;
- webKitEvent.clickCount = 1;
-
- return webKitEvent;
-}
+namespace content {
static const float cDefaultScrollStep = 20;
-WebMouseWheelEvent WebEventFactoryEfl::toWebMouseEvent(const Ecore_Event_Mouse_Wheel* ev) {
- WebMouseWheelEvent webKitEvent;
- webKitEvent.timeStampSeconds = (double)ev->timestamp / 1000;
- webKitEvent.modifiers = EflToWebModifiers(ev->modifiers, 0);
-
- webKitEvent.x = webKitEvent.windowX = ev->x;
- webKitEvent.y = webKitEvent.windowY = ev->y;
- webKitEvent.globalX = ev->root.x;
- webKitEvent.globalY = ev->root.y;
- webKitEvent.type = WebInputEvent::MouseWheel;
-
- if (ev->direction) {
- webKitEvent.wheelTicksX = ev->z;
- webKitEvent.deltaX = ev->z * cDefaultScrollStep;
- } else {
- webKitEvent.wheelTicksY = -(ev->z);
- webKitEvent.deltaY = -(ev->z * cDefaultScrollStep);
- }
-
- return webKitEvent;
-}
-
-WebMouseEvent WebEventFactoryEfl::toWebMouseEvent(const Ecore_Event_Mouse_Move* ev) {
- WebMouseEvent webKitEvent;
- webKitEvent.timeStampSeconds = (double)ev->timestamp / 1000;
- webKitEvent.modifiers = EflToWebModifiers(ev->modifiers, 0);
-
- webKitEvent.x = webKitEvent.windowX = ev->x;
- webKitEvent.y = webKitEvent.windowY = ev->y;
- webKitEvent.globalX = ev->root.x;
- webKitEvent.globalY = ev->root.y;
- webKitEvent.type = WebInputEvent::MouseMove;
-
- return webKitEvent;
-}
-
-ui::KeyboardCode KeyboardCodeFromEflKey(const char* key) {
+static ui::KeyboardCode KeyboardCodeFromEflKey(const char* key) {
return ui::KeyboardCodeFromXKeysym(XStringToKeysym(key));
}
-int WindowsKeyCodeFromEflKey(const char* key) {
+static int WindowsKeyCodeFromEflKey(const char* key) {
int windows_key_code = KeyboardCodeFromEflKey(key);
if (windows_key_code == ui::VKEY_SHIFT ||
windows_key_code == ui::VKEY_CONTROL ||
return windows_key_code;
}
-int NativeKeyCodeFromEflKey(const char* key) {
+static int NativeKeyCodeFromEflKey(const char* key) {
//return ecore_x_keysym_keycode_get(ev->key);
return XKeysymToKeycode((Display*)ecore_x_display_get(), XStringToKeysym(key));
}
-int CharacterFromEflString(const char* string) {
+static int CharacterFromEflString(const char* string) {
if (string) {
base::string16 result;
base::UTF8ToUTF16(string, strlen(string), &result);
return 0;
}
-content::NativeWebKeyboardEvent WebEventFactoryEfl::toWebKeyboardEvent(const Ecore_Event_Key* ev, bool pressed) {
- content::NativeWebKeyboardEvent webKitEvent;
- webKitEvent.timeStampSeconds = (double)ev->timestamp / 1000;
- webKitEvent.modifiers = EflToWebModifiers(ev->modifiers, 0);
- webKitEvent.type = pressed ? WebInputEvent::KeyDown : WebInputEvent::KeyUp;
-
- webKitEvent.nativeKeyCode = NativeKeyCodeFromEflKey(ev->key);
- webKitEvent.windowsKeyCode = WindowsKeyCodeFromEflKey(ev->key);
-
- if (webKitEvent.windowsKeyCode == ui::VKEY_RETURN)
- webKitEvent.unmodifiedText[0] = '\r';
- else
- webKitEvent.unmodifiedText[0] = CharacterFromEflString(ev->string);
-
- if (webKitEvent.modifiers & blink::WebInputEvent::ControlKey) {
- webKitEvent.text[0] =
- GetControlCharacter(
- webKitEvent.windowsKeyCode,
- webKitEvent.modifiers & blink::WebInputEvent::ShiftKey);
- } else {
- webKitEvent.text[0] = webKitEvent.unmodifiedText[0];
- }
-
- webKitEvent.setKeyIdentifierFromWindowsKeyCode();
-
- return webKitEvent;
-}
-
enum {
LeftButton = 1,
MiddleButton = 2,
return WebMouseEvent::ButtonNone;
}
-static inline WebInputEvent::Modifiers EvasToWebModifiers(const Evas_Modifier* modifiers) {
+static WebInputEvent::Modifiers EvasToWebModifiers(const Evas_Modifier* modifiers) {
unsigned result = 0;
if (evas_key_modifier_is_set(modifiers, "Shift"))
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "ui/events/event.h"
-typedef struct _Ecore_Event_Mouse_Button Ecore_Event_Mouse_Button;
-typedef struct _Ecore_Event_Mouse_Wheel Ecore_Event_Mouse_Wheel;
-typedef struct _Ecore_Event_Mouse_Move Ecore_Event_Mouse_Move;
-typedef struct _Ecore_Event_Key Ecore_Event_Key;
-typedef struct _Evas Evas;
-typedef struct _Evas_Event_Mouse_Down Evas_Event_Mouse_Down;
-typedef struct _Evas_Event_Mouse_Up Evas_Event_Mouse_Up;
-typedef struct _Evas_Event_Mouse_Move Evas_Event_Mouse_Move;
-typedef struct _Evas_Event_Mouse_Wheel Evas_Event_Mouse_Wheel;
-typedef struct _Evas_Event_Key_Down Evas_Event_Key_Down;
-typedef struct _Evas_Event_Key_Up Evas_Event_Key_Up;
+#include <Evas.h>
+
typedef struct _Ewk_Touch_Point Ewk_Touch_Point;
-typedef struct _Evas_Object Evas_Object;
namespace content {
class WebEventFactoryEfl {
public:
- static blink::WebMouseEvent toWebMouseEvent(const Ecore_Event_Mouse_Button*, bool pressed);
- static blink::WebMouseWheelEvent toWebMouseEvent(const Ecore_Event_Mouse_Wheel*);
- static blink::WebMouseEvent toWebMouseEvent(const Ecore_Event_Mouse_Move*);
-
- static content::NativeWebKeyboardEvent toWebKeyboardEvent(const Ecore_Event_Key*, bool pressed);
-
static blink::WebMouseEvent toWebMouseEvent(Evas*, Evas_Object*, const Evas_Event_Mouse_Down*, float scale_factor);
static blink::WebMouseEvent toWebMouseEvent(Evas*, Evas_Object*, const Evas_Event_Mouse_Up*, float scale_factor);
static blink::WebMouseEvent toWebMouseEvent(Evas*, Evas_Object*, const Evas_Event_Mouse_Move*, float scale_factor);
namespace content {
-const int menuHeight = 140;// The Height fo the context menu.
-const int menuPadding = 60;// This is padding for deciding when to modify context menu position.
-//const int spacePadding = 24;// This is for making context menu closer to the handles.
-const int spacePadding = 0;// This is for making context menu closer to the handles.
-const int textSelectionScrollSize = 50;// Scroll step when selection handler is moving out of viewport.
-static int s_magnifierMaxYOffsetDelta = 50;// Magnifier should not show the image below the viewport
-static int s_textSelectionMargin = 5;
+static const int menuHeight = 140;// The Height fo the context menu.
+static const int menuPadding = 60;// This is padding for deciding when to modify context menu position.
+static const int spacePadding = 0; // 24;// This is for making context menu closer to the handles.
+static const int textSelectionScrollSize = 50;// Scroll step when selection handler is moving out of viewport.
static bool IsRectEmpty(const gfx::Rect& rect) {
if (rect.x() == 0 && rect.y() == 0 && rect.height() == 0 && rect.width() == 0) {
SelectionControllerEfl::SelectionControllerEfl(EWebView* parent_view)
: parent_view_(parent_view),
mouse_press_(false),
- long_mouse_press_(false),
scrolling_(false),
+ long_mouse_press_(false),
selection_data_(new SelectionBoxEfl(parent_view)),
start_handle_(new SelectionHandleEfl(this, SelectionHandleEfl::HANDLE_TYPE_LEFT, parent_view->evas_object())),
end_handle_(new SelectionHandleEfl(this, SelectionHandleEfl::HANDLE_TYPE_RIGHT, parent_view->evas_object())),