Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: ui/views/animation/ink_drop_host_view.cc

Issue 2095873004: Ink drops with touch input are redundant on Windows since the OS does something similar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Spelling error correction Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/animation/ink_drop_host_view.h" 5 #include "ui/views/animation/ink_drop_host_view.h"
6 6
7 #include "ui/events/event.h" 7 #include "ui/events/event.h"
8 #include "ui/events/scoped_target_handler.h" 8 #include "ui/events/scoped_target_handler.h"
9 #include "ui/gfx/color_palette.h" 9 #include "ui/gfx/color_palette.h"
10 #include "ui/gfx/geometry/size_conversions.h" 10 #include "ui/gfx/geometry/size_conversions.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 165 }
166 166
167 gfx::Point InkDropHostView::GetInkDropCenterBasedOnLastEvent() const { 167 gfx::Point InkDropHostView::GetInkDropCenterBasedOnLastEvent() const {
168 return last_ripple_triggering_event_ 168 return last_ripple_triggering_event_
169 ? last_ripple_triggering_event_->location() 169 ? last_ripple_triggering_event_->location()
170 : GetLocalBounds().CenterPoint(); 170 : GetLocalBounds().CenterPoint();
171 } 171 }
172 172
173 void InkDropHostView::AnimateInkDrop(InkDropState state, 173 void InkDropHostView::AnimateInkDrop(InkDropState state,
174 const ui::LocatedEvent* event) { 174 const ui::LocatedEvent* event) {
175 #if defined(OS_WIN)
176 // On Windows, don't initiate ink-drops. Additionally, certain event states
177 // should dismiss existing ink-drop animations.
178 if (event && event->IsGestureEvent()) {
bruthig 2016/06/30 00:23:11 This would definitely benefit from some tests.
kylix_rd 2016/06/30 17:31:25 I presume you're referring to the whole block and
bruthig 2016/06/30 17:35:36 Correct, but at least the number of test cases req
179 // Don't transition the ink-drop to a "pending" state from a touch event.
180 if (state == InkDropState::ACTION_PENDING ||
181 state == InkDropState::ALTERNATE_ACTION_PENDING)
182 return;
183 // If the state is already pending, presumably from a mouse or keyboard
184 // event, then a "triggered" action state should be allowed. Conversely,
185 // if the state had already transitioned to hidden, then the touch event
186 // is ignored.
187 if ((state == InkDropState::ACTION_TRIGGERED ||
188 state == InkDropState::ALTERNATE_ACTION_TRIGGERED) &&
189 ink_drop_->GetTargetInkDropState() == InkDropState::HIDDEN)
bruthig 2016/06/30 00:23:11 What is the use-case for the "&& HIDDEN" clause he
kylix_rd 2016/06/30 13:39:37 The idea here is that a triggered action from a to
bruthig 2016/06/30 17:21:49 Ah right, makes sense. I must have been tired.
kylix_rd 2016/06/30 17:31:25 Aside from this logic being a little more complica
bruthig 2016/06/30 17:35:36 Nothing specific to this CL that I can think of.
190 return;
191 }
192 #endif
175 last_ripple_triggering_event_.reset( 193 last_ripple_triggering_event_.reset(
176 event ? ui::Event::Clone(*event).release()->AsLocatedEvent() : nullptr); 194 event ? ui::Event::Clone(*event).release()->AsLocatedEvent() : nullptr);
177 ink_drop_->AnimateToState(state); 195 ink_drop_->AnimateToState(state);
178 } 196 }
179 197
180 void InkDropHostView::VisibilityChanged(View* starting_from, bool is_visible) { 198 void InkDropHostView::VisibilityChanged(View* starting_from, bool is_visible) {
181 View::VisibilityChanged(starting_from, is_visible); 199 View::VisibilityChanged(starting_from, is_visible);
182 if (GetWidget() && !is_visible) { 200 if (GetWidget() && !is_visible) {
183 ink_drop()->AnimateToState(InkDropState::HIDDEN); 201 ink_drop()->AnimateToState(InkDropState::HIDDEN);
184 ink_drop()->SetHovered(false); 202 ink_drop()->SetHovered(false);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 if (has_an_ink_drop) { 242 if (has_an_ink_drop) {
225 ink_drop_.reset(new InkDropImpl(this)); 243 ink_drop_.reset(new InkDropImpl(this));
226 gesture_handler_.reset(new InkDropGestureHandler(this, ink_drop_.get())); 244 gesture_handler_.reset(new InkDropGestureHandler(this, ink_drop_.get()));
227 } else { 245 } else {
228 gesture_handler_.reset(); 246 gesture_handler_.reset();
229 ink_drop_.reset(new InkDropStub()); 247 ink_drop_.reset(new InkDropStub());
230 } 248 }
231 } 249 }
232 250
233 } // namespace views 251 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698