Changeset 152878 in webkit


Ignore:
Timestamp:
Jul 18, 2013 7:12:09 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[WK2] Share Qt port's codes to find zoomable area with CoordinatedGraphics.
https://bugs.webkit.org/show_bug.cgi?id=118585

Patch by Eunmi Lee <eunmi15.lee@samsung.com> on 2013-07-18
Reviewed by Anders Carlsson.

The function to find zoomable area is needed in order to implement the
feature to scale for double-tap gesture. The WK2 EFL and NIX port want
to use that function, so extract the code from the Qt port, make it
usable in the CoordinatedGraphics and add API and callback.

  • CMakeLists.txt:
  • Target.pri:
  • UIProcess/API/C/CoordinatedGraphics/WKView.cpp:

(WKViewFindZoomableAreaForRect):

  • UIProcess/API/C/CoordinatedGraphics/WKView.h:
  • UIProcess/API/efl/EwkView.cpp:

(EwkView::didFindZoomableArea):

  • UIProcess/API/efl/EwkView.h:
  • UIProcess/CoordinatedGraphics/WebPageProxyCoordinatedGraphics.cpp: Added.

(WebKit::WebPageProxy::findZoomableAreaForPoint):
(WebKit::WebPageProxy::didFindZoomableArea):

  • UIProcess/CoordinatedGraphics/WebView.cpp:

(WebKit::WebView::didFindZoomableArea):
(WebKit::WebView::findZoomableAreaForPoint):

  • UIProcess/CoordinatedGraphics/WebView.h:
  • UIProcess/CoordinatedGraphics/WebViewClient.cpp:

(WebKit::WebViewClient::didFindZoomableArea):

  • UIProcess/CoordinatedGraphics/WebViewClient.h:
  • UIProcess/PageClient.h:
  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:
  • UIProcess/efl/ViewClientEfl.cpp:

(WebKit::ViewClientEfl::didFindZoomableArea):
(WebKit::ViewClientEfl::ViewClientEfl):

  • UIProcess/efl/ViewClientEfl.h:
  • UIProcess/qt/WebPageProxyQt.cpp:
  • WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp: Added.

(WebKit::WebPage::findZoomableAreaForPoint):

  • WebProcess/WebPage/WebPage.cpp:
  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:
Location:
trunk/Source/WebKit2
Files:
2 added
20 edited

Legend:

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

    r152774 r152878  
    367367
    368368    UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp
     369    UIProcess/CoordinatedGraphics/WebPageProxyCoordinatedGraphics.cpp
    369370
    370371    UIProcess/Downloads/DownloadProxy.cpp
     
    520521
    521522    WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
     523    WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp
    522524)
    523525
  • trunk/Source/WebKit2/ChangeLog

    r152877 r152878  
     12013-07-18  Eunmi Lee  <eunmi15.lee@samsung.com>
     2
     3        [WK2] Share Qt port's codes to find zoomable area with CoordinatedGraphics.
     4        https://bugs.webkit.org/show_bug.cgi?id=118585
     5
     6        Reviewed by Anders Carlsson.
     7
     8        The function to find zoomable area is needed in order to implement the
     9        feature to scale for double-tap gesture. The WK2 EFL and NIX port want
     10        to use that function, so extract the code from the Qt port, make it
     11        usable in the CoordinatedGraphics and add API and callback.
     12
     13        * CMakeLists.txt:
     14        * Target.pri:
     15        * UIProcess/API/C/CoordinatedGraphics/WKView.cpp:
     16        (WKViewFindZoomableAreaForRect):
     17        * UIProcess/API/C/CoordinatedGraphics/WKView.h:
     18        * UIProcess/API/efl/EwkView.cpp:
     19        (EwkView::didFindZoomableArea):
     20        * UIProcess/API/efl/EwkView.h:
     21        * UIProcess/CoordinatedGraphics/WebPageProxyCoordinatedGraphics.cpp: Added.
     22        (WebKit::WebPageProxy::findZoomableAreaForPoint):
     23        (WebKit::WebPageProxy::didFindZoomableArea):
     24        * UIProcess/CoordinatedGraphics/WebView.cpp:
     25        (WebKit::WebView::didFindZoomableArea):
     26        (WebKit::WebView::findZoomableAreaForPoint):
     27        * UIProcess/CoordinatedGraphics/WebView.h:
     28        * UIProcess/CoordinatedGraphics/WebViewClient.cpp:
     29        (WebKit::WebViewClient::didFindZoomableArea):
     30        * UIProcess/CoordinatedGraphics/WebViewClient.h:
     31        * UIProcess/PageClient.h:
     32        * UIProcess/WebPageProxy.h:
     33        * UIProcess/WebPageProxy.messages.in:
     34        * UIProcess/efl/ViewClientEfl.cpp:
     35        (WebKit::ViewClientEfl::didFindZoomableArea):
     36        (WebKit::ViewClientEfl::ViewClientEfl):
     37        * UIProcess/efl/ViewClientEfl.h:
     38        * UIProcess/qt/WebPageProxyQt.cpp:
     39        * WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp: Added.
     40        (WebKit::WebPage::findZoomableAreaForPoint):
     41        * WebProcess/WebPage/WebPage.cpp:
     42        * WebProcess/WebPage/WebPage.h:
     43        * WebProcess/WebPage/WebPage.messages.in:
     44
    1452013-07-18  Simon Cooper  <scooper@apple.com>
    246
  • trunk/Source/WebKit2/Target.pri

    r151699 r152878  
    566566    UIProcess/qt/BackingStoreQt.cpp \
    567567    UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp \
     568    UIProcess/CoordinatedGraphics/WebPageProxyCoordinatedGraphics.cpp \
    568569    UIProcess/DefaultUndoController.cpp \
    569570    UIProcess/Downloads/DownloadProxy.cpp \
     
    749750    WebProcess/WebPage/FindController.cpp \
    750751    WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp \
     752    WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp \
    751753    WebProcess/WebPage/TapHighlightController.cpp \
    752754    WebProcess/WebPage/LayerTreeHost.cpp \
  • trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp

    r151541 r152878  
    2727#include "WebView.h"
    2828
     29using namespace WebCore;
    2930using namespace WebKit;
    3031
     
    189190}
    190191
     192void WKViewFindZoomableAreaForRect(WKViewRef viewRef, WKRect wkRect)
     193{
     194    IntRect rect = toIntRect(wkRect);
     195    toImpl(viewRef)->findZoomableAreaForPoint(rect.center(), rect.size());
     196}
     197
    191198#endif // USE(COORDINATED_GRAPHICS)
  • trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h

    r151541 r152878  
    3737typedef void (*WKViewPageDidChangeViewportAttributesCallback)(WKViewRef view, WKViewportAttributesRef, const void* clientInfo);
    3838typedef void (*WKViewPageDidChangeTooltipCallback)(WKViewRef view, WKStringRef newTooltip, const void* clientInfo);
     39typedef void (*WKViewDidFindZoomableAreaCallback)(WKViewRef view, WKPoint point, WKRect area, const void* clientInfo);
    3940
    4041struct WKViewClient {
     
    5253    WKViewPageDidChangeViewportAttributesCallback    didChangeViewportAttributes;
    5354    WKViewPageDidChangeTooltipCallback               didChangeTooltip;
     55    WKViewDidFindZoomableAreaCallback                didFindZoomableArea;
    5456};
    5557typedef struct WKViewClient WKViewClient;
     
    104106WK_EXPORT double WKViewOpacity(WKViewRef view);
    105107
     108WK_EXPORT void WKViewFindZoomableAreaForRect(WKViewRef, WKRect);
     109
    106110#ifdef __cplusplus
    107111}
  • trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp

    r152147 r152878  
    3030#include "NativeWebMouseEvent.h"
    3131#include "NativeWebWheelEvent.h"
     32#include "NotImplemented.h"
    3233#include "PageLoadClientEfl.h"
    3334#include "PagePolicyClientEfl.h"
     
    13751376}
    13761377
     1378void EwkView::didFindZoomableArea(const WKPoint& point, const WKRect& area)
     1379{
     1380    notImplemented();
     1381}
     1382
    13771383Evas_Smart_Class EwkView::parentSmartClass = EVAS_SMART_CLASS_INIT_NULL;
    13781384
  • trunk/Source/WebKit2/UIProcess/API/efl/EwkView.h

    r151313 r152878  
    202202    PassRefPtr<cairo_surface_t> takeSnapshot();
    203203
     204    void didFindZoomableArea(const WKPoint&, const WKRect&);
     205
    204206private:
    205207    EwkView(WKViewRef, Evas_Object*);
  • trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp

    r152841 r152878  
    208208}
    209209
     210void WebView::didFindZoomableArea(const WebCore::IntPoint& target, const WebCore::IntRect& area)
     211{
     212    m_client.didFindZoomableArea(this, target, area);
     213}
     214
    210215AffineTransform WebView::transformFromScene() const
    211216{
     
    500505}
    501506
     507void WebView::findZoomableAreaForPoint(const IntPoint& point, const IntSize& size)
     508{
     509    m_page->findZoomableAreaForPoint(transformFromScene().mapPoint(point), transformFromScene().mapSize(size));
     510}
     511
    502512} // namespace WebKit
    503513
  • trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h

    r152841 r152878  
    9494#endif
    9595
     96    void findZoomableAreaForPoint(const WebCore::IntPoint&, const WebCore::IntSize&);
     97
    9698    // View client.
    9799    void initializeClient(const WKViewClient*);
     
    102104    const WebCore::IntSize& contentsSize() const { return m_contentsSize; }
    103105    WebCore::FloatSize visibleContentsSize() const;
     106    void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&);
    104107
    105108    // FIXME: Should become private when Web Events creation is moved to WebView.
  • trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebViewClient.cpp

    r148963 r152878  
    112112}
    113113
     114void WebViewClient::didFindZoomableArea(WebView* view, const IntPoint& target, const IntRect& area)
     115{
     116    if (!m_client.didFindZoomableArea)
     117        return;
     118
     119    m_client.didFindZoomableArea(toAPI(view), toAPI(target), toAPI(area), m_client.clientInfo);
     120}
     121
    114122} // namespace WebKit
    115123
  • trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebViewClient.h

    r148963 r152878  
    5555    void didChangeViewportAttributes(WebView*, const WebCore::ViewportAttributes&);
    5656    void didChangeTooltip(WebView*, const String& tooltip);
     57    void didFindZoomableArea(WebView*, const WebCore::IntPoint&, const WebCore::IntRect&);
    5758};
    5859
  • trunk/Source/WebKit2/UIProcess/PageClient.h

    r152841 r152878  
    122122    virtual void pageTransitionViewportReady() = 0;
    123123#endif
     124#if USE(COORDINATED_GRAPHICS)
     125    virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) = 0;
     126#endif
    124127#if PLATFORM(QT)
    125     virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) = 0;
    126128    virtual void handleAuthenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password) = 0;
    127129    virtual void handleCertificateVerificationRequest(const String& hostname, bool& ignoreErrors) = 0;
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r152841 r152878  
    663663    WebPageCreationParameters creationParameters() const;
    664664
    665 #if PLATFORM(QT)
     665#if USE(COORDINATED_GRAPHICS)
    666666    void findZoomableAreaForPoint(const WebCore::IntPoint&, const WebCore::IntSize&);
    667667#endif
     
    888888    void pageTransitionViewportReady();
    889889#endif
    890 #if PLATFORM(QT)
     890#if USE(COORDINATED_GRAPHICS)
    891891    void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&);
    892892#endif
    893 
    894893#if PLATFORM(QT) || PLATFORM(EFL)
    895894    void didChangeContentsSize(const WebCore::IntSize&);
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in

    r152841 r152878  
    7878    PageTransitionViewportReady()
    7979#endif
     80#if USE(COORDINATED_GRAPHICS)
     81    DidFindZoomableArea(WebCore::IntPoint target, WebCore::IntRect area)
     82#endif
    8083#if PLATFORM(QT)
    81     DidFindZoomableArea(WebCore::IntPoint target, WebCore::IntRect area)
    8284    AuthenticationRequiredRequest(WTF::String hostname, WTF::String realm, WTF::String prefilledUsername) -> (WTF::String username, WTF::String password)
    8385    CertificateVerificationRequest(WTF::String hostname) -> (bool ignoreErrors)
  • trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.cpp

    r152525 r152878  
    155155}
    156156
     157void ViewClientEfl::didFindZoomableArea(WKViewRef, WKPoint point, WKRect area, const void* clientInfo)
     158{
     159    toEwkView(clientInfo)->didFindZoomableArea(point, area);
     160}
     161
    157162ViewClientEfl::ViewClientEfl(EwkView* view)
    158163    : m_view(view)
     
    165170    viewClient.clientInfo = this;
    166171    viewClient.didChangeContentsSize = didChangeContentsSize;
     172    viewClient.didFindZoomableArea = didFindZoomableArea;
    167173    viewClient.viewNeedsDisplay = viewNeedsDisplay;
    168174    viewClient.webProcessCrashed = webProcessCrashed;
  • trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.h

    r148660 r152878  
    5757    static void didChangeViewportAttributes(WKViewRef, WKViewportAttributesRef, const void* clientInfo);
    5858    static void didChangeTooltip(WKViewRef, WKStringRef, const void* clientInfo);
     59    static void didFindZoomableArea(WKViewRef, WKPoint, WKRect, const void* clientInfo);
    5960
    6061    EwkView* m_view;
  • trunk/Source/WebKit2/UIProcess/qt/WebPageProxyQt.cpp

    r145515 r152878  
    8787}
    8888
    89 void WebPageProxy::didFindZoomableArea(const IntPoint& target, const IntRect& area)
    90 {
    91     m_pageClient->didFindZoomableArea(target, area);
    92 }
    93 
    94 void WebPageProxy::findZoomableAreaForPoint(const IntPoint& point, const IntSize& area)
    95 {
    96     if (!isValid())
    97         return;
    98 
    99     m_process->send(Messages::WebPage::FindZoomableAreaForPoint(point, area), m_pageID);
    100 }
    101 
    10289void WebPageProxy::authenticationRequiredRequest(const String& hostname, const String& realm, const String& prefilledUsername, String& username, String& password)
    10390{
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r152841 r152878  
    31783178}
    31793179
    3180 #if PLATFORM(QT)
    3181 #if ENABLE(TOUCH_ADJUSTMENT)
    3182 void WebPage::findZoomableAreaForPoint(const WebCore::IntPoint& point, const WebCore::IntSize& area)
    3183 {
    3184     Node* node = 0;
    3185     IntRect zoomableArea;
    3186     bool foundAreaForTouchPoint = m_mainFrame->coreFrame()->eventHandler()->bestZoomableAreaForTouchPoint(point, IntSize(area.width() / 2, area.height() / 2), zoomableArea, node);
    3187 
    3188     if (!foundAreaForTouchPoint)
    3189         return;
    3190 
    3191     ASSERT(node);
    3192 
    3193     if (node->document() && node->document()->view())
    3194         zoomableArea = node->document()->view()->contentsToWindow(zoomableArea);
    3195 
    3196     send(Messages::WebPageProxy::DidFindZoomableArea(point, zoomableArea));
    3197 }
    3198 
    3199 #else
    3200 void WebPage::findZoomableAreaForPoint(const WebCore::IntPoint& point, const WebCore::IntSize& area)
    3201 {
    3202     UNUSED_PARAM(area);
    3203     Frame* mainframe = m_mainFrame->coreFrame();
    3204     HitTestResult result = mainframe->eventHandler()->hitTestResultAtPoint(mainframe->view()->windowToContents(point), HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent);
    3205 
    3206     Node* node = result.innerNode();
    3207 
    3208     if (!node)
    3209         return;
    3210 
    3211     IntRect zoomableArea = node->pixelSnappedBoundingBox();
    3212 
    3213     while (true) {
    3214         bool found = !node->isTextNode() && !node->isShadowRoot();
    3215 
    3216         // No candidate found, bail out.
    3217         if (!found && !node->parentNode())
    3218             return;
    3219 
    3220         // Candidate found, and it is a better candidate than its parent.
    3221         // NB: A parent is considered a better candidate iff the node is
    3222         // contained by it and it is the only child.
    3223         if (found && (!node->parentNode() || node->parentNode()->childNodeCount() != 1))
    3224             break;
    3225 
    3226         node = node->parentNode();
    3227         zoomableArea.unite(node->pixelSnappedBoundingBox());
    3228     }
    3229 
    3230     if (node->document() && node->document()->frame() && node->document()->frame()->view()) {
    3231         const ScrollView* view = node->document()->frame()->view();
    3232         zoomableArea = view->contentsToWindow(zoomableArea);
    3233     }
    3234 
    3235     send(Messages::WebPageProxy::DidFindZoomableArea(point, zoomableArea));
    3236 }
    3237 #endif
    3238 #endif
    3239 
    32403180WebPage::SandboxExtensionTracker::~SandboxExtensionTracker()
    32413181{
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r152841 r152878  
    795795    void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
    796796
    797 #if PLATFORM(QT)
     797#if USE(COORDINATED_GRAPHICS)
    798798    void findZoomableAreaForPoint(const WebCore::IntPoint&, const WebCore::IntSize& area);
    799799#endif
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

    r152425 r152878  
    298298    CancelComposition()
    299299#endif
    300 #if PLATFORM(QT)
     300#if USE(COORDINATED_GRAPHICS)
    301301    FindZoomableAreaForPoint(WebCore::IntPoint point, WebCore::IntSize area)
    302302#endif
Note: See TracChangeset for help on using the changeset viewer.