Diff
Modified: trunk/Source/WebKit2/ChangeLog (120441 => 120442)
--- trunk/Source/WebKit2/ChangeLog 2012-06-15 11:48:19 UTC (rev 120441)
+++ trunk/Source/WebKit2/ChangeLog 2012-06-15 12:16:55 UTC (rev 120442)
@@ -1,5 +1,31 @@
2012-06-15 Christophe Dumez <christophe.du...@intel.com>
+ [EFL][WK2] Add title support to Ewk_View
+ https://bugs.webkit.org/show_bug.cgi?id=89095
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Add a method to get the title of the main frame in
+ an Ewk_View. A "title,changed" signal is now emitted
+ on the view to notify clients that the main frame
+ title was changed.
+
+ * PlatformEfl.cmake:
+ * UIProcess/API/efl/ewk_view.cpp:
+ (_Ewk_View_Private_Data):
+ (_ewk_view_priv_del):
+ (ewk_view_base_add):
+ (ewk_view_title_get):
+ (ewk_view_title_changed):
+ * UIProcess/API/efl/ewk_view.h:
+ * UIProcess/API/efl/ewk_view_loader_client.cpp: Added.
+ (didReceiveTitleForFrame):
+ (ewk_view_loader_client_attach):
+ * UIProcess/API/efl/ewk_view_loader_client_private.h: Added.
+ * UIProcess/API/efl/ewk_view_private.h:
+
+2012-06-15 Christophe Dumez <christophe.du...@intel.com>
+
[WK2][EFL] Implement navigation back/forward in Ewk_View
https://bugs.webkit.org/show_bug.cgi?id=89173
Modified: trunk/Source/WebKit2/PlatformEfl.cmake (120441 => 120442)
--- trunk/Source/WebKit2/PlatformEfl.cmake 2012-06-15 11:48:19 UTC (rev 120441)
+++ trunk/Source/WebKit2/PlatformEfl.cmake 2012-06-15 12:16:55 UTC (rev 120442)
@@ -31,6 +31,7 @@
UIProcess/API/efl/PageClientImpl.cpp
UIProcess/API/efl/ewk_context.cpp
UIProcess/API/efl/ewk_view.cpp
+ UIProcess/API/efl/ewk_view_loader_client.cpp
UIProcess/cairo/BackingStoreCairo.cpp
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp (120441 => 120442)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-06-15 11:48:19 UTC (rev 120441)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-06-15 12:16:55 UTC (rev 120442)
@@ -30,6 +30,7 @@
#include "WKURL.h"
#include "ewk_context.h"
#include "ewk_context_private.h"
+#include "ewk_view_loader_client_private.h"
#include "ewk_view_private.h"
#include <wtf/text/CString.h>
@@ -41,6 +42,7 @@
struct _Ewk_View_Private_Data {
OwnPtr<PageClientImpl> pageClient;
const char* uri;
+ const char* title;
};
#define EWK_VIEW_TYPE_CHECK(ewkView, result) \
@@ -268,6 +270,7 @@
priv->pageClient = nullptr;
eina_stringshare_del(priv->uri);
+ eina_stringshare_del(priv->title);
free(priv);
}
@@ -489,6 +492,7 @@
}
priv->pageClient = PageClientImpl::create(toImpl(contextRef), toImpl(pageGroupRef), ewkView);
+ ewk_view_loader_client_attach(toAPI(priv->pageClient->page()), ewkView);
return ewkView;
}
@@ -542,6 +546,28 @@
return true;
}
+const char* ewk_view_title_get(const Evas_Object* ewkView)
+{
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
+
+ CString title = priv->pageClient->page()->pageTitle().utf8();
+ eina_stringshare_replace(&priv->title, title.data());
+
+ return priv->title;
+}
+
+/**
+ * @internal
+ * The view title was changed by the frame loader.
+ *
+ * Emits signal: "title,changed" with pointer to new title string.
+ */
+void ewk_view_title_changed(Evas_Object* ewkView, const char* title)
+{
+ evas_object_smart_callback_call(ewkView, "title,changed", const_cast<char*>(title));
+}
+
void ewk_view_display(Evas_Object* ewkView, const IntRect& rect)
{
EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h (120441 => 120442)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h 2012-06-15 11:48:19 UTC (rev 120441)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h 2012-06-15 12:16:55 UTC (rev 120442)
@@ -23,6 +23,10 @@
* @brief WebKit main smart object.
*
* This object provides view related APIs of WebKit2 to EFL object.
+ *
+ * The following signals (see evas_object_smart_callback_add()) are emitted:
+ *
+ * - "title,changed", const char*: title of the main frame was changed.
*/
#ifndef ewk_view_h
@@ -225,6 +229,18 @@
*/
EAPI Eina_Bool ewk_view_forward_possible(Evas_Object *o);
+/**
+ * Gets the current title of the main frame.
+ *
+ * It returns an internal string and should not
+ * be modified. The string is guaranteed to be stringshared.
+ *
+ * @param o view object to get current title
+ *
+ * @return current title on success or @c 0 on failure
+ */
+EAPI const char *ewk_view_title_get(const Evas_Object *o);
+
#ifdef __cplusplus
}
#endif
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp (0 => 120442)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client.cpp 2012-06-15 12:16:55 UTC (rev 120442)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "WKFrame.h"
+#include "ewk_view_loader_client_private.h"
+#include "ewk_view_private.h"
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+
+static void didReceiveTitleForFrame(WKPageRef, WKStringRef title, WKFrameRef frame, WKTypeRef, const void* clientInfo)
+{
+ if (!WKFrameIsMainFrame(frame))
+ return;
+
+ Evas_Object* ewkView = static_cast<Evas_Object*>(const_cast<void*>(clientInfo));
+ ewk_view_title_changed(ewkView, toImpl(title)->string().utf8().data());
+}
+
+void ewk_view_loader_client_attach(WKPageRef pageRef, Evas_Object* ewkView)
+{
+ WKPageLoaderClient loadClient;
+ memset(&loadClient, 0, sizeof(WKPageLoaderClient));
+ loadClient.version = kWKPageLoaderClientCurrentVersion;
+ loadClient.clientInfo = ewkView;
+ loadClient.didReceiveTitleForFrame = didReceiveTitleForFrame;
+ WKPageSetPageLoaderClient(pageRef, &loadClient);
+}
Added: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client_private.h (0 => 120442)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client_private.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_loader_client_private.h 2012-06-15 12:16:55 UTC (rev 120442)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ewk_view_loader_client_private_h
+#define ewk_view_loader_client_private_h
+
+#include <Evas.h>
+#include <WebKit2/WKBase.h>
+
+void ewk_view_loader_client_attach(WKPageRef pageRef, Evas_Object* ewkView);
+
+#endif // ewk_view_loader_client_private_h
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h (120441 => 120442)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h 2012-06-15 11:48:19 UTC (rev 120441)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h 2012-06-15 12:16:55 UTC (rev 120442)
@@ -32,6 +32,7 @@
void ewk_view_display(Evas_Object* ewkView, const WebCore::IntRect& rect);
void ewk_view_image_data_set(Evas_Object* ewkView, void* imageData, const WebCore::IntSize& size);
+void ewk_view_title_changed(Evas_Object* ewkView, const char* title);
Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef, WKPageGroupRef);
Modified: trunk/Tools/ChangeLog (120441 => 120442)
--- trunk/Tools/ChangeLog 2012-06-15 11:48:19 UTC (rev 120441)
+++ trunk/Tools/ChangeLog 2012-06-15 12:16:55 UTC (rev 120442)
@@ -1,5 +1,20 @@
2012-06-15 Christophe Dumez <christophe.du...@intel.com>
+ [EFL][WK2] Add title support to Ewk_View
+ https://bugs.webkit.org/show_bug.cgi?id=89095
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Update the MiniBrowser so it listens for the "title,change"
+ signal on the view and keeps the browser window title
+ up-to-date.
+
+ * MiniBrowser/efl/main.c:
+ (on_title_changed):
+ (browserCreate):
+
+2012-06-15 Christophe Dumez <christophe.du...@intel.com>
+
[WK2][EFL] Implement navigation back/forward in Ewk_View
https://bugs.webkit.org/show_bug.cgi?id=89173
Modified: trunk/Tools/MiniBrowser/efl/main.c (120441 => 120442)
--- trunk/Tools/MiniBrowser/efl/main.c 2012-06-15 11:48:19 UTC (rev 120441)
+++ trunk/Tools/MiniBrowser/efl/main.c 2012-06-15 12:16:55 UTC (rev 120442)
@@ -86,6 +86,15 @@
}
}
+static void
+on_title_changed(void *user_data, Evas_Object *webview, void *event_info)
+{
+ MiniBrowser *app = (MiniBrowser *)user_data;
+ const char *title = (const char *)event_info;
+
+ ecore_evas_title_set(app->ee, title);
+}
+
static MiniBrowser *browserCreate(const char *url)
{
MiniBrowser *app = malloc(sizeof(MiniBrowser));
@@ -112,6 +121,8 @@
app->browser = ewk_view_add(app->evas);
evas_object_name_set(app->browser, "browser");
+ evas_object_smart_callback_add(app->browser, "title,changed", on_title_changed, app);
+
evas_object_event_callback_add(app->browser, EVAS_CALLBACK_KEY_DOWN, on_key_down, app);
evas_object_size_hint_weight_set(app->browser, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);