Title: [95983] trunk/Source/WebKit/efl
Revision
95983
Author
[email protected]
Date
2011-09-26 12:58:24 -0700 (Mon, 26 Sep 2011)

Log Message

[EFL] Add virtual method to notify user when wrapping focus
https://bugs.webkit.org/show_bug.cgi?id=68699

Reviewed by Antonio Gomes.

Add a virtual method to ewk_view, so the Chrome gets notified if we
finished focusing all the items and would start over. This way the
browser can decide to handle the subsequent focus changes among its
widgets.

* WebCoreSupport/ChromeClientEfl.cpp: call ewk_view's virtual method to
give it a chance to grab focus
(WebCore::ChromeClientEfl::canTakeFocus):
* ewk/ewk_private.h:
* ewk/ewk_view.cpp: add virtual method
(ewk_view_focus_can_cycle):
* ewk/ewk_view.h: add focus direction enum and virtual method

Modified Paths

Diff

Modified: trunk/Source/WebKit/efl/ChangeLog (95982 => 95983)


--- trunk/Source/WebKit/efl/ChangeLog	2011-09-26 19:58:00 UTC (rev 95982)
+++ trunk/Source/WebKit/efl/ChangeLog	2011-09-26 19:58:24 UTC (rev 95983)
@@ -1,3 +1,23 @@
+2011-09-26  Lucas De Marchi  <[email protected]>
+
+        [EFL] Add virtual method to notify user when wrapping focus
+        https://bugs.webkit.org/show_bug.cgi?id=68699
+
+        Reviewed by Antonio Gomes.
+
+        Add a virtual method to ewk_view, so the Chrome gets notified if we
+        finished focusing all the items and would start over. This way the
+        browser can decide to handle the subsequent focus changes among its
+        widgets.
+
+        * WebCoreSupport/ChromeClientEfl.cpp: call ewk_view's virtual method to
+        give it a chance to grab focus
+        (WebCore::ChromeClientEfl::canTakeFocus):
+        * ewk/ewk_private.h:
+        * ewk/ewk_view.cpp: add virtual method
+        (ewk_view_focus_can_cycle):
+        * ewk/ewk_view.h: add focus direction enum and virtual method
+
 2011-09-24  Adam Barth  <[email protected]>
 
         Always enable ENABLE(OFFLINE_WEB_APPLICATIONS)

Modified: trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp (95982 => 95983)


--- trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp	2011-09-26 19:58:00 UTC (rev 95982)
+++ trunk/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp	2011-09-26 19:58:24 UTC (rev 95983)
@@ -236,11 +236,15 @@
     ewk_view_window_close(m_view);
 }
 
-bool ChromeClientEfl::canTakeFocus(FocusDirection)
+bool ChromeClientEfl::canTakeFocus(FocusDirection coreDirection)
 {
     // This is called when cycling through links/focusable objects and we
     // reach the last focusable object.
-    return false;
+    ASSERT(coreDirection == FocusDirectionForward || coreDirection == FocusDirectionBackward);
+
+    Ewk_Focus_Direction direction = static_cast<Ewk_Focus_Direction>(coreDirection);
+
+    return !ewk_view_focus_can_cycle(m_view, direction);
 }
 
 void ChromeClientEfl::takeFocus(FocusDirection)

Modified: trunk/Source/WebKit/efl/ewk/ewk_private.h (95982 => 95983)


--- trunk/Source/WebKit/efl/ewk/ewk_private.h	2011-09-26 19:58:00 UTC (rev 95982)
+++ trunk/Source/WebKit/efl/ewk/ewk_private.h	2011-09-26 19:58:24 UTC (rev 95983)
@@ -139,6 +139,8 @@
 void ewk_view_editor_client_contents_changed(Evas_Object* o);
 void ewk_view_editor_client_selection_changed(Evas_Object* o);
 
+bool ewk_view_focus_can_cycle(Evas_Object *o, Ewk_Focus_Direction direction);
+
 #if ENABLE(NETSCAPE_PLUGIN_API)
 void ewk_view_js_window_object_clear(Evas_Object* o, Evas_Object* frame);
 #endif

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.cpp (95982 => 95983)


--- trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2011-09-26 19:58:00 UTC (rev 95982)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.cpp	2011-09-26 19:58:24 UTC (rev 95983)
@@ -3107,6 +3107,18 @@
     sd->api->add_console_message(sd, message, lineNumber, sourceID);
 }
 
+bool ewk_view_focus_can_cycle(Evas_Object* o, Ewk_Focus_Direction direction)
+{
+    DBG("o=%p direction=%d", o, direction);
+    EWK_VIEW_SD_GET_OR_RETURN(o, sd, false);
+    EINA_SAFETY_ON_NULL_RETURN_VAL(sd->api, false);
+
+    if (!sd->api->focus_can_cycle)
+        return false;
+
+    return sd->api->focus_can_cycle(sd, direction);
+}
+
 void ewk_view_run_javascript_alert(Evas_Object* o, Evas_Object* frame, const char* message)
 {
     DBG("o=%p frame=%p message=%s", o, frame, message);

Modified: trunk/Source/WebKit/efl/ewk/ewk_view.h (95982 => 95983)


--- trunk/Source/WebKit/efl/ewk/ewk_view.h	2011-09-26 19:58:00 UTC (rev 95982)
+++ trunk/Source/WebKit/efl/ewk/ewk_view.h	2011-09-26 19:58:24 UTC (rev 95983)
@@ -104,6 +104,15 @@
 
 /// Creates a type name for @a _Ewk_View_Smart_Class.
 typedef struct _Ewk_View_Smart_Class Ewk_View_Smart_Class;
+
+// Defines the direction of focus change. Keep in sync with
+// WebCore::FocusDirection.
+enum _Ewk_Focus_Direction {
+    EWK_FOCUS_DIRECTION_FORWARD = 1,
+    EWK_FOCUS_DIRECTION_BACKWARD,
+};
+typedef enum _Ewk_Focus_Direction Ewk_Focus_Direction;
+
 /// Ewk view's class, to be overridden by sub-classes.
 struct _Ewk_View_Smart_Class {
     Evas_Smart_Class sc; /**< All but 'data' is free to be changed. */
@@ -149,13 +158,14 @@
     Eina_Bool (*run_open_panel)(Ewk_View_Smart_Data *sd, Evas_Object *frame, Eina_Bool allows_multiple_files, const char *accept_types, Eina_List **selected_filenames);
 
     Eina_Bool (*navigation_policy_decision)(Ewk_View_Smart_Data *sd, Ewk_Frame_Resource_Request *request);
+    Eina_Bool (*focus_can_cycle)(Ewk_View_Smart_Data *sd, Ewk_Focus_Direction direction);
 };
 
 /**
  * The version you have to put into the version field
  * in the @a Ewk_View_Smart_Class structure.
  */
-#define EWK_VIEW_SMART_CLASS_VERSION 1UL
+#define EWK_VIEW_SMART_CLASS_VERSION 2UL
 
 /**
  * Initializes a whole @a Ewk_View_Smart_Class structure.
@@ -167,7 +177,7 @@
  * @see EWK_VIEW_SMART_CLASS_INIT_VERSION
  * @see EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION
  */
-#define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
 
 /**
  * Initializes to zero a whole @a Ewk_View_Smart_Class structure.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to