| Differences between
and this patch
- a/LayoutTests/ChangeLog +11 lines
Lines 1-3 a/LayoutTests/ChangeLog_sec1
1
2021-10-08  Tim Nguyen  <ntim@apple.com>
2
3
        Re-sync the-dialog-element and inert WPT from upstream
4
        https://bugs.webkit.org/show_bug.cgi?id=231392
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Upstream commit: https://github.com/web-platform-tests/wpt/commit/a44515b7c7774abf1256f488bf0e9dc02459fced
9
10
        * TestExpectations:
11
1
2021-10-07  Antti Koivisto  <antti@apple.com>
12
2021-10-07  Antti Koivisto  <antti@apple.com>
2
13
3
        REGRESSION (IFC selections): Overlapping selection rectangles when selecting preformatted text
14
        REGRESSION (IFC selections): Overlapping selection rectangles when selecting preformatted text
- a/LayoutTests/imported/w3c/ChangeLog +21 lines
Lines 1-3 a/LayoutTests/imported/w3c/ChangeLog_sec1
1
2021-10-08  Tim Nguyen  <ntim@apple.com>
2
3
        Re-sync the-dialog-element and inert WPT from upstream
4
        https://bugs.webkit.org/show_bug.cgi?id=231392
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Upstream commit: https://github.com/web-platform-tests/wpt/commit/a44515b7c7774abf1256f488bf0e9dc02459fced
9
10
        * resources/resource-files.json:
11
        * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-inert.tentative-expected.txt: Added.
12
        * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-inert.tentative.html: Added.
13
        * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/w3c-import.log:
14
        * web-platform-tests/inert/frame/button.html: Removed.
15
        * web-platform-tests/inert/frame/w3c-import.log: Removed.
16
        * web-platform-tests/inert/inert-computed-style-expected.txt: Added.
17
        * web-platform-tests/inert/inert-computed-style.html: Added.
18
        * web-platform-tests/inert/inert-retargeting-iframe.tentative.html: Removed.
19
        * web-platform-tests/inert/inert-retargeting.tentative.html: Removed.
20
        * web-platform-tests/inert/w3c-import.log:
21
1
2021-10-07  Rob Buis  <rbuis@igalia.com>
22
2021-10-07  Rob Buis  <rbuis@igalia.com>
2
23
3
        Resync the-img-element WPT tests from upstream
24
        Resync the-img-element WPT tests from upstream
- a/LayoutTests/TestExpectations -4 lines
Lines 5189-5198 webkit.org/b/230004 imported/w3c/web-platform-tests/css/css-pseudo/selection-ove a/LayoutTests/TestExpectations_sec1
5189
webkit.org/b/230004 imported/w3c/web-platform-tests/css/css-pseudo/selection-paint-image.html [ ImageOnlyFailure ]
5189
webkit.org/b/230004 imported/w3c/web-platform-tests/css/css-pseudo/selection-paint-image.html [ ImageOnlyFailure ]
5190
webkit.org/b/230004 imported/w3c/web-platform-tests/css/css-pseudo/selection-textarea-011.html [ ImageOnlyFailure ]
5190
webkit.org/b/230004 imported/w3c/web-platform-tests/css/css-pseudo/selection-textarea-011.html [ ImageOnlyFailure ]
5191
5191
5192
# Awaiting official CSSWG resolution making these tests irrelevant: https://lists.w3.org/Archives/Public/www-style/2021Sep/0004.html
5193
imported/w3c/web-platform-tests/inert/inert-retargeting.tentative.html [ Skip ]
5194
imported/w3c/web-platform-tests/inert/inert-retargeting-iframe.tentative.html [ Skip ]
5195
5196
imported/w3c/web-platform-tests/content-security-policy/script-src/ [ DumpJSConsoleLogInStdErr ]
5192
imported/w3c/web-platform-tests/content-security-policy/script-src/ [ DumpJSConsoleLogInStdErr ]
5197
5193
5198
# import-w3c-tests copies -notref.html to -expected.html, so expected image failure here.
5194
# import-w3c-tests copies -notref.html to -expected.html, so expected image failure here.
- a/LayoutTests/imported/w3c/resources/resource-files.json -1 lines
Lines 2856-2862 a/LayoutTests/imported/w3c/resources/resource-files.json_sec1
2856
        "web-platform-tests/html/webappapis/scripting/events/onerroreventhandler-frame.html",
2856
        "web-platform-tests/html/webappapis/scripting/events/onerroreventhandler-frame.html",
2857
        "web-platform-tests/html/webappapis/user-prompts/cannot-show-simple-dialogs/support/confirm.html",
2857
        "web-platform-tests/html/webappapis/user-prompts/cannot-show-simple-dialogs/support/confirm.html",
2858
        "web-platform-tests/html/webappapis/user-prompts/cannot-show-simple-dialogs/support/prompt.html",
2858
        "web-platform-tests/html/webappapis/user-prompts/cannot-show-simple-dialogs/support/prompt.html",
2859
        "web-platform-tests/inert/frame/button.html",
2860
        "web-platform-tests/infrastructure/assumptions/ahem-notref.html",
2859
        "web-platform-tests/infrastructure/assumptions/ahem-notref.html",
2861
        "web-platform-tests/infrastructure/reftest/red.html",
2860
        "web-platform-tests/infrastructure/reftest/red.html",
2862
        "web-platform-tests/intersection-observer/observer-in-iframe.html",
2861
        "web-platform-tests/intersection-observer/observer-in-iframe.html",
- a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-inert.tentative-expected.txt +4 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-inert.tentative-expected.txt_sec1
1
Something
2
3
PASS dialog-inert
4
- a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-inert.tentative.html +45 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-inert.tentative.html_sec1
1
<!doctype html>
2
<meta charset=utf-8>
3
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
4
<link rel="author" title="Mozilla" href="https://mozilla.org">
5
<script src="/resources/testharness.js"></script>
6
<script src="/resources/testharnessreport.js"></script>
7
<style>
8
  body { margin: 0 }
9
  dialog {
10
    width: 100%;
11
    height: 100%;
12
    max-width: 100%;
13
    max-height: 100%;
14
    box-sizing: border-box;
15
    padding: 0;
16
  }
17
  dialog::backdrop {
18
    display: none;
19
  }
20
</style>
21
<dialog id=dialog>Something</dialog>
22
<script>
23
test(function() {
24
  let dialog = document.getElementById("dialog");
25
  dialog.showModal();
26
  assert_equals(
27
    document.elementFromPoint(10, 10),
28
    dialog,
29
    "Dialog is hittable by default",
30
  );
31
  dialog.inert = true;
32
  assert_not_equals(
33
    document.elementFromPoint(10, 10),
34
    dialog,
35
    "Dialog becomes inert dynamically",
36
  );
37
  dialog.close();
38
  dialog.showModal();
39
  assert_not_equals(
40
    document.elementFromPoint(10, 10),
41
    dialog,
42
    "Dialog remains inert after open",
43
  );
44
});
45
</script>
- a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/w3c-import.log +3 lines
Lines 41-46 List of files: a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/w3c-import.log_sec1
41
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-enabled.html
41
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-enabled.html
42
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-focusing-steps-prevent-autofocus.html
42
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-focusing-steps-prevent-autofocus.html
43
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-form-submission.html
43
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-form-submission.html
44
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-inert.tentative.html
44
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-keydown-preventDefault.html
45
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-keydown-preventDefault.html
45
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-not-in-tree-crash.html
46
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-not-in-tree-crash.html
46
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-open.html
47
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-open.html
Lines 80-85 List of files: a/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/w3c-import.log_sec2
80
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-display-none.html
81
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-display-none.html
81
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-nesting-expected.html
82
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-nesting-expected.html
82
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-nesting.html
83
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-nesting.html
84
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-opacity-expected.html
85
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-opacity.html
83
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-stacking-correct-order-remove-readd-expected.html
86
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-stacking-correct-order-remove-readd-expected.html
84
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-stacking-correct-order-remove-readd.html
87
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-stacking-correct-order-remove-readd.html
85
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-stacking-dynamic-expected.html
88
/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-stacking-dynamic-expected.html
- a/LayoutTests/imported/w3c/web-platform-tests/inert/frame/button.html -36 lines
Lines 1-36 a/LayoutTests/imported/w3c/web-platform-tests/inert/frame/button.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<style>
5
body {
6
  overflow: hidden;
7
}
8
9
button#background {
10
  position: absolute;
11
  top: 0;
12
  left: 0;
13
  width: 150px;
14
  height: 40px;
15
  line-height: 53px;
16
}
17
18
button.clicked {
19
  background-color: red;
20
}
21
22
button.clicked::after {
23
  content: " (clicked)";
24
}
25
26
</style>
27
</head>
28
<body>
29
  <button id="background">background</button>
30
<script>
31
document.body.addEventListener('click', (e) => {
32
  e.target.classList.add('clicked');
33
});
34
</script>
35
</body>
36
</html>
- a/LayoutTests/imported/w3c/web-platform-tests/inert/frame/w3c-import.log -17 lines
Lines 1-17 a/LayoutTests/imported/w3c/web-platform-tests/inert/frame/w3c-import.log_sec1
1
The tests in this directory were imported from the W3C repository.
2
Do NOT modify these tests directly in WebKit.
3
Instead, create a pull request on the WPT github:
4
	https://github.com/web-platform-tests/wpt
5
6
Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
7
8
Do NOT modify or remove this file.
9
10
------------------------------------------------------------------------
11
Properties requiring vendor prefixes:
12
None
13
Property values requiring vendor prefixes:
14
None
15
------------------------------------------------------------------------
16
List of files:
17
/LayoutTests/imported/w3c/web-platform-tests/inert/frame/button.html
- a/LayoutTests/imported/w3c/web-platform-tests/inert/inert-computed-style-expected.txt +3 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/inert/inert-computed-style-expected.txt_sec1
1
2
FAIL inert isn't hit-testable, but that isn't expose in the computed style assert_equals: inert node doesn't change pointer-events computed value expected (string) "auto" but got (undefined) undefined
3
- a/LayoutTests/imported/w3c/web-platform-tests/inert/inert-computed-style.html +49 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/inert/inert-computed-style.html_sec1
1
<!DOCTYPE html>
2
<meta charset="utf-8">
3
<title>inert isn't hit-testable, but that isn't expose in the computed style</title>
4
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
5
<link rel="author" title="Mozilla" href="https://mozilla.org">
6
<script src="/resources/testharness.js"></script>
7
<script src="/resources/testharnessreport.js"></script>
8
<style>
9
  body { margin: 0 }
10
  div {
11
    width: 100px;
12
    height: 100px;
13
    position: absolute;
14
    top: 0;
15
    left: 0;
16
    background-color: blue;
17
  }
18
  #non-inert {
19
    background-color: red;
20
  }
21
</style>
22
<div id="non-inert"></div>
23
<div id="inert"></div>
24
<script>
25
  test(function() {
26
    let inert = document.getElementById("inert");
27
    assert_equals(
28
      document.elementFromPoint(50, 50),
29
      inert,
30
      "not-yet-inert node hit-test before non-inert node",
31
    );
32
    inert.inert = true;
33
    assert_equals(
34
      document.elementFromPoint(50, 50),
35
      document.getElementById("non-inert"),
36
      "inert node is transparent to events (as pointer-events: none)",
37
    );
38
    assert_equals(
39
      getComputedStyle(inert).pointerEvents,
40
      "auto",
41
      "inert node doesn't change pointer-events computed value",
42
    );
43
    assert_equals(
44
      getComputedStyle(inert).userSelect,
45
      "auto",
46
      "inert node doesn't change pointer-events computed value",
47
    );
48
  });
49
</script>
- a/LayoutTests/imported/w3c/web-platform-tests/inert/inert-retargeting-iframe.tentative.html -279 lines
Lines 1-279 a/LayoutTests/imported/w3c/web-platform-tests/inert/inert-retargeting-iframe.tentative.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script src="/resources/testharness.js"></script>
5
<script src="/resources/testharnessreport.js"></script>
6
<script src="/resources/testdriver.js"></script>
7
<script src="/resources/testdriver-actions.js"></script>
8
<script src="/resources/testdriver-vendor.js"></script>
9
<style>
10
button#foreground,
11
button#background {
12
  position: absolute;
13
  top: 75px;
14
  left: 50px;
15
  width: 100px;
16
  height: 20px;
17
}
18
19
button#background {
20
  left: 75px;
21
  width: 150px;
22
  height: 40px;
23
  top: 125px;
24
  line-height: 53px;
25
}
26
27
.clicked {
28
  background-color: red;
29
}
30
31
#ancestorContainer.clicked {
32
  background-color: green;
33
}
34
35
#ancestorContainer {
36
  position: absolute;
37
  top: 200px;
38
  left: 10px;
39
  width: 300px;
40
  height: 300px;
41
  background-color: blue;
42
}
43
44
#displacedAncestor {
45
  position: absolute;
46
  top: 13px;
47
  left: 240px;
48
  width: 300px;
49
  height: 250px;
50
  background-color: #ff89;
51
}
52
53
#displacedAncestor.clicked {
54
  background-color: #f009;
55
}
56
57
#inertContainer {
58
  background-color: #fff9;
59
  position: absolute;
60
  top: 35px;
61
  left: -192px;
62
  width: 200px;
63
  height: 200px;
64
}
65
66
fieldset {
67
  margin: 0;
68
  padding: 0;
69
  border: 1px solid black;
70
}
71
72
legend {
73
  background-color: white;
74
  border: 1px solid black;
75
  margin-left: 5px;
76
}
77
</style>
78
</head>
79
<body>
80
  <p>Click on "Inert button".</p>
81
  <ul>
82
    <li>The blue square ("Non-inert ancestor container") should turn green.</li>
83
    <li>The yellow, semi-transparent square ("Non-inert, displaced container") should not turn red.</li>
84
    <li>"Non-inert button" should not turn red.</li>
85
  </ul>
86
  <p style="margin-bottom:250px">(The full test suite checks a range of events.)</p>
87
  <fieldset id="ancestorContainer">
88
    <legend>Non-inert ancestor container</legend>
89
    <iframe id="background" src="frame/button.html"></iframe>
90
    <fieldset id="displacedAncestor">
91
      <legend>Non-inert, displaced ancestor</legend>
92
      <fieldset id="inertContainer" inert>
93
        <legend>Inert container</legend>
94
        <button id="foreground">foreground</button>
95
      </fieldset>
96
    </fieldset>
97
  </fieldset>
98
99
  <script>
100
document.body.addEventListener('click', (e) => {
101
  e.target.classList.add('clicked');
102
});
103
104
function clickOn(element) {
105
  return new test_driver.Actions()
106
      .pointerMove(0, 0, {origin: element})
107
      .pointerDown({button: test_driver.Actions.prototype.ButtonType.LEFT})
108
      .pointerUp({button: test_driver.Actions.prototype.ButtonType.LEFT})
109
      .send();
110
}
111
112
function auxClickOn(element) {
113
  return new test_driver.Actions()
114
      .pointerMove(0, 0, {origin: element})
115
      .pointerDown({button: test_driver.Actions.prototype.ButtonType.RIGHT})
116
      .pointerUp({button: test_driver.Actions.prototype.ButtonType.RIGHT})
117
      .send();
118
}
119
120
function dblClickOn(element) {
121
  return new test_driver.Actions()
122
      .pointerMove(0, 0, {origin: element})
123
      .pointerDown({button: test_driver.Actions.prototype.ButtonType.LEFT})
124
      .pointerUp({button: test_driver.Actions.prototype.ButtonType.LEFT})
125
      .pointerDown({button: test_driver.Actions.prototype.ButtonType.LEFT})
126
      .pointerUp({button: test_driver.Actions.prototype.ButtonType.LEFT})
127
      .send();
128
}
129
130
function movePointerOver(element) {
131
  let rect = element.getBoundingClientRect();
132
  return new test_driver.Actions()
133
      .pointerMove(0, 0, { origin: element })
134
      .send();
135
}
136
137
function movePointerTo(x, y) {
138
  return new test_driver.Actions()
139
      .pointerMove(Math.ceil(x), Math.ceil(y), { origin: "viewport" })
140
      .send();
141
}
142
143
function expectEventsOn(events, element) {
144
  let promises = [];
145
  for (event of events) {
146
    ((event, element) => {
147
      var promise = new Promise((resolve, reject) => {
148
        let f = (e) => {
149
          assert_equals(e.type, event);
150
          assert_equals(e.target, element);
151
          resolve();
152
        }
153
        element.addEventListener(event, f, { capture: true, once: true });
154
155
        step_timeout(() => {
156
          element.removeEventListener(event, f, { capture: true });
157
          reject("did not get " + event + " on " + element.id);
158
        }, 5000);
159
      });
160
      promises.push(promise);
161
    })(event, element);
162
  }
163
  return promises;
164
}
165
166
function unexpectEventsOn(events, element) {
167
  let promises = [];
168
  for (event of events) {
169
    ((event, element) => {
170
      var promise = new Promise((resolve, reject) => {
171
        let f = (e) => {
172
          assert_equals(e.type, event);
173
          assert_equals(e.target, element);
174
          reject("got " + e.type + " on " + e.target.id);
175
        }
176
        element.addEventListener(event, f, { capture: true, once: true });
177
178
        step_timeout(() => {
179
          element.removeEventListener(event, f, { capture: true });
180
          resolve();
181
        }, 1000);
182
      });
183
      promises.push(promise);
184
    })(event, element);
185
  }
186
  return promises;
187
}
188
189
test(() => {
190
  let rect = foreground.getBoundingClientRect();
191
  let center_x = rect.left + (rect.width / 2);
192
  let center_y = rect.top + (rect.height / 2);
193
  assert_equals(document.elementsFromPoint(center_x, center_y)[0], foreground);
194
}, "elementsFromPoint returns inert element");
195
196
promise_test(async () => {
197
  // Test mouse events on non-inert element - events should go to "foreground"
198
  inertContainer.inert = false;
199
  await movePointerTo(0, 0);
200
  let promises = expectEventsOn(["mouseover", "mouseenter", "mousemove", "mousedown",
201
                                 "mouseup", "click", "auxclick", "mouseout",
202
                                 "mouseleave"],
203
                                foreground);
204
  await clickOn(foreground);
205
  await auxClickOn(foreground);
206
  await dblClickOn(foreground);
207
  let ancestorBox = ancestorContainer.getBoundingClientRect();
208
  let inertBox = inertContainer.getBoundingClientRect();
209
  let x = ancestorBox.left + (ancestorBox.width / 2);
210
  let y = inertBox.bottom + ((ancestorBox.bottom - inertBox.bottom) / 2);
211
  await movePointerTo(x, y);
212
  await Promise.all(promises);
213
}, "Tests that any mouse event on a non-inert element is correctly targeted to that element");
214
215
promise_test(async () => {
216
  // Make the containing element inert - now events should go to "container"
217
  // which is the non-inert ancestor at the same position
218
  inertContainer.inert = true;
219
  await movePointerTo(0, 0);
220
221
  let promises = expectEventsOn(["mouseover", "mouseenter", "mousemove", "mousedown",
222
                                 "mouseup", "click", "auxclick"],
223
                                ancestorContainer);
224
225
  promises = promises.concat(unexpectEventsOn(["mouseout", "mouseleave"],
226
                                              ancestorContainer));
227
228
  await clickOn(foreground);
229
  await auxClickOn(foreground);
230
  await dblClickOn(foreground);
231
  let ancestorBox = ancestorContainer.getBoundingClientRect();
232
  let inertBox = inertContainer.getBoundingClientRect();
233
  let x = ancestorBox.left + (ancestorBox.width / 2);
234
  let y = inertBox.bottom + ((ancestorBox.bottom - inertBox.bottom) / 2);
235
  await movePointerTo(x, y);
236
  await Promise.all(promises);
237
}, 'Tests that any mouse event on an inert element is targeted to the nearest non-inert ancestor at the same coordinates');
238
239
promise_test(async () => {
240
  // Test pointer events on non-inert element - events should go to "foreground"
241
  inertContainer.inert = false;
242
  await movePointerTo(0, 0);
243
244
  let promises = expectEventsOn(["pointerover", "pointerenter", "pointermove",
245
                                 "pointerdown", "pointerup", "pointerout",
246
                                 "pointerleave"],
247
                                foreground);
248
  await clickOn(foreground);
249
  let ancestorBox = ancestorContainer.getBoundingClientRect();
250
  let inertBox = inertContainer.getBoundingClientRect();
251
  let x = ancestorBox.left + (ancestorBox.width / 2);
252
  let y = inertBox.bottom + ((ancestorBox.bottom - inertBox.bottom) / 2);
253
  await movePointerTo(x, y);
254
  await Promise.all(promises);
255
}, "Tests that any pointer event on a non-inert element is correctly targeted to that element");
256
257
promise_test(async () => {
258
  // Make the containing element inert - now events should go to "container"
259
  // which is the non-inert ancestor at the same position
260
  inertContainer.inert = true;
261
  await movePointerTo(0, 0);
262
263
  let promises = expectEventsOn(["pointerover", "pointerenter", "pointermove",
264
                                 "pointerdown", "pointerup" ],
265
                                ancestorContainer);
266
267
  promises = promises.concat(unexpectEventsOn(["pointerout", "pointerleave"],
268
                                              ancestorContainer));
269
  await clickOn(foreground);
270
  let ancestorBox = ancestorContainer.getBoundingClientRect();
271
  let inertBox = inertContainer.getBoundingClientRect();
272
  let x = ancestorBox.left + (ancestorBox.width / 2);
273
  let y = inertBox.bottom + ((ancestorBox.bottom - inertBox.bottom) / 2);
274
  await movePointerTo(x, y);
275
  await Promise.all(promises);
276
}, 'Tests that any pointer event on an inert element is targeted to the nearest non-inert ancestor at the same coordinates');
277
  </script>
278
</body>
279
</html>
- a/LayoutTests/imported/w3c/web-platform-tests/inert/inert-retargeting.tentative.html -290 lines
Lines 1-290 a/LayoutTests/imported/w3c/web-platform-tests/inert/inert-retargeting.tentative.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script src="/resources/testharness.js"></script>
5
<script src="/resources/testharnessreport.js"></script>
6
<script src="/resources/testdriver.js"></script>
7
<script src="/resources/testdriver-actions.js"></script>
8
<script src="/resources/testdriver-vendor.js"></script>
9
<style>
10
button#foreground,
11
button#background {
12
  position: absolute;
13
  top: 75px;
14
  left: 50px;
15
  width: 100px;
16
  height: 20px;
17
}
18
19
button#background {
20
  left: 75px;
21
  width: 150px;
22
  height: 40px;
23
  top: 125px;
24
  line-height: 53px;
25
}
26
27
.clicked {
28
  background-color: red;
29
}
30
31
#ancestorContainer.clicked {
32
  background-color: green;
33
}
34
35
#ancestorContainer {
36
  position: relative;
37
  width: 300px;
38
  height: 300px;
39
  background-color: blue;
40
}
41
42
#displacedAncestor {
43
  position: absolute;
44
  top: 13px;
45
  left: 240px;
46
  width: 300px;
47
  height: 250px;
48
  background-color: #ff89;
49
}
50
51
#displacedAncestor.clicked {
52
  background-color: #f009;
53
}
54
55
#inertContainer {
56
  background-color: #fff9;
57
  position: absolute;
58
  top: 35px;
59
  left: -192px;
60
  width: 200px;
61
  height: 200px;
62
}
63
64
fieldset {
65
  margin: 0;
66
  padding: 0;
67
  border: 1px solid black;
68
}
69
70
legend {
71
  background-color: white;
72
  border: 1px solid black;
73
  margin-left: 5px;
74
}
75
76
button.clicked::after {
77
  content: " (clicked)";
78
}
79
80
.clicked > legend::after {
81
  content: " (clicked)";
82
}
83
84
</style>
85
</head>
86
<body>
87
  <p>Click on "foreground".</p>
88
  <ul>
89
    <li>The blue square ("Non-inert ancestor container") should turn green.</li>
90
    <li>The yellow, semi-transparent square ("Non-inert, displaced container") should not turn red.</li>
91
    <li>"Non-inert button" should not turn red.</li>
92
  </ul>
93
  <p>(The full test suite checks a range of events.)</p>
94
  <fieldset id="ancestorContainer">
95
    <legend>Non-inert ancestor container</legend>
96
    <button id="background">background</button>
97
    <fieldset id="displacedAncestor">
98
      <legend>Non-inert, displaced ancestor</legend>
99
      <fieldset id="inertContainer" inert>
100
        <legend>Inert container</legend>
101
        <button id="foreground">foreground</button>
102
      </fieldset>
103
    </fieldset>
104
  </fieldset>
105
106
  <script>
107
document.body.addEventListener('click', (e) => {
108
  e.target.classList.add('clicked');
109
});
110
111
function clickOn(element) {
112
  return new test_driver.Actions()
113
      .pointerMove(0, 0, {origin: element})
114
      .pointerDown({button: test_driver.Actions.prototype.ButtonType.LEFT})
115
      .pointerUp({button: test_driver.Actions.prototype.ButtonType.LEFT})
116
      .send();
117
}
118
119
function auxClickOn(element) {
120
  return new test_driver.Actions()
121
      .pointerMove(0, 0, {origin: element})
122
      .pointerDown({button: test_driver.Actions.prototype.ButtonType.RIGHT})
123
      .pointerUp({button: test_driver.Actions.prototype.ButtonType.RIGHT})
124
      .send();
125
}
126
127
function dblClickOn(element) {
128
  return new test_driver.Actions()
129
      .pointerMove(0, 0, {origin: element})
130
      .pointerDown({button: test_driver.Actions.prototype.ButtonType.LEFT})
131
      .pointerUp({button: test_driver.Actions.prototype.ButtonType.LEFT})
132
      .pointerDown({button: test_driver.Actions.prototype.ButtonType.LEFT})
133
      .pointerUp({button: test_driver.Actions.prototype.ButtonType.LEFT})
134
      .send();
135
}
136
137
function movePointerOver(element) {
138
  let rect = element.getBoundingClientRect();
139
  return new test_driver.Actions()
140
      .pointerMove(0, 0, { origin: element })
141
      .send();
142
}
143
144
function movePointerTo(x, y) {
145
  return new test_driver.Actions()
146
      .pointerMove(x, y, { origin: "viewport" })
147
      .send();
148
}
149
150
function expectEventsOn(events, element) {
151
  let promises = [];
152
  for (event of events) {
153
    ((event, element) => {
154
      var promise = new Promise((resolve, reject) => {
155
        let f = (e) => {
156
          assert_equals(e.type, event);
157
          assert_equals(e.target, element);
158
          resolve();
159
        }
160
        element.addEventListener(event, f, { capture: true, once: true });
161
162
        step_timeout(() => {
163
          element.removeEventListener(event, f, { capture: true });
164
          reject("did not get " + event + " on " + element.id);
165
        }, 1000);
166
      });
167
      promises.push(promise);
168
    })(event, element);
169
  }
170
  return promises;
171
}
172
173
function unexpectEventsOn(events, element) {
174
  let promises = [];
175
  for (event of events) {
176
    ((event, element) => {
177
      var promise = new Promise((resolve, reject) => {
178
        let f = (e) => {
179
          assert_equals(e.type, event);
180
          assert_equals(e.target, element);
181
          reject("got " + e.type + " on " + e.target.id);
182
        }
183
        element.addEventListener(event, f, { capture: true, once: true });
184
185
        step_timeout(() => {
186
          element.removeEventListener(event, f, { capture: true });
187
          resolve();
188
        }, 1000);
189
      });
190
      promises.push(promise);
191
    })(event, element);
192
  }
193
  return promises;
194
}
195
196
test(() => {
197
  let rect = foreground.getBoundingClientRect();
198
  let center_x = rect.left + (rect.width / 2);
199
  let center_y = rect.top + (rect.height / 2);
200
  assert_equals(document.elementsFromPoint(center_x, center_y)[0], foreground);
201
}, "elementsFromPoint returns inert element");
202
203
promise_test(async () => {
204
  // Test mouse events on non-inert element - events should go to "foreground"
205
  inertContainer.inert = false;
206
  await movePointerTo(0, 0);
207
  let promises = expectEventsOn(["mouseover", "mouseenter", "mousemove", "mousedown",
208
                                 "mouseup", "click", "auxclick", "mouseout",
209
                                 "mouseleave"],
210
                                foreground);
211
  await clickOn(foreground);
212
  await auxClickOn(foreground);
213
  await dblClickOn(foreground);
214
  let ancestorBox = ancestorContainer.getBoundingClientRect();
215
  let inertBox = inertContainer.getBoundingClientRect();
216
  let x = ancestorBox.left + (ancestorBox.width / 2);
217
  let y = inertBox.bottom + ((ancestorBox.bottom - inertBox.bottom) / 2);
218
  await movePointerTo(x, y);
219
  await Promise.all(promises);
220
}, "Tests that any mouse event on a non-inert element is correctly targeted to that element");
221
222
promise_test(async () => {
223
  // Make the containing element inert - now events should go to "container"
224
  // which is the non-inert ancestor at the same position
225
  inertContainer.inert = true;
226
  await movePointerTo(0, 0);
227
228
  let promises = expectEventsOn(["mouseover", "mouseenter", "mousemove", "mousedown",
229
                                 "mouseup", "click", "auxclick"],
230
                                ancestorContainer);
231
232
  // TODO(aboxhall): We are getting these unexpected events. Why?
233
  promises = promises.concat(unexpectEventsOn(["mouseout", "mouseleave"],
234
                                              ancestorContainer));
235
236
  await clickOn(foreground);
237
  await auxClickOn(foreground);
238
  await dblClickOn(foreground);
239
  let ancestorBox = ancestorContainer.getBoundingClientRect();
240
  let inertBox = inertContainer.getBoundingClientRect();
241
  let x = ancestorBox.left + (ancestorBox.width / 2);
242
  let y = inertBox.bottom + ((ancestorBox.bottom - inertBox.bottom) / 2);
243
  await movePointerTo(x, y);
244
  await Promise.all(promises);
245
}, 'Tests that any mouse event on an inert element is targeted to the nearest non-inert ancestor at the same coordinates');
246
247
promise_test(async () => {
248
  // Test pointer events on non-inert element - events should go to "foreground"
249
  inertContainer.inert = false;
250
  await movePointerTo(0, 0);
251
252
  let promises = expectEventsOn(["pointerover", "pointerenter", "pointermove",
253
                                 "pointerdown", "pointerup", "pointerout",
254
                                 "pointerleave"],
255
                                foreground);
256
  await clickOn(foreground);
257
  let ancestorBox = ancestorContainer.getBoundingClientRect();
258
  let inertBox = inertContainer.getBoundingClientRect();
259
  let x = ancestorBox.left + (ancestorBox.width / 2);
260
  let y = inertBox.bottom + ((ancestorBox.bottom - inertBox.bottom) / 2);
261
  await movePointerTo(x, y);
262
  await Promise.all(promises);
263
}, "Tests that any pointer event on a non-inert element is correctly targeted to that element");
264
265
promise_test(async () => {
266
  // Make the containing element inert - now events should go to "container"
267
  // which is the non-inert ancestor at the same position
268
  inertContainer.inert = true;
269
  await movePointerTo(0, 0);
270
271
  let promises = expectEventsOn(["pointerover", "pointerenter", "pointermove",
272
                                 "pointerdown", "pointerup" ],
273
                                ancestorContainer);
274
275
  // TODO(aboxhall): We are getting these unexpected events. Why?
276
  promises = promises.concat(unexpectEventsOn(["pointerout", "pointerleave"],
277
                                              ancestorContainer));
278
279
  await clickOn(foreground);
280
  let ancestorBox = ancestorContainer.getBoundingClientRect();
281
  let inertBox = inertContainer.getBoundingClientRect();
282
  let x = ancestorBox.left + (ancestorBox.width / 2);
283
  let y = inertBox.bottom + ((ancestorBox.bottom - inertBox.bottom) / 2);
284
  await movePointerTo(x, y);
285
  await Promise.all(promises);
286
}, 'Tests that any pointer event on an inert element is targeted to the nearest non-inert ancestor at the same coordinates');
287
288
</script>
289
</body>
290
</html>
- a/LayoutTests/imported/w3c/web-platform-tests/inert/w3c-import.log -2 / +1 lines
Lines 14-19 Property values requiring vendor prefixes: a/LayoutTests/imported/w3c/web-platform-tests/inert/w3c-import.log_sec1
14
None
14
None
15
------------------------------------------------------------------------
15
------------------------------------------------------------------------
16
List of files:
16
List of files:
17
/LayoutTests/imported/w3c/web-platform-tests/inert/inert-computed-style.html
17
/LayoutTests/imported/w3c/web-platform-tests/inert/inert-does-not-match-disabled-selector.tentative.html
18
/LayoutTests/imported/w3c/web-platform-tests/inert/inert-does-not-match-disabled-selector.tentative.html
18
/LayoutTests/imported/w3c/web-platform-tests/inert/inert-in-shadow-dom.tentative.html
19
/LayoutTests/imported/w3c/web-platform-tests/inert/inert-in-shadow-dom.tentative.html
19
/LayoutTests/imported/w3c/web-platform-tests/inert/inert-inlines.tentative.html
20
/LayoutTests/imported/w3c/web-platform-tests/inert/inert-inlines.tentative.html
Lines 23-27 List of files: a/LayoutTests/imported/w3c/web-platform-tests/inert/w3c-import.log_sec2
23
/LayoutTests/imported/w3c/web-platform-tests/inert/inert-node-is-unselectable.tentative.html
24
/LayoutTests/imported/w3c/web-platform-tests/inert/inert-node-is-unselectable.tentative.html
24
/LayoutTests/imported/w3c/web-platform-tests/inert/inert-on-non-html.tentative.html
25
/LayoutTests/imported/w3c/web-platform-tests/inert/inert-on-non-html.tentative.html
25
/LayoutTests/imported/w3c/web-platform-tests/inert/inert-on-slots.tentative.html
26
/LayoutTests/imported/w3c/web-platform-tests/inert/inert-on-slots.tentative.html
26
/LayoutTests/imported/w3c/web-platform-tests/inert/inert-retargeting-iframe.tentative.html
27
/LayoutTests/imported/w3c/web-platform-tests/inert/inert-retargeting.tentative.html

Return to Bug 231392