Changeset 140398 in webkit


Ignore:
Timestamp:
Jan 22, 2013 1:15:07 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Source/WebKit/gtk: [GTK] Add listener for direction-changed signal in WebKitWebView
https://bugs.webkit.org/show_bug.cgi?id=107131

Patch by Manuel Rego Casasnovas <Manuel Rego Casasnovas> on 2013-01-22
Reviewed by Philippe Normand.

  • webkit/webkitwebview.cpp:

(webkit_web_view_init): Add listener for direction-changed signal.
(webkitWebViewDirectionChanged): Implement listener using
Editor::setBaseWritingDirection().

Tools: [GTK] Implement TestRunner::setTextDirection
https://bugs.webkit.org/show_bug.cgi?id=107131

Patch by Manuel Rego Casasnovas <Manuel Rego Casasnovas> on 2013-01-22
Reviewed by Philippe Normand.

  • DumpRenderTree/gtk/DumpRenderTree.cpp:

(resetDefaultsToConsistentValues): Reset direction to default value.

  • DumpRenderTree/gtk/TestRunnerGtk.cpp:

(TestRunner::setTextDirection): Implement method using
gtk_widget_set_direction.

LayoutTests: [GTK] Implement testRunner::setTextDirection
https://bugs.webkit.org/show_bug.cgi?id=107131

Patch by Manuel Rego Casasnovas <Manuel Rego Casasnovas> on 2013-01-22
Reviewed by Philippe Normand.

  • platform/gtk-wk2/TestExpectations: Unflag

fast/html/set-text-direction.html as it was already passing in WK2.

  • platform/gtk/TestExpectations: Remove

fast/html/set-text-direction.html.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140395 r140398  
     12013-01-22  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [GTK] Implement testRunner::setTextDirection
     4        https://bugs.webkit.org/show_bug.cgi?id=107131
     5
     6        Reviewed by Philippe Normand.
     7
     8        * platform/gtk-wk2/TestExpectations: Unflag
     9        fast/html/set-text-direction.html as it was already passing in WK2.
     10        * platform/gtk/TestExpectations: Remove
     11        fast/html/set-text-direction.html.
     12
    1132013-01-22  Christophe Dumez  <christophe.dumez@intel.com>
    214
  • trunk/LayoutTests/platform/gtk-wk2/TestExpectations

    r140258 r140398  
    508508Bug(GTK) fast/events/drag-selects-image.html [ Pass ]
    509509Bug(GTK) fast/forms/text-input-event.html [ Pass ]
    510 Bug(GTK) fast/html/set-text-direction.html [ Pass ]
    511510Bug(GTK) fast/js/names.html [ Pass ]
    512511Bug(GTK) fast/loader/form-submission-after-beforeunload-cancel.html [ Pass ]
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r140364 r140398  
    10871087Bug(GTK) editing/spelling/markers.html [ Skip ]
    10881088
    1089 # testRunner::setTextDirection() is not implemented.
    1090 Bug(GTK) fast/html/set-text-direction.html [ Failure ]
    1091 
    10921089# testRunner.overridePreference("WebKitDefaultFontSize"...) does not take into account screen DPI
    10931090webkit.org/b/57160 fast/harness/override-preferences-2.html [ Failure ]
  • trunk/Source/WebKit/gtk/ChangeLog

    r140336 r140398  
     12013-01-22  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [GTK] Add listener for direction-changed signal in WebKitWebView
     4        https://bugs.webkit.org/show_bug.cgi?id=107131
     5
     6        Reviewed by Philippe Normand.
     7
     8        * webkit/webkitwebview.cpp:
     9        (webkit_web_view_init): Add listener for direction-changed signal.
     10        (webkitWebViewDirectionChanged): Implement listener using
     11        Editor::setBaseWritingDirection().
     12
    1132013-01-21  Oleg Smirnov  <oleg.smirnov@lge.com>
    214
  • trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp

    r140153 r140398  
    270270static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GParamSpec* pspec, WebKitWebView* webView);
    271271static void webkit_web_view_set_window_features(WebKitWebView* webView, WebKitWebWindowFeatures* webWindowFeatures);
     272static void webkitWebViewDirectionChanged(WebKitWebView*, GtkTextDirection previousDirection, gpointer);
    272273
    273274#if ENABLE(CONTEXT_MENUS)
     
    36973698    priv->acceleratedCompositingContext = AcceleratedCompositingContext::create(webView);
    36983699#endif
     3700
     3701    g_signal_connect(webView, "direction-changed", G_CALLBACK(webkitWebViewDirectionChanged), 0);
    36993702}
    37003703
     
    53625365#endif
    53635366
     5367void webkitWebViewDirectionChanged(WebKitWebView* webView, GtkTextDirection previousDirection, gpointer)
     5368{
     5369    g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
     5370
     5371    GtkTextDirection direction = gtk_widget_get_direction(GTK_WIDGET(webView));
     5372
     5373    Frame* focusedFrame = core(webView)->focusController()->focusedFrame();
     5374    if (!focusedFrame)
     5375        return;
     5376
     5377    Editor* editor = focusedFrame->editor();
     5378    if (!editor || !editor->canEdit())
     5379        return;
     5380
     5381    switch (direction) {
     5382    case GTK_TEXT_DIR_NONE:
     5383        editor->setBaseWritingDirection(NaturalWritingDirection);
     5384        break;
     5385    case GTK_TEXT_DIR_LTR:
     5386        editor->setBaseWritingDirection(LeftToRightWritingDirection);
     5387        break;
     5388    case GTK_TEXT_DIR_RTL:
     5389        editor->setBaseWritingDirection(RightToLeftWritingDirection);
     5390        break;
     5391    default:
     5392        g_assert_not_reached();
     5393        return;
     5394    }
     5395}
     5396
    53645397namespace WebKit {
    53655398
  • trunk/Tools/ChangeLog

    r140396 r140398  
     12013-01-22  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [GTK] Implement TestRunner::setTextDirection
     4        https://bugs.webkit.org/show_bug.cgi?id=107131
     5
     6        Reviewed by Philippe Normand.
     7
     8        * DumpRenderTree/gtk/DumpRenderTree.cpp:
     9        (resetDefaultsToConsistentValues): Reset direction to default value.
     10        * DumpRenderTree/gtk/TestRunnerGtk.cpp:
     11        (TestRunner::setTextDirection): Implement method using
     12        gtk_widget_set_direction.
     13
    1142013-01-22  Jochen Eisinger  <jochen@chromium.org>
    215
  • trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp

    r140153 r140398  
    528528        gTestRunner->setHandlesAuthenticationChallenges(false);
    529529    }
     530
     531    gtk_widget_set_direction(GTK_WIDGET(webView), GTK_TEXT_DIR_NONE);
    530532}
    531533
  • trunk/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp

    r140144 r140398  
    940940void TestRunner::setTextDirection(JSStringRef direction)
    941941{
    942     // FIXME: Implement.
     942    GOwnPtr<gchar> writingDirection(JSStringCopyUTF8CString(direction));
     943
     944    WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
     945    ASSERT(view);
     946
     947    if (g_str_equal(writingDirection.get(), "auto"))
     948        gtk_widget_set_direction(GTK_WIDGET(view), GTK_TEXT_DIR_NONE);
     949    else if (g_str_equal(writingDirection.get(), "ltr"))
     950        gtk_widget_set_direction(GTK_WIDGET(view), GTK_TEXT_DIR_LTR);
     951    else if (g_str_equal(writingDirection.get(), "rtl"))
     952        gtk_widget_set_direction(GTK_WIDGET(view), GTK_TEXT_DIR_RTL);
     953    else
     954        fprintf(stderr, "TestRunner::setTextDirection called with unknown direction: '%s'.\n", writingDirection.get());
    943955}
    944956
Note: See TracChangeset for help on using the changeset viewer.