Reviewed by Darin.
authoradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Aug 2007 22:05:24 +0000 (22:05 +0000)
committeradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Aug 2007 22:05:24 +0000 (22:05 +0000)
        Fix for http://bugs.webkit.org/show_bug.cgi?id=15098
        <rdar://problem/5440319> REGRESSION (9A530-9A534): Double scroll bar on pdfs

        * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::makeDocumentView):
         Don't suppress scrollbars before the view creation if we're making the view for a non-html view

        * WebView/WebFrameViewInternal.h: Make _scrollView return a WebDynamicScrollBarsView since so many clients were relying on it being that type anyway.
        * WebView/WebFrameView.mm:
        (-[WebFrameView _setDocumentView:]):
        (-[WebFrameView _scrollView]):
        (-[WebFrameView setAllowsScrolling:]):
        (-[WebFrameView allowsScrolling]):
        * WebView/WebView.mm:
        (-[WebView setAlwaysShowVerticalScroller:]):
        (-[WebView alwaysShowVerticalScroller]):
        (-[WebView setAlwaysShowHorizontalScroller:]):
        (-[WebView alwaysShowHorizontalScroller]):

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

WebKit/ChangeLog
WebKit/WebCoreSupport/WebFrameLoaderClient.mm
WebKit/WebView/WebFrameView.mm
WebKit/WebView/WebFrameViewInternal.h
WebKit/WebView/WebView.mm

index 0729714a25888cc3b39ff6a1912083ce665f061a..36818283b21b2580a5de3cf2a7fa55cdfbbea4a9 100644 (file)
@@ -1,3 +1,25 @@
+2007-08-29  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Darin.
+
+        Fix for http://bugs.webkit.org/show_bug.cgi?id=15098
+        <rdar://problem/5440319> REGRESSION (9A530-9A534): Double scroll bar on pdfs
+
+        * WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::makeDocumentView):
+         Don't suppress scrollbars before the view creation if we're making the view for a non-html view
+
+        * WebView/WebFrameViewInternal.h: Make _scrollView return a WebDynamicScrollBarsView since so many clients were relying on it being that type anyway.
+        * WebView/WebFrameView.mm:
+        (-[WebFrameView _setDocumentView:]):
+        (-[WebFrameView _scrollView]):
+        (-[WebFrameView setAllowsScrolling:]):
+        (-[WebFrameView allowsScrolling]):
+        * WebView/WebView.mm:
+        (-[WebView setAlwaysShowVerticalScroller:]):
+        (-[WebView alwaysShowVerticalScroller]):
+        (-[WebView setAlwaysShowHorizontalScroller:]):
+        (-[WebView alwaysShowHorizontalScroller]):
+
 2007-08-29  David Hyatt  <hyatt@apple.com>
 
         The method that was swizzled to fix 5441281 does not exist on Tiger.
index 0fdbd764ceddbac837edeeb0f5ce6e28bc16a625..7796e95847d26bc1540c2720e2ecd64c5ea25fae 100644 (file)
@@ -41,6 +41,7 @@
 #import "WebDocumentInternal.h"
 #import "WebDocumentLoaderMac.h"
 #import "WebDownloadInternal.h"
+#import "WebDynamicScrollBarsView.h"
 #import "WebElementDictionary.h"
 #import "WebFormDelegate.h"
 #import "WebFrameBridge.h"
@@ -155,12 +156,17 @@ void WebFrameLoaderClient::makeDocumentView()
     WebFrameView *v = m_webFrame->_private->webFrameView;
     WebDataSource *ds = [m_webFrame.get() _dataSource];
 
-    bool canSkipCreation = [m_webFrame.get() _frameLoader]->committingFirstRealLoad() && [[WebFrameView class] _viewClassForMIMEType:[[ds response] MIMEType]] == [WebHTMLView class];
+    bool willProduceHTMLView = [[WebFrameView class] _viewClassForMIMEType:[[ds response] MIMEType]] == [WebHTMLView class];
+    bool canSkipCreation = [m_webFrame.get() _frameLoader]->committingFirstRealLoad() && willProduceHTMLView;
     if (canSkipCreation) {
         [[v documentView] setDataSource:ds];
         return;
     }
 
+    // Don't suppress scrollbars before the view creation if we're making the view for a non-HTML view.
+    if (!willProduceHTMLView)
+        [[v _scrollView] setScrollBarsSuppressed:NO repaintOnUnsuppress:NO];
+    
     NSView <WebDocumentView> *documentView = [v _makeDocumentViewForDataSource:ds];
     if (!documentView)
         return;
index 114025e3d80f4c93f0f179b54c154248c4196a9f..8f3c7ec8b6c9f5c63101a51dc360d58b4d12dd50 100644 (file)
@@ -163,7 +163,7 @@ enum {
 
 - (void)_setDocumentView:(NSView <WebDocumentView> *)view
 {
-    WebDynamicScrollBarsView *sv = (WebDynamicScrollBarsView *)[self _scrollView];
+    WebDynamicScrollBarsView *sv = [self _scrollView];
     core([self _webView])->dragController()->setDidInitiateDrag(false);
     
     [sv setSuppressLayout:YES];
@@ -222,7 +222,7 @@ enum {
     _private->webFrame = webFrame;    
 }
 
-- (NSScrollView *)_scrollView
+- (WebDynamicScrollBarsView *)_scrollView
 {
     // this can be called by [super dealloc] when cleaning up the keyview loop,
     // after _private has been nilled out.
@@ -365,7 +365,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
 
 - (void)setAllowsScrolling:(BOOL)flag
 {
-    WebDynamicScrollBarsView *scrollView = (WebDynamicScrollBarsView *)[self _scrollView];
+    WebDynamicScrollBarsView *scrollView = [self _scrollView];
     [scrollView setAllowsScrolling:flag];
     WebCore::Frame *frame = core([self webFrame]);
     if (WebCore::FrameView *view = frame? frame->view() : 0) {
@@ -376,7 +376,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
 
 - (BOOL)allowsScrolling
 {
-    return [(WebDynamicScrollBarsView *)[self _scrollView] allowsScrolling];
+    return [[self _scrollView] allowsScrolling];
 }
 
 - (NSView <WebDocumentView> *)documentView
index 2138bcd080ec8bff3cc06bfb5d7a436cb222d4fc..0304617a59262e5b530564e772180411f286bd82 100644 (file)
@@ -28,6 +28,7 @@
 
 #import <WebKit/WebFrameView.h>
 
+@class WebDynamicScrollBarsView;
 @class WebView;
 
 @interface WebFrameView (WebInternal)
@@ -44,6 +45,6 @@
 + (NSMutableDictionary *)_viewTypesAllowImageTypeOmission:(BOOL)allowImageTypeOmission;
 + (Class)_viewClassForMIMEType:(NSString *)MIMEType;
 + (BOOL)_canShowMIMETypeAsHTML:(NSString *)MIMEType;
-- (NSScrollView *)_scrollView;
+- (WebDynamicScrollBarsView *)_scrollView;
 
 @end
index 7549f2ba2daaacf5024fb00d58e31c18ea347d59..a540e463ed0a41a09e247043724eee3b99ef3044 100644 (file)
@@ -1464,7 +1464,7 @@ WebFrameLoadDelegateImplementationCache WebViewGetFrameLoadDelegateImplementatio
 
 - (void)setAlwaysShowVerticalScroller:(BOOL)flag
 {
-    WebDynamicScrollBarsView *scrollview = (WebDynamicScrollBarsView *)[[[self mainFrame] frameView] _scrollView];
+    WebDynamicScrollBarsView *scrollview = [[[self mainFrame] frameView] _scrollView];
     if (flag) {
         [scrollview setVerticalScrollingMode:WebCoreScrollbarAlwaysOn andLock:YES];
     } else {
@@ -1475,13 +1475,13 @@ WebFrameLoadDelegateImplementationCache WebViewGetFrameLoadDelegateImplementatio
 
 - (BOOL)alwaysShowVerticalScroller
 {
-    WebDynamicScrollBarsView *scrollview = (WebDynamicScrollBarsView *)[[[self mainFrame] frameView] _scrollView];
+    WebDynamicScrollBarsView *scrollview = [[[self mainFrame] frameView] _scrollView];
     return [scrollview verticalScrollingModeLocked] && [scrollview verticalScrollingMode] == WebCoreScrollbarAlwaysOn;
 }
 
 - (void)setAlwaysShowHorizontalScroller:(BOOL)flag
 {
-    WebDynamicScrollBarsView *scrollview = (WebDynamicScrollBarsView *)[[[self mainFrame] frameView] _scrollView];
+    WebDynamicScrollBarsView *scrollview = [[[self mainFrame] frameView] _scrollView];
     if (flag) {
         [scrollview setHorizontalScrollingMode:WebCoreScrollbarAlwaysOn andLock:YES];
     } else {
@@ -1499,7 +1499,7 @@ WebFrameLoadDelegateImplementationCache WebViewGetFrameLoadDelegateImplementatio
 
 - (BOOL)alwaysShowHorizontalScroller
 {
-    WebDynamicScrollBarsView *scrollview = (WebDynamicScrollBarsView *)[[[self mainFrame] frameView] _scrollView];
+    WebDynamicScrollBarsView *scrollview = [[[self mainFrame] frameView] _scrollView];
     return [scrollview horizontalScrollingModeLocked] && [scrollview horizontalScrollingMode] == WebCoreScrollbarAlwaysOn;
 }