Title: [99617] trunk/Source
Revision
99617
Author
[email protected]
Date
2011-11-08 14:44:17 -0800 (Tue, 08 Nov 2011)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=71856
WebKit should use new NSWindowDidChangeBackingPropertiesNotification instead of 
old NSWindowDidChangeResolutionNotification
-and corresponding-
<rdar://problem/10317253>

Reviewed by Tim Hatcher.

Source/WebKit/mac: 

* WebView/WebView.mm:
(-[WebView addWindowObserversForWindow:]):
(-[WebView removeWindowObservers]):

We have to check that the backing scale factor actually changed since this 
notification can also be used to signify other changes. 
(-[WebView _windowDidChangeBackingProperties:]):

Source/WebKit2: 

* UIProcess/API/mac/WKView.mm:
(-[WKView addWindowObserversForWindow:]):
(-[WKView removeWindowObservers]):

We have to check that the backing scale factor actually changed since this 
notification can also be used to signify other changes. 
(-[WKView _windowDidChangeBackingProperties:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (99616 => 99617)


--- trunk/Source/WebKit/mac/ChangeLog	2011-11-08 22:22:24 UTC (rev 99616)
+++ trunk/Source/WebKit/mac/ChangeLog	2011-11-08 22:44:17 UTC (rev 99617)
@@ -1,3 +1,21 @@
+2011-11-08  Beth Dakin  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=71856
+        WebKit should use new NSWindowDidChangeBackingPropertiesNotification instead of 
+        old NSWindowDidChangeResolutionNotification
+        -and corresponding-
+        <rdar://problem/10317253>
+
+        Reviewed by Tim Hatcher.
+
+        * WebView/WebView.mm:
+        (-[WebView addWindowObserversForWindow:]):
+        (-[WebView removeWindowObservers]):
+
+        We have to check that the backing scale factor actually changed since this 
+        notification can also be used to signify other changes. 
+        (-[WebView _windowDidChangeBackingProperties:]):
+
 2011-11-07  Adam Barth  <[email protected]>
 
         Move DomainRelaxationForbidden scheme registry to SchemeRegistry

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (99616 => 99617)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2011-11-08 22:22:24 UTC (rev 99616)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2011-11-08 22:44:17 UTC (rev 99617)
@@ -3223,8 +3223,9 @@
     return _private->shouldCloseWithWindow;
 }
 
-// FIXME: Use an AppKit constant for this once one is available.
-static NSString * const windowDidChangeResolutionNotification = @"NSWindowDidChangeResolutionNotification";
+// FIXME: Use AppKit constants for these when they are available.
+static NSString * const windowDidChangeBackingPropertiesNotification = @"NSWindowDidChangeBackingPropertiesNotification";
+static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOldScaleFactorKey"; 
 
 - (void)addWindowObserversForWindow:(NSWindow *)window
 {
@@ -3237,8 +3238,8 @@
             name:WKWindowWillOrderOnScreenNotification() object:window];
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowWillOrderOffScreen:)
             name:WKWindowWillOrderOffScreenNotification() object:window];
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeResolution:)
-            name:windowDidChangeResolutionNotification object:window];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeBackingProperties:)
+            name:windowDidChangeBackingPropertiesNotification object:window];
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeScreen:)
             name:NSWindowDidChangeScreenNotification object:window];
     }
@@ -3257,7 +3258,7 @@
         [[NSNotificationCenter defaultCenter] removeObserver:self
             name:WKWindowWillOrderOffScreenNotification() object:window];
         [[NSNotificationCenter defaultCenter] removeObserver:self
-            name:windowDidChangeResolutionNotification object:window];
+            name:windowDidChangeBackingPropertiesNotification object:window];
         [[NSNotificationCenter defaultCenter] removeObserver:self
             name:NSWindowDidChangeScreenNotification object:window];
     }
@@ -3371,9 +3372,14 @@
         [self close];
 }
 
-- (void)_windowDidChangeResolution:(NSNotification *)notification
+- (void)_windowDidChangeBackingProperties:(NSNotification *)notification
 {
-    _private->page->setDeviceScaleFactor([self _deviceScaleFactor]);
+    CGFloat oldBackingScaleFactor = [[notification.userInfo objectForKey:backingPropertyOldScaleFactorKey] doubleValue]; 
+    CGFloat newBackingScaleFactor = [self _deviceScaleFactor];
+    if (oldBackingScaleFactor == newBackingScaleFactor) 
+        return; 
+
+    _private->page->setDeviceScaleFactor(newBackingScaleFactor);
 }
 
 - (void)setPreferences:(WebPreferences *)prefs

Modified: trunk/Source/WebKit2/ChangeLog (99616 => 99617)


--- trunk/Source/WebKit2/ChangeLog	2011-11-08 22:22:24 UTC (rev 99616)
+++ trunk/Source/WebKit2/ChangeLog	2011-11-08 22:44:17 UTC (rev 99617)
@@ -1,3 +1,21 @@
+2011-11-08  Beth Dakin  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=71856
+        WebKit should use new NSWindowDidChangeBackingPropertiesNotification instead of 
+        old NSWindowDidChangeResolutionNotification
+        -and corresponding-
+        <rdar://problem/10317253>
+
+        Reviewed by Tim Hatcher.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView addWindowObserversForWindow:]):
+        (-[WKView removeWindowObservers]):
+
+        We have to check that the backing scale factor actually changed since this 
+        notification can also be used to signify other changes. 
+        (-[WKView _windowDidChangeBackingProperties:]):
+
 2011-11-08  Anders Carlsson  <[email protected]>
 
         Add a basic layer hierarchy to the Core Animation drawing area

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (99616 => 99617)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2011-11-08 22:22:24 UTC (rev 99616)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2011-11-08 22:44:17 UTC (rev 99617)
@@ -1730,8 +1730,9 @@
     return ownsGrowBox;
 }
 
-// FIXME: Use an AppKit constant for this once one is available.
-static NSString * const windowDidChangeResolutionNotification = @"NSWindowDidChangeResolutionNotification";
+// FIXME: Use AppKit constants for these when they are available.
+static NSString * const windowDidChangeBackingPropertiesNotification = @"NSWindowDidChangeBackingPropertiesNotification";
+static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOldScaleFactorKey";
 
 - (void)addWindowObserversForWindow:(NSWindow *)window
 {
@@ -1752,8 +1753,8 @@
                                                      name:@"NSWindowDidOrderOffScreenNotification" object:window];
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidOrderOnScreen:) 
                                                      name:@"_NSWindowDidBecomeVisible" object:window];
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeResolution:)
-                                                     name:windowDidChangeResolutionNotification object:window];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeBackingProperties:)
+                                                     name:windowDidChangeBackingPropertiesNotification object:window];
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidChangeScreen:)
                                                      name:NSWindowDidChangeScreenNotification object:window];
     }
@@ -1773,7 +1774,7 @@
     [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResizeNotification object:window];
     [[NSNotificationCenter defaultCenter] removeObserver:self name:@"NSWindowDidOrderOffScreenNotification" object:window];
     [[NSNotificationCenter defaultCenter] removeObserver:self name:@"_NSWindowDidBecomeVisible" object:window];
-    [[NSNotificationCenter defaultCenter] removeObserver:self name:windowDidChangeResolutionNotification object:window];
+    [[NSNotificationCenter defaultCenter] removeObserver:self name:windowDidChangeBackingPropertiesNotification object:window];
     [[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidChangeScreenNotification object:window];
 }
 
@@ -1882,9 +1883,14 @@
     _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
 }
 
-- (void)_windowDidChangeResolution:(NSNotification *)notification
+- (void)_windowDidChangeBackingProperties:(NSNotification *)notification
 {
-    _data->_page->setIntrinsicDeviceScaleFactor([self _intrinsicDeviceScaleFactor]);
+    CGFloat oldBackingScaleFactor = [[notification.userInfo objectForKey:backingPropertyOldScaleFactorKey] doubleValue]; 
+    CGFloat newBackingScaleFactor = [self _intrinsicDeviceScaleFactor]; 
+    if (oldBackingScaleFactor == newBackingScaleFactor) 
+        return; 
+
+    _data->_page->setIntrinsicDeviceScaleFactor(newBackingScaleFactor);
 }
 
 static void drawPageBackground(CGContextRef context, WebPageProxy* page, const IntRect& rect)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to