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 fe03339870
commit 328cf2ed1f
6 changed files with 27 additions and 41 deletions

View File

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

View File

@ -94,4 +94,7 @@ const char kEnableSpellingService[] = "enable-spelling-service";
// Override the default spellchecking language which comes from locales.pak. // Override the default spellchecking language which comes from locales.pak.
const char kOverrideSpellCheckLang[] = "override-spell-check-lang"; const char kOverrideSpellCheckLang[] = "override-spell-check-lang";
// Disable scroll bounce (rubber-banding) on OS X Lion and newer.
const char kDisableScrollBounce[] = "disable-scroll-bounce";
} // namespace switches } // namespace switches

View File

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

View File

@ -73,6 +73,11 @@ MSVC_POP_WARNING();
#include "third_party/WebKit/public/web/WebView.h" #include "third_party/WebKit/public/web/WebView.h"
#include "v8/include/v8.h" #include "v8/include/v8.h"
#if defined(OS_MACOSX)
#include "base/mac/mac_util.h"
#include "base/strings/sys_string_conversions.h"
#endif
#if defined(OS_WIN) #if defined(OS_WIN)
#include "base/win/iat_patch_function.h" #include "base/win/iat_patch_function.h"
#endif #endif
@ -500,6 +505,23 @@ void CefContentRendererClient::RenderThreadStarted() {
pdf_print_client_.reset(new ChromePDFPrintClient()); pdf_print_client_.reset(new ChromePDFPrintClient());
pdf::PPB_PDF_Impl::SetPrintClient(pdf_print_client_.get()); pdf::PPB_PDF_Impl::SetPrintClient(pdf_print_client_.get());
#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. // Notify the render process handler.
CefRefPtr<CefApp> application = CefContentClient::Get()->application(); CefRefPtr<CefApp> application = CefContentClient::Get()->application();
if (application.get()) { if (application.get()) {

View File

@ -132,11 +132,4 @@ patches = [
'name': 'webkit_progresstracker_426510', 'name': 'webkit_progresstracker_426510',
'path': '../third_party/WebKit/Source/core/loader/', 'path': '../third_party/WebKit/Source/core/loader/',
}, },
{
# 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,34 +0,0 @@
diff --git core/frame/FrameView.cpp core/frame/FrameView.cpp
index b227b2a..3bc4180 100644
--- core/frame/FrameView.cpp
+++ core/frame/FrameView.cpp
@@ -144,8 +144,10 @@ FrameView::FrameView(LocalFrame* frame)
if (!m_frame->isMainFrame())
return;
+#if 0
ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed);
ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed);
+#endif
}
PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame)
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