2007-12-08 Luca Bruno <lethalman88@gmail.com>
authoralp@webkit.org <alp@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Dec 2007 14:39:02 +0000 (14:39 +0000)
committeralp@webkit.org <alp@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Dec 2007 14:39:02 +0000 (14:39 +0000)
        Reviewed by Alp Toker.

        http://bugs.webkit.org/show_bug.cgi?id=16346
        [GTK] Some webview parts must use the focused frame.

        Also update some old code.

        * WebView/webkitprivate.cpp:
        (getFrameFromView): removed

        * WebView/webkitprivate.h:
        (getFrameFromView): removed

        * WebView/webkitwebview.cpp:
        (webkit_web_view_expose_event):
        (webkit_web_view_key_press_event): use focused frame
        (webkit_web_view_key_release_event): use focused frame
        (webkit_web_view_button_press_event):
        (webkit_web_view_button_release_event):
        (webkit_web_view_motion_event):
        (webkit_web_view_scroll_event):
        (webkit_web_view_size_allocate):
        (webkit_web_view_set_scroll_adjustments):
        (webkit_web_view_execute_script):
        (webkit_web_view_stop_loading):
        (webkit_web_view_load_string):
        (webkit_web_view_reload):
        (webkit_web_view_open):
        (webkit_web_view_can_go_forward):
        (webkit_web_view_can_go_backward):
        (webkit_web_view_go_forward):
        (webkit_web_view_go_backward):

        * WebCoreSupport/EditorClientGtk.cpp:
        (WebKit::EditorClient::handleKeypress): fix for page up and page down keys for editable contents

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28564 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/gtk/ChangeLog
WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
WebKit/gtk/WebView/webkitprivate.cpp
WebKit/gtk/WebView/webkitprivate.h
WebKit/gtk/WebView/webkitwebview.cpp

index 4e7b5299bd003927acabe58e3be832d7e75e2256..081e99dab495c59c97dc3ed9c2acd3c5e30902da 100644 (file)
@@ -1,3 +1,41 @@
+2007-12-08  Luca Bruno  <lethalman88@gmail.com>
+
+        Reviewed by Alp Toker.
+
+        http://bugs.webkit.org/show_bug.cgi?id=16346
+        [GTK] Some webview parts must use the focused frame.
+
+        Also update some old code.
+
+        * WebView/webkitprivate.cpp:
+        (getFrameFromView): removed
+
+        * WebView/webkitprivate.h:
+        (getFrameFromView): removed
+        
+        * WebView/webkitwebview.cpp:
+        (webkit_web_view_expose_event):
+        (webkit_web_view_key_press_event): use focused frame
+        (webkit_web_view_key_release_event): use focused frame
+        (webkit_web_view_button_press_event):
+        (webkit_web_view_button_release_event):
+        (webkit_web_view_motion_event):
+        (webkit_web_view_scroll_event):
+        (webkit_web_view_size_allocate):
+        (webkit_web_view_set_scroll_adjustments):
+        (webkit_web_view_execute_script):
+        (webkit_web_view_stop_loading):
+        (webkit_web_view_load_string):
+        (webkit_web_view_reload):
+        (webkit_web_view_open):
+        (webkit_web_view_can_go_forward):
+        (webkit_web_view_can_go_backward):
+        (webkit_web_view_go_forward):
+        (webkit_web_view_go_backward):
+
+        * WebCoreSupport/EditorClientGtk.cpp:
+        (WebKit::EditorClient::handleKeypress): fix for page up and page down keys for editable contents
+
 2007-12-07  Luca Bruno  <lethalman88@gmail.com>
 
         Reviewed by Alp Toker.
index c68069dd1948e335be525108ab40efc374a3f919..0634e29a632b78a98f03837fa509ac46d369b483 100644 (file)
@@ -270,7 +270,9 @@ void EditorClient::handleKeypress(KeyboardEvent* event)
                 frame->editor()->execCommand("MoveDownByPageAndModifyCaret");
                 break;
             case VK_HOME:
-                if (kevent->ctrlKey())
+                if (kevent->ctrlKey() && kevent->shiftKey())
+                    frame->editor()->execCommand("MoveToBeginningOfDocumentAndModifySelection");
+                else if (kevent->ctrlKey())
                     frame->editor()->execCommand("MoveToBeginningOfDocument");
                 else if (kevent->shiftKey())
                     frame->editor()->execCommand("MoveToBeginningOfLineAndModifySelection");
@@ -278,7 +280,9 @@ void EditorClient::handleKeypress(KeyboardEvent* event)
                     frame->editor()->execCommand("MoveToBeginningOfLine");
                 break;
             case VK_END:
-                if (kevent->ctrlKey())
+                if (kevent->ctrlKey() && kevent->shiftKey())
+                    frame->editor()->execCommand("MoveToEndOfDocumentAndModifySelection");
+                else if (kevent->ctrlKey())
                     frame->editor()->execCommand("MoveToEndOfDocument");
                 else if (kevent->shiftKey())
                     frame->editor()->execCommand("MoveToEndOfLineAndModifySelection");
index 0bc2b18dbf094fe8aaaa61a013a36d8c9f0c913c..88f4ec4717701e994a8eb26951e82063fc693ad2 100644 (file)
@@ -39,11 +39,6 @@ WebKitSettings* create(WebCore::Settings*)
     return 0;
 }
 
-WebKitWebFrame* getFrameFromView(WebKitWebView* webView)
-{
-    return webkit_web_view_get_main_frame(webView);
-}
-
 WebKitWebView* getViewFromFrame(WebKitWebFrame* frame)
 {
     return webkit_web_frame_get_web_view(frame);
index 41e5e5a2c9d4387d2564b4c7c5c2558500738dd8..841b0ee36f118b4796cd9c2b57c5f43fe3b632b6 100644 (file)
@@ -40,7 +40,6 @@
 namespace WebKit {
     void apply(WebKitSettings*,WebCore::Settings*);
     WebKitSettings* create(WebCore::Settings*);
-    WebKitWebFrame*  getFrameFromView(WebKitWebView*);
     WebKitWebView* getViewFromFrame(WebKitWebFrame*);
 
     WebCore::Frame* core(WebKitWebFrame*);
index cc476c5a14d2c629d8d701adaf46477e3ed94474..1ec76f89f09c32e817b0aba3560b66e234b87e45 100644 (file)
@@ -89,7 +89,7 @@ G_DEFINE_TYPE(WebKitWebView, webkit_web_view, GTK_TYPE_CONTAINER)
 
 static gboolean webkit_web_view_expose_event(GtkWidget* widget, GdkEventExpose* event)
 {
-    Frame* frame = core(getFrameFromView(WEBKIT_WEB_VIEW(widget)));
+    Frame* frame = core(webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(widget)));
     GdkRectangle clip;
     gdk_region_get_clipbox(event->region, &clip);
     cairo_t* cr = gdk_cairo_create(event->window);
@@ -106,7 +106,7 @@ static gboolean webkit_web_view_expose_event(GtkWidget* widget, GdkEventExpose*
 
 static gboolean webkit_web_view_key_press_event(GtkWidget* widget, GdkEventKey* event)
 {
-    Frame* frame = core(getFrameFromView(WEBKIT_WEB_VIEW(widget)));
+    Frame* frame = core(WEBKIT_WEB_VIEW(widget))->focusController()->focusedOrMainFrame();
     PlatformKeyboardEvent keyboardEvent(event);
 
     if (frame->eventHandler()->keyEvent(keyboardEvent))
@@ -148,7 +148,7 @@ static gboolean webkit_web_view_key_press_event(GtkWidget* widget, GdkEventKey*
 
 static gboolean webkit_web_view_key_release_event(GtkWidget* widget, GdkEventKey* event)
 {
-    Frame* frame = core(getFrameFromView(WEBKIT_WEB_VIEW(widget)));
+    Frame* frame = core(WEBKIT_WEB_VIEW(widget))->focusController()->focusedOrMainFrame();
     PlatformKeyboardEvent keyboardEvent(event);
 
     if (frame->eventHandler()->keyEvent(keyboardEvent))
@@ -160,7 +160,7 @@ static gboolean webkit_web_view_key_release_event(GtkWidget* widget, GdkEventKey
 
 static gboolean webkit_web_view_button_press_event(GtkWidget* widget, GdkEventButton* event)
 {
-    Frame* frame = core(getFrameFromView(WEBKIT_WEB_VIEW(widget)));
+    Frame* frame = core(webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(widget)));
 
     // FIXME: need to keep track of subframe focus for key events
     gtk_widget_grab_focus(GTK_WIDGET(widget));
@@ -169,20 +169,20 @@ static gboolean webkit_web_view_button_press_event(GtkWidget* widget, GdkEventBu
 
 static gboolean webkit_web_view_button_release_event(GtkWidget* widget, GdkEventButton* event)
 {
-    Frame* frame = core(getFrameFromView(WEBKIT_WEB_VIEW(widget)));
+    Frame* frame = core(webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(widget)));
 
     return frame->eventHandler()->handleMouseReleaseEvent(PlatformMouseEvent(event));
 }
 
 static gboolean webkit_web_view_motion_event(GtkWidget* widget, GdkEventMotion* event)
 {
-    Frame* frame = core(getFrameFromView(WEBKIT_WEB_VIEW(widget)));
+    Frame* frame = core(webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(widget)));
     return frame->eventHandler()->mouseMoved(PlatformMouseEvent(event));
 }
 
 static gboolean webkit_web_view_scroll_event(GtkWidget* widget, GdkEventScroll* event)
 {
-    Frame* frame = core(getFrameFromView(WEBKIT_WEB_VIEW(widget)));
+    Frame* frame = core(webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(widget)));
     PlatformWheelEvent wheelEvent(event);
     return frame->eventHandler()->handleWheelEvent(wheelEvent);
 }
@@ -191,7 +191,7 @@ static void webkit_web_view_size_allocate(GtkWidget* widget, GtkAllocation* allo
 {
     GTK_WIDGET_CLASS(webkit_web_view_parent_class)->size_allocate(widget,allocation);
 
-    Frame* frame = core(getFrameFromView(WEBKIT_WEB_VIEW(widget)));
+    Frame* frame = core(webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(widget)));
     frame->view()->resize(allocation->width, allocation->height);
     frame->forceLayout();
     frame->view()->adjustViewSize();
@@ -229,7 +229,7 @@ static void webkit_web_view_realize(GtkWidget* widget)
 
 static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAdjustment* hadj, GtkAdjustment* vadj)
 {
-    FrameView* view = core(getFrameFromView(webView))->view();
+    FrameView* view = core(webkit_web_view_get_main_frame(webView))->view();
     view->setGtkAdjustments(hadj, vadj);
 }
 
@@ -835,70 +835,62 @@ void webkit_web_view_go_backward(WebKitWebView* webView)
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
-    WebKitWebViewPrivate* webViewData = WEBKIT_WEB_VIEW_GET_PRIVATE(webView);
-    WebKitWebFramePrivate* frameData = WEBKIT_WEB_FRAME_GET_PRIVATE(webViewData->mainFrame);
-    frameData->frame->loader()->goBackOrForward(-1);
+    Frame* frame = core(webkit_web_view_get_main_frame(webView));
+    frame->loader()->goBackOrForward(-1);
 }
 
 void webkit_web_view_go_forward(WebKitWebView* webView)
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
-    WebKitWebViewPrivate* webViewData = WEBKIT_WEB_VIEW_GET_PRIVATE(webView);
-    WebKitWebFramePrivate* frameData = WEBKIT_WEB_FRAME_GET_PRIVATE(webViewData->mainFrame);
-    frameData->frame->loader()->goBackOrForward(1);
+    Frame* frame = core(webkit_web_view_get_main_frame(webView));
+    frame->loader()->goBackOrForward(1);
 }
 
 gboolean webkit_web_view_can_go_backward(WebKitWebView* webView)
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
 
-    WebKitWebViewPrivate* webViewData = WEBKIT_WEB_VIEW_GET_PRIVATE(webView);
-    WebKitWebFramePrivate* frameData = WEBKIT_WEB_FRAME_GET_PRIVATE(webViewData->mainFrame);
-    return frameData->frame->loader()->canGoBackOrForward(-1);
+    Frame* frame = core(webkit_web_view_get_main_frame(webView));
+    return frame->loader()->canGoBackOrForward(-1);
 }
 
 gboolean webkit_web_view_can_go_forward(WebKitWebView* webView)
 {
     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE);
 
-    WebKitWebViewPrivate* webViewData = WEBKIT_WEB_VIEW_GET_PRIVATE(webView);
-    WebKitWebFramePrivate* frameData = WEBKIT_WEB_FRAME_GET_PRIVATE(webViewData->mainFrame);
-    return frameData->frame->loader()->canGoBackOrForward(1);
+    Frame* frame = core(webkit_web_view_get_main_frame(webView));
+    return frame->loader()->canGoBackOrForward(1);
 }
 
 void webkit_web_view_open(WebKitWebView* webView, const gchar* uri)
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
-    WebKitWebViewPrivate* webViewData = WEBKIT_WEB_VIEW_GET_PRIVATE(webView);
-    WebKitWebFramePrivate* frameData = WEBKIT_WEB_FRAME_GET_PRIVATE(webViewData->mainFrame);
-
+    Frame* frame = core(webkit_web_view_get_main_frame(webView));
     DeprecatedString string = DeprecatedString::fromUtf8(uri);
-    frameData->frame->loader()->load(ResourceRequest(KURL(string)));
+    frame->loader()->load(ResourceRequest(KURL(string)));
 }
 
 void webkit_web_view_reload(WebKitWebView* webView)
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
-    WebKitWebViewPrivate* webViewData = WEBKIT_WEB_VIEW_GET_PRIVATE(webView);
-    WebKitWebFramePrivate* frameData = WEBKIT_WEB_FRAME_GET_PRIVATE(webViewData->mainFrame);
-    frameData->frame->loader()->reload();
+    Frame* frame = core(webkit_web_view_get_main_frame(webView));
+    frame->loader()->reload();
 }
 
 void webkit_web_view_load_string(WebKitWebView* webView, const gchar* content, const gchar* contentMimeType, const gchar* contentEncoding, const gchar* baseUri)
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
-    WebKitWebViewPrivate* webViewData = WEBKIT_WEB_VIEW_GET_PRIVATE(webView);
-    WebKitWebFramePrivate* frameData = WEBKIT_WEB_FRAME_GET_PRIVATE(webViewData->mainFrame);
+    Frame* frame = core(webkit_web_view_get_main_frame(webView));
 
     KURL url(DeprecatedString::fromUtf8(baseUri));
     RefPtr<SharedBuffer> sharedBuffer = new SharedBuffer(strdup(content), strlen(content));
     SubstituteData substituteData(sharedBuffer.release(), String(contentMimeType), String(contentEncoding), KURL("about:blank"), url);
 
-    frameData->frame->loader()->load(ResourceRequest(url), substituteData);
+    frame->loader()->load(ResourceRequest(url), substituteData);
 }
 
 void webkit_web_view_load_html_string(WebKitWebView* webView, const gchar* content, const gchar* baseUrl)
@@ -912,10 +904,9 @@ void webkit_web_view_stop_loading(WebKitWebView* webView)
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
-    WebKitWebViewPrivate* webViewData = WEBKIT_WEB_VIEW_GET_PRIVATE(webView);
-    WebKitWebFramePrivate* frameData = WEBKIT_WEB_FRAME_GET_PRIVATE(webViewData->mainFrame);
+    Frame* frame = core(webkit_web_view_get_main_frame(webView));
 
-    if (FrameLoader* loader = frameData->frame->loader())
+    if (FrameLoader* loader = frame->loader())
         loader->stopAllLoaders();
 }
 
@@ -932,10 +923,8 @@ void webkit_web_view_execute_script(WebKitWebView* webView, const gchar* script)
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
     g_return_if_fail(script);
 
-    WebKitWebViewPrivate* webViewData = WEBKIT_WEB_VIEW_GET_PRIVATE(webView);
-    WebKitWebFramePrivate* frameData = WEBKIT_WEB_FRAME_GET_PRIVATE(webViewData->mainFrame);
-
-    if (FrameLoader* loader = frameData->frame->loader())
+    Frame* frame = core(webkit_web_view_get_main_frame(webView));
+    if (FrameLoader* loader = frame->loader())
         loader->executeScript(String::fromUTF8(script), true);
 }