Commit b48b8f92 authored by thatcher's avatar thatcher

Reviewed by Darin and John.

        <rdar://problem/3600734> API: please add a way to turn vertical scrollbar
        always on (for Mail, to avoid reflow when typing)

        Adds new methods to lock the scrolling mode on WebDynamicScrollBarsView.
        Locking the scroll mode prevents WebCore from changing it as needed.
        Also adds an SPI on WebView that will lock the "always on" mode
        for each scroller.

        * WebKit.xcodeproj/project.pbxproj:
        * WebView/WebDynamicScrollBarsView.h:
        * WebView/WebDynamicScrollBarsView.m:
        (-[WebDynamicScrollBarsView setAllowsScrolling:]):
        (-[WebDynamicScrollBarsView allowsScrolling]):
        (-[WebDynamicScrollBarsView setAllowsHorizontalScrolling:]):
        (-[WebDynamicScrollBarsView setAllowsVerticalScrolling:]):
        (-[WebDynamicScrollBarsView setHorizontalScrollingMode:]):
        (-[WebDynamicScrollBarsView setVerticalScrollingMode:]):
        (-[WebDynamicScrollBarsView setScrollingMode:]):
        (-[WebDynamicScrollBarsView setHorizontalScrollingModeLocked:]):
        (-[WebDynamicScrollBarsView setVerticalScrollingModeLocked:]):
        (-[WebDynamicScrollBarsView setScrollingModesLocked:]):
        (-[WebDynamicScrollBarsView horizontalScrollingModeLocked]):
        (-[WebDynamicScrollBarsView verticalScrollingModeLocked]):
        * WebView/WebView.m:
        (-[WebView setAlwaysShowVerticalScroller:]):
        (-[WebView alwaysShowVerticalScroller]):
        (-[WebView setAlwaysShowHorizontalScroller:]):
        (-[WebView alwaysShowHorizontalScroller]):
        * WebView/WebViewPrivate.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@14771 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9ca92892
2006-06-08 Timothy Hatcher <timothy@apple.com>
Reviewed by Darin and John.
<rdar://problem/3600734> API: please add a way to turn vertical scrollbar
always on (for Mail, to avoid reflow when typing)
Adds new methods to lock the scrolling mode on WebDynamicScrollBarsView.
Locking the scroll mode prevents WebCore from changing it as needed.
Also adds an SPI on WebView that will lock the "always on" mode
for each scroller.
* WebKit.xcodeproj/project.pbxproj:
* WebView/WebDynamicScrollBarsView.h:
* WebView/WebDynamicScrollBarsView.m:
(-[WebDynamicScrollBarsView setAllowsScrolling:]):
(-[WebDynamicScrollBarsView allowsScrolling]):
(-[WebDynamicScrollBarsView setAllowsHorizontalScrolling:]):
(-[WebDynamicScrollBarsView setAllowsVerticalScrolling:]):
(-[WebDynamicScrollBarsView setHorizontalScrollingMode:]):
(-[WebDynamicScrollBarsView setVerticalScrollingMode:]):
(-[WebDynamicScrollBarsView setScrollingMode:]):
(-[WebDynamicScrollBarsView setHorizontalScrollingModeLocked:]):
(-[WebDynamicScrollBarsView setVerticalScrollingModeLocked:]):
(-[WebDynamicScrollBarsView setScrollingModesLocked:]):
(-[WebDynamicScrollBarsView horizontalScrollingModeLocked]):
(-[WebDynamicScrollBarsView verticalScrollingModeLocked]):
* WebView/WebView.m:
(-[WebView setAlwaysShowVerticalScroller:]):
(-[WebView alwaysShowVerticalScroller]):
(-[WebView setAlwaysShowHorizontalScroller:]):
(-[WebView alwaysShowHorizontalScroller]):
* WebView/WebViewPrivate.h:
2006-06-08 Darin Adler <darin@apple.com>
Reviewed by Justin.
......
......@@ -279,23 +279,6 @@
ED7F6D8B0980683500C235ED /* WebNSDataExtrasPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = ED7F6D8A0980683500C235ED /* WebNSDataExtrasPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
/* End PBXBuildFile section */
/* Begin PBXBuildStyle section */
5139C0C70A265D25001AFADD /* Development */ = {
isa = PBXBuildStyle;
buildSettings = {
COPY_PHASE_STRIP = NO;
};
name = Development;
};
5139C0C80A265D25001AFADD /* Deployment */ = {
isa = PBXBuildStyle;
buildSettings = {
COPY_PHASE_STRIP = YES;
};
name = Deployment;
};
/* End PBXBuildStyle section */
/* Begin PBXFileReference section */
1C68F640095B5FC100C2984E /* webInspector */ = {isa = PBXFileReference; lastKnownFileType = folder; name = webInspector; path = WebInspector/webInspector; sourceTree = SOURCE_ROOT; };
1C68F65C095B5FC100C2984E /* WebInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebInspector.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
......@@ -1249,12 +1232,6 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
buildSettings = {
};
buildStyles = (
5139C0C70A265D25001AFADD /* Development */,
5139C0C80A265D25001AFADD /* Deployment */,
);
hasScannedForEncodings = 1;
knownRegions = (
English,
......
......@@ -35,6 +35,8 @@
{
WebCoreScrollBarMode hScroll;
WebCoreScrollBarMode vScroll;
BOOL hScrollModeLocked;
BOOL vScrollModeLocked;
BOOL suppressLayout;
BOOL suppressScrollers;
BOOL inUpdateScrollers;
......@@ -45,6 +47,13 @@
- (void)setAllowsVerticalScrolling:(BOOL)flag;
- (BOOL)allowsVerticalScrolling;
- (void)setHorizontalScrollingModeLocked:(BOOL)locked;
- (void)setVerticalScrollingModeLocked:(BOOL)locked;
- (void)setScrollingModesLocked:(BOOL)mode;
- (BOOL)horizontalScrollingModeLocked;
- (BOOL)verticalScrollingModeLocked;
// Convenience method to affect both scrolling directions at once.
- (void)setAllowsScrolling:(BOOL)flag;
......
......@@ -144,24 +144,47 @@ - (void)reflectScrolledClipView:(NSClipView *)clipView
- (void)setAllowsScrolling:(BOOL)flag
{
hScroll = vScroll = (flag ? WebCoreScrollBarAuto : WebCoreScrollBarAlwaysOff);
if (hScrollModeLocked && vScrollModeLocked)
return;
if (flag && vScroll == WebCoreScrollBarAlwaysOff)
vScroll = WebCoreScrollBarAuto;
else if (!flag && vScroll != WebCoreScrollBarAlwaysOff)
vScroll = WebCoreScrollBarAlwaysOff;
if (flag && hScroll == WebCoreScrollBarAlwaysOff)
hScroll = WebCoreScrollBarAuto;
else if (!flag && hScroll != WebCoreScrollBarAlwaysOff)
hScroll = WebCoreScrollBarAlwaysOff;
[self updateScrollers];
}
- (BOOL)allowsScrolling
{
return hScroll != WebCoreScrollBarAlwaysOff && vScroll != WebCoreScrollBarAlwaysOff;
// Returns YES if either horizontal or vertical scrolling is allowed.
return hScroll != WebCoreScrollBarAlwaysOff || vScroll != WebCoreScrollBarAlwaysOff;
}
- (void)setAllowsHorizontalScrolling:(BOOL)flag
{
hScroll = (flag ? WebCoreScrollBarAuto : WebCoreScrollBarAlwaysOff);
if (hScrollModeLocked)
return;
if (flag && hScroll == WebCoreScrollBarAlwaysOff)
hScroll = WebCoreScrollBarAuto;
else if (!flag && hScroll != WebCoreScrollBarAlwaysOff)
hScroll = WebCoreScrollBarAlwaysOff;
[self updateScrollers];
}
- (void)setAllowsVerticalScrolling:(BOOL)flag
{
vScroll = (flag ? WebCoreScrollBarAuto : WebCoreScrollBarAlwaysOff);
if (vScrollModeLocked)
return;
if (flag && vScroll == WebCoreScrollBarAlwaysOff)
vScroll = WebCoreScrollBarAuto;
else if (!flag && vScroll != WebCoreScrollBarAlwaysOff)
vScroll = WebCoreScrollBarAlwaysOff;
[self updateScrollers];
}
......@@ -187,7 +210,7 @@ -(WebCoreScrollBarMode)verticalScrollingMode
- (void)setHorizontalScrollingMode:(WebCoreScrollBarMode)mode
{
if (mode == hScroll)
if (mode == hScroll || hScrollModeLocked)
return;
hScroll = mode;
[self updateScrollers];
......@@ -195,7 +218,7 @@ - (void)setHorizontalScrollingMode:(WebCoreScrollBarMode)mode
- (void)setVerticalScrollingMode:(WebCoreScrollBarMode)mode
{
if (mode == vScroll)
if (mode == vScroll || vScrollModeLocked)
return;
vScroll = mode;
[self updateScrollers];
......@@ -203,10 +226,47 @@ - (void)setVerticalScrollingMode:(WebCoreScrollBarMode)mode
- (void)setScrollingMode:(WebCoreScrollBarMode)mode
{
if (mode == vScroll && mode == hScroll)
if ((mode == vScroll && mode == hScroll) || (vScrollModeLocked && hScrollModeLocked))
return;
vScroll = hScroll = mode;
[self updateScrollers];
BOOL update = NO;
if (mode != vScroll && !vScrollModeLocked) {
vScroll = mode;
update = YES;
}
if (mode != hScroll && !hScrollModeLocked) {
hScroll = mode;
update = YES;
}
if (update)
[self updateScrollers];
}
- (void)setHorizontalScrollingModeLocked:(BOOL)locked
{
hScrollModeLocked = locked;
}
- (void)setVerticalScrollingModeLocked:(BOOL)locked
{
vScrollModeLocked = locked;
}
- (void)setScrollingModesLocked:(BOOL)locked
{
hScrollModeLocked = vScrollModeLocked = locked;
}
- (BOOL)horizontalScrollingModeLocked
{
return hScrollModeLocked;
}
- (BOOL)verticalScrollingModeLocked
{
return vScrollModeLocked;
}
- (BOOL)autoforwardsScrollWheelEvents
......
......@@ -2329,6 +2329,42 @@ - (void)_inspectElement:(id)sender
[inspector showWindow:nil];
}
- (void)setAlwaysShowVerticalScroller:(BOOL)flag
{
WebDynamicScrollBarsView *scrollview = (WebDynamicScrollBarsView *)[[[self mainFrame] frameView] _scrollView];
if (flag) {
[scrollview setVerticalScrollingMode:WebCoreScrollBarAlwaysOn];
[scrollview setVerticalScrollingModeLocked:YES];
} else {
[scrollview setVerticalScrollingModeLocked:NO];
[scrollview setVerticalScrollingMode:WebCoreScrollBarAuto];
}
}
- (BOOL)alwaysShowVerticalScroller
{
WebDynamicScrollBarsView *scrollview = (WebDynamicScrollBarsView *)[[[self mainFrame] frameView] _scrollView];
return [scrollview verticalScrollingModeLocked] && [scrollview verticalScrollingMode] == WebCoreScrollBarAlwaysOn;
}
- (void)setAlwaysShowHorizontalScroller:(BOOL)flag
{
WebDynamicScrollBarsView *scrollview = (WebDynamicScrollBarsView *)[[[self mainFrame] frameView] _scrollView];
if (flag) {
[scrollview setHorizontalScrollingMode:WebCoreScrollBarAlwaysOn];
[scrollview setHorizontalScrollingModeLocked:YES];
} else {
[scrollview setHorizontalScrollingModeLocked:NO];
[scrollview setHorizontalScrollingMode:WebCoreScrollBarAuto];
}
}
- (BOOL)alwaysShowHorizontalScroller
{
WebDynamicScrollBarsView *scrollview = (WebDynamicScrollBarsView *)[[[self mainFrame] frameView] _scrollView];
return [scrollview horizontalScrollingModeLocked] && [scrollview horizontalScrollingMode] == WebCoreScrollBarAlwaysOn;
}
@end
@implementation WebView (WebIBActions)
......
......@@ -220,6 +220,32 @@ Could be worth adding to the API.
+ (NSString *)_minimumRequiredSafariBuildNumber;
/*!
@method setAlwaysShowVerticalScroller:
@result Forces the vertical scroller to be visible if flag is YES, otherwise
if flag is NO the scroller with automatically show and hide as needed.
*/
- (void)setAlwaysShowVerticalScroller:(BOOL)flag;
/*!
@method alwaysShowVerticalScroller
@result YES if the vertical scroller is always shown
*/
- (BOOL)alwaysShowVerticalScroller;
/*!
@method setAlwaysShowHorizontalScroller:
@result Forces the horizontal scroller to be visible if flag is YES, otherwise
if flag is NO the scroller with automatically show and hide as needed.
*/
- (void)setAlwaysShowHorizontalScroller:(BOOL)flag;
/*!
@method alwaysShowHorizontalScroller
@result YES if the horizontal scroller is always shown
*/
- (BOOL)alwaysShowHorizontalScroller;
@end
@interface WebView (WebViewPrintingPrivate)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment