Repository: electron/electron
Pull request: fix: display id order validation on certain versions of Windows 10

#### Description of Change

Ports https://github.com/electron/electron/pull/46873

#### Release Notes

Notes: fix display id validation errors on certain versions of windows 10

Changed files:
filename: patches/chromium/.patches
patch: @@ -147,3 +147,4 @@ fix_linter_error.patch
 revert_enable_crel_for_arm32_targets.patch
 mac_fix_check_on_ime_reconversion_due_to_invalid_replacement_range.patch
 fix_osr_stutter_fix_backport_for_electron.patch
+do_not_check_the_order_of_display_id_order_on_windows.patch

filename: patches/chromium/do_not_check_the_order_of_display_id_order_on_windows.patch
patch: @@ -0,0 +1,68 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Mitsuru Oshima <oshima@chromium.org>
+Date: Thu, 17 Apr 2025 16:49:21 -0700
+Subject: Do not check the order of Display ID order on Windows
+
+Id is generated by Windows side logic so this rule isn't applicable.
+
+Bug: 394622418
+Change-Id: I79c7f91103c6b752b6a7a123aacd3573a9ab815f
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6471333
+Reviewed-by: Vincent Chiang <vincentchiang@chromium.org>
+Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
+Cr-Commit-Position: refs/heads/main@{#1448671}
+
+diff --git a/ui/display/display_layout.cc b/ui/display/display_layout.cc
+index 0d3746d8174868b743990b5ab10b3506819ef0ea..85d5c06851148576ab4dd272918215335292b4aa 100644
+--- a/ui/display/display_layout.cc
++++ b/ui/display/display_layout.cc
+@@ -500,6 +500,7 @@ void DisplayLayout::ApplyToDisplayList(Displays* display_list,
+   if (!DisplayLayout::Validate(DisplayListToDisplayIdList(*display_list),
+                                *this)) {
+     // Prevent invalid and non-relevant display layouts.
++    LOG(ERROR) << "Invalid Display Layout";
+     return;
+   }
+ 
+@@ -549,15 +550,19 @@ bool DisplayLayout::Validate(const DisplayIdList& list,
+ 
+   bool has_primary_as_parent = false;
+   // The placement list must be sorted by the first 8 bits of the display IDs.
++#if BUILDFLAG(IS_CHROMEOS)
+   int64_t prev_id = std::numeric_limits<int8_t>::min();
++#endif  // BUILDFLAG(IS_CHROMEOS)
+   for (const auto& placement : layout.placement_list) {
+-    // Placements are sorted by display_id.
++#if BUILDFLAG(IS_CHROMEOS)
++    // Placements are sorted by display_id on ChromeOS.
+     if (prev_id >= (placement.display_id & 0xFF)) {
+       DISPLAY_LOG(ERROR) << "PlacementList must be sorted by first 8 bits of"
+                          << " display_id ";
+       return false;
+     }
+     prev_id = (placement.display_id & 0xFF);
++#endif  // BUILDFLAG(IS_CHROMEOS)
+     if (placement.display_id == kInvalidDisplayId) {
+       DISPLAY_LOG(ERROR) << "display_id is not initialized";
+       return false;
+diff --git a/ui/display/display_layout_unittest.cc b/ui/display/display_layout_unittest.cc
+index 68327c8a6b71853a0f1bf3c0351e38865bcbe054..4ea830ef086eb009c692a0b90b100eaaed303fd0 100644
+--- a/ui/display/display_layout_unittest.cc
++++ b/ui/display/display_layout_unittest.cc
+@@ -122,6 +122,7 @@ TEST(DisplayLayoutTest, SwapPrimaryDisplayThreeDisplays) {
+   EXPECT_EQ(Position::RIGHT, layout->placement_list[1].position);
+ }
+ 
++#if BUILDFLAG(IS_CHROMEOS)
+ // Makes sure that only the least significant 8 bits of the display IDs in the
+ // placement lists are used to validate their sort order.
+ TEST(DisplayLayoutTest, PlacementSortOrder) {
+@@ -148,6 +149,8 @@ TEST(DisplayLayoutTest, PlacementSortOrder) {
+   EXPECT_TRUE(DisplayLayout::Validate({456, 0x0504, 0x0605, 0x0406}, *layout));
+ }
+ 
++#endif  // BUILDFLAG(IS_CHROMEOS)
++
+ namespace {
+ 
+ class TwoDisplays