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

Unified Diff: ui/keyboard/keyboard_util.cc

Issue 240443006: Remove native VK window height logic and wait for resizeTo to setup VK window height (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/keyboard/keyboard_util.h ('k') | ui/keyboard/resources/constants.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/keyboard/keyboard_util.cc
diff --git a/ui/keyboard/keyboard_util.cc b/ui/keyboard/keyboard_util.cc
index 7048be2e5564f354b113df0185dbf009935c03ba..1e06795bdcea3381c1382253d5a4898d3c19233c 100644
--- a/ui/keyboard/keyboard_util.cc
+++ b/ui/keyboard/keyboard_util.cc
@@ -43,26 +43,6 @@ bool g_accessibility_keyboard_enabled = false;
base::LazyInstance<GURL> g_override_content_url = LAZY_INSTANCE_INITIALIZER;
-// The ratio between the height of the keyboard and the screen when using the
-// usability keyboard.
-const float kUsabilityKeyboardHeightRatio = 1.0f;
-
-// The default ratio between the height of the keyboard and the screen.
-const float kDefaultKeyboardHeightRatio = 0.41f;
-
-// The ratio between the height of the keyboard and the screen when using the
-// accessibility keyboard.
-const float kAccessibilityKeyboardHeightRatio = 0.3f;
-
-float GetKeyboardHeightRatio(){
- if (keyboard::IsKeyboardUsabilityExperimentEnabled()) {
- return kUsabilityKeyboardHeightRatio;
- } else if (keyboard::GetAccessibilityKeyboardEnabled()) {
- return kAccessibilityKeyboardHeightRatio;
- }
- return kDefaultKeyboardHeightRatio;
-}
-
bool g_touch_keyboard_enabled = false;
} // namespace
@@ -71,12 +51,23 @@ namespace keyboard {
gfx::Rect DefaultKeyboardBoundsFromWindowBounds(
const gfx::Rect& window_bounds) {
- const float kKeyboardHeightRatio = GetKeyboardHeightRatio();
+ // Initialize default keyboard height to 0. The keyboard window height should
+ // only be set by window.resizeTo in virtual keyboard web contents. Otherwise,
+ // the default height may conflict with the new height and causing some
+ // strange animation issues. For keyboard usability experiments, a full screen
+ // virtual keyboard window is always preferred.
int keyboard_height =
- static_cast<int>(window_bounds.height() * kKeyboardHeightRatio);
+ keyboard::IsKeyboardUsabilityExperimentEnabled() ?
+ window_bounds.height() : 0;
+
+ return KeyboardBoundsFromWindowBounds(window_bounds, keyboard_height);
+}
+
+gfx::Rect KeyboardBoundsFromWindowBounds(const gfx::Rect& window_bounds,
+ int keyboard_height) {
return gfx::Rect(
window_bounds.x(),
- window_bounds.y() + window_bounds.height() - keyboard_height,
+ window_bounds.bottom() - keyboard_height,
window_bounds.width(),
keyboard_height);
}
« no previous file with comments | « ui/keyboard/keyboard_util.h ('k') | ui/keyboard/resources/constants.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698