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

hyatt hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:58:10 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 0061d206db7e2932b3b68a1fdef3df4b8fc1e50d
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Sep 26 00:58:11 2003 +0000

    	Change layout so that it is called from the private _recursive functions instead of
    	inside drawRect.
    
            Reviewed by kocienda
    
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView layoutToPageWidth:adjustingViewSize:]):
            (-[WebHTMLView drawRect:]):
            * WebView.subproj/WebHTMLViewPrivate.m:
            (-[WebHTMLView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:testDirtyRect:]):
            (-[WebHTMLView _recursiveDisplayAllDirtyWithLockFocus:visRect:]):
            (-[WebHTMLView _web_setPrintingModeRecursive]):
            (-[WebHTMLView _web_clearPrintingModeRecursive]):
            (-[WebHTMLView _web_layoutIfNeededRecursive:testDirtyRect:]):
            (-[NSView _web_setPrintingModeRecursive]):
            (-[NSView _web_clearPrintingModeRecursive]):
            (-[NSView _web_layoutIfNeededRecursive:testDirtyRect:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5069 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 3373227..05b62c2 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,23 @@
+2003-09-25  David Hyatt  <hyatt at apple.com>
+
+	Change layout so that it is called from the private _recursive functions instead of
+	inside drawRect.
+	
+        Reviewed by kocienda
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView layoutToPageWidth:adjustingViewSize:]):
+        (-[WebHTMLView drawRect:]):
+        * WebView.subproj/WebHTMLViewPrivate.m:
+        (-[WebHTMLView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:testDirtyRect:]):
+        (-[WebHTMLView _recursiveDisplayAllDirtyWithLockFocus:visRect:]):
+        (-[WebHTMLView _web_setPrintingModeRecursive]):
+        (-[WebHTMLView _web_clearPrintingModeRecursive]):
+        (-[WebHTMLView _web_layoutIfNeededRecursive:testDirtyRect:]):
+        (-[NSView _web_setPrintingModeRecursive]):
+        (-[NSView _web_clearPrintingModeRecursive]):
+        (-[NSView _web_layoutIfNeededRecursive:testDirtyRect:]):
+
 2003-09-25  Richard Williamson   <rjw at apple.com>
 
 	Fixed 3433802.  Written by Ed.  Carbon WebView doesn't detach native view when removed.
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 22d7fa1..8c7fff8 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -368,8 +368,6 @@
 	_private->lastLayoutSize = [(NSClipView *)[self superview] documentVisibleRect].size;
         _private->lastLayoutFrameSize = newLayoutFrameSize;
     }
-    
-    [self setNeedsDisplay:YES];
 
 #ifdef _KWQ_TIMING        
     double thisTime = CFAbsoluteTimeGetCurrent() - start;
@@ -468,39 +466,6 @@
         [self _restoreSubviews];
     }
 
-    // This helps when we print as part of a larger print process.
-    // If the WebHTMLView itself is what we're printing, then we will never have to do this.
-    BOOL wasInPrintingMode = _private->printing;
-    BOOL isPrinting = ![NSGraphicsContext currentContextDrawingToScreen];
-    if (wasInPrintingMode != isPrinting) {
-        [self _setPrinting:isPrinting pageWidth:0 adjustViewSize:NO];
-    }
-    
-    if ([[self _bridge] needsLayout]) {
-        _private->needsLayout = YES;
-    }
-    BOOL didReapplyStylesOrLayout = _private->needsToApplyStyles || _private->needsLayout;
-
-    [self layout];
-
-    if (didReapplyStylesOrLayout) {
-        // If we reapplied styles or did layout, we would like to draw as much as possible right now.
-        // If we can draw the entire view, then we don't need to come back and display, even though
-        // layout will have called setNeedsDisplay:YES to make that happen.
-        NSRect visibleRect = [self visibleRect];
-        CGRect clipBoundingBoxCG = CGContextGetClipBoundingBox((CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]);
-        NSRect clipBoundingBox = NSMakeRect(clipBoundingBoxCG.origin.x, clipBoundingBoxCG.origin.y,
-            clipBoundingBoxCG.size.width, clipBoundingBoxCG.size.height);
-        // If the clip is such that we can draw the entire view instead of just the requested bit,
-        // then we will do just that. Note that this works only for rectangular clip, because we
-        // are only checking if the clip's bounding box contains the rect; we would prefer to check
-        // if the clip contained it, but that's not possible.
-        if (NSContainsRect(clipBoundingBox, visibleRect)) {
-            rect = visibleRect;
-            [self setNeedsDisplay:NO];
-        }
-    }
-    
 #ifdef _KWQ_TIMING
     double start = CFAbsoluteTimeGetCurrent();
 #endif
@@ -560,10 +525,6 @@
     LOG(Timing, "%s draw seconds = %f", widget->part()->baseURL().URL().latin1(), thisTime);
 #endif
 
-    if (wasInPrintingMode != isPrinting) {
-        [self _setPrinting:wasInPrintingMode pageWidth:0 adjustViewSize:NO];
-    }
-
     if (subviewsWereSetAside) {
         [self _setAsideSubviews];
     }
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.m b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
index d0b5afc..8360742 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.m
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
@@ -41,19 +41,26 @@
 #define DRAG_LINK_LABEL_FONT_SIZE   11.0
 #define DRAG_LINK_URL_FONT_SIZE   10.0
 
+static BOOL forceRealHitTest = NO;
+
+ at interface WebHTMLView (WebHTMLViewPrivate)
+- (void)_setPrinting:(BOOL)printing pageWidth:(float)pageWidth adjustViewSize:(BOOL)adjustViewSize;
+ at end
+
 // Any non-zero value will do, but using somethign recognizable might help us debug some day.
 #define TRACKING_RECT_TAG 0xBADFACE
 
-static BOOL forceRealHitTest = NO;
 
 @interface NSView (AppKitSecretsIKnowAbout)
-- (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)rect isVisibleRect:(BOOL)isVisibleRect rectIsVisibleRectForView:(NSView *)visibleView topView:(BOOL)topView;
+- (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)rect isVisibleRect:(BOOL)isVisibleRect rectIsVisibleRectForView:(NSView *)visibleView testDirtyRect:(BOOL)testDirtyRect;
 - (void)_recursiveDisplayAllDirtyWithLockFocus:(BOOL)needsLockFocus visRect:(NSRect)visRect;
 - (NSRect)_dirtyRect;
 @end
 
 @interface NSView (WebHTMLViewPrivate)
-- (void)_web_propagateDirtyRectToAncestor;
+- (void)_web_setPrintingModeRecursive;
+- (void)_web_clearPrintingModeRecursive;
+- (void)_web_layoutIfNeededRecursive:(NSRect)rect testDirtyRect:(bool)testDirtyRect;
 @end
 
 @interface NSMutableDictionary (WebHTMLViewPrivate)
@@ -203,36 +210,71 @@ static BOOL forceRealHitTest = NO;
 }
 
 // Don't let AppKit even draw subviews. We take care of that.
-- (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)rect isVisibleRect:(BOOL)isVisibleRect rectIsVisibleRectForView:(NSView *)visibleView topView:(BOOL)topView
-{
-    // The _setDrawsDescendants: mechanism now takes care of this for us.
-    // But only in AppKit-722 and newer.
-    if (NSAppKitVersionNumber < 722) {
-        [_subviews makeObjectsPerformSelector:@selector(_web_propagateDirtyRectToAncestor)];
+- (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)rect isVisibleRect:(BOOL)isVisibleRect rectIsVisibleRectForView:(NSView *)visibleView testDirtyRect:(BOOL)testDirtyRect
+{
+    // This helps when we print as part of a larger print process.
+    // If the WebHTMLView itself is what we're printing, then we will never have to do this.
+    BOOL wasInPrintingMode = _private->printing;
+    BOOL isPrinting = ![NSGraphicsContext currentContextDrawingToScreen];
+    if (wasInPrintingMode != isPrinting) {
+        if (isPrinting) {
+            [self _web_setPrintingModeRecursive];
+        } else {
+            [self _web_clearPrintingModeRecursive];
+        }
     }
+
+    [self _web_layoutIfNeededRecursive: rect testDirtyRect:YES];
+
     [self _setAsideSubviews];
     [super _recursiveDisplayRectIfNeededIgnoringOpacity:rect isVisibleRect:isVisibleRect
-        rectIsVisibleRectForView:visibleView topView:topView];
+        rectIsVisibleRectForView:visibleView testDirtyRect:testDirtyRect];
     [self _restoreSubviews];
+
+    if (wasInPrintingMode != isPrinting) {
+        if (wasInPrintingMode) {
+            [self _web_setPrintingModeRecursive];
+        } else {
+            [self _web_clearPrintingModeRecursive];
+        }
+    }
 }
 
 // Don't let AppKit even draw subviews. We take care of that.
 - (void)_recursiveDisplayAllDirtyWithLockFocus:(BOOL)needsLockFocus visRect:(NSRect)visRect
 {
     BOOL needToSetAsideSubviews = !_private->subviewsSetAside;
-    
+
+    BOOL wasInPrintingMode = _private->printing;
+    BOOL isPrinting = ![NSGraphicsContext currentContextDrawingToScreen];
+
     if (needToSetAsideSubviews) {
-        // The _setDrawsDescendants: mechanism now takes care of this for us.
-        // But only in AppKit-722 and newer.
-        if (NSAppKitVersionNumber < 722) {
-            [_subviews makeObjectsPerformSelector:@selector(_web_propagateDirtyRectToAncestor)];
+        // This helps when we print as part of a larger print process.
+        // If the WebHTMLView itself is what we're printing, then we will never have to do this.
+        if (wasInPrintingMode != isPrinting) {
+            if (isPrinting) {
+                [self _web_setPrintingModeRecursive];
+            } else {
+                [self _web_clearPrintingModeRecursive];
+            }
         }
+
+        [self _web_layoutIfNeededRecursive: visRect testDirtyRect:NO];
+
         [self _setAsideSubviews];
     }
     
     [super _recursiveDisplayAllDirtyWithLockFocus:needsLockFocus visRect:visRect];
     
     if (needToSetAsideSubviews) {
+        if (wasInPrintingMode != isPrinting) {
+            if (wasInPrintingMode) {
+                [self _web_setPrintingModeRecursive];
+            } else {
+                [self _web_clearPrintingModeRecursive];
+            }
+        }
+
         [self _restoreSubviews];
     }
 }
@@ -650,6 +692,39 @@ static WebHTMLView *lastHitView = nil;
     return _private->pluginController;
 }
 
+- (void)_web_setPrintingModeRecursive
+{
+    [self _setPrinting:YES pageWidth:0 adjustViewSize:NO];
+    [super _web_setPrintingModeRecursive];
+}
+
+- (void)_web_clearPrintingModeRecursive
+{
+    [self _setPrinting:NO pageWidth:0 adjustViewSize:NO];
+    [super _web_clearPrintingModeRecursive];
+}
+
+- (void)_web_layoutIfNeededRecursive:(NSRect)displayRect testDirtyRect:(bool)testDirtyRect
+{
+    ASSERT(!_private->subviewsSetAside);
+    displayRect = NSIntersectionRect(displayRect, [self bounds]);
+
+    if (!testDirtyRect || [self needsDisplay]) {
+        if (testDirtyRect) {
+            NSRect dirtyRect = [self _dirtyRect];
+            displayRect = NSIntersectionRect(displayRect, dirtyRect);
+        }
+        if (!NSIsEmptyRect(displayRect)) {
+            if ([[self _bridge] needsLayout])
+                _private->needsLayout = YES;
+            if (_private->needsToApplyStyles || _private->needsLayout)
+                [self layout];
+        }
+    }
+
+    [super _web_layoutIfNeededRecursive: displayRect testDirtyRect: NO];
+}
+
 - (NSRect)_selectionRect
 {
     return [[self _bridge] selectionRect];
@@ -692,11 +767,23 @@ static WebHTMLView *lastHitView = nil;
 
 @implementation NSView (WebHTMLViewPrivate)
 
-- (void)_web_propagateDirtyRectToAncestor
+- (void)_web_setPrintingModeRecursive
+{
+    [_subviews makeObjectsPerformSelector:@selector(_web_setPrintingModeRecursive)];
+}
+
+- (void)_web_clearPrintingModeRecursive
+{
+    [_subviews makeObjectsPerformSelector:@selector(_web_clearPrintingModeRecursive)];
+}
+
+- (void)_web_layoutIfNeededRecursive: (NSRect)rect testDirtyRect:(bool)testDirtyRect
 {
-    [_subviews makeObjectsPerformSelector:@selector(_web_propagateDirtyRectToAncestor)];
-    if ([self needsDisplay]) {
-        [[self superview] setNeedsDisplayInRect:[self convertRect:[self _dirtyRect] toView:[self superview]]];
+    unsigned index, count;
+    for (index = 0, count = [_subviews count]; index < count; index++) {
+        NSView *subview = [_subviews objectAtIndex:index];
+        NSRect dirtiedSubviewRect = [subview convertRect: rect fromView: self];
+        [subview _web_layoutIfNeededRecursive: dirtiedSubviewRect testDirtyRect:testDirtyRect];
     }
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list