Skip to content

Commit 3c01bf6

Browse files
authored
browser(webkit): account for non-Mac device scale factor (#1661)
1 parent b7d0c32 commit 3c01bf6

File tree

2 files changed

+29
-25
lines changed

2 files changed

+29
-25
lines changed

browser_patches/webkit/BUILD_NUMBER

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1187
1+
1188

browser_patches/webkit/patches/bootstrap.diff

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2752,6 +2752,7 @@ index ee9edb30dd7b3461c4d491dfaf7929011d498bc9..71b51b0261494112b23800fe02f5e31b
27522752
}
27532753

27542754
-void InspectorNetworkAgent::interceptContinue(ErrorString& errorString, const String& requestId)
2755+
-{
27552756
+bool InspectorNetworkAgent::interceptRequest(ResourceLoader& loader, Function<void(bool handled)>&& handler) {
27562757
+ if (!m_interceptionEnabled || !m_interceptRequests)
27572758
+ return false;
@@ -2765,10 +2766,7 @@ index ee9edb30dd7b3461c4d491dfaf7929011d498bc9..71b51b0261494112b23800fe02f5e31b
27652766
+}
27662767
+
27672768
+void InspectorNetworkAgent::interceptContinue(ErrorString& errorString, const String& requestId, const String* method, const JSON::Object* headers, const String* postData)
2768-
{
2769-
- auto pendingInterceptResponse = m_pendingInterceptResponses.take(requestId);
2770-
- if (!pendingInterceptResponse) {
2771-
- errorString = "Missing pending intercept response for given requestId"_s;
2769+
+{
27722770
+ auto pendingRequest = m_pendingInterceptRequests.take(requestId);
27732771
+ if (pendingRequest) {
27742772
+ ResourceLoader* loader = pendingRequest->m_loader.get();
@@ -2799,16 +2797,18 @@ index ee9edb30dd7b3461c4d491dfaf7929011d498bc9..71b51b0261494112b23800fe02f5e31b
27992797
+ request->setHTTPBody(WTFMove(data));
28002798
+ }
28012799
+ pendingRequest->m_callback(false);
2800+
+ return;
2801+
+ }
2802+
+
2803+
auto pendingInterceptResponse = m_pendingInterceptResponses.take(requestId);
2804+
- if (!pendingInterceptResponse) {
2805+
- errorString = "Missing pending intercept response for given requestId"_s;
2806+
+ if (pendingInterceptResponse) {
2807+
+ pendingInterceptResponse->respondWithOriginalResponse();
28022808
return;
28032809
}
28042810

28052811
- pendingInterceptResponse->respondWithOriginalResponse();
2806-
+ auto pendingInterceptResponse = m_pendingInterceptResponses.take(requestId);
2807-
+ if (pendingInterceptResponse) {
2808-
+ pendingInterceptResponse->respondWithOriginalResponse();
2809-
+ return;
2810-
+ }
2811-
+
28122812
+ errorString = "Missing pending intercept response for given requestId"_s;
28132813
}
28142814

@@ -3132,16 +3132,16 @@ index 09dd591948baa0bf4a31cc57b391792faae97a57..d5d4a44e4d921ed3b60a2ac093346b93
31323132
+ Frame* frame = frameId ? assertFrame(errorString, *frameId) : &m_inspectedPage.mainFrame();
31333133
+ if (!frame)
31343134
+ return;
3135-
3136-
- ResourceRequest resourceRequest { frame.document()->completeURL(url) };
3137-
- FrameLoadRequest frameLoadRequest { *frame.document(), frame.document()->securityOrigin(), WTFMove(resourceRequest), "_self"_s, LockHistory::No, LockBackForwardList::No, ReferrerPolicy::EmptyString, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow, InitiatedByMainFrame::Unknown };
3138-
- frame.loader().changeLocation(WTFMove(frameLoadRequest));
3135+
+
31393136
+ ResourceRequest resourceRequest { frame->document()->completeURL(url) };
31403137
+ if (!resourceRequest.url().isValid()) {
31413138
+ errorString = "Cannot navigate to invalid URL"_s;
31423139
+ return;
31433140
+ }
3144-
+
3141+
3142+
- ResourceRequest resourceRequest { frame.document()->completeURL(url) };
3143+
- FrameLoadRequest frameLoadRequest { *frame.document(), frame.document()->securityOrigin(), WTFMove(resourceRequest), "_self"_s, LockHistory::No, LockBackForwardList::No, ReferrerPolicy::EmptyString, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow, InitiatedByMainFrame::Unknown };
3144+
- frame.loader().changeLocation(WTFMove(frameLoadRequest));
31453145
+ if (referrer)
31463146
+ resourceRequest.setInitiatorIdentifier(InspectorNetworkAgent::createInitiatorIdentifierForInspectorNavigation(*referrer));
31473147
+ FrameLoadRequest frameLoadRequest { *frame->document(), frame->document()->securityOrigin(), WTFMove(resourceRequest), "_self"_s, LockHistory::No, LockBackForwardList::No, ReferrerPolicy::EmptyString, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow, InitiatedByMainFrame::Unknown };
@@ -4415,19 +4415,23 @@ index 69146c375b32cec512d7750f114a0a4f8e614f1a..403fefc5e2f3ab69f3a51919e9e70666
44154415

44164416
Ref<Frame> Frame::create(Page* page, HTMLFrameOwnerElement* ownerElement, UniqueRef<FrameLoaderClient>&& client)
44174417
diff --git a/Source/WebCore/page/FrameSnapshotting.cpp b/Source/WebCore/page/FrameSnapshotting.cpp
4418-
index 73587787f88a6ad4e4baffb0beb0b87e7782916f..7e7a984207d6005bdb116784f981b487c8c16846 100644
4418+
index 73587787f88a6ad4e4baffb0beb0b87e7782916f..88492f501e6ec9e38455dbe6fd27537bf0ee6970 100644
44194419
--- a/Source/WebCore/page/FrameSnapshotting.cpp
44204420
+++ b/Source/WebCore/page/FrameSnapshotting.cpp
4421-
@@ -115,6 +115,8 @@ std::unique_ptr<ImageBuffer> snapshotFrameRectWithClip(Frame& frame, const IntRe
4421+
@@ -114,7 +114,12 @@ std::unique_ptr<ImageBuffer> snapshotFrameRectWithClip(Frame& frame, const IntRe
4422+
std::unique_ptr<ImageBuffer> buffer = ImageBuffer::create(imageRect.size(), RenderingMode::Unaccelerated, scaleFactor);
44224423
if (!buffer)
44234424
return nullptr;
4425+
+#if !PLATFORM(MAC)
4426+
+ buffer->context().scale(scaleFactor);
4427+
+#endif
44244428
buffer->context().translate(-imageRect.x(), -imageRect.y());
44254429
+ if (coordinateSpace != FrameView::ViewCoordinates)
44264430
+ buffer->context().scale(1 / frame.page()->pageScaleFactor());
44274431

44284432
if (!clipRects.isEmpty()) {
44294433
Path clipPath;
4430-
@@ -123,7 +125,10 @@ std::unique_ptr<ImageBuffer> snapshotFrameRectWithClip(Frame& frame, const IntRe
4434+
@@ -123,7 +128,10 @@ std::unique_ptr<ImageBuffer> snapshotFrameRectWithClip(Frame& frame, const IntRe
44314435
buffer->context().clipPath(clipPath);
44324436
}
44334437

@@ -13575,9 +13579,7 @@ index 1e4fb27884034dcca333f77efd24150d4c9dc2ec..30eaa65b5600fce08e6153bbd47fdbca
1357513579

1357613580
-WKPageRef WebKitBrowserWindow::createNewPage(WKPageRef page, WKPageConfigurationRef configuration, WKNavigationActionRef navigationAction, WKWindowFeaturesRef windowFeatures, const void *clientInfo)
1357713581
+void WebKitBrowserWindow::closeWindow(WKPageRef page, const void* clientInfo)
13578-
{
13579-
- auto& newWindow = MainWindow::create().leakRef();
13580-
- auto factory = [configuration](BrowserWindowClient& client, HWND mainWnd, bool) -> auto {
13582+
+{
1358113583
+ auto& thisWindow = toWebKitBrowserWindow(clientInfo);
1358213584
+ PostMessage(thisWindow.m_hMainWnd, WM_CLOSE, 0, 0);
1358313585
+}
@@ -13604,7 +13606,9 @@ index 1e4fb27884034dcca333f77efd24150d4c9dc2ec..30eaa65b5600fce08e6153bbd47fdbca
1360413606
+}
1360513607
+
1360613608
+void WebKitBrowserWindow::runBeforeUnloadConfirmPanel(WKPageRef page, WKStringRef message, WKFrameRef frame, WKPageRunBeforeUnloadConfirmPanelResultListenerRef listener, const void *clientInfo)
13607-
+{
13609+
{
13610+
- auto& newWindow = MainWindow::create().leakRef();
13611+
- auto factory = [configuration](BrowserWindowClient& client, HWND mainWnd, bool) -> auto {
1360813612
+ auto& thisWindow = toWebKitBrowserWindow(clientInfo);
1360913613
+ WKRetain(listener);
1361013614
+ thisWindow.m_beforeUnloadDialog = listener;
@@ -13794,9 +13798,9 @@ index 6008ca19e26a938cf962c0c336299fff7d13f9a3..8005d72f8c0d9ef82efda8aec1ff0e7d
1379413798
- else
1379513799
- ::SetProcessDPIAware();
1379613800
+ SetProcessDpiAwarenessContextPtr()(DPI_AWARENESS_CONTEXT_UNAWARE);
13797-
13798-
+ MainWindow::configure(options.headless, options.noStartupWindow);
1379913801
+
13802+
+ MainWindow::configure(options.headless, options.noStartupWindow);
13803+
1380013804
+ if (!options.noStartupWindow) {
1380113805
#if !ENABLE(WEBKIT_LEGACY)
1380213806
- auto factory = WebKitBrowserWindow::create;

0 commit comments

Comments
 (0)