Skip to content

Commit e6cd9f9

Browse files
authored
Merge pull request #1166 from emutavchi/developer_mode_fix_wpe-2.38
Fix DEVELOPER_MODE build for Broadcom platform
2 parents 7877902 + 0d4841a commit e6cd9f9

17 files changed

Lines changed: 2908 additions & 18 deletions

Source/cmake/OptionsWPE.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBDRIVER PUBLIC ON)
4444
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_CRYPTO PUBLIC ON)
4545
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XSLT PUBLIC ON)
4646

47-
WEBKIT_OPTION_DEFINE(USE_WPEWEBKIT_PLATFORM_BROADCOM "Whether to enable support for the Broadcom" PUBLIC OFF)
4847
# Private options shared with other WebKit ports. Add options here only if
4948
# we need a value different from the default defined in WebKitFeatures.cmake.
5049
# Changing these options is completely unsupported.
@@ -354,7 +353,6 @@ SET_AND_EXPOSE_TO_BUILD(WTF_PLATFORM_WESTEROS ${USE_WPEWEBKIT_PLATFORM_WESTEROS}
354353
SET_AND_EXPOSE_TO_BUILD(WTF_PLATFORM_BCM_NEXUS ${USE_WPEWEBKIT_PLATFORM_BCM_NEXUS})
355354
SET_AND_EXPOSE_TO_BUILD(WTF_PLATFORM_AMLOGIC ${USE_WPEWEBKIT_PLATFORM_AMLOGIC})
356355
SET_AND_EXPOSE_TO_BUILD(WTF_PLATFORM_RPI ${USE_WPEWEBKIT_PLATFORM_RPI})
357-
SET_AND_EXPOSE_TO_BUILD(WTF_PLATFORM_BROADCOM ${USE_WPEWEBKIT_PLATFORM_BROADCOM})
358356
SET_AND_EXPOSE_TO_BUILD(WTF_PLATFORM_REALTEK ${USE_WPEWEBKIT_PLATFORM_REALTEK})
359357

360358
if (WTF_CPU_ARM OR WTF_CPU_MIPS)

Tools/MiniBrowser/wpe/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ int main(int argc, char *argv[])
309309
g_object_unref(settings);
310310

311311
backendPtr->setInputClient(std::make_unique<InputClient>(loop, webView));
312-
#if defined(ENABLE_ACCESSIBILITY) && ENABLE_ACCESSIBILITY
312+
#if defined(ENABLE_ACCESSIBILITY) && ENABLE_ACCESSIBILITY && defined(USE_ATK) && USE_ATK
313313
auto* accessible = wpe_view_backend_dispatch_get_accessible(wpeBackend);
314314
if (ATK_IS_OBJECT(accessible))
315315
backendPtr->setAccessibleChild(ATK_OBJECT(accessible));

Tools/TestRunnerShared/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
set(TestRunnerShared_LIBRARY_TYPE OBJECT)
2+
set(TestRunnerShared_DEPENDENCIES TestRunnerSharedBindings)
3+
14
WEBKIT_FRAMEWORK_DECLARE(TestRunnerShared)
25

36
set(DumpRenderTree_BINDINGS_DIR ${TOOLS_DIR}/DumpRenderTree/Bindings)
@@ -55,8 +58,5 @@ GENERATE_BINDINGS(TestRunnerSharedBindings
5558
DESTINATION ${TestRunnerShared_DERIVED_SOURCES_DIR}
5659
GENERATOR DumpRenderTree)
5760

58-
set(TestRunnerShared_LIBRARY_TYPE OBJECT)
59-
set(TestRunnerShared_DEPENDENCIES TestRunnerSharedBindings)
60-
6161
WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
6262
WEBKIT_FRAMEWORK(TestRunnerShared)

Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
#include <wtf/RunLoop.h>
3939
#include <wtf/Threading.h>
4040

41+
#if USE(ATK)
42+
#include "AccessibilityNotificationHandlerAtk.h"
43+
#endif
44+
4145
namespace WTR {
4246

4347
#if USE(ATSPI)
@@ -96,6 +100,8 @@ class AccessibilityController : public JSWrappable {
96100

97101
#if PLATFORM(COCOA)
98102
RetainPtr<id> m_globalNotificationHandler;
103+
#elif USE(ATK)
104+
RefPtr<AccessibilityNotificationHandler> m_globalNotificationHandler;
99105
#elif USE(ATSPI)
100106
std::unique_ptr<AccessibilityNotificationHandler> m_globalNotificationHandler;
101107
#endif

Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ OBJC_CLASS NSArray;
4343
OBJC_CLASS NSString;
4444
#include <wtf/RetainPtr.h>
4545
using PlatformUIElement = id;
46+
#elif ENABLE(ACCESSIBILITY) && USE(ATK)
47+
#include "AccessibilityNotificationHandlerAtk.h"
48+
#include <atk/atk.h>
49+
#include <wtf/glib/GRefPtr.h>
50+
typedef GRefPtr<AtkObject> PlatformUIElement;
4651
#elif USE(ATSPI)
4752
namespace WebCore {
4853
class AccessibilityObjectAtspi;
@@ -248,15 +253,15 @@ class AccessibilityUIElement : public JSWrappable {
248253
RefPtr<AccessibilityUIElement> ariaOwnsElementAtIndex(unsigned);
249254
RefPtr<AccessibilityUIElement> ariaFlowToElementAtIndex(unsigned);
250255
RefPtr<AccessibilityUIElement> ariaControlsElementAtIndex(unsigned);
251-
#if PLATFORM(COCOA) || USE(ATSPI)
256+
#if PLATFORM(COCOA) || USE(ATSPI) || USE(ATK)
252257
RefPtr<AccessibilityUIElement> ariaDetailsElementAtIndex(unsigned);
253258
RefPtr<AccessibilityUIElement> ariaErrorMessageElementAtIndex(unsigned);
254259
#else
255260
RefPtr<AccessibilityUIElement> ariaDetailsElementAtIndex(unsigned) { return nullptr; }
256261
RefPtr<AccessibilityUIElement> ariaErrorMessageElementAtIndex(unsigned) { return nullptr; }
257262
#endif
258263

259-
#if USE(ATSPI)
264+
#if USE(ATSPI) || USE(ATK)
260265
RefPtr<AccessibilityUIElement> ariaLabelledByElementAtIndex(unsigned);
261266
RefPtr<AccessibilityUIElement> ariaDescribedByElementAtIndex(unsigned);
262267
RefPtr<AccessibilityUIElement> ariaOwnsReferencingElementAtIndex(unsigned);
@@ -442,7 +447,9 @@ class AccessibilityUIElement : public JSWrappable {
442447
void getChildren(Vector<RefPtr<AccessibilityUIElement> >&);
443448
void getChildrenWithRange(Vector<RefPtr<AccessibilityUIElement> >&, unsigned location, unsigned length);
444449

445-
#if USE(ATSPI)
450+
#if USE(ATK)
451+
RefPtr<AccessibilityNotificationHandler> m_notificationHandler;
452+
#elif USE(ATSPI)
446453
static RefPtr<AccessibilityController> s_controller;
447454
RefPtr<WebCore::AccessibilityObjectAtspi> m_element;
448455
std::unique_ptr<AccessibilityNotificationHandler> m_notificationHandler;

Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
#include "config.h"
2727
#include "InjectedBundle.h"
2828

29+
#if ENABLE(ACCESSIBILITY)
30+
#include "AccessibilityController.h"
31+
#endif
2932
#include "ActivateFonts.h"
3033
#include "DictionaryFunctions.h"
3134
#include "InjectedBundlePage.h"

Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@
3737
#include <wtf/RefPtr.h>
3838
#include <wtf/Vector.h>
3939

40-
#if ENABLE(ACCESSIBILITY)
41-
#include "AccessibilityController.h"
42-
#endif
43-
4440
namespace WTR {
4541

4642
class InjectedBundlePage;
4743

44+
#if ENABLE(ACCESSIBILITY)
45+
class AccessibilityController;
46+
#endif
47+
4848
class InjectedBundle {
4949
public:
5050
static InjectedBundle& singleton();

Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
#include "config.h"
2727
#include "InjectedBundlePage.h"
2828

29+
#if ENABLE(ACCESSIBILITY)
30+
#include "AccessibilityController.h"
31+
#endif
2932
#include "ActivateFonts.h"
3033
#include "InjectedBundle.h"
3134
#include "StringFunctions.h"
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
/*
2+
* Copyright (C) 2012 Igalia S.L.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions are
6+
* met:
7+
*
8+
* * Redistributions of source code must retain the above copyright
9+
* notice, this list of conditions and the following disclaimer.
10+
* * Redistributions in binary form must reproduce the above
11+
* copyright notice, this list of conditions and the following disclaimer
12+
* in the documentation and/or other materials provided with the
13+
* distribution.
14+
*
15+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
*/
27+
28+
#include "config.h"
29+
#include "AccessibilityController.h"
30+
31+
#if ENABLE(ACCESSIBILITY) && USE(ATK)
32+
33+
#include "AccessibilityUIElement.h"
34+
#include "InjectedBundle.h"
35+
#include "InjectedBundlePage.h"
36+
37+
#include <WebKit/WKBundlePagePrivate.h>
38+
#include <atk/atk.h>
39+
#include <cstdio>
40+
#include <wtf/glib/GUniquePtr.h>
41+
#include <wtf/text/StringBuilder.h>
42+
43+
namespace WTR {
44+
45+
void AccessibilityController::resetToConsistentState()
46+
{
47+
m_globalNotificationHandler = nullptr;
48+
}
49+
50+
static AtkObject* childElementById(AtkObject* parent, const char* id)
51+
{
52+
if (!ATK_IS_OBJECT(parent))
53+
return nullptr;
54+
55+
bool parentFound = false;
56+
AtkAttributeSet* attributeSet = atk_object_get_attributes(parent);
57+
for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) {
58+
AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data);
59+
if (!strcmp(attribute->name, "html-id")) {
60+
if (!strcmp(attribute->value, id))
61+
parentFound = true;
62+
break;
63+
}
64+
}
65+
atk_attribute_set_free(attributeSet);
66+
67+
if (parentFound)
68+
return parent;
69+
70+
int childCount = atk_object_get_n_accessible_children(parent);
71+
for (int i = 0; i < childCount; i++) {
72+
AtkObject* result = childElementById(atk_object_ref_accessible_child(parent, i), id);
73+
if (ATK_IS_OBJECT(result))
74+
return result;
75+
}
76+
77+
return nullptr;
78+
}
79+
80+
RefPtr<AccessibilityUIElement> AccessibilityController::accessibleElementById(JSStringRef id)
81+
{
82+
AtkObject* root = ATK_OBJECT(WKAccessibilityRootObject(InjectedBundle::singleton().page()->page()));
83+
if (!root)
84+
return nullptr;
85+
86+
size_t bufferSize = JSStringGetMaximumUTF8CStringSize(id);
87+
GUniquePtr<gchar> idBuffer(static_cast<gchar*>(g_malloc(bufferSize)));
88+
JSStringGetUTF8CString(id, idBuffer.get(), bufferSize);
89+
90+
AtkObject* result = childElementById(root, idBuffer.get());
91+
if (ATK_IS_OBJECT(result))
92+
return AccessibilityUIElement::create(result);
93+
94+
return nullptr;
95+
}
96+
97+
JSRetainPtr<JSStringRef> AccessibilityController::platformName()
98+
{
99+
JSRetainPtr<JSStringRef> platformName(Adopt, JSStringCreateWithUTF8CString("atk"));
100+
return platformName;
101+
}
102+
103+
void AccessibilityController::injectAccessibilityPreference(JSStringRef domain, JSStringRef key, JSStringRef value)
104+
{
105+
}
106+
107+
Ref<AccessibilityUIElement> AccessibilityController::rootElement()
108+
{
109+
WKBundlePageRef page = InjectedBundle::singleton().page()->page();
110+
void* root = WKAccessibilityRootObject(page);
111+
112+
return AccessibilityUIElement::create(static_cast<AtkObject*>(root));
113+
}
114+
115+
RefPtr<AccessibilityUIElement> AccessibilityController::focusedElement()
116+
{
117+
WKBundlePageRef page = InjectedBundle::singleton().page()->page();
118+
void* root = WKAccessibilityFocusedObject(page);
119+
120+
if (!ATK_IS_OBJECT(root))
121+
return nullptr;
122+
123+
return AccessibilityUIElement::create(static_cast<AtkObject*>(root));
124+
}
125+
126+
bool AccessibilityController::addNotificationListener(JSValueRef functionCallback)
127+
{
128+
if (!functionCallback)
129+
return false;
130+
131+
// Only one global notification listener.
132+
if (!m_globalNotificationHandler)
133+
m_globalNotificationHandler = AccessibilityNotificationHandler::create();
134+
m_globalNotificationHandler->setNotificationFunctionCallback(functionCallback);
135+
136+
return true;
137+
}
138+
139+
bool AccessibilityController::removeNotificationListener()
140+
{
141+
// Programmers should not be trying to remove a listener that's already removed.
142+
ASSERT(m_globalNotificationHandler);
143+
144+
m_globalNotificationHandler = nullptr;
145+
return false;
146+
}
147+
148+
} // namespace WTR
149+
150+
#endif // ENABLE(ACCESSIBILITY) && USE(ATK)

0 commit comments

Comments
 (0)