Commit fd4dd8e1 authored by xan@webkit.org's avatar xan@webkit.org

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:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48506 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2266a5b0
2009-09-14 Xan Lopez <xlopez@igalia.com>
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:
2009-09-18 Xan Lopez <xlopez@igalia.com>
Reviewed by Gustavo Noronha and Jan Alonzo.
......
......@@ -542,6 +542,7 @@ TEST_PROGS += Programs/unittests/testhttpbackend \
Programs/unittests/testwindow \
Programs/unittests/testdownload \
Programs/unittests/testatk \
Programs/unittests/testhittestresult \
Programs/unittests/testwebsettings \
Programs/unittests/testwebresource \
Programs/unittests/testwebdatasource
......@@ -610,6 +611,10 @@ Programs_unittests_testwebdatasource_SOURCES = WebKit/gtk/tests/testwebdatasourc
Programs_unittests_testwebdatasource_CFLAGS = $(webkit_tests_cflags)
Programs_unittests_testwebdatasource_LDADD = $(webkit_tests_ldadd)
Programs_unittests_testhittestresult_SOURCES = WebKit/gtk/tests/testhittestresult.c
Programs_unittests_testhittestresult_CFLAGS = $(webkit_tests_cflags)
Programs_unittests_testhittestresult_LDADD = $(webkit_tests_ldadd)
# Autogenerated sources
BUILT_SOURCES := \
$(javascriptcore_built_sources) \
......
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:
2009-09-18 Xan Lopez <xlopez@igalia.com>
Reviewed by Gustavo Noronha and Jan Alonzo.
......
......@@ -62,11 +62,13 @@
#include "InspectorClientGtk.h"
#include "FrameLoader.h"
#include "FrameView.h"
#include "MouseEventWithHitTestResults.h"
#include "PasteboardHelper.h"
#include "PlatformKeyboardEvent.h"
#include "PlatformWheelEvent.h"
#include "ProgressTracker.h"
#include "ResourceHandle.h"
#include "RenderView.h"
#include "ScriptValue.h"
#include "Scrollbar.h"
#include <wtf/GOwnPtr.h>
......@@ -3026,7 +3028,7 @@ void webkit_web_view_stop_loading(WebKitWebView* webView)
Frame* frame = core(webView)->mainFrame();
if (FrameLoader* loader = frame->loader())
loader->stopAllLoaders();
loader->stopForUserCancel();
}
/**
......@@ -3911,3 +3913,39 @@ GList* webkit_web_view_get_subresources(WebKitWebView* webView)
GList* subResources = g_hash_table_get_values(priv->subResources);
return g_list_remove(subResources, priv->mainResource);
}
/* From EventHandler.cpp */
static IntPoint documentPointForWindowPoint(Frame* frame, const IntPoint& windowPoint)
{
FrameView* view = frame->view();
// FIXME: Is it really OK to use the wrong coordinates here when view is 0?
// Historically the code would just crash; this is clearly no worse than that.
return view ? view->windowToContents(windowPoint) : windowPoint;
}
/**
* webkit_web_view_get_hit_test_result:
* @webView: a #WebKitWebView
* @event: a #GdkEventButton
*
* Does a 'hit test' in the coordinates specified by @event to figure
* out context information about that position in the @webView.
*
* Returns: a newly created #WebKitHitTestResult with the context of the
* specified position.
*
* Since: 1.1.15
**/
WebKitHitTestResult* webkit_web_view_get_hit_test_result(WebKitWebView* webView, GdkEventButton* event)
{
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL);
g_return_val_if_fail(event, NULL);
PlatformMouseEvent mouseEvent = PlatformMouseEvent(event);
Frame* frame = core(webView)->mainFrame();
HitTestRequest request(HitTestRequest::Active);
IntPoint documentPoint = documentPointForWindowPoint(frame, mouseEvent.pos());
MouseEventWithHitTestResults mev = frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent);
return kit(mev.hitTestResult());
}
......@@ -363,6 +363,9 @@ webkit_web_view_set_view_source_mode (WebKitWebView *web_view,
WEBKIT_API gboolean
webkit_web_view_get_view_source_mode (WebKitWebView *web_view);
WEBKIT_API WebKitHitTestResult*
webkit_web_view_get_hit_test_result (WebKitWebView *webView,
GdkEventButton *event);
G_END_DECLS
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment