Title: [182078] tags/Safari-601.1.23.4/Source/WebKit2
- Revision
- 182078
- Author
- [email protected]
- Date
- 2015-03-27 14:07:17 -0700 (Fri, 27 Mar 2015)
Log Message
Merged r182037. rdar://problem/20233711
Modified Paths
Diff
Modified: tags/Safari-601.1.23.4/Source/WebKit2/ChangeLog (182077 => 182078)
--- tags/Safari-601.1.23.4/Source/WebKit2/ChangeLog 2015-03-27 21:02:31 UTC (rev 182077)
+++ tags/Safari-601.1.23.4/Source/WebKit2/ChangeLog 2015-03-27 21:07:17 UTC (rev 182078)
@@ -1,3 +1,34 @@
+2015-03-27 Babak Shafiei <[email protected]>
+
+ Merge r182037.
+
+ 2015-03-26 Enrica Casucci <[email protected]>
+
+ REGRESSION(r1807689): Slower startup time for WKWebView.
+ https://bugs.webkit.org/show_bug.cgi?id=143115
+ rdar://problem/20233711
+
+ Reviewed by Anders Carlsson.
+
+ In http://trac.webkit.org/changeset/180768 we added an observer to
+ track visibility of the NSFontPanel to ensure we could fetch the font
+ information for the current selection when the panel first becomes visible.
+ It turns out that adding the observer requires the shared font panel
+ object to be created.
+ That is apparently a very expensive operation that is regressing
+ the initialization time for the WKWebView.
+ We should initialize the NSFontPanel lazily, only when we make the entire
+ view editable.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _setEditable:]):
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView addWindowObserversForWindow:]):
+ (-[WKView _addFontPanelObserver]):
+ (-[WKView removeWindowObservers]):
+ (-[WKView observeValueForKeyPath:ofObject:change:context:]):
+ * UIProcess/API/mac/WKViewInternal.h:
+
2015-03-19 Babak Shafiei <[email protected]>
Merge r181679.
Modified: tags/Safari-601.1.23.4/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (182077 => 182078)
--- tags/Safari-601.1.23.4/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-03-27 21:02:31 UTC (rev 182077)
+++ tags/Safari-601.1.23.4/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-03-27 21:07:17 UTC (rev 182078)
@@ -1657,6 +1657,7 @@
- (void)_setEditable:(BOOL)editable
{
_page->setEditable(editable);
+ [_wkView _addFontPanelObserver];
}
- (_WKRemoteObjectRegistry *)_remoteObjectRegistry
Modified: tags/Safari-601.1.23.4/Source/WebKit2/UIProcess/API/mac/WKView.mm (182077 => 182078)
--- tags/Safari-601.1.23.4/Source/WebKit2/UIProcess/API/mac/WKView.mm 2015-03-27 21:02:31 UTC (rev 182077)
+++ tags/Safari-601.1.23.4/Source/WebKit2/UIProcess/API/mac/WKView.mm 2015-03-27 21:07:17 UTC (rev 182078)
@@ -2559,10 +2559,6 @@
name:@"_NSWindowDidChangeContentsHostedInLayerSurfaceNotification" object:window];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeOcclusionState:)
name:NSWindowDidChangeOcclusionStateNotification object:window];
- [[NSFontPanel sharedFontPanel] addObserver:self
- forKeyPath:@"visible"
- options:NSKeyValueObservingOptionNew
- context:nil];
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
[window addObserver:self forKeyPath:@"contentLayoutRect" options:NSKeyValueObservingOptionInitial context:keyValueObservingContext];
[window addObserver:self forKeyPath:@"titlebarAppearsTransparent" options:NSKeyValueObservingOptionInitial context:keyValueObservingContext];
@@ -2570,6 +2566,11 @@
}
}
+- (void)_addFontPanelObserver
+{
+ [[NSFontPanel sharedFontPanel] addObserver:self forKeyPath:@"visible" options:0 context:keyValueObservingContext];
+}
+
- (void)removeWindowObservers
{
NSWindow *window = _data->_targetWindowForMovePreparation ? _data->_targetWindowForMovePreparation : [self window];
@@ -2589,7 +2590,8 @@
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidChangeScreenNotification object:window];
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"_NSWindowDidChangeContentsHostedInLayerSurfaceNotification" object:window];
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidChangeOcclusionStateNotification object:window];
- [[NSFontPanel sharedFontPanel] removeObserver:self forKeyPath:@"visible" context:nil];
+ if (_data->_page->isEditable())
+ [[NSFontPanel sharedFontPanel] removeObserver:self forKeyPath:@"visible" context:keyValueObservingContext];
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
[window removeObserver:self forKeyPath:@"contentLayoutRect" context:keyValueObservingContext];
[window removeObserver:self forKeyPath:@"titlebarAppearsTransparent" context:keyValueObservingContext];
@@ -3773,18 +3775,18 @@
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
- if ([NSFontPanel sharedFontPanelExists] && object == [NSFontPanel sharedFontPanel]) {
+ if (context != keyValueObservingContext) {
+ [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
+ return;
+ }
+
+ if ([keyPath isEqualToString:@"visible"] && [NSFontPanel sharedFontPanelExists] && object == [NSFontPanel sharedFontPanel]) {
[self updateFontPanelIfNeeded];
return;
}
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- if (context == keyValueObservingContext) {
- if ([keyPath isEqualToString:@"contentLayoutRect"] || [keyPath isEqualToString:@"titlebarAppearsTransparent"])
- [self _updateContentInsetsIfAutomatic];
- return;
- }
-
- [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
+ if ([keyPath isEqualToString:@"contentLayoutRect"] || [keyPath isEqualToString:@"titlebarAppearsTransparent"])
+ [self _updateContentInsetsIfAutomatic];
#endif
}
Modified: tags/Safari-601.1.23.4/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (182077 => 182078)
--- tags/Safari-601.1.23.4/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h 2015-03-27 21:02:31 UTC (rev 182077)
+++ tags/Safari-601.1.23.4/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h 2015-03-27 21:07:17 UTC (rev 182078)
@@ -126,6 +126,7 @@
- (void)_reparentLayerTreeInThumbnailView;
#endif
+- (void)_addFontPanelObserver;
// FullScreen
@property (readonly) BOOL _hasFullScreenWindowController;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes