Commit 70cf770e authored by Eitan Isaacson's avatar Eitan Isaacson
Browse files

Bug 1744315 - P2: Don't traverse into remote accessibles in explore by touch. r=Jamie

Our default traversal rule will eventually work with remote trees, but
explore by touch will be local-only until we do hittesting in the parent
process. This change prevents the parent process from drilling down past
outer docs into frames.

Differential Revision: https://phabricator.services.mozilla.com/D132841
parent bcc337c8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -313,7 +313,7 @@ void AccessibleWrap::PivotTo(int32_t aGranularity, bool aForward,

void AccessibleWrap::ExploreByTouch(float aX, float aY) {
  a11y::Pivot pivot(RootAccessible());
  TraversalRule rule;
  ExploreByTouchRule rule;

  Accessible* maybeResult = pivot.AtPoint(aX, aY, rule);
  LocalAccessible* result = maybeResult ? maybeResult->AsLocal() : nullptr;
+12 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ uint16_t TraversalRule::Match(Accessible* aAcc) {
  MOZ_ASSERT(
      aAcc && aAcc->IsLocal(),
      "Should only receive local accessibles when processing on android.");

  LocalAccessible* aAccessible = aAcc->AsLocal();
  uint16_t result = nsIAccessibleTraversalRule::FILTER_IGNORE;

@@ -291,3 +292,14 @@ uint16_t TraversalRule::DefaultMatch(LocalAccessible* aAccessible) {

  return nsIAccessibleTraversalRule::FILTER_IGNORE;
}

uint16_t ExploreByTouchRule::Match(Accessible* aAcc) {
  if (aAcc->IsRemote()) {
    // Explore by touch happens in the local process and should
    // not drill down into remote frames.
    return nsIAccessibleTraversalRule::FILTER_IGNORE |
           nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE;
  }

  return TraversalRule::Match(aAcc);
}
+5 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ class LocalAccessible;
/**
 * Class represents a simple traversal rule.
 */
class TraversalRule final : public PivotRule {
class TraversalRule : public PivotRule {
 public:
  TraversalRule();
  explicit TraversalRule(int32_t aGranularity);
@@ -50,6 +50,10 @@ class TraversalRule final : public PivotRule {
  int32_t mGranularity;
};

class ExploreByTouchRule final : public TraversalRule {
  virtual uint16_t Match(Accessible* aAcc) override;
};

}  // namespace a11y
}  // namespace mozilla