Diff
Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (212657 => 212658)
--- branches/safari-603-branch/Source/WebCore/ChangeLog 2017-02-20 18:22:56 UTC (rev 212657)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog 2017-02-20 18:30:27 UTC (rev 212658)
@@ -1,5 +1,34 @@
2017-02-20 Matthew Hanson <matthew_han...@apple.com>
+ Merge r212652. rdar://problem/30435303
+
+ 2017-02-20 Per Arne Vollan <pvol...@apple.com>
+
+ [Win] Custom scale factor is not applied in all cases.
+ https://bugs.webkit.org/show_bug.cgi?id=168117
+
+ Reviewed by Brent Fulgham.
+
+ We should not call the function deviceScaleFactorForWindow directly, since this
+ will return the system scale factor, and ignore the custom scale factor.
+
+ * platform/graphics/ca/win/CACFLayerTreeHost.h:
+ * platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp:
+ (WebCore::WKCACFViewLayerTreeHost::initializeContext):
+ (WebCore::WKCACFViewLayerTreeHost::resize):
+ (WebCore::WKCACFViewLayerTreeHost::setScaleFactor):
+ * platform/graphics/ca/win/WKCACFViewLayerTreeHost.h:
+ * platform/win/GDIUtilities.h:
+ (WebCore::makeScaledPoint):
+ * platform/win/PlatformMouseEventWin.cpp:
+ (WebCore::positionForEvent):
+ * platform/win/PopupMenuWin.cpp:
+ (WebCore::PopupMenuWin::show):
+ (WebCore::PopupMenuWin::wndProc):
+ * platform/win/PopupMenuWin.h:
+
+2017-02-20 Matthew Hanson <matthew_han...@apple.com>
+
Merge r212621. rdar://problem/30563318
2017-02-18 Ryosuke Niwa <rn...@webkit.org>
Modified: branches/safari-603-branch/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h (212657 => 212658)
--- branches/safari-603-branch/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h 2017-02-20 18:22:56 UTC (rev 212657)
+++ branches/safari-603-branch/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h 2017-02-20 18:30:27 UTC (rev 212658)
@@ -69,6 +69,7 @@
void setPage(Page*);
virtual void paint(HDC = nullptr);
virtual void resize() = 0;
+ virtual void setScaleFactor(float) = 0;
void flushPendingGraphicsLayerChangesSoon();
virtual void setShouldInvertColors(bool);
#if USE(AVFOUNDATION)
Modified: branches/safari-603-branch/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp (212657 => 212658)
--- branches/safari-603-branch/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp 2017-02-20 18:22:56 UTC (rev 212657)
+++ branches/safari-603-branch/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp 2017-02-20 18:30:27 UTC (rev 212658)
@@ -124,12 +124,6 @@
void WKCACFViewLayerTreeHost::initializeContext(void* userData, PlatformCALayer* layer)
{
-#if HAVE(CACFLAYER_SETCONTENTSSCALE)
- float scaleFactor = deviceScaleFactorForWindow(nullptr);
- CACFLayerSetTransform(layer->platformLayer(), CATransform3DMakeScale(scaleFactor, scaleFactor, 1));
- CACFLayerSetContentsScale(layer->platformLayer(), scaleFactor);
-#endif
-
WKCACFViewSetContextUserData(m_view.get(), userData);
WKCACFViewSetLayer(m_view.get(), layer->platformLayer());
WKCACFViewSetContextDidChangeCallback(m_view.get(), contextDidChangeCallback, this);
@@ -140,6 +134,14 @@
m_viewNeedsUpdate = true;
}
+void WKCACFViewLayerTreeHost::setScaleFactor(float scaleFactor)
+{
+#if HAVE(CACFLAYER_SETCONTENTSSCALE)
+ CACFLayerSetTransform(rootLayer()->platformLayer(), CATransform3DMakeScale(scaleFactor, scaleFactor, 1));
+ CACFLayerSetContentsScale(rootLayer()->platformLayer(), scaleFactor);
+#endif
+}
+
bool WKCACFViewLayerTreeHost::createRenderer()
{
updateViewIfNeeded();
Modified: branches/safari-603-branch/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h (212657 => 212658)
--- branches/safari-603-branch/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h 2017-02-20 18:22:56 UTC (rev 212657)
+++ branches/safari-603-branch/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h 2017-02-20 18:30:27 UTC (rev 212658)
@@ -46,6 +46,7 @@
virtual void initializeContext(void* userData, PlatformCALayer*);
virtual void resize();
+ virtual void setScaleFactor(float);
virtual void destroyRenderer();
virtual void flushContext();
virtual void contextDidChange();
Modified: branches/safari-603-branch/Source/WebCore/platform/win/GDIUtilities.h (212657 => 212658)
--- branches/safari-603-branch/Source/WebCore/platform/win/GDIUtilities.h 2017-02-20 18:22:56 UTC (rev 212657)
+++ branches/safari-603-branch/Source/WebCore/platform/win/GDIUtilities.h 2017-02-20 18:30:27 UTC (rev 212658)
@@ -26,6 +26,8 @@
#ifndef GDIUtilties_h
#define GDIUtilties_h
+#include <IntPoint.h>
+
#include <windows.h>
namespace WebCore {
@@ -32,6 +34,13 @@
WEBCORE_EXPORT float deviceScaleFactorForWindow(HWND);
+inline LPARAM makeScaledPoint(IntPoint point, float scaleFactor)
+{
+ float inverseScaleFactor = 1.0f / scaleFactor;
+ point.scale(inverseScaleFactor, inverseScaleFactor);
+ return MAKELPARAM(point.x(), point.y());
+}
+
} // namespace WebCore
#endif // GDIUtilties_h
Modified: branches/safari-603-branch/Source/WebCore/platform/win/PlatformMouseEventWin.cpp (212657 => 212658)
--- branches/safari-603-branch/Source/WebCore/platform/win/PlatformMouseEventWin.cpp 2017-02-20 18:22:56 UTC (rev 212657)
+++ branches/safari-603-branch/Source/WebCore/platform/win/PlatformMouseEventWin.cpp 2017-02-20 18:30:27 UTC (rev 212658)
@@ -42,8 +42,6 @@
static IntPoint positionForEvent(HWND hWnd, LPARAM lParam)
{
IntPoint point(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
- float inverseScaleFactor = 1.0f / deviceScaleFactorForWindow(hWnd);
- point.scale(inverseScaleFactor, inverseScaleFactor);
return point;
}
Modified: branches/safari-603-branch/Source/WebCore/platform/win/PopupMenuWin.cpp (212657 => 212658)
--- branches/safari-603-branch/Source/WebCore/platform/win/PopupMenuWin.cpp 2017-02-20 18:22:56 UTC (rev 212657)
+++ branches/safari-603-branch/Source/WebCore/platform/win/PopupMenuWin.cpp 2017-02-20 18:30:27 UTC (rev 212658)
@@ -31,6 +31,7 @@
#include "FontSelector.h"
#include "Frame.h"
#include "FrameView.h"
+#include "GDIUtilities.h"
#include "GraphicsContext.h"
#include "HTMLNames.h"
#include "HWndDC.h"
@@ -131,6 +132,9 @@
if (clientRect().isEmpty())
return;
+ if (view && view->frame().page())
+ m_scaleFactor = view->frame().page()->deviceScaleFactor();
+
HWND hostWindow = view->hostWindow()->platformPageClient();
if (!m_scrollbar && visibleItems() < client()->listSize()) {
@@ -958,7 +962,7 @@
if (scrollbarCapturingMouse() || scrollBarRect.contains(mousePoint)) {
// Put the point into coordinates relative to the scroll bar
mousePoint.move(-scrollBarRect.x(), -scrollBarRect.y());
- PlatformMouseEvent event(hWnd, message, wParam, MAKELPARAM(mousePoint.x(), mousePoint.y()));
+ PlatformMouseEvent event(hWnd, message, wParam, makeScaledPoint(mousePoint, m_scaleFactor));
scrollbar()->mouseMoved(event);
break;
}
@@ -995,7 +999,7 @@
if (scrollBarRect.contains(mousePoint)) {
// Put the point into coordinates relative to the scroll bar
mousePoint.move(-scrollBarRect.x(), -scrollBarRect.y());
- PlatformMouseEvent event(hWnd, message, wParam, MAKELPARAM(mousePoint.x(), mousePoint.y()));
+ PlatformMouseEvent event(hWnd, message, wParam, makeScaledPoint(mousePoint, m_scaleFactor));
scrollbar()->mouseDown(event);
setScrollbarCapturingMouse(true);
break;
@@ -1022,7 +1026,7 @@
setScrollbarCapturingMouse(false);
// Put the point into coordinates relative to the scroll bar
mousePoint.move(-scrollBarRect.x(), -scrollBarRect.y());
- PlatformMouseEvent event(hWnd, message, wParam, MAKELPARAM(mousePoint.x(), mousePoint.y()));
+ PlatformMouseEvent event(hWnd, message, wParam, makeScaledPoint(mousePoint, m_scaleFactor));
scrollbar()->mouseUp(event);
// FIXME: This is a hack to work around Scrollbar not invalidating correctly when it doesn't have a parent widget
RECT r = scrollBarRect;
Modified: branches/safari-603-branch/Source/WebCore/platform/win/PopupMenuWin.h (212657 => 212658)
--- branches/safari-603-branch/Source/WebCore/platform/win/PopupMenuWin.h 2017-02-20 18:22:56 UTC (rev 212657)
+++ branches/safari-603-branch/Source/WebCore/platform/win/PopupMenuWin.h 2017-02-20 18:30:27 UTC (rev 212658)
@@ -134,6 +134,7 @@
bool m_wasClicked { false };
bool m_scrollbarCapturingMouse { false };
bool m_showPopup { false };
+ float m_scaleFactor { 1 };
friend class AccessiblePopupMenu;
};
Modified: branches/safari-603-branch/Source/WebKit/win/ChangeLog (212657 => 212658)
--- branches/safari-603-branch/Source/WebKit/win/ChangeLog 2017-02-20 18:22:56 UTC (rev 212657)
+++ branches/safari-603-branch/Source/WebKit/win/ChangeLog 2017-02-20 18:30:27 UTC (rev 212658)
@@ -1,3 +1,22 @@
+2017-02-20 Matthew Hanson <matthew_han...@apple.com>
+
+ Merge r212652. rdar://problem/30435303
+
+ 2017-02-20 Per Arne Vollan <pvol...@apple.com>
+
+ [Win] Custom scale factor is not applied in all cases.
+ https://bugs.webkit.org/show_bug.cgi?id=168117
+
+ Reviewed by Brent Fulgham.
+
+ We should not call the function deviceScaleFactorForWindow directly, since this
+ will return the system scale factor, and ignore the custom scale factor.
+
+ * WebView.cpp:
+ (WebView::handleContextMenuEvent):
+ (WebView::handleMouseEvent):
+ (WebView::setAcceleratedCompositing):
+
2017-02-17 Matthew Hanson <matthew_han...@apple.com>
Rollout r212500. rdar://problem/29904368
Modified: branches/safari-603-branch/Source/WebKit/win/WebView.cpp (212657 => 212658)
--- branches/safari-603-branch/Source/WebKit/win/WebView.cpp 2017-02-20 18:22:56 UTC (rev 212657)
+++ branches/safari-603-branch/Source/WebKit/win/WebView.cpp 2017-02-20 18:30:27 UTC (rev 212658)
@@ -1658,7 +1658,7 @@
Frame* targetFrame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document().frame() : &m_page->focusController().focusedOrMainFrame();
targetFrame->view()->setCursor(pointerCursor());
- PlatformMouseEvent mouseEvent(m_viewWindow, WM_RBUTTONUP, wParam, lParam);
+ PlatformMouseEvent mouseEvent(m_viewWindow, WM_RBUTTONUP, wParam, makeScaledPoint(IntPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)), deviceScaleFactor()));
bool handledEvent = targetFrame->eventHandler().sendContextMenuEvent(mouseEvent);
if (!handledEvent)
return false;
@@ -1826,7 +1826,7 @@
// Create our event.
// On WM_MOUSELEAVE we need to create a mouseout event, so we force the position
// of the event to be at (MINSHORT, MINSHORT).
- LPARAM position = (message == WM_MOUSELEAVE) ? ((MINSHORT << 16) | MINSHORT) : lParam;
+ LPARAM position = (message == WM_MOUSELEAVE) ? ((MINSHORT << 16) | MINSHORT) : makeScaledPoint(IntPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)), deviceScaleFactor());
PlatformMouseEvent mouseEvent(m_viewWindow, message, wParam, position, m_mouseActivated);
setMouseActivated(false);
@@ -7152,6 +7152,7 @@
ASSERT(m_viewWindow);
m_layerTreeHost->setWindow(m_viewWindow);
m_layerTreeHost->setPage(page());
+ m_layerTreeHost->setScaleFactor(deviceScaleFactor());
// FIXME: We could perhaps get better performance by never allowing this layer to
// become tiled (or choosing a higher-than-normal tiling threshold).