https://bugs.webkit.org/show_bug.cgi?id=87919
<rdar://problem/
11563242>
Reviewed by Dean Jackson.
Connect the test infrastructure for High DPI tests to Windows. This
involved adding a new accessor to the IWebViewPrivate interface, and
providing a rudimentary implemenation of DPI support on Windows.
* Interfaces/IWebViewPrivate.idl: Add new API to set/get scaling
factor.
* WebView.cpp:
(WebView::initWithFrame): Initialize the device scale factor.
(WebView::setHostWindow): Ditto.
(WebView::windowAncestryDidChange): Ditto.
(WebView::deviceScaleFactor): Added. Check current window for scaling
factor. If no windows exist, check main screen.
(WebView::setCustomBackingScaleFactor): Added.
(WebView::backingScaleFactor): Added.
* WebView.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185982
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-06-25 Brent Fulgham <bfulgham@apple.com>
+
+ [Win] Need implementation of layoutTestController.setBackingScaleFactor
+ https://bugs.webkit.org/show_bug.cgi?id=87919
+ <rdar://problem/11563242>
+
+ Reviewed by Dean Jackson.
+
+ Connect the test infrastructure for High DPI tests to Windows. This
+ involved adding a new accessor to the IWebViewPrivate interface, and
+ providing a rudimentary implemenation of DPI support on Windows.
+
+ * Interfaces/IWebViewPrivate.idl: Add new API to set/get scaling
+ factor.
+ * WebView.cpp:
+ (WebView::initWithFrame): Initialize the device scale factor.
+ (WebView::setHostWindow): Ditto.
+ (WebView::windowAncestryDidChange): Ditto.
+ (WebView::deviceScaleFactor): Added. Check current window for scaling
+ factor. If no windows exist, check main screen.
+ (WebView::setCustomBackingScaleFactor): Added.
+ (WebView::backingScaleFactor): Added.
+ * WebView.h:
+
2015-06-24 Anders Carlsson <andersca@apple.com>
Move PluginMainThreadScheduler to WebKit/win
/*
- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
HRESULT scaleWebView([in] double scale, [in] POINT origin);
HRESULT dispatchPendingLoadRequests();
+
+ HRESULT setCustomBackingScaleFactor([in] double);
+ HRESULT backingScaleFactor([out] double*);
}
/*
- * Copyright (C) 2006-2014 Apple, Inc. All rights reserved.
+ * Copyright (C) 2006-2015 Apple, Inc. All rights reserved.
* Copyright (C) 2009, 2010, 2011 Appcelerator, Inc. All rights reserved.
* Copyright (C) 2011 Brent Fulgham. All rights reserved.
*
ASSERT(webView);
// Windows Media Player has a modal message loop that will deliver messages
- // to us at inappropriate times and we will crash if we handle them when
+ // to us at inappropriate times and we will crash if we handle them when:
// they are delivered. We repost paint messages so that we eventually get
// a chance to paint once the modal loop has exited, but other messages
// aren't safe to repost, so we just drop them.
notifyCenter->addObserver(this, WebPreferences::webPreferencesChangedNotification(), static_cast<IWebPreferences*>(m_preferences.get()));
m_preferences->postPreferencesChangesNotification();
+ m_page->setDeviceScaleFactor(deviceScaleFactor());
+
setSmartInsertDeleteEnabled(TRUE);
return hr;
}
windowAncestryDidChange();
+ if (m_page)
+ m_page->setDeviceScaleFactor(deviceScaleFactor());
+
return S_OK;
}
if (m_topLevelParent)
WindowMessageBroadcaster::addListener(m_topLevelParent, this);
+ if (m_page)
+ m_page->setDeviceScaleFactor(deviceScaleFactor());
+
updateActiveState();
return S_OK;
resourceLoadScheduler()->servePendingRequests();
return S_OK;
}
+
+static float scaleFactorFromWindow(HWND window)
+{
+ HWndDC dc(window);
+ return ::GetDeviceCaps(dc, LOGPIXELSX) / 96.0f;
+}
+
+float WebView::deviceScaleFactor() const
+{
+ if (m_customDeviceScaleFactor)
+ return m_customDeviceScaleFactor;
+
+ // FIXME(146335): Should check for Windows 8.1 High DPI Features here first.
+
+ if (m_viewWindow)
+ return scaleFactorFromWindow(m_viewWindow);
+
+ if (m_hostWindow)
+ return scaleFactorFromWindow(m_hostWindow);
+
+ return scaleFactorFromWindow(0);
+}
+
+HRESULT WebView::setCustomBackingScaleFactor(double customScaleFactor)
+{
+ double oldScaleFactor = deviceScaleFactor();
+
+ m_customDeviceScaleFactor = customScaleFactor;
+
+ if (oldScaleFactor != deviceScaleFactor())
+ m_page->setDeviceScaleFactor(deviceScaleFactor());
+
+ return S_OK;
+}
+
+HRESULT WebView::backingScaleFactor(double* factor)
+{
+ if (!factor)
+ return E_POINTER;
+
+ *factor = deviceScaleFactor();
+
+ return S_OK;
+}
virtual HRESULT STDMETHODCALLTYPE setUsesLayeredWindow(BOOL);
virtual HRESULT STDMETHODCALLTYPE usesLayeredWindow(BOOL*);
+ virtual HRESULT STDMETHODCALLTYPE setCustomBackingScaleFactor(double);
+ virtual HRESULT STDMETHODCALLTYPE backingScaleFactor(double*);
+
// WebView
bool shouldUseEmbeddedView(const WTF::String& mimeType) const;
HRESULT STDMETHODCALLTYPE scaleWebView(double scale, POINT origin);
HRESULT STDMETHODCALLTYPE dispatchPendingLoadRequests();
+ float deviceScaleFactor() const;
+
protected:
static bool registerWebViewWindowClass();
static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
WTF::String m_userAgentCustom;
WTF::String m_userAgentStandard;
float m_zoomMultiplier;
+ float m_customDeviceScaleFactor { 0 };
bool m_zoomsTextOnly;
WTF::String m_overrideEncoding;
WTF::String m_applicationName;