Commit fcf2cf6b authored by Avery Musbach's avatar Avery Musbach Committed by Commit Bot

split view: Anticipate that dragging may begin in a snap area

The present CL modifies code that was based on a bad assumption: that
dragging always begins with one of the kFrom* window dragging states.

Test: manual
Fixed: 1024513
Change-Id: Id515edfc9344af8a86ca49b14583af244b248652
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1918034Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: Avery Musbach <amusbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715993}
parent 25195a44
......@@ -181,11 +181,13 @@ class SplitViewDragIndicators::RotatedImageLabelView : public views::View {
return;
}
// When dragging begins, set the text and fade in with an indicator.
// Set the text according to |can_dragged_window_be_snapped|.
SetLabelText(l10n_util::GetStringUTF16(
can_dragged_window_be_snapped ? IDS_ASH_SPLIT_VIEW_GUIDANCE
: IDS_ASH_SPLIT_VIEW_CANNOT_SNAP));
// When dragging begins (without a snap preview), fade in with an indicator.
if (previous_window_dragging_state == WindowDraggingState::kNoDrag) {
SetLabelText(l10n_util::GetStringUTF16(
can_dragged_window_be_snapped ? IDS_ASH_SPLIT_VIEW_GUIDANCE
: IDS_ASH_SPLIT_VIEW_CANNOT_SNAP));
DoSplitviewOpacityAnimation(
layer(), SPLITVIEW_ANIMATION_TEXT_FADE_IN_WITH_HIGHLIGHT);
return;
......
......@@ -206,6 +206,9 @@ void SplitViewHighlightView::OnWindowDraggingStateChanged(
return;
}
// Set the color according to |can_dragged_window_be_snapped|.
SetColor(can_dragged_window_be_snapped ? SK_ColorWHITE : SK_ColorBLACK);
if (preview_position != SplitViewController::NONE) {
DoSplitviewOpacityAnimation(
layer(), is_right_or_bottom_ != IsPhysicalLeftOrTop(preview_position)
......@@ -236,12 +239,11 @@ void SplitViewHighlightView::OnWindowDraggingStateChanged(
}
// The drag just started, and not in a snap area. If |previews_only|, there is
// nothing to do. Else set the color of the indicators and fade them in.
// nothing to do. Else fade in.
DCHECK_EQ(SplitViewDragIndicators::WindowDraggingState::kNoDrag,
previous_window_dragging_state);
DCHECK_EQ(0.f, layer()->opacity());
if (!previews_only) {
SetColor(can_dragged_window_be_snapped ? SK_ColorWHITE : SK_ColorBLACK);
DoSplitviewOpacityAnimation(layer(), SPLITVIEW_ANIMATION_HIGHLIGHT_FADE_IN);
return;
}
......
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