Diff
Modified: trunk/Source/WebKit/mac/ChangeLog (94121 => 94122)
--- trunk/Source/WebKit/mac/ChangeLog 2011-08-30 23:15:56 UTC (rev 94121)
+++ trunk/Source/WebKit/mac/ChangeLog 2011-08-30 23:31:31 UTC (rev 94122)
@@ -1,3 +1,19 @@
+2011-08-30 Beth Dakin <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=67150
+ Would like API to use a custom device scale factor for a particular WebView/WKView
+ -and corresponding-
+ <rdar://problem/10041016>
+
+ Reviewed by Darin Adler.
+
+ New API is _setOverrideBackingScaleFactor:(CGFloat)
+ * WebView/WebView.mm:
+ (-[WebView _setOverrideBackingScaleFactor:]):
+ (-[WebView _deviceScaleFactor]):
+ * WebView/WebViewData.h:
+ * WebView/WebViewPrivate.h:
+
2011-08-30 Aaron Colwell <[email protected]>
Add MediaSource API to HTMLMediaElement
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (94121 => 94122)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2011-08-30 23:15:56 UTC (rev 94121)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2011-08-30 23:31:31 UTC (rev 94122)
@@ -2793,6 +2793,16 @@
return view->fixedLayoutSize();
}
+- (void)_setOverrideBackingScaleFactor:(CGFloat)overrideScaleFactor
+{
+ float oldScaleFactor = [self _deviceScaleFactor];
+
+ _private->overrideBackingScaleFactor = overrideScaleFactor;
+
+ if (oldScaleFactor != [self _deviceScaleFactor])
+ _private->page->setDeviceScaleFactor(overrideScaleFactor);
+}
+
- (NSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit
{
return [self countMatchesForText:string options:(caseFlag ? 0 : WebFindOptionsCaseInsensitive) highlight:highlight limit:limit markMatches:YES];
@@ -5520,6 +5530,9 @@
- (float)_deviceScaleFactor
{
+ if (_private->overrideBackingScaleFactor != 0)
+ return _private->overrideBackingScaleFactor;
+
NSWindow *window = [self window];
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
if (window)
Modified: trunk/Source/WebKit/mac/WebView/WebViewData.h (94121 => 94122)
--- trunk/Source/WebKit/mac/WebView/WebViewData.h 2011-08-30 23:15:56 UTC (rev 94121)
+++ trunk/Source/WebKit/mac/WebView/WebViewData.h 2011-08-30 23:31:31 UTC (rev 94122)
@@ -193,5 +193,7 @@
BOOL interactiveFormValidationEnabled;
int validationMessageTimerMagnification;
+
+ float overrideBackingScaleFactor;
}
@end
Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (94121 => 94122)
--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h 2011-08-30 23:15:56 UTC (rev 94121)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h 2011-08-30 23:31:31 UTC (rev 94122)
@@ -549,6 +549,8 @@
- (BOOL)_useFixedLayout;
- (NSSize)_fixedLayoutSize;
+- (void)_setOverrideBackingScaleFactor:(CGFloat)overrideScaleFactor;
+
// Deprecated. Use the methods in pending public above instead.
- (NSUInteger)markAllMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit;
- (NSUInteger)countMatchesForText:(NSString *)string caseSensitive:(BOOL)caseFlag highlight:(BOOL)highlight limit:(NSUInteger)limit markMatches:(BOOL)markMatches;
Modified: trunk/Source/WebKit2/ChangeLog (94121 => 94122)
--- trunk/Source/WebKit2/ChangeLog 2011-08-30 23:15:56 UTC (rev 94121)
+++ trunk/Source/WebKit2/ChangeLog 2011-08-30 23:31:31 UTC (rev 94122)
@@ -1,3 +1,24 @@
+2011-08-30 Beth Dakin <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=67150
+ Would like API to use a custom device scale factor for a particular WebView/WKView
+ -and corresponding-
+ <rdar://problem/10041016>
+
+ Reviewed by Darin Adler.
+
+ New API is setOverrideBackingScaleFactor() on WKPage
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageGetOverrideBackingScaleFactor):
+ (WKPageSetOverrideBackingScaleFactor):
+ * UIProcess/API/C/WKPage.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy):
+ (WebKit::WebPageProxy::deviceScaleFactor):
+ (WebKit::WebPageProxy::setOverrideBackingScaleFactor):
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::overrideBackingScaleFactor):
+
2011-08-30 Aaron Colwell <[email protected]>
Add MediaSource API to HTMLMediaElement
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (94121 => 94122)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2011-08-30 23:15:56 UTC (rev 94121)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2011-08-30 23:31:31 UTC (rev 94122)
@@ -258,6 +258,16 @@
return toImpl(pageRef)->textZoomFactor();
}
+double WKPageGetOverrideBackingScaleFactor(WKPageRef pageRef)
+{
+ return toImpl(pageRef)->overrideBackingScaleFactor();
+}
+
+void WKPageSetOverrideBackingScaleFactor(WKPageRef pageRef, double overrideScaleFactor)
+{
+ toImpl(pageRef)->setOverrideBackingScaleFactor(overrideScaleFactor);
+}
+
bool WKPageSupportsTextZoom(WKPageRef pageRef)
{
return toImpl(pageRef)->supportsTextZoom();
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.h (94121 => 94122)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.h 2011-08-30 23:15:56 UTC (rev 94121)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.h 2011-08-30 23:31:31 UTC (rev 94122)
@@ -349,6 +349,9 @@
WK_EXPORT WKDataRef WKPageCopySessionState(WKPageRef page, void* context, WKPageSessionStateFilterCallback urlAllowedCallback);
WK_EXPORT void WKPageRestoreFromSessionState(WKPageRef page, WKDataRef sessionStateData);
+WK_EXPORT double WKPageGetOverrideBackingScaleFactor(WKPageRef page);
+WK_EXPORT void WKPageSetOverrideBackingScaleFactor(WKPageRef page, double overrideScaleFactor);
+
WK_EXPORT bool WKPageSupportsTextZoom(WKPageRef page);
WK_EXPORT double WKPageGetTextZoomFactor(WKPageRef page);
WK_EXPORT void WKPageSetTextZoomFactor(WKPageRef page, double zoomFactor);
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (94121 => 94122)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2011-08-30 23:15:56 UTC (rev 94121)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2011-08-30 23:31:31 UTC (rev 94122)
@@ -145,6 +145,7 @@
, m_pageZoomFactor(1)
, m_pageScaleFactor(1)
, m_deviceScaleFactor(1)
+ , m_overrideBackingScaleFactor(0)
, m_drawsBackground(true)
, m_drawsTransparentBackground(false)
, m_areMemoryCacheClientCallsEnabled(true)
@@ -1118,6 +1119,29 @@
m_drawingArea->deviceScaleFactorDidChange();
}
+float WebPageProxy::deviceScaleFactor() const
+{
+ if (m_overrideBackingScaleFactor)
+ return m_overrideBackingScaleFactor;
+ return m_deviceScaleFactor;
+}
+
+void WebPageProxy::setOverrideBackingScaleFactor(float overrideScaleFactor)
+{
+ if (!isValid())
+ return;
+
+ if (m_overrideBackingScaleFactor == overrideScaleFactor)
+ return;
+
+ float oldScaleFactor = deviceScaleFactor();
+
+ m_overrideBackingScaleFactor = overrideScaleFactor;
+
+ if (deviceScaleFactor() != oldScaleFactor)
+ m_drawingArea->deviceScaleFactorDidChange();
+}
+
void WebPageProxy::setUseFixedLayout(bool fixed)
{
if (!isValid())
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (94121 => 94122)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2011-08-30 23:15:56 UTC (rev 94121)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2011-08-30 23:31:31 UTC (rev 94122)
@@ -387,8 +387,11 @@
double pageScaleFactor() const { return m_pageScaleFactor; }
void setDeviceScaleFactor(float);
- float deviceScaleFactor() const { return m_deviceScaleFactor; }
+ float deviceScaleFactor() const;
+ void setOverrideBackingScaleFactor(float);
+ float overrideBackingScaleFactor() const { return m_overrideBackingScaleFactor; }
+
void setUseFixedLayout(bool);
void setFixedLayoutSize(const WebCore::IntSize&);
bool useFixedLayout() const { return m_useFixedLayout; };
@@ -860,6 +863,7 @@
double m_pageZoomFactor;
double m_pageScaleFactor;
float m_deviceScaleFactor;
+ float m_overrideBackingScaleFactor;
bool m_drawsBackground;
bool m_drawsTransparentBackground;