<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:rniwa&#64;webkit.org" title="Ryosuke Niwa &lt;rniwa&#64;webkit.org&gt;"> <span class="fn">Ryosuke Niwa</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_ASSIGNED "
   title="ASSIGNED - For keyboard users, activating a fragment URL should transfer focus and caret to the destination"
   href="https://bugs.webkit.org/show_bug.cgi?id=116046">bug 116046</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Attachment #276287 Flags</td>
           <td>review?
           </td>
           <td>review-
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_ASSIGNED "
   title="ASSIGNED - For keyboard users, activating a fragment URL should transfer focus and caret to the destination"
   href="https://bugs.webkit.org/show_bug.cgi?id=116046#c32">Comment # 32</a>
              on <a class="bz_bug_link 
          bz_status_ASSIGNED "
   title="ASSIGNED - For keyboard users, activating a fragment URL should transfer focus and caret to the destination"
   href="https://bugs.webkit.org/show_bug.cgi?id=116046">bug 116046</a>
              from <span class="vcard"><a class="email" href="mailto:rniwa&#64;webkit.org" title="Ryosuke Niwa &lt;rniwa&#64;webkit.org&gt;"> <span class="fn">Ryosuke Niwa</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=276287&amp;action=diff" name="attach_276287" title="patch">attachment 276287</a> <a href="attachment.cgi?id=276287&amp;action=edit" title="patch">[details]</a></span>
patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=276287&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=276287&amp;action=review</a>

<span class="quote">&gt; Source/WebCore/dom/Document.cpp:3944
&gt; +    </span >

There's whitespace in this line.
Ditto for every blink line hereafter in this file.

<span class="quote">&gt; Source/WebCore/dom/Document.cpp:3969
&gt; +        Node* nextNode = NodeTraversal::nextSkippingChildren(*node);</span >

Why are we calling nextSkippingChildren here given we're moving to the container node in nodeChildrenWillBeRemoved already?

<span class="quote">&gt; Source/WebCore/dom/Document.cpp:4099
&gt; +    // We should update m_focusNavigationStartingNode if it was removed.</span >

This comment repeats what the code below says. Please remove it.

<span class="quote">&gt; Source/WebCore/dom/Document.cpp:4101
&gt; +    for (Node* nodeToBeRemoved = container.firstChild(); nodeToBeRemoved; nodeToBeRemoved = nodeToBeRemoved-&gt;nextSibling()) {
&gt; +        if (m_focusNavigationStartingNode.get() == nodeToBeRemoved) {</span >

This is a very inefficient way of checking that m_focusNavigationStartingNode is getting removed.
Instead, just check &quot;m_focusNavigationStartingNode &amp;&amp; m_focusNavigationStartingNode-&gt;parentNode() == this&quot;.
Also, this code has a bug that it doesn't check the possibility that an ancestor of m_focusNavigationStartingNode is getting removed.
e.g. m_focusNavigationStartingNode is at the span in &lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt; and div is getting removed.
So we need to walk up the ancestor chain of m_focusNavigationStartingNode and check whether any of it matches this.
r- because of this bug.
Also, please add a test case for this.

<span class="quote">&gt; Source/WebCore/dom/Document.cpp:4131
&gt; +    // We should update m_focusNavigationStartingNode if it was removed.
&gt; +    if (m_focusNavigationStartingNode.get() == &amp;n) {
&gt; +        m_focusNavigationStartingNode = n.previousSibling();
&gt; +        if (!m_focusNavigationStartingNode)
&gt; +            m_focusNavigationStartingNode = n.parentNode();
&gt; +        m_focusNavigationStartingNodeIsRemoved = true;
&gt; +    }</span >

Please use add a helper function instead of duplicating the code here.

<span class="quote">&gt; Source/WebCore/page/FrameView.cpp:2100
&gt; +            </span >

Nit: Superfluous blank line &amp; whitespace.

<span class="quote">&gt; LayoutTests/fast/events/sequential-focus-navigation-starting-point-expected.txt:2
&gt; +PASS document.activeElement.id is 'next'</span >

This output doesn't tell us why document.activeElement.id should be &quot;next&quot;.

<span class="quote">&gt; LayoutTests/fast/events/sequential-focus-navigation-starting-point.html:14
&gt; +test1();
&gt; +test2();
&gt; +test3();
&gt; +test4();</span >

There's no need to spit into four different functions like this.

<span class="quote">&gt; LayoutTests/fast/events/sequential-focus-navigation-starting-point.html:23
&gt; +    container.innerHTML = '&lt;input id=prev&gt;&lt;div style=&quot;height:200px;&quot;&gt;&lt;span&gt;text&lt;/span&gt;&lt;/div&gt;&lt;input id=next&gt;';
&gt; +    hoverOverElement(container.querySelector('span'));
&gt; +    eventSender.mouseDown();
&gt; +    eventSender.keyDown('\t');
&gt; +    shouldBe(&quot;document.activeElement.id&quot;, &quot;'next'&quot;);</span >

This code can be improved as follows:
shouldBe(&quot;container.innerHTML = '&lt;input id=prev&gt;&lt;div style=&quot;height:200px;&quot;&gt;&lt;span&gt;text&lt;/span&gt;&lt;/div&gt;&lt;input id=next&gt;'; focusSpan(); moveFocus('forward'); document.activeElement.id&quot;, &quot;'next'&quot;);
where
function focusSpan() { hoverOverElement(container.querySelector('span')); }
function moveFocus(direction) { eventSender.keyDown('\t', direction == 'forward' ? [] : ['shiftKey']); }

This way, the expected result contains the markup as well as the code that runs prior to the assertion
and makes it blatantly obvious why activeElement.id should be 'next'.
Ditto for other test cases.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>