Commit 20a22865 authored by Eliot Courtney's avatar Eliot Courtney Committed by Commit Bot

Only consider overlay window controls for hittest if they are visible.

Bug: 883159
Test: PIP window no longer has draggabilty issues for touch input
Change-Id: I70121fd76bcc32e932ed49c4250301b0a2f884e9
Reviewed-on: https://chromium-review.googlesource.com/c/1341743
Commit-Queue: Eliot Courtney <edcourtney@chromium.org>
Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609596}
parent e56b996c
...@@ -110,17 +110,19 @@ class OverlayWindowFrameView : public views::NonClientFrameView { ...@@ -110,17 +110,19 @@ class OverlayWindowFrameView : public views::NonClientFrameView {
// The media controls should take and handle user interaction. // The media controls should take and handle user interaction.
OverlayWindowViews* window = static_cast<OverlayWindowViews*>(widget_); OverlayWindowViews* window = static_cast<OverlayWindowViews*>(widget_);
if (window->GetCloseControlsBounds().Contains(point) || if (window->AreControlsVisible() &&
window->GetFirstCustomControlsBounds().Contains(point) || (window->GetCloseControlsBounds().Contains(point) ||
window->GetSecondCustomControlsBounds().Contains(point) || window->GetFirstCustomControlsBounds().Contains(point) ||
window->GetPlayPauseControlsBounds().Contains(point)) { window->GetSecondCustomControlsBounds().Contains(point) ||
window->GetPlayPauseControlsBounds().Contains(point))) {
return window_component; return window_component;
} }
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// If the resize handle is clicked on, we want to force the hit test to // If the resize handle is clicked on, we want to force the hit test to
// force a resize drag. // force a resize drag.
if (window->GetResizeHandleControlsBounds().Contains(point)) if (window->AreControlsVisible() &&
window->GetResizeHandleControlsBounds().Contains(point))
return window->GetResizeHTComponent(); return window->GetResizeHTComponent();
#endif #endif
...@@ -782,7 +784,7 @@ void OverlayWindowViews::OnGestureEvent(ui::GestureEvent* event) { ...@@ -782,7 +784,7 @@ void OverlayWindowViews::OnGestureEvent(ui::GestureEvent* event) {
// layers are expected to have the same visibility. // layers are expected to have the same visibility.
// TODO(apacible): This placeholder logic should be updated with touchscreen // TODO(apacible): This placeholder logic should be updated with touchscreen
// specific investigation. https://crbug/854373 // specific investigation. https://crbug/854373
if (!GetControlsScrimLayer()->visible()) { if (!AreControlsVisible()) {
UpdateControlsVisibility(true); UpdateControlsVisibility(true);
return; return;
} }
...@@ -841,6 +843,10 @@ int OverlayWindowViews::GetResizeHTComponent() const { ...@@ -841,6 +843,10 @@ int OverlayWindowViews::GetResizeHTComponent() const {
return resize_handle_view_->GetHTComponent(); return resize_handle_view_->GetHTComponent();
} }
bool OverlayWindowViews::AreControlsVisible() const {
return controls_scrim_view_->layer()->visible();
}
ui::Layer* OverlayWindowViews::GetControlsScrimLayer() { ui::Layer* OverlayWindowViews::GetControlsScrimLayer() {
return controls_scrim_view_->layer(); return controls_scrim_view_->layer();
} }
......
...@@ -74,6 +74,10 @@ class OverlayWindowViews : public content::OverlayWindow, ...@@ -74,6 +74,10 @@ class OverlayWindowViews : public content::OverlayWindow,
// handle in order to force a drag-to-resize. // handle in order to force a drag-to-resize.
int GetResizeHTComponent() const; int GetResizeHTComponent() const;
// Returns true if the controls (e.g. close button, play/pause button) are
// visible.
bool AreControlsVisible() const;
views::ToggleImageButton* play_pause_controls_view_for_testing() const; views::ToggleImageButton* play_pause_controls_view_for_testing() const;
gfx::Point close_image_position_for_testing() const; gfx::Point close_image_position_for_testing() const;
gfx::Point resize_handle_position_for_testing() const; gfx::Point resize_handle_position_for_testing() const;
......
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