Add ax action internalInvalidateTree

This change allows a target process or anything outside of the context of a
source tree to request that its source tree be invalidated.

We make use of this new action in the Automation Internal browser side api, when
a client extension's automation bindings requests an enable frame. Typically,
chrome.automationInternal.enableFrame gets called whenever the extension process
encounters a new child tree. This, in turn, resets state within the tree source
and triggers a re-send of all tree data and node data on the next event.

The action is hooked up to one tree source (ARC++).

TBR=dominickn
Bug: 929522
Test: toggle on ChromeVox, interact with Play Store. Toggle off and then back on
ChromeVox, interact with Play Store. Repeat this several times. ChromeVox should
work throughout.

Change-Id: I8e2a729f079f932d06a615bb5fcca9ebbe7365f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1573859
Commit-Queue: David Tseng <dtseng@chromium.org>
Reviewed-by: Katie Dektar <katie@chromium.org>
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652629}
diff --git a/chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bridge.cc b/chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bridge.cc
index f844390..22cd227 100644
--- a/chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bridge.cc
+++ b/chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bridge.cc
@@ -544,6 +544,9 @@
           arc::mojom::AccessibilityActionType::HIDE_TOOLTIP;
       break;
     }
+    case ax::mojom::Action::kInternalInvalidateTree:
+      tree_source->InvalidateTree();
+      break;
     default:
       return;
   }
diff --git a/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.cc b/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.cc
index 62c32ff..4bcd8cc 100644
--- a/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.cc
+++ b/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.cc
@@ -385,6 +385,10 @@
   return info_data_bounds;
 }
 
+void AXTreeSourceArc::InvalidateTree() {
+  current_tree_serializer_->Reset();
+}
+
 gfx::Rect AXTreeSourceArc::ComputeEnclosingBounds(
     ArcAccessibilityInfoData* info_data) const {
   gfx::Rect computed_bounds;
diff --git a/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.h b/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.h
index fc4aed3..e85531f 100644
--- a/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.h
+++ b/chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.h
@@ -81,6 +81,9 @@
   const gfx::Rect GetBounds(ArcAccessibilityInfoData* info_data,
                             aura::Window* focused_window) const;
 
+  // Invalidates the tree serializer.
+  void InvalidateTree();
+
   bool is_notification() { return is_notification_; }
 
   bool is_input_method_window() { return is_input_method_window_; }
diff --git a/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc b/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
index c2f0210..e7970e2 100644
--- a/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
+++ b/chrome/browser/extensions/api/automation_internal/automation_internal_api.cc
@@ -328,8 +328,22 @@
   std::unique_ptr<Params> params(Params::Create(*args_));
   EXTENSION_FUNCTION_VALIDATE(params.get());
 
-  content::RenderFrameHost* rfh = content::RenderFrameHost::FromAXTreeID(
-      ui::AXTreeID::FromString(params->tree_id));
+  ui::AXTreeID ax_tree_id = ui::AXTreeID::FromString(params->tree_id);
+  ui::AXTreeIDRegistry* registry = ui::AXTreeIDRegistry::GetInstance();
+  ui::AXActionHandler* action_handler = registry->GetActionHandler(ax_tree_id);
+  if (action_handler) {
+    // Explicitly invalidate the pre-existing source tree first. This ensures
+    // the source tree sends a complete tree when the next event occurs. This
+    // is required whenever the client extension is reloaded.
+    ui::AXActionData action;
+    action.target_tree_id = ax_tree_id;
+    action.source_extension_id = extension_id();
+    action.action = ax::mojom::Action::kInternalInvalidateTree;
+    action_handler->PerformAction(action);
+  }
+
+  content::RenderFrameHost* rfh =
+      content::RenderFrameHost::FromAXTreeID(ax_tree_id);
   if (!rfh)
     return RespondNow(Error("unable to load tab"));
 
@@ -506,6 +520,7 @@
       break;
     case api::automation::ACTION_TYPE_ANNOTATEPAGEIMAGES:
     case api::automation::ACTION_TYPE_SIGNALENDOFTEST:
+    case api::automation::ACTION_TYPE_INTERNALINVALIDATETREE:
     case api::automation::ACTION_TYPE_NONE:
       break;
   }
diff --git a/chrome/common/extensions/api/automation.idl b/chrome/common/extensions/api/automation.idl
index 3f167a4..781f944 100644
--- a/chrome/common/extensions/api/automation.idl
+++ b/chrome/common/extensions/api/automation.idl
@@ -298,6 +298,7 @@
     hideTooltip,
     hitTest,
     increment,
+    internalInvalidateTree,
     loadInlineTextBoxes,
     replaceSelectedText,
     scrollBackward,
diff --git a/content/renderer/accessibility/render_accessibility_impl.cc b/content/renderer/accessibility/render_accessibility_impl.cc
index 3b77665..ffec479 100644
--- a/content/renderer/accessibility/render_accessibility_impl.cc
+++ b/content/renderer/accessibility/render_accessibility_impl.cc
@@ -792,15 +792,16 @@
         MarkAllAXObjectsDirty(ax::mojom::Role::kImage);
       }
       break;
-    case ax::mojom::Action::kShowTooltip:
-    case ax::mojom::Action::kHideTooltip:
-      break;
     case ax::mojom::Action::kSignalEndOfTest:
       // Wait for 100ms to allow pending events to come in
       base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100));
 
       HandleAXEvent(root, ax::mojom::Event::kEndOfTest);
       break;
+    case ax::mojom::Action::kShowTooltip:
+    case ax::mojom::Action::kHideTooltip:
+    case ax::mojom::Action::kInternalInvalidateTree:
+      break;
   }
 }
 
diff --git a/third_party/closure_compiler/externs/automation.js b/third_party/closure_compiler/externs/automation.js
index aafce1c..4c3d029 100644
--- a/third_party/closure_compiler/externs/automation.js
+++ b/third_party/closure_compiler/externs/automation.js
@@ -305,6 +305,7 @@
   HIDE_TOOLTIP: 'hideTooltip',
   HIT_TEST: 'hitTest',
   INCREMENT: 'increment',
+  INTERNAL_INVALIDATE_TREE: 'internalInvalidateTree',
   LOAD_INLINE_TEXT_BOXES: 'loadInlineTextBoxes',
   REPLACE_SELECTED_TEXT: 'replaceSelectedText',
   SCROLL_BACKWARD: 'scrollBackward',
diff --git a/ui/accessibility/ax_enum_util.cc b/ui/accessibility/ax_enum_util.cc
index 6e16d54..fbf9f5c 100644
--- a/ui/accessibility/ax_enum_util.cc
+++ b/ui/accessibility/ax_enum_util.cc
@@ -1111,6 +1111,8 @@
       return "showTooltip";
     case ax::mojom::Action::kHideTooltip:
       return "hideTooltip";
+    case ax::mojom::Action::kInternalInvalidateTree:
+      return "internalInvalidateTree";
   }
 
   return "";
@@ -1179,6 +1181,8 @@
     return ax::mojom::Action::kShowTooltip;
   if (0 == strcmp(action, "hideTooltip"))
     return ax::mojom::Action::kHideTooltip;
+  if (0 == strcmp(action, "internalInvalidateTree"))
+    return ax::mojom::Action::kInternalInvalidateTree;
   return ax::mojom::Action::kNone;
 }
 
diff --git a/ui/accessibility/ax_enums.mojom b/ui/accessibility/ax_enums.mojom
index 83756d2..152999b 100644
--- a/ui/accessibility/ax_enums.mojom
+++ b/ui/accessibility/ax_enums.mojom
@@ -5,85 +5,85 @@
 // Must also be kept in sync with chrome/common/extensions/api/automation.idl.
 module ax.mojom;
 
- // For new entries to the following four enums, also add to
- // chrome/common/extensions/api/automation.idl. This is enforced
- // by a PRESUBMIT check.
- //
- // Explanation of in-lined comments next to some enum values/attributes:
- //
- // Web: this attribute is only used in web content.
- //
- // Native: this attribute is only used in native UI.
- //
- // Implicit: for events, it would be cleaner if we just updated the AX node and
- //     each platform fired the appropriate events to indicate which
- //     platform-specific attributes changed.
- //
- //  if Native / [Platform1, ...] is specified, the attribute is only used
- //  on those platforms.
- //
- // If unspecified, the atribute is used across web and native on multiple
- // platforms.
+// For new entries to the following four enums, also add to
+// chrome/common/extensions/api/automation.idl. This is enforced
+// by a PRESUBMIT check.
+//
+// Explanation of in-lined comments next to some enum values/attributes:
+//
+// Web: this attribute is only used in web content.
+//
+// Native: this attribute is only used in native UI.
+//
+// Implicit: for events, it would be cleaner if we just updated the AX node and
+//     each platform fired the appropriate events to indicate which
+//     platform-specific attributes changed.
+//
+//  if Native / [Platform1, ...] is specified, the attribute is only used
+//  on those platforms.
+//
+// If unspecified, the attribute is used across web and native on multiple
+// platforms.
 
 enum Event {
   kNone,
-  kActiveDescendantChanged,   // Web
+  kActiveDescendantChanged,  // Web
   kAlert,
-  kAriaAttributeChanged,      // Implicit
-  kAutocorrectionOccured,     // Unknown: http://crbug.com/392498
-  kBlur,                      // Remove: http://crbug.com/392502
-  kCheckedStateChanged,       // Implicit
+  kAriaAttributeChanged,   // Implicit
+  kAutocorrectionOccured,  // Unknown: http://crbug.com/392498
+  kBlur,                   // Remove: http://crbug.com/392502
+  kCheckedStateChanged,    // Implicit
   kChildrenChanged,
   kClicked,
   kDocumentSelectionChanged,
   kDocumentTitleChanged,
-  kEndOfTest,                 // Sentinel value indicating the end of a test
-  kExpandedChanged,           // Web
+  kEndOfTest,        // Sentinel value indicating the end of a test
+  kExpandedChanged,  // Web
   kFocus,
-  kFocusContext,              // Contextual focus event that must delay the next focus event
-  kHide,                      // Remove: http://crbug.com/392502
+  kFocusContext,  // Contextual focus event that must delay the next focus event
+  kHide,          // Remove: http://crbug.com/392502
   kHitTestResult,
   kHover,
-  kImageFrameUpdated,         // Web
-  kInvalidStatusChanged,      // Implicit
-  kLayoutComplete,            // Web
-  kLiveRegionCreated,         // Implicit
-  kLiveRegionChanged,         // Web
-  kLoadComplete,              // Web
-  kLoadStart,                 // Web / AuraLinux
-  kLocationChanged,           // Web
-  kMediaStartedPlaying,       // Native / Automation
-  kMediaStoppedPlaying,       // Native / Automation
-  kMenuEnd,                   // Native / Win
-  kMenuListItemSelected,      // Web
-  kMenuListValueChanged,      // Web
-  kMenuPopupEnd,              // Native
-  kMenuPopupHide,             // Native / AuraLinux
-  kMenuPopupStart,            // Native
-  kMenuStart,                 // Native / Win
+  kImageFrameUpdated,     // Web
+  kInvalidStatusChanged,  // Implicit
+  kLayoutComplete,        // Web
+  kLiveRegionCreated,     // Implicit
+  kLiveRegionChanged,     // Web
+  kLoadComplete,          // Web
+  kLoadStart,             // Web / AuraLinux
+  kLocationChanged,       // Web
+  kMediaStartedPlaying,   // Native / Automation
+  kMediaStoppedPlaying,   // Native / Automation
+  kMenuEnd,               // Native / Win
+  kMenuListItemSelected,  // Web
+  kMenuListValueChanged,  // Web
+  kMenuPopupEnd,          // Native
+  kMenuPopupHide,         // Native / AuraLinux
+  kMenuPopupStart,        // Native
+  kMenuStart,             // Native / Win
   kMouseCanceled,
   kMouseDragged,
   kMouseMoved,
   kMousePressed,
   kMouseReleased,
-  kRowCollapsed,              // Web / Mac
-  kRowCountChanged,           // Web / Mac
-  kRowExpanded,               // Web / Mac
-  kScrollPositionChanged,     // Web
-  kScrolledToAnchor,          // Web
-  kSelectedChildrenChanged,   // Web
-  kSelection,                 // Native
-  kSelectionAdd,              // Native
-  kSelectionRemove,           // Native
-  kShow,                      // Remove: http://crbug.com/392502
-  kStateChanged,              // Native / Automation
+  kRowCollapsed,             // Web / Mac
+  kRowCountChanged,          // Web / Mac
+  kRowExpanded,              // Web / Mac
+  kScrollPositionChanged,    // Web
+  kScrolledToAnchor,         // Web
+  kSelectedChildrenChanged,  // Web
+  kSelection,                // Native
+  kSelectionAdd,             // Native
+  kSelectionRemove,          // Native
+  kShow,                     // Remove: http://crbug.com/392502
+  kStateChanged,             // Native / Automation
   kTextChanged,
-  kWindowActivated,           // Native
-  kWindowDeactivated,         // Native
+  kWindowActivated,    // Native
+  kWindowDeactivated,  // Native
   kTextSelectionChanged,
-  kTreeChanged,               // Accessibility tree changed. Don't
-                              // explicitly fire an accessibility event,
-                              // only implicitly due to the change.
+  kTreeChanged,  // Accessibility tree changed. Don't
+                 // explicitly fire an accessibility event,
+                 // only implicitly due to the change.
   kValueChanged,
 };
 
@@ -95,10 +95,10 @@
 // internal roles used by the accessibility infrastructure.
 //
 // Explanation of in-lined comments next to some enum values.
- //
- // Web: this attribute is only used in web content.
- //
- // Native: this attribute is only used in native UI.
+//
+// Web: this attribute is only used in web content.
+//
+// Native: this attribute is only used in native UI.
 enum Role {
   kNone,
   kAbbr,
@@ -299,7 +299,7 @@
   kEditable,
   kExpanded,
   kFocusable,
-   // Grows horizontally, e.g. most toolbars and separators.
+  // Grows horizontally, e.g. most toolbars and separators.
   kHorizontal,
   kHovered,
   // Skip over this node in the accessibility tree, but keep its subtree.
@@ -311,14 +311,14 @@
   kProtected,
   kRequired,
   kRichlyEditable,
-   // Grows vertically, e.g. menu or combo box.
+  // Grows vertically, e.g. menu or combo box.
   kVertical,
   kVisited,
 };
 
- // An action to be taken on an accessibility node.
- // In contrast to |AXDefaultActionVerb|, these describe what happens to the
- // object, e.g. "FOCUS".
+// An action to be taken on an accessibility node.
+// In contrast to |AXDefaultActionVerb|, these describe what happens to the
+// object, e.g. "FOCUS".
 enum Action {
   kNone,
 
@@ -334,15 +334,15 @@
 
   kCustomAction,
 
-   // Decrement a slider or range control by one step value.
+  // Decrement a slider or range control by one step value.
   kDecrement,
 
-   // Do the default action for an object, typically this means "click".
+  // Do the default action for an object, typically this means "click".
   kDoDefault,
 
   kFocus,
 
-   // Return the content of this image object in the image_data attribute.
+  // Return the content of this image object in the image_data attribute.
   kGetImageData,
 
   // Gets the bounding rect for a range of text.
@@ -350,24 +350,28 @@
 
   kHideTooltip,
 
-   // Given a point, find the object it corresponds to and fire a
-   // |AXActionData.hit_test_event_to_fire| event on it in response.
+  // Given a point, find the object it corresponds to and fire a
+  // |AXActionData.hit_test_event_to_fire| event on it in response.
   kHitTest,
 
-   // Increment a slider or range control by one step value.
+  // Increment a slider or range control by one step value.
   kIncrement,
 
-   // Load inline text boxes for this subtree, providing information
-   // about word boundaries, line layout, and individual character
-   // bounding boxes.
+  // For internal use only; signals to tree sources to invalidate an entire
+  // tree.
+  kInternalInvalidateTree,
+
+  // Load inline text boxes for this subtree, providing information
+  // about word boundaries, line layout, and individual character
+  // bounding boxes.
   kLoadInlineTextBoxes,
 
-   // Delete any selected text in the control's text value and
-   // insert |AXActionData::value| in its place, like when typing or pasting.
+  // Delete any selected text in the control's text value and
+  // insert |AXActionData::value| in its place, like when typing or pasting.
   kReplaceSelectedText,
 
-   // Scrolls by approximately one screen in a specific direction. Should be
-   // called on a node that has scrollable boolean set to true.
+  // Scrolls by approximately one screen in a specific direction. Should be
+  // called on a node that has scrollable boolean set to true.
   kScrollBackward,
   kScrollDown,
   kScrollForward,
@@ -375,13 +379,13 @@
   kScrollRight,
   kScrollUp,
 
-   // Scroll any scrollable containers to make the target object visible
-   // on the screen.  Optionally pass a subfocus rect in
-   // AXActionData.target_rect, in node-local coordinates.
+  // Scroll any scrollable containers to make the target object visible
+  // on the screen.  Optionally pass a subfocus rect in
+  // AXActionData.target_rect, in node-local coordinates.
   kScrollToMakeVisible,
 
-   // Scroll the given object to a specified point on the screen in
-   // global screen coordinates. Pass a point in AXActionData.target_point.
+  // Scroll the given object to a specified point on the screen in
+  // global screen coordinates. Pass a point in AXActionData.target_point.
   kScrollToPoint,
 
   // Notifies a node that it has accessibility focus.
@@ -392,17 +396,17 @@
   kSetScrollOffset,
   kSetSelection,
 
-   // Don't focus this node, but set it as the sequential focus navigation
-   // starting point, so that pressing Tab moves to the next element
-   // following this one, for example.
+  // Don't focus this node, but set it as the sequential focus navigation
+  // starting point, so that pressing Tab moves to the next element
+  // following this one, for example.
   kSetSequentialFocusNavigationStartingPoint,
 
-   // Replace the value of the control with AXActionData::value and
-   // reset the selection, if applicable.
+  // Replace the value of the control with AXActionData::value and
+  // reset the selection, if applicable.
   kSetValue,
   kShowContextMenu,
 
-   // Send an event signaling the end of a test.
+  // Send an event signaling the end of a test.
   kSignalEndOfTest,
   kShowTooltip,
 };
@@ -413,22 +417,22 @@
   kRequestInlineTextBoxes,
 };
 
- // A list of valid values for the |AXIntAttribute| |default_action_verb|.
- // These will describe the action that will be performed on a given node when
- // executing the default action, which is a click.
- // In contrast to |AXAction|, these describe what the user can do on the
- // object, e.g. "PRESS", not what happens to the object as a result.
- // Only one verb can be used at a time to describe the default action.
+// A list of valid values for the |AXIntAttribute| |default_action_verb|.
+// These will describe the action that will be performed on a given node when
+// executing the default action, which is a click.
+// In contrast to |AXAction|, these describe what the user can do on the
+// object, e.g. "PRESS", not what happens to the object as a result.
+// Only one verb can be used at a time to describe the default action.
 enum DefaultActionVerb {
   kNone,
   kActivate,
   kCheck,
   kClick,
 
-   // A click will be performed on one of the node's ancestors.
-   // This happens when the node itself is not clickable, but one of its
-   // ancestors has click handlers attached which are able to capture the click
-   // as it bubbles up.
+  // A click will be performed on one of the node's ancestors.
+  // This happens when the node itself is not clickable, but one of its
+  // ancestors has click handlers attached which are able to capture the click
+  // as it bubbles up.
   kClickAncestor,
 
   kJump,
@@ -438,7 +442,7 @@
   kUncheck,
 };
 
- // A change to the accessibility tree.
+// A change to the accessibility tree.
 enum Mutation {
   kNone,
   kNodeCreated,
@@ -450,16 +454,16 @@
 enum StringAttribute {
   kNone,
   kAccessKey,
-   // Only used when invalid_state == invalid_state_other.
+  // Only used when invalid_state == invalid_state_other.
   kAriaInvalidValue,
   kAutoComplete,
   kChildTreeId,
-  kClassName,       // Native / Android
+  kClassName,  // Native / Android
   kContainerLiveRelevant,
   kContainerLiveStatus,
   kDescription,
   kDisplay,
-   // Only present when different from parent.
+  // Only present when different from parent.
   kFontFamily,
   kHtmlTag,
   // Stores an automatic image annotation if one is available. Only valid on
@@ -468,7 +472,7 @@
   kImageDataUrl,
   kInnerHtml,
   kKeyShortcuts,
-   // Only present when different from parent.
+  // Only present when different from parent.
   kLanguage,
   kName,
   kLiveRelevant,
@@ -486,7 +490,7 @@
 enum IntAttribute {
   kNone,
   kDefaultActionVerb,
-   // Scrollable container attributes.
+  // Scrollable container attributes.
   kScrollX,
   kScrollXMin,
   kScrollXMax,
@@ -494,48 +498,48 @@
   kScrollYMin,
   kScrollYMax,
 
-   // Attributes for retrieving the endpoints of a selection.
+  // Attributes for retrieving the endpoints of a selection.
   kTextSelStart,
   kTextSelEnd,
 
-   // aria_col* and aria_row* attributes
+  // aria_col* and aria_row* attributes
   kAriaColumnCount,
   kAriaCellColumnIndex,
   kAriaRowCount,
   kAriaCellRowIndex,
 
-   // Table attributes.
+  // Table attributes.
   kTableRowCount,
   kTableColumnCount,
   kTableHeaderId,
 
-   // Table row attributes.
+  // Table row attributes.
   kTableRowIndex,
   kTableRowHeaderId,
 
-   // Table column attributes.
+  // Table column attributes.
   kTableColumnIndex,
   kTableColumnHeaderId,
 
-   // Table cell attributes.
+  // Table cell attributes.
   kTableCellColumnIndex,
   kTableCellColumnSpan,
   kTableCellRowIndex,
   kTableCellRowSpan,
   kSortDirection,
 
-   // Tree control attributes.
+  // Tree control attributes.
   kHierarchicalLevel,
 
-   // What information was used to compute the object's name
-   // (of type AXNameFrom).
+  // What information was used to compute the object's name
+  // (of type AXNameFrom).
   kNameFrom,
 
-   // What information was used to compute the object's description
-   // (of type AXDescriptionFrom).
+  // What information was used to compute the object's description
+  // (of type AXDescriptionFrom).
   kDescriptionFrom,
 
-   // Relationships between this element and other elements.
+  // Relationships between this element and other elements.
   kActivedescendantId,
   kDetailsId,
   kErrormessageId,
@@ -545,25 +549,25 @@
   kPopupForId,
   kPreviousOnLineId,
 
-   // Input restriction, if any, such as readonly or disabled.
-   // Of type AXRestriction, see below.
-   // No value or enabled control or other object that is not disabled.
+  // Input restriction, if any, such as readonly or disabled.
+  // Of type AXRestriction, see below.
+  // No value or enabled control or other object that is not disabled.
   kRestriction,
 
-   // Position or Number of items in current set of listitems or treeitems
+  // Position or Number of items in current set of listitems or treeitems
   kSetSize,
   kPosInSet,
 
-   // In the case of Role::kColorWell, specifies the selected color.
+  // In the case of Role::kColorWell, specifies the selected color.
   kColorValue,
 
-   // Indicates the element that represents the current item within a container
-   // or set of related elements.
+  // Indicates the element that represents the current item within a container
+  // or set of related elements.
   kAriaCurrentState,
 
-   // Text attributes.
+  // Text attributes.
 
-   // Foreground and background color in RGBA.
+  // Foreground and background color in RGBA.
   kBackgroundColor,
   kColor,
 
@@ -572,23 +576,23 @@
   // Image annotation status, of type ImageAnnotationStatus.
   kImageAnnotationStatus,
 
-   // Indicates if a form control has invalid input or
-   // if an element has an aria-invalid attribute.
+  // Indicates if a form control has invalid input or
+  // if an element has an aria-invalid attribute.
   kInvalidState,
 
-   // Of type AXCheckedState
+  // Of type AXCheckedState
   kCheckedState,
 
   // The list style type. Only available on list items.
   kListStyle,
 
-   // Specifies the direction of the text, e.g., right-to-left.
+  // Specifies the direction of the text, e.g., right-to-left.
   kTextDirection,
 
-   // Specifies the position of the text, e.g., subscript.
+  // Specifies the position of the text, e.g., subscript.
   kTextPosition,
 
-   // Bold, italic, underline, etc.
+  // Bold, italic, underline, etc.
   kTextStyle,
 
   // The overline text decoration style.
@@ -600,26 +604,26 @@
   // The underline text decoration style.
   kTextUnderlineStyle,
 
-   // Focus traversal in views and Android.
+  // Focus traversal in views and Android.
   kPreviousFocusId,
   kNextFocusId,
 };
 
 enum FloatAttribute {
   kNone,
-   // Range attributes.
+  // Range attributes.
   kValueForRange,
   kMinValueForRange,
   kMaxValueForRange,
   kStepValueForRange,
 
-   // Text attributes.
-   // Font size is in pixels.
+  // Text attributes.
+  // Font size is in pixels.
   kFontSize,
 
-   // Font weight can take on any arbitrary numeric value. Increments of 100 in
-   // range [0, 900] represent keywords such as light, normal, bold, etc. 0 is
-   // the default.
+  // Font weight can take on any arbitrary numeric value. Increments of 100 in
+  // range [0, 900] represent keywords such as light, normal, bold, etc. 0 is
+  // the default.
   kFontWeight,
 };
 
@@ -633,35 +637,35 @@
 // given attribute, while another tree source only uses two.
 enum BoolAttribute {
   kNone,
-   // Generic busy state, does not have to be on a live region.
+  // Generic busy state, does not have to be on a live region.
   kBusy,
-   // The object is at the root of an editable field, such as a content
-   // editable.
+  // The object is at the root of an editable field, such as a content
+  // editable.
   kEditableRoot,
 
-   // Live region attributes.
+  // Live region attributes.
   kContainerLiveAtomic,
   kContainerLiveBusy,
   kLiveAtomic,
 
-   // If a dialog box is marked as explicitly modal
+  // If a dialog box is marked as explicitly modal
   kModal,
 
-   // If this is set, all of the other fields in this struct should
-   // be ignored and only the locations should change.
+  // If this is set, all of the other fields in this struct should
+  // be ignored and only the locations should change.
   kUpdateLocationOnly,
 
-   // Set on a canvas element if it has fallback content.
+  // Set on a canvas element if it has fallback content.
   kCanvasHasFallback,
 
-   // Indicates this node is scrollable (Android only).
+  // Indicates this node is scrollable (Android only).
   kScrollable,
 
-   // A hint to clients that the node is clickable.
+  // A hint to clients that the node is clickable.
   kClickable,
 
-   // Indicates that this node clips its children, i.e. may have
-   // overflow: hidden or clip children by default.
+  // Indicates that this node clips its children, i.e. may have
+  // overflow: hidden or clip children by default.
   kClipsChildren,
 
   // Indicates whether this node is selected or unselected.
@@ -673,64 +677,64 @@
 
 enum IntListAttribute {
   kNone,
-   // Ids of nodes that are children of this node logically, but are
-   // not children of this node in the tree structure. As an example,
-   // a table cell is a child of a row, and an 'indirect' child of a
-   // column.
+  // Ids of nodes that are children of this node logically, but are
+  // not children of this node in the tree structure. As an example,
+  // a table cell is a child of a row, and an 'indirect' child of a
+  // column.
   kIndirectChildIds,
 
-   // Relationships between this element and other elements.
+  // Relationships between this element and other elements.
   kControlsIds,
   kDescribedbyIds,
   kFlowtoIds,
   kLabelledbyIds,
   kRadioGroupIds,
 
-   // For static text. These int lists must be the same size; they represent
-   // the start and end character offset of each marker. Examples of markers
-   // include spelling and grammar errors, and find-in-page matches.
+  // For static text. These int lists must be the same size; they represent
+  // the start and end character offset of each marker. Examples of markers
+  // include spelling and grammar errors, and find-in-page matches.
   kMarkerTypes,
   kMarkerStarts,
   kMarkerEnds,
 
-   // For inline text. This is the pixel position of the end of this
-   // character within the bounding rectangle of this object, in the
-   // direction given by StringAttribute::kTextDirection. For example,
-   // for left-to-right text, the first offset is the right coordinate of
-   // the first character within the object's bounds, the second offset
-   // is the right coordinate of the second character, and so on.
+  // For inline text. This is the pixel position of the end of this
+  // character within the bounding rectangle of this object, in the
+  // direction given by StringAttribute::kTextDirection. For example,
+  // for left-to-right text, the first offset is the right coordinate of
+  // the first character within the object's bounds, the second offset
+  // is the right coordinate of the second character, and so on.
   kCharacterOffsets,
 
-   // Used for caching. Do not read directly. Use
-   // |AXNode::GetOrComputeLineStartOffsets|
-   // For all text fields and content editable roots: A list of the start
-   // offsets of each line inside this object.
+  // Used for caching. Do not read directly. Use
+  // |AXNode::GetOrComputeLineStartOffsets|
+  // For all text fields and content editable roots: A list of the start
+  // offsets of each line inside this object.
   kCachedLineStarts,
 
-   // For inline text. These int lists must be the same size; they represent
-   // the start and end character offset of each word within this text.
+  // For inline text. These int lists must be the same size; they represent
+  // the start and end character offset of each word within this text.
   kWordStarts,
   kWordEnds,
 
-   // Used for an UI element to define custom actions for it. For example, a
-   // list UI will allow a user to reorder items in the list by dragging the
-   // items. Developer can expose those actions as custom actions. Currently
-   // custom actions are used only in Android window.
+  // Used for an UI element to define custom actions for it. For example, a
+  // list UI will allow a user to reorder items in the list by dragging the
+  // items. Developer can expose those actions as custom actions. Currently
+  // custom actions are used only in Android window.
   kCustomActionIds,
 };
 
 enum StringListAttribute {
   kNone,
-   // Descriptions for custom actions. This must be aligned with
-   // custom_action_ids.
+  // Descriptions for custom actions. This must be aligned with
+  // custom_action_ids.
   kCustomActionDescriptions,
 };
 
- // TODO(dmazzoni, nektar): make this list not grow exponentially as new
- // MarkerTypes are added
+// TODO(dmazzoni, nektar): make this list not grow exponentially as new
+// MarkerTypes are added
 enum MarkerType {
   kNone,
-   // Assignments are ignored by the parser, but are kept here for clarity.
+  // Assignments are ignored by the parser, but are kept here for clarity.
   kSpelling = 1,
   kGrammar = 2,
   kSpellingGrammar = 3,
@@ -738,8 +742,8 @@
   kSpellingTextMatch = 5,
   kGrammarTextMatch = 6,
   kSpellingGrammarTextMatch = 7,
-   // DocumentMarker::MarkerType::Composition = 8 is ignored for accessibility
-   // purposes
+  // DocumentMarker::MarkerType::Composition = 8 is ignored for accessibility
+  // purposes
   kActiveSuggestion = 16,
   kSpellingActiveSuggestion = 17,
   kGrammarActiveSuggestion = 18,
@@ -756,7 +760,7 @@
   kSpellingTextMatchSuggestion = 37,
   kGrammarTextMatchSuggestion = 38,
   kSpellingGrammarTextMatchSuggestion = 39,
-   // We again skip over DocumentMarker::MarkerType::Composition = 8 here
+  // We again skip over DocumentMarker::MarkerType::Composition = 8 here
   kActiveSuggestionSuggestion = 48,
   kSpellingActiveSuggestionSuggestion = 49,
   kGrammarActiveSuggestionSuggestion = 50,
@@ -791,8 +795,8 @@
   kSuperscript,
 };
 
- // A Java counterpart will be generated for this enum.
- // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.ui.accessibility
+// A Java counterpart will be generated for this enum.
+// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.ui.accessibility
 enum TextStyle {
   kBold,
   kItalic,
@@ -843,10 +847,10 @@
   kOther,
 };
 
- // Input restriction associated with an object.
- // No value for a control means it is enabled.
- // Use read_only for a textbox that allows focus/selection but not input.
- // Use disabled for a control or group of controls that disallows input.
+// Input restriction associated with an object.
+// No value for a control means it is enabled.
+// Use read_only for a textbox that allows focus/selection but not input.
+// Use disabled for a control or group of controls that disallows input.
 enum Restriction {
   kNone,
   kReadOnly,
@@ -896,7 +900,7 @@
   kAction,
 };
 
- // Touch gestures on Chrome OS.
+// Touch gestures on Chrome OS.
 enum Gesture {
   kNone,
   kClick,
@@ -927,19 +931,19 @@
   kUpstream,
 };
 
- // Compares two nodes in an accessibility tree in pre-order traversal.
+// Compares two nodes in an accessibility tree in pre-order traversal.
 enum TreeOrder {
   kNone,
-   // Not in the same tree, or other error.
+  // Not in the same tree, or other error.
   kUndefined,
 
-   // First node is before the second one.
+  // First node is before the second one.
   kBefore,
 
-   // Nodes are the same.
+  // Nodes are the same.
   kEqual,
 
-   // First node is after the second one.
+  // First node is after the second one.
   kAfter,
 };
 
@@ -950,32 +954,32 @@
 };
 
 enum ImageAnnotationStatus {
-   // Not an image, or image annotation feature not enabled.
+  // Not an image, or image annotation feature not enabled.
   kNone,
 
-   // Not loaded yet, already labeled by the author, or not eligible
-   // due to size, type, etc.
+  // Not loaded yet, already labeled by the author, or not eligible
+  // due to size, type, etc.
   kIneligibleForAnnotation,
 
-   // Eligible to be automatically annotated if the user requests it.
+  // Eligible to be automatically annotated if the user requests it.
   kEligibleForAnnotation,
 
-   // An annotation has been requested but has not been received yet.
+  // An annotation has been requested but has not been received yet.
   kAnnotationPending,
 
-   // An annotation has been provided and kImageAnnotation contains the
-   // annotation text.
+  // An annotation has been provided and kImageAnnotation contains the
+  // annotation text.
   kAnnotationSucceeded,
 
-   // The annotation request was processed successfully, but it was not
-   // possible to come up with an annotation for this image.
+  // The annotation request was processed successfully, but it was not
+  // possible to come up with an annotation for this image.
   kAnnotationEmpty,
 
-   // The image is classified as adult content and no annotation will
-   // be generated.
+  // The image is classified as adult content and no annotation will
+  // be generated.
   kAnnotationAdult,
 
-   // The annotation process failed, e.g. unable to contact the server,
-   // request timed out, etc.
+  // The annotation process failed, e.g. unable to contact the server,
+  // request timed out, etc.
   kAnnotationProcessFailed,
 };
diff --git a/ui/accessibility/ax_node_data.cc b/ui/accessibility/ax_node_data.cc
index 6c9e513..05395c0 100644
--- a/ui/accessibility/ax_node_data.cc
+++ b/ui/accessibility/ax_node_data.cc
@@ -638,6 +638,7 @@
     case ax::mojom::Action::kGetImageData:
     case ax::mojom::Action::kHitTest:
     case ax::mojom::Action::kIncrement:
+    case ax::mojom::Action::kInternalInvalidateTree:
     case ax::mojom::Action::kLoadInlineTextBoxes:
     case ax::mojom::Action::kReplaceSelectedText:
     case ax::mojom::Action::kScrollToMakeVisible: