- Revision
- 140398
- Author
- [email protected]
- Date
- 2013-01-22 01:15:07 -0800 (Tue, 22 Jan 2013)
Log 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 <[email protected]> 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 <[email protected]> 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 <[email protected]> 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.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (140397 => 140398)
--- trunk/LayoutTests/ChangeLog 2013-01-22 09:06:22 UTC (rev 140397)
+++ trunk/LayoutTests/ChangeLog 2013-01-22 09:15:07 UTC (rev 140398)
@@ -1,3 +1,15 @@
+2013-01-22 Manuel Rego Casasnovas <[email protected]>
+
+ [GTK] Implement testRunner::setTextDirection
+ https://bugs.webkit.org/show_bug.cgi?id=107131
+
+ 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.
+
2013-01-22 Christophe Dumez <[email protected]>
Unreviewed EFL gardening.
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (140397 => 140398)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2013-01-22 09:06:22 UTC (rev 140397)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2013-01-22 09:15:07 UTC (rev 140398)
@@ -1086,9 +1086,6 @@
Bug(GTK) editing/spelling/grammar-paste.html [ Skip ]
Bug(GTK) editing/spelling/markers.html [ Skip ]
-# testRunner::setTextDirection() is not implemented.
-Bug(GTK) fast/html/set-text-direction.html [ Failure ]
-
# testRunner.overridePreference("WebKitDefaultFontSize"...) does not take into account screen DPI
webkit.org/b/57160 fast/harness/override-preferences-2.html [ Failure ]
Modified: trunk/LayoutTests/platform/gtk-wk2/TestExpectations (140397 => 140398)
--- trunk/LayoutTests/platform/gtk-wk2/TestExpectations 2013-01-22 09:06:22 UTC (rev 140397)
+++ trunk/LayoutTests/platform/gtk-wk2/TestExpectations 2013-01-22 09:15:07 UTC (rev 140398)
@@ -507,7 +507,6 @@
Bug(GTK) fast/events/dont-loose-last-event.html [ Pass ]
Bug(GTK) fast/events/drag-selects-image.html [ Pass ]
Bug(GTK) fast/forms/text-input-event.html [ Pass ]
-Bug(GTK) fast/html/set-text-direction.html [ Pass ]
Bug(GTK) fast/js/names.html [ Pass ]
Bug(GTK) fast/loader/form-submission-after-beforeunload-cancel.html [ Pass ]
Bug(GTK) fast/loader/stop-provisional-loads.html [ Pass ]
Modified: trunk/Source/WebKit/gtk/ChangeLog (140397 => 140398)
--- trunk/Source/WebKit/gtk/ChangeLog 2013-01-22 09:06:22 UTC (rev 140397)
+++ trunk/Source/WebKit/gtk/ChangeLog 2013-01-22 09:15:07 UTC (rev 140398)
@@ -1,3 +1,15 @@
+2013-01-22 Manuel Rego Casasnovas <[email protected]>
+
+ [GTK] Add listener for direction-changed signal in WebKitWebView
+ https://bugs.webkit.org/show_bug.cgi?id=107131
+
+ Reviewed by Philippe Normand.
+
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_init): Add listener for direction-changed signal.
+ (webkitWebViewDirectionChanged): Implement listener using
+ Editor::setBaseWritingDirection().
+
2013-01-21 Oleg Smirnov <[email protected]>
[Gtk] Dispatching event list into input element.
Modified: trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp (140397 => 140398)
--- trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp 2013-01-22 09:06:22 UTC (rev 140397)
+++ trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp 2013-01-22 09:15:07 UTC (rev 140398)
@@ -269,6 +269,7 @@
static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GParamSpec* pspec, WebKitWebView* webView);
static void webkit_web_view_set_window_features(WebKitWebView* webView, WebKitWebWindowFeatures* webWindowFeatures);
+static void webkitWebViewDirectionChanged(WebKitWebView*, GtkTextDirection previousDirection, gpointer);
#if ENABLE(CONTEXT_MENUS)
static void PopupMenuPositionFunc(GtkMenu* menu, gint *x, gint *y, gboolean *pushIn, gpointer userData)
@@ -3696,6 +3697,8 @@
#if USE(ACCELERATED_COMPOSITING)
priv->acceleratedCompositingContext = AcceleratedCompositingContext::create(webView);
#endif
+
+ g_signal_connect(webView, "direction-changed", G_CALLBACK(webkitWebViewDirectionChanged), 0);
}
GtkWidget* webkit_web_view_new(void)
@@ -5361,6 +5364,36 @@
}
#endif
+void webkitWebViewDirectionChanged(WebKitWebView* webView, GtkTextDirection previousDirection, gpointer)
+{
+ g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
+
+ GtkTextDirection direction = gtk_widget_get_direction(GTK_WIDGET(webView));
+
+ Frame* focusedFrame = core(webView)->focusController()->focusedFrame();
+ if (!focusedFrame)
+ return;
+
+ Editor* editor = focusedFrame->editor();
+ if (!editor || !editor->canEdit())
+ return;
+
+ switch (direction) {
+ case GTK_TEXT_DIR_NONE:
+ editor->setBaseWritingDirection(NaturalWritingDirection);
+ break;
+ case GTK_TEXT_DIR_LTR:
+ editor->setBaseWritingDirection(LeftToRightWritingDirection);
+ break;
+ case GTK_TEXT_DIR_RTL:
+ editor->setBaseWritingDirection(RightToLeftWritingDirection);
+ break;
+ default:
+ g_assert_not_reached();
+ return;
+ }
+}
+
namespace WebKit {
WebCore::Page* core(WebKitWebView* webView)
Modified: trunk/Tools/ChangeLog (140397 => 140398)
--- trunk/Tools/ChangeLog 2013-01-22 09:06:22 UTC (rev 140397)
+++ trunk/Tools/ChangeLog 2013-01-22 09:15:07 UTC (rev 140398)
@@ -1,3 +1,16 @@
+2013-01-22 Manuel Rego Casasnovas <[email protected]>
+
+ [GTK] Implement TestRunner::setTextDirection
+ https://bugs.webkit.org/show_bug.cgi?id=107131
+
+ 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.
+
2013-01-22 Jochen Eisinger <[email protected]>
[chromium] move spell checking mocks to TestRunner library
Modified: trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp (140397 => 140398)
--- trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp 2013-01-22 09:06:22 UTC (rev 140397)
+++ trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp 2013-01-22 09:15:07 UTC (rev 140398)
@@ -527,6 +527,8 @@
gTestRunner->setAuthenticationUsername("");
gTestRunner->setHandlesAuthenticationChallenges(false);
}
+
+ gtk_widget_set_direction(GTK_WIDGET(webView), GTK_TEXT_DIR_NONE);
}
static bool useLongRunningServerMode(int argc, char *argv[])
Modified: trunk/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp (140397 => 140398)
--- trunk/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp 2013-01-22 09:06:22 UTC (rev 140397)
+++ trunk/Tools/DumpRenderTree/gtk/TestRunnerGtk.cpp 2013-01-22 09:15:07 UTC (rev 140398)
@@ -939,7 +939,19 @@
void TestRunner::setTextDirection(JSStringRef direction)
{
- // FIXME: Implement.
+ GOwnPtr<gchar> writingDirection(JSStringCopyUTF8CString(direction));
+
+ WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
+ ASSERT(view);
+
+ if (g_str_equal(writingDirection.get(), "auto"))
+ gtk_widget_set_direction(GTK_WIDGET(view), GTK_TEXT_DIR_NONE);
+ else if (g_str_equal(writingDirection.get(), "ltr"))
+ gtk_widget_set_direction(GTK_WIDGET(view), GTK_TEXT_DIR_LTR);
+ else if (g_str_equal(writingDirection.get(), "rtl"))
+ gtk_widget_set_direction(GTK_WIDGET(view), GTK_TEXT_DIR_RTL);
+ else
+ fprintf(stderr, "TestRunner::setTextDirection called with unknown direction: '%s'.\n", writingDirection.get());
}
void TestRunner::addChromeInputField()