Changeset 148274 in webkit


Ignore:
Timestamp:
Apr 12, 2013 6:10:28 AM (11 years ago)
Author:
mikhail.pozdnyakov@intel.com
Message:

[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.

Location:
trunk/Source/WebKit2
Files:
11 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/CMakeLists.txt

    r148165 r148274  
    302302    UIProcess/WebVibrationProvider.cpp
    303303    UIProcess/WebVibrationProxy.cpp
     304    UIProcess/WebViewportAttributes.cpp
    304305
    305306    UIProcess/API/C/WKApplicationCacheManager.cpp
     
    344345    UIProcess/API/C/WKTextChecker.cpp
    345346    UIProcess/API/C/WKVibration.cpp
     347    UIProcess/API/C/WKViewportAttributes.cpp
    346348
    347349    UIProcess/API/CoordinatedGraphics/WKCoordinatedScene.cpp
  • trunk/Source/WebKit2/ChangeLog

    r148267 r148274  
     12013-04-12  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
     2
     3        [WK2][EFL] WebView: Add callbacks to the WKViewClient to handle page viewport update
     4        https://bugs.webkit.org/show_bug.cgi?id=110463
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * UIProcess/efl/ViewClientEfl.h:
     9        (ViewClientEfl):
     10        * UIProcess/efl/WebView.cpp:
     11        (WebKit::WebView::didChangeViewportProperties):
     12        * UIProcess/efl/WebViewClient.cpp:
     13        (WebKit::WebViewClient::didChangeViewportAttributes):
     14        (WebKit):
     15        * UIProcess/efl/WebViewClient.h:
     16
     17            Added didChangeViewportAttributes callback to the WKViewClient to
     18            handle page viewport updates.
     19
     20        * CMakeLists.txt:
     21        * Shared/API/c/WKBase.h:
     22        * Shared/APIObject.h:
     23        * UIProcess/API/C/WKAPICast.h:
     24        (WebKit):
     25        * UIProcess/API/C/WKViewportAttributes.cpp: Added.
     26        (WKViewportAttributesGetTypeID):
     27        * UIProcess/API/C/WKViewportAttributes.h: Added.
     28        * UIProcess/API/C/efl/WKView.h:
     29        * UIProcess/WebViewportAttributes.cpp: Added.
     30        (WebKit):
     31        (WebKit::WebViewportAttributes::WebViewportAttributes):
     32        (WebKit::WebViewportAttributes::~WebViewportAttributes):
     33        * UIProcess/WebViewportAttributes.h: Added.
     34        (WebKit):
     35        (WebViewportAttributes):
     36        (WebKit::WebViewportAttributes::create):
     37        (WebKit::WebViewportAttributes::originalAttributes):
     38        (WebKit::WebViewportAttributes::type):
     39
     40            Added WKViewportAttributesRef - WK2 C API object that is wrapping
     41            WebCore::ViewportAttributes structure and is passed in didChangeViewportAttributes
     42            WKViewClient callback.
     43
     44        * UIProcess/efl/ViewClientEfl.cpp:
     45        (WebKit::ViewClientEfl::didChangeViewportAttributes):
     46        (WebKit):
     47
     48            Added implementaion of didChangeViewportAttributes WKViewClient
     49            callback so that existing EFL WK2 funtionality is kept.
     50
     51
    1522013-04-12  Carlos Garcia Campos  <cgarcia@igalia.com>
    253
  • trunk/Source/WebKit2/Shared/API/c/WKBase.h

    r147963 r148274  
    134134typedef const struct OpaqueWKTextChecker* WKTextCheckerRef;
    135135typedef const struct OpaqueWKVibration* WKVibrationRef;
     136typedef const struct OpaqueWKViewportAttributes* WKViewportAttributesRef;
    136137
    137138/* WebKit2 Bundle types */
  • trunk/Source/WebKit2/Shared/APIObject.h

    r147403 r148274  
    110110        TypeTextChecker,
    111111        TypeVibration,
     112        TypeViewportAttributes,
    112113
    113114        // Bundle types
  • trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h

    r147963 r148274  
    9595class WebTextChecker;
    9696class WebVibrationProxy;
     97class WebViewportAttributes;
    9798
    9899WK_ADD_API_MAPPING(WKApplicationCacheManagerRef, WebApplicationCacheManagerProxy)
     
    139140WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker)
    140141WK_ADD_API_MAPPING(WKVibrationRef, WebVibrationProxy)
     142WK_ADD_API_MAPPING(WKViewportAttributesRef, WebViewportAttributes)
    141143WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy)
    142144
  • trunk/Source/WebKit2/UIProcess/API/C/WKViewportAttributes.cpp

    r148273 r148274  
    11/*
    2  * Copyright (C) 2013 Samsung Electronics. All rights reserved.
     2 * Copyright (C) 2013 Intel Corporation. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    66 * are met:
    77 * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
     8 *    notice, this list of conditions and the followlayoutSizeing disclaimer.
    99 * 2. Redistributions in binary form must reproduce the above copyright
    10  *    notice, this list of conditions and the following disclaimer in the
     10 *    notice, this list Viewof conditions and the following disclaimer in the
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
     
    2424 */
    2525
    26 #ifndef WebViewClient_h
    27 #define WebViewClient_h
     26#include "config.h"
     27#include "WKViewportAttributes.h"
    2828
    29 #include "APIClient.h"
    30 #include "WKView.h"
    31 #include <wtf/text/WTFString.h>
     29#include "WKAPICast.h"
     30#include "WebViewportAttributes.h"
    3231
    33 namespace WebCore {
    34 class IntPoint;
    35 class IntRect;
    36 class IntSize;
     32using namespace WebKit;
     33
     34WKTypeID WKViewportAttributesGetTypeID()
     35{
     36    return toAPI(WebViewportAttributes::APIType);
    3737}
    38 
    39 namespace WebKit {
    40 
    41 class WebView;
    42 
    43 class WebViewClient: public APIClient<WKViewClient, kWKViewClientCurrentVersion> {
    44 public:
    45     void viewNeedsDisplay(WebView*, const WebCore::IntRect&);
    46     void didChangeContentsSize(WebView*, const WebCore::IntSize&);
    47     void webProcessCrashed(WebView*, const String& url);
    48     void webProcessDidRelaunch(WebView*);
    49     void didChangeContentsPosition(WebView*, const WebCore::IntPoint&);
    50     void didRenderFrame(WebView*, const WebCore::IntSize&, const WebCore::IntRect&);
    51     void didCompletePageTransition(WebView*);
    52 };
    53 
    54 } // namespace WebKit
    55 
    56 #endif // WebViewClient_h
  • trunk/Source/WebKit2/UIProcess/API/C/WKViewportAttributes.h

    r148273 r148274  
    11/*
    2  * Copyright (C) 2013 Samsung Electronics. All rights reserved.
     2 * Copyright (C) 2013 Intel Corporation. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    88 *    notice, this list of conditions and the following disclaimer.
    99 * 2. Redistributions in binary form must reproduce the above copyright
    10  *    notice, this list of conditions and the following disclaimer in the
     10 *    notice, this list Viewof conditions and the following disclaimer in the
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
     
    2424 */
    2525
    26 #ifndef WebViewClient_h
    27 #define WebViewClient_h
     26#ifndef WKViewportAttributes_h
     27#define WKViewportAttributes_h
    2828
    29 #include "APIClient.h"
    30 #include "WKView.h"
    31 #include <wtf/text/WTFString.h>
     29#include <WebKit2/WKBase.h>
     30#include <WebKit2/WKGeometry.h>
    3231
    33 namespace WebCore {
    34 class IntPoint;
    35 class IntRect;
    36 class IntSize;
     32#ifdef __cplusplus
     33extern "C" {
     34#endif
     35
     36WK_EXPORT WKTypeID WKViewportAttributesGetTypeID();
     37
     38#ifdef __cplusplus
    3739}
     40#endif
    3841
    39 namespace WebKit {
    40 
    41 class WebView;
    42 
    43 class WebViewClient: public APIClient<WKViewClient, kWKViewClientCurrentVersion> {
    44 public:
    45     void viewNeedsDisplay(WebView*, const WebCore::IntRect&);
    46     void didChangeContentsSize(WebView*, const WebCore::IntSize&);
    47     void webProcessCrashed(WebView*, const String& url);
    48     void webProcessDidRelaunch(WebView*);
    49     void didChangeContentsPosition(WebView*, const WebCore::IntPoint&);
    50     void didRenderFrame(WebView*, const WebCore::IntSize&, const WebCore::IntRect&);
    51     void didCompletePageTransition(WebView*);
    52 };
    53 
    54 } // namespace WebKit
    55 
    56 #endif // WebViewClient_h
     42#endif /* WKViewportAttributes_h */
  • trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.h

    r147913 r148274  
    3737typedef void (*WKViewPageDidChangeContentsPositionCallback)(WKViewRef view, WKPoint position, const void* clientInfo);
    3838typedef void (*WKViewPageDidRenderFrameCallback)(WKViewRef view, WKSize contentsSize, WKRect coveredRect, const void* clientInfo);
     39typedef void (*WKViewPageDidChangeViewportAttributesCallback)(WKViewRef view, WKViewportAttributesRef, const void* clientInfo);
    3940
    4041struct WKViewClient {
     
    5051    WKViewPageDidRenderFrameCallback                 didRenderFrame;
    5152    WKViewCallback                                   didCompletePageTransition;
     53    WKViewPageDidChangeViewportAttributesCallback    didChangeViewportAttributes;
    5254};
    5355typedef struct WKViewClient WKViewClient;
  • trunk/Source/WebKit2/UIProcess/WebViewportAttributes.cpp

    r148273 r148274  
    11/*
    2  * Copyright (C) 2013 Samsung Electronics. All rights reserved.
     2 * Copyright (C) 2013 Intel Corporation. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #ifndef WebViewClient_h
    27 #define WebViewClient_h
    28 
    29 #include "APIClient.h"
    30 #include "WKView.h"
    31 #include <wtf/text/WTFString.h>
    32 
    33 namespace WebCore {
    34 class IntPoint;
    35 class IntRect;
    36 class IntSize;
    37 }
     26#include "config.h"
     27#include "WebViewportAttributes.h"
    3828
    3929namespace WebKit {
    4030
    41 class WebView;
     31WebViewportAttributes::WebViewportAttributes(const WebCore::ViewportAttributes& attributes)
     32    : m_attributes(attributes)
     33{
     34}
    4235
    43 class WebViewClient: public APIClient<WKViewClient, kWKViewClientCurrentVersion> {
    44 public:
    45     void viewNeedsDisplay(WebView*, const WebCore::IntRect&);
    46     void didChangeContentsSize(WebView*, const WebCore::IntSize&);
    47     void webProcessCrashed(WebView*, const String& url);
    48     void webProcessDidRelaunch(WebView*);
    49     void didChangeContentsPosition(WebView*, const WebCore::IntPoint&);
    50     void didRenderFrame(WebView*, const WebCore::IntSize&, const WebCore::IntRect&);
    51     void didCompletePageTransition(WebView*);
    52 };
     36WebViewportAttributes::~WebViewportAttributes()
     37{
     38}
    5339
    5440} // namespace WebKit
    55 
    56 #endif // WebViewClient_h
  • trunk/Source/WebKit2/UIProcess/WebViewportAttributes.h

    r148273 r148274  
    11/*
    2  * Copyright (C) 2013 Samsung Electronics. All rights reserved.
     2 * Copyright (C) 2013 Intel Corporation. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    88 *    notice, this list of conditions and the following disclaimer.
    99 * 2. Redistributions in binary form must reproduce the above copyright
    10  *    notice, this list of conditions and the following disclaimer in the
     10 *    notice, this list Viewof conditions and the following disclaimer in the
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
     
    2424 */
    2525
    26 #ifndef WebViewClient_h
    27 #define WebViewClient_h
     26#ifndef WebViewportAttributes_h
     27#define WebViewportAttributes_h
    2828
    29 #include "APIClient.h"
    30 #include "WKView.h"
    31 #include <wtf/text/WTFString.h>
    32 
    33 namespace WebCore {
    34 class IntPoint;
    35 class IntRect;
    36 class IntSize;
    37 }
     29#include "APIObject.h"
     30#include <WebCore/ViewportArguments.h>
     31#include <wtf/PassRefPtr.h>
    3832
    3933namespace WebKit {
    4034
    41 class WebView;
     35class WebViewportAttributes : public TypedAPIObject<APIObject::TypeViewportAttributes> {
     36public:
     37    static PassRefPtr<WebViewportAttributes> create(const WebCore::ViewportAttributes& attributes)
     38    {
     39        return adoptRef(new WebViewportAttributes(attributes));
     40    }
    4241
    43 class WebViewClient: public APIClient<WKViewClient, kWKViewClientCurrentVersion> {
    44 public:
    45     void viewNeedsDisplay(WebView*, const WebCore::IntRect&);
    46     void didChangeContentsSize(WebView*, const WebCore::IntSize&);
    47     void webProcessCrashed(WebView*, const String& url);
    48     void webProcessDidRelaunch(WebView*);
    49     void didChangeContentsPosition(WebView*, const WebCore::IntPoint&);
    50     void didRenderFrame(WebView*, const WebCore::IntSize&, const WebCore::IntRect&);
    51     void didCompletePageTransition(WebView*);
     42    virtual ~WebViewportAttributes();
     43
     44    const WebCore::ViewportAttributes& originalAttributes() const { return m_attributes; }
     45
     46private:
     47    explicit WebViewportAttributes(const WebCore::ViewportAttributes&);
     48
     49    WebCore::ViewportAttributes m_attributes;
    5250};
    5351
    5452} // namespace WebKit
    5553
    56 #endif // WebViewClient_h
     54#endif // WebViewportAttributes_h
  • trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.cpp

    r147913 r148274  
    2929#include "EwkView.h"
    3030#include "PageViewportController.h"
     31#include "WebViewportAttributes.h"
    3132#include <WebKit2/WKString.h>
    3233#include <WebKit2/WKView.h>
     
    132133}
    133134
     135void ViewClientEfl::didChangeViewportAttributes(WKViewRef, WKViewportAttributesRef attributes, const void* clientInfo)
     136{
     137    EwkView* ewkView = toEwkView(clientInfo);
     138    if (WKPageUseFixedLayout(ewkView->wkPage())) {
     139#if USE(ACCELERATED_COMPOSITING)
     140        // FIXME: pageViewportController should accept WKViewportAttributesRef.
     141        ewkView->pageViewportController()->didChangeViewportAttributes(toImpl(attributes)->originalAttributes());
     142#endif
     143        return;
     144    }
     145    ewkView->scheduleUpdateDisplay();
     146}
     147
    134148ViewClientEfl::ViewClientEfl(EwkView* view)
    135149    : m_view(view)
  • trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.h

    r147913 r148274  
    5555    static void didRenderFrame(WKViewRef, WKSize, WKRect, const void* clientInfo);
    5656    static void didCompletePageTransition(WKViewRef, const void* clientInfo);
     57    static void didChangeViewportAttributes(WKViewRef, WKViewportAttributesRef, const void* clientInfo);
    5758
    5859    EwkView* m_view;
  • trunk/Source/WebKit2/UIProcess/efl/WebView.cpp

    r147913 r148274  
    530530void WebView::didChangeViewportProperties(const WebCore::ViewportAttributes& attr)
    531531{
    532     if (m_page->useFixedLayout()) {
    533 #if USE(ACCELERATED_COMPOSITING)
    534         m_ewkView->pageViewportController()->didChangeViewportAttributes(attr);
    535 #endif
    536         return;
    537     }
    538     m_ewkView->scheduleUpdateDisplay();
     532    m_client.didChangeViewportAttributes(this, attr);
    539533}
    540534
  • trunk/Source/WebKit2/UIProcess/efl/WebViewClient.cpp

    r147913 r148274  
    2626#include "config.h"
    2727#include "WebViewClient.h"
     28#include "WebViewportAttributes.h"
    2829
    2930#include "WKAPICast.h"
     31#include "WKBase.h"
    3032#include "WKRetainPtr.h"
    3133
     
    9092}
    9193
     94void WebViewClient::didChangeViewportAttributes(WebView* view, const ViewportAttributes& attributes)
     95{
     96    if (!m_client.didChangeViewportAttributes)
     97        return;
     98
     99    WKRetainPtr<WKViewportAttributesRef> wkAttributes = adoptWK(toAPI(WebViewportAttributes::create(attributes).leakRef()));
     100    m_client.didChangeViewportAttributes(toAPI(view), wkAttributes.get(), m_client.clientInfo);
     101}
     102
    92103} // namespace WebKit
  • trunk/Source/WebKit2/UIProcess/efl/WebViewClient.h

    r147913 r148274  
    3535class IntRect;
    3636class IntSize;
     37class ViewportAttributes;
    3738}
    3839
     
    5051    void didRenderFrame(WebView*, const WebCore::IntSize&, const WebCore::IntRect&);
    5152    void didCompletePageTransition(WebView*);
     53    void didChangeViewportAttributes(WebView*, const WebCore::ViewportAttributes&);
    5254};
    5355
Note: See TracChangeset for help on using the changeset viewer.