Title: [120692] trunk
Revision
120692
Author
[email protected]
Date
2012-06-19 01:38:38 -0700 (Tue, 19 Jun 2012)

Log Message

[EFL] EFL's LayoutTestController does not support setTextDirection
https://bugs.webkit.org/show_bug.cgi?id=87481

Patch by Christophe Dumez <[email protected]> on 2012-06-19
Reviewed by Hajime Morita.

Source/WebKit/efl:

Add new Ewk_View method to set the text direction, by calling
Editor::setBaseWritingDirection() internally, as Mac and Chromium
ports do.

* WebCoreSupport/AssertMatchingEnums.cpp:
* ewk/ewk_view.cpp:
(ewk_view_text_direction_set):
* ewk/ewk_view.h:

Tools:

Implement setTextDirection in EFL's LayoutTestController and
properly reset its value between test cases to avoid flakiness.

* DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
(DumpRenderTreeChrome::resetDefaultsToConsistentValues):
* DumpRenderTree/efl/LayoutTestControllerEfl.cpp:
(LayoutTestController::setTextDirection):

LayoutTests:

Unskip related test case now that EFL's LayoutTestController
implements setTextDirection.

* platform/efl/Skipped:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (120691 => 120692)


--- trunk/LayoutTests/ChangeLog	2012-06-19 08:36:28 UTC (rev 120691)
+++ trunk/LayoutTests/ChangeLog	2012-06-19 08:38:38 UTC (rev 120692)
@@ -1,3 +1,15 @@
+2012-06-19  Christophe Dumez  <[email protected]>
+
+        [EFL] EFL's LayoutTestController does not support setTextDirection
+        https://bugs.webkit.org/show_bug.cgi?id=87481
+
+        Reviewed by Hajime Morita.
+
+        Unskip related test case now that EFL's LayoutTestController
+        implements setTextDirection.
+
+        * platform/efl/Skipped:
+
 2012-06-19  MORITA Hajime  <[email protected]>
 
         Unreviewed expectation update.

Modified: trunk/LayoutTests/platform/efl/Skipped (120691 => 120692)


--- trunk/LayoutTests/platform/efl/Skipped	2012-06-19 08:36:28 UTC (rev 120691)
+++ trunk/LayoutTests/platform/efl/Skipped	2012-06-19 08:38:38 UTC (rev 120692)
@@ -182,9 +182,6 @@
 # viewport meta tag tests that failed because window.devicePixelRatio is not implemented
 fast/viewport/viewport-133.html
 
-# EFL's LayoutTestController does not implement setTextDirection
-fast/html/set-text-direction.html
-
 # Frame::findString does nothing on pages that prevent selection
 # https://bugs.webkit.org/show_bug.cgi?id=40361
 editing/text-iterator/findString-selection-disabled.html

Modified: trunk/Source/WebKit/efl/ChangeLog (120691 => 120692)


--- trunk/Source/WebKit/efl/ChangeLog	2012-06-19 08:36:28 UTC (rev 120691)
+++ trunk/Source/WebKit/efl/ChangeLog	2012-06-19 08:38:38 UTC (rev 120692)
@@ -1,3 +1,19 @@
+2012-06-19  Christophe Dumez  <[email protected]>
+
+        [EFL] EFL's LayoutTestController does not support setTextDirection
+        https://bugs.webkit.org/show_bug.cgi?id=87481
+
+        Reviewed by Hajime Morita.
+
+        Add new Ewk_View method to set the text direction, by calling
+        Editor::setBaseWritingDirection() internally, as Mac and Chromium
+        ports do.
+
+        * WebCoreSupport/AssertMatchingEnums.cpp:
+        * ewk/ewk_view.cpp:
+        (ewk_view_text_direction_set):
+        * ewk/ewk_view.h:
+
 2012-06-15  Christophe Dumez  <[email protected]>
 
         [EFL] EFL's LayoutTestController does not support titleTextDirection

Modified: trunk/Source/WebKit/efl/WebCoreSupport/AssertMatchingEnums.cpp (120691 => 120692)


--- trunk/Source/WebKit/efl/WebCoreSupport/AssertMatchingEnums.cpp	2012-06-19 08:36:28 UTC (rev 120691)
+++ trunk/Source/WebKit/efl/WebCoreSupport/AssertMatchingEnums.cpp	2012-06-19 08:38:38 UTC (rev 120692)
@@ -27,6 +27,7 @@
 #include "FrameLoaderTypes.h"
 #include "Page.h"
 #include "VisibleSelection.h"
+#include "WritingDirection.h"
 #include "ewk_contextmenu.h"
 #include "ewk_frame.h"
 #include "ewk_view.h"
@@ -40,6 +41,13 @@
 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \
     COMPILE_ASSERT(static_cast<int>(webkit_name) == static_cast<int>(WebCore::webcore_name), mismatching_enums)
 
+// These constants are not namespaced, bring them into WebCore so the ASSERT still works for them.
+namespace WebCore {
+using ::NaturalWritingDirection;
+using ::LeftToRightWritingDirection;
+using ::RightToLeftWritingDirection;
+};
+
 #if ENABLE(PAGE_VISIBILITY_API)
 COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGE_VISIBILITY_STATE_VISIBLE, PageVisibilityStateVisible);
 COMPILE_ASSERT_MATCHING_ENUM(EWK_PAGE_VISIBILITY_STATE_HIDDEN, PageVisibilityStateHidden);
@@ -74,6 +82,10 @@
 COMPILE_ASSERT_MATCHING_ENUM(EWK_VIEW_MODE_MAXIMIZED, Page::ViewModeMaximized);
 COMPILE_ASSERT_MATCHING_ENUM(EWK_VIEW_MODE_MINIMIZED, Page::ViewModeMinimized);
 
+COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_DIRECTION_DEFAULT, NaturalWritingDirection);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_DIRECTION_LEFT_TO_RIGHT, LeftToRightWritingDirection);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_DIRECTION_RIGHT_TO_LEFT, RightToLeftWritingDirection);
+
 #if ENABLE(CONTEXT_MENUS)
 COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION, ContextMenuItemTagNoAction);
 COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK_IN_NEW_WINDOW, ContextMenuItemTagOpenLinkInNewWindow);

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.cpp (120691 => 120692)


--- trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2012-06-19 08:36:28 UTC (rev 120691)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2012-06-19 08:38:38 UTC (rev 120692)
@@ -3959,6 +3959,26 @@
     return priv->settings.devicePixelRatio;
 }
 
+void ewk_view_text_direction_set(Evas_Object* ewkView, Ewk_Text_Direction direction)
+{
+    EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);
+    EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv);
+
+    // The Editor::setBaseWritingDirection() function checks if we can change
+    // the text direction of the selected node and updates its DOM "dir"
+    // attribute and its CSS "direction" property.
+    // So, we just call the function as Safari does.
+    WebCore::Frame* focusedFrame = priv->page->focusController()->focusedOrMainFrame();
+    if (!focusedFrame)
+        return;
+
+    WebCore::Editor* editor = focusedFrame->editor();
+    if (!editor->canEdit())
+        return;
+
+    editor->setBaseWritingDirection(static_cast<WritingDirection>(direction));
+}
+
 void ewk_view_did_first_visually_nonempty_layout(Evas_Object* ewkView)
 {
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData);

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.h (120691 => 120692)


--- trunk/Source/WebKit/efl/ewk/ewk_view.h	2012-06-19 08:36:28 UTC (rev 120691)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.h	2012-06-19 08:38:38 UTC (rev 120692)
@@ -2377,6 +2377,14 @@
 EAPI float ewk_view_device_pixel_ratio_get(const Evas_Object *o);
 
 /**
+ * Changes the text direction of the selected input node.
+ *
+ * @param o view object to set text direction.
+ * @param direction text direction.
+ */
+EAPI void ewk_view_text_direction_set(Evas_Object *o, Ewk_Text_Direction direction);
+
+/**
  * Sets the view mode.
  *
  * The view-mode media feature describes the mode in which the

Modified: trunk/Tools/ChangeLog (120691 => 120692)


--- trunk/Tools/ChangeLog	2012-06-19 08:36:28 UTC (rev 120691)
+++ trunk/Tools/ChangeLog	2012-06-19 08:38:38 UTC (rev 120692)
@@ -1,3 +1,18 @@
+2012-06-19  Christophe Dumez  <[email protected]>
+
+        [EFL] EFL's LayoutTestController does not support setTextDirection
+        https://bugs.webkit.org/show_bug.cgi?id=87481
+
+        Reviewed by Hajime Morita.
+
+        Implement setTextDirection in EFL's LayoutTestController and
+        properly reset its value between test cases to avoid flakiness.
+
+        * DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
+        (DumpRenderTreeChrome::resetDefaultsToConsistentValues):
+        * DumpRenderTree/efl/LayoutTestControllerEfl.cpp:
+        (LayoutTestController::setTextDirection):
+
 2012-06-19  Kristóf Kosztyó  <[email protected]>
 
         [Qt] Temporarily disable xvfb driver in nrwt

Modified: trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp (120691 => 120692)


--- trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp	2012-06-19 08:36:28 UTC (rev 120691)
+++ trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp	2012-06-19 08:38:38 UTC (rev 120692)
@@ -253,6 +253,7 @@
     ewk_view_scale_set(mainView(), 1.0, 0, 0);
     ewk_view_text_zoom_set(mainView(), 1.0);
     ewk_view_visibility_state_set(mainView(), EWK_PAGE_VISIBILITY_STATE_VISIBLE, true);
+    ewk_view_text_direction_set(mainView(), EWK_TEXT_DIRECTION_DEFAULT);
 
     ewk_history_clear(ewk_view_history_get(mainView()));
 

Modified: trunk/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp (120691 => 120692)


--- trunk/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp	2012-06-19 08:36:28 UTC (rev 120691)
+++ trunk/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp	2012-06-19 08:38:38 UTC (rev 120692)
@@ -851,9 +851,21 @@
     ewk_view_setting_minimum_timer_interval_set(browser->mainView(), minimumTimerInterval);
 }
 
-void LayoutTestController::setTextDirection(JSStringRef)
+void LayoutTestController::setTextDirection(JSStringRef direction)
 {
-    notImplemented();
+    Ewk_Text_Direction ewkDirection;
+    if (JSStringIsEqualToUTF8CString(direction, "auto"))
+        ewkDirection = EWK_TEXT_DIRECTION_DEFAULT;
+    else if (JSStringIsEqualToUTF8CString(direction, "rtl"))
+        ewkDirection = EWK_TEXT_DIRECTION_RIGHT_TO_LEFT;
+    else if (JSStringIsEqualToUTF8CString(direction, "ltr"))
+        ewkDirection = EWK_TEXT_DIRECTION_LEFT_TO_RIGHT;
+    else {
+        fprintf(stderr, "LayoutTestController::setTextDirection called with unknown direction: '%s'.\n", direction->ustring().utf8().data());
+        return;
+    }
+
+    ewk_view_text_direction_set(browser->mainView(), ewkDirection);
 }
 
 void LayoutTestController::addChromeInputField()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to