-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Assert pressure is 0 during pointerup #3794
Merged
RByers
merged 4 commits into
web-platform-tests:master
from
material-foundation:pointerup-pressure
Sep 28, 2016
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2adc6f5
[pointerevents] Remove dead code in iframe
appsforartists 68ba272
[pointerevents] Set event.buttons to match event.pressure
appsforartists 100a484
[pointerevents] Add constructor tests for event.button and event.buttons
appsforartists f6f2c1c
[pointerevents] Assert event.pressure is 0 when event.type == pointerup
appsforartists File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although we have not setting this before and that is fine to set them this way. But there should be no expectation that when js itself creates a PointerEvent object it conforms with the spec. Meaning that it can have buttons=25 and pressure=2 as long as they fit in the data type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR I've opened to support w3c/pointerevents#146 in PEP sets pressure to 0 when buttons is 0. Thus, if someone tried to create a
PointerEvent
withpressure
set but notbuttons
, pressure would be 0.This seems reasonable.
pressure
withoutbuttons
would be nonsense, and allowing a constructor implementation to validate those parameters makes it really easy to assert correctness. (Look at how simple the PEP PR is).If allowing
PointerEvent
arguments to be nonsensical is a requirement, that should be its own test.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my understanding and from the discussions we had so far the answer is yes. In other words, any combination of the field values are possible when js creates an untrusted event. But I'd like someone else to confirm this as well. Maybe @mustaqahmed @RByers @scottgonzalez can chime in here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong opinion either way, but developers shouldn't be creating events with values that can't exist for real.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think there's a difference between "they technically can because an implementation doesn't validate" and "the spec requires that nonsense be passed-through unmolested."
I'm not asking that the spec require validation in the constructor, but I do think this PR should be merged. If we wanna specify that
pressure
is always passed-through in the constructor, even ifbuttons
is unset, that should be a separate conversation (and a separate test).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I do feel the same about this PR that it can go in without further changes.
My first comment about this part was just something to bring our attentions to this subject.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, constructors let you specify any value permitted by the interface even if such events aren't created by the browser in practice.