Repository navigation
Addresses Issue #1716. Indicated part of the document. - #9632
Conversation
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @mbrubeck (or someone else) soon. |
|
We can ignore the warning from @highfive due to servo/highfive#59. |
|
Actually @jdm, the highfive warning has reminded me that I didn't add all the tests in the manifest.json. I'll address that now. |
56b21c6 to
f8c5cce
Compare
| .find(|node| check_anchor(&node)) | ||
| .map(Root::upcast) | ||
| }) | ||
| if fragid == "" { |
There was a problem hiding this comment.
Step annotations here would be nice.
| // 7. If fragid is an ASCII case-insensitive match for the string top, then the | ||
| // indicated part of the document is the top of the document; stop the algorithm | ||
| // here. | ||
| .or_else(|| if fragid.to_lowercase() == "top" { |
There was a problem hiding this comment.
or_else can be changed into or.
There was a problem hiding this comment.
@KiChjang Lazily evaluating those expressions seems better, since quite often the values will never be needed. As written, at most one Some value will be evaluated, and we don't unnecessarily search the document tree for an anchor if we already found an id match. This function probably isn't performance-critical, but I don't think it alters too much in readability either.
I can of course change it if you think it's best.
There was a problem hiding this comment.
Hmm, true, never thought about it in the aspect of eager vs lazy evaluation!
f3b6e3a to
11debf2
Compare
| let doc_node = self.upcast::<Node>(); | ||
| doc_node.traverse_preorder() | ||
| .filter_map(Root::downcast) | ||
| .find(|node| check_anchor(&node)) |
There was a problem hiding this comment.
Would .find(check_anchor) work here?
There was a problem hiding this comment.
To be honest, this was existing code that I extracted into its own function, and I didn't look too hard at the details.
A quick attempt tells me that this isn't a straightforward change. I don't fully understand the type-conversions going on there, but I can't see this code getting shorter by going down that path.
bc59a40 to
17b51c5
Compare
|
@bors-servo r+ Thanks for working on this! |
|
📌 Commit 17b51c5 has been approved by |
|
No need to disable the tests, but we can mark that they are expected to fail so we'll be notified when they start passing in the future :) That being said, I'm not clear on why |
|
@jdm I can't see it in the spec either. However, in 3 browsers that I checked (Firefox, Chrome and Safari), all of them have values that change as you scroll. The value of the rectangle's |
8edcadc to
d74b665
Compare
Interactive test for fragid resolution.
Added HTML tests for scrolling to fragid
Applied algorithm from whatwg spec
https://html.spec.whatwg.org/multipage/#the-indicated-part-of-the-document
Changes following code review
db1c42e to
e39e59e
Compare
|
@bors-servo r+ |
|
📌 Commit e39e59e has been approved by |
|
⌛ Testing commit e39e59e with merge 6eb2e8a... |
Addresses Issue #1716. Indicated part of the document. Fixes #1716. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9632) <!-- Reviewable:end -->
|
💔 Test failed - linux-rel |
Addresses Issue #1716. Indicated part of the document. Fixes #1716. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9632) <!-- Reviewable:end -->
|
💔 Test failed - linux-rel |
|
⚡ Previous build results for android, gonk, linux-dev, mac-dev-unit, mac-rel-css, mac-rel-wpt are reusable. Rebuilding only linux-rel... |
|
☀️ Test successful - android, gonk, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt |
Fixes #1716.