Changeset 181866 in webkit
- Timestamp:
- Mar 23, 2015, 1:42:03 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
-
WebKit/mac/ChangeLog (modified) (1 diff)
-
WebKit/mac/WebView/WebView.mm (modified) (6 diffs)
-
WebKit/mac/WebView/WebViewData.h (modified) (3 diffs)
-
WebKit/mac/WebView/WebViewData.mm (modified) (1 diff)
-
WebKit2/ChangeLog (modified) (1 diff)
-
WebKit2/UIProcess/API/mac/WKView.mm (modified) (8 diffs)
-
WebKit2/UIProcess/API/mac/WKViewInternal.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/mac/ChangeLog
r181858 r181866 1 2015-03-23 Alexey Proskuryakov <ap@apple.com> 2 3 REGRESSION (Yosemite): WKView visibility notifications are messed up 4 https://bugs.webkit.org/show_bug.cgi?id=142945 5 6 Reviewed by Tim Horton. 7 8 As these notifications cannot be used by NSView subclasses, create a separate 9 object for observing them. 10 11 * WebView/WebView.mm: 12 (-[WebView _commonInitializationWithFrameName:groupName:]): 13 (-[WebView initSimpleHTMLDocumentWithStyle:frame:preferences:groupName:]): 14 (-[WebView addWindowObserversForWindow:]): 15 (-[WebView removeWindowObservers]): 16 (-[WebView viewWillMoveToWindow:]): Make sure that observers are removed even 17 if -[WebView close] is called manually. 18 * WebView/WebViewData.h: 19 * WebView/WebViewData.mm: 20 (-[WebWindowVisibilityObserver initWithView:]): 21 (-[WebWindowVisibilityObserver startObserving:]): 22 (-[WebWindowVisibilityObserver stopObserving:]): 23 (-[WebWindowVisibilityObserver _windowVisibilityChanged:]): 24 1 25 2015-03-23 Tim Horton <timothy_horton@apple.com> 2 26 -
trunk/Source/WebKit/mac/WebView/WebView.mm
r181846 r181866 880 880 _private->includesFlattenedCompositingLayersWhenDrawingToBitmap = YES; 881 881 882 #if PLATFORM(MAC) 883 _private->windowVisibilityObserver = adoptNS([[WebWindowVisibilityObserver alloc] initWithView:self]); 884 #endif 885 882 886 NSRect f = [self frame]; 883 887 WebFrameView *frameView = [[WebFrameView alloc] initWithFrame: NSMakeRect(0,0,f.size.width,f.size.height)]; … … 1174 1178 _private->drawsBackground = YES; 1175 1179 _private->backgroundColor = CGColorRetain(cachedCGColor(Color::white, ColorSpaceDeviceRGB)); 1176 1180 1177 1181 WebFrameView *frameView = nil; 1178 1182 frameView = [[WebFrameView alloc] initWithFrame: CGRectMake(0,0,frame.size.width,frame.size.height)]; … … 5187 5191 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowVisibilityChanged:) 5188 5192 name:NSWindowDidDeminiaturizeNotification object:window]; 5189 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowVisibilityChanged:) 5190 name:@"NSWindowDidOrderOffScreenNotification" object:window]; 5191 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowVisibilityChanged:) 5192 name:@"_NSWindowDidBecomeVisible" object:window]; 5193 [_private->windowVisibilityObserver startObserving:window]; 5193 5194 } 5194 5195 } … … 5214 5215 [[NSNotificationCenter defaultCenter] removeObserver:self 5215 5216 name:NSWindowDidDeminiaturizeNotification object:window]; 5216 [[NSNotificationCenter defaultCenter] removeObserver:self 5217 name:@"NSWindowDidOrderOffScreenNotification" object:window]; 5218 [[NSNotificationCenter defaultCenter] removeObserver:self 5219 name:@"_NSWindowDidBecomeVisible" object:window]; 5217 [_private->windowVisibilityObserver stopObserving:window]; 5220 5218 } 5221 5219 } … … 5226 5224 // This happens when decoding a WebView in a nib. 5227 5225 // FIXME: What sets up the observer of NSWindowWillCloseNotification in this case? 5228 if (!_private || _private->closed)5229 return; 5230 5226 if (!_private) 5227 return; 5228 5231 5229 if ([self window] && [self window] != [self hostWindow]) 5232 5230 [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowWillCloseNotification object:[self window]]; … … 5240 5238 [window setAcceptsMouseMovedEvents:YES]; 5241 5239 WKSetNSWindowShouldPostEventNotifications(window, YES); 5242 } else {5240 } else if (!_private->closed) { 5243 5241 _private->page->setCanStartMedia(false); 5244 5242 _private->page->setIsInWindow(false); -
trunk/Source/WebKit/mac/WebView/WebViewData.h
r181838 r181866 85 85 #endif 86 86 87 #if PLATFORM(MAC) 88 @class WebWindowVisibilityObserver; 89 #endif 90 87 91 extern BOOL applicationIsTerminating; 88 92 extern int pluginDatabaseClientCount; … … 125 129 WebViewLayerFlushScheduler m_layerFlushScheduler; 126 130 }; 131 132 @interface WebWindowVisibilityObserver : NSObject { 133 WebView *_view; 134 } 135 136 - (instancetype)initWithView:(WebView *)view; 137 - (void)startObserving:(NSWindow *)window; 138 - (void)stopObserving:(NSWindow *)window; 139 @end 127 140 128 141 // FIXME: This should be renamed to WebViewData. … … 160 173 std::unique_ptr<WebCore::TextIndicatorWindow> textIndicatorWindow; 161 174 BOOL hasInitializedLookupObserver; 175 RetainPtr<WebWindowVisibilityObserver> windowVisibilityObserver; 162 176 #endif // PLATFORM(MAC) 163 177 -
trunk/Source/WebKit/mac/WebView/WebViewData.mm
r181838 r181866 78 78 } 79 79 80 #if PLATFORM(MAC) 81 82 @implementation WebWindowVisibilityObserver 83 84 - (instancetype)initWithView:(WebView *)view 85 { 86 self = [super init]; 87 if (!self) 88 return nil; 89 90 _view = view; 91 return self; 92 } 93 94 - (void)startObserving:(NSWindow *)window 95 { 96 // An NSView derived object such as WebView cannot observe these notifications, because NSView itself observes them. 97 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowVisibilityChanged:) 98 name:@"NSWindowDidOrderOffScreenNotification" object:window]; 99 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowVisibilityChanged:) 100 name:@"_NSWindowDidBecomeVisible" object:window]; 101 } 102 103 - (void)stopObserving:(NSWindow *)window 104 { 105 [[NSNotificationCenter defaultCenter] removeObserver:self name:@"NSWindowDidOrderOffScreenNotification" object:window]; 106 [[NSNotificationCenter defaultCenter] removeObserver:self name:@"_NSWindowDidBecomeVisible" object:window]; 107 } 108 109 - (void)_windowVisibilityChanged:(NSNotification *)notification 110 { 111 [_view _windowVisibilityChanged:notification]; 112 } 113 114 @end 115 116 #endif // PLATFORM(MAC) 117 80 118 @implementation WebViewPrivate 81 119 -
trunk/Source/WebKit2/ChangeLog
r181864 r181866 1 2015-03-23 Alexey Proskuryakov <ap@apple.com> 2 3 REGRESSION (Yosemite): WKView visibility notifications are messed up 4 https://bugs.webkit.org/show_bug.cgi?id=142945 5 6 Reviewed by Tim Horton. 7 8 As these notifications cannot be used by NSView subclasses, create a separate 9 object for observing them. 10 11 * UIProcess/API/mac/WKView.mm: 12 (-[WKWindowVisibilityObserver initWithView:]): 13 (-[WKWindowVisibilityObserver startObserving:]): 14 (-[WKWindowVisibilityObserver stopObserving:]): 15 (-[WKWindowVisibilityObserver _windowDidOrderOnScreen:]): 16 (-[WKWindowVisibilityObserver _windowDidOrderOffScreen:]): 17 (-[WKView addWindowObserversForWindow:]): 18 (-[WKView removeWindowObservers]): Also, don't try to remove NSWindowWillOrderOffScreenNotification, 19 which we never start to observe. 20 (-[WKView initWithFrame:processPool:configuration:webView:]): 21 * UIProcess/API/mac/WKViewInternal.h: 22 1 23 2015-03-23 Anders Carlsson <andersca@apple.com> 2 24 -
trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm
r181836 r181866 171 171 #endif 172 172 173 @class WKWindowVisibilityObserver; 174 173 175 @interface WKViewData : NSObject { 174 176 @public … … 253 255 BOOL _windowOcclusionDetectionEnabled; 254 256 257 RetainPtr<WKWindowVisibilityObserver> _windowVisibilityObserver; 258 255 259 std::unique_ptr<ViewGestureController> _gestureController; 256 260 BOOL _allowsMagnification; … … 282 286 283 287 @implementation WKViewData 288 @end 289 290 @interface WKWindowVisibilityObserver : NSObject { 291 WKView *_view; 292 } 293 294 - (instancetype)initWithView:(WKView *)view; 295 - (void)startObserving:(NSWindow *)window; 296 - (void)stopObserving:(NSWindow *)window; 297 @end 298 299 @implementation WKWindowVisibilityObserver 300 301 - (instancetype)initWithView:(WKView *)view 302 { 303 self = [super init]; 304 if (!self) 305 return nil; 306 307 _view = view; 308 return self; 309 } 310 311 - (void)startObserving:(NSWindow *)window 312 { 313 // An NSView derived object such as WKView cannot observe these notifications, because NSView itself observes them. 314 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidOrderOffScreen:) 315 name:@"NSWindowDidOrderOffScreenNotification" object:window]; 316 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidOrderOnScreen:) 317 name:@"_NSWindowDidBecomeVisible" object:window]; 318 } 319 320 - (void)stopObserving:(NSWindow *)window 321 { 322 [[NSNotificationCenter defaultCenter] removeObserver:self name:@"NSWindowDidOrderOffScreenNotification" object:window]; 323 [[NSNotificationCenter defaultCenter] removeObserver:self name:@"_NSWindowDidBecomeVisible" object:window]; 324 } 325 326 - (void)_windowDidOrderOnScreen:(NSNotification *)notification 327 { 328 [_view _windowDidOrderOnScreen:notification]; 329 } 330 331 - (void)_windowDidOrderOffScreen:(NSNotification *)notification 332 { 333 [_view _windowDidOrderOffScreen:notification]; 334 } 335 284 336 @end 285 337 … … 2547 2599 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidResize:) 2548 2600 name:NSWindowDidResizeNotification object:window]; 2549 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidOrderOffScreen:)2550 name:@"NSWindowDidOrderOffScreenNotification" object:window];2551 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidOrderOnScreen:)2552 name:@"_NSWindowDidBecomeVisible" object:window];2553 2601 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeBackingProperties:) 2554 2602 name:NSWindowDidChangeBackingPropertiesNotification object:window]; … … 2567 2615 [window addObserver:self forKeyPath:@"titlebarAppearsTransparent" options:NSKeyValueObservingOptionInitial context:keyValueObservingContext]; 2568 2616 #endif 2617 [_data->_windowVisibilityObserver startObserving:window]; 2569 2618 } 2570 2619 } … … 2582 2631 [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidMoveNotification object:window]; 2583 2632 [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResizeNotification object:window]; 2584 [[NSNotificationCenter defaultCenter] removeObserver:self name:@"NSWindowWillOrderOffScreenNotification" object:window];2585 [[NSNotificationCenter defaultCenter] removeObserver:self name:@"NSWindowDidOrderOffScreenNotification" object:window];2586 [[NSNotificationCenter defaultCenter] removeObserver:self name:@"_NSWindowDidBecomeVisible" object:window];2587 2633 [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidChangeBackingPropertiesNotification object:window]; 2588 2634 [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidChangeScreenNotification object:window]; … … 2594 2640 [window removeObserver:self forKeyPath:@"titlebarAppearsTransparent" context:keyValueObservingContext]; 2595 2641 #endif 2642 [_data->_windowVisibilityObserver stopObserving:window]; 2596 2643 } 2597 2644 … … 3697 3744 _data->_windowOcclusionDetectionEnabled = YES; 3698 3745 3746 _data->_windowVisibilityObserver = adoptNS([[WKWindowVisibilityObserver alloc] initWithView:self]); 3747 3699 3748 _data->_intrinsicContentSize = NSMakeSize(NSViewNoInstrinsicMetric, NSViewNoInstrinsicMetric); 3700 3749 3701 3750 _data->_needsViewFrameInWindowCoordinates = _data->_page->preferences().pluginsEnabled(); 3702 3751 3703 3752 [self _registerDraggedTypes]; 3704 3753 -
trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
r181760 r181866 130 130 #endif 131 131 132 - (void)_windowDidOrderOnScreen:(NSNotification *)notification; 133 - (void)_windowDidOrderOffScreen:(NSNotification *)notification; 134 132 135 // FullScreen 133 136
Note:
See TracChangeset
for help on using the changeset viewer.