[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:51:27 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 9cc54cfcd3c311b491de9a8f24047f162968ee89
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Oct 20 19:59:42 2002 +0000

    	- fixed a problem where you would get garbage bits when resizing while loading a standalone image
    
    	Cleaned up some of the complexity of how we were handling resizing.
    
            * WebView.subproj/WebDynamicScrollBarsView.m: (-[WebDynamicScrollBarsView updateScrollers]):
    	Do the update twice to properly handle the case where a disappearing scroller makes a second
    	scroller appear or vice versa.
    
            * WebView.subproj/WebFramePrivate.m: (-[WebFrame _setState:]): Remove the code that was trying
    	to set the setDrawsBackground flag on the scroll view. It was doing it wrong, causing bugs with
    	drawing non-HTML views while loading. Also, it wasn't working as an optimization, since the
    	window was still drawing the metallic background behind. We can revisit adding an optimization
    	at the WebHTMLView level if it creates a measurable speed increase, but we must be careful to
    	test loading with non-HTML views along with the HTML cases.
    
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView _setNeedsLayoutToYes:]): Added. Calls setNeedsLayout:YES.
            (-[WebHTMLView viewWillMoveToSuperview:]): Added. Registers so we get _setNeedsLayoutToYes:
    	calls when the superview's size changes. This allows us to do a layout at all the right times.
            (-[WebHTMLView layout]): Call setNeedsDisplay:YES, because if we do a layout without a complete
    	display the screen will look bad. Also do a reapplyStyles, because if there are pending style
    	changes we want to apply them before doing a layout since they could affect the layout.
            (-[WebHTMLView drawRect:]): Remove the special case that says to always relayout during live
    	resize, because it works without a special case now. For the other live resize case, turn it from
    	a special case into a general one. Any time layout is done, make sure to draw the entire view,
    	not just the passed-in rectangle, and call setNeedsDisplay:NO so we don't do it all over again.
    
            * WebView.subproj/WebImageView.m: (-[WebImageView layout]): Explicitly set frame size to
    	0,0 when there is no image.
    
            * WebView.subproj/WebView.m: Remove now-unnecessary viewWillStartLiveResize, setFrame:,
    	viewDidEndLiveResize, isOpaque, and drawRect overrides.
            (-[WebView initWithFrame:]): Don't call setDrawsBackground:NO for the reasons above.
    	Don't set scroll bar visibility because the dynamic scroll bars view handles that already.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2381 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index a041974..534fed0 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,40 @@
+2002-10-20  Darin Adler  <darin at apple.com>
+
+	- fixed a problem where you would get garbage bits when resizing while loading a standalone image
+
+	Cleaned up some of the complexity of how we were handling resizing.
+
+        * WebView.subproj/WebDynamicScrollBarsView.m: (-[WebDynamicScrollBarsView updateScrollers]):
+	Do the update twice to properly handle the case where a disappearing scroller makes a second
+	scroller appear or vice versa.
+
+        * WebView.subproj/WebFramePrivate.m: (-[WebFrame _setState:]): Remove the code that was trying
+	to set the setDrawsBackground flag on the scroll view. It was doing it wrong, causing bugs with
+	drawing non-HTML views while loading. Also, it wasn't working as an optimization, since the
+	window was still drawing the metallic background behind. We can revisit adding an optimization
+	at the WebHTMLView level if it creates a measurable speed increase, but we must be careful to
+	test loading with non-HTML views along with the HTML cases.
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView _setNeedsLayoutToYes:]): Added. Calls setNeedsLayout:YES.
+        (-[WebHTMLView viewWillMoveToSuperview:]): Added. Registers so we get _setNeedsLayoutToYes:
+	calls when the superview's size changes. This allows us to do a layout at all the right times.
+        (-[WebHTMLView layout]): Call setNeedsDisplay:YES, because if we do a layout without a complete
+	display the screen will look bad. Also do a reapplyStyles, because if there are pending style
+	changes we want to apply them before doing a layout since they could affect the layout.
+        (-[WebHTMLView drawRect:]): Remove the special case that says to always relayout during live
+	resize, because it works without a special case now. For the other live resize case, turn it from
+	a special case into a general one. Any time layout is done, make sure to draw the entire view,
+	not just the passed-in rectangle, and call setNeedsDisplay:NO so we don't do it all over again.
+
+        * WebView.subproj/WebImageView.m: (-[WebImageView layout]): Explicitly set frame size to
+	0,0 when there is no image.
+
+        * WebView.subproj/WebView.m: Remove now-unnecessary viewWillStartLiveResize, setFrame:,
+	viewDidEndLiveResize, isOpaque, and drawRect overrides.
+        (-[WebView initWithFrame:]): Don't call setDrawsBackground:NO for the reasons above.
+	Don't set scroll bar visibility because the dynamic scroll bars view handles that already.
+
 2002-10-19  Darin Adler  <darin at apple.com>
 
 	- fixed 3073693 -- flash drawn to screen even when window minimized
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index a041974..534fed0 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,40 @@
+2002-10-20  Darin Adler  <darin at apple.com>
+
+	- fixed a problem where you would get garbage bits when resizing while loading a standalone image
+
+	Cleaned up some of the complexity of how we were handling resizing.
+
+        * WebView.subproj/WebDynamicScrollBarsView.m: (-[WebDynamicScrollBarsView updateScrollers]):
+	Do the update twice to properly handle the case where a disappearing scroller makes a second
+	scroller appear or vice versa.
+
+        * WebView.subproj/WebFramePrivate.m: (-[WebFrame _setState:]): Remove the code that was trying
+	to set the setDrawsBackground flag on the scroll view. It was doing it wrong, causing bugs with
+	drawing non-HTML views while loading. Also, it wasn't working as an optimization, since the
+	window was still drawing the metallic background behind. We can revisit adding an optimization
+	at the WebHTMLView level if it creates a measurable speed increase, but we must be careful to
+	test loading with non-HTML views along with the HTML cases.
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView _setNeedsLayoutToYes:]): Added. Calls setNeedsLayout:YES.
+        (-[WebHTMLView viewWillMoveToSuperview:]): Added. Registers so we get _setNeedsLayoutToYes:
+	calls when the superview's size changes. This allows us to do a layout at all the right times.
+        (-[WebHTMLView layout]): Call setNeedsDisplay:YES, because if we do a layout without a complete
+	display the screen will look bad. Also do a reapplyStyles, because if there are pending style
+	changes we want to apply them before doing a layout since they could affect the layout.
+        (-[WebHTMLView drawRect:]): Remove the special case that says to always relayout during live
+	resize, because it works without a special case now. For the other live resize case, turn it from
+	a special case into a general one. Any time layout is done, make sure to draw the entire view,
+	not just the passed-in rectangle, and call setNeedsDisplay:NO so we don't do it all over again.
+
+        * WebView.subproj/WebImageView.m: (-[WebImageView layout]): Explicitly set frame size to
+	0,0 when there is no image.
+
+        * WebView.subproj/WebView.m: Remove now-unnecessary viewWillStartLiveResize, setFrame:,
+	viewDidEndLiveResize, isOpaque, and drawRect overrides.
+        (-[WebView initWithFrame:]): Don't call setDrawsBackground:NO for the reasons above.
+	Don't set scroll bar visibility because the dynamic scroll bars view handles that already.
+
 2002-10-19  Darin Adler  <darin at apple.com>
 
 	- fixed 3073693 -- flash drawn to screen even when window minimized
diff --git a/WebKit/WebView.subproj/WebDynamicScrollBarsView.m b/WebKit/WebView.subproj/WebDynamicScrollBarsView.m
index 98f6c46..faf1509 100644
--- a/WebKit/WebView.subproj/WebDynamicScrollBarsView.m
+++ b/WebKit/WebView.subproj/WebDynamicScrollBarsView.m
@@ -15,35 +15,44 @@
 
 - (void)updateScrollers
 {
-    BOOL scrollsVertically;
-    BOOL scrollsHorizontally;
-
-    if (disallowsScrolling) {
-        scrollsVertically = NO;
-        scrollsHorizontally = NO;
-    } else {
-        // Force a layout before checking if scrollbars are needed.
-        // This fixes 2969367, although may introduce a slowdown in live resize performance.
-        NSView *documentView = [self documentView];
-        if ([documentView conformsToProtocol:@protocol(WebDocumentView)]) {
-            [(id <WebDocumentView>)documentView layout];
-        }
-        
-        NSSize documentSize = [documentView frame].size;
-        NSSize frameSize = [self frame].size;
-        
-        scrollsVertically = documentSize.height > frameSize.height;
-        if (scrollsVertically)
-            scrollsHorizontally = documentSize.width + [NSScroller scrollerWidth] > frameSize.width;
-        else {
-            scrollsHorizontally = documentSize.width > frameSize.width;
-            if (scrollsHorizontally)
-                scrollsVertically = documentSize.height + [NSScroller scrollerWidth] > frameSize.height;
+    // We need to do the work below twice in the case where a scroll bar disappears,
+    // making the second layout have a wider width than the first. Doing it more than
+    // twice would indicate some kind of infinite loop, so we do it at most twice.
+    // It's quite efficient to do this work twice in the normal case, so we don't bother
+    // trying to figure out of the second pass is needed or not.
+    
+    int pass;
+    for (pass = 0; pass < 2; pass++) {
+        BOOL scrollsVertically;
+        BOOL scrollsHorizontally;
+    
+        if (disallowsScrolling) {
+            scrollsVertically = NO;
+            scrollsHorizontally = NO;
+        } else {
+            // 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];
+            if ([documentView conformsToProtocol:@protocol(WebDocumentView)]) {
+                [(id <WebDocumentView>)documentView layout];
+            }
+            
+            NSSize documentSize = [documentView frame].size;
+            NSSize frameSize = [self frame].size;
+            
+            scrollsVertically = documentSize.height > frameSize.height;
+            if (scrollsVertically)
+                scrollsHorizontally = documentSize.width + [NSScroller scrollerWidth] > frameSize.width;
+            else {
+                scrollsHorizontally = documentSize.width > frameSize.width;
+                if (scrollsHorizontally)
+                    scrollsVertically = documentSize.height + [NSScroller scrollerWidth] > frameSize.height;
+            }
         }
+    
+        [self setHasVerticalScroller:scrollsVertically];
+        [self setHasHorizontalScroller:scrollsHorizontally];
     }
-
-    [self setHasVerticalScroller:scrollsVertically];
-    [self setHasHorizontalScroller:scrollsHorizontally];
 }
 
 // Make the horizontal and vertical scroll bars come and go as needed.
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index a58c795..5a1965b 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -393,14 +393,7 @@ static const char * const stateNames[] = {
     
     _private->state = newState;
     
-    if (_private->state == WebFrameStateProvisional){
-        [[[self webView] frameScrollView] setDrawsBackground: NO];
-    }
-    
-    if (_private->state == WebFrameStateComplete){
-        NSScrollView *sv = [[self webView] frameScrollView];
-        [sv setDrawsBackground: YES];
-        [[sv contentView] setCopiesOnScroll: YES];
+    if (_private->state == WebFrameStateComplete) {
         [_private->scheduledLayoutTimer fire];
    	ASSERT(_private->scheduledLayoutTimer == nil);
     }
diff --git a/WebKit/WebView.subproj/WebFrameView.m b/WebKit/WebView.subproj/WebFrameView.m
index d67ce66..0f93d4e 100644
--- a/WebKit/WebView.subproj/WebFrameView.m
+++ b/WebKit/WebView.subproj/WebFrameView.m
@@ -83,12 +83,9 @@ NSString *WebErrorDomainWebKit = @"WebErrorDomainWebKit";
     _private = [[WebViewPrivate alloc] init];
 
     WebDynamicScrollBarsView *scrollView  = [[WebDynamicScrollBarsView alloc] initWithFrame: NSMakeRect(0,0,frame.size.width,frame.size.height)];
+    [scrollView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
     _private->frameScrollView = scrollView;
-    [scrollView setContentView: [[[WebClipView alloc] initWithFrame:[scrollView bounds]] autorelease]];
-    [scrollView setDrawsBackground: NO];
-    [scrollView setHasVerticalScroller: NO];
-    [scrollView setHasHorizontalScroller: NO];
-    [scrollView setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
+    [scrollView setContentView:[[[WebClipView alloc] initWithFrame:[scrollView bounds]] autorelease]];
     [self addSubview: scrollView];
     
     [self registerForDraggedTypes:[NSPasteboard _web_dragTypesForURL]];
@@ -107,29 +104,6 @@ NSString *WebErrorDomainWebKit = @"WebErrorDomainWebKit";
     [super dealloc];
 }
 
-- (void)viewWillStartLiveResize
-{
-}
-
-
-- (void)setFrame: (NSRect)f
-{
-    if (!NSEqualRects(f, [self frame]))
-        [[self documentView] setNeedsLayout: YES];
-        
-    [super setFrame: f];
-    
-    // We have to force a display now, rather than depend on
-    // setNeedsDisplay: or we will get drawing turds under the
-    // scrollbar frames.
-    if ([self inLiveResize] && [self _isMainFrame])
-        [[self window] displayIfNeeded];
-}
-
-- (void)viewDidEndLiveResize
-{
-}
-
 - (void)setAllowsScrolling: (BOOL)flag
 {
     [[self frameScrollView] setAllowsScrolling: flag];
@@ -216,20 +190,6 @@ NSString *WebErrorDomainWebKit = @"WebErrorDomainWebKit";
     return YES;
 }
 
-- (BOOL)isOpaque
-{
-    return YES;
-}
-
-- (void)drawRect:(NSRect)rect
-{
-    if ([self documentView] == nil) {
-        // Need to paint ourselves if there's no documentView to do it instead.
-        [[NSColor whiteColor] set];
-        NSRectFill(rect);
-    }
-}
-
 - (NSWindow *)window
 {
     NSWindow *window = [super window];
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index d0916fe..e6f7472 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -175,6 +175,37 @@
     [[NSNotificationCenter defaultCenter] removeObserver: self name: NSWindowDidResignMainNotification object: nil];
 }
 
+- (void)_setNeedsLayoutToYes:(NSNotification *)notification
+{
+    [self setNeedsLayout:YES];
+}
+
+- (void)viewWillMoveToSuperview:(NSView *)newSuperview
+{
+    // We watch the bounds of our superview, so that we can do a layout when the size
+    // of the superview changes. This is different from other scrollable things that don't
+    // need this kind of thing because their layout doesn't change.
+    
+    // We need to pay attention to both height and width because, our "layout" has to change
+    // to extend the background the full height of the space.
+    
+    NSView *oldSuperview = [self superview];
+    
+    if (oldSuperview) {
+        [[NSNotificationCenter defaultCenter] removeObserver:self
+            name:NSViewFrameDidChangeNotification object:oldSuperview];
+        [[NSNotificationCenter defaultCenter] removeObserver:self
+            name:NSViewBoundsDidChangeNotification object:oldSuperview];
+    }
+
+    if (newSuperview) {
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_setNeedsLayoutToYes:) 
+            name:NSViewFrameDidChangeNotification object:newSuperview];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_setNeedsLayoutToYes:) 
+            name:NSViewBoundsDidChangeNotification object:newSuperview];
+    }
+}
+
 - (void)viewWillMoveToWindow:(NSWindow *)window
 {
     [self removeMouseMovedObserver];
@@ -224,6 +255,8 @@
 
 - (void)layout
 {
+    [self reapplyStyles];
+    
     // Ensure that we will receive mouse move events.  Is this the best place to put this?
     [[self window] setAcceptsMouseMovedEvents: YES];
     [[self window] _setShouldPostEventNotifications: YES];
@@ -239,6 +272,8 @@
     LOG(View, "%@ doing layout", self);
     [[self _bridge] forceLayout];
     _private->needsLayout = NO;
+    
+    [self setNeedsDisplay:YES];
 
 #ifdef _KWQ_TIMING        
     double thisTime = CFAbsoluteTimeGetCurrent() - start;
@@ -369,7 +404,6 @@
     _private->needsToApplyStyles = flag;
 }
 
-
 - (void)_drawBorder: (int)type
 {
     switch (type){
@@ -442,18 +476,13 @@
         [self _restoreSubviews];
     }
     
-    if ([self inLiveResize]) {
-        if (!NSEqualRects(rect, [self visibleRect])) {
-            [self setNeedsLayout:YES];
-        }
-    }
-    
-    [self reapplyStyles];
+    BOOL didReapplyStylesOrLayout = _private->needsToApplyStyles || _private->needsLayout;
 
     [self layout];
 
-    if ([self inLiveResize]) {
+    if (didReapplyStylesOrLayout) {
         rect = [self visibleRect];
+        [self setNeedsDisplay:NO];
     }
     
 #ifdef _KWQ_TIMING
diff --git a/WebKit/WebView.subproj/WebImageView.m b/WebKit/WebView.subproj/WebImageView.m
index 3b032b0..c1d7d24 100644
--- a/WebKit/WebView.subproj/WebImageView.m
+++ b/WebKit/WebView.subproj/WebImageView.m
@@ -13,7 +13,7 @@
 @implementation WebImageView
 
 - (id)initWithFrame:(NSRect)frame
-{    
+{
     self = [super initWithFrame:frame];
     if (self) {
         canDragFrom = YES;
@@ -58,9 +58,9 @@
     WebImageRenderer *image = [representation image];
     if (image) {
         [self setFrameSize:[image size]];
-        [image setFlipped:YES];
+    } else {
+        [self setFrameSize:NSMakeSize(0, 0)];
     }
-
 }
 
 - (void)setAcceptsDrags: (BOOL)flag

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list