Title: [179752] trunk/Source/WebKit2
- Revision
- 179752
- Author
- [email protected]
- Date
- 2015-02-06 12:46:19 -0800 (Fri, 06 Feb 2015)
Log Message
Support overriding the deviceScaleFactor per WKWebView/WKView
https://bugs.webkit.org/show_bug.cgi?id=141311
Reviewed by Tim Horton.
* UIProcess/API/Cocoa/WKViewPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _setOverrideDeviceScaleFactor:]):
(-[WKWebView _overrideDeviceScaleFactor]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/mac/WKView.mm:
(-[WKView _intrinsicDeviceScaleFactor]):
(-[WKView _setOverrideDeviceScaleFactor:]):
(-[WKView _overrideDeviceScaleFactor]):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (179751 => 179752)
--- trunk/Source/WebKit2/ChangeLog 2015-02-06 20:25:05 UTC (rev 179751)
+++ trunk/Source/WebKit2/ChangeLog 2015-02-06 20:46:19 UTC (rev 179752)
@@ -1,3 +1,20 @@
+2015-02-05 Timothy Hatcher <[email protected]>
+
+ Support overriding the deviceScaleFactor per WKWebView/WKView
+ https://bugs.webkit.org/show_bug.cgi?id=141311
+
+ Reviewed by Tim Horton.
+
+ * UIProcess/API/Cocoa/WKViewPrivate.h:
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _setOverrideDeviceScaleFactor:]):
+ (-[WKWebView _overrideDeviceScaleFactor]):
+ * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView _intrinsicDeviceScaleFactor]):
+ (-[WKView _setOverrideDeviceScaleFactor:]):
+ (-[WKView _overrideDeviceScaleFactor]):
+
2015-02-06 Carlos Garcia Campos <[email protected]>
[GTK] Remove WebKitWebView::close-notification signal
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h (179751 => 179752)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h 2015-02-06 20:25:05 UTC (rev 179751)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h 2015-02-06 20:46:19 UTC (rev 179752)
@@ -90,6 +90,8 @@
@property (nonatomic, setter=_setTopContentInset:) CGFloat _topContentInset;
@property (nonatomic, setter=_setTotalHeightOfBanners:) CGFloat _totalHeightOfBanners;
+@property (nonatomic, setter=_setOverrideDeviceScaleFactor:) CGFloat _overrideDeviceScaleFactor WK_AVAILABLE(WK_MAC_TBA, NA);
+
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
@property (nonatomic, setter=_setAutomaticallyAdjustsContentInsets:) BOOL _automaticallyAdjustsContentInsets;
#endif
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (179751 => 179752)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-02-06 20:25:05 UTC (rev 179751)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-02-06 20:46:19 UTC (rev 179752)
@@ -2530,6 +2530,16 @@
_page->setDrawsTransparentBackground(drawsTransparentBackground);
}
+- (void)_setOverrideDeviceScaleFactor:(CGFloat)deviceScaleFactor
+{
+ [_wkView _setOverrideDeviceScaleFactor:deviceScaleFactor];
+}
+
+- (CGFloat)_overrideDeviceScaleFactor
+{
+ return [_wkView _overrideDeviceScaleFactor];
+}
+
- (void)_setTopContentInset:(CGFloat)contentInset
{
[_wkView _setTopContentInset:contentInset];
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (179751 => 179752)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h 2015-02-06 20:25:05 UTC (rev 179751)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h 2015-02-06 20:46:19 UTC (rev 179752)
@@ -155,9 +155,13 @@
@property (readonly) NSColor *_pageExtendedBackgroundColor;
@property (nonatomic, setter=_setDrawsTransparentBackground:) BOOL _drawsTransparentBackground;
@property (nonatomic, setter=_setTopContentInset:) CGFloat _topContentInset;
+
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
@property (nonatomic, setter=_setAutomaticallyAdjustsContentInsets:) BOOL _automaticallyAdjustsContentInsets;
#endif
+
+// Default value is 0. A value of 0 means the window's backing scale factor will be used and automatically update when the window moves screens.
+@property (nonatomic, setter=_setOverrideDeviceScaleFactor:) CGFloat _overrideDeviceScaleFactor WK_AVAILABLE(WK_MAC_TBA, NA);
#endif
- (void)_getMainResourceDataWithCompletionHandler:(void (^)(NSData *, NSError *))completionHandler;
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (179751 => 179752)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2015-02-06 20:25:05 UTC (rev 179751)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2015-02-06 20:46:19 UTC (rev 179752)
@@ -262,6 +262,8 @@
CGFloat _topContentInset;
CGFloat _totalHeightOfBanners;
+ CGFloat _overrideDeviceScaleFactor;
+
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
BOOL _automaticallyAdjustsContentInsets;
RetainPtr<WKActionMenuController> _actionMenuController;
@@ -2828,6 +2830,8 @@
- (float)_intrinsicDeviceScaleFactor
{
+ if (_data->_overrideDeviceScaleFactor)
+ return _data->_overrideDeviceScaleFactor;
if (_data->_targetWindowForMovePreparation)
return [_data->_targetWindowForMovePreparation backingScaleFactor];
if (NSWindow *window = [self window])
@@ -4127,6 +4131,17 @@
return _data->_ignoresAllEvents;
}
+- (void)_setOverrideDeviceScaleFactor:(CGFloat)deviceScaleFactor
+{
+ _data->_overrideDeviceScaleFactor = deviceScaleFactor;
+ _data->_page->setIntrinsicDeviceScaleFactor([self _intrinsicDeviceScaleFactor]);
+}
+
+- (CGFloat)_overrideDeviceScaleFactor
+{
+ return _data->_overrideDeviceScaleFactor;
+}
+
- (void)_dispatchSetTopContentInset
{
if (!_data->_didScheduleSetTopContentInset)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes