[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

jhoneycutt at apple.com jhoneycutt at apple.com
Thu Apr 8 00:54:05 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit cd3d45c6efea9fe8c2fc481daaa37e80abd5fc78
Author: jhoneycutt at apple.com <jhoneycutt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 5 01:12:13 2010 +0000

    MSAA: <select> elements should broadcast value change events
    
    https://bugs.webkit.org/show_bug.cgi?id=33088
    
    <rdar://problem/7332364>
    
    Reviewed by Darin Adler.
    
    WebCore:
    
    * accessibility/AXObjectCache.cpp:
    (WebCore::AXObjectCache::postNotification):
    If the post type is async, follow the old code path; otherwise, call
    postPlatformNotification().
    
    * accessibility/AXObjectCache.h:
    (WebCore::AXObjectCache::):
    Added a new accessibility notification, AXMenuListValueChanged. Added
    a new parameter to postNotification() to specify whether the post should
    be synchronous or asynchronous.
    
    * accessibility/win/AXObjectCacheWin.cpp:
    (WebCore::AXObjectCache::postPlatformNotification):
    If the WebCore notification is AXMenuListValueChanged, broadcast an
    EVENT_OBJECT_VALUECHANGE event.
    
    * dom/SelectElement.cpp:
    (WebCore::SelectElement::setSelectedIndex):
    When the selected index of a RenderMenuList is changed, call
    RenderMenuList::didSetSelectedIndex().
    
    * rendering/RenderMenuList.cpp:
    (WebCore::RenderMenuList::RenderMenuList):
    Initialize new member
    (WebCore::RenderMenuList::didSetSelectedIndex):
    If the selected index has changed, post AXMenuListValueChanged to the
    object synchronously.
    
    * rendering/RenderMenuList.h:
    Declare didSetSelectedIndex(), and add a member to hold the last
    selected index.
    
    WebKitTools:
    
    * DumpRenderTree/AccessibilityController.cpp:
    (logValueChangeEventsCallback):
    Start logging value change events.
    (AccessibilityController::getJSClass):
    Add a "logValueChangeEvents" to the AccessibilityController's JS class
    definition.
    (AccessibilityController::resetToConsistentState):
    Disable logging of value change events.
    
    * DumpRenderTree/AccessibilityController.h:
    Declare setLogValueChangeEvents(), and add a member variable for the
    value change event hook.
    
    * DumpRenderTree/gtk/AccessibilityControllerGtk.cpp:
    (AccessibilityController::setLogValueChangeEvents):
    Stubbed.
    
    * DumpRenderTree/mac/AccessibilityControllerMac.mm:
    (AccessibilityController::setLogValueChangeEvents):
    Stubbed.
    
    * DumpRenderTree/win/AccessibilityControllerWin.cpp:
    (AccessibilityController::AccessibilityController):
    Initialize new member var.
    (AccessibilityController::~AccessibilityController):
    Disable logging of value change events.
    (logEventProc):
    When we receive an EVENT_OBJECT_VALUECHANGE, log the name of the object
    and its value.
    (AccessibilityController::setLogValueChangeEvents):
    If disabling logging, unhook the event, and clear the event hook
    member var. Otherwise, query for the root element to enable
    accessibility, and hook EVENT_OBJECT_VALUECHANGE.
    
    LayoutTests:
    
    * platform/win/accessibility/select-element-valuechange-event-expected.txt: Added.
    * platform/win/accessibility/select-element-valuechange-event.html: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52773 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index be7c6cd..af79dcf 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-01-04  Jon Honeycutt  <jhoneycutt at apple.com>
+
+        MSAA: <select> elements should broadcast value change events
+
+        https://bugs.webkit.org/show_bug.cgi?id=33088
+
+        <rdar://problem/7332364>
+
+        Reviewed by Darin Adler.
+
+        * platform/win/accessibility/select-element-valuechange-event-expected.txt: Added.
+        * platform/win/accessibility/select-element-valuechange-event.html: Added.
+
 2010-01-04  Darin Adler  <darin at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/LayoutTests/platform/win/accessibility/select-element-valuechange-event-expected.txt b/LayoutTests/platform/win/accessibility/select-element-valuechange-event-expected.txt
new file mode 100644
index 0000000..ffe3c41
--- /dev/null
+++ b/LayoutTests/platform/win/accessibility/select-element-valuechange-event-expected.txt
@@ -0,0 +1,6 @@
+Received value change event for object 'selectElement', value 'Option 2'.
+Received value change event for object 'selectElement', value 'Option 3'.
+This tests that we broadcast value change events when the selected item changes.
+
+
+
diff --git a/LayoutTests/platform/win/accessibility/select-element-valuechange-event.html b/LayoutTests/platform/win/accessibility/select-element-valuechange-event.html
new file mode 100644
index 0000000..f006124
--- /dev/null
+++ b/LayoutTests/platform/win/accessibility/select-element-valuechange-event.html
@@ -0,0 +1,30 @@
+<html>
+<body id="body">
+
+<p>This tests that we broadcast value change events when the selected item changes.</p>
+
+<p id="notDRT">This test should only be run inside of DumpRenderTree.</p>
+
+<select id="selectElement" title="selectElement">
+    <option SELECTED>Option 1</option>
+    <option>Option 2</option>
+    <option>Option 3</option>
+</select>
+
+<script>
+    if (window.layoutTestController && window.accessibilityController) {
+        document.getElementById("notDRT").style.visibility = "hidden";
+
+        layoutTestController.dumpAsText();
+    
+        accessibilityController.logValueChangeEvents();
+
+        document.getElementById("selectElement").focus();
+
+        document.getElementById("selectElement").selectedIndex = 1;
+
+        eventSender.keyDown("downArrow");
+    }
+</script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4d0c2fc..07d9595 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,45 @@
+2010-01-04  Jon Honeycutt  <jhoneycutt at apple.com>
+
+        MSAA: <select> elements should broadcast value change events
+
+        https://bugs.webkit.org/show_bug.cgi?id=33088
+
+        <rdar://problem/7332364>
+
+        Reviewed by Darin Adler.
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::postNotification):
+        If the post type is async, follow the old code path; otherwise, call
+        postPlatformNotification().
+
+        * accessibility/AXObjectCache.h:
+        (WebCore::AXObjectCache::):
+        Added a new accessibility notification, AXMenuListValueChanged. Added
+        a new parameter to postNotification() to specify whether the post should
+        be synchronous or asynchronous.
+
+        * accessibility/win/AXObjectCacheWin.cpp:
+        (WebCore::AXObjectCache::postPlatformNotification):
+        If the WebCore notification is AXMenuListValueChanged, broadcast an
+        EVENT_OBJECT_VALUECHANGE event.
+
+        * dom/SelectElement.cpp:
+        (WebCore::SelectElement::setSelectedIndex):
+        When the selected index of a RenderMenuList is changed, call
+        RenderMenuList::didSetSelectedIndex().
+
+        * rendering/RenderMenuList.cpp:
+        (WebCore::RenderMenuList::RenderMenuList):
+        Initialize new member
+        (WebCore::RenderMenuList::didSetSelectedIndex):
+        If the selected index has changed, post AXMenuListValueChanged to the
+        object synchronously.
+
+        * rendering/RenderMenuList.h:
+        Declare didSetSelectedIndex(), and add a member to hold the last
+        selected index.
+
 2010-01-04  Darin Adler  <darin at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebCore/accessibility/AXObjectCache.cpp b/WebCore/accessibility/AXObjectCache.cpp
index e46fc41..8cfd6c0 100644
--- a/WebCore/accessibility/AXObjectCache.cpp
+++ b/WebCore/accessibility/AXObjectCache.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -341,7 +341,7 @@ void AXObjectCache::notificationPostTimerFired(Timer<AXObjectCache>*)
 }
     
 #if HAVE(ACCESSIBILITY)
-void AXObjectCache::postNotification(RenderObject* renderer, AXNotification notification, bool postToElement)
+void AXObjectCache::postNotification(RenderObject* renderer, AXNotification notification, bool postToElement, PostType postType)
 {
     // Notifications for text input objects are sent to that object.
     // All others are sent to the top WebArea.
@@ -369,9 +369,12 @@ void AXObjectCache::postNotification(RenderObject* renderer, AXNotification noti
     if (!obj)
         return;
 
-    m_notificationsToPost.append(make_pair(obj, notification));
-    if (!m_notificationPostTimer.isActive())
-        m_notificationPostTimer.startOneShot(0);
+    if (postType == PostAsynchronously) {
+        m_notificationsToPost.append(make_pair(obj, notification));
+        if (!m_notificationPostTimer.isActive())
+            m_notificationPostTimer.startOneShot(0);
+    } else
+        postPlatformNotification(obj.get(), notification);
 }
 
 void AXObjectCache::selectedChildrenChanged(RenderObject* renderer)
diff --git a/WebCore/accessibility/AXObjectCache.h b/WebCore/accessibility/AXObjectCache.h
index adfddcd..b174b3b 100644
--- a/WebCore/accessibility/AXObjectCache.h
+++ b/WebCore/accessibility/AXObjectCache.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -55,6 +55,8 @@ struct TextMarkerData {
     EAffinity affinity;
 };
 
+enum PostType { PostSynchronously, PostAsynchronously };
+
 class AXObjectCache : public Noncopyable {
 public:
     AXObjectCache();
@@ -108,9 +110,10 @@ public:
         AXSelectedTextChanged,
         AXValueChanged,
         AXScrolledToAnchor,
+        AXMenuListValueChanged,
     };
-    
-    void postNotification(RenderObject*, AXNotification, bool postToElement);
+
+    void postNotification(RenderObject*, AXNotification, bool postToElement, PostType = PostAsynchronously);
 
 protected:
     void postPlatformNotification(AccessibilityObject*, AXNotification);
diff --git a/WebCore/accessibility/win/AXObjectCacheWin.cpp b/WebCore/accessibility/win/AXObjectCacheWin.cpp
index e768a8a..8b7d99e 100644
--- a/WebCore/accessibility/win/AXObjectCacheWin.cpp
+++ b/WebCore/accessibility/win/AXObjectCacheWin.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008, 2009, 2010 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -83,6 +83,10 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotific
             msaaEvent = EVENT_SYSTEM_SCROLLINGSTART;
             break;
 
+        case AXMenuListValueChanged:
+            msaaEvent = EVENT_OBJECT_VALUECHANGE;
+            break;
+
         default:
             return;
     }
diff --git a/WebCore/dom/SelectElement.cpp b/WebCore/dom/SelectElement.cpp
index 2d00350..54387fc 100644
--- a/WebCore/dom/SelectElement.cpp
+++ b/WebCore/dom/SelectElement.cpp
@@ -349,6 +349,8 @@ void SelectElement::setSelectedIndex(SelectElementData& data, Element* element,
         data.setUserDrivenChange(userDrivenChange);
         if (fireOnChangeNow)
             menuListOnChange(data, element);
+        if (RenderMenuList* menuList = toRenderMenuList(element->renderer()))
+            menuList->didSetSelectedIndex();
     }
 
     if (Frame* frame = element->document()->frame())
diff --git a/WebCore/rendering/RenderMenuList.cpp b/WebCore/rendering/RenderMenuList.cpp
index 13fe747..f48c30f 100644
--- a/WebCore/rendering/RenderMenuList.cpp
+++ b/WebCore/rendering/RenderMenuList.cpp
@@ -1,7 +1,7 @@
 /*
  * This file is part of the select element renderer in WebCore.
  *
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
  *               2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
  *
  * This library is free software; you can redistribute it and/or
@@ -24,6 +24,7 @@
 #include "config.h"
 #include "RenderMenuList.h"
 
+#include "AXObjectCache.h"
 #include "CSSStyleSelector.h"
 #include "Frame.h"
 #include "FrameView.h"
@@ -50,6 +51,7 @@ RenderMenuList::RenderMenuList(Element* element)
     , m_innerBlock(0)
     , m_optionsChanged(true)
     , m_optionsWidth(0)
+    , m_lastSelectedIndex(-1)
     , m_popup(0)
     , m_popupIsVisible(false)
 {
@@ -306,6 +308,18 @@ void RenderMenuList::valueChanged(unsigned listIndex, bool fireOnChange)
     select->setSelectedIndexByUser(select->listToOptionIndex(listIndex), true, fireOnChange);
 }
 
+void RenderMenuList::didSetSelectedIndex()
+{
+    int index = selectedIndex();
+    if (m_lastSelectedIndex == index)
+        return;
+
+    m_lastSelectedIndex = index;
+
+    if (AXObjectCache::accessibilityEnabled())
+        document()->axObjectCache()->postNotification(this, AXObjectCache::AXMenuListValueChanged, true, PostSynchronously);
+}
+
 String RenderMenuList::itemText(unsigned listIndex) const
 {
     SelectElement* select = toSelectElement(static_cast<Element*>(node()));
diff --git a/WebCore/rendering/RenderMenuList.h b/WebCore/rendering/RenderMenuList.h
index 7ced2a0..266869b 100644
--- a/WebCore/rendering/RenderMenuList.h
+++ b/WebCore/rendering/RenderMenuList.h
@@ -1,7 +1,7 @@
 /*
  * This file is part of the select element renderer in WebCore.
  *
- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -49,6 +49,8 @@ public:
 
     void setOptionsChanged(bool changed) { m_optionsChanged = changed; }
 
+    void didSetSelectedIndex();
+
     String text() const;
 
 private:
@@ -111,6 +113,8 @@ private:
     bool m_optionsChanged;
     int m_optionsWidth;
 
+    int m_lastSelectedIndex;
+
     RefPtr<PopupMenu> m_popup;
     bool m_popupIsVisible;
 };
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index ed3b847..40eaa18 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,47 @@
+2010-01-04  Jon Honeycutt  <jhoneycutt at apple.com>
+
+        MSAA: <select> elements should broadcast value change events
+
+        https://bugs.webkit.org/show_bug.cgi?id=33088
+
+        <rdar://problem/7332364>
+
+        Reviewed by Darin Adler.
+
+        * DumpRenderTree/AccessibilityController.cpp:
+        (logValueChangeEventsCallback):
+        Start logging value change events.
+        (AccessibilityController::getJSClass):
+        Add a "logValueChangeEvents" to the AccessibilityController's JS class
+        definition.
+        (AccessibilityController::resetToConsistentState):
+        Disable logging of value change events.
+
+        * DumpRenderTree/AccessibilityController.h:
+        Declare setLogValueChangeEvents(), and add a member variable for the
+        value change event hook.
+
+        * DumpRenderTree/gtk/AccessibilityControllerGtk.cpp:
+        (AccessibilityController::setLogValueChangeEvents):
+        Stubbed.
+
+        * DumpRenderTree/mac/AccessibilityControllerMac.mm:
+        (AccessibilityController::setLogValueChangeEvents):
+        Stubbed.
+
+        * DumpRenderTree/win/AccessibilityControllerWin.cpp:
+        (AccessibilityController::AccessibilityController):
+        Initialize new member var.
+        (AccessibilityController::~AccessibilityController):
+        Disable logging of value change events.
+        (logEventProc):
+        When we receive an EVENT_OBJECT_VALUECHANGE, log the name of the object
+        and its value.
+        (AccessibilityController::setLogValueChangeEvents):
+        If disabling logging, unhook the event, and clear the event hook
+        member var. Otherwise, query for the root element to enable
+        accessibility, and hook EVENT_OBJECT_VALUECHANGE.
+
 2010-01-04  Adam Barth  <abarth at webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebKitTools/DumpRenderTree/AccessibilityController.cpp b/WebKitTools/DumpRenderTree/AccessibilityController.cpp
index d3688f4..045bc80 100644
--- a/WebKitTools/DumpRenderTree/AccessibilityController.cpp
+++ b/WebKitTools/DumpRenderTree/AccessibilityController.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008, 2009, 2010 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -63,6 +63,13 @@ static JSValueRef logFocusEventsCallback(JSContextRef ctx, JSObjectRef, JSObject
     return JSValueMakeUndefined(ctx);
 }
 
+static JSValueRef logValueChangeEventsCallback(JSContextRef ctx, JSObjectRef, JSObjectRef thisObject, size_t, const JSValueRef[], JSValueRef*)
+{
+    AccessibilityController* controller = static_cast<AccessibilityController*>(JSObjectGetPrivate(thisObject));
+    controller->setLogValueChangeEvents(true);
+    return JSValueMakeUndefined(ctx);
+}
+
 static JSValueRef logScrollingStartEventsCallback(JSContextRef ctx, JSObjectRef, JSObjectRef thisObject, size_t, const JSValueRef[], JSValueRef*)
 {
     AccessibilityController* controller = static_cast<AccessibilityController*>(JSObjectGetPrivate(thisObject));
@@ -74,6 +81,7 @@ JSClassRef AccessibilityController::getJSClass()
 {
     static JSStaticFunction staticFunctions[] = {
         { "logFocusEvents", logFocusEventsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "logValueChangeEvents", logValueChangeEventsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "logScrollingStartEvents", logScrollingStartEventsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { 0, 0, 0 }
     };
@@ -95,5 +103,6 @@ JSClassRef AccessibilityController::getJSClass()
 void AccessibilityController::resetToConsistentState()
 {
     setLogFocusEvents(false);
+    setLogValueChangeEvents(false);
     setLogScrollingStartEvents(false);
 }
diff --git a/WebKitTools/DumpRenderTree/AccessibilityController.h b/WebKitTools/DumpRenderTree/AccessibilityController.h
index a10e8be..b4d45eb 100644
--- a/WebKitTools/DumpRenderTree/AccessibilityController.h
+++ b/WebKitTools/DumpRenderTree/AccessibilityController.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008, 2009, 2010 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -45,6 +45,7 @@ public:
     AccessibilityUIElement focusedElement();
 
     void setLogFocusEvents(bool);
+    void setLogValueChangeEvents(bool);
     void setLogScrollingStartEvents(bool);
 
     void resetToConsistentState();
@@ -54,6 +55,7 @@ private:
 
 #if PLATFORM(WIN)
     HWINEVENTHOOK m_focusEventHook;
+    HWINEVENTHOOK m_valueChangeEventHook;
     HWINEVENTHOOK m_scrollingStartEventHook;
 #endif
 };
diff --git a/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp
index df06cea..d95f854 100644
--- a/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/AccessibilityControllerGtk.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008, 2009, 2010 Apple Inc. All Rights Reserved.
  * Copyright (C) 2009 Jan Michael Alonzo
  *
  * Redistribution and use in source and binary forms, with or without
@@ -73,3 +73,7 @@ void AccessibilityController::setLogFocusEvents(bool)
 void AccessibilityController::setLogScrollingStartEvents(bool)
 {
 }
+
+void AccessibilityController::setLogValueChangeEvents(bool)
+{
+}
diff --git a/WebKitTools/DumpRenderTree/mac/AccessibilityControllerMac.mm b/WebKitTools/DumpRenderTree/mac/AccessibilityControllerMac.mm
index 67e0fa4..4895a1a 100644
--- a/WebKitTools/DumpRenderTree/mac/AccessibilityControllerMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/AccessibilityControllerMac.mm
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008, 2009, 2010 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -62,3 +62,6 @@ void AccessibilityController::setLogScrollingStartEvents(bool)
 {
 }
 
+void AccessibilityController::setLogValueChangeEvents(bool)
+{
+}
diff --git a/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp b/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp
index ac64efb..1abb71e 100644
--- a/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/AccessibilityControllerWin.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008, 2009, 2010 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -39,12 +39,14 @@ using namespace std;
 AccessibilityController::AccessibilityController()
     : m_focusEventHook(0)
     , m_scrollingStartEventHook(0)
+    , m_valueChangeEventHook(0)
 {
 }
 
 AccessibilityController::~AccessibilityController()
 {
     setLogFocusEvents(false);
+    setLogValueChangeEvents(false);
 }
 
 AccessibilityUIElement AccessibilityController::focusedElement()
@@ -112,6 +114,17 @@ static void CALLBACK logEventProc(HWINEVENTHOOK hWinEventHook, DWORD event, HWND
             printf("Received focus event for object '%S'.\n", name.c_str());
             break;
 
+        case EVENT_OBJECT_VALUECHANGE: {
+            BSTR valueBSTR;
+            hr = parentObject->get_accValue(vChild, &valueBSTR);
+            ASSERT(SUCCEEDED(hr));
+            wstring value(valueBSTR, ::SysStringLen(valueBSTR));
+            SysFreeString(valueBSTR);
+
+            printf("Received value change event for object '%S', value '%S'.\n", name.c_str(), value.c_str());
+            break;
+        }
+
         case EVENT_SYSTEM_SCROLLINGSTART:
             printf("Received scrolling start event for object '%S'.\n", name.c_str());
             break;
@@ -142,6 +155,26 @@ void AccessibilityController::setLogFocusEvents(bool logFocusEvents)
     ASSERT(m_focusEventHook);
 }
 
+void AccessibilityController::setLogValueChangeEvents(bool logValueChangeEvents)
+{
+    if (!!m_valueChangeEventHook == logValueChangeEvents)
+        return;
+
+    if (!logValueChangeEvents) {
+        UnhookWinEvent(m_valueChangeEventHook);
+        m_valueChangeEventHook = 0;
+        return;
+    }
+
+    // Ensure that accessibility is initialized for the WebView by querying for
+    // the root accessible object.
+    rootElement();
+
+    m_valueChangeEventHook = SetWinEventHook(EVENT_OBJECT_VALUECHANGE, EVENT_OBJECT_VALUECHANGE, GetModuleHandle(0), logEventProc, GetCurrentProcessId(), 0, WINEVENT_INCONTEXT);
+
+    ASSERT(m_valueChangeEventHook);
+}
+
 void AccessibilityController::setLogScrollingStartEvents(bool logScrollingStartEvents)
 {
     if (!!m_scrollingStartEventHook == logScrollingStartEvents)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list