Commit 02199b40 authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

Remove location a11y notifications for transform animations

These were added so chromevox properly updates the highlight
location when transform animations complete. Previously, the view
location was updated only when view bounds changed. This has since
been addressed in the views code, so app list specific workarounds are
no longer needed.

TEST=Enable chromevox, show the partial launcher with the highlight on
the search box. Expand the app list to fullscreen. Verify that the
highlight stays with the search box.

Change-Id: Iee6be1a1ec2173282a39e2af31e2df1204ab081b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2472877Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Commit-Queue: Alex Newcomer <newcomer@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817154}
parent 9dda2627
...@@ -428,8 +428,6 @@ class ContentsContainerAnimation : public AppListFolderView::Animation, ...@@ -428,8 +428,6 @@ class ContentsContainerAnimation : public AppListFolderView::Animation,
// preferred bounds is calculated correctly. // preferred bounds is calculated correctly.
folder_view_->contents_container()->layer()->SetTransform(gfx::Transform()); folder_view_->contents_container()->layer()->SetTransform(gfx::Transform());
folder_view_->RecordAnimationSmoothness(); folder_view_->RecordAnimationSmoothness();
folder_view_->NotifyAccessibilityLocationChanges();
} }
private: private:
...@@ -693,17 +691,6 @@ void AppListFolderView::OnTabletModeChanged(bool started) { ...@@ -693,17 +691,6 @@ void AppListFolderView::OnTabletModeChanged(bool started) {
page_switcher_->set_is_tablet_mode(started); page_switcher_->set_is_tablet_mode(started);
} }
void AppListFolderView::NotifyAccessibilityLocationChanges() {
contents_container_->NotifyAccessibilityEvent(
ax::mojom::Event::kLocationChanged, true);
items_grid_view_->NotifyAccessibilityEvent(ax::mojom::Event::kLocationChanged,
true);
folder_header_view_->NotifyAccessibilityEvent(
ax::mojom::Event::kLocationChanged, true);
page_switcher_->NotifyAccessibilityEvent(ax::mojom::Event::kLocationChanged,
true);
}
void AppListFolderView::CalculateIdealBounds() { void AppListFolderView::CalculateIdealBounds() {
gfx::Rect rect(GetContentsBounds()); gfx::Rect rect(GetContentsBounds());
if (rect.IsEmpty()) if (rect.IsEmpty())
......
...@@ -116,10 +116,6 @@ class APP_LIST_EXPORT AppListFolderView : public views::View, ...@@ -116,10 +116,6 @@ class APP_LIST_EXPORT AppListFolderView : public views::View,
// Called when tablet mode starts and ends. // Called when tablet mode starts and ends.
void OnTabletModeChanged(bool started); void OnTabletModeChanged(bool started);
// When transform in |contents_view_| is updated, notify accessibility to show
// ChromeVox focus in correct locations.
void NotifyAccessibilityLocationChanges();
private: private:
void CalculateIdealBounds(); void CalculateIdealBounds();
......
...@@ -62,7 +62,7 @@ void AppListPage::AnimateOpacity(float current_progress, ...@@ -62,7 +62,7 @@ void AppListPage::AnimateOpacity(float current_progress,
void AppListPage::AnimateYPosition(AppListViewState target_view_state, void AppListPage::AnimateYPosition(AppListViewState target_view_state,
const TransformAnimator& animator, const TransformAnimator& animator,
float default_offset) { float default_offset) {
animator.Run(default_offset, layer(), this); animator.Run(default_offset, layer());
} }
gfx::Rect AppListPage::GetAboveContentsOffscreenBounds( gfx::Rect AppListPage::GetAboveContentsOffscreenBounds(
......
...@@ -123,14 +123,11 @@ class APP_LIST_EXPORT AppListPage : public views::View { ...@@ -123,14 +123,11 @@ class APP_LIST_EXPORT AppListPage : public views::View {
// Called when the app list view state changes to |target_view_state| to // Called when the app list view state changes to |target_view_state| to
// animate the app list page vertical offset from the app list view top. // animate the app list page vertical offset from the app list view top.
// |animator| - The callback that runs the transform animation to update the // |animator| - The callback that runs the transform animation to update the
// page's vertical position. (The layer is required argument, while view is // page's vertical position.
// optional, and should be used with layers associated with views - the
// animator will send out a11y position change notification for the view when
// the animation finishes).
// |default_offset| - the default transform offset that can be passed to // |default_offset| - the default transform offset that can be passed to
// |animator| to follow the search box position animation. // |animator| to follow the search box position animation.
using TransformAnimator = base::RepeatingCallback< using TransformAnimator =
void(float offset, ui::Layer* layer, views::View* view)>; base::RepeatingCallback<void(float offset, ui::Layer* layer)>;
virtual void AnimateYPosition(AppListViewState target_view_state, virtual void AnimateYPosition(AppListViewState target_view_state,
const TransformAnimator& animator, const TransformAnimator& animator,
float default_offset); float default_offset);
......
...@@ -223,16 +223,15 @@ void AppsContainerView::AnimateYPosition(AppListViewState target_view_state, ...@@ -223,16 +223,15 @@ void AppsContainerView::AnimateYPosition(AppListViewState target_view_state,
const int offset = current_suggestion_chip_y - target_suggestion_chip_y; const int offset = current_suggestion_chip_y - target_suggestion_chip_y;
suggestion_chip_container_view_->SetY(target_suggestion_chip_y); suggestion_chip_container_view_->SetY(target_suggestion_chip_y);
animator.Run(offset, suggestion_chip_container_view_->layer(), animator.Run(offset, suggestion_chip_container_view_->layer());
suggestion_chip_container_view_);
apps_grid_view_->SetY(suggestion_chip_container_view_->y() + apps_grid_view_->SetY(suggestion_chip_container_view_->y() +
chip_grid_y_distance_); chip_grid_y_distance_);
animator.Run(offset, apps_grid_view_->layer(), apps_grid_view_); animator.Run(offset, apps_grid_view_->layer());
page_switcher_->SetY(suggestion_chip_container_view_->y() + page_switcher_->SetY(suggestion_chip_container_view_->y() +
chip_grid_y_distance_); chip_grid_y_distance_);
animator.Run(offset, page_switcher_->layer(), page_switcher_); animator.Run(offset, page_switcher_->layer());
} }
void AppsContainerView::OnTabletModeChanged(bool started) { void AppsContainerView::OnTabletModeChanged(bool started) {
......
...@@ -354,8 +354,8 @@ void AssistantPageView::AnimateYPosition(AppListViewState target_view_state, ...@@ -354,8 +354,8 @@ void AssistantPageView::AnimateYPosition(AppListViewState target_view_state,
if (needs_layout()) if (needs_layout())
Layout(); Layout();
animator.Run(default_offset, layer(), this); animator.Run(default_offset, layer());
animator.Run(default_offset, view_shadow_->shadow()->shadow_layer(), nullptr); animator.Run(default_offset, view_shadow_->shadow()->shadow_layer());
} }
void AssistantPageView::UpdatePageOpacityForState(AppListState state, void AssistantPageView::UpdatePageOpacityForState(AppListState state,
......
...@@ -70,27 +70,6 @@ float GetOpacityForProgress(float progress, ...@@ -70,27 +70,6 @@ float GetOpacityForProgress(float progress,
1.0f); 1.0f);
} }
// Notifies assistive technology that all schedules animations have completed on
// this view and that a location change event has occurred. This should be used
// for notifying a11y to update view locations after transformation animations.
// This object will delete itself after running OnImplicitAnimationsCompleted.
class AccessibilityAnimationObserver : public ui::ImplicitAnimationObserver {
public:
explicit AccessibilityAnimationObserver(views::View* view) : view_(view) {}
~AccessibilityAnimationObserver() override = default;
// ui::ImplicitAnimationObserver:
void OnImplicitAnimationsCompleted() override {
view_->NotifyAccessibilityEvent(ax::mojom::Event::kLocationChanged, true);
delete this;
}
private:
views::View* const view_;
DISALLOW_COPY_AND_ASSIGN(AccessibilityAnimationObserver);
};
} // namespace } // namespace
ContentsView::ContentsView(AppListView* app_list_view) ContentsView::ContentsView(AppListView* app_list_view)
...@@ -784,12 +763,10 @@ void ContentsView::AnimateToViewState(AppListViewState target_view_state, ...@@ -784,12 +763,10 @@ void ContentsView::AnimateToViewState(AppListViewState target_view_state,
// Animates layer's vertical position (using transform animation). // Animates layer's vertical position (using transform animation).
// |layer| - The layer to transform. // |layer| - The layer to transform.
// |view| - Optional, the view to which the layer belongs (if the layer is a
// view layer).
// |y_offset| - The initial vertical offset - the layer's vertical offset will // |y_offset| - The initial vertical offset - the layer's vertical offset will
// be animated to 0. // be animated to 0.
auto animate_transform = [](base::TimeDelta duration, float y_offset, auto animate_transform = [](base::TimeDelta duration, float y_offset,
ui::Layer* layer, views::View* view) { ui::Layer* layer) {
gfx::Transform transform; gfx::Transform transform;
transform.Translate(0, y_offset); transform.Translate(0, y_offset);
layer->SetTransform(transform); layer->SetTransform(transform);
...@@ -800,10 +777,6 @@ void ContentsView::AnimateToViewState(AppListViewState target_view_state, ...@@ -800,10 +777,6 @@ void ContentsView::AnimateToViewState(AppListViewState target_view_state,
settings->SetTransitionDuration(duration); settings->SetTransitionDuration(duration);
settings->SetPreemptionStrategy( settings->SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_SET_NEW_TARGET); ui::LayerAnimator::IMMEDIATELY_SET_NEW_TARGET);
// Observer will delete itself after animation completes.
if (view)
settings->AddObserver(new AccessibilityAnimationObserver(view));
layer->SetTransform(gfx::Transform()); layer->SetTransform(gfx::Transform());
}; };
...@@ -853,7 +826,7 @@ void ContentsView::AnimateToViewState(AppListViewState target_view_state, ...@@ -853,7 +826,7 @@ void ContentsView::AnimateToViewState(AppListViewState target_view_state,
// For search box, animate the search_box view layer instead of the widget // For search box, animate the search_box view layer instead of the widget
// layer to avoid conflict with pagination model transitions (which update the // layer to avoid conflict with pagination model transitions (which update the
// search box widget layer transform as the transition progresses). // search box widget layer transform as the transition progresses).
animate_transform(duration, y_offset, search_box->layer(), search_box); animate_transform(duration, y_offset, search_box->layer());
// Update app list page bounds to their target values. This assumes that // Update app list page bounds to their target values. This assumes that
// potential in-progress pagination transition does not directly animate page // potential in-progress pagination transition does not directly animate page
...@@ -877,7 +850,7 @@ void ContentsView::AnimateToViewState(AppListViewState target_view_state, ...@@ -877,7 +850,7 @@ void ContentsView::AnimateToViewState(AppListViewState target_view_state,
View* host_view = child_window->GetProperty(views::kHostViewKey); View* host_view = child_window->GetProperty(views::kHostViewKey);
if (!host_view) if (!host_view)
continue; continue;
animate_transform(duration, y_offset, child_window->layer(), nullptr); animate_transform(duration, y_offset, child_window->layer());
} }
last_target_view_state_ = target_view_state; last_target_view_state_ = target_view_state;
...@@ -889,7 +862,7 @@ void ContentsView::AnimateToViewState(AppListViewState target_view_state, ...@@ -889,7 +862,7 @@ void ContentsView::AnimateToViewState(AppListViewState target_view_state,
animate_transform( animate_transform(
duration, duration,
expand_arrow_view()->CalculateOffsetFromCurrentAppListProgress(progress), expand_arrow_view()->CalculateOffsetFromCurrentAppListProgress(progress),
expand_arrow_view()->layer(), expand_arrow_view()); expand_arrow_view()->layer());
} }
void ContentsView::SetExpandArrowViewVisibility(bool show) { void ContentsView::SetExpandArrowViewVisibility(bool show) {
......
...@@ -475,12 +475,12 @@ void SearchResultPageView::AnimateYPosition(AppListViewState target_view_state, ...@@ -475,12 +475,12 @@ void SearchResultPageView::AnimateYPosition(AppListViewState target_view_state,
if (needs_layout()) if (needs_layout())
Layout(); Layout();
animator.Run(default_offset, layer(), this); animator.Run(default_offset, layer());
animator.Run(default_offset, view_shadow_->shadow()->shadow_layer(), nullptr); animator.Run(default_offset, view_shadow_->shadow()->shadow_layer());
if (anchored_dialog_) { if (anchored_dialog_) {
const float offset = const float offset =
anchored_dialog_->AdjustVerticalTransformOffset(default_offset); anchored_dialog_->AdjustVerticalTransformOffset(default_offset);
animator.Run(offset, anchored_dialog_->widget()->GetLayer(), nullptr); animator.Run(offset, anchored_dialog_->widget()->GetLayer());
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment