[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

simon.fraser at apple.com simon.fraser at apple.com
Thu Apr 8 00:24:54 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 766eff66044b47f287c234705dfbc965dcf0d378
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Dec 7 23:30:34 2009 +0000

    2009-12-07  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Darin Adler.
    
            <rdar://problem/7450481> One compositing test keeps DRT in "compositing mode", breaks repaint tests
    
            The counter that WebView used to keep track of the number of enclosed WebHTMLViews using
            accelerated compositing was hard to manage, and maintained incorrectly in a number of cases.
            This caused one compositing test make DumpRenderTree think that all subsequent tests
            were compositing too.
    
            Replace this counter with notifications, which are only fired if a client (DRT) requests them. The
            notification informs the client that a WebHTMLView entered compositing mode (or an already-
            compositing WebHTML was added); it does not say when a view becomes uncomposited, or all
            compositing subviews were removed, since this is tricky to get right.
    
            Change -[WebView _isUsingAcceleratedCompositing] to manually walk the frames, and
            return YES if any document view is composited.
    
            * WebKit.exp:
            * WebView/WebHTMLView.mm:
            (-[WebHTMLView close]):
            (-[WebHTMLView viewDidMoveToSuperview]):
            (-[WebHTMLView attachRootLayer:]):
            (-[WebHTMLView detachRootLayer]):
            * WebView/WebView.mm:
            (+[WebView automaticallyNotifiesObserversForKey:]):
            (-[WebView _postsAcceleratedCompositingNotifications]):
            (-[WebView _setPostsAcceleratedCompositingNotifications:]):
            (-[WebView _isUsingAcceleratedCompositing]):
            * WebView/WebViewData.h:
            * WebView/WebViewInternal.h:
            * WebView/WebViewPrivate.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51804 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 9cc33e7..982d3eb 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,37 @@
+2009-12-07  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Darin Adler.
+
+        <rdar://problem/7450481> One compositing test keeps DRT in "compositing mode", breaks repaint tests
+
+        The counter that WebView used to keep track of the number of enclosed WebHTMLViews using
+        accelerated compositing was hard to manage, and maintained incorrectly in a number of cases.
+        This caused one compositing test make DumpRenderTree think that all subsequent tests
+        were compositing too.
+        
+        Replace this counter with notifications, which are only fired if a client (DRT) requests them. The
+        notification informs the client that a WebHTMLView entered compositing mode (or an already-
+        compositing WebHTML was added); it does not say when a view becomes uncomposited, or all
+        compositing subviews were removed, since this is tricky to get right.
+        
+        Change -[WebView _isUsingAcceleratedCompositing] to manually walk the frames, and
+        return YES if any document view is composited.
+
+        * WebKit.exp:
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView close]):
+        (-[WebHTMLView viewDidMoveToSuperview]):
+        (-[WebHTMLView attachRootLayer:]):
+        (-[WebHTMLView detachRootLayer]):
+        * WebView/WebView.mm:
+        (+[WebView automaticallyNotifiesObserversForKey:]):
+        (-[WebView _postsAcceleratedCompositingNotifications]):
+        (-[WebView _setPostsAcceleratedCompositingNotifications:]):
+        (-[WebView _isUsingAcceleratedCompositing]):
+        * WebView/WebViewData.h:
+        * WebView/WebViewInternal.h:
+        * WebView/WebViewPrivate.h:
+
 2009-12-07  Gavin Barraclough  <barraclough at apple.com>
 
         Reviewed by Oliver Hunt.
diff --git a/WebKit/mac/WebKit.exp b/WebKit/mac/WebKit.exp
index 64f9947..3aa270f 100644
--- a/WebKit/mac/WebKit.exp
+++ b/WebKit/mac/WebKit.exp
@@ -119,3 +119,4 @@ _WebViewDidEndEditingNotification
 _WebViewProgressEstimateChangedNotification
 _WebViewProgressFinishedNotification
 _WebViewProgressStartedNotification
+__WebViewDidStartAcceleratedCompositingNotification
diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm
index aa1932d..5dc66ee 100644
--- a/WebKit/mac/WebView/WebHTMLView.mm
+++ b/WebKit/mac/WebView/WebHTMLView.mm
@@ -1976,11 +1976,6 @@ static void _updateMouseoverTimerCallback(CFRunLoopTimerRef timer, void *info)
     // remove tooltips before clearing _private so removeTrackingRect: will work correctly
     [self removeAllToolTips];
 
-#if USE(ACCELERATED_COMPOSITING)
-    if (_private->layerHostingView)
-        [[self _webView] _stoppedAcceleratedCompositingForFrame:[self _frame]];
-#endif
-
     [_private clear];
 
     Page* page = core([self _webView]);
@@ -2888,6 +2883,14 @@ WEBCORE_COMMAND(yankAndSelect)
 {
     if ([self superview] != nil)
         [self addSuperviewObservers];
+
+#if USE(ACCELERATED_COMPOSITING)
+    if ([self superview] && [self _isUsingAcceleratedCompositing]) {
+        WebView *webView = [self _webView];
+        if ([webView _postsAcceleratedCompositingNotifications])
+            [[NSNotificationCenter defaultCenter] postNotificationName:_WebViewDidStartAcceleratedCompositingNotification object:webView userInfo:nil];
+    }
+#endif
 }
 
 - (void)viewWillMoveToWindow:(NSWindow *)window
@@ -5413,7 +5416,6 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point)
         [hostingView release];
         // hostingView is owned by being a subview of self
         _private->layerHostingView = hostingView;
-        [[self _webView] _startedAcceleratedCompositingForFrame:[self _frame]];
     }
 
     // Make a container layer, which will get sized/positioned by AppKit and CA.
@@ -5442,6 +5444,9 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point)
     // Parent our root layer in the container layer
     [viewLayer addSublayer:layer];
     
+    if ([[self _webView] _postsAcceleratedCompositingNotifications])
+        [[NSNotificationCenter defaultCenter] postNotificationName:_WebViewDidStartAcceleratedCompositingNotification object:[self _webView] userInfo:nil];
+    
 #if defined(BUILDING_ON_LEOPARD)
     [self _updateLayerHostingViewPosition];
 #endif
@@ -5454,7 +5459,6 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point)
         [_private->layerHostingView setWantsLayer:NO];
         [_private->layerHostingView removeFromSuperview];
         _private->layerHostingView = nil;
-        [[self _webView] _stoppedAcceleratedCompositingForFrame:[self _frame]];
     }
 }
 
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 55f8510..33ea069 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -321,10 +321,6 @@ macro(yankAndSelect) \
 #define AppleKeyboardUIMode CFSTR("AppleKeyboardUIMode")
 #define UniversalAccessDomain CFSTR("com.apple.universalaccess")
 
-#if USE(ACCELERATED_COMPOSITING)
-#define UsingAcceleratedCompositingProperty @"_isUsingAcceleratedCompositing"
-#endif            
-
 static BOOL s_didSetCacheModel;
 static WebCacheModel s_cacheModel = WebCacheModelDocumentViewer;
 
@@ -400,6 +396,8 @@ NSString *_WebMainFrameTitleKey =       @"mainFrameTitle";
 NSString *_WebMainFrameURLKey =         @"mainFrameURL";
 NSString *_WebMainFrameDocumentKey =    @"mainFrameDocument";
 
+NSString *_WebViewDidStartAcceleratedCompositingNotification = @"_WebViewDidStartAcceleratedCompositing";
+
 @interface WebProgressItem : NSObject
 {
 @public
@@ -1553,9 +1551,6 @@ static inline IMP getMethod(id o, SEL s)
     if (!manualNotifyKeys)
         manualNotifyKeys = [[NSSet alloc] initWithObjects:_WebMainFrameURLKey, _WebIsLoadingKey, _WebEstimatedProgressKey,
             _WebCanGoBackKey, _WebCanGoForwardKey, _WebMainFrameTitleKey, _WebMainFrameIconKey, _WebMainFrameDocumentKey,
-#if USE(ACCELERATED_COMPOSITING)
-            UsingAcceleratedCompositingProperty, // used by DRT
-#endif            
             nil];
     if ([manualNotifyKeys containsObject:key])
         return NO;
@@ -2100,10 +2095,35 @@ static inline IMP getMethod(id o, SEL s)
     return handCursor().impl();
 }
 
+- (BOOL)_postsAcceleratedCompositingNotifications
+{
+#if USE(ACCELERATED_COMPOSITING)
+    return _private->postsAcceleratedCompositingNotifications;
+#else
+    return NO;
+#endif
+
+}
+- (void)_setPostsAcceleratedCompositingNotifications:(BOOL)flag
+{
+#if USE(ACCELERATED_COMPOSITING)
+    _private->postsAcceleratedCompositingNotifications = flag;
+#endif
+}
+
 - (BOOL)_isUsingAcceleratedCompositing
 {
 #if USE(ACCELERATED_COMPOSITING)
-    return _private->acceleratedFramesCount > 0;
+    Frame* coreFrame = [self _mainCoreFrame];
+    if (_private->usesDocumentViews) {
+        for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) {
+            NSView *documentView = [[kit(frame) frameView] documentView];
+            if ([documentView isKindOfClass:[WebHTMLView class]] && [(WebHTMLView *)documentView _isUsingAcceleratedCompositing])
+                return YES;
+        }
+    }
+
+    return NO;
 #else
     return NO;
 #endif
@@ -5441,28 +5461,6 @@ static WebFrameView *containingFrameView(NSView *view)
     _private->needsOneShotDrawingSynchronization = needsSynchronization;
 }
 
-- (void)_startedAcceleratedCompositingForFrame:(WebFrame*)webFrame
-{
-    BOOL entering = _private->acceleratedFramesCount == 0;
-    if (entering)
-        [self willChangeValueForKey:UsingAcceleratedCompositingProperty];
-    ++_private->acceleratedFramesCount;
-    if (entering)
-        [self didChangeValueForKey:UsingAcceleratedCompositingProperty];
-}
-
-- (void)_stoppedAcceleratedCompositingForFrame:(WebFrame*)webFrame
-{
-    BOOL leaving = _private->acceleratedFramesCount == 1;
-    ASSERT(_private->acceleratedFramesCount > 0);
-    
-    if (leaving)
-        [self willChangeValueForKey:UsingAcceleratedCompositingProperty];
-    --_private->acceleratedFramesCount;
-    if (leaving)
-        [self didChangeValueForKey:UsingAcceleratedCompositingProperty];
-}
-
 - (BOOL)_syncCompositingChanges
 {
     Frame* frame = [self _mainCoreFrame];
diff --git a/WebKit/mac/WebView/WebViewData.h b/WebKit/mac/WebView/WebViewData.h
index 6ec94a7..37024c7 100644
--- a/WebKit/mac/WebView/WebViewData.h
+++ b/WebKit/mac/WebView/WebViewData.h
@@ -141,8 +141,7 @@ extern int pluginDatabaseClientCount;
     // When this flag is set, next time a WebHTMLView draws, it needs to temporarily disable screen updates
     // so that the NSView drawing is visually synchronized with CALayer updates.
     BOOL needsOneShotDrawingSynchronization;
-    // Number of WebHTMLViews using accelerated compositing. Used to implement _isUsingAcceleratedCompositing.
-    int acceleratedFramesCount;
+    BOOL postsAcceleratedCompositingNotifications;
     // Run loop observer used to implement the compositing equivalent of -viewWillDraw
     CFRunLoopObserverRef layerSyncRunLoopObserver;
 #endif
diff --git a/WebKit/mac/WebView/WebViewInternal.h b/WebKit/mac/WebView/WebViewInternal.h
index 3b1195d..6c2ae50 100644
--- a/WebKit/mac/WebView/WebViewInternal.h
+++ b/WebKit/mac/WebView/WebViewInternal.h
@@ -81,8 +81,6 @@ namespace WebCore {
 #if USE(ACCELERATED_COMPOSITING)
 - (BOOL)_needsOneShotDrawingSynchronization;
 - (void)_setNeedsOneShotDrawingSynchronization:(BOOL)needsSynchronization;
-- (void)_startedAcceleratedCompositingForFrame:(WebFrame*)webFrame;
-- (void)_stoppedAcceleratedCompositingForFrame:(WebFrame*)webFrame;
 - (void)_scheduleCompositingLayerSync;
 #endif
 
diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h
index e17cec0..0622d4c 100644
--- a/WebKit/mac/WebView/WebViewPrivate.h
+++ b/WebKit/mac/WebView/WebViewPrivate.h
@@ -67,6 +67,9 @@ extern NSString *WebElementIsContentEditableKey; // NSNumber indicating whether
 // other WebElementDictionary keys
 extern NSString *WebElementLinkIsLiveKey;        // NSNumber of BOOL indictating whether the link is live or not
 
+// One of the subviews of the WebView entered compositing mode.
+extern NSString *_WebViewDidStartAcceleratedCompositingNotification;
+
 #if ENABLE_DASHBOARD_SUPPORT
 typedef enum {
     WebDashboardBehaviorAlwaysSendMouseEventsToAllWindows,
@@ -461,6 +464,8 @@ Could be worth adding to the API.
 + (NSCursor *)_pointingHandCursor;
 
 // SPI for DumpRenderTree
+- (BOOL)_postsAcceleratedCompositingNotifications;
+- (void)_setPostsAcceleratedCompositingNotifications:(BOOL)flag;
 - (BOOL)_isUsingAcceleratedCompositing;
 
 // SPI for PluginHalter
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 292c960..749e2d9 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,32 @@
+2009-12-07  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Darin Adler.
+
+        <rdar://problem/7450481> One compositing test keeps DRT in "compositing mode", breaks repaint tests
+
+        The counter that WebView used to keep track of the number of enclosed WebHTMLViews using
+        accelerated compositing was hard to manage, and maintained incorrectly in a number of cases.
+        This caused one compositing test make DumpRenderTree think that all subsequent tests
+        were compositing too.
+
+        Replace this counter with notifications, which are only fired if a client (DRT) requests them. The
+        notification informs the client that a WebHTMLView entered compositing mode (or an already-
+        compositing WebHTML was added); it does not say when a view becomes uncomposited, or all
+        compositing subviews were removed, since this is tricky to get right.
+        
+        DumpRenderTreeWindow listens for this notification, and uses it to turn on window
+        autodisplay, which is necessary to kick-start Core Animation rendering and animations.
+        We ensure that window autodisplay is turned off before every test.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (createWebViewAndOffscreenWindow):
+        (resetWebViewToConsistentStateBeforeTesting):
+        * DumpRenderTree/mac/DumpRenderTreeWindow.h:
+        * DumpRenderTree/mac/DumpRenderTreeWindow.mm:
+        (-[DumpRenderTreeWindow close]):
+        (-[DumpRenderTreeWindow startListeningForAcceleratedCompositingChanges]):
+        (-[DumpRenderTreeWindow webViewStartedAcceleratedCompositing:]):
+
 2009-12-07  Nikolas Zimmermann  <nzimmermann at rim.com>
 
         Reviewed by Holger Hans Peter Freyther.
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
index 661d1b0..4ffeac3 100644
--- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
+++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
@@ -306,7 +306,7 @@ WebView *createWebViewAndOffscreenWindow()
     [window orderBack:nil];
     [window setAutodisplay:NO];
 
-    [window startObservingWebView];
+    [window startListeningForAcceleratedCompositingChanges];
     
     // For reasons that are not entirely clear, the following pair of calls makes WebView handle its
     // dynamic scrollbars properly. Without it, every frame will always have scrollbars.
@@ -1122,6 +1122,7 @@ static void resetWebViewToConsistentStateBeforeTesting()
     [webView _clearMainFrameName];
     [[webView undoManager] removeAllActions];
     [WebView _removeAllUserContentFromGroup:[webView groupName]];
+    [[webView window] setAutodisplay:NO];
 
     resetDefaultsToConsistentValues();
 
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTreeWindow.h b/WebKitTools/DumpRenderTree/mac/DumpRenderTreeWindow.h
index b6bdcb8..a229d20 100644
--- a/WebKitTools/DumpRenderTree/mac/DumpRenderTreeWindow.h
+++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTreeWindow.h
@@ -34,7 +34,6 @@
 
 @interface DumpRenderTreeWindow : NSWindow
 {
-    BOOL observingWebView;
 }
 
 // I'm not sure why we can't just use [NSApp windows]
@@ -42,7 +41,6 @@
 
 - (WebView *)webView;
 
-- (void)startObservingWebView;
-- (void)stopObservingWebView;
+- (void)startListeningForAcceleratedCompositingChanges;
 
 @end
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTreeWindow.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTreeWindow.mm
index aa5b117..8845ef0 100644
--- a/WebKitTools/DumpRenderTree/mac/DumpRenderTreeWindow.mm
+++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTreeWindow.mm
@@ -67,7 +67,7 @@ static CFArrayCallBacks NonRetainingArrayCallbacks = {
 
 - (void)close
 {
-    [self stopObservingWebView];
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
 
     CFRange arrayRange = CFRangeMake(0, CFArrayGetCount(openWindowsRef));
     CFIndex i = CFArrayGetFirstIndexOfValue(openWindowsRef, arrayRange, self);
@@ -99,32 +99,20 @@ static CFArrayCallBacks NonRetainingArrayCallbacks = {
     return nil;
 }
 
-- (void)startObservingWebView
+- (void)startListeningForAcceleratedCompositingChanges
 {
-    [self stopObservingWebView];
-    [[self webView] addObserver:self forKeyPath:@"_isUsingAcceleratedCompositing" options:0 context:0];
-    observingWebView = YES;
+    [[self webView] _setPostsAcceleratedCompositingNotifications:YES];
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(webViewStartedAcceleratedCompositing:)
+        name:_WebViewDidStartAcceleratedCompositingNotification object:nil];
 }
 
-- (void)stopObservingWebView
+- (void)webViewStartedAcceleratedCompositing:(NSNotification *)notification
 {
-    if (!observingWebView)
-        return;
-    [[self webView] removeObserver:self forKeyPath:@"_isUsingAcceleratedCompositing"];
-    observingWebView = NO;
-}
-
-- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
-{
-    if ([keyPath isEqualToString:@"_isUsingAcceleratedCompositing"]) {
-        // When using accelerated compositing, the window needs to be autodisplay for AppKit/CA to
-        // start accelerated animations correctly.
-        BOOL isAccelerated = [[self webView] _isUsingAcceleratedCompositing];
-        [self setAutodisplay:isAccelerated];
-        return;
-    }
-    
-    [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
+    // If the WebView has gone into compositing mode, turn on window autodisplay. This is necessary for CA
+    // to update layers and start animations.
+    // We only ever turn autodisplay on here, because we turn it off before every test.
+    if ([[self webView] _isUsingAcceleratedCompositing])
+        [self setAutodisplay:YES];
 }
 
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list