Skip to content

Commit

Permalink
browser(webkit): keep top-left corner in place when scaling frames
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s committed Jul 22, 2020
1 parent baa0956 commit 569c615
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions browser_patches/webkit/BUILD_NUMBER
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1311
Changed: yurys@chromium.org Tue Jul 21 18:47:35 PDT 2020
1312
Changed: yurys@chromium.org Wed Jul 22 15:22:16 PDT 2020
9 changes: 6 additions & 3 deletions browser_patches/webkit/patches/bootstrap.diff
Original file line number Diff line number Diff line change
Expand Up @@ -9743,10 +9743,10 @@ index f9c26832d3e91e8d747c5c1e0f0d76c34f4c3096..0cdf93cfe090b9be742a9c670b3372d2
} // namespace WebKit
diff --git a/Source/WebKit/UIProcess/Inspector/mac/ScreencastEncoderMac.mm b/Source/WebKit/UIProcess/Inspector/mac/ScreencastEncoderMac.mm
new file mode 100644
index 0000000000000000000000000000000000000000..aa06bdfb5170428ace1143ae52b413ac6b987040
index 0000000000000000000000000000000000000000..51b0d77bbb2addd48a0ffd1cfb65368d37caefd9
--- /dev/null
+++ b/Source/WebKit/UIProcess/Inspector/mac/ScreencastEncoderMac.mm
@@ -0,0 +1,51 @@
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2020 Microsoft Corporation.
+ *
Expand Down Expand Up @@ -9794,7 +9794,10 @@ index 0000000000000000000000000000000000000000..aa06bdfb5170428ace1143ae52b413ac
+ }
+ size_t imageWidth = CGImageGetWidth(image);
+ size_t imageHeight = CGImageGetHeight(image);
+ CGContextDrawImage(context.get(), CGRectMake(0, 0, imageWidth, imageHeight), image);
+ // TODO: exclude controls from original screenshot
+ constexpr int browserControlsHeight = 55;
+ CGFloat pageHeight = static_cast<CGFloat>(imageHeight) - browserControlsHeight;
+ CGContextDrawImage(context.get(), CGRectMake(0, height - pageHeight, imageWidth, imageHeight), image);
+}
+
+} // namespace WebKit
Expand Down

0 comments on commit 569c615

Please sign in to comment.