Skip to content

Commit fc91426

Browse files
author
Piotr Marcinkowski
committed
[wpe-2.38] [OIPF] Add window.KeyEvent interface with VK keys mapping
This change is required by Britbox application to properly handle seek/play/pause
1 parent eb1c70d commit fc91426

9 files changed

Lines changed: 132 additions & 0 deletions

File tree

Source/WebCore/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,15 @@ set(WebCore_NON_SVG_IDL_FILES
13131313
xml/XSLTProcessor.idl
13141314
)
13151315

1316+
if (ENABLE_OIPF_VK)
1317+
list(APPEND WebCore_NON_SVG_IDL_FILES
1318+
page/VkConsts.idl
1319+
)
1320+
list(APPEND WebCore_UNIFIED_SOURCE_LIST_FILES
1321+
SourcesOIPF.txt
1322+
)
1323+
endif ()
1324+
13161325
set(WebCore_SVG_IDL_FILES
13171326
svg/Document+SVG.idl
13181327
svg/SVGAElement.idl

Source/WebCore/SourcesOIPF.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
page/VkConsts.cpp

Source/WebCore/page/DOMWindow.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@
134134
#include <wtf/URL.h>
135135
#include <wtf/text/WTFString.h>
136136

137+
#if ENABLE(OIPF_VK)
138+
#include "VkConsts.h"
139+
#endif
140+
137141
#if ENABLE(USER_MESSAGE_HANDLERS)
138142
#include "UserContentController.h"
139143
#include "UserMessageHandlerDescriptor.h"
@@ -354,6 +358,18 @@ FloatRect DOMWindow::adjustWindowRect(Page& page, const FloatRect& pendingChange
354358
return window;
355359
}
356360

361+
#if ENABLE(OIPF_VK)
362+
RefPtr<VkConsts> DOMWindow::keyEvent()
363+
{
364+
if (!isCurrentlyDisplayedInFrame())
365+
return nullptr;
366+
if (!m_keyEvent)
367+
m_keyEvent = VkConsts::create(*this);
368+
369+
return m_keyEvent;
370+
}
371+
#endif
372+
357373
bool DOMWindow::allowPopUp(Frame& firstFrame)
358374
{
359375
if (DocumentLoader* documentLoader = firstFrame.loader().documentLoader()) {

Source/WebCore/page/DOMWindow.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ class WebCoreOpaqueRoot;
8989
class WebKitNamespace;
9090
class WebKitPoint;
9191

92+
#if ENABLE(OIPF_VK)
93+
class VkConsts;
94+
#endif
95+
9296
#if ENABLE(DEVICE_ORIENTATION)
9397
class DeviceMotionController;
9498
class DeviceOrientationController;
@@ -162,6 +166,10 @@ class DOMWindow final
162166

163167
static FloatRect adjustWindowRect(Page&, const FloatRect& pendingChanges);
164168

169+
#if ENABLE(OIPF_VK)
170+
RefPtr<VkConsts> keyEvent();
171+
#endif
172+
165173
bool allowPopUp(); // Call on first window, not target window.
166174
static bool allowPopUp(Frame& firstFrame);
167175
static bool canShowModalDialog(const Frame&);
@@ -462,6 +470,9 @@ class DOMWindow final
462470
mutable RefPtr<BarProp> m_toolbar;
463471
mutable RefPtr<Location> m_location;
464472
mutable RefPtr<VisualViewport> m_visualViewport;
473+
#if ENABLE(OIPF_VK)
474+
mutable RefPtr<VkConsts> m_keyEvent;
475+
#endif
465476

466477
String m_status;
467478
String m_defaultStatus;

Source/WebCore/page/DOMWindow.idl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@
124124
// Internal operations, not exposed to the Web.
125125
[EnabledForWorld=shadowRootIsAlwaysOpen] NodeList collectMatchingElementsInFlatTree(Node scope, DOMString selectors);
126126
[EnabledForWorld=shadowRootIsAlwaysOpen] Element? matchingElementInFlatTree(Node scope, DOMString selectors);
127+
128+
#if defined(ENABLE_OIPF_VK) && ENABLE_OIPF_VK
129+
readonly attribute VkConsts KeyEvent;
130+
#endif
127131
};
128132

129133
[

Source/WebCore/page/VkConsts.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include "VkConsts.h"
2+
3+
namespace WebCore {
4+
5+
VkConsts::VkConsts(DOMWindow& window)
6+
: DOMWindowProperty(&window)
7+
{
8+
}
9+
10+
} // namespace WebCore

Source/WebCore/page/VkConsts.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#ifndef VKCONSTS_H
2+
#define VKCONSTS_H
3+
4+
#include "config.h"
5+
#include "DOMWindowProperty.h"
6+
#include <wtf/RefCounted.h>
7+
8+
namespace WebCore {
9+
10+
class VkConsts final : public RefCounted<VkConsts>, public DOMWindowProperty {
11+
public:
12+
static Ref<VkConsts> create(DOMWindow& window) { return adoptRef(*new VkConsts(window)); }
13+
14+
private:
15+
explicit VkConsts(DOMWindow&);
16+
};
17+
} // namespace WebCore
18+
19+
#endif // VKCONSTS_H

Source/WebCore/page/VkConsts.idl

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
[
2+
Exposed=Window,
3+
DoNotCheckConstants
4+
] interface VkConsts {
5+
const long VK_ENTER = 13;
6+
const long VK_LEFT = 37;
7+
const long VK_UP = 38;
8+
const long VK_RIGHT = 39;
9+
const long VK_DOWN = 40;
10+
const long VK_SPACE = 32;
11+
const long VK_BACK_SPACE = 8;
12+
const long VK_0 = 48;
13+
const long VK_1 = 49;
14+
const long VK_2 = 50;
15+
const long VK_3 = 51;
16+
const long VK_4 = 52;
17+
const long VK_5 = 53;
18+
const long VK_6 = 54;
19+
const long VK_7 = 55;
20+
const long VK_8 = 56;
21+
const long VK_9 = 57;
22+
const long VK_A = 65;
23+
const long VK_B = 66;
24+
const long VK_C = 67;
25+
const long VK_D = 68;
26+
const long VK_E = 69;
27+
const long VK_F = 70;
28+
const long VK_G = 71;
29+
const long VK_H = 72;
30+
const long VK_I = 73;
31+
const long VK_J = 74;
32+
const long VK_K = 75;
33+
const long VK_L = 76;
34+
const long VK_M = 77;
35+
const long VK_N = 78;
36+
const long VK_O = 79;
37+
const long VK_P = 80;
38+
const long VK_Q = 81;
39+
const long VK_R = 82;
40+
const long VK_S = 83;
41+
const long VK_T = 84;
42+
const long VK_U = 85;
43+
const long VK_V = 86;
44+
const long VK_W = 87;
45+
const long VK_X = 88;
46+
const long VK_Y = 89;
47+
const long VK_Z = 90;
48+
const long VK_RED = 403;
49+
const long VK_GREEN = 404;
50+
const long VK_YELLOW = 405;
51+
const long VK_BLUE = 406;
52+
const long VK_HELP = 47;
53+
const long VK_PLAY = 250;
54+
const long VK_PAUSE = 19;
55+
const long VK_PLAY_PAUSE = 179;
56+
const long VK_STOP = 178;
57+
const long VK_FAST_FWD = 228;
58+
const long VK_REWIND = 227;
59+
const long VK_BACK = 27;
60+
const long VK_CONTEXT_MENU = 93;
61+
};

Source/cmake/OptionsWPE.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ WEBKIT_OPTION_DEPEND(ENABLE_DOCUMENTATION ENABLE_INTROSPECTION)
104104
WEBKIT_OPTION_DEFINE(USE_GSTREAMER_HOLEPUNCH "Whether to enable GStreamer holepunch" PRIVATE OFF)
105105
WEBKIT_OPTION_DEFINE(USE_EXTERNAL_HOLEPUNCH "Whether to enable external holepunch" PRIVATE OFF)
106106
WEBKIT_OPTION_DEFINE(ENABLE_ACCELERATED_2D_CANVAS "Whether to enable accelerated 2D canvas" PRIVATE OFF)
107+
WEBKIT_OPTION_DEFINE(ENABLE_OIPF_VK "Whether to enable OIPF keys for DAE applications" PRIVATE OFF)
107108

108109
# Supported platforms.
109110
WEBKIT_OPTION_DEFINE(USE_WPEWEBKIT_PLATFORM_WESTEROS "Whether to enable support for the Westeros platform" PUBLIC OFF)

0 commit comments

Comments
 (0)