mirror of
https://github.com/electron/electron.git
synced 2026-01-08 23:18:06 -05:00
* chore: bump chromium in DEPS to 136.0.7076.0 * chore: bump chromium in DEPS to 136.0.7077.0 * 6368856: Migrate absl variant.h and utility.h in content (part 2/2) | https://chromium-review.googlesource.com/c/chromium/src/+/6368856 * 6356528: Clean up LegacyRenderWidgetHostHWND code | https://chromium-review.googlesource.com/c/chromium/src/+/6356528 * chore: export patches * 6339113: [Viewport Segments] Add CDP commands to override Viewport Segments without overriding other device properties. | https://chromium-review.googlesource.com/c/chromium/src/+/6339113 * 6352169: [DevTools][MultiInstance] Support new tab in another window on Android | https://chromium-review.googlesource.com/c/chromium/src/+/6352169 * 6368856: Migrate absl variant.h and utility.h in content (part 2/2) | https://chromium-review.googlesource.com/c/chromium/src/+/6368856 * 6360858:Clickiness: Wire response from URLLoader to DB, add e2e tests| https://chromium-review.googlesource.com/c/chromium/src/+/6360858 * chore: bump chromium in DEPS to 136.0.7079.0 * chore: export patches * chore: bump chromium in DEPS to 136.0.7081.0 * chore: export patches * chore: bump chromium in DEPS to 136.0.7083.0 * 6361987: Remove double-declaration with gfx::NativeView and gfx::NativeWindow | https://chromium-review.googlesource.com/c/chromium/src/+/6361987 * chore: export patches * chore: bump chromium in DEPS to 136.0.7087.0 * chore: export patches * fix: include node patch for missing AtomicsWaitEvent https://chromium-review.googlesource.com/c/chromium/src/+/6385540 * build: add depot_tools python to path * fix: cppgc init and unregistering v8 isolate https://chromium-review.googlesource.com/c/v8/v8/+/6333562 CppGc is now initialized earlier so Node can skip reinitializing it. Additionally, gin::IsolateHandle was attempting to destruct an already destructed v8::Isolate upon electron::JavaScriptEnvironment destruction. By removing the call to NodePlatform::UnregisterIsolate, this fixes the crash on app shutdown. * fix: unregister isolate after destruction See code comment. * chore: bump chromium in DEPS to 136.0.7095.0 * chore: sync patches * fix: add script_parsing::ContentScriptType parameter https://chromium-review.googlesource.com/c/chromium/src/+/6298395 * fix: migrate content::BrowserAccessibilityState methods https://chromium-review.googlesource.com/c/chromium/src/+/6401437 https://chromium-review.googlesource.com/c/chromium/src/+/6383275 * feat: enableHappyEyeballs option for host resolver https://chromium-review.googlesource.com/c/chromium/src/+/6332599 * fix: add new cookie exclusion reason https://chromium-review.googlesource.com/c/chromium/src/+/6343479 * fix: add new url loader method https://chromium-review.googlesource.com/c/chromium/src/+/6337340 * fix: add new cppgc header file for electron_node headers https://chromium-review.googlesource.com/c/v8/v8/+/6348644 * fix: disable CREL on Linux ARM64 https://chromium-review.googlesource.com/q/I3a62f02f564f07be63173b0773b4ecaffbe939b9 * fixup! fix: add new cppgc header file for electron_node headers https://chromium-review.googlesource.com/c/v8/v8/+/6348644 * chore: update corner smoothing patch * fixup! chore: update corner smoothing patch * chore: disable NAN weak tests These two tests are incompatible with a V8 change that disallows running JS code from a weak finalizer callback. Ref: https://chromium-review.googlesource.com/c/v8/v8/+/4733273 * test: fix task starvation in node test A V8 change makes these contexts get collected in a task that is posted and run asynchronously. The tests were synchronously GC'ing in an infinite loop, preventing the task loop from running the task that would GC these contexts. This change should be upstreamed in some way. Ref: https://chromium-review.googlesource.com/c/v8/v8/+/4733273 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: alice <alice@makenotion.com> Co-authored-by: Samuel Maddock <smaddock@slack-corp.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: clavin <clavin@electronjs.org>
133 lines
5.6 KiB
Diff
133 lines
5.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Shelley Vohr <shelley.vohr@gmail.com>
|
|
Date: Thu, 20 Aug 2020 10:55:48 -0700
|
|
Subject: fix: properly honor printing page ranges
|
|
|
|
The print ranges in Chromium's print job settings were not being properly
|
|
plumbed through to PMPrintSettings on mcOS. This fixes that by setting
|
|
them should they exist.
|
|
|
|
This will be upstreamed.
|
|
|
|
diff --git a/printing/printing_context_mac.h b/printing/printing_context_mac.h
|
|
index 5b469b3b6bd11d8e0baa08e9be257990ac9bc438..c1410e5d8112f0319de40e4fbf41dbaea4b9733c 100644
|
|
--- a/printing/printing_context_mac.h
|
|
+++ b/printing/printing_context_mac.h
|
|
@@ -84,6 +84,10 @@ class COMPONENT_EXPORT(PRINTING) PrintingContextMac : public PrintingContext {
|
|
// Returns true if the orientation was set.
|
|
bool SetOrientationIsLandscape(bool landscape);
|
|
|
|
+ // Set the page range in native print info object.
|
|
+ // Returns true if the range was set.
|
|
+ bool SetPrintRangeInPrintSettings(const PageRanges& ranges);
|
|
+
|
|
// Sets duplex mode in PMPrintSettings.
|
|
// Returns true if duplex mode is set.
|
|
bool SetDuplexModeInPrintSettings(mojom::DuplexMode mode);
|
|
diff --git a/printing/printing_context_mac.mm b/printing/printing_context_mac.mm
|
|
index f39f8b2dd3aa2b89498ed5331aa9b9ba6a02abf5..c0e155c14b2b4e81cde35cea1db284bc4c43f5e6 100644
|
|
--- a/printing/printing_context_mac.mm
|
|
+++ b/printing/printing_context_mac.mm
|
|
@@ -520,7 +520,8 @@ bool IsIppColorModelColorful(mojom::ColorModel color_model) {
|
|
!SetCollateInPrintSettings(settings_->collate()) ||
|
|
!SetDuplexModeInPrintSettings(settings_->duplex_mode()) ||
|
|
!SetOutputColor(static_cast<int>(settings_->color())) ||
|
|
- !SetResolution(settings_->dpi_size())) {
|
|
+ !SetResolution(settings_->dpi_size()) ||
|
|
+ !SetPrintRangeInPrintSettings(settings_->ranges()) ) {
|
|
return OnError();
|
|
}
|
|
}
|
|
@@ -673,6 +674,22 @@ bool IsIppColorModelColorful(mojom::ColorModel color_model) {
|
|
return PMSetCopies(print_settings, copies, false) == noErr;
|
|
}
|
|
|
|
+bool PrintingContextMac::SetPrintRangeInPrintSettings(const PageRanges& ranges) {
|
|
+ // Default is already NSPrintAllPages - we can safely bail.
|
|
+ if (ranges.empty())
|
|
+ return true;
|
|
+
|
|
+ PMPrintSettings print_settings =
|
|
+ static_cast<PMPrintSettings>([print_info_ PMPrintSettings]);
|
|
+
|
|
+ // macOS does not allow multiple ranges, so pluck the first.
|
|
+ auto range = ranges.front();
|
|
+ bool set_first_page = PMSetFirstPage(print_settings, range.from + 1, false) == noErr;
|
|
+ bool set_last_page = PMSetLastPage(print_settings, range.to + 1, false) == noErr;
|
|
+
|
|
+ return set_first_page && set_last_page;
|
|
+}
|
|
+
|
|
bool PrintingContextMac::SetCollateInPrintSettings(bool collate) {
|
|
PMPrintSettings print_settings =
|
|
static_cast<PMPrintSettings>([print_info_ PMPrintSettings]);
|
|
diff --git a/printing/printing_context_system_dialog_win.cc b/printing/printing_context_system_dialog_win.cc
|
|
index d5eec01f35bd182d5bb49138fc66446fcd5f8cdf..3c289d7cdf7fdf7717fc2397e3344cbe614e0b70 100644
|
|
--- a/printing/printing_context_system_dialog_win.cc
|
|
+++ b/printing/printing_context_system_dialog_win.cc
|
|
@@ -73,14 +73,30 @@ void PrintingContextSystemDialogWin::AskUserForSettings(
|
|
PRINTPAGERANGE ranges[32];
|
|
dialog_options.nStartPage = START_PAGE_GENERAL;
|
|
if (max_pages) {
|
|
- // Default initialize to print all the pages.
|
|
UNSAFE_TODO(memset(ranges, 0, sizeof(ranges)));
|
|
- ranges[0].nFromPage = 1;
|
|
- ranges[0].nToPage = max_pages;
|
|
- dialog_options.nPageRanges = 1;
|
|
- dialog_options.nMaxPageRanges = std::size(ranges);
|
|
+
|
|
+ auto page_ranges = settings_->ranges();
|
|
+ if (!page_ranges.empty()) {
|
|
+ UNSAFE_TODO({
|
|
+ for (size_t i = 0; i < page_ranges.size(); i++) {
|
|
+ auto range = page_ranges[i];
|
|
+ ranges[i].nFromPage = range.from + 1;
|
|
+ ranges[i].nToPage = range.to + 1;
|
|
+ }
|
|
+ });
|
|
+ dialog_options.nPageRanges = page_ranges.size();
|
|
+
|
|
+ // Ensure the Pages radio button is selected.
|
|
+ dialog_options.Flags |= PD_PAGENUMS;
|
|
+ } else {
|
|
+ ranges[0].nFromPage = 1;
|
|
+ ranges[0].nToPage = max_pages;
|
|
+ dialog_options.nPageRanges = 1;
|
|
+ }
|
|
+
|
|
dialog_options.nMinPage = 1;
|
|
dialog_options.nMaxPage = max_pages;
|
|
+ dialog_options.nMaxPageRanges = std::size(ranges);
|
|
dialog_options.lpPageRanges = ranges;
|
|
} else {
|
|
// No need to bother, we don't know how many pages are available.
|
|
diff --git a/ui/gtk/printing/print_dialog_gtk.cc b/ui/gtk/printing/print_dialog_gtk.cc
|
|
index b04cb0b9a9fd25e638c8e5cfac08ddf5dbd1a67e..393815e33b8c700baa349482867fc7f1425ff09f 100644
|
|
--- a/ui/gtk/printing/print_dialog_gtk.cc
|
|
+++ b/ui/gtk/printing/print_dialog_gtk.cc
|
|
@@ -247,6 +247,24 @@ void PrintDialogGtk::UpdateSettings(
|
|
|
|
gtk_print_settings_set_n_copies(gtk_settings_, settings->copies());
|
|
gtk_print_settings_set_collate(gtk_settings_, settings->collate());
|
|
+
|
|
+ auto print_ranges = settings->ranges();
|
|
+ if (!print_ranges.empty()) {
|
|
+ // Tell the system that we only intend to print a subset of pages.
|
|
+ gtk_print_settings_set_print_pages(gtk_settings_, GTK_PRINT_PAGES_RANGES);
|
|
+
|
|
+ GtkPageRange* ranges;
|
|
+ ranges = g_new(GtkPageRange, print_ranges.size());
|
|
+ for (size_t i = 0; i < print_ranges.size(); i++) {
|
|
+ auto range = print_ranges[i];
|
|
+ ranges[i].start = range.from;
|
|
+ ranges[i].end = range.to;
|
|
+ }
|
|
+
|
|
+ gtk_print_settings_set_page_ranges(gtk_settings_, ranges, 1);
|
|
+ g_free(ranges);
|
|
+ }
|
|
+
|
|
if (settings->dpi_horizontal() > 0 && settings->dpi_vertical() > 0) {
|
|
gtk_print_settings_set_resolution_xy(
|
|
gtk_settings_, settings->dpi_horizontal(), settings->dpi_vertical());
|