|
Lines 4-10
a/Tools/DumpRenderTree/efl/EventSender.cpp_sec1
|
| 4 |
* Copyright (C) 2009 Holger Hans Peter Freyther |
4 |
* Copyright (C) 2009 Holger Hans Peter Freyther |
| 5 |
* Copyright (C) 2010 Igalia S.L. |
5 |
* Copyright (C) 2010 Igalia S.L. |
| 6 |
* Copyright (C) 2011 ProFUSION Embedded Systems |
6 |
* Copyright (C) 2011 ProFUSION Embedded Systems |
| 7 |
* Copyright (C) 2011 Samsung Electronics |
7 |
* Copyright (C) 2011, 2012 Samsung Electronics |
| 8 |
* |
8 |
* |
| 9 |
* Redistribution and use in source and binary forms, with or without |
9 |
* Redistribution and use in source and binary forms, with or without |
| 10 |
* modification, are permitted provided that the following conditions |
10 |
* modification, are permitted provided that the following conditions |
|
Lines 103-108
enum ZoomEvent {
a/Tools/DumpRenderTree/efl/EventSender.cpp_sec2
|
| 103 |
ZoomOut |
103 |
ZoomOut |
| 104 |
}; |
104 |
}; |
| 105 |
|
105 |
|
|
|
106 |
struct KeyEventInfo { |
| 107 |
KeyEventInfo(const char* keyName, EvasKeyModifier modifiers) |
| 108 |
: keyName(keyName) |
| 109 |
, modifiers(modifiers) |
| 110 |
{ |
| 111 |
} |
| 112 |
|
| 113 |
const char* keyName; |
| 114 |
EvasKeyModifier modifiers; |
| 115 |
}; |
| 116 |
|
| 106 |
static void setEvasModifiers(Evas* evas, EvasKeyModifier modifiers) |
117 |
static void setEvasModifiers(Evas* evas, EvasKeyModifier modifiers) |
| 107 |
{ |
118 |
{ |
| 108 |
static const char* modifierNames[] = { "Control", "Shift", "Alt", "Super" }; |
119 |
static const char* modifierNames[] = { "Control", "Shift", "Alt", "Super" }; |
|
Lines 399-412
static const char* keyNameFromJSValue(JSStringRef character)
a/Tools/DumpRenderTree/efl/EventSender.cpp_sec3
|
| 399 |
return 0; |
410 |
return 0; |
| 400 |
} |
411 |
} |
| 401 |
|
412 |
|
| 402 |
static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
413 |
static PassOwnPtr<KeyEventInfo> createKeyEventInfo(JSContextRef context, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
| 403 |
{ |
414 |
{ |
| 404 |
Evas_Object* view = ewk_frame_view_get(browser->mainFrame()); |
415 |
if (!ewk_frame_view_get(browser->mainFrame())) |
| 405 |
if (!view) |
416 |
return nullptr; |
| 406 |
return JSValueMakeUndefined(context); |
|
|
| 407 |
|
417 |
|
| 408 |
if (argumentCount < 1) |
418 |
if (argumentCount < 1) |
| 409 |
return JSValueMakeUndefined(context); |
419 |
return nullptr; |
| 410 |
|
420 |
|
| 411 |
// handle location argument. |
421 |
// handle location argument. |
| 412 |
int location = DomKeyLocationStandard; |
422 |
int location = DomKeyLocationStandard; |
|
Lines 415-439
static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS
a/Tools/DumpRenderTree/efl/EventSender.cpp_sec4
|
| 415 |
|
425 |
|
| 416 |
JSRetainPtr<JSStringRef> character(Adopt, JSValueToStringCopy(context, arguments[0], exception)); |
426 |
JSRetainPtr<JSStringRef> character(Adopt, JSValueToStringCopy(context, arguments[0], exception)); |
| 417 |
if (exception && *exception) |
427 |
if (exception && *exception) |
| 418 |
return JSValueMakeUndefined(context); |
428 |
return nullptr; |
| 419 |
|
429 |
|
| 420 |
// send the event |
430 |
EvasKeyModifier modifiers = EvasKeyModifierNone; |
| 421 |
Evas* evas = evas_object_evas_get(view); |
|
|
| 422 |
if (argumentCount >= 2) |
431 |
if (argumentCount >= 2) |
| 423 |
setEvasModifiers(evas, modifiersFromJSValue(context, arguments[1])); |
432 |
modifiers = modifiersFromJSValue(context, arguments[1]); |
| 424 |
|
433 |
|
| 425 |
const CString cCharacter = character.get()->ustring().utf8(); |
434 |
const CString cCharacter = character.get()->ustring().utf8(); |
| 426 |
const char* keyName = (location == DomKeyLocationNumpad) ? keyPadNameFromJSValue(character.get()) : keyNameFromJSValue(character.get()); |
435 |
const char* keyName = (location == DomKeyLocationNumpad) ? keyPadNameFromJSValue(character.get()) : keyNameFromJSValue(character.get()); |
| 427 |
|
|
|
| 428 |
if (!keyName) |
436 |
if (!keyName) |
| 429 |
keyName = cCharacter.data(); |
437 |
keyName = cCharacter.data(); |
| 430 |
|
438 |
|
|
|
439 |
return adoptPtr(new KeyEventInfo(keyName, modifiers)); |
| 440 |
} |
| 441 |
|
| 442 |
static void sendKeyDown(Evas* evas, PassOwnPtr<KeyEventInfo> keyEventInfo) |
| 443 |
{ |
| 444 |
if (!keyEventInfo) |
| 445 |
return; |
| 446 |
|
| 447 |
const char* keyName = keyEventInfo->keyName; |
| 448 |
EvasKeyModifier modifiers = keyEventInfo->modifiers; |
| 449 |
|
| 431 |
DumpRenderTreeSupportEfl::layoutFrame(browser->mainFrame()); |
450 |
DumpRenderTreeSupportEfl::layoutFrame(browser->mainFrame()); |
|
|
451 |
|
| 452 |
ASSERT(evas); |
| 453 |
setEvasModifiers(evas, modifiers); |
| 432 |
evas_event_feed_key_down(evas, keyName, keyName, keyName, 0, 0, 0); |
454 |
evas_event_feed_key_down(evas, keyName, keyName, keyName, 0, 0, 0); |
| 433 |
evas_event_feed_key_up(evas, keyName, keyName, keyName, 0, 1, 0); |
455 |
evas_event_feed_key_up(evas, keyName, keyName, keyName, 0, 1, 0); |
| 434 |
|
|
|
| 435 |
setEvasModifiers(evas, EvasKeyModifierNone); |
456 |
setEvasModifiers(evas, EvasKeyModifierNone); |
| 436 |
|
457 |
|
|
|
458 |
DumpRenderTreeSupportEfl::deliverAllMutationsIfNecessary(); |
| 459 |
} |
| 460 |
|
| 461 |
static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
| 462 |
{ |
| 463 |
OwnPtr<KeyEventInfo> keyEventInfo = createKeyEventInfo(context, argumentCount, arguments, exception); |
| 464 |
sendKeyDown(evas_object_evas_get(browser->mainFrame()), keyEventInfo.release()); |
| 465 |
|
| 437 |
return JSValueMakeUndefined(context); |
466 |
return JSValueMakeUndefined(context); |
| 438 |
} |
467 |
} |
| 439 |
|
468 |
|
|
Lines 508-513
static JSValueRef zoomPageOutCallback(JSContextRef context, JSObjectRef function
a/Tools/DumpRenderTree/efl/EventSender.cpp_sec5
|
| 508 |
return JSValueMakeUndefined(context); |
537 |
return JSValueMakeUndefined(context); |
| 509 |
} |
538 |
} |
| 510 |
|
539 |
|
|
|
540 |
static Eina_Bool sendAsynchronousKeyDown(void* userData) |
| 541 |
{ |
| 542 |
OwnPtr<KeyEventInfo> keyEventInfo = adoptPtr(static_cast<KeyEventInfo*>(userData)); |
| 543 |
sendKeyDown(evas_object_evas_get(browser->mainFrame()), keyEventInfo.release()); |
| 544 |
return ECORE_CALLBACK_CANCEL; |
| 545 |
} |
| 546 |
|
| 547 |
static JSValueRef scheduleAsynchronousKeyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) |
| 548 |
{ |
| 549 |
OwnPtr<KeyEventInfo> keyEventInfo = createKeyEventInfo(context, argumentCount, arguments, exception); |
| 550 |
ecore_idler_add(sendAsynchronousKeyDown, static_cast<void*>(keyEventInfo.leakPtr())); |
| 551 |
return JSValueMakeUndefined(context); |
| 552 |
} |
| 553 |
|
| 511 |
static JSStaticFunction staticFunctions[] = { |
554 |
static JSStaticFunction staticFunctions[] = { |
| 512 |
{ "mouseScrollBy", mouseScrollByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
555 |
{ "mouseScrollBy", mouseScrollByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
| 513 |
{ "continuousMouseScrollBy", continuousMouseScrollByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
556 |
{ "continuousMouseScrollBy", continuousMouseScrollByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
Lines 516-521
static JSStaticFunction staticFunctions[] = {
a/Tools/DumpRenderTree/efl/EventSender.cpp_sec6
|
| 516 |
{ "mouseMoveTo", mouseMoveToCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
559 |
{ "mouseMoveTo", mouseMoveToCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
| 517 |
{ "keyDown", keyDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
560 |
{ "keyDown", keyDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
| 518 |
{ "scheduleAsynchronousClick", scheduleAsynchronousClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
561 |
{ "scheduleAsynchronousClick", scheduleAsynchronousClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
|
|
562 |
{ "scheduleAsynchronousKeyDown", scheduleAsynchronousKeyDownCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
| 519 |
{ "scalePageBy", scalePageByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
563 |
{ "scalePageBy", scalePageByCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
| 520 |
{ "textZoomIn", textZoomInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
564 |
{ "textZoomIn", textZoomInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
| 521 |
{ "textZoomOut", textZoomOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |
565 |
{ "textZoomOut", textZoomOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, |