Auto merge of #11726 - sjmelia:7720_add_target_selector, r=mbrubeck

Issue 7720: Add target selector and update when scrolling to fragment

<!-- Please describe your changes on the following line: -->
Add the target pseudo selector and set/unset it during scrolling to fragment. This change is not complete as no repaint is triggered after the selector is added - it will only take effect after a repaint is triggered by e.g. hovering over another element. (See manual test)

I would like some help because i'm not sure how to resolve this; I can only think to call window.reflow.

I added a manual test case, don't think this counts really! I think the applicable automated test is in /tests/wpt/web-platform-tests/dom/nodes/Element-matches.html but it currently fails, I think due to the above.

---
<!-- 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 #7720  (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11726)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-08-03 14:53:30 -05:00 committed by GitHub
commit 7a7bdf51ad
10 changed files with 105 additions and 59 deletions

View file

@ -1,7 +1,5 @@
[Element-matches.html]
type: testharness
[In-document Element.matches: :target pseudo-class selector, matching the element referenced by the URL fragment identifier (with no refNodes): :target]
expected: FAIL
[In-document Element.matches: :lang pseudo-class selector, matching inherited language (with no refNodes): #pseudo-lang-div1:lang(en)]
expected: FAIL

View file

@ -6,12 +6,6 @@
[Document.querySelector: Attribute whitespace-separated list selector, not matching class attribute with empty value: #attr-whitespace [class~=""\]]
expected: FAIL
[Document.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target]
expected: FAIL
[Document.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target]
expected: FAIL
[Document.querySelectorAll: :lang pseudo-class selector, matching inherited language: #pseudo-lang-div1:lang(en)]
expected: FAIL
@ -66,12 +60,6 @@
[Detached Element.querySelector: Attribute whitespace-separated list selector, not matching class attribute with empty value: #attr-whitespace [class~=""\]]
expected: FAIL
[Detached Element.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target]
expected: FAIL
[Detached Element.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target]
expected: FAIL
[Detached Element.querySelectorAll: :lang pseudo-class selector, not matching element with no inherited language: #pseudo-lang-div1:lang(en)]
expected: FAIL
@ -126,12 +114,6 @@
[Fragment.querySelector: Attribute whitespace-separated list selector, not matching class attribute with empty value: #attr-whitespace [class~=""\]]
expected: FAIL
[Fragment.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target]
expected: FAIL
[Fragment.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target]
expected: FAIL
[Fragment.querySelectorAll: :lang pseudo-class selector, not matching element with no inherited language: #pseudo-lang-div1:lang(en)]
expected: FAIL
@ -186,12 +168,6 @@
[In-document Element.querySelector: Attribute whitespace-separated list selector, not matching class attribute with empty value: #attr-whitespace [class~=""\]]
expected: FAIL
[In-document Element.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target]
expected: FAIL
[In-document Element.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target]
expected: FAIL
[In-document Element.querySelectorAll: :lang pseudo-class selector, matching inherited language: #pseudo-lang-div1:lang(en)]
expected: FAIL

View file

@ -6,12 +6,6 @@
[Document.querySelector: Attribute whitespace-separated list selector, not matching class attribute with empty value: #attr-whitespace [class~=""\]]
expected: FAIL
[Document.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target]
expected: FAIL
[Document.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target]
expected: FAIL
[Document.querySelectorAll: :lang pseudo-class selector, matching inherited language: #pseudo-lang-div1:lang(en)]
expected: FAIL
@ -66,12 +60,6 @@
[Detached Element.querySelector: Attribute whitespace-separated list selector, not matching class attribute with empty value: #attr-whitespace [class~=""\]]
expected: FAIL
[Detached Element.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target]
expected: FAIL
[Detached Element.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target]
expected: FAIL
[Detached Element.querySelectorAll: :lang pseudo-class selector, not matching element with no inherited language: #pseudo-lang-div1:lang(en)]
expected: FAIL
@ -126,12 +114,6 @@
[Fragment.querySelector: Attribute whitespace-separated list selector, not matching class attribute with empty value: #attr-whitespace [class~=""\]]
expected: FAIL
[Fragment.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target]
expected: FAIL
[Fragment.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target]
expected: FAIL
[Fragment.querySelectorAll: :lang pseudo-class selector, not matching element with no inherited language: #pseudo-lang-div1:lang(en)]
expected: FAIL
@ -186,12 +168,6 @@
[In-document Element.querySelector: Attribute whitespace-separated list selector, not matching class attribute with empty value: #attr-whitespace [class~=""\]]
expected: FAIL
[In-document Element.querySelectorAll: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target]
expected: FAIL
[In-document Element.querySelector: :target pseudo-class selector, matching the element referenced by the URL fragment identifier: :target]
expected: FAIL
[In-document Element.querySelectorAll: :lang pseudo-class selector, matching inherited language: #pseudo-lang-div1:lang(en)]
expected: FAIL