Mac: Add `disable-scroll-bounce` command-line flag (issue #1597).

This commit is contained in:
Marshall Greenblatt 2015-04-08 15:16:17 +02:00
parent 4a905f1e2b
commit 6cceb1bd41
6 changed files with 27 additions and 26 deletions

View File

@ -664,6 +664,7 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
// any associated values) if present in the browser command line.
static const char* const kSwitchNames[] = {
switches::kContextSafetyImplementation,
switches::kDisableScrollBounce,
switches::kDisableSpellChecking,
switches::kEnableSpeechInput,
switches::kEnableSpellingAutoCorrect,

View File

@ -97,4 +97,7 @@ const char kOverrideSpellCheckLang[] = "override-spell-check-lang";
// Enable detection and use of a system-wide Pepper Flash install.
const char kEnableSystemFlash[] = "enable-system-flash";
// Disable scroll bounce (rubber-banding) on OS X Lion and newer.
const char kDisableScrollBounce[] = "disable-scroll-bounce";
} // namespace switches

View File

@ -42,6 +42,7 @@ extern const char kDisableSpellChecking[];
extern const char kEnableSpellingService[];
extern const char kOverrideSpellCheckLang[];
extern const char kEnableSystemFlash[];
extern const char kDisableScrollBounce[];
} // namespace switches

View File

@ -69,6 +69,11 @@ MSVC_POP_WARNING();
#include "third_party/WebKit/public/web/WebView.h"
#include "v8/include/v8.h"
#if defined(OS_MACOSX)
#include "base/mac/mac_util.h"
#include "base/strings/sys_string_conversions.h"
#endif
namespace {
// Stub implementation of blink::WebPrerenderingSupport.
@ -455,6 +460,23 @@ void CefContentRendererClient::RenderThreadStarted() {
// Cross-origin entries need to be added after WebKit is initialized.
cross_origin_whitelist_entries_ = params.cross_origin_whitelist_entries;
#if defined(OS_MACOSX)
if (base::mac::IsOSLionOrLater()) {
base::ScopedCFTypeRef<CFStringRef> key(
base::SysUTF8ToCFStringRef("NSScrollViewRubberbanding"));
base::ScopedCFTypeRef<CFStringRef> value;
// If the command-line switch is specified then set the value that will be
// checked in RenderThreadImpl::Init(). Otherwise, remove the application-
// level value.
if (command_line->HasSwitch(switches::kDisableScrollBounce))
value.reset(base::SysUTF8ToCFStringRef("false"));
CFPreferencesSetAppValue(key, value, kCFPreferencesCurrentApplication);
CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
}
#endif // defined(OS_MACOSX)
// Notify the render process handler.
CefRefPtr<CefApp> application = CefContentClient::Get()->application();
if (application.get()) {

View File

@ -149,11 +149,4 @@ patches = [
'name': 'chrome_pepper_flash_1586',
'path': '../chrome/common/',
},
{
# Disable scollbar bounce and overlay on OS X.
# http://code.google.com/p/chromiumembedded/issues/detail?id=364
'name': 'spi_webcore_364',
'path': '../third_party/WebKit/Source/',
'condition': 'CEF_SPI_BUILD',
},
]

View File

@ -1,19 +0,0 @@
diff --git platform/scroll/ScrollbarThemeMacCommon.mm platform/scroll/ScrollbarThemeMacCommon.mm
index 90abb7c..6bb16c6 100644
--- platform/scroll/ScrollbarThemeMacCommon.mm
+++ platform/scroll/ScrollbarThemeMacCommon.mm
@@ -354,10 +354,14 @@ NSScrollerStyle ScrollbarThemeMacCommon::recommendedScrollerStyle()
// static
bool ScrollbarThemeMacCommon::isOverlayAPIAvailable()
{
+#if 0
static bool apiAvailable =
[NSClassFromString(@"NSScrollerImp") respondsToSelector:@selector(scrollerImpWithStyle:controlSize:horizontal:replacingScrollerImp:)]
&& [NSClassFromString(@"NSScrollerImpPair") instancesRespondToSelector:@selector(scrollerStyle)];
return apiAvailable;
+#else
+ return false;
+#endif
}
} // namespace blink