Title: [143937] trunk/Source/WebCore
Revision
143937
Author
commit-qu...@webkit.org
Date
2013-02-25 09:30:23 -0800 (Mon, 25 Feb 2013)

Log Message

[EFL][GTK] Move text selection/focus notification for a11y from gtk to atk directory
https://bugs.webkit.org/show_bug.cgi?id=110221

Patch by Mariusz Grzegorczyk <marius...@samsung.com> on 2013-02-25
Reviewed by Martin Robinson.

Share implementation between efl and gtk.
Update build with changes made.

* GNUmakefile.list.am: Change WebCore/editing/gtk/FrameSelectionGtk.cpp to WebCore/editing/atk/FrameSelectionAtk.cpp to build.
* PlatformEfl.cmake: Add WebCore/editing/atk to include directories, add Webcore/editing/atk/FrameSelectionAtk.cpp to build.
* editing/FrameSelection.h: Omit notifyAccessibilityForSelectionChange() stub for EFL port.
(WebCore):
* editing/atk/FrameSelectionAtk.cpp: Renamed from Source/WebCore/editing/gtk/FrameSelectionGtk.cpp.
(WebCore):
(WebCore::emitTextSelectionChange):
(WebCore::maybeEmitTextFocusChange):
(WebCore::FrameSelection::notifyAccessibilityForSelectionChange):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143936 => 143937)


--- trunk/Source/WebCore/ChangeLog	2013-02-25 17:27:13 UTC (rev 143936)
+++ trunk/Source/WebCore/ChangeLog	2013-02-25 17:30:23 UTC (rev 143937)
@@ -1,3 +1,23 @@
+2013-02-25  Mariusz Grzegorczyk  <marius...@samsung.com>
+
+        [EFL][GTK] Move text selection/focus notification for a11y from gtk to atk directory
+        https://bugs.webkit.org/show_bug.cgi?id=110221
+
+        Reviewed by Martin Robinson.
+
+        Share implementation between efl and gtk.
+        Update build with changes made.
+
+        * GNUmakefile.list.am: Change WebCore/editing/gtk/FrameSelectionGtk.cpp to WebCore/editing/atk/FrameSelectionAtk.cpp to build.
+        * PlatformEfl.cmake: Add WebCore/editing/atk to include directories, add Webcore/editing/atk/FrameSelectionAtk.cpp to build.
+        * editing/FrameSelection.h: Omit notifyAccessibilityForSelectionChange() stub for EFL port.
+        (WebCore):
+        * editing/atk/FrameSelectionAtk.cpp: Renamed from Source/WebCore/editing/gtk/FrameSelectionGtk.cpp.
+        (WebCore):
+        (WebCore::emitTextSelectionChange):
+        (WebCore::maybeEmitTextFocusChange):
+        (WebCore::FrameSelection::notifyAccessibilityForSelectionChange):
+
 2013-02-25  Alpha Lam  <hc...@chromium.org>
 
         GIFImageReader to read from source data directly

Modified: trunk/Source/WebCore/GNUmakefile.list.am (143936 => 143937)


--- trunk/Source/WebCore/GNUmakefile.list.am	2013-02-25 17:27:13 UTC (rev 143936)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2013-02-25 17:30:23 UTC (rev 143937)
@@ -6115,7 +6115,7 @@
 	Source/WebCore/accessibility/atk/WebKitAccessibleUtil.h \
 	Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp \
 	Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.h \
-	Source/WebCore/editing/gtk/FrameSelectionGtk.cpp \
+	Source/WebCore/editing/atk/FrameSelectionAtk.cpp \
 	Source/WebCore/page/gtk/DragControllerGtk.cpp \
 	Source/WebCore/page/gtk/EventHandlerGtk.cpp \
 	Source/WebCore/platform/audio/gtk/AudioBusGtk.cpp \

Modified: trunk/Source/WebCore/PlatformEfl.cmake (143936 => 143937)


--- trunk/Source/WebCore/PlatformEfl.cmake	2013-02-25 17:27:13 UTC (rev 143936)
+++ trunk/Source/WebCore/PlatformEfl.cmake	2013-02-25 17:30:23 UTC (rev 143937)
@@ -1,4 +1,5 @@
 list(APPEND WebCore_INCLUDE_DIRECTORIES
+    "${WEBCORE_DIR}/editing/atk"
     "${WEBCORE_DIR}/page/efl"
     "${WEBCORE_DIR}/platform/cairo"
     "${WEBCORE_DIR}/platform/efl"
@@ -34,6 +35,8 @@
 
     editing/SmartReplaceICU.cpp
 
+    editing/atk/FrameSelectionAtk.cpp
+
     page/efl/DragControllerEfl.cpp
     page/efl/EventHandlerEfl.cpp
 

Modified: trunk/Source/WebCore/editing/FrameSelection.h (143936 => 143937)


--- trunk/Source/WebCore/editing/FrameSelection.h	2013-02-25 17:27:13 UTC (rev 143936)
+++ trunk/Source/WebCore/editing/FrameSelection.h	2013-02-25 17:30:23 UTC (rev 143937)
@@ -329,7 +329,7 @@
     m_typingStyle = style;
 }
 
-#if !(PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(CHROMIUM))
+#if !(PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(CHROMIUM) || PLATFORM(EFL))
 inline void FrameSelection::notifyAccessibilityForSelectionChange()
 {
 }

Copied: trunk/Source/WebCore/editing/atk/FrameSelectionAtk.cpp (from rev 143936, trunk/Source/WebCore/editing/gtk/FrameSelectionGtk.cpp) (0 => 143937)


--- trunk/Source/WebCore/editing/atk/FrameSelectionAtk.cpp	                        (rev 0)
+++ trunk/Source/WebCore/editing/atk/FrameSelectionAtk.cpp	2013-02-25 17:30:23 UTC (rev 143937)
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2009 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "FrameSelection.h"
+
+#include "AXObjectCache.h"
+#include "Frame.h"
+#include "WebKitAccessibleWrapperAtk.h"
+
+#if PLATFORM(EFL)
+#include <glib.h>
+#else
+#include <gtk/gtk.h>
+#endif
+
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+static void emitTextSelectionChange(AccessibilityObject* object, VisibleSelection selection, int offset)
+{
+    AtkObject* axObject = object->wrapper();
+    if (!axObject || !ATK_IS_TEXT(axObject))
+        return;
+
+    g_signal_emit_by_name(axObject, "text-caret-moved", offset);
+    if (selection.isRange())
+        g_signal_emit_by_name(axObject, "text-selection-changed");
+}
+
+static void maybeEmitTextFocusChange(PassRefPtr<AccessibilityObject> prpObject)
+{
+    // This static variable is needed to keep track of the old object
+    // as per previous calls to this function, in order to properly
+    // decide whether to emit some signals or not.
+    DEFINE_STATIC_LOCAL(RefPtr<AccessibilityObject>, oldObject, ());
+
+    RefPtr<AccessibilityObject> object = prpObject;
+
+    // Ensure the oldObject belongs to the same document that the
+    // current object so further comparisons make sense. Otherwise,
+    // just reset oldObject to 0 so it won't be taken into account in
+    // the immediately following call to this function.
+    if (object && oldObject && oldObject->document() != object->document())
+        oldObject = 0;
+
+    AtkObject* axObject = object ? object->wrapper() : 0;
+    AtkObject* oldAxObject = oldObject ? oldObject->wrapper() : 0;
+
+    if (axObject != oldAxObject) {
+        if (oldAxObject && ATK_IS_TEXT(oldAxObject)) {
+            g_signal_emit_by_name(oldAxObject, "focus-event", false);
+            g_signal_emit_by_name(oldAxObject, "state-change", "focused", false);
+        }
+        if (axObject && ATK_IS_TEXT(axObject)) {
+            g_signal_emit_by_name(axObject, "focus-event", true);
+            g_signal_emit_by_name(axObject, "state-change", "focused", true);
+        }
+    }
+
+    // Update pointer to last focused object.
+    oldObject = object;
+}
+
+
+void FrameSelection::notifyAccessibilityForSelectionChange()
+{
+    if (!AXObjectCache::accessibilityEnabled())
+        return;
+
+    if (!m_selection.start().isNotNull() || !m_selection.end().isNotNull())
+        return;
+
+    RenderObject* focusedNode = m_selection.end().containerNode()->renderer();
+    AccessibilityObject* accessibilityObject = m_frame->document()->axObjectCache()->getOrCreate(focusedNode);
+    if (!accessibilityObject)
+        return;
+
+    int offset;
+    RefPtr<AccessibilityObject> object = objectFocusedAndCaretOffsetUnignored(accessibilityObject, offset);
+    if (!object)
+        return;
+
+    emitTextSelectionChange(object.get(), m_selection, offset);
+    maybeEmitTextFocusChange(object.release());
+}
+
+} // namespace WebCore

Deleted: trunk/Source/WebCore/editing/gtk/FrameSelectionGtk.cpp (143936 => 143937)


--- trunk/Source/WebCore/editing/gtk/FrameSelectionGtk.cpp	2013-02-25 17:27:13 UTC (rev 143936)
+++ trunk/Source/WebCore/editing/gtk/FrameSelectionGtk.cpp	2013-02-25 17:30:23 UTC (rev 143937)
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2009 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
- 
-#include "config.h"
-#include "FrameSelection.h"
-
-#include "AXObjectCache.h"
-#include "Frame.h"
-#include "WebKitAccessibleWrapperAtk.h"
-
-#include <gtk/gtk.h>
-
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-static void emitTextSelectionChange(AccessibilityObject* object, VisibleSelection selection, int offset)
-{
-    AtkObject* axObject = object->wrapper();
-    if (!axObject || !ATK_IS_TEXT(axObject))
-        return;
-
-    g_signal_emit_by_name(axObject, "text-caret-moved", offset);
-    if (selection.isRange())
-        g_signal_emit_by_name(axObject, "text-selection-changed");
-}
-
-static void maybeEmitTextFocusChange(PassRefPtr<AccessibilityObject> prpObject)
-{
-    // This static variable is needed to keep track of the old object
-    // as per previous calls to this function, in order to properly
-    // decide whether to emit some signals or not.
-    DEFINE_STATIC_LOCAL(RefPtr<AccessibilityObject>, oldObject, ());
-
-    RefPtr<AccessibilityObject> object = prpObject;
-
-    // Ensure the oldObject belongs to the same document that the
-    // current object so further comparisons make sense. Otherwise,
-    // just reset oldObject to 0 so it won't be taken into account in
-    // the immediately following call to this function.
-    if (object && oldObject && oldObject->document() != object->document())
-        oldObject = 0;
-
-    AtkObject* axObject = object ? object->wrapper() : 0;
-    AtkObject* oldAxObject = oldObject ? oldObject->wrapper() : 0;
-
-    if (axObject != oldAxObject) {
-        if (oldAxObject && ATK_IS_TEXT(oldAxObject)) {
-            g_signal_emit_by_name(oldAxObject, "focus-event", false);
-            g_signal_emit_by_name(oldAxObject, "state-change", "focused", false);
-        }
-        if (axObject && ATK_IS_TEXT(axObject)) {
-            g_signal_emit_by_name(axObject, "focus-event", true);
-            g_signal_emit_by_name(axObject, "state-change", "focused", true);
-        }
-    }
-
-    // Update pointer to last focused object.
-    oldObject = object;
-}
-
-
-void FrameSelection::notifyAccessibilityForSelectionChange()
-{
-    if (!AXObjectCache::accessibilityEnabled())
-        return;
-
-    // Return for no valid selections.
-    if (!m_selection.start().isNotNull() || !m_selection.end().isNotNull())
-        return;
-
-    RenderObject* focusedNode = m_selection.end().containerNode()->renderer();
-    AccessibilityObject* accessibilityObject = m_frame->document()->axObjectCache()->getOrCreate(focusedNode);
-
-    // Need to check this as getOrCreate could return 0.
-    if (!accessibilityObject)
-        return;
-
-    int offset;
-    RefPtr<AccessibilityObject> object = objectFocusedAndCaretOffsetUnignored(accessibilityObject, offset);
-    if (!object)
-        return;
-
-    // Emit relatedsignals.
-    emitTextSelectionChange(object.get(), m_selection, offset);
-    maybeEmitTextFocusChange(object.release());
-}
-
-} // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to