+2007-07-05 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by John.
+
+ <rdar://problem/5236277> REGRESSION-9A458: SPI for setting scroll bar behavior doesn't work
+
+ Calling setHorizontalScrollingMode: calls updateScrollers before returning, this will cause
+ WebCore to reset the scrolling mode based on the CSS overflow rules. So the setAlwaysShowHorizontalScroller:
+ and setAlwaysShowVerticalScroller: methods needed a way to lock the scrolling mode before
+ calling updateScrollers.
+
+ * WebView/WebDynamicScrollBarsView.m:
+ (-[WebDynamicScrollBarsView updateScrollers]):
+ (-[WebDynamicScrollBarsView setHorizontalScrollingMode:]):
+ (-[WebDynamicScrollBarsView setHorizontalScrollingMode:andLock:]):
+ (-[WebDynamicScrollBarsView setVerticalScrollingMode:]):
+ (-[WebDynamicScrollBarsView setVerticalScrollingMode:andLock:]):
+ (-[WebDynamicScrollBarsView setScrollingMode:]):
+ (-[WebDynamicScrollBarsView setScrollingMode:andLock:]):
+ * WebView/WebView.mm:
+ (-[WebView setAlwaysShowVerticalScroller:]):
+ (-[WebView setAlwaysShowHorizontalScroller:]):
+
2007-07-06 Mitz Pettel <mitz@webkit.org>
Reviewed by Maciej.
BOOL scrollsVertically;
BOOL scrollsHorizontally;
- if (!suppressLayout && !suppressScrollers &&
- (hScroll == WebCoreScrollbarAuto || vScroll == WebCoreScrollbarAuto))
- {
+ if (!suppressLayout && !suppressScrollers && (hScroll == WebCoreScrollbarAuto || vScroll == WebCoreScrollbarAuto)) {
// Do a layout if pending, before checking if scrollbars are needed.
// This fixes 2969367, although may introduce a slowdown in live resize performance.
NSView *documentView = [self documentView];
[(id <WebDocumentView>)documentView setNeedsLayout: YES];
[(id <WebDocumentView>)documentView layout];
}
-
+
NSSize documentSize = [documentView frame].size;
NSSize frameSize = [self frame].size;
-
+
scrollsVertically = (vScroll == WebCoreScrollbarAlwaysOn) ||
(vScroll == WebCoreScrollbarAuto && documentSize.height > frameSize.height);
if (scrollsVertically)
scrollsVertically = (vScroll == WebCoreScrollbarAlwaysOn) ||
(vScroll == WebCoreScrollbarAuto && documentSize.height + [NSScroller scrollerWidth] > frameSize.height);
}
- }
- else {
+ } else {
scrollsHorizontally = (hScroll == WebCoreScrollbarAuto) ? hasHorizontalScroller : (hScroll == WebCoreScrollbarAlwaysOn);
scrollsVertically = (vScroll == WebCoreScrollbarAuto) ? hasVerticalScroller : (vScroll == WebCoreScrollbarAlwaysOn);
}
-
+
if (hasVerticalScroller != scrollsVertically) {
[self setHasVerticalScroller:scrollsVertically];
hasVerticalScroller = scrollsVertically;
[[self verticalScroller] setNeedsDisplay: NO];
[[self horizontalScroller] setNeedsDisplay: NO];
}
-
+
inUpdateScrollers = false;
}
}
- (void)setHorizontalScrollingMode:(WebCoreScrollbarMode)mode
+{
+ [self setHorizontalScrollingMode:mode andLock:NO];
+}
+
+- (void)setHorizontalScrollingMode:(WebCoreScrollbarMode)mode andLock:(BOOL)lock
{
if (mode == hScroll || hScrollModeLocked)
return;
+
hScroll = mode;
+
+ if (lock)
+ [self setHorizontalScrollingModeLocked:YES];
+
[self updateScrollers];
}
- (void)setVerticalScrollingMode:(WebCoreScrollbarMode)mode
+{
+ [self setVerticalScrollingMode:mode andLock:NO];
+}
+
+- (void)setVerticalScrollingMode:(WebCoreScrollbarMode)mode andLock:(BOOL)lock
{
if (mode == vScroll || vScrollModeLocked)
return;
+
vScroll = mode;
+
+ if (lock)
+ [self setVerticalScrollingModeLocked:YES];
+
[self updateScrollers];
}
- (void)setScrollingMode:(WebCoreScrollbarMode)mode
+{
+ [self setScrollingMode:mode andLock:NO];
+}
+
+- (void)setScrollingMode:(WebCoreScrollbarMode)mode andLock:(BOOL)lock
{
if ((mode == vScroll && mode == hScroll) || (vScrollModeLocked && hScrollModeLocked))
return;
update = YES;
}
+ if (lock)
+ [self setScrollingModesLocked:YES];
+
if (update)
[self updateScrollers];
}
{
WebDynamicScrollBarsView *scrollview = (WebDynamicScrollBarsView *)[[[self mainFrame] frameView] _scrollView];
if (flag) {
- [scrollview setVerticalScrollingMode:WebCoreScrollbarAlwaysOn];
- [scrollview setVerticalScrollingModeLocked:YES];
+ [scrollview setVerticalScrollingMode:WebCoreScrollbarAlwaysOn andLock:YES];
} else {
[scrollview setVerticalScrollingModeLocked:NO];
[scrollview setVerticalScrollingMode:WebCoreScrollbarAuto];
{
WebDynamicScrollBarsView *scrollview = (WebDynamicScrollBarsView *)[[[self mainFrame] frameView] _scrollView];
if (flag) {
- [scrollview setHorizontalScrollingMode:WebCoreScrollbarAlwaysOn];
- [scrollview setHorizontalScrollingModeLocked:YES];
+ [scrollview setHorizontalScrollingMode:WebCoreScrollbarAlwaysOn andLock:YES];
} else {
[scrollview setHorizontalScrollingModeLocked:NO];
[scrollview setHorizontalScrollingMode:WebCoreScrollbarAuto];