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,
// preferred bounds is calculated correctly.
folder_view_->contents_container()->layer()->SetTransform(gfx::Transform());
folder_view_->RecordAnimationSmoothness();
folder_view_->NotifyAccessibilityLocationChanges();
}
private:
......@@ -693,17 +691,6 @@ void AppListFolderView::OnTabletModeChanged(bool 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() {
gfx::Rect rect(GetContentsBounds());
if (rect.IsEmpty())
......
......@@ -116,10 +116,6 @@ class APP_LIST_EXPORT AppListFolderView : public views::View,
// Called when tablet mode starts and ends.
void OnTabletModeChanged(bool started);
// When transform in |contents_view_| is updated, notify accessibility to show
// ChromeVox focus in correct locations.
void NotifyAccessibilityLocationChanges();
private:
void CalculateIdealBounds();
......
......@@ -62,7 +62,7 @@ void AppListPage::AnimateOpacity(float current_progress,
void AppListPage::AnimateYPosition(AppListViewState target_view_state,
const TransformAnimator& animator,
float default_offset) {
animator.Run(default_offset, layer(), this);
animator.Run(default_offset, layer());
}
gfx::Rect AppListPage::GetAboveContentsOffscreenBounds(
......
......@@ -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
// animate the app list page vertical offset from the app list view top.
// |animator| - The callback that runs the transform animation to update the
// page's vertical position. (The layer is required argument, while view is
// 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).
// page's vertical position.
// |default_offset| - the default transform offset that can be passed to
// |animator| to follow the search box position animation.
using TransformAnimator = base::RepeatingCallback<
void(float offset, ui::Layer* layer, views::View* view)>;
using TransformAnimator =
base::RepeatingCallback<void(float offset, ui::Layer* layer)>;
virtual void AnimateYPosition(AppListViewState target_view_state,
const TransformAnimator& animator,
float default_offset);
......
......@@ -223,16 +223,15 @@ void AppsContainerView::AnimateYPosition(AppListViewState target_view_state,
const int offset = current_suggestion_chip_y - target_suggestion_chip_y;
suggestion_chip_container_view_->SetY(target_suggestion_chip_y);
animator.Run(offset, suggestion_chip_container_view_->layer(),
suggestion_chip_container_view_);
animator.Run(offset, suggestion_chip_container_view_->layer());
apps_grid_view_->SetY(suggestion_chip_container_view_->y() +
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() +
chip_grid_y_distance_);
animator.Run(offset, page_switcher_->layer(), page_switcher_);
animator.Run(offset, page_switcher_->layer());
}
void AppsContainerView::OnTabletModeChanged(bool started) {
......
......@@ -354,8 +354,8 @@ void AssistantPageView::AnimateYPosition(AppListViewState target_view_state,
if (needs_layout())
Layout();
animator.Run(default_offset, layer(), this);
animator.Run(default_offset, view_shadow_->shadow()->shadow_layer(), nullptr);
animator.Run(default_offset, layer());
animator.Run(default_offset, view_shadow_->shadow()->shadow_layer());
}
void AssistantPageView::UpdatePageOpacityForState(AppListState state,
......
......@@ -70,27 +70,6 @@ float GetOpacityForProgress(float progress,
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
ContentsView::ContentsView(AppListView* app_list_view)
......@@ -784,12 +763,10 @@ void ContentsView::AnimateToViewState(AppListViewState target_view_state,
// Animates layer's vertical position (using transform animation).
// |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
// be animated to 0.
auto animate_transform = [](base::TimeDelta duration, float y_offset,
ui::Layer* layer, views::View* view) {
ui::Layer* layer) {
gfx::Transform transform;
transform.Translate(0, y_offset);
layer->SetTransform(transform);
......@@ -800,10 +777,6 @@ void ContentsView::AnimateToViewState(AppListViewState target_view_state,
settings->SetTransitionDuration(duration);
settings->SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_SET_NEW_TARGET);
// Observer will delete itself after animation completes.
if (view)
settings->AddObserver(new AccessibilityAnimationObserver(view));
layer->SetTransform(gfx::Transform());
};
......@@ -853,7 +826,7 @@ void ContentsView::AnimateToViewState(AppListViewState target_view_state,
// For search box, animate the search_box view layer instead of the widget
// layer to avoid conflict with pagination model transitions (which update the
// 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
// potential in-progress pagination transition does not directly animate page
......@@ -877,7 +850,7 @@ void ContentsView::AnimateToViewState(AppListViewState target_view_state,
View* host_view = child_window->GetProperty(views::kHostViewKey);
if (!host_view)
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;
......@@ -889,7 +862,7 @@ void ContentsView::AnimateToViewState(AppListViewState target_view_state,
animate_transform(
duration,
expand_arrow_view()->CalculateOffsetFromCurrentAppListProgress(progress),
expand_arrow_view()->layer(), expand_arrow_view());
expand_arrow_view()->layer());
}
void ContentsView::SetExpandArrowViewVisibility(bool show) {
......
......@@ -475,12 +475,12 @@ void SearchResultPageView::AnimateYPosition(AppListViewState target_view_state,
if (needs_layout())
Layout();
animator.Run(default_offset, layer(), this);
animator.Run(default_offset, view_shadow_->shadow()->shadow_layer(), nullptr);
animator.Run(default_offset, layer());
animator.Run(default_offset, view_shadow_->shadow()->shadow_layer());
if (anchored_dialog_) {
const float 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