Changeset 150893 in webkit


Ignore:
Timestamp:
May 29, 2013 7:34:19 AM (11 years ago)
Author:
marcelo.lira@openbossa.org
Message:

[WK2][CoordinatedGraphics][EFL] WKViewUserViewportToContents() function doesn't do what it says
https://bugs.webkit.org/show_bug.cgi?id=116683

Reviewed by Noam Rosenthal.

Source/WebKit2:

WKViewUserViewportToContents now converts WebView coordinates to
page contents coordinates, taking into account factors as content
scale and scroll, and also device scale.

The function WKViewUserViewportToScene was added to convert WebView
coordinates to the coordinates of the canvas/scene where the view
is drawn, and EwkView was fixed to use it, instead of
WKViewUserViewportToContents.

  • UIProcess/API/C/CoordinatedGraphics/WKView.cpp:

(WKViewUserViewportToScene):

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

(EwkView::createGLSurface):

  • UIProcess/CoordinatedGraphics/WebView.cpp:

(WebKit::WebView::userViewportToContents):
(WebKit):
(WebKit::WebView::userViewportToScene):
(WebKit::WebView::transformToScene):

  • UIProcess/CoordinatedGraphics/WebView.h:

(WebView):

Tools:

A coordinates conversion test for WKViewUserViewportToContents was
added to WebKit2 API tests.

  • TestWebKitAPI/PlatformEfl.cmake:
  • TestWebKitAPI/Tests/WebKit2/CoordinatedGraphics/WKViewUserViewportToContents.cpp: Added.

(TestWebKitAPI):
(TestWebKitAPI::TEST):

Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r150884 r150893  
     12013-05-29  Marcelo Lira  <marcelo.lira@openbossa.org>
     2
     3        [WK2][CoordinatedGraphics][EFL] WKViewUserViewportToContents() function doesn't do what it says
     4        https://bugs.webkit.org/show_bug.cgi?id=116683
     5
     6        Reviewed by Noam Rosenthal.
     7
     8        WKViewUserViewportToContents now converts WebView coordinates to
     9        page contents coordinates, taking into account factors as content
     10        scale and scroll, and also device scale.
     11
     12        The function WKViewUserViewportToScene was added to convert WebView
     13        coordinates to the coordinates of the canvas/scene where the view
     14        is drawn, and EwkView was fixed to use it, instead of
     15        WKViewUserViewportToContents.
     16
     17        * UIProcess/API/C/CoordinatedGraphics/WKView.cpp:
     18        (WKViewUserViewportToScene):
     19        * UIProcess/API/C/CoordinatedGraphics/WKView.h:
     20        * UIProcess/API/efl/EwkView.cpp:
     21        (EwkView::createGLSurface):
     22        * UIProcess/CoordinatedGraphics/WebView.cpp:
     23        (WebKit::WebView::userViewportToContents):
     24        (WebKit):
     25        (WebKit::WebView::userViewportToScene):
     26        (WebKit::WebView::transformToScene):
     27        * UIProcess/CoordinatedGraphics/WebView.h:
     28        (WebView):
     29
    1302013-05-29  Carlos Garcia Campos  <cgarcia@igalia.com>
    231
  • trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.cpp

    r150012 r150893  
    107107}
    108108
     109WKPoint WKViewUserViewportToScene(WKViewRef viewRef, WKPoint point)
     110{
     111    WebCore::IntPoint result = toImpl(viewRef)->userViewportToScene(toIntPoint(point));
     112    return WKPointMake(result.x(), result.y());
     113}
     114
    109115void WKViewPaintToCurrentGLContext(WKViewRef viewRef)
    110116{
  • trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h

    r150012 r150893  
    8080WK_EXPORT void WKViewSetUserViewportTranslation(WKViewRef, double tx, double ty);
    8181WK_EXPORT WKPoint WKViewUserViewportToContents(WKViewRef, WKPoint);
     82WK_EXPORT WKPoint WKViewUserViewportToScene(WKViewRef, WKPoint);
    8283
    8384WK_EXPORT void WKViewPaintToCurrentGLContext(WKViewRef);
  • trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp

    r150332 r150893  
    775775    Evas_GL_API* gl = evas_gl_api_get(m_evasGL.get());
    776776
    777     const WKPoint& boundsEnd = WKViewUserViewportToContents(wkView(), WKPointMake(deviceSize().width(), deviceSize().height()));
     777    WKPoint boundsEnd = WKViewUserViewportToScene(wkView(), WKPointMake(deviceSize().width(), deviceSize().height()));
    778778    gl->glViewport(0, 0, boundsEnd.x, boundsEnd.y);
    779779    gl->glClearColor(1.0, 1.0, 1.0, 0);
  • trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp

    r150802 r150893  
    111111IntPoint WebView::userViewportToContents(const IntPoint& point) const
    112112{
     113    return transformFromScene().mapPoint(point);
     114}
     115
     116IntPoint WebView::userViewportToScene(const WebCore::IntPoint& point) const
     117{
    113118    return m_userViewportTransform.mapPoint(point);
    114119}
     
    203208AffineTransform WebView::transformToScene() const
    204209{
     210    FloatPoint position = -m_contentPosition;
     211    float effectiveScale = m_contentScaleFactor * m_page->deviceScaleFactor();
     212    position.scale(effectiveScale, effectiveScale);
     213
    205214    TransformationMatrix transform = m_userViewportTransform;
    206 
    207     const FloatPoint& position = contentPosition();
    208     transform.scale(m_page->deviceScaleFactor());
    209     transform.translate(-position.x(), -position.y());
    210     transform.scale(contentScaleFactor());
     215    transform.translate(position.x(), position.y());
     216    transform.scale(effectiveScale);
    211217
    212218    return transform.toAffineTransform();
  • trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.h

    r150764 r150893  
    7272    void setUserViewportTranslation(double tx, double ty);
    7373    WebCore::IntPoint userViewportToContents(const WebCore::IntPoint&) const;
     74    WebCore::IntPoint userViewportToScene(const WebCore::IntPoint&) const;
    7475
    7576    void paintToCurrentGLContext();
  • trunk/Tools/ChangeLog

    r150891 r150893  
     12013-05-29  Marcelo Lira  <marcelo.lira@openbossa.org>
     2
     3        [WK2][CoordinatedGraphics][EFL] WKViewUserViewportToContents() function doesn't do what it says
     4        https://bugs.webkit.org/show_bug.cgi?id=116683
     5
     6        Reviewed by Noam Rosenthal.
     7
     8        A coordinates conversion test for WKViewUserViewportToContents was
     9        added to WebKit2 API tests.
     10
     11        * TestWebKitAPI/PlatformEfl.cmake:
     12        * TestWebKitAPI/Tests/WebKit2/CoordinatedGraphics/WKViewUserViewportToContents.cpp: Added.
     13        (TestWebKitAPI):
     14        (TestWebKitAPI::TEST):
     15
    1162013-05-29  Yong Li  <yong.li.webkit@outlook.com>
    217
  • trunk/Tools/TestWebKitAPI/PlatformEfl.cmake

    r149073 r150893  
    9595    WKURL
    9696    WillSendSubmitEvent
     97    CoordinatedGraphics/WKViewUserViewportToContents
    9798    efl/WKViewClientWebProcessCallbacks
    9899)
Note: See TracChangeset for help on using the changeset viewer.