Changeset 175973 in webkit
- Timestamp:
- Nov 11, 2014, 1:39:46 PM (12 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/API/mac/WKView.mm (modified) (3 diffs)
-
UIProcess/API/mac/WKViewInternal.h (modified) (1 diff)
-
UIProcess/mac/PageClientImpl.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r175972 r175973 1 2014-11-11 Tim Horton <timothy_horton@apple.com> 2 3 Occasional assertion failure under recommendedScrollbarStyleDidChange() 4 https://bugs.webkit.org/show_bug.cgi?id=138604 5 <rdar://problem/18855914> 6 7 Reviewed by Beth Dakin. 8 9 It is possible for AppKit to install tracking areas into our view 10 behind our back, but we have code that depends on knowing exactly 11 the set of tracking areas installed on WKView. 12 13 Make this more robust by keeping a reference to the tracking area we 14 use for many things and manipulating that instead of making assumptions 15 about the total set of tracking areas on WKView. 16 17 * UIProcess/API/mac/WKView.mm: 18 (-[WKView _primaryTrackingArea]): 19 (-[WKView _replacePrimaryTrackingArea:]): 20 Provide a 'primary' tracking area setter/getter. 21 22 (-[WKView initWithFrame:context:configuration:webView:]): 23 Keep a reference to the original tracking area installed at initialization time. 24 25 * UIProcess/API/mac/WKViewInternal.h: 26 * UIProcess/mac/PageClientImpl.mm: 27 (WebKit::PageClientImpl::recommendedScrollbarStyleDidChange): 28 Instead of walking the set of tracking areas, make use of the fact that 29 we know exactly which tracking area we installed, and uninstall just that 30 one, and replace it with our newly-built one. 31 1 32 2014-11-11 Myles C. Maxfield <mmaxfield@apple.com> 2 33 -
trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm
r175790 r175973 170 170 RetainPtr<WKBrowsingContextController> _browsingContextController; 171 171 #endif 172 173 RetainPtr<NSTrackingArea> _primaryTrackingArea; 172 174 173 175 // For ToolTips. … … 3494 3496 } 3495 3497 3498 - (NSTrackingArea *)_primaryTrackingArea 3499 { 3500 return _data->_primaryTrackingArea.get(); 3501 } 3502 3503 - (void)_setPrimaryTrackingArea:(NSTrackingArea *)trackingArea 3504 { 3505 [self removeTrackingArea:_data->_primaryTrackingArea.get()]; 3506 _data->_primaryTrackingArea = trackingArea; 3507 [self addTrackingArea:trackingArea]; 3508 } 3509 3496 3510 - (instancetype)initWithFrame:(NSRect)frame context:(WebContext&)context configuration:(WebPageConfiguration)webPageConfiguration webView:(WKWebView *)webView 3497 3511 { … … 3511 3525 options |= NSTrackingActiveInKeyWindow; 3512 3526 3513 NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:frame3514 options:options3515 owner:self3516 userInfo:nil];3517 [self addTrackingArea:trackingArea];3518 [trackingArea release];3519 3520 3527 _data = [[WKViewData alloc] init]; 3528 _data->_primaryTrackingArea = adoptNS([[NSTrackingArea alloc] initWithRect:frame options:options owner:self userInfo:nil]); 3529 [self addTrackingArea:_data->_primaryTrackingArea.get()]; 3530 3521 3531 _data->_pageClient = std::make_unique<PageClientImpl>(self, webView); 3522 3532 _data->_page = context.createWebPage(*_data->_pageClient, WTF::move(webPageConfiguration)); -
trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
r175756 r175973 134 134 - (void)_dismissActionMenuPopovers; 135 135 136 @property (nonatomic, retain, setter=_setPrimaryTrackingArea:) NSTrackingArea *_primaryTrackingArea; 137 136 138 @end -
trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm
r175966 r175973 586 586 void PageClientImpl::recommendedScrollbarStyleDidChange(int32_t newStyle) 587 587 { 588 NSArray *trackingAreas = [m_wkView trackingAreas];589 NSUInteger count = [trackingAreas count];590 ASSERT(count == 1);591 592 for (NSUInteger i = 0; i < count; ++i)593 [m_wkView removeTrackingArea:[trackingAreas objectAtIndex:i]];594 595 588 // Now re-create a tracking area with the appropriate options given the new scrollbar style 596 589 NSTrackingAreaOptions options = NSTrackingMouseMoved | NSTrackingMouseEnteredAndExited | NSTrackingInVisibleRect; … … 600 593 options |= NSTrackingActiveInKeyWindow; 601 594 602 NSTrackingArea *trackingArea = [[NSTrackingArea alloc] initWithRect:[m_wkView frame] 603 options:options 604 owner:m_wkView 605 userInfo:nil]; 606 [m_wkView addTrackingArea:trackingArea]; 607 [trackingArea release]; 595 RetainPtr<NSTrackingArea> trackingArea = adoptNS([[NSTrackingArea alloc] initWithRect:[m_wkView frame] options:options owner:m_wkView userInfo:nil]); 596 [m_wkView _setPrimaryTrackingArea:trackingArea.get()]; 608 597 } 609 598
Note:
See TracChangeset
for help on using the changeset viewer.