Changeset 85987 in webkit


Ignore:
Timestamp:
May 6, 2011 4:29:43 PM (13 years ago)
Author:
Martin Robinson
Message:

2011-05-06 Martin Robinson <mrobinson@igalia.com>

Reviewed by Xan Lopez.

[GTK] [WebKit2] WebView::windowToScreen needs an implementation
https://bugs.webkit.org/show_bug.cgi?id=55960

Abstract coordinate system translation code from WebKit into WebCore.
This will allow the code to be shared between WebKit and WebKit2. The code
now lives in a new GtkUtilities.cpp helper file.

  • GNUmakefile.list.am: Added GtkUtilities to the source list.
  • platform/gtk/GtkUtilities.cpp: Added. (WebCore::convertWidgetRectToScreenRect):
  • platform/gtk/GtkUtilities.h: Added.

2011-05-06 Martin Robinson <mrobinson@igalia.com>

Reviewed by Xan Lopez.

[GTK] [WebKit2] WebView::windowToScreen needs an implementation
https://bugs.webkit.org/show_bug.cgi?id=55960

Abstract the code to translate from widget space to screen space into
a helper method in WebCore.

  • WebCoreSupport/ChromeClientGtk.cpp: Use the new helper method from GtkUtilities. (WebKit::ChromeClient::windowToScreen): (WebKit::ChromeClient::screenToWindow):

2011-05-06 Martin Robinson <mrobinson@igalia.com>

Reviewed by Xan Lopez.

[GTK] [WebKit2] WebView::windowToScreen needs an implementation
https://bugs.webkit.org/show_bug.cgi?id=55960

Add an implementation of PageClient::windowToScreen for GTK+ WebKit2 using
the newly abstracted widget to screen coordinate translation code in WebCore.

  • UIProcess/API/gtk/PageClientImpl.cpp: (WebKit::PageClientImpl::windowToScreen): Added implementation.
Location:
trunk/Source
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r85985 r85987  
     12011-05-06  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        [GTK] [WebKit2] WebView::windowToScreen needs an implementation
     6        https://bugs.webkit.org/show_bug.cgi?id=55960
     7
     8        Abstract coordinate system translation code from WebKit into WebCore.
     9        This will allow the code to be shared between WebKit and WebKit2. The code
     10        now lives in a new GtkUtilities.cpp helper file.
     11
     12        * GNUmakefile.list.am: Added GtkUtilities to the source list.
     13        * platform/gtk/GtkUtilities.cpp: Added.
     14        (WebCore::convertWidgetRectToScreenRect):
     15        * platform/gtk/GtkUtilities.h: Added.
     16
    1172011-05-06  Martin Robinson  <mrobinson@igalia.com>
    218
  • trunk/Source/WebCore/GNUmakefile.list.am

    r85909 r85987  
    37353735        Source/WebCore/platform/gtk/GtkClickCounter.cpp \
    37363736        Source/WebCore/platform/gtk/GtkClickCounter.h \
     3737        Source/WebCore/platform/gtk/GtkUtilities.cpp \
     3738        Source/WebCore/platform/gtk/GtkUtilities.h \
    37373739        Source/WebCore/platform/gtk/GeolocationServiceGtk.cpp \
    37383740        Source/WebCore/platform/gtk/GeolocationServiceGtk.h \
  • trunk/Source/WebKit/gtk/ChangeLog

    r85925 r85987  
     12011-05-06  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        [GTK] [WebKit2] WebView::windowToScreen needs an implementation
     6        https://bugs.webkit.org/show_bug.cgi?id=55960
     7
     8        Abstract the code to translate from widget space to screen space into
     9        a helper method in WebCore.
     10
     11        * WebCoreSupport/ChromeClientGtk.cpp: Use the new helper method from GtkUtilities.
     12        (WebKit::ChromeClient::windowToScreen):
     13        (WebKit::ChromeClient::screenToWindow):
     14
    1152011-05-04  Philippe Normand  <pnormand@igalia.com>
    216
  • trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp

    r85066 r85987  
    3434#include "FrameLoadRequest.h"
    3535#include "FrameView.h"
     36#include "GtkUtilities.h"
    3637#include "GtkVersioning.h"
    3738#include "HTMLNames.h"
     
    451452}
    452453
    453 // FIXME: this does not take into account the WM decorations
    454 static IntPoint widgetScreenPosition(GtkWidget* widget)
    455 {
    456     GtkWidget* window = gtk_widget_get_toplevel(widget);
    457     int widgetX = 0, widgetY = 0;
    458 
    459     gtk_widget_translate_coordinates(widget, window, 0, 0, &widgetX, &widgetY);
    460 
    461     IntPoint result(widgetX, widgetY);
    462     int originX, originY;
    463     gdk_window_get_origin(gtk_widget_get_window(window), &originX, &originY);
    464     result.move(originX, originY);
    465 
    466     return result;
    467 }
    468 
    469454IntRect ChromeClient::windowToScreen(const IntRect& rect) const
    470455{
    471     IntRect result(rect);
    472     IntPoint screenPosition = widgetScreenPosition(GTK_WIDGET(m_webView));
    473     result.move(screenPosition.x(), screenPosition.y());
    474 
    475     return result;
     456    return convertWidgetRectToScreenRect(GTK_WIDGET(m_webView), rect);
    476457}
    477458
    478459IntPoint ChromeClient::screenToWindow(const IntPoint& point) const
    479460{
     461    IntPoint widgetPositionOnScreen = convertWidgetRectToScreenRect(GTK_WIDGET(m_webView),
     462                                                                    IntRect(IntPoint(), IntSize())).location();
    480463    IntPoint result(point);
    481     IntPoint screenPosition = widgetScreenPosition(GTK_WIDGET(m_webView));
    482     result.move(-screenPosition.x(), -screenPosition.y());
    483 
     464    result.move(-widgetPositionOnScreen.x(), -widgetPositionOnScreen.y());
    484465    return result;
    485466}
  • trunk/Source/WebKit2/ChangeLog

    r85983 r85987  
     12011-05-06  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        [GTK] [WebKit2] WebView::windowToScreen needs an implementation
     6        https://bugs.webkit.org/show_bug.cgi?id=55960
     7
     8        Add an implementation of PageClient::windowToScreen for GTK+ WebKit2 using
     9        the newly abstracted widget to screen coordinate translation code in WebCore.
     10
     11        * UIProcess/API/gtk/PageClientImpl.cpp:
     12        (WebKit::PageClientImpl::windowToScreen): Added implementation.
     13
    1142011-05-06  Anders Carlsson  <andersca@apple.com>
    215
  • trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp

    r85860 r85987  
    3838#include "WebKitWebViewBasePrivate.h"
    3939#include "WebPageProxy.h"
     40#include <WebCore/GtkUtilities.h>
    4041#include <wtf/text/WTFString.h>
    4142
     
    413414IntRect PageClientImpl::windowToScreen(const IntRect& rect)
    414415{
    415     notImplemented();
    416     return IntRect();
     416    return convertWidgetRectToScreenRect(m_viewWidget, rect);
    417417}
    418418
Note: See TracChangeset for help on using the changeset viewer.