diff --git a/accessible/android/AccessibleWrap.cpp b/accessible/android/AccessibleWrap.cpp index ccb7761333b2..2ba81f3327b6 100644 --- a/accessible/android/AccessibleWrap.cpp +++ b/accessible/android/AccessibleWrap.cpp @@ -373,7 +373,7 @@ AccessibleWrap::WrapperRangeInfo(double* aCurVal, double* aMinVal, } mozilla::java::GeckoBundle::LocalRef -AccessibleWrap::ToBundle() +AccessibleWrap::ToBundle(bool aMinimal) { if (!IsProxy() && IsDefunct()) { return nullptr; @@ -390,16 +390,6 @@ AccessibleWrap::ToBundle() uint64_t state = State(); uint64_t flags = GetFlags(role, state); GECKOBUNDLE_PUT(nodeInfo, "flags", java::sdk::Integer::ValueOf(flags)); - - nsAutoString geckoRole; - nsAutoString roleDescription; - if (VirtualViewID() != kNoID) { - GetRoleDescription(role, geckoRole, roleDescription); - } - - GECKOBUNDLE_PUT( - nodeInfo, "roleDescription", jni::StringParam(roleDescription)); - GECKOBUNDLE_PUT(nodeInfo, "geckoRole", jni::StringParam(geckoRole)); GECKOBUNDLE_PUT(nodeInfo, "className", java::sdk::Integer::ValueOf(AndroidClass())); nsAutoString text; @@ -416,6 +406,25 @@ AccessibleWrap::ToBundle() } GECKOBUNDLE_PUT(nodeInfo, "text", jni::StringParam(text)); + if (aMinimal) { + GECKOBUNDLE_FINISH(nodeInfo); + return nodeInfo; + } + + nsAutoString geckoRole; + nsAutoString roleDescription; + if (VirtualViewID() != kNoID) { + GetRoleDescription(role, geckoRole, roleDescription); + } + + GECKOBUNDLE_PUT( + nodeInfo, "roleDescription", jni::StringParam(roleDescription)); + GECKOBUNDLE_PUT(nodeInfo, "geckoRole", jni::StringParam(geckoRole)); + + GECKOBUNDLE_PUT( + nodeInfo, "roleDescription", jni::StringParam(roleDescription)); + GECKOBUNDLE_PUT(nodeInfo, "geckoRole", jni::StringParam(geckoRole)); + nsAutoString viewIdResourceName; WrapperDOMNodeID(viewIdResourceName); if (!viewIdResourceName.IsEmpty()) { diff --git a/accessible/android/AccessibleWrap.h b/accessible/android/AccessibleWrap.h index d0a04931c4e5..372f7dd92669 100644 --- a/accessible/android/AccessibleWrap.h +++ b/accessible/android/AccessibleWrap.h @@ -31,7 +31,7 @@ public: virtual bool GetSelectionBounds(int32_t* aStartOffset, int32_t* aEndOffset); - mozilla::java::GeckoBundle::LocalRef ToBundle(); + mozilla::java::GeckoBundle::LocalRef ToBundle(bool aMinimal = false); int32_t AndroidClass() { diff --git a/accessible/android/SessionAccessibility.cpp b/accessible/android/SessionAccessibility.cpp index 4e84dd6ecae9..c2fb656618e5 100644 --- a/accessible/android/SessionAccessibility.cpp +++ b/accessible/android/SessionAccessibility.cpp @@ -151,7 +151,7 @@ SessionAccessibility::SendAccessibilityFocusedEvent(AccessibleWrap* aAccessible) { mSessionAccessibility->SendEvent( java::sdk::AccessibilityEvent::TYPE_VIEW_ACCESSIBILITY_FOCUSED, - aAccessible->VirtualViewID(), nullptr, aAccessible->ToBundle()); + aAccessible->VirtualViewID(), nullptr, aAccessible->ToBundle(true)); aAccessible->ScrollTo(nsIAccessibleScrollType::SCROLL_TYPE_ANYWHERE); } @@ -160,7 +160,7 @@ SessionAccessibility::SendHoverEnterEvent(AccessibleWrap* aAccessible) { mSessionAccessibility->SendEvent( java::sdk::AccessibilityEvent::TYPE_VIEW_HOVER_ENTER, - aAccessible->VirtualViewID(), nullptr, aAccessible->ToBundle()); + aAccessible->VirtualViewID(), nullptr, aAccessible->ToBundle(true)); } void @@ -174,7 +174,7 @@ SessionAccessibility::SendFocusEvent(AccessibleWrap* aAccessible) mSessionAccessibility->SendEvent( java::sdk::AccessibilityEvent::TYPE_VIEW_FOCUSED, - aAccessible->VirtualViewID(), nullptr, aAccessible->ToBundle()); + aAccessible->VirtualViewID(), nullptr, aAccessible->ToBundle(true)); } void @@ -199,8 +199,8 @@ SessionAccessibility::SendScrollingEvent(AccessibleWrap* aAccessible, GECKOBUNDLE_FINISH(eventInfo); mSessionAccessibility->SendEvent( - java::sdk::AccessibilityEvent::TYPE_VIEW_SCROLLED, virtualViewId, - eventInfo, aAccessible->ToBundle()); + java::sdk::AccessibilityEvent::TYPE_VIEW_SCROLLED, virtualViewId, eventInfo, + aAccessible->ToBundle(true)); SendWindowContentChangedEvent(aAccessible); } @@ -210,7 +210,7 @@ SessionAccessibility::SendWindowContentChangedEvent(AccessibleWrap* aAccessible) { mSessionAccessibility->SendEvent( java::sdk::AccessibilityEvent::TYPE_WINDOW_CONTENT_CHANGED, - aAccessible->VirtualViewID(), nullptr, aAccessible->ToBundle()); + aAccessible->VirtualViewID(), nullptr, aAccessible->ToBundle(true)); } void @@ -224,7 +224,7 @@ SessionAccessibility::SendWindowStateChangedEvent(AccessibleWrap* aAccessible) mSessionAccessibility->SendEvent( java::sdk::AccessibilityEvent::TYPE_WINDOW_STATE_CHANGED, - aAccessible->VirtualViewID(), nullptr, aAccessible->ToBundle()); + aAccessible->VirtualViewID(), nullptr, aAccessible->ToBundle(true)); } void @@ -245,7 +245,7 @@ SessionAccessibility::SendTextSelectionChangedEvent(AccessibleWrap* aAccessible, mSessionAccessibility->SendEvent( java::sdk::AccessibilityEvent::TYPE_VIEW_TEXT_SELECTION_CHANGED, - aAccessible->VirtualViewID(), eventInfo, aAccessible->ToBundle()); + aAccessible->VirtualViewID(), eventInfo, aAccessible->ToBundle(true)); } void @@ -279,7 +279,7 @@ SessionAccessibility::SendTextChangedEvent(AccessibleWrap* aAccessible, mSessionAccessibility->SendEvent( java::sdk::AccessibilityEvent::TYPE_VIEW_TEXT_CHANGED, - aAccessible->VirtualViewID(), eventInfo, aAccessible->ToBundle()); + aAccessible->VirtualViewID(), eventInfo, aAccessible->ToBundle(true)); } void @@ -299,7 +299,7 @@ SessionAccessibility::SendTextTraversedEvent(AccessibleWrap* aAccessible, mSessionAccessibility->SendEvent( java::sdk::AccessibilityEvent:: TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY, - aAccessible->VirtualViewID(), eventInfo, aAccessible->ToBundle()); + aAccessible->VirtualViewID(), eventInfo, aAccessible->ToBundle(true)); } void @@ -307,7 +307,7 @@ SessionAccessibility::SendClickedEvent(AccessibleWrap* aAccessible) { mSessionAccessibility->SendEvent( java::sdk::AccessibilityEvent::TYPE_VIEW_CLICKED, - aAccessible->VirtualViewID(), nullptr, aAccessible->ToBundle()); + aAccessible->VirtualViewID(), nullptr, aAccessible->ToBundle(true)); } void @@ -315,5 +315,5 @@ SessionAccessibility::SendSelectedEvent(AccessibleWrap* aAccessible) { mSessionAccessibility->SendEvent( java::sdk::AccessibilityEvent::TYPE_VIEW_SELECTED, - aAccessible->VirtualViewID(), nullptr, aAccessible->ToBundle()); + aAccessible->VirtualViewID(), nullptr, aAccessible->ToBundle(true)); }