Skip to content

Addresses Issue #1716. Indicated part of the document. - #9632

Merged
bors-servo merged 1 commit into
servo:masterfrom
peterjoel:issue_1716
Feb 17, 2016
Merged

bors-servo merged 1 commit into
servo:masterfrom
peterjoel:issue_1716

Conversation

@peterjoel

Copy link
Copy Markdown
Contributor

Fixes #1716.

Review on Reviewable

@highfive

Copy link
Copy Markdown

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.

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Feb 14, 2016
@highfive

Copy link
Copy Markdown

warning Warning warning

  • This pull request adds a file without the .ini file extension to tests/wpt/metadata. Please consider removing it!

@jdm

jdm commented Feb 14, 2016

Copy link
Copy Markdown
Member

We can ignore the warning from @highfive due to servo/highfive#59.

@peterjoel

Copy link
Copy Markdown
Contributor Author

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.

@peterjoel peterjoel changed the title Issue 1716 Addresses Issue #1716. Indicated part of the document. Feb 14, 2016
@peterjoel

Copy link
Copy Markdown
Contributor Author

#1716

Comment thread components/script/dom/document.rs Outdated
.find(|node| check_anchor(&node))
.map(Root::upcast)
})
if fragid == "" {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step annotations here would be nice.

@KiChjang KiChjang added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Feb 15, 2016
// 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" {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or_else can be changed into or.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, true, never thought about it in the aspect of eager vs lazy evaluation!

@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Feb 15, 2016
let doc_node = self.upcast::<Node>();
doc_node.traverse_preorder()
.filter_map(Root::downcast)
.find(|node| check_anchor(&node))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would .find(check_anchor) work here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@KiChjang

Copy link
Copy Markdown
Contributor

@bors-servo r+

Thanks for working on this!

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 17b51c5 has been approved by KiChjang

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Feb 15, 2016
@jdm

jdm commented Feb 15, 2016

Copy link
Copy Markdown
Member

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 getClientRects or getBoundingClientRect should be affected by the scroll position; I don't see any language in https://drafts.csswg.org/cssom-view/#dom-element-getclientrects that suggests that.

@peterjoel

Copy link
Copy Markdown
Contributor Author

@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 top is (and I'm not sure why 8) 8 - element.scrollTop.

@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Feb 16, 2016
    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
@KiChjang

Copy link
Copy Markdown
Contributor

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit e39e59e has been approved by KiChjang

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Feb 17, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit e39e59e with merge 6eb2e8a...

bors-servo pushed a commit that referenced this pull request Feb 17, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Feb 17, 2016
@KiChjang

Copy link
Copy Markdown
Contributor

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit e39e59e with merge 8d63eff...

bors-servo pushed a commit that referenced this pull request Feb 17, 2016
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Feb 17, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Feb 17, 2016
@KiChjang

Copy link
Copy Markdown
Contributor

@bors-servo

Copy link
Copy Markdown
Contributor

⚡ Previous build results for android, gonk, linux-dev, mac-dev-unit, mac-rel-css, mac-rel-wpt are reusable. Rebuilding only linux-rel...

@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, gonk, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt

@bors-servo
bors-servo merged commit e39e59e into servo:master Feb 17, 2016
@peterjoel
peterjoel deleted the issue_1716 branch February 20, 2016 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-tests-failed The changes caused existing tests to fail.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants