Title: [249366] trunk
Revision
249366
Author
bfulg...@apple.com
Date
2019-09-01 11:13:03 -0700 (Sun, 01 Sep 2019)

Log Message

[WinCairo, FTW] Properly handle device scale factor
https://bugs.webkit.org/show_bug.cgi?id=201361

Reviewed by Don Olmstead.

Source/WebCore:

Update the Direct2D ImageBuffer/ImageBufferData classes to correctly handle
the device scale factor.

* platform/graphics/win/ImageBufferDataDirect2D.cpp:
(WebCore::ImageBufferData::putData):
* platform/graphics/win/ImageBufferDirect2D.cpp:
(WebCore::ImageBuffer::putByteArray):

Source/WebKit:

Update the WebView and WebProcess to correctly handle
the device scale factor.

* UIProcess/win/WebView.cpp:
(WebKit::WebView::WebView): Tell the page the current device scale factor.
* WebProcess/win/WebProcessMainWin.cpp:
(WebKit::WebProcessMainWin): Tell the process to be aware of device scale.

Tools:

Reset zoom to 1.0; device scale is handled elsewhere.

* MiniBrowser/win/WebKitBrowserWindow.cpp:
(WebKitBrowserWindow::resetZoom):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (249365 => 249366)


--- trunk/Source/WebCore/ChangeLog	2019-09-01 16:31:51 UTC (rev 249365)
+++ trunk/Source/WebCore/ChangeLog	2019-09-01 18:13:03 UTC (rev 249366)
@@ -1,3 +1,18 @@
+2019-08-30  Brent Fulgham  <bfulg...@apple.com>
+
+        [WinCairo, FTW] Properly handle device scale factor
+        https://bugs.webkit.org/show_bug.cgi?id=201361
+
+        Reviewed by Don Olmstead.
+
+        Update the Direct2D ImageBuffer/ImageBufferData classes to correctly handle
+        the device scale factor.
+
+        * platform/graphics/win/ImageBufferDataDirect2D.cpp:
+        (WebCore::ImageBufferData::putData):
+        * platform/graphics/win/ImageBufferDirect2D.cpp:
+        (WebCore::ImageBuffer::putByteArray):
+
 2019-08-31  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         EXIF orientation should be respected when rendering images 

Modified: trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp (249365 => 249366)


--- trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp	2019-09-01 16:31:51 UTC (rev 249365)
+++ trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.cpp	2019-09-01 18:13:03 UTC (rev 249366)
@@ -172,7 +172,6 @@
 
     Checked<int> originx = sourceRect.x();
     Checked<int> destx = (Checked<int>(destPoint.x()) + sourceRect.x());
-    destx *= resolutionScale;
     ASSERT(destx.unsafeGet() >= 0);
     ASSERT(destx.unsafeGet() < size.width());
     ASSERT(originx.unsafeGet() >= 0);
@@ -179,7 +178,6 @@
     ASSERT(originx.unsafeGet() <= sourceRect.maxX());
 
     Checked<int> endx = (Checked<int>(destPoint.x()) + sourceRect.maxX());
-    endx *= resolutionScale;
     ASSERT(endx.unsafeGet() <= size.width());
 
     Checked<int> width = sourceRect.width();
@@ -187,7 +185,6 @@
 
     Checked<int> originy = sourceRect.y();
     Checked<int> desty = (Checked<int>(destPoint.y()) + sourceRect.y());
-    desty *= resolutionScale;
     ASSERT(desty.unsafeGet() >= 0);
     ASSERT(desty.unsafeGet() < size.height());
     ASSERT(originy.unsafeGet() >= 0);
@@ -194,7 +191,6 @@
     ASSERT(originy.unsafeGet() <= sourceRect.maxY());
 
     Checked<int> endy = (Checked<int>(destPoint.y()) + sourceRect.maxY());
-    endy *= resolutionScale;
     ASSERT(endy.unsafeGet() <= size.height());
 
     Checked<int> height = sourceRect.height();

Modified: trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.h (249365 => 249366)


--- trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.h	2019-09-01 16:31:51 UTC (rev 249365)
+++ trunk/Source/WebCore/platform/graphics/win/ImageBufferDataDirect2D.h	2019-09-01 18:13:03 UTC (rev 249366)
@@ -50,7 +50,7 @@
     COMPtr<ID2D1Bitmap> bitmap;
 
     RefPtr<Uint8ClampedArray> getData(AlphaPremultiplication, const IntRect&, const IntSize&, bool accelerateRendering, float resolutionScale) const;
-    void putData(const Uint8ClampedArray& source, AlphaPremultiplication sourceFormat, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, const IntSize&, bool accelerateRendering, float resolutionScale);
+    void putData(const Uint8ClampedArray& source, AlphaPremultiplication sourceFormat, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, const IntSize&, bool accelerateRendering, float resolutionScale = 1.0f);
 
     COMPtr<ID2D1Bitmap> compatibleBitmap(ID2D1RenderTarget*);
 };

Modified: trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp (249365 => 249366)


--- trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp	2019-09-01 16:31:51 UTC (rev 249365)
+++ trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2D.cpp	2019-09-01 18:13:03 UTC (rev 249366)
@@ -324,12 +324,15 @@
 
     IntRect scaledSourceRect = sourceRect;
     IntSize scaledSourceSize = sourceSize;
+    IntPoint scaledDestPoint = destPoint;
+
     if (coordinateSystem == LogicalCoordinateSystem) {
         scaledSourceRect.scale(m_resolutionScale);
         scaledSourceSize.scale(m_resolutionScale);
+        scaledDestPoint.scale(m_resolutionScale);
     }
 
-    m_data.putData(source, bufferFormat, scaledSourceSize, scaledSourceRect, destPoint, internalSize(), context().isAcceleratedContext(), 1);
+    m_data.putData(source, bufferFormat, scaledSourceSize, scaledSourceRect, scaledDestPoint, internalSize(), context().isAcceleratedContext());
 }
 
 String ImageBuffer::toDataURL(const String&, Optional<double>, PreserveResolution) const

Modified: trunk/Source/WebKit/ChangeLog (249365 => 249366)


--- trunk/Source/WebKit/ChangeLog	2019-09-01 16:31:51 UTC (rev 249365)
+++ trunk/Source/WebKit/ChangeLog	2019-09-01 18:13:03 UTC (rev 249366)
@@ -1,3 +1,18 @@
+2019-08-30  Brent Fulgham  <bfulg...@apple.com>
+
+        [WinCairo, FTW] Properly handle device scale factor
+        https://bugs.webkit.org/show_bug.cgi?id=201361
+
+        Reviewed by Don Olmstead.
+
+        Update the WebView and WebProcess to correctly handle
+        the device scale factor.
+
+        * UIProcess/win/WebView.cpp:
+        (WebKit::WebView::WebView): Tell the page the current device scale factor.
+        * WebProcess/win/WebProcessMainWin.cpp:
+        (WebKit::WebProcessMainWin): Tell the process to be aware of device scale.
+
 2019-08-31  Chris Dumez  <cdu...@apple.com>
 
         DocumentStorageAccess::hasStorageAccess() / requestStorageAccess() don't need to know about pageID / frameID

Modified: trunk/Source/WebKit/UIProcess/win/WebView.cpp (249365 => 249366)


--- trunk/Source/WebKit/UIProcess/win/WebView.cpp	2019-09-01 16:31:51 UTC (rev 249365)
+++ trunk/Source/WebKit/UIProcess/win/WebView.cpp	2019-09-01 18:13:03 UTC (rev 249366)
@@ -45,6 +45,7 @@
 #include <WebCore/Cursor.h>
 #include <WebCore/Editor.h>
 #include <WebCore/FloatRect.h>
+#include <WebCore/GDIUtilities.h>
 #include <WebCore/HWndDC.h>
 #include <WebCore/IntRect.h>
 #include <WebCore/NotImplemented.h>
@@ -246,6 +247,7 @@
 
     WebProcessPool* processPool = pageConfiguration->processPool();
     m_page = processPool->createWebPage(*m_pageClient, WTFMove(pageConfiguration));
+    m_page->setIntrinsicDeviceScaleFactor(WebCore::deviceScaleFactorForWindow(parentWindow));
     m_page->initializeWebPage();
 
     IntSize windowSize(rect.right - rect.left, rect.bottom - rect.top);

Modified: trunk/Source/WebKit/WebProcess/win/WebProcessMainWin.cpp (249365 => 249366)


--- trunk/Source/WebKit/WebProcess/win/WebProcessMainWin.cpp	2019-09-01 16:31:51 UTC (rev 249365)
+++ trunk/Source/WebKit/WebProcess/win/WebProcessMainWin.cpp	2019-09-01 18:13:03 UTC (rev 249366)
@@ -46,6 +46,9 @@
     // WebProcess uses DirectX
     HRESULT hr = ::CoInitializeEx(nullptr, COINIT_MULTITHREADED);
     RELEASE_ASSERT(SUCCEEDED(hr));
+
+    ::SetProcessDPIAware();
+
     return AuxiliaryProcessMain<WebProcess, WebProcessMain>(argc, argv);
 }
 

Modified: trunk/Tools/ChangeLog (249365 => 249366)


--- trunk/Tools/ChangeLog	2019-09-01 16:31:51 UTC (rev 249365)
+++ trunk/Tools/ChangeLog	2019-09-01 18:13:03 UTC (rev 249366)
@@ -1,3 +1,15 @@
+2019-08-30  Brent Fulgham  <bfulg...@apple.com>
+
+        [WinCairo, FTW] Properly handle device scale factor
+        https://bugs.webkit.org/show_bug.cgi?id=201361
+
+        Reviewed by Don Olmstead.
+
+        Reset zoom to 1.0; device scale is handled elsewhere.
+
+        * MiniBrowser/win/WebKitBrowserWindow.cpp:
+        (WebKitBrowserWindow::resetZoom):
+
 2019-08-30  Zhifei Fang  <zhifei_f...@apple.com>
 
         [results.webkit.org Timeline] Add notify rerender API for timeline

Modified: trunk/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp (249365 => 249366)


--- trunk/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp	2019-09-01 16:31:51 UTC (rev 249365)
+++ trunk/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp	2019-09-01 18:13:03 UTC (rev 249366)
@@ -281,7 +281,7 @@
 void WebKitBrowserWindow::resetZoom()
 {
     auto page = WKViewGetPage(m_view.get());
-    WKPageSetPageZoomFactor(page, WebCore::deviceScaleFactorForWindow(hwnd()));
+    WKPageSetPageZoomFactor(page, 1.0);
 }
 
 void WebKitBrowserWindow::zoomIn()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to