diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-11 13:45:28 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-11 13:45:28 +0200 |
commit | d6a599dbc9d824a462b2b206316e102bf8136446 (patch) | |
tree | ecb257a5e55b2239d74b90fdad62fccd661cf286 /Source/WebKit/efl | |
parent | 3ccc3a85f09a83557b391aae380d3bf5f81a2911 (diff) | |
download | qtwebkit-d6a599dbc9d824a462b2b206316e102bf8136446.tar.gz |
Imported WebKit commit 8ff1f22783a32de82fee915abd55bd1b298f2644 (http://svn.webkit.org/repository/webkit/trunk@122325)
New snapshot that should work with the latest Qt build system changes
Diffstat (limited to 'Source/WebKit/efl')
25 files changed, 1229 insertions, 208 deletions
diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog index 2a675753b..141f8bf1b 100644 --- a/Source/WebKit/efl/ChangeLog +++ b/Source/WebKit/efl/ChangeLog @@ -1,3 +1,357 @@ +2012-07-10 Adam Barth <abarth@webkit.org> + + LayoutTestController.dumpConfigurationForViewport should move to Internals + https://bugs.webkit.org/show_bug.cgi?id=45652 + + Reviewed by Eric Seidel. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + * WebCoreSupport/DumpRenderTreeSupportEfl.h: + +2012-07-09 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] Battery status code needs refactoring to be reused in WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=90760 + + Reviewed by Hajime Morita. + + Add BatteryClientEfl to WebKit, which uses BatteryProviderEfl from + WebCore internally. + + * WebCoreSupport/BatteryClientEfl.cpp: Added. + (BatteryClientEfl::BatteryClientEfl): + (BatteryClientEfl::setController): + (BatteryClientEfl::startUpdating): + (BatteryClientEfl::stopUpdating): + (BatteryClientEfl::batteryControllerDestroyed): + (BatteryClientEfl::didChangeBatteryStatus): + * WebCoreSupport/BatteryClientEfl.h: Renamed from Source/WebCore/platform/efl/BatteryClientEfl.h. + (WebCore): + (BatteryClientEfl): + (BatteryClientEfl::~BatteryClientEfl): + * ewk/ewk_view.cpp: + (_ewk_view_priv_new): + +2012-07-09 Adam Klein <adamk@chromium.org> + + Rename WebCore::WebKitMutationObserver to WebCore::MutationObserver + https://bugs.webkit.org/show_bug.cgi?id=90810 + + Reviewed by Ojan Vafai. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + (DumpRenderTreeSupportEfl::deliverAllMutationsIfNecessary): + +2012-07-09 Krzysztof Czech <k.czech@samsung.com> + + [EFL] Simplify runTest function by defining default arguments. + https://bugs.webkit.org/show_bug.cgi?id=90525 + + Reviewed by Chang Shu. + + Default arguments will simplify macro RUN_TEST. + Function will only have one mandatory argument, callback test function. + Added static modifiers to callback functions. + + * tests/UnitTestUtils/EWKTestBase.h: + (EWKTestBase): + * tests/test_ewk_view.cpp: + (ewkViewEditableGetCb): + (TEST): + (ewkViewUriGetCb): + +2012-07-08 Christophe Dumez <christophe.dumez@intel.com> + + [EFL] REGRESSION (r122035): fullscreen/exit-full-screen-iframe.html is crashing + https://bugs.webkit.org/show_bug.cgi?id=90735 + + Reviewed by Antonio Gomes. + + Keep a reference to the Element passed to enterFullScreenForElement() so + that we can reuse it later in exitFullScreenForElement(). This is needed + because the Element passed to exitFullScreenForElement() may be null. + This fixes the crash for the fullscreen/exit-full-screen-iframe.html + test introduced in r122035. + + * WebCoreSupport/ChromeClientEfl.cpp: + (WebCore::ChromeClientEfl::enterFullScreenForElement): + (WebCore::ChromeClientEfl::exitFullScreenForElement): + * WebCoreSupport/ChromeClientEfl.h: + (ChromeClientEfl): + +2012-07-07 Jinwoo Song <jinwoo7.song@samsung.com> + + [EFL] Fix build break when Accelerated Compositing is on. + https://bugs.webkit.org/show_bug.cgi?id=90718 + + Unreviewed build fix. + + ewk_view_accelerated_compositing_XXX APIs are in ewk_view_private.h + + * WebCoreSupport/PageClientEfl.cpp: + (PageClientEfl::createEvasObjectForAcceleratedCompositing): + (PageClientEfl::acceleratedCompositingContext): + * WebCoreSupport/PageClientEfl.h: + (PageClientEfl): + +2012-07-06 Seokju Kwon <seokju.kwon@samsung.com> + + [EFL] Add Web Inspector to WebKit-EFL + https://bugs.webkit.org/show_bug.cgi?id=83865 + + Reviewed by Pavel Feldman. + + EFL port implementation for Web Inspector. + Implementation of InspectorClientEfl and InspectorFrontendClientEfl + for using the Web Inspector in WebKit-EFL with new EWK APIs. + + * WebCoreSupport/InspectorClientEfl.cpp: + (WebCore::notifyWebInspectorDestroy): + (WebCore): + (InspectorFrontendSettingsEfl): + (WebCore::InspectorFrontendSettingsEfl::getProperty): + (WebCore::InspectorFrontendSettingsEfl::setProperty): + (WebCore::InspectorClientEfl::InspectorClientEfl): + (WebCore::InspectorClientEfl::~InspectorClientEfl): + (WebCore::InspectorClientEfl::inspectorDestroyed): + (WebCore::InspectorClientEfl::openInspectorFrontend): + (WebCore::InspectorClientEfl::closeInspectorFrontend): + (WebCore::InspectorClientEfl::bringFrontendToFront): + (WebCore::InspectorClientEfl::sendMessageToFrontend): + (WebCore::InspectorClientEfl::releaseFrontendPage): + (WebCore::InspectorClientEfl::inspectorFilesPath): + (WebCore::InspectorFrontendClientEfl::InspectorFrontendClientEfl): + (WebCore::InspectorFrontendClientEfl::~InspectorFrontendClientEfl): + (WebCore::InspectorFrontendClientEfl::localizedStringsURL): + (WebCore::InspectorFrontendClientEfl::hiddenPanels): + (WebCore::InspectorFrontendClientEfl::bringToFront): + (WebCore::InspectorFrontendClientEfl::closeWindow): + (WebCore::InspectorFrontendClientEfl::inspectedURLChanged): + (WebCore::InspectorFrontendClientEfl::attachWindow): + (WebCore::InspectorFrontendClientEfl::detachWindow): + (WebCore::InspectorFrontendClientEfl::setAttachedWindowHeight): + (WebCore::InspectorFrontendClientEfl::destroyInspectorWindow): + * WebCoreSupport/InspectorClientEfl.h: + (WebCore): + (InspectorClientEfl): + (InspectorFrontendClientEfl): + (WebCore::InspectorFrontendClientEfl::disconnectInspectorClient): + * ewk/ewk_view.cpp: + (_Ewk_View_Private_Data): + (_ewk_view_priv_new): + (ewk_view_web_inspector_show): + (ewk_view_web_inspector_close): + (ewk_view_web_inspector_view_get): + (ewk_view_web_inspector_view_set): + * ewk/ewk_view.h: + +2012-07-05 Kihong Kwon <kihong.kwon@samsung.com> + + [EFL] Change class name from NotificationClientEfl to NotificationPresenterClientEfl. + https://bugs.webkit.org/show_bug.cgi?id=90542 + + Reviewed by Kenneth Rohde Christiansen. + + Change class name from NotificationClientEfl to NotificationPresenterClientEfl + to be in line with other ports.(qt, chromium, blackberry) + + * WebCoreSupport/ChromeClientEfl.cpp: + * WebCoreSupport/NotificationPresenterClientEfl.cpp: Renamed from Source/WebKit/efl/WebCoreSupport/NotificationClientEfl.cpp. + (WebCore): + (WebCore::NotificationPresenterClientEfl::NotificationPresenterClientEfl): + (WebCore::NotificationPresenterClientEfl::~NotificationPresenterClientEfl): + (WebCore::NotificationPresenterClientEfl::show): + (WebCore::NotificationPresenterClientEfl::cancel): + (WebCore::NotificationPresenterClientEfl::notificationObjectDestroyed): + (WebCore::NotificationPresenterClientEfl::notificationControllerDestroyed): + (WebCore::NotificationPresenterClientEfl::requestPermission): + (WebCore::NotificationPresenterClientEfl::checkPermission): + (WebCore::NotificationPresenterClientEfl::cancelRequestsForPermission): + * WebCoreSupport/NotificationPresenterClientEfl.h: Renamed from Source/WebKit/efl/WebCoreSupport/NotificationClientEfl.h. + (WebCore): + (NotificationPresenterClientEfl): + +2012-07-02 Benjamin Poulain <bpoulain@apple.com> + + Do not do any logging initialization when logging is disabled + https://bugs.webkit.org/show_bug.cgi?id=90228 + + Reviewed by Simon Fraser. + + * ewk/ewk_main.cpp: + (_ewk_init_body): + +2012-07-02 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [EFL] Rename NotificationPresenterEfl with NotificationClientEfl + https://bugs.webkit.org/show_bug.cgi?id=90370 + + Reviewed by Csaba Osztrogonác. + + Bug 80488 renamed NotificationPresenter with NotificationClient. So, EFL port needs to adjust it as well. + + * WebCoreSupport/ChromeClientEfl.cpp: + * WebCoreSupport/NotificationClientEfl.cpp: Renamed from Source/WebKit/efl/WebCoreSupport/NotificationPresenterClientEfl.cpp. + (WebCore): + (WebCore::NotificationClientEfl::NotificationClientEfl): + (WebCore::NotificationClientEfl::~NotificationClientEfl): + (WebCore::NotificationClientEfl::show): + (WebCore::NotificationClientEfl::cancel): + (WebCore::NotificationClientEfl::notificationObjectDestroyed): + (WebCore::NotificationClientEfl::notificationControllerDestroyed): + (WebCore::NotificationClientEfl::requestPermission): + (WebCore::NotificationClientEfl::checkPermission): + (WebCore::NotificationClientEfl::cancelRequestsForPermission): + * WebCoreSupport/NotificationClientEfl.h: Renamed from Source/WebKit/efl/WebCoreSupport/NotificationPresenterClientEfl.h. + (WebCore): + (NotificationClientEfl): + +2012-06-29 Krzysztof Czech <k.czech@samsung.com>, Tomasz Morawski <t.morawski@samsung.com> + + [EFL] Implementation of testing framework and unit tests for WebKit-EFL port. + https://bugs.webkit.org/show_bug.cgi?id=68509 + + Reviewed by Chang Shu. + + Testing framework is based on gtest library. Gtest library is part of the WebKit project. Framework is devided into base part and view part. + Base part takes care of efl initialization, defines test macros and prepares test to run. View part is a context of each test. + + * tests/UnitTestUtils/EWKTestBase.cpp: Added. + (EWKUnitTests): + (EWKUnitTests::EWKTestBase::init): + (EWKUnitTests::EWKTestBase::shutdown): + (EWKUnitTests::EWKTestBase::shutdownAll): + (EWKUnitTests::EWKTestBase::startTest): + (EWKUnitTests::EWKTestBase::endTest): + (EWKUnitTests::EWKTestBase::createTest): + (EWKUnitTests::EWKTestBase::runTest): + * tests/UnitTestUtils/EWKTestBase.h: Added. + (EWKUnitTests): + (EWKTestBase): + * tests/UnitTestUtils/EWKTestConfig.h: Added. + (Config): + * tests/UnitTestUtils/EWKTestView.cpp: Added. + (EWKUnitTests): + (EWKUnitTests::EWKTestEcoreEvas::EWKTestEcoreEvas): + (EWKUnitTests::EWKTestEcoreEvas::evas): + (EWKUnitTests::EWKTestEcoreEvas::show): + (EWKUnitTests::EWKTestView::EWKTestView): + (EWKUnitTests::EWKTestView::init): + (EWKUnitTests::EWKTestView::show): + (EWKUnitTests::EWKTestView::mainFrame): + (EWKUnitTests::EWKTestView::evas): + (EWKUnitTests::EWKTestView::bindEvents): + * tests/UnitTestUtils/EWKTestView.h: Added. + (EWKUnitTests): + (EWKTestEcoreEvas): + (EWKTestView): + (EWKUnitTests::EWKTestView::webView): + * tests/resources/default_test_page.html: Added. + * tests/test_ewk_view.cpp: Added. + (ewkViewEditableGetCb): + (TEST): + (ewkViewUriGetCb): + * tests/test_runner.cpp: Added. + (parseCustomArguments): + (main): + +2012-06-29 Konrad Piascik <kpiascik@rim.com> + + Don't hardcode target dpi of 160 (it should be 96 on desktop) + https://bugs.webkit.org/show_bug.cgi?id=88114 + + Reviewed by Adam Barth. + + Updated the call to computeViewportAttributes. + + * WebCoreSupport/DumpRenderTreeSupportEfl.cpp: + (DumpRenderTreeSupportEfl::dumpConfigurationForViewport): + * ewk/ewk_view.cpp: + (_ewk_view_viewport_attributes_compute): + +2012-06-27 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r121398. + http://trac.webkit.org/changeset/121398 + https://bugs.webkit.org/show_bug.cgi?id=90136 + + broke efl build (Requested by ryuan on #webkit). + + * tests/UnitTestUtils/EWKTestBase.cpp: Removed. + * tests/UnitTestUtils/EWKTestBase.h: Removed. + * tests/UnitTestUtils/EWKTestConfig.h: Removed. + * tests/UnitTestUtils/EWKTestView.cpp: Removed. + * tests/UnitTestUtils/EWKTestView.h: Removed. + * tests/resources/default_test_page.html: Removed. + * tests/test_ewk_view.cpp: Removed. + * tests/test_runner.cpp: Removed. + +2012-06-27 Krzysztof Czech <k.czech@samsung.com> + + [EFL] Implementation of testing framework and unit tests for WebKit-EFL port. + https://bugs.webkit.org/show_bug.cgi?id=68509 + + Reviewed by Chang Shu. + + Testing framework is based on gtest library. Gtest library is part of the WebKit project. Framework is devided into base part and view part. + Base part takes care of efl initialization, defines test macros and prepares test to run. View part is a context of each test. + + * tests/UnitTestUtils/EWKTestBase.cpp: Added. + (EWKUnitTests): + (EWKUnitTests::EWKTestBase::init): + (EWKUnitTests::EWKTestBase::shutdown): + (EWKUnitTests::EWKTestBase::shutdownAll): + (EWKUnitTests::EWKTestBase::startTest): + (EWKUnitTests::EWKTestBase::endTest): + (EWKUnitTests::EWKTestBase::createTest): + (EWKUnitTests::EWKTestBase::runTest): + * tests/UnitTestUtils/EWKTestBase.h: Added. + (EWKUnitTests): + (EWKTestBase): + * tests/UnitTestUtils/EWKTestConfig.h: Added. + (Config): + * tests/UnitTestUtils/EWKTestView.cpp: Added. + (EWKUnitTests): + (EWKUnitTests::EWKTestEcoreEvas::EWKTestEcoreEvas): + (EWKUnitTests::EWKTestEcoreEvas::evas): + (EWKUnitTests::EWKTestEcoreEvas::show): + (EWKUnitTests::EWKTestView::EWKTestView): + (EWKUnitTests::EWKTestView::init): + (EWKUnitTests::EWKTestView::show): + (EWKUnitTests::EWKTestView::mainFrame): + (EWKUnitTests::EWKTestView::evas): + (EWKUnitTests::EWKTestView::bindEvents): + * tests/UnitTestUtils/EWKTestView.h: Added. + (EWKUnitTests): + (EWKTestEcoreEvas): + (EWKTestView): + (EWKUnitTests::EWKTestView::webView): + * tests/resources/default_test_page.html: Added. + * tests/test_ewk_view.cpp: Added. + (ewkViewEditableGetCb): + (TEST): + (ewkViewUriGetCb): + * tests/test_runner.cpp: Added. + (parseCustomArguments): + (main): + +2012-06-25 Mark Hahnenberg <mhahnenberg@apple.com> + + JSLock should be per-JSGlobalData + https://bugs.webkit.org/show_bug.cgi?id=89123 + + Reviewed by Geoffrey Garen. + + Changed all sites that used JSLock to instead use the new JSLockHolder + and pass in the correct JS context that the code is about to interact with that + needs protection. Also added a couple JSLocks to places that didn't already + have it that needed it. + + * ewk/ewk_frame.cpp: + (ewk_frame_script_execute): + * ewk/ewk_view.cpp: + (ewk_view_js_object_add): + 2012-06-26 Gyuyoung Kim <gyuyoung.kim@samsung.com> Change return type in bandwidth attribute of network information API diff --git a/Source/WebKit/efl/WebCoreSupport/BatteryClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/BatteryClientEfl.cpp index 2e12c14a7..e61da11f3 100644 --- a/Source/WebKit/efl/WebCoreSupport/BatteryClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/BatteryClientEfl.cpp @@ -1,5 +1,6 @@ /* - * Copyright (C) 2012 Samsung Electronics + * Copyright (C) 2012 Samsung Electronics. All rights reserved. + * Copyright (C) 2012 Intel Corporation. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -23,44 +24,26 @@ #if ENABLE(BATTERY_STATUS) #include "BatteryController.h" -#include "EventNames.h" -#include <limits> - -namespace WebCore { BatteryClientEfl::BatteryClientEfl() : m_controller(0) - , m_timer(this, &BatteryClientEfl::timerFired) - , m_batteryStatusRefreshInterval(1.0) + , m_provider(this) { } -void BatteryClientEfl::setController(BatteryController* controller) +void BatteryClientEfl::setController(WebCore::BatteryController* controller) { m_controller = controller; } void BatteryClientEfl::startUpdating() { - if (m_timer.isActive()) - return; - - if (!e_dbus_init()) - return; - - if (!e_ukit_init()) { - e_dbus_shutdown(); - return; - } - - m_timer.startRepeating(m_batteryStatusRefreshInterval); + m_provider.startUpdating(); } void BatteryClientEfl::stopUpdating() { - m_timer.stop(); - e_ukit_shutdown(); - e_dbus_shutdown(); + m_provider.stopUpdating(); } void BatteryClientEfl::batteryControllerDestroyed() @@ -68,116 +51,10 @@ void BatteryClientEfl::batteryControllerDestroyed() delete this; } -void BatteryClientEfl::setBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus> batteryStatus) -{ - m_batteryStatus = batteryStatus; - m_controller->didChangeBatteryStatus(eventType, m_batteryStatus); -} - -void BatteryClientEfl::timerFired(Timer<BatteryClientEfl>* timer) +void BatteryClientEfl::didChangeBatteryStatus(const AtomicString& eventType, PassRefPtr<WebCore::BatteryStatus> status) { - ASSERT_UNUSED(timer, timer == &m_timer); - E_DBus_Connection* edbusConnection = e_dbus_bus_get(DBUS_BUS_SYSTEM); - if (edbusConnection) - e_upower_get_all_devices(edbusConnection, getBatteryStatus, static_cast<void*>(this)); + ASSERT(m_controller); + m_controller->didChangeBatteryStatus(eventType, status); } -void BatteryClientEfl::getBatteryStatus(void* data, void* replyData, DBusError* dBusError) -{ - E_Ukit_Get_All_Devices_Return* eukitDeviceNames = static_cast<E_Ukit_Get_All_Devices_Return*>(replyData); - if (!eukitDeviceNames || !eukitDeviceNames->strings || dbus_error_is_set(dBusError)) { - dbus_error_free(dBusError); - return; - } - - E_DBus_Connection* edbusConnection = e_dbus_bus_get(DBUS_BUS_SYSTEM); - Eina_List* list; - void* deviceName; - EINA_LIST_FOREACH(eukitDeviceNames->strings, list, deviceName) - e_upower_get_all_properties(edbusConnection, static_cast<char*>(deviceName), setBatteryClient, data); -} - -void BatteryClientEfl::setBatteryClient(void* data, void* replyData, DBusError* dBusError) -{ - E_Ukit_Get_All_Properties_Return* eukitPropertyNames = static_cast<E_Ukit_Get_All_Properties_Return*>(replyData); - - if (!eukitPropertyNames || dbus_error_is_set(dBusError)) { - dbus_error_free(dBusError); - return; - } - - if (!eukitPropertyNames->properties) - return; - - E_Ukit_Property* property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "Type")); - if (!property || property->val.u != E_UPOWER_SOURCE_BATTERY) - return; - - BatteryClientEfl* client = static_cast<BatteryClientEfl*>(data); - BatteryStatus* clientBatteryStatus = client->batteryStatus(); - bool charging = false; - bool chargingChanged = false; - static unsigned chargingState = 0; - - property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "State")); - if (!property) - return; - if (!clientBatteryStatus || chargingState != property->val.u) { - chargingChanged = true; - chargingState = property->val.u; - (chargingState == E_UPOWER_STATE_FULL || chargingState == E_UPOWER_STATE_CHARGING) ? charging = true : charging = false; - } else - charging = clientBatteryStatus->charging(); - - bool chargingTimeChanged = false; - bool dischargingTimeChanged = false; - double chargingTime = std::numeric_limits<double>::infinity(); - double dischargingTime = std::numeric_limits<double>::infinity(); - - if (charging) { - if (!clientBatteryStatus || clientBatteryStatus->dischargingTime() != std::numeric_limits<double>::infinity()) - dischargingTimeChanged = true; - dischargingTime = std::numeric_limits<double>::infinity(); - property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "TimeToFull")); - if (!property) - return; - if (!clientBatteryStatus || clientBatteryStatus->chargingTime() != property->val.x) - chargingTimeChanged = true; - chargingTime = property->val.x; - } else { - if (!clientBatteryStatus || clientBatteryStatus->chargingTime() != std::numeric_limits<double>::infinity()) - chargingTimeChanged = true; - chargingTime = std::numeric_limits<double>::infinity(); - property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "TimeToEmpty")); - if (!property) - return; - if (!clientBatteryStatus || clientBatteryStatus->dischargingTime() != property->val.x) - dischargingTimeChanged = true; - dischargingTime = property->val.x; - } - - double level = 0; - bool levelChanged = false; - - property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "Percentage")); - if (!property) - return; - if (!clientBatteryStatus || clientBatteryStatus->level() != property->val.d) - levelChanged = true; - level = property->val.d; - - WTF::RefPtr<BatteryStatus> batteryStatus = BatteryStatus::create(charging, chargingTime, dischargingTime, level); - if (chargingChanged) - client->setBatteryStatus(eventNames().chargingchangeEvent, batteryStatus); - if (chargingTimeChanged) - client->setBatteryStatus(eventNames().chargingtimechangeEvent, batteryStatus); - if (dischargingTimeChanged) - client->setBatteryStatus(eventNames().dischargingtimechangeEvent, batteryStatus); - if (levelChanged) - client->setBatteryStatus(eventNames().levelchangeEvent, batteryStatus); -} - -} - -#endif // BATTERY_STATUS - +#endif // ENABLE(BATTERY_STATUS) diff --git a/Source/WebKit/efl/WebCoreSupport/BatteryClientEfl.h b/Source/WebKit/efl/WebCoreSupport/BatteryClientEfl.h index df47d70be..4ba11e84c 100644 --- a/Source/WebKit/efl/WebCoreSupport/BatteryClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/BatteryClientEfl.h @@ -1,5 +1,6 @@ /* - * Copyright (C) 2012 Samsung Electronics + * Copyright (C) 2012 Samsung Electronics. All rights reserved. + * Copyright (C) 2012 Intel Corporation. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -23,42 +24,34 @@ #if ENABLE(BATTERY_STATUS) #include "BatteryClient.h" +#include "BatteryProviderEfl.h" +#include "BatteryProviderEflClient.h" #include "BatteryStatus.h" -#include "Timer.h" -#include <E_Ukit.h> -#include <wtf/text/AtomicString.h> +#include <wtf/PassRefPtr.h> namespace WebCore { - class BatteryController; -class BatteryStatus; +} -class BatteryClientEfl : public BatteryClient { +class BatteryClientEfl : public WebCore::BatteryClient, public WebCore::BatteryProviderEflClient { public: BatteryClientEfl(); - ~BatteryClientEfl() { }; + virtual ~BatteryClientEfl() { } - virtual void setController(BatteryController*); + // BatteryClient interface. + virtual void setController(WebCore::BatteryController*); virtual void startUpdating(); virtual void stopUpdating(); virtual void batteryControllerDestroyed(); - void setBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus>); - BatteryStatus* batteryStatus() { return m_batteryStatus.get(); } - private: - void timerFired(Timer<BatteryClientEfl>*); - static void getBatteryStatus(void* data, void* replyData, DBusError*); - static void setBatteryClient(void* data, void* replyData, DBusError*); + // BatteryProviderEflClient interface. + virtual void didChangeBatteryStatus(const AtomicString& eventType, PassRefPtr<WebCore::BatteryStatus>); - BatteryController* m_controller; - Timer<BatteryClientEfl> m_timer; - RefPtr<BatteryStatus> m_batteryStatus; - const double m_batteryStatusRefreshInterval; + WebCore::BatteryController* m_controller; + WebCore::BatteryProviderEfl m_provider; }; -} +#endif // ENABLE(BATTERY_STATUS) -#endif // BATTERY_STATUS #endif // BatteryClientEfl_h - diff --git a/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp index a234bf9f7..703fa88ec 100644 --- a/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp @@ -628,14 +628,25 @@ bool ChromeClientEfl::supportsFullScreenForElement(const WebCore::Element* eleme void ChromeClientEfl::enterFullScreenForElement(WebCore::Element* element) { + // Keep a reference to the element to use it later in + // exitFullScreenForElement(). + m_fullScreenElement = element; + element->document()->webkitWillEnterFullScreenForElement(element); element->document()->webkitDidEnterFullScreenForElement(element); } -void ChromeClientEfl::exitFullScreenForElement(WebCore::Element* element) +void ChromeClientEfl::exitFullScreenForElement(WebCore::Element*) { - element->document()->webkitWillExitFullScreenForElement(element); - element->document()->webkitDidExitFullScreenForElement(element); + // The element passed into this function is not reliable, i.e. it could + // be null. In addition the parameter may be disappearing in the future. + // So we use the reference to the element we saved above. + ASSERT(m_fullScreenElement); + + m_fullScreenElement->document()->webkitWillExitFullScreenForElement(m_fullScreenElement.get()); + m_fullScreenElement->document()->webkitDidExitFullScreenForElement(m_fullScreenElement.get()); + + m_fullScreenElement.clear(); } #endif diff --git a/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h b/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h index ed770d610..a5ce3149a 100644 --- a/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h @@ -192,6 +192,9 @@ public: Evas_Object* m_view; KURL m_hoveredLinkURL; +#if ENABLE(FULLSCREEN_API) + RefPtr<Element> m_fullScreenElement; +#endif }; } diff --git a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp index fe1f70dae..485db7f09 100644 --- a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp @@ -47,6 +47,7 @@ #include <JSElement.h> #include <JavaScriptCore/OpaqueJSString.h> #include <MemoryCache.h> +#include <MutationObserver.h> #include <PageGroup.h> #include <PrintContext.h> #include <RenderTreeAsText.h> @@ -55,7 +56,6 @@ #include <ScriptValue.h> #include <Settings.h> #include <TextIterator.h> -#include <WebKitMutationObserver.h> #include <bindings/js/GCController.h> #include <history/HistoryItem.h> #include <workers/WorkerThread.h> @@ -577,27 +577,10 @@ void DumpRenderTreeSupportEfl::setMockScrollbarsEnabled(bool enable) WebCore::Settings::setMockScrollbarsEnabled(enable); } -void DumpRenderTreeSupportEfl::dumpConfigurationForViewport(Evas_Object* ewkView, int deviceDPI, const WebCore::IntSize& deviceSize, const WebCore::IntSize& availableSize) -{ - WebCore::Page* page = EWKPrivate::corePage(ewkView); - - if (!page) - return; - WebCore::ViewportArguments arguments = page->mainFrame()->document()->viewportArguments(); - WebCore::ViewportAttributes attributes = computeViewportAttributes(arguments, - /* default layout width for non-mobile pages */ 980, - deviceSize.width(), deviceSize.height(), - deviceDPI, - availableSize); - restrictMinimumScaleFactorToViewportSize(attributes, availableSize); - restrictScaleFactorToInitialScaleIfNotUserScalable(attributes); - fprintf(stdout, "viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n", static_cast<int>(attributes.layoutSize.width()), static_cast<int>(attributes.layoutSize.height()), attributes.initialScale, attributes.minimumScale, attributes.maximumScale, attributes.userScalable); -} - void DumpRenderTreeSupportEfl::deliverAllMutationsIfNecessary() { #if ENABLE(MUTATION_OBSERVERS) - WebCore::WebKitMutationObserver::deliverAllMutations(); + WebCore::MutationObserver::deliverAllMutations(); #endif } diff --git a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h index e9ba7e8a9..611f3c85f 100644 --- a/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h @@ -99,8 +99,6 @@ public: static void setMockScrollbarsEnabled(bool); - static void dumpConfigurationForViewport(Evas_Object* ewkView, int deviceDPI, const WebCore::IntSize& deviceSize, const WebCore::IntSize& availableSize); - static void deliverAllMutationsIfNecessary(); static String markerTextForListItem(JSContextRef, JSValueRef nodeObject); static void setInteractiveFormValidationEnabled(Evas_Object* ewkView, bool enabled); diff --git a/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp index 7e29758bd..a0f1aacfc 100644 --- a/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.cpp @@ -21,31 +21,86 @@ #include "config.h" #include "InspectorClientEfl.h" +#if ENABLE(INSPECTOR) +#include "InspectorController.h" #include "NotImplemented.h" #include "PlatformString.h" - -using namespace WebCore; +#include "ewk_view_private.h" +#include <unistd.h> namespace WebCore { +static void notifyWebInspectorDestroy(void* userData, Evas_Object* webview, void* eventInfo) +{ + InspectorFrontendClientEfl* inspectorFrontendClient = static_cast<InspectorFrontendClientEfl*>(userData); + if (inspectorFrontendClient) + inspectorFrontendClient->destroyInspectorWindow(true); +} + +class InspectorFrontendSettingsEfl : public InspectorFrontendClientLocal::Settings { +public: + virtual String getProperty(const String& name) + { + notImplemented(); + return String(); + } + + virtual void setProperty(const String& name, const String& value) + { + notImplemented(); + } +}; + +InspectorClientEfl::InspectorClientEfl(Evas_Object* webView) + : m_inspectedView(webView) + , m_inspectorView(0) + , m_frontendClient(0) +{ +} + +InspectorClientEfl::~InspectorClientEfl() +{ + if (m_frontendClient) { + m_frontendClient->disconnectInspectorClient(); + m_frontendClient = 0; + } +} + void InspectorClientEfl::inspectorDestroyed() { + closeInspectorFrontend(); delete this; } void InspectorClientEfl::openInspectorFrontend(InspectorController*) { - notImplemented(); + evas_object_smart_callback_call(m_inspectedView, "inspector,view,create", 0); + + Evas_Object* inspectorView = ewk_view_web_inspector_view_get(m_inspectedView); + if (!inspectorView) + return; + + m_inspectorView = inspectorView; + + String inspectorUri = inspectorFilesPath(); + ewk_view_uri_set(m_inspectorView, inspectorUri.utf8().data()); + + OwnPtr<InspectorFrontendClientEfl> frontendClient = adoptPtr(new InspectorFrontendClientEfl(m_inspectedView, m_inspectorView, this)); + m_frontendClient = frontendClient.get(); + + InspectorController* controller = EWKPrivate::corePage(m_inspectorView)->inspectorController(); + controller->setInspectorFrontendClient(frontendClient.release()); } void InspectorClientEfl::closeInspectorFrontend() { - notImplemented(); + if (m_frontendClient) + m_frontendClient->destroyInspectorWindow(false); } void InspectorClientEfl::bringFrontendToFront() { - notImplemented(); + m_frontendClient->bringToFront(); } void InspectorClientEfl::highlight() @@ -58,21 +113,98 @@ void InspectorClientEfl::hideHighlight() notImplemented(); } -void InspectorClientEfl::populateSetting(const String&, String*) +bool InspectorClientEfl::sendMessageToFrontend(const String& message) +{ + Page* frontendPage = EWKPrivate::corePage(m_inspectorView); + return doDispatchMessageOnFrontendPage(frontendPage, message); +} + +void InspectorClientEfl::releaseFrontendPage() +{ + m_inspectorView = 0; + m_frontendClient = 0; +} + +String InspectorClientEfl::inspectorFilesPath() +{ + String inspectorFilesPath = makeString("file://", WEB_INSPECTOR_INSTALL_DIR, "/inspector.html"); + if (access(inspectorFilesPath.utf8().data(), R_OK)) // On success, zero is returned + inspectorFilesPath = makeString("file://", WEB_INSPECTOR_DIR, "/inspector.html"); + + return inspectorFilesPath; +} + +InspectorFrontendClientEfl::InspectorFrontendClientEfl(Evas_Object* inspectedView, Evas_Object* inspectorView, InspectorClientEfl* inspectorClient) + : InspectorFrontendClientLocal(EWKPrivate::corePage(inspectedView)->inspectorController(), EWKPrivate::corePage(inspectorView), adoptPtr(new InspectorFrontendSettingsEfl())) + , m_inspectedView(inspectedView) + , m_inspectorView(inspectorView) + , m_inspectorClient(inspectorClient) +{ + evas_object_smart_callback_add(m_inspectorView, "inspector,view,destroy", notifyWebInspectorDestroy, this); +} + +InspectorFrontendClientEfl::~InspectorFrontendClientEfl() +{ + evas_object_smart_callback_del(m_inspectorView, "inspector,view,destroy", notifyWebInspectorDestroy); + + if (m_inspectorClient) { + m_inspectorClient->releaseFrontendPage(); + m_inspectorClient = 0; + } +} + +String InspectorFrontendClientEfl::localizedStringsURL() +{ + notImplemented(); + return String(); +} + +String InspectorFrontendClientEfl::hiddenPanels() +{ + notImplemented(); + return String(); +} + +void InspectorFrontendClientEfl::bringToFront() { notImplemented(); } -void InspectorClientEfl::storeSetting(const String&, const String&) +void InspectorFrontendClientEfl::closeWindow() +{ + destroyInspectorWindow(true); +} + +void InspectorFrontendClientEfl::inspectedURLChanged(const String&) +{ + notImplemented(); +} + +void InspectorFrontendClientEfl::attachWindow() { notImplemented(); } -bool InspectorClientEfl::sendMessageToFrontend(const String&) +void InspectorFrontendClientEfl::detachWindow() { notImplemented(); - return false; } +void InspectorFrontendClientEfl::setAttachedWindowHeight(unsigned) +{ + notImplemented(); +} + +void InspectorFrontendClientEfl::destroyInspectorWindow(bool notifyInspectorController) +{ + if (notifyInspectorController) + EWKPrivate::corePage(m_inspectedView)->inspectorController()->disconnectFrontend(); + + if (m_inspectorClient) + m_inspectorClient->releaseFrontendPage(); + + evas_object_smart_callback_call(m_inspectedView, "inspector,view,close", m_inspectorView); +} } +#endif diff --git a/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.h b/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.h index f92e94dda..b6a078e72 100644 --- a/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.h @@ -2,7 +2,7 @@ * Copyright (C) 2007 Apple Inc. All rights reserved. * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia * Copyright (C) 2009-2010 ProFUSION embedded systems - * Copyright (C) 2009-2010 Samsung Electronics + * Copyright (C) 2009-2012 Samsung Electronics * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,13 +33,19 @@ #define InspectorClientEfl_h #include "InspectorClient.h" +#include "InspectorFrontendClientLocal.h" +#include <Evas.h> #include <wtf/Forward.h> namespace WebCore { +class InspectorFrontendClientEfl; class Page; -class InspectorClientEfl : public WebCore::InspectorClient { +class InspectorClientEfl : public InspectorClient { public: + InspectorClientEfl(Evas_Object*); + ~InspectorClientEfl(); + virtual void inspectorDestroyed(); virtual void openInspectorFrontend(InspectorController*); @@ -49,10 +55,43 @@ public: virtual void highlight(); virtual void hideHighlight(); - virtual void populateSetting(const String& key, String* value); - virtual void storeSetting(const String& key, const String& value); - virtual bool sendMessageToFrontend(const String&); + + void releaseFrontendPage(); + String inspectorFilesPath(); + +private: + Evas_Object* m_inspectedView; + Evas_Object* m_inspectorView; + InspectorFrontendClientEfl* m_frontendClient; +}; + +class InspectorFrontendClientEfl : public InspectorFrontendClientLocal { +public: + InspectorFrontendClientEfl(Evas_Object*, Evas_Object*, InspectorClientEfl*); + ~InspectorFrontendClientEfl(); + + virtual String localizedStringsURL(); + virtual String hiddenPanels(); + + virtual void bringToFront(); + virtual void closeWindow(); + + virtual void inspectedURLChanged(const String&); + + virtual void attachWindow(); + virtual void detachWindow(); + + virtual void setAttachedWindowHeight(unsigned); + + void disconnectInspectorClient() { m_inspectorClient = 0; } + void destroyInspectorWindow(bool notifyInspectorController); + +private: + Evas_Object* m_inspectedView; + Evas_Object* m_inspectorView; + InspectorClientEfl* m_inspectorClient; + }; } diff --git a/Source/WebKit/efl/WebCoreSupport/NotificationPresenterClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/NotificationPresenterClientEfl.cpp index e33735134..c4e5ca8da 100644 --- a/Source/WebKit/efl/WebCoreSupport/NotificationPresenterClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/NotificationPresenterClientEfl.cpp @@ -59,7 +59,7 @@ void NotificationPresenterClientEfl::requestPermission(ScriptExecutionContext* c notImplemented(); } -NotificationPresenter::Permission NotificationPresenterClientEfl::checkPermission(ScriptExecutionContext* context) +NotificationClient::Permission NotificationPresenterClientEfl::checkPermission(ScriptExecutionContext* context) { notImplemented(); return PermissionDenied; diff --git a/Source/WebKit/efl/WebCoreSupport/NotificationPresenterClientEfl.h b/Source/WebKit/efl/WebCoreSupport/NotificationPresenterClientEfl.h index 55174e707..ece5ccfe4 100644 --- a/Source/WebKit/efl/WebCoreSupport/NotificationPresenterClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/NotificationPresenterClientEfl.h @@ -22,11 +22,11 @@ #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) #include "Notification.h" -#include "NotificationPresenter.h" +#include "NotificationClient.h" namespace WebCore { -class NotificationPresenterClientEfl : public NotificationPresenter { +class NotificationPresenterClientEfl : public NotificationClient { public: NotificationPresenterClientEfl(); @@ -37,7 +37,7 @@ public: virtual void notificationObjectDestroyed(Notification*); virtual void notificationControllerDestroyed(); virtual void requestPermission(ScriptExecutionContext*, PassRefPtr<VoidCallback>); - virtual NotificationPresenter::Permission checkPermission(ScriptExecutionContext*); + virtual NotificationClient::Permission checkPermission(ScriptExecutionContext*); virtual void cancelRequestsForPermission(ScriptExecutionContext*); }; diff --git a/Source/WebKit/efl/WebCoreSupport/PageClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/PageClientEfl.cpp index 25fbd750c..6d409c073 100644 --- a/Source/WebKit/efl/WebCoreSupport/PageClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/PageClientEfl.cpp @@ -20,7 +20,7 @@ #include "config.h" #include "PageClientEfl.h" -#include "ewk_private.h" +#include "ewk_view_private.h" namespace WebCore { class IntRect; @@ -37,12 +37,12 @@ PageClientEfl::~PageClientEfl() } #if USE(ACCELERATED_COMPOSITING) -bool PageClientEfl::createEvasObjectForAcceleratedCompositing(Evas_Native_Surface* nativeSurface, const IntRect& rect) +bool PageClientEfl::createEvasObjectForAcceleratedCompositing(Evas_Native_Surface* nativeSurface, const WebCore::IntRect& rect) { return ewk_view_accelerated_compositing_object_create(m_view, nativeSurface, rect); } -GraphicsContext3D* PageClientEfl::acceleratedCompositingContext() +WebCore::GraphicsContext3D* PageClientEfl::acceleratedCompositingContext() { return ewk_view_accelerated_compositing_context_get(m_view); } diff --git a/Source/WebKit/efl/WebCoreSupport/PageClientEfl.h b/Source/WebKit/efl/WebCoreSupport/PageClientEfl.h index b95823c7a..6f98d701c 100644 --- a/Source/WebKit/efl/WebCoreSupport/PageClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/PageClientEfl.h @@ -35,8 +35,8 @@ public: virtual ~PageClientEfl(); #if USE(ACCELERATED_COMPOSITING) - bool createEvasObjectForAcceleratedCompositing(Evas_Native_Surface*, const IntRect&); - GraphicsContext3D* acceleratedCompositingContext(); + bool createEvasObjectForAcceleratedCompositing(Evas_Native_Surface*, const WebCore::IntRect&); + WebCore::GraphicsContext3D* acceleratedCompositingContext(); #endif Evas_Object* view() { return m_view; } diff --git a/Source/WebKit/efl/ewk/ewk_frame.cpp b/Source/WebKit/efl/ewk/ewk_frame.cpp index 6ba941d35..67a9bc82c 100644 --- a/Source/WebKit/efl/ewk/ewk_frame.cpp +++ b/Source/WebKit/efl/ewk/ewk_frame.cpp @@ -455,8 +455,8 @@ char* ewk_frame_script_execute(Evas_Object* ewkFrame, const char* script) if (!result || (!result.isBoolean() && !result.isString() && !result.isNumber())) return 0; - JSC::JSLock lock(JSC::SilenceAssertionsOnly); JSC::ExecState* exec = smartData->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec(); + JSC::JSLockHolder lock(exec); resultString = WebCore::ustringToString(result.toString(exec)->value(exec)); return strdup(resultString.utf8().data()); #else diff --git a/Source/WebKit/efl/ewk/ewk_main.cpp b/Source/WebKit/efl/ewk/ewk_main.cpp index 84d2b5025..b48c28a6b 100644 --- a/Source/WebKit/efl/ewk/ewk_main.cpp +++ b/Source/WebKit/efl/ewk/ewk_main.cpp @@ -146,7 +146,9 @@ Eina_Bool _ewk_init_body(void) "work (ie: Adobe Flash)"); WebCore::ScriptController::initializeThreading(); +#if !LOG_DISABLED WebCore::initializeLoggingChannelsIfNecessary(); +#endif // !LOG_DISABLED WebCore::Settings::setDefaultMinDOMTimerInterval(0.004); PlatformStrategiesEfl::initialize(); diff --git a/Source/WebKit/efl/ewk/ewk_view.cpp b/Source/WebKit/efl/ewk/ewk_view.cpp index c45569ce1..1ae83fc9d 100644 --- a/Source/WebKit/efl/ewk/ewk_view.cpp +++ b/Source/WebKit/efl/ewk/ewk_view.cpp @@ -41,6 +41,7 @@ #include "HTMLInputElement.h" #include "HTMLNames.h" #include "InspectorClientEfl.h" +#include "InspectorController.h" #include "IntSize.h" #include "JSDOMBinding.h" #include "JSDOMWindow.h" @@ -344,6 +345,9 @@ struct _Ewk_View_Private_Data { SoupSession* soupSession; const char* cursorGroup; Evas_Object* cursorObject; +#if ENABLE(INSPECTOR) + Evas_Object* inspectorView; +#endif #ifdef HAVE_ECORE_X bool isUsingEcoreX; #endif @@ -730,8 +734,9 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData) pageClients.chromeClient = new WebCore::ChromeClientEfl(smartData->self); pageClients.editorClient = new WebCore::EditorClientEfl(smartData->self); pageClients.dragClient = new WebCore::DragClientEfl; - pageClients.inspectorClient = new WebCore::InspectorClientEfl; - +#if ENABLE(INSPECTOR) + pageClients.inspectorClient = new WebCore::InspectorClientEfl(smartData->self); +#endif priv->page = adoptPtr(new WebCore::Page(pageClients)); #if ENABLE(DEVICE_ORIENTATION) @@ -749,7 +754,7 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData) #endif #if ENABLE(BATTERY_STATUS) - WebCore::provideBatteryTo(priv->page.get(), new WebCore::BatteryClientEfl); + WebCore::provideBatteryTo(priv->page.get(), new BatteryClientEfl); #endif priv->pageSettings = priv->page->settings(); @@ -1237,7 +1242,7 @@ static WebCore::ViewportAttributes _ewk_view_viewport_attributes_compute(const E WebCore::IntRect availableRect = enclosingIntRect(priv->page->chrome()->client()->pageRect()); WebCore::IntRect deviceRect = enclosingIntRect(priv->page->chrome()->client()->windowRect()); - WebCore::ViewportAttributes attributes = WebCore::computeViewportAttributes(priv->viewportArguments, desktopWidth, deviceRect.width(), deviceRect.height(), deviceDPI, availableRect.size()); + WebCore::ViewportAttributes attributes = WebCore::computeViewportAttributes(priv->viewportArguments, desktopWidth, deviceRect.width(), deviceRect.height(), deviceDPI / WebCore::ViewportArguments::deprecatedTargetDPI, availableRect.size()); WebCore::restrictMinimumScaleFactorToViewportSize(attributes, availableRect.size()); WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(attributes); @@ -4045,8 +4050,8 @@ Eina_Bool ewk_view_js_object_add(Evas_Object* ewkView, Ewk_JS_Object* object, co EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); - JSC::JSLock lock(JSC::SilenceAssertionsOnly); WebCore::JSDOMWindow* window = toJSDOMWindow(priv->mainFrame, WebCore::mainThreadNormalWorld()); + JSC::JSLockHolder lock(window->globalExec()); JSC::Bindings::RootObject* root; root = priv->mainFrame->script()->bindingRootObject(); @@ -4362,6 +4367,48 @@ void ewk_view_setting_should_display_text_descriptions_set(Evas_Object *ewkView, #endif } +void ewk_view_web_inspector_show(const Evas_Object* ewkView) +{ +#if ENABLE(INSPECTOR) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + + priv->page->inspectorController()->show(); +#endif +} + +void ewk_view_web_inspector_close(const Evas_Object* ewkView) +{ +#if ENABLE(INSPECTOR) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv); + + priv->page->inspectorController()->close(); +#endif +} + +Evas_Object* ewk_view_web_inspector_view_get(const Evas_Object* ewkView) +{ +#if ENABLE(INSPECTOR) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); + + return priv->inspectorView; +#else + return 0; +#endif +} + +void ewk_view_web_inspector_view_set(Evas_Object* ewkView, Evas_Object* inspectorView) +{ +#if ENABLE(INSPECTOR) + EWK_VIEW_SD_GET(ewkView, smartData); + EWK_VIEW_PRIV_GET(smartData, priv); + + priv->inspectorView = inspectorView; +#endif +} + #if USE(ACCELERATED_COMPOSITING) bool ewk_view_accelerated_compositing_object_create(Evas_Object* ewkView, Evas_Native_Surface* nativeSurface, const WebCore::IntRect& rect) { diff --git a/Source/WebKit/efl/ewk/ewk_view.h b/Source/WebKit/efl/ewk/ewk_view.h index f645f7223..d5feb36b3 100644 --- a/Source/WebKit/efl/ewk/ewk_view.h +++ b/Source/WebKit/efl/ewk/ewk_view.h @@ -46,6 +46,8 @@ * - "icon,received", void: main frame received an icon. * - "inputmethod,changed", Eina_Bool: reports that input method was changed and * it gives a boolean value whether it's enabled or not as an argument. + * - "inspector,view,close", Evas_Object*: request to close the view for web inspector. + * - "inspector,view,create", void: request to create the new view for web inspector. * - "js,windowobject,clear", void: Report that the JS window object has been cleared. * - "link,hover,in", const char *link[2]: reports mouse is over a link. * It gives the url in link[0] and link's title in link[1] as an argument. @@ -2644,6 +2646,53 @@ EAPI Eina_Bool ewk_view_setting_web_audio_get(const Evas_Object *o); */ EAPI Eina_Bool ewk_view_setting_web_audio_set(Evas_Object *o, Eina_Bool enable); +/** + * Show the web inspector to debug a web page. + * + * The following signals are emiited. + * "inspector,view,create" and "inspector,view,close" + * The first one will be called to request the view for web inspector on view that will be inspected. + * This callback should create the view for web inspector and set the view with ewk_view_web_inspector_view_set(). + * The second one will be called to close the view for web inspector on view having the web inspector after disconnecting frontend + * This callback should remove the view for web inspector. + * + * When the view having the web inspector is removed, + * please emit the "inspector,view,destroy" signal on view for web inspector. + * + * @param o The view to show the web inspector. + * + * @see ewk_view_web_inspector_close() + * @see ewk_view_web_inspector_view_set() + */ +EAPI void ewk_view_web_inspector_show(const Evas_Object *o); + +/** + * Close the web inspector view + * + * @param o The view to close the web inspector. + * + * @see ewk_view_web_inspector_show() + * @see ewk_view_web_inspector_view_get() + */ +EAPI void ewk_view_web_inspector_close(const Evas_Object *o); + +/** + * Get the view of web inspector. + * + * @param o The view that is inspected. + * + * @return view object on success or @c 0 on failure + */ +EAPI Evas_Object* ewk_view_web_inspector_view_get(const Evas_Object *o); + +/** + * Set the view of web inspector. + * + * @param o The view that is inspected. + * @param inspector_view The view of web inspector. + */ +EAPI void ewk_view_web_inspector_view_set(Evas_Object *o, Evas_Object *inspector_view); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit/efl/tests/UnitTestUtils/EWKTestBase.cpp b/Source/WebKit/efl/tests/UnitTestUtils/EWKTestBase.cpp new file mode 100644 index 000000000..608300aa6 --- /dev/null +++ b/Source/WebKit/efl/tests/UnitTestUtils/EWKTestBase.cpp @@ -0,0 +1,109 @@ +/* + Copyright (C) 2012 Samsung Electronics + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "config.h" +#include "EWKTestBase.h" + +#include "EWKTestConfig.h" +#include "EWKTestView.h" +#include <EWebKit.h> + +#include <Ecore.h> +#include <Edje.h> + +int EWKUnitTests::EWKTestBase::useX11Window; + +namespace EWKUnitTests { + +bool EWKTestBase::init() +{ + if (!ecore_evas_init()) + return false; + + if (!edje_init()) { + ecore_evas_shutdown(); + return false; + } + + int ret = ewk_init(); + const char* proxyUri = getenv("http_proxy"); + + if (ret && proxyUri) + ewk_network_proxy_uri_set(proxyUri); + + return ret; +} + +void EWKTestBase::shutdown() +{ + ecore_evas_shutdown(); + edje_shutdown(); + ewk_shutdown(); +} + +void EWKTestBase::shutdownAll() +{ + int count = 0; + + while ((count = ecore_evas_shutdown()) > 0) { } + while ((count = edje_shutdown()) > 0) { } + while ((count = ewk_shutdown()) > 0) { } +} + +void EWKTestBase::startTest() +{ + ecore_main_loop_begin(); +} + +void EWKTestBase::endTest() +{ + ecore_main_loop_quit(); +} + +bool EWKTestBase::createTest(const char* url, void (*event_callback)(void*, Evas_Object*, void*), const char* event_name, void* event_data) +{ + EFL_INIT_RET(); + + EWKTestEcoreEvas evas(useX11Window); + if (!evas.evas()) + return false; + evas.show(); + + EWKTestView view(evas.evas(), url); + if (!view.init()) + return false; + + view.bindEvents(event_callback, event_name, event_data); + view.show(); + + START_TEST(); + + return true; +} + +bool EWKTestBase::runTest(void (*event_callback)(void*, Evas_Object*, void*), const char* event_name, void* event_data) +{ + return createTest(Config::defaultTestPage, event_callback, event_name, event_data); +} + +bool EWKTestBase::runTest(const char* url, void (*event_callback)(void*, Evas_Object*, void*), const char* event_name, void* event_data) +{ + return createTest(url, event_callback, event_name, event_data); +} + +} diff --git a/Source/WebKit/efl/tests/UnitTestUtils/EWKTestBase.h b/Source/WebKit/efl/tests/UnitTestUtils/EWKTestBase.h new file mode 100644 index 000000000..fc1d27171 --- /dev/null +++ b/Source/WebKit/efl/tests/UnitTestUtils/EWKTestBase.h @@ -0,0 +1,70 @@ +/* + Copyright (C) 2012 Samsung Electronics + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef EWKTestBase_h +#define EWKTestBase_h + +#include <Evas.h> +#include <gtest/gtest.h> + +#define RUN_TEST(args...) \ + do { \ + ASSERT_EQ(true, EWKTestBase::runTest(args)); \ + } while (0) + +#define START_TEST() \ + do { \ + EWKTestBase::startTest(); \ + } while (0) + +#define END_TEST() \ + do { \ + EWKTestBase::endTest(); \ + } while (0) + +#define EFL_INIT_RET() \ + do { \ + if (!EWKTestBase::init()) \ + return false; \ + } while (0) + +#define EFL_INIT() \ + do { \ + EWKTestBase::init(); \ + } while (0) + +namespace EWKUnitTests { + +class EWKTestBase { + static bool createTest(const char* url, void (*event_callback)(void*, Evas_Object*, void*), const char* event_name, void* event_data); +public: + static bool init(); + static void shutdown(); + static void shutdownAll(); + static void startTest(); + static void endTest(); + + static bool runTest(const char* url, void (*event_callback)(void*, Evas_Object*, void*), const char* event_name = "load,finished", void* event_data = 0); + static bool runTest(void (*event_callback)(void*, Evas_Object*, void*), const char* event_name = "load,finished", void* event_data = 0); + + static int useX11Window; +}; + +} + +#endif diff --git a/Source/WebKit/efl/tests/UnitTestUtils/EWKTestConfig.h b/Source/WebKit/efl/tests/UnitTestUtils/EWKTestConfig.h new file mode 100644 index 000000000..a1cf6ea83 --- /dev/null +++ b/Source/WebKit/efl/tests/UnitTestUtils/EWKTestConfig.h @@ -0,0 +1,31 @@ +/* + Copyright (C) 2012 Samsung Electronics + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef EWKTestConfig_h +#define EWKTestConfig_h + +namespace EWKUnitTests { +namespace Config { +static const int defaultViewWidth = 600; +static const int defaultViewHeight = 800; +static const char* const defaultThemePath = DEFAULT_THEME_PATH"/default.edj"; +static const char* const defaultTestPage = "file://"DEFAULT_TEST_PAGE_DIR"/default_test_page.html"; +} +} + +#endif diff --git a/Source/WebKit/efl/tests/UnitTestUtils/EWKTestView.cpp b/Source/WebKit/efl/tests/UnitTestUtils/EWKTestView.cpp new file mode 100644 index 000000000..fd29b811c --- /dev/null +++ b/Source/WebKit/efl/tests/UnitTestUtils/EWKTestView.cpp @@ -0,0 +1,148 @@ +/* + Copyright (C) 2012 Samsung Electronics + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "config.h" +#include "EWKTestView.h" + +#include "EWKTestConfig.h" +#include <EWebKit.h> + +#include <wtf/PassOwnPtr.h> + +namespace EWKUnitTests { + +EWKTestEcoreEvas::EWKTestEcoreEvas(int useX11Window) +{ + if (useX11Window) + m_ecoreEvas = adoptPtr(ecore_evas_new(0, 0, 0, Config::defaultViewWidth, Config::defaultViewHeight, 0)); + else + m_ecoreEvas = adoptPtr(ecore_evas_buffer_new(Config::defaultViewWidth, Config::defaultViewHeight)); +} + +EWKTestEcoreEvas::EWKTestEcoreEvas(const char* engine_name, int viewport_x, int viewport_y, int viewport_w, int viewport_h, const char* extra_options, int useX11Window) +{ + if (useX11Window) + m_ecoreEvas = adoptPtr(ecore_evas_new(engine_name, viewport_x, viewport_y, viewport_w, viewport_h, extra_options)); + else + m_ecoreEvas = adoptPtr(ecore_evas_buffer_new(viewport_x, viewport_y)); +} + +Evas* EWKTestEcoreEvas::evas() +{ + if (m_ecoreEvas.get()) + return ecore_evas_get(m_ecoreEvas.get()); + return 0; +} + +void EWKTestEcoreEvas::show() +{ + if (m_ecoreEvas.get()) + ecore_evas_show(m_ecoreEvas.get()); +} + +EWKTestView::EWKTestView(Evas* evas) + : m_evas(evas) + , m_url(Config::defaultTestPage) + , m_defaultViewType(TiledView) + , m_width(Config::defaultViewWidth) + , m_height(Config::defaultViewHeight) +{ +} + +EWKTestView::EWKTestView(Evas* evas, const char* url) + : m_evas(evas) + , m_url(url) + , m_defaultViewType(TiledView) + , m_width(Config::defaultViewWidth) + , m_height(Config::defaultViewHeight) +{ +} + +EWKTestView::EWKTestView(Evas* evas, EwkViewType type, const char* url) + : m_evas(evas) + , m_url(url) + , m_defaultViewType(type) + , m_width(Config::defaultViewWidth) + , m_height(Config::defaultViewHeight) +{ +} + +EWKTestView::EWKTestView(Evas* evas, EwkViewType type, const char* url, int width, int height) + : m_evas(evas) + , m_url(url) + , m_defaultViewType(type) + , m_width(width) + , m_height(height) +{ +} + +bool EWKTestView::init() +{ + if (!m_evas || m_url.empty()) + return false; + + switch (m_defaultViewType) { + case SingleView: + m_webView = adoptPtr(ewk_view_single_add(m_evas)); + break; + + case TiledView: + m_webView = adoptPtr(ewk_view_tiled_add(m_evas)); + break; + } + + if (!m_webView.get()) + return false; + + ewk_view_theme_set(m_webView.get(), Config::defaultThemePath); + ewk_view_uri_set(m_webView.get(), m_url.c_str()); +} + +void EWKTestView::show() +{ + if (!m_webView.get()) + return; + evas_object_resize(m_webView.get(), m_width, m_height); + evas_object_show(m_webView.get()); + evas_object_focus_set(m_webView.get(), EINA_TRUE); +} + +Evas_Object* EWKTestView::mainFrame() +{ + if (m_webView.get()) + return ewk_view_frame_main_get(m_webView.get()); + return 0; +} + +Evas* EWKTestView::evas() +{ + if (m_webView.get()) + return evas_object_evas_get(m_webView.get()); + return 0; +} + +void EWKTestView::bindEvents(void (*callback)(void*, Evas_Object*, void*), const char* eventName, void* ptr) +{ + if (!m_webView.get()) + return; + + evas_object_smart_callback_del(m_webView.get(), eventName, callback); + evas_object_smart_callback_add(m_webView.get(), eventName, callback, ptr); +} + +} diff --git a/Source/WebKit/efl/tests/UnitTestUtils/EWKTestView.h b/Source/WebKit/efl/tests/UnitTestUtils/EWKTestView.h new file mode 100644 index 000000000..6d15d0d30 --- /dev/null +++ b/Source/WebKit/efl/tests/UnitTestUtils/EWKTestView.h @@ -0,0 +1,75 @@ +/* + Copyright (C) 2012 Samsung Electronics + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef EWKTestView_h +#define EWKTestView_h + +#include <Ecore_Evas.h> +#include <Evas.h> +#include <string> +#include <wtf/OwnPtr.h> + +namespace EWKUnitTests { + +class EWKTestEcoreEvas { +public: + EWKTestEcoreEvas(int useX11Window); + EWKTestEcoreEvas(const char* engine_name, int viewport_x, int viewport_y, int viewport_w, int viewport_h, const char* extra_options, int useX11Window); + + Evas* evas(); + void show(); + +private: + OwnPtr<Ecore_Evas> m_ecoreEvas; +}; + +class EWKTestView { +public: + enum EwkViewType { + SingleView = 0, + TiledView, + }; + + explicit EWKTestView(Evas*); + EWKTestView(Evas*, const char* url); + EWKTestView(Evas*, EwkViewType, const char* url); + EWKTestView(Evas*, EwkViewType, const char* url, int width, int height); + + Evas_Object* webView() { return m_webView.get(); } + Evas_Object* mainFrame(); + Evas* evas(); + void show(); + + bool init(); + void bindEvents(void (*callback)(void*, Evas_Object*, void*), const char* eventName, void* ptr); + +private: + EWKTestView(const EWKTestView&); + EWKTestView operator=(const EWKTestView&); + + Evas* m_evas; + OwnPtr<Evas_Object> m_webView; + + int m_width, m_height; + EwkViewType m_defaultViewType; + std::string m_url; +}; + +} + +#endif diff --git a/Source/WebKit/efl/tests/resources/default_test_page.html b/Source/WebKit/efl/tests/resources/default_test_page.html new file mode 100644 index 000000000..edd81e732 --- /dev/null +++ b/Source/WebKit/efl/tests/resources/default_test_page.html @@ -0,0 +1,6 @@ +<HTML> +<BODY> +<H2 align="center">EFL Unit Tests</H2> +<H2 align="center">Default Testing Web Page</H2> +</BODY> +</HTML> diff --git a/Source/WebKit/efl/tests/test_ewk_view.cpp b/Source/WebKit/efl/tests/test_ewk_view.cpp new file mode 100644 index 000000000..2d490797a --- /dev/null +++ b/Source/WebKit/efl/tests/test_ewk_view.cpp @@ -0,0 +1,54 @@ +/* + Copyright (C) 2012 Samsung Electronics + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "config.h" + +#include "UnitTestUtils/EWKTestBase.h" +#include <EWebKit.h> +#include <gtest/gtest.h> + +using namespace EWKUnitTests; + +/** +* @brief Checking whether function properly returns correct value. +*/ +static void ewkViewEditableGetCb(void* eventInfo, Evas_Object* o, void* data) +{ + ewk_view_editable_set(o, EINA_FALSE); + EXPECT_EQ(EINA_FALSE, ewk_view_editable_get(o)); + END_TEST(); +} + +TEST(test_ewk_view, ewk_view_editable_get) +{ + RUN_TEST(ewkViewEditableGetCb); +} + +/** +* @brief Checking whether function returns correct uri string. +*/ +static void ewkViewUriGetCb(void* eventInfo, Evas_Object* o, void* data) +{ + EXPECT_STREQ("http://www.webkit.org/", ewk_view_uri_get(o)); + END_TEST(); +} + +TEST(test_ewk_view, ewk_view_uri_get) +{ + RUN_TEST("http://www.webkit.org", ewkViewUriGetCb); +} diff --git a/Source/WebKit/efl/tests/test_runner.cpp b/Source/WebKit/efl/tests/test_runner.cpp new file mode 100644 index 000000000..702a61f6c --- /dev/null +++ b/Source/WebKit/efl/tests/test_runner.cpp @@ -0,0 +1,40 @@ +/* + Copyright (C) 2012 Samsung Electronics + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "UnitTestUtils/EWKTestBase.h" +#include <getopt.h> +#include <gtest/gtest.h> + +static void parseCustomArguments(int argc, char** argv) +{ + static const option options[] = { + {"useX11Window", no_argument, &EWKUnitTests::EWKTestBase::useX11Window, true}, + {0, 0, 0, 0} + }; + + int option; + while ((option = getopt_long(argc, argv, "", options, 0)) != -1) { } +} + +int main(int argc, char** argv) +{ + atexit(EWKUnitTests::EWKTestBase::shutdownAll); + parseCustomArguments(argc, argv); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} |