Changeset 48506 in webkit


Ignore:
Timestamp:
Sep 18, 2009 6:53:22 AM (15 years ago)
Author:
xan@webkit.org
Message:

2009-09-18 Xan Lopez <xlopez@igalia.com>

Reviewed by Gustavo Noronha and Jan Alonzo.

[GTK] context menu overriding API is very limited
https://bugs.webkit.org/show_bug.cgi?id=27546

Add new tests to the build.

  • GNUmakefile.am:

WebKit/gtk:

2009-09-18 Xan Lopez <xlopez@igalia.com>

Reviewed by Gustavo Noronha and Jan Alonzo.

[GTK] context menu overriding API is very limited
https://bugs.webkit.org/show_bug.cgi?id=27546

Add webkit_web_view_get_hit_test_result, a function to get a hit
test result from a GdkEventButton. Useful to let applications
decide between several actions on button press depending on what
is being pressed.

  • webkit/webkitwebview.cpp: (webkit_web_view_stop_loading): (documentPointForWindowPoint): (webkit_web_view_get_hit_test_result):
  • webkit/webkitwebview.h:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r48505 r48506  
    1 2009-09-14  Xan Lopez  <xlopez@igalia.com>
     12009-09-18  Xan Lopez  <xlopez@igalia.com>
     2
     3        Reviewed by Gustavo Noronha and Jan Alonzo.
     4
     5        [GTK] context menu overriding API is very limited
     6        https://bugs.webkit.org/show_bug.cgi?id=27546
     7
     8        Add new tests to the build.
     9
     10        * GNUmakefile.am:
     11
     122009-09-18  Xan Lopez  <xlopez@igalia.com>
    213
    314        Reviewed by Gustavo Noronha and Jan Alonzo.
  • trunk/GNUmakefile.am

    r48505 r48506  
    543543        Programs/unittests/testdownload \
    544544        Programs/unittests/testatk \
     545        Programs/unittests/testhittestresult \
    545546        Programs/unittests/testwebsettings \
    546547        Programs/unittests/testwebresource \
     
    610611Programs_unittests_testwebdatasource_CFLAGS = $(webkit_tests_cflags)
    611612Programs_unittests_testwebdatasource_LDADD = $(webkit_tests_ldadd)
     613
     614Programs_unittests_testhittestresult_SOURCES = WebKit/gtk/tests/testhittestresult.c
     615Programs_unittests_testhittestresult_CFLAGS = $(webkit_tests_cflags)
     616Programs_unittests_testhittestresult_LDADD = $(webkit_tests_ldadd)
    612617
    613618# Autogenerated sources
  • trunk/WebKit/gtk/ChangeLog

    r48505 r48506  
     12009-09-18  Xan Lopez  <xlopez@igalia.com>
     2
     3        Reviewed by Gustavo Noronha and Jan Alonzo.
     4
     5        [GTK] context menu overriding API is very limited
     6        https://bugs.webkit.org/show_bug.cgi?id=27546
     7
     8        Add webkit_web_view_get_hit_test_result, a function to get a hit
     9        test result from a GdkEventButton. Useful to let applications
     10        decide between several actions on button press depending on what
     11        is being pressed.
     12
     13        * webkit/webkitwebview.cpp:
     14        (webkit_web_view_stop_loading):
     15        (documentPointForWindowPoint):
     16        (webkit_web_view_get_hit_test_result):
     17        * webkit/webkitwebview.h:
     18
    1192009-09-18  Xan Lopez  <xlopez@igalia.com>
    220
  • trunk/WebKit/gtk/webkit/webkitwebview.cpp

    r48383 r48506  
    6363#include "FrameLoader.h"
    6464#include "FrameView.h"
     65#include "MouseEventWithHitTestResults.h"
    6566#include "PasteboardHelper.h"
    6667#include "PlatformKeyboardEvent.h"
     
    6869#include "ProgressTracker.h"
    6970#include "ResourceHandle.h"
     71#include "RenderView.h"
    7072#include "ScriptValue.h"
    7173#include "Scrollbar.h"
     
    30273029
    30283030    if (FrameLoader* loader = frame->loader())
    3029         loader->stopAllLoaders();
     3031        loader->stopForUserCancel();
    30303032}
    30313033
     
    39123914    return g_list_remove(subResources, priv->mainResource);
    39133915}
     3916
     3917/* From EventHandler.cpp */
     3918static IntPoint documentPointForWindowPoint(Frame* frame, const IntPoint& windowPoint)
     3919{
     3920    FrameView* view = frame->view();
     3921    // FIXME: Is it really OK to use the wrong coordinates here when view is 0?
     3922    // Historically the code would just crash; this is clearly no worse than that.
     3923    return view ? view->windowToContents(windowPoint) : windowPoint;
     3924}
     3925
     3926/**
     3927 * webkit_web_view_get_hit_test_result:
     3928 * @webView: a #WebKitWebView
     3929 * @event: a #GdkEventButton
     3930 *
     3931 * Does a 'hit test' in the coordinates specified by @event to figure
     3932 * out context information about that position in the @webView.
     3933 *
     3934 * Returns: a newly created #WebKitHitTestResult with the context of the
     3935 * specified position.
     3936 *
     3937 * Since: 1.1.15
     3938 **/
     3939WebKitHitTestResult* webkit_web_view_get_hit_test_result(WebKitWebView* webView, GdkEventButton* event)
     3940{
     3941    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL);
     3942    g_return_val_if_fail(event, NULL);
     3943
     3944    PlatformMouseEvent mouseEvent = PlatformMouseEvent(event);
     3945    Frame* frame = core(webView)->mainFrame();
     3946    HitTestRequest request(HitTestRequest::Active);
     3947    IntPoint documentPoint = documentPointForWindowPoint(frame, mouseEvent.pos());
     3948    MouseEventWithHitTestResults mev = frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent);
     3949
     3950    return kit(mev.hitTestResult());
     3951}
  • trunk/WebKit/gtk/webkit/webkitwebview.h

    r47865 r48506  
    364364webkit_web_view_get_view_source_mode            (WebKitWebView        *web_view);
    365365
     366WEBKIT_API WebKitHitTestResult*
     367webkit_web_view_get_hit_test_result             (WebKitWebView        *webView,
     368                                                 GdkEventButton       *event);
    366369G_END_DECLS
    367370
Note: See TracChangeset for help on using the changeset viewer.