Skip to content
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

Remove activatable element filter within HTMLElement#click() #9930

Merged
merged 1 commit into from Mar 11, 2016

Conversation

@rebstar6
Copy link
Contributor

rebstar6 commented Mar 8, 2016

Address #6542

Ensure that click() calls are not limited to activatable elements. Also makes the isTrusted attribute false when synthetic click activation are called from a click() method (as per spec).

Review on Reviewable

@jdm
Copy link
Member

jdm commented Mar 8, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Mar 8, 2016

Trying commit dc7f607 with merge 0bf06af...

bors-servo added a commit that referenced this pull request Mar 8, 2016
Remove activatable element filter within HTMLElement#click()

Address #6542

Ensure that click() calls are not limited to activatable elements. Also makes the isTrusted attribute false when synthetic click activation are called from a click() method (as per spec).

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9930)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 8, 2016

💔 Test failed - mac-rel-wpt

@jdm
Copy link
Member

jdm commented Mar 8, 2016

  ▶ Unexpected subtest result in /DOMEvents/throwing-in-listener-when-all-have-not-run-yet.html:
  └ PASS [expected FAIL] Throwing in event listener

You'll need to remove the appropriate ini file, now that the test passes :)

@rebstar6
Copy link
Contributor Author

rebstar6 commented Mar 9, 2016

Wow, that definitely was not the test that I was coding for. Seems weird that it now passes, but I can certainly take that ini out.

@highfive highfive removed the S-tests-failed label Mar 9, 2016
@jdm jdm assigned jdm and unassigned KiChjang Mar 9, 2016
@jdm
Copy link
Member

jdm commented Mar 9, 2016

Looks good! I've only got stylistic nits about the changes, so you can go ahead and squash all the commits together when you're addressing my comments.
-S-awaiting-review +S-needs-code-changes


Reviewed 8 of 8 files at r1, 1 of 1 files at r2.
Review status: all files reviewed at latest revision, 14 unresolved discussions.


components/script/dom/activation.rs, line 34 [r2] (raw file):
Let's use /// Whether an activation was initiated via the click() method. We should also add #[derive(PartialEq)] to make comparisons easier later on.


components/script/dom/activation.rs, line 42 [r2] (raw file):
nit: let's align these arguments with element


components/script/dom/activation.rs, line 46 [r2] (raw file):
Let's call this source.


components/script/dom/activation.rs, line 54 [r2] (raw file):
Let's add a let activatable = element.as_maybe_activatable() and use that throughout this method.


components/script/dom/activation.rs, line 77 [r2] (raw file):

if source == ActivationSource::FromClick {
    event.set_trusted(false);
}

components/script/dom/document.rs, line 8 [r2] (raw file):
use dom::activation::{ActivationSource, synthetic_click_activation};


components/script/dom/document.rs, line 1083 [r2] (raw file):
nit: let's move this to the previous line and align the remaining arguments with it.


components/script/dom/htmlbuttonelement.rs, line 7 [r2] (raw file):
use dom::activation::{Activatable, ActivationSource, synthetic_click_activation};


components/script/dom/htmlelement.rs, line 6 [r2] (raw file):
use dom::activation::{ActivationSource, synthetic_click_activation};


components/script/dom/htmlelement.rs, line 188 [r2] (raw file):
nit: ensure these arguments align with the previous line.


components/script/dom/htmlinputelement.rs, line 8 [r2] (raw file):
use dom::activation::{Activatable, ActivationSource, synthetic_click_activation);


components/script/dom/htmlinputelement.rs, line 906 [r2] (raw file):
nit: ensure these arguments are indented to match the first one.


components/script/dom/htmllabelelement.rs, line 7 [r2] (raw file):
use dom::activation::{Activatable, ActivationSource, synthetic_click_activation);


components/script/dom/htmllabelelement.rs, line 69 [r2] (raw file):
nit: indentation


Comments from the review on Reviewable.io

@rebstar6
Copy link
Contributor Author

rebstar6 commented Mar 10, 2016

Review status: all files reviewed at latest revision, 14 unresolved discussions.


components/script/dom/activation.rs, line 34 [r2] (raw file):
On the enum? It's giving me: error: derive may only be applied to structs and enums


components/script/dom/activation.rs, line 42 [r2] (raw file):
Done.


components/script/dom/activation.rs, line 46 [r2] (raw file):
Done.


components/script/dom/activation.rs, line 54 [r2] (raw file):
Done.


components/script/dom/activation.rs, line 77 [r2] (raw file):
I had tried this initially but it gives errors: note: an implementation of std::cmp::PartialEq might be missing for dom::activation::ActivationSource

...which I'm now realizing is related to the partialeq comment above


Comments from the review on Reviewable.io

@jdm
Copy link
Member

jdm commented Mar 10, 2016

Yes, I meant on the enum. Apologies if that's not where I commented.

@rebstar6 rebstar6 force-pushed the rebstar6:htmlclick branch from c84e935 to 8d2fb7f Mar 10, 2016
@rebstar6
Copy link
Contributor Author

rebstar6 commented Mar 10, 2016

Comments addressed, squashed down to 1 commit.

@jdm
Copy link
Member

jdm commented Mar 10, 2016

One last change and this will be good to merge :)
-S-awaiting-review +S-needs-code-changes


Reviewed 6 of 6 files at r3.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


components/script/dom/activation.rs, line 56 [r3] (raw file):
Let's use if let Some(a) = activatable { here (and elsewhere in this function), since it's more idiomatic than using map for side-effects.


Comments from the review on Reviewable.io

Moved synthetic_click_actiavtion out of Activatable trait so it can be
called by all elements (not just activatable). Calls appropriately
from click. Also updates the isdisabled check in click to check for all
types of elements
@rebstar6 rebstar6 force-pushed the rebstar6:htmlclick branch from 8d2fb7f to d6678a1 Mar 10, 2016
@rebstar6
Copy link
Contributor Author

rebstar6 commented Mar 10, 2016

Review status: all files reviewed at latest revision, 1 unresolved discussion.


components/script/dom/activation.rs, line 56 [r3] (raw file):
Done.


Comments from the review on Reviewable.io

@jdm
Copy link
Member

jdm commented Mar 10, 2016

@bors-servo: r+
Great work!


Reviewed 1 of 1 files at r4.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from the review on Reviewable.io

@bors-servo
Copy link
Contributor

bors-servo commented Mar 10, 2016

📌 Commit d6678a1 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Mar 11, 2016

Testing commit d6678a1 with merge fcceea8...

bors-servo added a commit that referenced this pull request Mar 11, 2016
Remove activatable element filter within HTMLElement#click()

Address #6542

Ensure that click() calls are not limited to activatable elements. Also makes the isTrusted attribute false when synthetic click activation are called from a click() method (as per spec).

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9930)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 11, 2016

💔 Test failed - linux-rel

@jdm
Copy link
Member

jdm commented Mar 11, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Mar 11, 2016

Testing commit d6678a1 with merge f2f6787...

bors-servo added a commit that referenced this pull request Mar 11, 2016
Remove activatable element filter within HTMLElement#click()

Address #6542

Ensure that click() calls are not limited to activatable elements. Also makes the isTrusted attribute false when synthetic click activation are called from a click() method (as per spec).

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9930)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 11, 2016

@bors-servo bors-servo merged commit d6678a1 into servo:master Mar 11, 2016
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.