[WK2][EFL] WebView: Add callbacks to the WKViewClient to handle page viewport update

https://bugs.webkit.org/show_bug.cgi?id=110463

Reviewed by Anders Carlsson.

* UIProcess/efl/ViewClientEfl.h:
(ViewClientEfl):
* UIProcess/efl/WebView.cpp:
(WebKit::WebView::didChangeViewportProperties):
* UIProcess/efl/WebViewClient.cpp:
(WebKit::WebViewClient::didChangeViewportAttributes):
(WebKit):
* UIProcess/efl/WebViewClient.h:

    Added didChangeViewportAttributes callback to the WKViewClient to
    handle page viewport updates.

* CMakeLists.txt:
* Shared/API/c/WKBase.h:
* Shared/APIObject.h:
* UIProcess/API/C/WKAPICast.h:
(WebKit):
* UIProcess/API/C/WKViewportAttributes.cpp: Added.
(WKViewportAttributesGetTypeID):
* UIProcess/API/C/WKViewportAttributes.h: Added.
* UIProcess/API/C/efl/WKView.h:
* UIProcess/WebViewportAttributes.cpp: Added.
(WebKit):
(WebKit::WebViewportAttributes::WebViewportAttributes):
(WebKit::WebViewportAttributes::~WebViewportAttributes):
* UIProcess/WebViewportAttributes.h: Added.
(WebKit):
(WebViewportAttributes):
(WebKit::WebViewportAttributes::create):
(WebKit::WebViewportAttributes::originalAttributes):
(WebKit::WebViewportAttributes::type):

    Added WKViewportAttributesRef - WK2 C API object that is wrapping
    WebCore::ViewportAttributes structure and is passed in didChangeViewportAttributes
    WKViewClient callback.

* UIProcess/efl/ViewClientEfl.cpp:
(WebKit::ViewClientEfl::didChangeViewportAttributes):
(WebKit):

    Added implementaion of didChangeViewportAttributes WKViewClient
    callback so that existing EFL WK2 funtionality is kept.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148274 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8ab172be
......@@ -301,6 +301,7 @@ set(WebKit2_SOURCES
UIProcess/WebUIClient.cpp
UIProcess/WebVibrationProvider.cpp
UIProcess/WebVibrationProxy.cpp
UIProcess/WebViewportAttributes.cpp
UIProcess/API/C/WKApplicationCacheManager.cpp
UIProcess/API/C/WKAuthenticationChallenge.cpp
......@@ -343,6 +344,7 @@ set(WebKit2_SOURCES
UIProcess/API/C/WKResourceCacheManager.cpp
UIProcess/API/C/WKTextChecker.cpp
UIProcess/API/C/WKVibration.cpp
UIProcess/API/C/WKViewportAttributes.cpp
UIProcess/API/CoordinatedGraphics/WKCoordinatedScene.cpp
......
2013-04-12 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com>
[WK2][EFL] WebView: Add callbacks to the WKViewClient to handle page viewport update
https://bugs.webkit.org/show_bug.cgi?id=110463
Reviewed by Anders Carlsson.
* UIProcess/efl/ViewClientEfl.h:
(ViewClientEfl):
* UIProcess/efl/WebView.cpp:
(WebKit::WebView::didChangeViewportProperties):
* UIProcess/efl/WebViewClient.cpp:
(WebKit::WebViewClient::didChangeViewportAttributes):
(WebKit):
* UIProcess/efl/WebViewClient.h:
Added didChangeViewportAttributes callback to the WKViewClient to
handle page viewport updates.
* CMakeLists.txt:
* Shared/API/c/WKBase.h:
* Shared/APIObject.h:
* UIProcess/API/C/WKAPICast.h:
(WebKit):
* UIProcess/API/C/WKViewportAttributes.cpp: Added.
(WKViewportAttributesGetTypeID):
* UIProcess/API/C/WKViewportAttributes.h: Added.
* UIProcess/API/C/efl/WKView.h:
* UIProcess/WebViewportAttributes.cpp: Added.
(WebKit):
(WebKit::WebViewportAttributes::WebViewportAttributes):
(WebKit::WebViewportAttributes::~WebViewportAttributes):
* UIProcess/WebViewportAttributes.h: Added.
(WebKit):
(WebViewportAttributes):
(WebKit::WebViewportAttributes::create):
(WebKit::WebViewportAttributes::originalAttributes):
(WebKit::WebViewportAttributes::type):
Added WKViewportAttributesRef - WK2 C API object that is wrapping
WebCore::ViewportAttributes structure and is passed in didChangeViewportAttributes
WKViewClient callback.
* UIProcess/efl/ViewClientEfl.cpp:
(WebKit::ViewClientEfl::didChangeViewportAttributes):
(WebKit):
Added implementaion of didChangeViewportAttributes WKViewClient
callback so that existing EFL WK2 funtionality is kept.
2013-04-12 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] The style of visited links doesn't change in WebKit2
......@@ -133,6 +133,7 @@ typedef const struct OpaqueWKPreferences* WKPreferencesRef;
typedef const struct OpaqueWKProtectionSpace* WKProtectionSpaceRef;
typedef const struct OpaqueWKTextChecker* WKTextCheckerRef;
typedef const struct OpaqueWKVibration* WKVibrationRef;
typedef const struct OpaqueWKViewportAttributes* WKViewportAttributesRef;
/* WebKit2 Bundle types */
......
......@@ -109,6 +109,7 @@ public:
TypePreferences,
TypeTextChecker,
TypeVibration,
TypeViewportAttributes,
// Bundle types
TypeBundle,
......
......@@ -94,6 +94,7 @@ class WebRenderLayer;
class WebRenderObject;
class WebTextChecker;
class WebVibrationProxy;
class WebViewportAttributes;
WK_ADD_API_MAPPING(WKApplicationCacheManagerRef, WebApplicationCacheManagerProxy)
WK_ADD_API_MAPPING(WKAuthenticationChallengeRef, AuthenticationChallengeProxy)
......@@ -138,6 +139,7 @@ WK_ADD_API_MAPPING(WKRenderLayerRef, WebRenderLayer)
WK_ADD_API_MAPPING(WKRenderObjectRef, WebRenderObject)
WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker)
WK_ADD_API_MAPPING(WKVibrationRef, WebVibrationProxy)
WK_ADD_API_MAPPING(WKViewportAttributesRef, WebViewportAttributes)
WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy)
/* Enum conversions */
......
/*
* Copyright (C) 2013 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 followlayoutSizeing disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list Viewof conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT HOLDERS OR
* 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 "WKViewportAttributes.h"
#include "WKAPICast.h"
#include "WebViewportAttributes.h"
using namespace WebKit;
WKTypeID WKViewportAttributesGetTypeID()
{
return toAPI(WebViewportAttributes::APIType);
}
/*
* Copyright (C) 2013 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 Viewof conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT HOLDERS OR
* 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 WKViewportAttributes_h
#define WKViewportAttributes_h
#include <WebKit2/WKBase.h>
#include <WebKit2/WKGeometry.h>
#ifdef __cplusplus
extern "C" {
#endif
WK_EXPORT WKTypeID WKViewportAttributesGetTypeID();
#ifdef __cplusplus
}
#endif
#endif /* WKViewportAttributes_h */
......@@ -36,6 +36,7 @@ typedef void (*WKViewPageDidChangeContentsSizeCallback)(WKViewRef view, WKSize s
typedef void (*WKViewWebProcessCrashedCallback)(WKViewRef view, WKURLRef url, const void* clientInfo);
typedef void (*WKViewPageDidChangeContentsPositionCallback)(WKViewRef view, WKPoint position, const void* clientInfo);
typedef void (*WKViewPageDidRenderFrameCallback)(WKViewRef view, WKSize contentsSize, WKRect coveredRect, const void* clientInfo);
typedef void (*WKViewPageDidChangeViewportAttributesCallback)(WKViewRef view, WKViewportAttributesRef, const void* clientInfo);
struct WKViewClient {
int version;
......@@ -49,6 +50,7 @@ struct WKViewClient {
WKViewPageDidChangeContentsPositionCallback didChangeContentsPosition;
WKViewPageDidRenderFrameCallback didRenderFrame;
WKViewCallback didCompletePageTransition;
WKViewPageDidChangeViewportAttributesCallback didChangeViewportAttributes;
};
typedef struct WKViewClient WKViewClient;
......
/*
* Copyright (C) 2013 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 THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT HOLDERS OR
* 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 "WebViewportAttributes.h"
namespace WebKit {
WebViewportAttributes::WebViewportAttributes(const WebCore::ViewportAttributes& attributes)
: m_attributes(attributes)
{
}
WebViewportAttributes::~WebViewportAttributes()
{
}
} // namespace WebKit
/*
* Copyright (C) 2013 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 Viewof conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 THE COPYRIGHT HOLDERS OR
* 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 WebViewportAttributes_h
#define WebViewportAttributes_h
#include "APIObject.h"
#include <WebCore/ViewportArguments.h>
#include <wtf/PassRefPtr.h>
namespace WebKit {
class WebViewportAttributes : public TypedAPIObject<APIObject::TypeViewportAttributes> {
public:
static PassRefPtr<WebViewportAttributes> create(const WebCore::ViewportAttributes& attributes)
{
return adoptRef(new WebViewportAttributes(attributes));
}
virtual ~WebViewportAttributes();
const WebCore::ViewportAttributes& originalAttributes() const { return m_attributes; }
private:
explicit WebViewportAttributes(const WebCore::ViewportAttributes&);
WebCore::ViewportAttributes m_attributes;
};
} // namespace WebKit
#endif // WebViewportAttributes_h
......@@ -28,6 +28,7 @@
#include "EwkView.h"
#include "PageViewportController.h"
#include "WebViewportAttributes.h"
#include <WebKit2/WKString.h>
#include <WebKit2/WKView.h>
......@@ -131,6 +132,19 @@ void ViewClientEfl::didCompletePageTransition(WKViewRef, const void* clientInfo)
ewkView->scheduleUpdateDisplay();
}
void ViewClientEfl::didChangeViewportAttributes(WKViewRef, WKViewportAttributesRef attributes, const void* clientInfo)
{
EwkView* ewkView = toEwkView(clientInfo);
if (WKPageUseFixedLayout(ewkView->wkPage())) {
#if USE(ACCELERATED_COMPOSITING)
// FIXME: pageViewportController should accept WKViewportAttributesRef.
ewkView->pageViewportController()->didChangeViewportAttributes(toImpl(attributes)->originalAttributes());
#endif
return;
}
ewkView->scheduleUpdateDisplay();
}
ViewClientEfl::ViewClientEfl(EwkView* view)
: m_view(view)
{
......
......@@ -54,6 +54,7 @@ private:
static void didChangeContentsPosition(WKViewRef, WKPoint, const void* clientInfo);
static void didRenderFrame(WKViewRef, WKSize, WKRect, const void* clientInfo);
static void didCompletePageTransition(WKViewRef, const void* clientInfo);
static void didChangeViewportAttributes(WKViewRef, WKViewportAttributesRef, const void* clientInfo);
EwkView* m_view;
};
......
......@@ -529,13 +529,7 @@ FloatRect WebView::convertToUserSpace(const FloatRect& deviceRect)
void WebView::didChangeViewportProperties(const WebCore::ViewportAttributes& attr)
{
if (m_page->useFixedLayout()) {
#if USE(ACCELERATED_COMPOSITING)
m_ewkView->pageViewportController()->didChangeViewportAttributes(attr);
#endif
return;
}
m_ewkView->scheduleUpdateDisplay();
m_client.didChangeViewportAttributes(this, attr);
}
void WebView::pageDidRequestScroll(const IntPoint& position)
......
......@@ -25,8 +25,10 @@
#include "config.h"
#include "WebViewClient.h"
#include "WebViewportAttributes.h"
#include "WKAPICast.h"
#include "WKBase.h"
#include "WKRetainPtr.h"
using namespace WebCore;
......@@ -89,4 +91,13 @@ void WebViewClient::didCompletePageTransition(WebView* view)
m_client.didCompletePageTransition(toAPI(view), m_client.clientInfo);
}
void WebViewClient::didChangeViewportAttributes(WebView* view, const ViewportAttributes& attributes)
{
if (!m_client.didChangeViewportAttributes)
return;
WKRetainPtr<WKViewportAttributesRef> wkAttributes = adoptWK(toAPI(WebViewportAttributes::create(attributes).leakRef()));
m_client.didChangeViewportAttributes(toAPI(view), wkAttributes.get(), m_client.clientInfo);
}
} // namespace WebKit
......@@ -34,6 +34,7 @@ namespace WebCore {
class IntPoint;
class IntRect;
class IntSize;
class ViewportAttributes;
}
namespace WebKit {
......@@ -49,6 +50,7 @@ public:
void didChangeContentsPosition(WebView*, const WebCore::IntPoint&);
void didRenderFrame(WebView*, const WebCore::IntSize&, const WebCore::IntRect&);
void didCompletePageTransition(WebView*);
void didChangeViewportAttributes(WebView*, const WebCore::ViewportAttributes&);
};
} // namespace WebKit
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment