Commit 98142e3f authored by Tom Anderson's avatar Tom Anderson Committed by Commit Bot

[XProto] Fix regression in hiding switch/list expressions

In [1], I replaced:
  field.for_list = getattr(field, 'for_list', None)
  field.for_switch = getattr(field, 'for_switch', None)
with:
  field.for_list = None
  field.for_switch = None

However, getattr() is still necessary because these variables may be
set when processing later fields from the same structure, so we need
to know if they've already been set.  This is compounded by the fields
getting thrown into a dictionary, so when we're iterating over the
keys, we get them in an unspecified order.

[1] cd1129d8

BUG=1066670
R=msisov

Change-Id: I84a9128b0b0403f543cbe905d37ebd4151cc0521
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2250510Reviewed-by: default avatarMaksim Sisov <msisov@igalia.com>
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779908}
parent 677d12c1
...@@ -23,7 +23,6 @@ Window CreateWindow(Connection* connection) { ...@@ -23,7 +23,6 @@ Window CreateWindow(Connection* connection) {
.parent = connection->default_screen().root, .parent = connection->default_screen().root,
.width = 1, .width = 1,
.height = 1, .height = 1,
.value_mask = CreateWindowAttribute::OverrideRedirect,
.override_redirect = Bool32(true), .override_redirect = Bool32(true),
}); });
auto create_window_response = create_window_future.Sync(); auto create_window_response = create_window_future.Sync();
...@@ -69,7 +68,6 @@ TEST(X11ConnectionTest, Event) { ...@@ -69,7 +68,6 @@ TEST(X11ConnectionTest, Event) {
auto cwa_future = connection.ChangeWindowAttributes({ auto cwa_future = connection.ChangeWindowAttributes({
.window = window, .window = window,
.value_mask = CreateWindowAttribute::EventMask,
.event_mask = EventMask::PropertyChange, .event_mask = EventMask::PropertyChange,
}); });
EXPECT_FALSE(cwa_future.Sync().error); EXPECT_FALSE(cwa_future.Sync().error);
......
...@@ -1078,8 +1078,10 @@ class GenXproto(FileWriter): ...@@ -1078,8 +1078,10 @@ class GenXproto(FileWriter):
if field.field_name == 'sequence': if field.field_name == 'sequence':
field.visible = True field.visible = True
field.parent = (t, name) field.parent = (t, name)
field.for_list = None # |for_list| and |for_switch| may have already been set when
field.for_switch = None # processing other fields in this structure.
field.for_list = getattr(field, 'for_list', None)
field.for_switch = getattr(field, 'for_switch', None)
for is_type, for_type in ((field.type.is_list, 'for_list'), for is_type, for_type in ((field.type.is_list, 'for_list'),
(field.type.is_switch, 'for_switch')): (field.type.is_switch, 'for_switch')):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment