WKWebView has no equivalent of -[WebView setAlwaysShowVerticalScroller:]
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Dec 2017 20:57:11 +0000 (20:57 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Dec 2017 20:57:11 +0000 (20:57 +0000)
commit2162209f3a610ad3fb9fb6059e10529f9269cf22
treec90592e74589c74fd240029b6dca90c4ad8e4270
parentf40e66eb9121f67af15c04abaa22d0051b7acbef
WKWebView has no equivalent of -[WebView setAlwaysShowVerticalScroller:]
https://bugs.webkit.org/show_bug.cgi?id=180613
<rdar://problem/35946124>

Reviewed by Geoff Garen.

Source/WebCore:

Test: TestWebKitAPI/Tests/WebKitCocoa/WKWebViewAlwaysShowsScroller.mm

* platform/ScrollView.h: Exported setScrollbarModes.

Source/WebKit:

Added _alwaysShowsHorizontalScroller and _alwaysShowsVerticalScroller properties to
WKWebView.

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const): Encode new alwaysShowsHorizontalScroller
  and alwaysShowsVerticalScroller parameters.
(WebKit::WebPageCreationParameters::decode): Decode new parameters.

* Shared/WebPageCreationParameters.h: Added new alwaysShowsHorizontalScroller and
  alwaysShowsVerticalScroller boolean parameters.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _alwaysShowsHorizontalScroller]): New accessor that calls through to the
  WebPageProxy.
(-[WKWebView _setAlwaysShowsHorizontalScroller:]): Ditto.
(-[WKWebView _alwaysShowsVerticalScroller]): Ditto.
(-[WKWebView _setAlwaysShowsVerticalScroller:]): Ditto.

* UIProcess/API/Cocoa/WKWebViewPrivate.h: Declare new properties.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setAlwaysShowsHorizontalScroller): Update member variable and send
  a message to the page.
(WebKit::WebPageProxy::setAlwaysShowsVerticalScroller): Ditto.
(WebKit::WebPageProxy::creationParameters): Initialize new parameters from the new member
  variables.

* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::alwaysShowsHorizontalScroller const): New getter.
(WebKit::WebPageProxy::alwaysShowsVerticalScroller const): Ditto.

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage): Factor
  alwaysShowsHorizontalScroller and alwaysShowsVerticalScroller into the initial scroller
  modes and scroller locks when creating the FrameView.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Initialize new m_alwaysShowsHorizontalScroller and
  m_alwaysShowsVerticalScroller member variables from the corresponding new creation
  parameters.
(WebKit::WebPage::setAlwaysShowsHorizontalScroller): Update the member variable and set
  new scrollbar mode on the frame view if needed.
(WebKit::WebPage::setAlwaysShowsVerticalScroller): Ditto.

* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::alwaysShowsHorizontalScroller const): New getter.
(WebKit::WebPage::alwaysShowsVerticalScroller const): Ditto.

* WebProcess/WebPage/WebPage.messages.in: Added new messages.

Source/WebKitLegacy/mac:

* WebKit.mac.exp: Removed WebCoreScrollbarAlwaysOn, which is no longer being used by any
  clients.
* WebView/WebDynamicScrollBarsView.h: Ditto.
* WebView/WebDynamicScrollBarsView.mm: Ditto.

Tools:

* MiniBrowser/mac/MainMenu.xib: Added Always Show {Horizontal,Vertical} Scroller menu items
  to the View menu.

* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController validateMenuItem:]): Set the state of the new menu items based
  on -alwaysShow{Horizontal,Vertical}Scroller.
(-[WK1BrowserWindowController toggleAlwaysShowsHorizontalScroller:]): Toggle the value.
(-[WK1BrowserWindowController toggleAlwaysShowsVerticalScroller:]): Ditto.

* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController validateMenuItem:]): Set the state of the new menu items based
  on the new property.
(-[WK2BrowserWindowController toggleAlwaysShowsHorizontalScroller:]): Toggle the property.
(-[WK2BrowserWindowController toggleAlwaysShowsVerticalScroller:]): Ditto.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/WKWebViewAlwaysShowsScroller.mm: Added.
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/ScrollView.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPageCreationParameters.cpp
Source/WebKit/Shared/WebPageCreationParameters.h
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebKit.mac.exp
Source/WebKitLegacy/mac/WebView/WebDynamicScrollBarsView.h
Source/WebKitLegacy/mac/WebView/WebDynamicScrollBarsView.mm
Tools/ChangeLog
Tools/MiniBrowser/mac/MainMenu.xib
Tools/MiniBrowser/mac/WK1BrowserWindowController.m
Tools/MiniBrowser/mac/WK2BrowserWindowController.m
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewAlwaysShowsScroller.mm [new file with mode: 0644]