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

Side by Side Diff: ash/wm/resize_handle_window_targeter.cc

Issue 2172363002: Created min size for print preview dialog and modified to allow the Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Mac compile error. Created 4 years, 4 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
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 "ash/wm/resize_handle_window_targeter.h" 5 #include "ash/wm/resize_handle_window_targeter.h"
6 6
7 #include "ash/common/ash_constants.h" 7 #include "ash/common/ash_constants.h"
8 #include "ash/common/wm/window_state.h" 8 #include "ash/common/wm/window_state.h"
9 #include "ash/wm/immersive_fullscreen_controller.h" 9 #include "ash/wm/immersive_fullscreen_controller.h"
10 #include "ash/wm/window_state_aura.h" 10 #include "ash/wm/window_state_aura.h"
11 #include "ui/aura/window.h" 11 #include "ui/aura/window.h"
12 #include "ui/aura/window_targeter.h"
12 #include "ui/events/event.h" 13 #include "ui/events/event.h"
13 14
14 namespace ash { 15 namespace ash {
15 16
16 ResizeHandleWindowTargeter::ResizeHandleWindowTargeter( 17 ResizeHandleWindowTargeter::ResizeHandleWindowTargeter(
17 aura::Window* window, 18 aura::Window* window,
18 WmImmersiveFullscreenController* controller) 19 WmImmersiveFullscreenController* controller)
19 : window_(window), immersive_controller_(controller) { 20 : window_(window), immersive_controller_(controller) {
20 wm::WindowState* window_state = wm::GetWindowState(window_); 21 wm::WindowState* window_state = wm::GetWindowState(window_);
21 OnPostWindowStateTypeChange(window_state, wm::WINDOW_STATE_TYPE_DEFAULT); 22 OnPostWindowStateTypeChange(window_state, wm::WINDOW_STATE_TYPE_DEFAULT);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // being generated. 64 // being generated.
64 insets = gfx::Insets(kImmersiveFullscreenTopEdgeInset, 0, 0, 0); 65 insets = gfx::Insets(kImmersiveFullscreenTopEdgeInset, 0, 0, 0);
65 } else { 66 } else {
66 // If the event falls very close to the inside of the frame border, then 67 // If the event falls very close to the inside of the frame border, then
67 // target the window itself, so that the window can be resized easily. 68 // target the window itself, so that the window can be resized easily.
68 insets = frame_border_inset_; 69 insets = frame_border_inset_;
69 } 70 }
70 71
71 if (!insets.IsEmpty()) { 72 if (!insets.IsEmpty()) {
72 gfx::Rect bounds = gfx::Rect(window_->bounds().size()); 73 gfx::Rect bounds = gfx::Rect(window_->bounds().size());
73 bounds.Inset(insets); 74 gfx::Rect insetBounds(bounds);
74 if (!bounds.Contains(event->location())) 75 insetBounds.Inset(insets);
76 if (!insetBounds.Contains(event->location()) &&
77 !HasIndependentChildWithEvent(window, event->location(), false))
75 return window_; 78 return window_;
76 } 79 }
77 } 80 }
78 return aura::WindowTargeter::FindTargetForLocatedEvent(window, event); 81 return aura::WindowTargeter::FindTargetForLocatedEvent(window, event);
79 } 82 }
80 83
81 bool ResizeHandleWindowTargeter::SubtreeShouldBeExploredForEvent( 84 bool ResizeHandleWindowTargeter::SubtreeShouldBeExploredForEvent(
82 aura::Window* window, 85 aura::Window* window,
83 const ui::LocatedEvent& event) { 86 const ui::LocatedEvent& event) {
84 if (window == window_) { 87 if (window == window_) {
85 // Defer to the parent's targeter on whether |window_| should be able to 88 // Defer to the parent's targeter on whether |window_| should be able to
86 // receive the event. 89 // receive the event.
87 ui::EventTarget* parent = 90 ui::EventTarget* parent =
88 static_cast<ui::EventTarget*>(window)->GetParentTarget(); 91 static_cast<ui::EventTarget*>(window)->GetParentTarget();
89 if (parent) { 92 if (parent) {
90 aura::WindowTargeter* targeter = 93 aura::WindowTargeter* targeter =
91 static_cast<aura::WindowTargeter*>(parent->GetEventTargeter()); 94 static_cast<aura::WindowTargeter*>(parent->GetEventTargeter());
92 if (targeter) 95 if (targeter)
93 return targeter->SubtreeShouldBeExploredForEvent(window, event); 96 return targeter->SubtreeShouldBeExploredForEvent(window, event);
94 } 97 }
95 } 98 }
96 return aura::WindowTargeter::SubtreeShouldBeExploredForEvent(window, event); 99 return aura::WindowTargeter::SubtreeShouldBeExploredForEvent(window, event);
97 } 100 }
98 101
99 } // namespace ash 102 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698