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

Side by Side Diff: ui/keyboard/keyboard_controller.cc

Issue 578653004: Overscroll for keyboard disabled while keyboard is hiding. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: ) Created 6 years, 3 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/keyboard/keyboard_controller.h ('k') | ui/keyboard/keyboard_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/keyboard/keyboard_controller.h" 5 #include "ui/keyboard/keyboard_controller.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 void KeyboardController::OnInputMethodDestroyed( 438 void KeyboardController::OnInputMethodDestroyed(
439 const ui::InputMethod* input_method) { 439 const ui::InputMethod* input_method) {
440 DCHECK_EQ(input_method_, input_method); 440 DCHECK_EQ(input_method_, input_method);
441 input_method_ = NULL; 441 input_method_ = NULL;
442 } 442 }
443 443
444 void KeyboardController::OnShowImeIfNeeded() { 444 void KeyboardController::OnShowImeIfNeeded() {
445 ShowKeyboardInternal(); 445 ShowKeyboardInternal();
446 } 446 }
447 447
448 bool KeyboardController::ShouldEnableInsets(aura::Window* window) {
449 aura::Window *keyboard_window = proxy_->GetKeyboardWindow();
450 return (keyboard_window->GetRootWindow() == window->GetRootWindow() &&
451 keyboard::IsKeyboardOverscrollEnabled() &&
452 proxy_->GetKeyboardWindow()->IsVisible() &&
453 keyboard_visible_);
454 }
455
448 void KeyboardController::UpdateWindowInsets(aura::Window* window) { 456 void KeyboardController::UpdateWindowInsets(aura::Window* window) {
449 aura::Window *keyboard_window = proxy_->GetKeyboardWindow(); 457 aura::Window *keyboard_window = proxy_->GetKeyboardWindow();
450 if (window == keyboard_window) 458 if (window == keyboard_window)
451 return; 459 return;
452 460
453 bool enableInsets = (keyboard_window->GetRootWindow() ==
454 window->GetRootWindow()) && keyboard::IsKeyboardOverscrollEnabled() &&
455 proxy_->GetKeyboardWindow()->IsVisible();
456
457 scoped_ptr<content::RenderWidgetHostIterator> widgets( 461 scoped_ptr<content::RenderWidgetHostIterator> widgets(
458 content::RenderWidgetHost::GetRenderWidgetHosts()); 462 content::RenderWidgetHost::GetRenderWidgetHosts());
459 while (content::RenderWidgetHost* widget = widgets->GetNextHost()) { 463 while (content::RenderWidgetHost* widget = widgets->GetNextHost()) {
460 content::RenderWidgetHostView* view = widget->GetView(); 464 content::RenderWidgetHostView* view = widget->GetView();
461 if (view && window->Contains(view->GetNativeView())) { 465 if (view && window->Contains(view->GetNativeView())) {
462 gfx::Rect window_bounds = view->GetNativeView()->GetBoundsInScreen(); 466 gfx::Rect window_bounds = view->GetNativeView()->GetBoundsInScreen();
463 gfx::Rect intersect = gfx::IntersectRects(window_bounds, 467 gfx::Rect intersect = gfx::IntersectRects(window_bounds,
464 proxy_->GetKeyboardWindow()->bounds()); 468 proxy_->GetKeyboardWindow()->bounds());
465 int overlap = enableInsets ? intersect.height() : 0; 469 int overlap = ShouldEnableInsets(window) ? intersect.height() : 0;
466 if (overlap > 0 && overlap < window_bounds.height()) 470 if (overlap > 0 && overlap < window_bounds.height())
467 view->SetInsets(gfx::Insets(0, 0, overlap, 0)); 471 view->SetInsets(gfx::Insets(0, 0, overlap, 0));
468 else 472 else
469 view->SetInsets(gfx::Insets()); 473 view->SetInsets(gfx::Insets());
470 return; 474 return;
471 } 475 }
472 } 476 }
473 } 477 }
474 478
475 void KeyboardController::ShowKeyboardInternal() { 479 void KeyboardController::ShowKeyboardInternal() {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 proxy_->HideKeyboardContainer(container_.get()); 577 proxy_->HideKeyboardContainer(container_.get());
574 } 578 }
575 579
576 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) { 580 void KeyboardController::AddBoundsChangedObserver(aura::Window* window) {
577 aura::Window* target_window = GetFrameWindow(window); 581 aura::Window* target_window = GetFrameWindow(window);
578 if (target_window) 582 if (target_window)
579 window_bounds_observer_->AddObservedWindow(target_window); 583 window_bounds_observer_->AddObservedWindow(target_window);
580 } 584 }
581 585
582 } // namespace keyboard 586 } // namespace keyboard
OLDNEW
« no previous file with comments | « ui/keyboard/keyboard_controller.h ('k') | ui/keyboard/keyboard_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698