Reviewed by John.
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jul 2007 14:40:08 +0000 (14:40 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Jul 2007 14:40:08 +0000 (14:40 +0000)
        <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:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@24060 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/WebView/WebDynamicScrollBarsView.m
WebKit/WebView/WebView.mm

index 32ed86a9aa3394eac9721a5ceaebb25bb3b446d5..bd4a8dbf1d3b99961e575b415a506453ee992252 100644 (file)
@@ -1,3 +1,26 @@
+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.
index 6fcd6c203997541e2b42d4236344b2d7f809e8e4..c7ff77cc2c29744f8aba82d96bd94025e4ef7198 100644 (file)
@@ -69,9 +69,7 @@
         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];
 }
index 9a573dd71766d34e130a4b2d4c26fe1fa825f6aa..34aefac1d9d940ebd624d1ba34e6a773f0b2ea5f 100644 (file)
@@ -1416,8 +1416,7 @@ WebFrameLoadDelegateImplementationCache WebViewGetFrameLoadDelegateImplementatio
 {
     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];
@@ -1434,8 +1433,7 @@ WebFrameLoadDelegateImplementationCache WebViewGetFrameLoadDelegateImplementatio
 {
     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];