Auto merge of #22928 - yytyd:event-cancel-bubble, r=KiChjang

implement historical cancelBubble attribute for Event interface

<!-- Please describe your changes on the following line: -->
Implementation of `cancelBubble` attribute for Event interface. ref: https://dom.spec.whatwg.org/#dom-event-cancelbubble

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22882 (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22928)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-03-03 07:38:51 -05:00 committed by GitHub
commit fe1663a9f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 13 additions and 55 deletions

View file

@ -309,6 +309,18 @@ impl EventMethods for Event {
}
}
// https://dom.spec.whatwg.org/#dom-event-cancelbubble
fn CancelBubble(&self) -> bool {
self.stop_propagation.get()
}
// https://dom.spec.whatwg.org/#dom-event-cancelbubble
fn SetCancelBubble(&self, value: bool) {
if value {
self.stop_propagation.set(true)
}
}
// https://dom.spec.whatwg.org/#dom-event-timestamp
fn TimeStamp(&self) -> u64 {
self.timestamp

View file

@ -20,6 +20,7 @@ interface Event {
readonly attribute unsigned short eventPhase;
void stopPropagation();
attribute boolean cancelBubble;
void stopImmediatePropagation();
[Pure]

View file

@ -1,26 +0,0 @@
[Event-cancelBubble.html]
type: testharness
[cancelBubble must be false when an event is initially created.]
expected: FAIL
[Initializing an event must set cancelBubble to false.]
expected: FAIL
[stopPropagation() must set cancelBubble to true.]
expected: FAIL
[stopImmediatePropagation() must set cancelBubble to true.]
expected: FAIL
[Event.cancelBubble=false must have no effect.]
expected: FAIL
[Event.cancelBubble=false must have no effect during event propagation.]
expected: FAIL
[cancelBubble must be false after an event has been dispatched.]
expected: FAIL
[Event.cancelBubble=true must set the stop propagation flag.]
expected: FAIL

View file

@ -1,5 +0,0 @@
[Event-dispatch-bubble-canceled.html]
type: testharness
[Setting cancelBubble=true prior to dispatchEvent()]
expected: FAIL

View file

@ -1,5 +0,0 @@
[Event-dispatch-multiple-cancelBubble.html]
type: testharness
[Multiple dispatchEvent() and cancelBubble]
expected: FAIL

View file

@ -1,7 +1,5 @@
[Event-initEvent.html]
type: testharness
[Calling initEvent must unset the stop propagation flag.]
expected: FAIL
[Properties of initEvent(type, true, true)]
expected: FAIL

View file

@ -1,5 +0,0 @@
[Event-propagation.html]
type: testharness
[After cancelBubble=true]
expected: FAIL

View file

@ -1262,18 +1262,6 @@
[Window interface: attribute event]
expected: FAIL
[Event interface: attribute cancelBubble]
expected: FAIL
[Event interface: document.createEvent("Event") must inherit property "cancelBubble" with the proper type]
expected: FAIL
[Event interface: new Event("foo") must inherit property "cancelBubble" with the proper type]
expected: FAIL
[Event interface: new CustomEvent("foo") must inherit property "cancelBubble" with the proper type]
expected: FAIL
[Document interface: operation prepend([object Object\],[object Object\])]
expected: FAIL