[EFL] The EFL port has no support for title directionality
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 May 2012 07:03:15 +0000 (07:03 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 May 2012 07:03:15 +0000 (07:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=86462

Patch by Christophe Dumez <christophe.dumez@intel.com> on 2012-05-24
Reviewed by Gustavo Noronha Silva.

Source/WebKit/efl:

Define a new Ewk_Text_With_Direction type to store the direction of
the text along with the text itself. This is needed to support text
directionality in EFL port.

Use the new Ewk_Text_With_Direction type for the frame title. Updated
"title,changed" signal, title getter/setter and Ewk_Hit_Test struct.

* WebCoreSupport/FrameLoaderClientEfl.cpp:
(WebCore::FrameLoaderClientEfl::dispatchDidReceiveTitle):
* ewk/ewk_frame.cpp:
(Ewk_Frame_Smart_Data):
(_ewk_frame_smart_del):
(ewk_frame_title_get):
(ewk_frame_hit_test_free):
(ewk_frame_hit_test_new):
(ewk_frame_title_set):
* ewk/ewk_frame.h:
* ewk/ewk_frame_private.h:
* ewk/ewk_view.cpp:
(_Ewk_View_Private_Data):
(ewk_view_title_get):
(ewk_view_title_set):
* ewk/ewk_view.h:
* ewk/ewk_view_private.h:

Tools:

Update "title,changed" signal handlers in DRT and EWebLauncher to
reflect the change from const char* to Ewk_Text_With_Direction* type
for the title.

* DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
(DumpRenderTreeChrome::onTitleChanged):
* EWebLauncher/main.c:
(title_set):
(on_title_changed):
(on_key_down):

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

Source/WebKit/efl/ChangeLog
Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp
Source/WebKit/efl/ewk/ewk_frame.cpp
Source/WebKit/efl/ewk/ewk_frame.h
Source/WebKit/efl/ewk/ewk_frame_private.h
Source/WebKit/efl/ewk/ewk_view.cpp
Source/WebKit/efl/ewk/ewk_view.h
Source/WebKit/efl/ewk/ewk_view_private.h
Tools/ChangeLog
Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp
Tools/EWebLauncher/main.c

index 2925a00..42e8093 100644 (file)
@@ -1,3 +1,35 @@
+2012-05-24  Christophe Dumez  <christophe.dumez@intel.com>
+
+        [EFL] The EFL port has no support for title directionality
+        https://bugs.webkit.org/show_bug.cgi?id=86462
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Define a new Ewk_Text_With_Direction type to store the direction of
+        the text along with the text itself. This is needed to support text
+        directionality in EFL port.
+
+        Use the new Ewk_Text_With_Direction type for the frame title. Updated
+        "title,changed" signal, title getter/setter and Ewk_Hit_Test struct.
+
+        * WebCoreSupport/FrameLoaderClientEfl.cpp:
+        (WebCore::FrameLoaderClientEfl::dispatchDidReceiveTitle):
+        * ewk/ewk_frame.cpp:
+        (Ewk_Frame_Smart_Data):
+        (_ewk_frame_smart_del):
+        (ewk_frame_title_get):
+        (ewk_frame_hit_test_free):
+        (ewk_frame_hit_test_new):
+        (ewk_frame_title_set):
+        * ewk/ewk_frame.h:
+        * ewk/ewk_frame_private.h:
+        * ewk/ewk_view.cpp:
+        (_Ewk_View_Private_Data):
+        (ewk_view_title_get):
+        (ewk_view_title_set):
+        * ewk/ewk_view.h:
+        * ewk/ewk_view_private.h:
+
 2012-05-23  Christophe Dumez  <christophe.dumez@intel.com>
 
         [EFL] EFL's DRT does not print didFailProvisionalLoadWithError messages
index bac93d8..c08d3ed 100644 (file)
@@ -616,13 +616,15 @@ void FrameLoaderClientEfl::dispatchDidStartProvisionalLoad()
 
 void FrameLoaderClientEfl::dispatchDidReceiveTitle(const StringWithDirection& title)
 {
-    // FIXME: use direction of title.
+    Ewk_Text_With_Direction ewkTitle;
     CString cs = title.string().utf8();
-    ewk_frame_title_set(m_frame, cs.data());
+    ewkTitle.string = cs.data();
+    ewkTitle.direction = (title.direction() == LTR) ? EWK_TEXT_DIRECTION_LEFT_TO_RIGHT : EWK_TEXT_DIRECTION_RIGHT_TO_LEFT;
+    ewk_frame_title_set(m_frame, &ewkTitle);
 
     if (ewk_view_frame_main_get(m_view) != m_frame)
         return;
-    ewk_view_title_set(m_view, cs.data());
+    ewk_view_title_set(m_view, &ewkTitle);
 }
 
 void FrameLoaderClientEfl::dispatchDidChangeIcons(WebCore::IconType iconType)
index f06416c..c800ad6 100644 (file)
@@ -74,7 +74,7 @@ struct Ewk_Frame_Smart_Data {
     Evas_Object* region;
 #endif
     WebCore::Frame* frame;
-    const char* title;
+    Ewk_Text_With_Direction title;
     const char* uri;
     const char* name;
     bool editable : 1;
@@ -240,7 +240,7 @@ static void _ewk_frame_smart_del(Evas_Object* ewkFrame)
             smartData->frame = 0;
         }
 
-        eina_stringshare_del(smartData->title);
+        eina_stringshare_del(smartData->title.string);
         eina_stringshare_del(smartData->uri);
         eina_stringshare_del(smartData->name);
     }
@@ -343,10 +343,10 @@ const char* ewk_frame_uri_get(const Evas_Object* ewkFrame)
     return smartData->uri;
 }
 
-const char* ewk_frame_title_get(const Evas_Object* ewkFrame)
+const Ewk_Text_With_Direction* ewk_frame_title_get(const Evas_Object* ewkFrame)
 {
     EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, 0);
-    return smartData->title;
+    return &smartData->title;
 }
 
 const char* ewk_frame_name_get(const Evas_Object* ewkFrame)
@@ -668,7 +668,7 @@ Eina_Bool ewk_frame_text_zoom_set(Evas_Object* ewkFrame, float textZoomFactor)
 void ewk_frame_hit_test_free(Ewk_Hit_Test* hitTest)
 {
     EINA_SAFETY_ON_NULL_RETURN(hitTest);
-    eina_stringshare_del(hitTest->title);
+    eina_stringshare_del(hitTest->title.string);
     eina_stringshare_del(hitTest->alternate_text);
     eina_stringshare_del(hitTest->link.text);
     eina_stringshare_del(hitTest->link.url);
@@ -713,7 +713,8 @@ Ewk_Hit_Test* ewk_frame_hit_test_new(const Evas_Object* ewkFrame, int x, int y)
 #endif
 
     WebCore::TextDirection direction;
-    hitTest->title = eina_stringshare_add(result.title(direction).utf8().data());
+    hitTest->title.string = eina_stringshare_add(result.title(direction).utf8().data());
+    hitTest->title.direction = (direction == WebCore::LTR) ? EWK_TEXT_DIRECTION_LEFT_TO_RIGHT : EWK_TEXT_DIRECTION_RIGHT_TO_LEFT;
     hitTest->alternate_text = eina_stringshare_add(result.altDisplayString().utf8().data());
     if (result.innerNonSharedNode() && result.innerNonSharedNode()->document()
         && result.innerNonSharedNode()->document()->frame())
@@ -1572,13 +1573,14 @@ void ewk_frame_contents_size_changed(Evas_Object* ewkFrame, Evas_Coord width, Ev
  *
  * Reports title changed.
  */
-void ewk_frame_title_set(Evas_Object* ewkFrame, const char* title)
+void ewk_frame_title_set(Evas_Object* ewkFrame, const Ewk_Text_With_Direction* title)
 {
-    DBG("ewkFrame=%p, title=%s", ewkFrame, title ? title : "(null)");
+    DBG("ewkFrame=%p, title=%s", ewkFrame, title->string ? title->string : "(null)");
     EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData);
-    if (!eina_stringshare_replace(&smartData->title, title))
+    if (!eina_stringshare_replace(&smartData->title.string, title->string))
         return;
-    evas_object_smart_callback_call(ewkFrame, "title,changed", (void*)smartData->title);
+    smartData->title.direction = title->direction;
+    evas_object_smart_callback_call(ewkFrame, "title,changed", (void*)title);
 }
 
 /**
index cfffcb5..dce883e 100644 (file)
@@ -73,7 +73,7 @@
  *  - "resource,response,received", Ewk_Frame_Resource_Response*: reports that a response
  *    to a resource request was received.
  *  - "state,save", void: frame's state will be saved as a history item.
- *  - "title,changed", const char*: title of the main frame was changed.
+ *  - "title,changed", Ewk_Text_With_Direction*: title of the main frame was changed.
  *  - "uri,changed", const char*: uri of the main frame was changed.
  *  - "xss,detected", Ewk_Frame_Xss_Notification*: reflected XSS is encountered in the page and suppressed.
  */
@@ -152,6 +152,21 @@ struct _Ewk_Frame_Resource_Messages {
     Ewk_Frame_Resource_Response *redirect_response; /**< redirect response, can not be changed */
 };
 
+/// Enum containing text directionality values.
+typedef enum {
+    EWK_TEXT_DIRECTION_DEFAULT, /**< Natural writing direction ("inherit") */
+    EWK_TEXT_DIRECTION_LEFT_TO_RIGHT,
+    EWK_TEXT_DIRECTION_RIGHT_TO_LEFT
+} Ewk_Text_Direction;
+
+/// Creates a type name for Ewk_Text_With_Direction.
+typedef struct _Ewk_Text_With_Direction Ewk_Text_With_Direction;
+
+struct _Ewk_Text_With_Direction {
+    const char *string;
+    Ewk_Text_Direction direction;
+};
+
 /// Creates a type name for Ewk_Frame_Xss_Notification.
 typedef struct _Ewk_Frame_Xss_Notification Ewk_Frame_Xss_Notification;
 
@@ -196,7 +211,7 @@ struct _Ewk_Hit_Test {
     struct {
         int x, y, w, h;
     } bounding_box; /**< DEPRECATED, see ewk_frame_hit_test_new() */
-    const char *title; /**< title of the element */
+    Ewk_Text_With_Direction title; /**< title of the element */
     const char *alternate_text; /**< the alternate text for image, area, input and applet */
     Evas_Object *frame; /**< the pointer to frame where hit test was requested */
     struct {
@@ -351,7 +366,7 @@ EAPI const char  *ewk_frame_uri_get(const Evas_Object *o);
  *
  * @return frame title on success or @c 0 on failure
  */
-EAPI const char  *ewk_frame_title_get(const Evas_Object *o);
+EAPI const Ewk_Text_With_Direction  *ewk_frame_title_get(const Evas_Object *o);
 
 /**
  * Gets the name of this frame.
index 1692518..6d0eb2f 100644 (file)
@@ -63,7 +63,7 @@ void ewk_frame_view_state_save(Evas_Object* ewkFrame, WebCore::HistoryItem* item
 void ewk_frame_did_perform_first_navigation(Evas_Object* ewkFrame);
 
 void ewk_frame_contents_size_changed(Evas_Object* ewkFrame, Evas_Coord width, Evas_Coord height);
-void ewk_frame_title_set(Evas_Object* ewkFrame, const char* title);
+void ewk_frame_title_set(Evas_Object* ewkFrame, const Ewk_Text_With_Direction* title);
 
 void ewk_frame_view_create_for_view(Evas_Object* ewkFrame, Evas_Object* view);
 bool ewk_frame_uri_changed(Evas_Object* ewkFrame);
index 5429a3e..8b43467 100644 (file)
@@ -1404,7 +1404,7 @@ const char* ewk_view_uri_get(const Evas_Object* ewkView)
     return ewk_frame_uri_get(smartData->main_frame);
 }
 
-const char* ewk_view_title_get(const Evas_Object* ewkView)
+const Ewk_Text_With_Direction* ewk_view_title_get(const Evas_Object* ewkView)
 {
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
     return ewk_frame_title_get(smartData->main_frame);
@@ -2953,9 +2953,9 @@ void ewk_view_input_method_state_set(Evas_Object* ewkView, bool active)
  *
  * Emits signal: "title,changed" with pointer to new title string.
  */
-void ewk_view_title_set(Evas_Object* ewkView, const char* title)
+void ewk_view_title_set(Evas_Object* ewkView, const Ewk_Text_With_Direction* title)
 {
-    DBG("ewkView=%p, title=%s", ewkView, title ? title : "(null)");
+    DBG("ewkView=%p, title=%s", ewkView, (title && title->string) ? title->string : "(null)");
     evas_object_smart_callback_call(ewkView, "title,changed", (void*)title);
 }
 
index b8b0ab6..e0c0076 100644 (file)
@@ -86,7 +86,7 @@
  *  - "statusbar,visible,get", Eina_Bool *: expects a @c EINA_TRUE if statusbar is
  *    visible; @c EINA_FALSE, otherwise.
  *  - "statusbar,visible,set", Eina_Bool: sets statusbar visibility.
- *  - "title,changed", const char*: title of the main frame was changed.
+ *  - "title,changed", Ewk_Text_With_Direction*: title of the main frame was changed.
  *  - "toolbars,visible,get", Eina_Bool *: expects a @c EINA_TRUE if toolbar
  *    is visible; @c EINA_FALSE, otherwise.
  *  - "toolbars,visible,set", Eina_Bool: sets toolbar visibility.
@@ -751,7 +751,7 @@ EAPI const char  *ewk_view_uri_get(const Evas_Object *o);
  *
  * @return current title on success or @c 0 on failure
  */
-EAPI const char  *ewk_view_title_get(const Evas_Object *o);
+EAPI const Ewk_Text_With_Direction  *ewk_view_title_get(const Evas_Object *o);
 
 /**
  * Queries if the main frame is editable.
index 50f6928..1d4149d 100644 (file)
@@ -49,7 +49,7 @@ const char ewkViewSingleName[] = "Ewk_View_Single";
 
 void ewk_view_ready(Evas_Object* ewkView);
 void ewk_view_input_method_state_set(Evas_Object* ewkView, bool active);
-void ewk_view_title_set(Evas_Object* ewkView, const char* title);
+void ewk_view_title_set(Evas_Object* ewkView, const Ewk_Text_With_Direction* title);
 void ewk_view_uri_changed(Evas_Object* ewkView);
 void ewk_view_load_document_finished(Evas_Object* ewkView, Evas_Object* frame);
 void ewk_view_load_started(Evas_Object* ewkView, Evas_Object* ewkFrame);
index 5ae1e59..bbc6f43 100644 (file)
@@ -1,3 +1,21 @@
+2012-05-24  Christophe Dumez  <christophe.dumez@intel.com>
+
+        [EFL] The EFL port has no support for title directionality
+        https://bugs.webkit.org/show_bug.cgi?id=86462
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Update "title,changed" signal handlers in DRT and EWebLauncher to
+        reflect the change from const char* to Ewk_Text_With_Direction* type
+        for the title.
+
+        * DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
+        (DumpRenderTreeChrome::onTitleChanged):
+        * EWebLauncher/main.c:
+        (title_set):
+        (on_title_changed):
+        (on_key_down):
+
 2012-05-23  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
 
         Change EFL debug build name with more detail one
index 6c4540a..30774e1 100644 (file)
@@ -431,15 +431,15 @@ void DumpRenderTreeChrome::onFrameIconChanged(void*, Evas_Object* frame, void*)
 
 void DumpRenderTreeChrome::onFrameTitleChanged(void*, Evas_Object* frame, void* eventInfo)
 {
-    const char* titleText = static_cast<const char*>(eventInfo);
+    const Ewk_Text_With_Direction* titleText = static_cast<const Ewk_Text_With_Direction*>(eventInfo);
 
     if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) {
         const String frameName(DumpRenderTreeSupportEfl::suitableDRTFrameName(frame));
-        printf("%s - didReceiveTitle: %s\n", frameName.utf8().data(), titleText);
+        printf("%s - didReceiveTitle: %s\n", frameName.utf8().data(), (titleText && titleText->string) ? titleText->string : "");
     }
 
     if (!done && gLayoutTestController->dumpTitleChanges())
-        printf("TITLE CHANGED: %s\n", titleText);
+        printf("TITLE CHANGED: %s\n", (titleText && titleText->string) ? titleText->string : "");
 }
 
 void DumpRenderTreeChrome::onDocumentLoadFinished(void*, Evas_Object*, void* eventInfo)
index dfe0ef8..4089d6e 100644 (file)
@@ -229,22 +229,22 @@ on_ecore_evas_resize(Ecore_Evas *ee)
 }
 
 static void
-title_set(Ecore_Evas *ee, const char *title, int progress)
+title_set(Ecore_Evas *ee, const Ewk_Text_With_Direction *title, int progress)
 {
     const char *appname = "EFL Test Launcher";
     const char *separator = " - ";
     char label[4096];
     int size;
 
-    if (!title || !strcmp(title, "")) {
+    if (!title || !title->string || !strcmp(title->string, "")) {
         ecore_evas_title_set(ee, appname);
         return;
     }
 
     if (progress < 100)
-        size = snprintf(label, sizeof(label), "%s (%d%%)%s%s", title, progress, separator, appname);
+        size = snprintf(label, sizeof(label), "%s (%d%%)%s%s", title->string, progress, separator, appname);
     else
-        size = snprintf(label, sizeof(label), "%s %s%s", title, separator, appname);
+        size = snprintf(label, sizeof(label), "%s %s%s", title->string, separator, appname);
 
     if (size >= (int)sizeof(label))
         return;
@@ -256,7 +256,7 @@ static void
 on_title_changed(void *user_data, Evas_Object *webview, void *event_info)
 {
     ELauncher *app = (ELauncher *)user_data;
-    const char *title = (const char *)event_info;
+    const Ewk_Text_With_Direction *title = (const Ewk_Text_With_Direction *)event_info;
 
     title_set(app->ee, title, 100);
 }
@@ -492,7 +492,7 @@ on_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
                    x, y,
                    ht->x, ht->y,
                    ht->bounding_box.x, ht->bounding_box.y, ht->bounding_box.w, ht->bounding_box.h,
-                   ht->title,
+                   ht->title.string,
                    ht->alternate_text,
                    ht->frame, evas_object_name_get(ht->frame),
                    ht->link.text,