Changeset 157968 in webkit
- Timestamp:
- Oct 24, 2013, 5:43:54 PM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/API/mac/PageClientImpl.mm (modified) (2 diffs)
-
UIProcess/API/mac/WKView.mm (modified) (8 diffs)
-
UIProcess/API/mac/WKViewInternal.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r157967 r157968 1 2013-10-24 Gavin Barraclough <barraclough@apple.com> 2 3 Simplify window occlusion detection code 4 https://bugs.webkit.org/show_bug.cgi?id=123300 5 6 Reviewed by Tim Horton. 7 8 Currently the WKView tries to maintain a copy of the window's occluded state, 9 but forced to NO when occlusion detection is disabled (and capable of handling 10 dectection being dynamically toggled). Simpler to just rely on the actual value 11 from the window, && the enabled setting. Cleaning this up revealed that we're 12 not sending a viewStateDidChange to the WebPageProxy when the occlusion state 13 changes, which we probably should be. 14 15 * UIProcess/API/mac/PageClientImpl.mm: 16 (WebKit::PageClientImpl::isViewVisible): 17 - check the real value of occlusion state from the window. 18 * UIProcess/API/mac/WKView.mm: 19 (-[WKView viewDidMoveToWindow]): 20 - don't update cached value. 21 (-[WKView _windowDidChangeOcclusionState:]): 22 - don't update cached value, but do send viewStateDidChange to the WebPageProxy. 23 (-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]): 24 - removed _isWindowOccluded. 25 (-[WKView windowOcclusionDetectionEnabled]): 26 (-[WKView setWindowOcclusionDetectionEnabled:]): 27 - Just toggle the flag - no cached state to update any more. 28 * UIProcess/API/mac/WKViewInternal.h: 29 - removed _isWindowOccluded. 30 1 31 2013-10-24 Gavin Barraclough <barraclough@apple.com> 2 32 -
trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
r157319 r157968 39 39 #import "WKStringCF.h" 40 40 #import "WKViewInternal.h" 41 #import "WKViewPrivate.h" 41 42 #import "StringUtilities.h" 42 43 #import "WebColorPickerMac.h" … … 202 203 return false; 203 204 204 if ([m_wkView _isWindowOccluded]) 205 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 206 if ([m_wkView windowOcclusionDetectionEnabled] && ([[m_wkView window] occlusionState] & NSWindowOcclusionStateVisible) != NSWindowOcclusionStateVisible) 205 207 return false; 208 #endif 206 209 207 210 return true; -
trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm
r157681 r157968 147 147 - (void)_setDrawingAreaSize:(NSSize)size; 148 148 - (void)_setPluginComplexTextInputState:(PluginComplexTextInputState)pluginComplexTextInputState; 149 150 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090151 - (void)_setIsWindowOccluded:(BOOL)isWindowOccluded;152 #endif153 149 @end 154 150 … … 238 234 NSRect _contentPreparationRect; 239 235 BOOL _useContentPreparationRectForVisibleRect; 240 241 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090242 BOOL _isWindowOccluded;243 236 BOOL _windowOcclusionDetectionEnabled; 244 #endif245 237 } 246 238 … … 1942 1934 // update the active state. 1943 1935 if ([self window]) { 1944 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 10901945 if (_data->_windowOcclusionDetectionEnabled)1946 [self _setIsWindowOccluded:([[self window] occlusionState] & NSWindowOcclusionStateVisible) != NSWindowOcclusionStateVisible];1947 #endif1948 1936 _data->_windowHasValidBackingStore = NO; 1949 1937 [self doWindowDidChangeScreen]; … … 2072 2060 - (void)_windowDidChangeOcclusionState:(NSNotification *)notification 2073 2061 { 2074 if (!_data->_windowOcclusionDetectionEnabled) 2075 return; 2076 2077 [self _setIsWindowOccluded:([self.window occlusionState] & NSWindowOcclusionStateVisible) != NSWindowOcclusionStateVisible]; 2062 _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible); 2078 2063 } 2079 2064 #endif … … 2257 2242 NSPoint locationInViewCoordinates = [self convertPoint:[event locationInWindow] fromView:nil]; 2258 2243 _data->_page->performDictionaryLookupAtLocation(FloatPoint(locationInViewCoordinates.x, locationInViewCoordinates.y)); 2259 }2260 #endif2261 2262 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 10902263 - (void)_setIsWindowOccluded:(BOOL)isWindowOccluded2264 {2265 if (_data->_isWindowOccluded == isWindowOccluded)2266 return;2267 2268 _data->_isWindowOccluded = isWindowOccluded;2269 _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);2270 2244 } 2271 2245 #endif … … 2919 2893 } 2920 2894 2921 - (BOOL)_isWindowOccluded2922 {2923 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 10902924 return _data->_isWindowOccluded;2925 #else2926 return NO;2927 #endif2928 }2929 2930 2895 @end 2931 2896 … … 2983 2948 _data->_clipsToVisibleRect = NO; 2984 2949 _data->_useContentPreparationRectForVisibleRect = NO; 2950 _data->_windowOcclusionDetectionEnabled = YES; 2985 2951 2986 2952 _data->_intrinsicContentSize = NSMakeSize(NSViewNoInstrinsicMetric, NSViewNoInstrinsicMetric); 2987 2988 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 10902989 _data->_isWindowOccluded = NO;2990 _data->_windowOcclusionDetectionEnabled = YES;2991 #endif2992 2953 2993 2954 _data->_needsViewFrameInWindowCoordinates = _data->_page->pageGroup()->preferences()->pluginsEnabled(); … … 3253 3214 - (BOOL)windowOcclusionDetectionEnabled 3254 3215 { 3255 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 10903256 3216 return _data->_windowOcclusionDetectionEnabled; 3257 #else3258 return NO;3259 #endif3260 3217 } 3261 3218 3262 3219 - (void)setWindowOcclusionDetectionEnabled:(BOOL)flag 3263 3220 { 3264 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 10903265 if (_data->_windowOcclusionDetectionEnabled == flag)3266 return;3267 3268 3221 _data->_windowOcclusionDetectionEnabled = flag; 3269 3270 if (flag) {3271 // When enabling window occlusion detection, update the view's current occluded state3272 // immediately, as the notification only fires when it changes.3273 if (self.window)3274 [self _setIsWindowOccluded:([self.window occlusionState] & NSWindowOcclusionStateVisible) != NSWindowOcclusionStateVisible];3275 } else {3276 // When disabling window occlusion detection, force the view to think it is not occluded,3277 // as it may already be occluded at the time of calling.3278 [self _setIsWindowOccluded:NO];3279 }3280 #endif3281 3222 } 3282 3223 -
trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
r157681 r157968 97 97 - (BOOL)_suppressVisibilityUpdates; 98 98 99 - (BOOL)_isWindowOccluded;100 101 99 @end
Note:
See TracChangeset
for help on using the changeset viewer.