8000 fix: display id order validation on certain versions of Windows 10 by deepak1556 · Pull Request #46874 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: display id order validation on certain versions of Windows 10 #46874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions patches/chromium/.patches
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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
0