You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support clicking links with URL fragments for the current page #1716
A-content/domInteracting with the DOM from web contentC-assignedThere is someone working on resolving the issueE-more-complexVariable effort required; may require a mentor. Recommended solution is clearly described in the iss
In current version, when URL fragment should find an element with id attribute, it is scrolled to the right position. (case of Acid2)
But, when URL fragment should find a element with name attribute, it does not work.
to document this issue, anchors with the "name" attribute work perfectly well for fragment links, provided load_url_from_element() is ever called.
This will in many cases not be called, because hit tests fail. gfx::DisplayItem seems to report bogus origin coordinates (on osx and linux/x11 using the skia renderer, at any rate). Fixing that should make it "work".
I spent some time on this issue, and here are my findings.
The previous comment is outdated (the symbols load_url_from_element(), etc don't exist anymore).
I think that it does not work when the element with an id attribute is an inline element, and the result is the same with a <a name="..."> anchor for the same reason.
In ScriptTask::trigger_fragment, we should check if the element returned by find_fragment_node falls in this case and find its actual position. @jdm suggested that we scroll to the position of the child text node, but I don't know if it would work if the element is empty.
This is basically correct, but we should definitely not be using the display list for this. We should be crawling the render tree, finding the right node, and pulling out its absolute position.
@Martiusweb I believe in practice that means you want the top ancestor of the node, and then call get_layout_root on it to obtain the render tree that @pcwalton mentions.
There are lots of tests that contain anchors to page fragments, but I highly doubt that they end up testing the scrolling behaviour we're looking for here. I suggest writing some yourself!
A very simple (manual) test indicates that not all cases are fixed. I'll set up some more automated tests. Do you have a recommendation as to where in the web-platform-tests they should live?
A-content/domInteracting with the DOM from web contentC-assignedThere is someone working on resolving the issueE-more-complexVariable effort required; may require a mentor. Recommended solution is clearly described in the iss
Activity
jdm commentedon Feb 20, 2014
In particular, we want to make sure we scroll to the appropriate position. In addition, we should dispatch a hashchange event (http://www.whatwg.org/specs/web-apps/current-work/multipage/section-index.html#event-hashchange).
kmcallister commentedon Mar 3, 2014
We have some support already, added for Acid2, which contains a link to
#top.june0cho commentedon Mar 4, 2014
In current version, when URL fragment should find an element with
idattribute, it is scrolled to the right position. (case of Acid2)But, when URL fragment should find
aelement withnameattribute, it does not work.caitp commentedon Apr 27, 2014
to document this issue, anchors with the "name" attribute work perfectly well for fragment links, provided
load_url_from_element()is ever called.This will in many cases not be called, because hit tests fail. gfx::DisplayItem seems to report bogus origin coordinates (on osx and linux/x11 using the skia renderer, at any rate). Fixing that should make it "work".
Martiusweb commentedon Jun 22, 2014
I spent some time on this issue, and here are my findings.
The previous comment is outdated (the symbols
load_url_from_element(), etc don't exist anymore).I think that it does not work when the element with an
idattribute is an inline element, and the result is the same with a<a name="...">anchor for the same reason.In
ScriptTask::trigger_fragment, we should check if the element returned byfind_fragment_nodefalls in this case and find its actual position. @jdm suggested that we scroll to the position of the child text node, but I don't know if it would work if the element is empty.pcwalton commentedon Jun 24, 2014
This is basically correct, but we should definitely not be using the display list for this. We should be crawling the render tree, finding the right node, and pulling out its absolute position.
jdm commentedon Jun 24, 2014
@Martiusweb I believe in practice that means you want the top ancestor of the node, and then call get_layout_root on it to obtain the render tree that @pcwalton mentions.
kball commentedon Jul 6, 2015
I'd like to take a look at this. Does anyone know if there are existing test cases somewhere in the repo?
jdm commentedon Jul 6, 2015
There are lots of tests that contain anchors to page fragments, but I highly doubt that they end up testing the scrolling behaviour we're looking for here. I suggest writing some yourself!
jdm commentedon Jul 6, 2015
Note: http://mxr.mozilla.org/servo/source/components/script/script_task.rs#1340 is the code that should be triggering the scrolling here. We may have fixed this unintentionally as part of #3790, but thorough testing would be valuable.
kball commentedon Jul 6, 2015
@jdm Thanks for the rapid response!
A very simple (manual) test indicates that not all cases are fixed. I'll set up some more automated tests. Do you have a recommendation as to where in the web-platform-tests they should live?
jdm commentedon Jul 6, 2015
I'd go with https://github.com/w3c/web-platform-tests/tree/master/html/browsers/browsing-the-web/scroll-to-fragid (ie. tests/wpt/web-platform-tests/html/browsers/browsing-the-web/scroll-to-fragid).
KiChjang commentedon Dec 1, 2015
@kball what's the status of this?
53 remaining items
servo#1716 Added missing test manifest entries
servo#1716 Added step annotations
servo#1716 Added step annotations
servo#1716 Minor changes, following code review
servo#1716 Appease tidy lint's interpretnation of alphabetical order
servo#1716 The indicated part of the document.
Auto merge of #9632 - peterjoel:issue_1716, r=KiChjang
servo#1716 Fixed test expectations (expected to FAIL for now)
servo#1716 The indicated part of the document.
servo#1716 Fixed test expectations (expected to FAIL for now)
servo#1716 Added diffs to appease manifest_changed.sh
servo#1716 The indicated part of the document.
Auto merge of #9632 - peterjoel:issue_1716, r=KiChjang
Auto merge of #9632 - peterjoel:issue_1716, r=KiChjang