Reviewers: David Trainor
CL:
https://codereview.chromium.org/2381373002/Description:
Disable caret blinking for blimp
For blimp, blinking caret in a text input area causes lot of redundant
state update messages being sent between client and server. To reduce
the data usage, a settings was added to blink to disable the blinking.
BUG=
Affected files (+17, -0 lines):
M blimp/engine/app/settings_manager.cc
M content/public/common/common_param_traits_macros.h
M content/public/common/web_preferences.h
M content/public/common/web_preferences.cc
M content/renderer/render_view_impl.cc
M third_party/WebKit/Source/core/editing/FrameCaret.cpp
M third_party/WebKit/Source/core/frame/Settings.in
M third_party/WebKit/Source/web/WebSettingsImpl.h
M third_party/WebKit/Source/web/WebSettingsImpl.cpp
M third_party/WebKit/public/web/WebSettings.h
Index: blimp/engine/app/settings_manager.cc
diff --git a/blimp/engine/app/settings_manager.cc b/blimp/engine/app/settings_manager.cc
index 0c7fd35b62156cfcff0a9827154264278670932d..46163439089efc1b2aef7f59300b133da2243886 100644
--- a/blimp/engine/app/settings_manager.cc
+++ b/blimp/engine/app/settings_manager.cc
@@ -31,6 +31,7 @@ void SettingsManager::UpdateWebkitPreferences(content::WebPreferences* prefs) {
settings_.default_maximum_page_scale_factor;
prefs->shrinks_viewport_contents_to_fit =
settings_.shrinks_viewport_contents_to_fit;
+ prefs->disable_caret_blinking = true;
}
const EngineSettings& SettingsManager::GetEngineSettings() const {
Index: content/public/common/common_param_traits_macros.h
diff --git a/content/public/common/common_param_traits_macros.h b/content/public/common/common_param_traits_macros.h
index ea3dc292ae23b114434e04d36c0a719517679c0c..5ef1c6a1fb62ed4b08fe633268aa3d49a2e43d78 100644
--- a/content/public/common/common_param_traits_macros.h
+++ b/content/public/common/common_param_traits_macros.h
@@ -149,6 +149,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences)
IPC_STRUCT_TRAITS_MEMBER(hyperlink_auditing_enabled)
IPC_STRUCT_TRAITS_MEMBER(allow_universal_access_from_file_urls)
IPC_STRUCT_TRAITS_MEMBER(allow_file_access_from_file_urls)
+ IPC_STRUCT_TRAITS_MEMBER(disable_caret_blinking)
IPC_STRUCT_TRAITS_MEMBER(experimental_webgl_enabled)
IPC_STRUCT_TRAITS_MEMBER(pepper_3d_enabled)
IPC_STRUCT_TRAITS_MEMBER(inert_visual_viewport)
Index: content/public/common/web_preferences.cc
diff --git a/content/public/common/web_preferences.cc b/content/public/common/web_preferences.cc
index 96b7a649b28af0dd63ad91a15c6967a369ec6142..6b361903f8d7f2a88506ef243eee2af59ceecd88 100644
--- a/content/public/common/web_preferences.cc
+++ b/content/public/common/web_preferences.cc
@@ -99,6 +99,7 @@ WebPreferences::WebPreferences()
hyperlink_auditing_enabled(true),
allow_universal_access_from_file_urls(false),
allow_file_access_from_file_urls(false),
+ disable_caret_blinking(false),
experimental_webgl_enabled(false),
pepper_3d_enabled(false),
flash_3d_enabled(true),
Index: content/public/common/web_preferences.h
diff --git a/content/public/common/web_preferences.h b/content/public/common/web_preferences.h
index d31bf84c9212385cb14640344fa51e361a7ab02d..724ef1c8405774b90f9c3ebe1e1622c25e885cca 100644
--- a/content/public/common/web_preferences.h
+++ b/content/public/common/web_preferences.h
@@ -120,6 +120,7 @@ struct CONTENT_EXPORT WebPreferences {
bool hyperlink_auditing_enabled;
bool allow_universal_access_from_file_urls;
bool allow_file_access_from_file_urls;
+ bool disable_caret_blinking;
bool experimental_webgl_enabled;
bool pepper_3d_enabled;
bool flash_3d_enabled;
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index c31ba7c346ac09949f33c29a95c8fd22ce7ba8a4..a3197caf908158e21d4f6216c8332acd14c1c222 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -988,6 +988,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs,
settings->setAllowFileAccessFromFileURLs(
prefs.allow_file_access_from_file_urls);
+ settings->setDisableCaretBlinking(prefs.disable_caret_blinking);
+
// Enable experimental WebGL support if requested on command line
// and support is compiled in.
settings->setExperimentalWebGLEnabled(prefs.experimental_webgl_enabled);
Index: third_party/WebKit/Source/core/editing/FrameCaret.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameCaret.cpp b/third_party/WebKit/Source/core/editing/FrameCaret.cpp
index 78a623abfa1d66a43ef88c838cd7b7193f60c91b..97a6b46fd53dfd5280fae8b44cbdbfd0a70e6f9a 100644
--- a/third_party/WebKit/Source/core/editing/FrameCaret.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameCaret.cpp
@@ -260,6 +260,9 @@ bool FrameCaret::shouldBlinkCaret() const
if (m_frame->settings() && m_frame->settings()->caretBrowsingEnabled())
return false;
+ if (m_frame->settings() && m_frame->settings()->disableCaretBlinking())
+ return false;
+
Element* root = rootEditableElementOf(caretPosition().position());
if (!root)
return false;
Index: third_party/WebKit/Source/core/frame/Settings.in
diff --git a/third_party/WebKit/Source/core/frame/Settings.in b/third_party/WebKit/Source/core/frame/Settings.in
index 358dfe5bebe1c07c586aae761c187753d0f07c61..7e096facb1317d0b6a1ad0cfac3ec2880bd99167 100644
--- a/third_party/WebKit/Source/core/frame/Settings.in
+++ b/third_party/WebKit/Source/core/frame/Settings.in
@@ -61,6 +61,7 @@ caretBrowsingEnabled initial=false
localStorageEnabled initial=false
allowUniversalAccessFromFileURLs initial=true
allowFileAccessFromFileURLs initial=true
+disableCaretBlinking initial=false
javaScriptCanOpenWindowsAutomatically initial=false
supportsMultipleWindows initial=true
javaScriptCanAccessClipboard initial=false
Index: third_party/WebKit/Source/web/WebSettingsImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebSettingsImpl.cpp b/third_party/WebKit/Source/web/WebSettingsImpl.cpp
index adac1a3e85996e39feeeae485c5c6151be3aaab3..e4ad838fc76d3971f015456d90266e274df0a121 100644
--- a/third_party/WebKit/Source/web/WebSettingsImpl.cpp
+++ b/third_party/WebKit/Source/web/WebSettingsImpl.cpp
@@ -462,6 +462,11 @@ void WebSettingsImpl::setAllowUniversalAccessFromFileURLs(bool allow)
m_settings->setAllowUniversalAccessFromFileURLs(allow);
}
+void WebSettingsImpl::setDisableCaretBlinking(bool disableCaretBlinking)
+{
+ m_settings->setDisableCaretBlinking(disableCaretBlinking);
+}
+
void WebSettingsImpl::setAllowFileAccessFromFileURLs(bool allow)
{
m_settings->setAllowFileAccessFromFileURLs(allow);
Index: third_party/WebKit/Source/web/WebSettingsImpl.h
diff --git a/third_party/WebKit/Source/web/WebSettingsImpl.h b/third_party/WebKit/Source/web/WebSettingsImpl.h
index 00b3dc6ec56107acd455f67946e8ac5601792bc6..105c17dd531598faaaecd2c51ce2d8eb8ae418bb 100644
--- a/third_party/WebKit/Source/web/WebSettingsImpl.h
+++ b/third_party/WebKit/Source/web/WebSettingsImpl.h
@@ -56,6 +56,7 @@ public:
void setAccessibilityEnabled(bool) override;
void setAccessibilityPasswordValuesEnabled(bool) override;
void setAllowFileAccessFromFileURLs(bool) override;
+ void setDisableCaretBlinking(bool) override;
void setAllowCustomScrollbarInMainFrame(bool) override;
void setAllowGeolocationOnInsecureOrigins(bool) override;
void setAllowRunningOfInsecureContent(bool) override;
Index: third_party/WebKit/public/web/WebSettings.h
diff --git a/third_party/WebKit/public/web/WebSettings.h b/third_party/WebKit/public/web/WebSettings.h
index 3ba8df2fb1560f7684fac63de2a3c86f7ea6832e..c9c9cdbdca4e4bf2cd32c847b354c0da0073dea3 100644
--- a/third_party/WebKit/public/web/WebSettings.h
+++ b/third_party/WebKit/public/web/WebSettings.h
@@ -129,6 +129,7 @@ public:
virtual void setAccessibilityEnabled(bool) = 0;
virtual void setAccessibilityPasswordValuesEnabled(bool) = 0;
virtual void setAllowFileAccessFromFileURLs(bool) = 0;
+ virtual void setDisableCaretBlinking(bool) = 0;
virtual void setAllowCustomScrollbarInMainFrame(bool) = 0;
virtual void setAllowGeolocationOnInsecureOrigins(bool) = 0;
// If set to true, allows frames with an https origin to run active