Re-land: Send Windows accessibility events based on tree updates.
The idea of this change is to fire Win AX events
based on the AX tree changing, rather than based
on Blink firing the right event and mapping it to a
Win event.
Store the Win-specific AX attributes (ia role,
ia state, name, value, etc.) in a struct, and when a
node is updated, compare the old value of each attribute
to the new value and fire an appropriate event for each
one (name changed, state changed, etc.).
Handle hypertext_ similarly, and properly diff the old and new hypertext in get_oldText and get_newText.
This enables all of the "event" tests that were
previously added to pass now, and it makes live regions
work correctly in NVDA and JAWS.
BUG=447962
Committed: https://crrev.com/eb691a960bef3c2aefa38627baa7cbdde480b81e
Cr-Commit-Position: refs/heads/master@{#313052}
Review URL: https://codereview.chromium.org/848653002
Cr-Commit-Position: refs/heads/master@{#313179}
diff --git a/content/browser/accessibility/browser_accessibility.h b/content/browser/accessibility/browser_accessibility.h
index 37f2fe04..e8a7d387 100644
--- a/content/browser/accessibility/browser_accessibility.h
+++ b/content/browser/accessibility/browser_accessibility.h
@@ -56,15 +56,15 @@
// Called after the object is first initialized and again every time
// its data changes.
- virtual void OnDataChanged();
+ virtual void OnDataChanged() {}
// Called after an atomic update to the tree finished and this object
// was created or changed in this update.
virtual void OnUpdateFinished() {}
- // Returns true if this is a native platform-specific object, vs a
- // cross-platform generic object.
- virtual bool IsNative() const;
+ virtual void OnSubtreeWillBeDeleted() {}
+
+ virtual void OnSubtreeCreationFinished() {}
// Called when the location changed.
virtual void OnLocationChanged() {}
@@ -88,6 +88,11 @@
// invalid index. Returns NULL if PlatformIsLeaf() returns true.
BrowserAccessibility* PlatformGetChild(uint32 child_index) const;
+ // Returns true if an ancestor of this node (not including itself) is a
+ // leaf node, meaning that this node is not actually exposed to the
+ // platform.
+ bool PlatformIsChildOfLeaf() const;
+
// Return the previous sibling of this object, or NULL if it's the first
// child of its parent.
BrowserAccessibility* GetPreviousSibling();
@@ -140,10 +145,6 @@
BrowserAccessibilityManager* manager() const { return manager_; }
bool instance_active() const { return node_ != NULL; }
ui::AXNode* node() const { return node_; }
- const std::string& name() const { return name_; }
- const std::string& value() const { return value_; }
- void set_name(const std::string& name) { name_ = name; }
- void set_value(const std::string& value) { value_ = value; }
// These access the internal accessibility tree, which doesn't necessarily
// reflect the accessibility tree that should be exposed on each platform.
@@ -164,6 +165,12 @@
typedef base::StringPairs HtmlAttributes;
const HtmlAttributes& GetHtmlAttributes() const;
+
+ // Returns true if this is a native platform-specific object, vs a
+ // cross-platform generic object. Don't call ToBrowserAccessibilityXXX if
+ // IsNative returns false.
+ virtual bool IsNative() const;
+
#if defined(OS_MACOSX) && __OBJC__
BrowserAccessibilityCocoa* ToBrowserAccessibilityCocoa();
#elif defined(OS_WIN)
@@ -214,9 +221,6 @@
bool GetIntListAttribute(ui::AXIntListAttribute attribute,
std::vector<int32>* value) const;
- void SetStringAttribute(ui::AXStringAttribute attribute,
- const std::string& value);
-
// Retrieve the value of a html attribute from the attribute map and
// returns true if found.
bool GetHtmlAttribute(const char* attr, base::string16* value) const;
@@ -250,9 +254,6 @@
// True if this is a web area, and its grandparent is a presentational iframe.
bool IsWebAreaForPresentationalIframe() const;
- // Append the text from this node and its children.
- std::string GetTextRecursive() const;
-
protected:
BrowserAccessibility();
@@ -272,9 +273,6 @@
// bounds offsets.
BrowserAccessibility* GetParentForBoundsCalculation() const;
- std::string name_;
- std::string value_;
-
DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility);
};