WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
WIP patch
wip.diff (text/plain), 11.77 KB, created by
Fujii Hironori
on 2019-09-02 01:16:15 PDT
(
hide
)
Description:
WIP patch
Filename:
MIME Type:
Creator:
Fujii Hironori
Created:
2019-09-02 01:16:15 PDT
Size:
11.77 KB
patch
obsolete
>diff --git a/Source/WebKit/UIProcess/win/PageClientImpl.cpp b/Source/WebKit/UIProcess/win/PageClientImpl.cpp >index be61bbdfe5e..cd57680dc88 100644 >--- a/Source/WebKit/UIProcess/win/PageClientImpl.cpp >+++ b/Source/WebKit/UIProcess/win/PageClientImpl.cpp >@@ -68,10 +68,7 @@ WebCore::FloatPoint PageClientImpl::viewScrollPosition() > > WebCore::IntSize PageClientImpl::viewSize() > { >- RECT clientRect; >- GetClientRect(m_view.window(), &clientRect); >- >- return IntRect(clientRect).size(); >+ return m_view.viewSize(); > } > > bool PageClientImpl::isViewWindowActive() >diff --git a/Source/WebKit/UIProcess/win/WebContextMenuProxyWin.cpp b/Source/WebKit/UIProcess/win/WebContextMenuProxyWin.cpp >index aa171f48bc4..33d1e7c41df 100644 >--- a/Source/WebKit/UIProcess/win/WebContextMenuProxyWin.cpp >+++ b/Source/WebKit/UIProcess/win/WebContextMenuProxyWin.cpp >@@ -103,7 +103,9 @@ void WebContextMenuProxyWin::showContextMenuWithItems(Vector<Ref<WebContextMenuI > populate(m_context, m_menu, items); > > UINT flags = TPM_RIGHTBUTTON | TPM_TOPALIGN | TPM_VERPOSANIMATION | TPM_HORIZONTAL | TPM_LEFTALIGN | TPM_HORPOSANIMATION; >- POINT pt { m_context.menuLocation().x(), m_context.menuLocation().y() }; >+ auto location = m_context.menuLocation(); >+ location.scale(m_page.deviceScaleFactor()); >+ POINT pt = location; > HWND wnd = m_page.viewWidget(); > ::ClientToScreen(wnd, &pt); > ::TrackPopupMenuEx(m_menu, flags, pt.x, pt.y, m_page.viewWidget(), nullptr); >diff --git a/Source/WebKit/UIProcess/win/WebInspectorProxyWin.cpp b/Source/WebKit/UIProcess/win/WebInspectorProxyWin.cpp >index db92e123752..3111260b611 100644 >--- a/Source/WebKit/UIProcess/win/WebInspectorProxyWin.cpp >+++ b/Source/WebKit/UIProcess/win/WebInspectorProxyWin.cpp >@@ -38,6 +38,7 @@ > #include "WebProcessPool.h" > #include "WebView.h" > #include <WebCore/CertificateInfo.h> >+#include <WebCore/GDIUtilities.h> > #include <WebCore/InspectorFrontendClientLocal.h> > #include <WebCore/NotImplemented.h> > #include <WebCore/WebCoreBundleWin.h> >@@ -298,16 +299,18 @@ String WebInspectorProxy::inspectorBaseURL() > > unsigned WebInspectorProxy::platformInspectedWindowHeight() > { >+ auto deviceScaleFactor = WebCore::deviceScaleFactorForWindow(m_inspectorViewWindow); > RECT rect; > ::GetClientRect(m_inspectedViewWindow, &rect); >- return rect.bottom - rect.top; >+ return (rect.bottom - rect.top) / deviceScaleFactor; > } > > unsigned WebInspectorProxy::platformInspectedWindowWidth() > { >+ auto deviceScaleFactor = WebCore::deviceScaleFactorForWindow(m_inspectorViewWindow); > RECT rect; > ::GetClientRect(m_inspectedViewWindow, &rect); >- return rect.right - rect.left; >+ return (rect.right - rect.left) / deviceScaleFactor; > } > > void WebInspectorProxy::platformAttach() >@@ -361,6 +364,7 @@ void WebInspectorProxy::platformDetach() > > void WebInspectorProxy::platformSetAttachedWindowHeight(unsigned height) > { >+ height *= WebCore::deviceScaleFactorForWindow(m_inspectorViewWindow); > auto windowInfo = getInspectedWindowInfo(m_inspectedViewWindow, m_inspectedViewParentWindow); > ::SetWindowPos(m_inspectorViewWindow, 0, windowInfo.left, windowInfo.parentHeight - height, windowInfo.parentWidth - windowInfo.left, height, SWP_NOZORDER); > ::SetWindowPos(m_inspectedViewWindow, 0, windowInfo.left, windowInfo.top, windowInfo.parentWidth - windowInfo.left, windowInfo.parentHeight - windowInfo.top, SWP_NOZORDER); >@@ -368,6 +372,7 @@ void WebInspectorProxy::platformSetAttachedWindowHeight(unsigned height) > > void WebInspectorProxy::platformSetAttachedWindowWidth(unsigned width) > { >+ width *= WebCore::deviceScaleFactorForWindow(m_inspectorViewWindow); > auto windowInfo = getInspectedWindowInfo(m_inspectedViewWindow, m_inspectedViewParentWindow); > ::SetWindowPos(m_inspectorViewWindow, 0, windowInfo.parentWidth - width, windowInfo.top, width, windowInfo.parentHeight - windowInfo.top, SWP_NOZORDER); > ::SetWindowPos(m_inspectedViewWindow, 0, windowInfo.left, windowInfo.top, windowInfo.parentWidth - windowInfo.left, windowInfo.parentHeight - windowInfo.top, SWP_NOZORDER); >diff --git a/Source/WebKit/UIProcess/win/WebView.cpp b/Source/WebKit/UIProcess/win/WebView.cpp >index 000350ca5fe..41d3f9a0f82 100644 >--- a/Source/WebKit/UIProcess/win/WebView.cpp >+++ b/Source/WebKit/UIProcess/win/WebView.cpp >@@ -42,9 +42,11 @@ > #include "WebProcessPool.h" > #include <Commctrl.h> > #include <WebCore/BitmapInfo.h> >+#include <WebCore/CairoUtilities.h> > #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> >@@ -247,17 +249,15 @@ WebView::WebView(RECT rect, const API::PageConfiguration& configuration, HWND pa > WebProcessPool* processPool = pageConfiguration->processPool(); > m_page = processPool->createWebPage(*m_pageClient, WTFMove(pageConfiguration)); > m_page->initializeWebPage(); >+ m_page->setIntrinsicDeviceScaleFactor(deviceScaleFactorForWindow(m_window)); > >- IntSize windowSize(rect.right - rect.left, rect.bottom - rect.top); > #if USE(DIRECT2D) >+ IntSize windowSize(rect.right - rect.left, rect.bottom - rect.top); > Direct2D::createDeviceAndContext(m_d3dDevice, m_immediateContext); > m_page->setDevice(m_d3dDevice.get()); > setupSwapChain(windowSize); > #endif > >- if (m_page->drawingArea()) >- m_page->drawingArea()->setSize(windowSize); >- > #if ENABLE(REMOTE_INSPECTOR) > m_page->setURLSchemeHandlerForScheme(RemoteInspectorProtocolHandler::create(*m_page), "inspector"); > #endif >@@ -350,6 +350,25 @@ void WebView::windowAncestryDidChange() > > LRESULT WebView::onMouseEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) > { >+ switch (message) { >+ case WM_LBUTTONDOWN: >+ case WM_MBUTTONDOWN: >+ case WM_RBUTTONDOWN: >+ case WM_LBUTTONUP: >+ case WM_MBUTTONUP: >+ case WM_RBUTTONUP: >+ case WM_MOUSEMOVE: >+ case WM_LBUTTONDBLCLK: >+ case WM_MBUTTONDBLCLK: >+ case WM_RBUTTONDBLCLK: >+ lParam = makeScaledPoint(MAKEPOINTS(lParam), m_page->deviceScaleFactor()); >+ break; >+ case WM_MOUSELEAVE: >+ break; >+ default: >+ ASSERT_NOT_REACHED(); >+ } >+ > NativeWebMouseEvent mouseEvent = NativeWebMouseEvent(hWnd, message, wParam, lParam, m_wasActivatedByMouseEvent); > setWasActivatedByMouseEvent(false); > >@@ -387,6 +406,7 @@ LRESULT WebView::onMouseEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa > > LRESULT WebView::onWheelEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) > { >+ lParam = makeScaledPoint(MAKEPOINTS(lParam), m_page->deviceScaleFactor()); > NativeWebWheelEvent wheelEvent(hWnd, message, wParam, lParam); > if (wheelEvent.controlKey()) { > // We do not want WebKit to handle Control + Wheel, this should be handled by the client application >@@ -475,25 +495,29 @@ LRESULT WebView::onKeyEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara > return 0; > } > >-static void drawPageBackground(HDC dc, const WebPageProxy* page, const RECT& rect) >+static void drawPageBackground(HDC dc, const WebPageProxy* page, IntRect rect) > { > auto& backgroundColor = page->backgroundColor(); > if (!backgroundColor || backgroundColor.value().isVisible()) > return; > >- ::FillRect(dc, &rect, reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1)); >+ rect.scale(page->deviceScaleFactor()); >+ RECT viewRect(rect); >+ ::FillRect(dc, &viewRect, reinterpret_cast<HBRUSH>(COLOR_WINDOW + 1)); > } > > void WebView::paint(HDC hdc, const IntRect& dirtyRect) > { > if (dirtyRect.isEmpty()) > return; >+ auto deviceScaleFactor = m_page->deviceScaleFactor(); > m_page->endPrinting(); > if (auto* drawingArea = static_cast<DrawingAreaProxyCoordinatedGraphics*>(m_page->drawingArea())) { > // FIXME: We should port WebKit1's rect coalescing logic here. > Region unpaintedRegion; > #if USE(CAIRO) > cairo_surface_t* surface = cairo_win32_surface_create(hdc); >+ cairoSurfaceSetDeviceScale(surface, deviceScaleFactor, deviceScaleFactor); > cairo_t* context = cairo_create(surface); > > drawingArea->paint(context, dirtyRect, unpaintedRegion); >@@ -525,7 +549,9 @@ LRESULT WebView::onPaintEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& han > > PAINTSTRUCT paintStruct; > HDC hdc = ::BeginPaint(m_window, &paintStruct); >- paint(hdc, paintStruct.rcPaint); >+ IntRect dirtyRect(paintStruct.rcPaint); >+ dirtyRect.scale(1 / m_page->deviceScaleFactor()); >+ paint(hdc, dirtyRect); > > ::EndPaint(m_window, &paintStruct); > >@@ -547,14 +573,13 @@ LRESULT WebView::onPrintClientEvent(HWND hWnd, UINT, WPARAM wParam, LPARAM, bool > > LRESULT WebView::onSizeEvent(HWND hwnd, UINT, WPARAM, LPARAM lParam, bool& handled) > { >- int width = LOWORD(lParam); >- int height = HIWORD(lParam); >+ m_viewSize = IntSize(LOWORD(lParam), HIWORD(lParam)); >+ m_viewSize.scale(1 / deviceScaleFactorForWindow(hwnd)); > >- IntSize windowSize(width, height); > > if (m_page && m_page->drawingArea()) { > // FIXME specify correctly layerPosition. >- m_page->drawingArea()->setSize(windowSize, m_nextResizeScrollOffset); >+ m_page->drawingArea()->setSize(m_viewSize, m_nextResizeScrollOffset); > m_nextResizeScrollOffset = IntSize(); > } > >@@ -569,6 +594,7 @@ LRESULT WebView::onSizeEvent(HWND hwnd, UINT, WPARAM, LPARAM lParam, bool& handl > HRESULT hr = m_swapChain->ResizeBuffers(0, 0, 0, DXGI_FORMAT_UNKNOWN, DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE); > RELEASE_ASSERT(SUCCEEDED(hr)); > >+ IntSize windowSize(LOWORD(lParam), HIWORD(lParam)); > configureBackingStore(windowSize); > } > #endif >@@ -863,12 +889,15 @@ void WebView::setScrollOffsetOnNextResize(const IntSize& scrollOffset) > { > // The next time we get a WM_SIZE message, scroll by the specified amount in onSizeEvent(). > m_nextResizeScrollOffset = scrollOffset; >+ m_nextResizeScrollOffset.scale(1 / m_page->deviceScaleFactor()); > } > > void WebView::setViewNeedsDisplay(const WebCore::Region& region) > { >- const RECT r = region.bounds(); >- ::InvalidateRect(m_window, &r, true); >+ auto rect = region.bounds(); >+ rect.scale(m_page->deviceScaleFactor()); >+ const RECT viewRect(rect); >+ ::InvalidateRect(m_window, &viewRect, true); > } > > #if ENABLE(INPUT_TYPE_COLOR) >diff --git a/Source/WebKit/UIProcess/win/WebView.h b/Source/WebKit/UIProcess/win/WebView.h >index 27f89720cd5..52006d1785b 100644 >--- a/Source/WebKit/UIProcess/win/WebView.h >+++ b/Source/WebKit/UIProcess/win/WebView.h >@@ -65,6 +65,7 @@ public: > HWND window() const { return m_window; } > void setParentWindow(HWND); > void windowAncestryDidChange(); >+ WebCore::IntSize viewSize() { return m_viewSize; } > void setIsInWindow(bool); > void setIsVisible(bool); > bool isWindowActive(); >@@ -167,6 +168,7 @@ private: > > std::unique_ptr<WebKit::PageClientImpl> m_pageClient; > RefPtr<WebPageProxy> m_page; >+ WebCore::IntSize m_viewSize; > #if USE(DIRECT2D) > COMPtr<ID3D11Device1> m_d3dDevice; > COMPtr<ID3D11DeviceContext1> m_immediateContext; >diff --git a/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp b/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp >index cafaaa4161f..269ccec3906 100644 >--- a/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp >+++ b/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp >@@ -159,7 +159,6 @@ WebKitBrowserWindow::WebKitBrowserWindow(BrowserWindowClient& client, WKPageConf > WKPageSetPageStateClient(page, &stateClient.base); > > updateProxySettings(); >- resetZoom(); > } > > void WebKitBrowserWindow::updateProxySettings() >@@ -281,7 +280,7 @@ void WebKitBrowserWindow::updateStatistics(HWND hDlg) > void WebKitBrowserWindow::resetZoom() > { > auto page = WKViewGetPage(m_view.get()); >- WKPageSetPageZoomFactor(page, WebCore::deviceScaleFactorForWindow(hwnd())); >+ WKPageSetPageZoomFactor(page, 1); > } > > void WebKitBrowserWindow::zoomIn()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 196339
:
366152
|
377841
|
377843
|
377844
|
377847
|
377874
|
450489