For keyboard users, activating a fragment URL should transfer focus and caret to the destination
https://bugs.webkit.org/show_bug.cgi?id=116046

Reviewed by Ryosuke Niwa.

Source/WebCore:

Added a sequential focus navigation starting node to document. When TAB or SHIFT-TAB is pressed
and there is no focused element, we start searching for next focus candidates at the sequential
focus navigation node.

Test: fast/events/sequential-focus-navigation-starting-point.html

* dom/Document.cpp:
(WebCore::Document::removedLastRef):
(WebCore::Document::destroyRenderTree):
(WebCore::Document::removeFocusedNodeOfSubtree):
(WebCore::Document::hoveredElementDidDetach):
(WebCore::Document::setFocusedElement):
(WebCore::isNodeFrameOrDocument):
(WebCore::Document::setFocusNavigationStartingNode):
(WebCore::Document::focusNavigationStartingNode):
(WebCore::Document::setCSSTarget):
(WebCore::Document::nodeChildrenWillBeRemoved):
(WebCore::Document::nodeWillBeRemoved):
(WebCore::fallbackFocusNavigationStartingNodeAfterRemoval):
(WebCore::Document::updateFocusNavigationStartingNodeWithNodeRemoval):
(WebCore::Document::textInserted):
* dom/Document.h:
(WebCore::Document::userActionElements):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEvent):
* page/FocusController.cpp:
(WebCore::FocusController::advanceFocusInDocumentOrder):
* page/FrameView.cpp:
(WebCore::FrameView::scrollToAnchor):

LayoutTests:

Updated fast/dom/fragment-activation-focuses-target.html, now that navigating to a unfocusable
fragment will unset the focused element.

* fast/dom/fragment-activation-focuses-target-expected.txt:
* fast/dom/fragment-activation-focuses-target.html:
* fast/events/sequential-focus-navigation-starting-point-expected.txt: Added.
* fast/events/sequential-focus-navigation-starting-point.html: Added.
* platform/ios-simulator/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@200479 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed