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

Side by Side Diff: ui/wm/core/masked_window_targeter.cc

Issue 1119423003: Refactors away method implementations in ui::EventTargeter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactors ui::EventTargeter (rebased) Created 5 years, 6 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 | « ui/wm/core/masked_window_targeter.h ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/wm/core/masked_window_targeter.h" 5 #include "ui/wm/core/masked_window_targeter.h"
6 6
7 #include "ui/aura/window.h" 7 #include "ui/aura/window.h"
8 #include "ui/events/event.h"
8 #include "ui/gfx/path.h" 9 #include "ui/gfx/path.h"
9 10
10 namespace wm { 11 namespace wm {
11 12
12 MaskedWindowTargeter::MaskedWindowTargeter(aura::Window* masked_window) 13 MaskedWindowTargeter::MaskedWindowTargeter(aura::Window* masked_window)
13 : masked_window_(masked_window) { 14 : masked_window_(masked_window) {
14 } 15 }
15 16
16 MaskedWindowTargeter::~MaskedWindowTargeter() {} 17 MaskedWindowTargeter::~MaskedWindowTargeter() {}
17 18
18 bool MaskedWindowTargeter::EventLocationInsideBounds( 19 bool MaskedWindowTargeter::EventLocationInsideBounds(
19 ui::EventTarget* target, 20 aura::Window* window,
20 const ui::LocatedEvent& event) const { 21 const ui::LocatedEvent& event) const {
21 aura::Window* window = static_cast<aura::Window*>(target);
22 if (window == masked_window_) { 22 if (window == masked_window_) {
23 gfx::Path mask; 23 gfx::Path mask;
24 if (!GetHitTestMask(window, &mask)) 24 if (!GetHitTestMask(window, &mask))
25 return WindowTargeter::EventLocationInsideBounds(window, event); 25 return WindowTargeter::EventLocationInsideBounds(window, event);
26 26
27 gfx::Size size = window->bounds().size(); 27 gfx::Size size = window->bounds().size();
28 SkRegion clip_region; 28 SkRegion clip_region;
29 clip_region.setRect(0, 0, size.width(), size.height()); 29 clip_region.setRect(0, 0, size.width(), size.height());
30 30
31 gfx::Point point = event.location(); 31 gfx::Point point = event.location();
32 if (window->parent()) 32 if (window->parent())
33 aura::Window::ConvertPointToTarget(window->parent(), window, &point); 33 aura::Window::ConvertPointToTarget(window->parent(), window, &point);
34 34
35 SkRegion mask_region; 35 SkRegion mask_region;
36 return mask_region.setPath(mask, clip_region) && 36 return mask_region.setPath(mask, clip_region) &&
37 mask_region.contains(point.x(), point.y()); 37 mask_region.contains(point.x(), point.y());
38 } 38 }
39 39
40 return WindowTargeter::EventLocationInsideBounds(window, event); 40 return WindowTargeter::EventLocationInsideBounds(window, event);
41 } 41 }
42 42
43 } // namespace wm 43 } // namespace wm
OLDNEW
« no previous file with comments | « ui/wm/core/masked_window_targeter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698