Commit d23ef8c4 authored by Katie D's avatar Katie D Committed by Commit Bot

Revert "Tapping an Select-to-Speak tray icon cancels further event propagation."

This reverts commit ecdb6a3b.

Reason for revert:
This is causing a weird behavior where if you mouse-down on the button and
then hold and drag way, select-to-speak is activated anyway. Select-to-Speak
can also be activated from behind the on-screen keyboard.

TBR=jamescook@chromium.org,dtseng@chromium.org

Bug: 870922
Change-Id: Ib9b7395e3a66c491a6c3274dd93898b4e064dd4d
Reviewed-on: https://chromium-review.googlesource.com/1187728
Commit-Queue: Katie Dektar <katie@chromium.org>
Reviewed-by: default avatarKatie Dektar <katie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585684}
parent 5a19eb52
......@@ -63,7 +63,6 @@ component("ash") {
"shell_init_params.h",
"shell_observer.h",
"sticky_keys/sticky_keys_controller.h",
"system/accessibility/select_to_speak_tray_utils.h",
"system/status_area_widget.h",
"system/status_area_widget_delegate.h",
"system/system_tray_focus_observer.h",
......@@ -638,7 +637,6 @@ component("ash") {
"system/accessibility/dictation_button_tray.h",
"system/accessibility/select_to_speak_tray.cc",
"system/accessibility/select_to_speak_tray.h",
"system/accessibility/select_to_speak_tray_utils.cc",
"system/audio/audio_detailed_view.cc",
"system/audio/audio_detailed_view.h",
"system/audio/display_speaker_controller.cc",
......
......@@ -77,10 +77,6 @@ void SelectToSpeakTray::OnSessionStateChanged(
CheckStatusAndUpdateIcon();
}
bool SelectToSpeakTray::ContainsPointInScreen(const gfx::Point& point) {
return GetBoundsInScreen().Contains(point);
}
void SelectToSpeakTray::UpdateIconsForSession() {
session_manager::SessionState session_state =
Shell::Get()->session_controller()->GetSessionState();
......
......@@ -39,10 +39,6 @@ class ASH_EXPORT SelectToSpeakTray : public TrayBackgroundView,
// SessionObserver:
void OnSessionStateChanged(session_manager::SessionState state) override;
// Returns true if the screen point passed in is contained within this tray's
// bounds.
bool ContainsPointInScreen(const gfx::Point& point);
private:
friend class SelectToSpeakTrayTest;
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/system/accessibility/select_to_speak_tray_utils.h"
#include "ash/session/session_controller.h"
#include "ash/shelf/shelf.h"
#include "ash/shell.h"
#include "ash/system/accessibility/select_to_speak_tray.h"
#include "ash/system/status_area_widget.h"
#include "ui/display/display.h"
#include "ui/gfx/geometry/point.h"
namespace ash {
namespace select_to_speak_tray_utils {
bool SelectToSpeakTrayContainsPointInScreen(const gfx::Point& point) {
for (aura::Window* window : Shell::GetAllRootWindows()) {
SelectToSpeakTray* tray =
Shelf::ForWindow(window)->GetStatusAreaWidget()->select_to_speak_tray();
if (tray && tray->ContainsPointInScreen(point))
return true;
}
return false;
}
} // namespace select_to_speak_tray_utils
} // namespace ash
\ No newline at end of file
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_SYSTEM_ACCESSIBILITY_SELECT_TO_SPEAK_TRAY_UTILS_H_
#define ASH_SYSTEM_ACCESSIBILITY_SELECT_TO_SPEAK_TRAY_UTILS_H_
#include "ash/ash_export.h"
namespace gfx {
class Point;
}
namespace ash {
namespace select_to_speak_tray_utils {
// Returns true if either the select-to-speak tray icon contains the
// given point (in screen space).
ASH_EXPORT bool SelectToSpeakTrayContainsPointInScreen(const gfx::Point& point);
} // namespace select_to_speak_tray_utils
} // namespace ash
#endif // ASH_SYSTEM_ACCESSIBILITY_SELECT_TO_SPEAK_TRAY_UTILS_H_
......@@ -12,10 +12,6 @@ specific_include_rules = {
"+ash/magnifier/magnification_controller.h",
"+ash/shell.h",
],
"select_to_speak_event_handler\.cc": [
# TODO(mash): Port the EventHandler to ash. http://crbug.com/874295
"+ash/system/accessibility/select_to_speak_tray_utils.h",
],
"switch_access_event_handler\.cc": [
# TODO(mash): Fix. https://crbug.com/854025
"+ash/shell.h",
......
......@@ -8,7 +8,6 @@
#include <string>
#include <utility>
#include "ash/system/accessibility/select_to_speak_tray_utils.h"
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
#include "chrome/browser/chromeos/accessibility/event_handler_common.h"
#include "chrome/common/extensions/extension_constants.h"
......@@ -163,13 +162,8 @@ void SelectToSpeakEventHandler::OnKeyEvent(ui::KeyEvent* event) {
void SelectToSpeakEventHandler::OnMouseEvent(ui::MouseEvent* event) {
DCHECK(IsSelectToSpeakEnabled());
DCHECK(event);
if (state_ == INACTIVE) {
if (event->type() == ui::ET_MOUSE_PRESSED) {
// Check if the mouse event occurred on the tray button.
CancelEventIfOverSelectToSpeakTray(event);
}
if (state_ == INACTIVE)
return;
}
if (event->type() == ui::ET_MOUSE_PRESSED) {
if (state_ == SEARCH_DOWN || state_ == MOUSE_RELEASED)
......@@ -207,12 +201,6 @@ void SelectToSpeakEventHandler::OnMouseEvent(ui::MouseEvent* event) {
void SelectToSpeakEventHandler::OnTouchEvent(ui::TouchEvent* event) {
DCHECK(IsSelectToSpeakEnabled());
DCHECK(event);
if (state_ == INACTIVE && event->type() == ui::ET_TOUCH_PRESSED) {
// Check if the touch event occurred on the tray button.
CancelEventIfOverSelectToSpeakTray(event);
}
// Only capture touch events if selection was requested or we are capturing
// touch events already.
if (state_ != SELECTION_REQUESTED && state_ != CAPTURING_TOUCH_ONLY)
......@@ -302,16 +290,4 @@ void SelectToSpeakEventHandler::CancelEvent(ui::Event* event) {
}
}
// TODO(katie): Refactor this for mash, http://crbug.com/874295.
void SelectToSpeakEventHandler::CancelEventIfOverSelectToSpeakTray(
ui::LocatedEvent* event) {
if (ash::select_to_speak_tray_utils::SelectToSpeakTrayContainsPointInScreen(
event->root_location())) {
// Cancel the event so it does not cause any UI changes after a button tap.
CancelEvent(event);
// Enter the selecting mode as if we've clicked or tapped the button.
chromeos::AccessibilityManager::Get()->RequestSelectToSpeakStateChange();
}
}
} // namespace chromeos
......@@ -52,11 +52,6 @@ class SelectToSpeakEventHandler : public ui::EventHandler {
// Forwards a mouse event to the Select-to-Speak extension.
void ForwardMouseEventToExtension(ui::MouseEvent* event);
// For touch and mouse events events, the Select-to-Speak tray needs to
// cancel all further event propagation so that dialogs and menus do not
// close and therefore can be read by the user.
void CancelEventIfOverSelectToSpeakTray(ui::LocatedEvent* event);
enum State {
// The search key is not down, no selection has been requested.
// No other keys or mouse events are captured.
......
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