FocusController::setFocusedNode() should be setFocusedElement().
[WebKit-https.git] / Source / WebCore / ChangeLog
index 46b5f64..5b91e81 100644 (file)
@@ -1,3 +1,432 @@
+2013-05-26  Andreas Kling  <akling@apple.com>
+
+        FocusController::setFocusedNode() should be setFocusedElement().
+        <http://webkit.org/b/116780>
+
+        Reviewed by Antti Koivisto.
+
+        Only Elements can have focus, so make the public API of FocusController take Element*.
+
+        * WebCore.exp.in:
+        * page/FocusController.h:
+        * page/FocusController.cpp:
+        (WebCore::FocusController::setFocusedElement):
+
+            Out with the setFocusedNode(), in with the setFocusedElement().
+
+        * dom/Element.cpp:
+        (WebCore::Element::focus):
+        (WebCore::Element::blur):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::dispatchMouseEvent):
+        * plugins/PluginView.cpp:
+        (WebCore::PluginView::focusPluginElement):
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::setFocusedNodeIfNeeded):
+
+            Tweak for FocusController taking Element* instead of Node*.
+
+        (WebCore::FrameSelection::setFocusedElementIfNeeded):
+
+            Renamed from setFocusedNodeIfNeeded().
+
+        * editing/htmlediting.h:
+        * editing/htmlediting.cpp:
+        (WebCore::enclosingAnchorElement):
+
+            Cleaned up the loop for readability and made it return an Element.
+
+2013-05-26  Andreas Kling  <akling@apple.com>
+
+        Move some form control things from Element to HTMLFormControlElement.
+        <http://webkit.org/b/116779>
+
+        Reviewed by Antti Koivisto.
+
+        The following methods sit better on HTMLFormControlElement than on Element:
+
+            - formControlType()
+            - wasChangedSinceLastFormControlChangeEvent()
+            - setChangedSinceLastFormControlChangeEvent()
+            - dispatchFormControlChangeEvent()
+
+        Moved them, and devirtualized as much as possible.
+
+        * dom/Document.cpp:
+        (WebCore::Document::setFocusedNode):
+
+            Check if the old focus target is an Element before (possibly) dispatching a change event.
+
+        * dom/Element.cpp:
+        * dom/Element.h:
+
+            Removed some stub methods that were only used by HTMLFormControlElement subclasses.
+
+        * html/HTMLFormControlElement.cpp:
+        * html/HTMLFormControlElement.h:
+        (WebCore::isHTMLFormControlElement):
+        (WebCore::toHTMLFormControlElement):
+
+            Add toHTMLFormControlElement() helper with ASSERT_WITH_SECURITY_IMPLICATION.
+
+        * html/HTMLTextFormControlElement.h:
+
+            Sprinkle OVERRIDE.
+
+2013-05-25  Andreas Kling  <akling@apple.com>
+
+        Move Node::supportsFocus() to Element.
+        <http://webkit.org/b/116778>
+
+        Reviewed by Antti Koivisto.
+
+        Node never supports focus, so move supportsFocus() to Element instead.
+
+        * dom/Element.h:
+        * dom/Node.cpp:
+        * dom/Node.h:
+
+            Removed Node::supportsFocus(), it always returned false anyway.
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::canSetFocusAttribute):
+
+            Check that the underlying Node is an Element before asking if it supports focus.
+
+        * html/HTMLAnchorElement.h:
+        * html/HTMLAreaElement.h:
+        * html/HTMLBodyElement.h:
+        * html/HTMLElement.h:
+        * html/HTMLFieldSetElement.h:
+        * html/HTMLFormControlElement.h:
+        * html/HTMLFrameElementBase.h:
+        * html/HTMLMediaElement.h:
+        * html/HTMLOptGroupElement.h:
+        * html/HTMLOptionElement.h:
+        * html/HTMLOutputElement.h:
+        * svg/SVGAElement.h:
+        * svg/SVGCircleElement.h:
+        * svg/SVGEllipseElement.h:
+        * svg/SVGGElement.h:
+        * svg/SVGImageElement.h:
+        * svg/SVGLineElement.h:
+        * svg/SVGPathElement.h:
+        * svg/SVGPolyElement.h:
+        * svg/SVGRectElement.h:
+        * svg/SVGSVGElement.h:
+        * svg/SVGSwitchElement.h:
+        * svg/SVGSymbolElement.h:
+        * svg/SVGTextElement.h:
+        * svg/SVGUseElement.h:
+
+            OVERRIDE ALL THE THINGS!
+
+2013-05-25  Andreas Kling  <akling@apple.com>
+
+        Move Node::isFocusable() to Element.
+        <http://webkit.org/b/116777>
+
+        Reviewed by Anders Carlsson.
+
+        Nodes cannot be focusable, so move isFocusable() from Node to Element.
+
+        * dom/Node.cpp:
+        * dom/Node.h:
+        * dom/Element.h:
+        * dom/Element.cpp:
+        (WebCore::Element::isFocusable):
+
+            Moved here from Node.
+
+        * dom/Document.cpp:
+        (WebCore::Document::setFocusedNode):
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::determineAccessibilityRole):
+
+            Check that the underlying node is an Element before asking if it's focusable.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scrollToAnchor):
+
+            Renamed the 'anchorNode' variable to 'anchorElement' because reasons.
+
+        * html/HTMLAreaElement.h:
+        * html/HTMLFormControlElement.h:
+        * html/HTMLLabelElement.h:
+        * html/HTMLOptionElement.h:
+        * svg/SVGAElement.h:
+
+            Sprinkle OVERRIDE.
+
+        * html/ValidationMessage.cpp:
+        (WebCore::ValidationMessage::setMessage):
+
+            Update a comment to refer to Element::isFocusable() instead of Node.
+
+2013-05-25  Andreas Kling  <akling@apple.com>
+
+        Move Node::tabIndex() to Element.
+        <http://webkit.org/b/116772>
+
+        Reviewed by Ryosuke Niwa.
+
+        Since only Elements are keyboard-focusable, it doesn't make sense for Node to have a tabIndex().
+
+        * dom/Element.h:
+        * dom/Node.cpp:
+        * dom/Node.h:
+
+            A Node can't have a tab index, so move tabIndex() to Element.
+
+        * page/FocusController.h:
+        * page/FocusController.cpp:
+        (WebCore::adjustedTabIndex):
+        (WebCore::FocusController::findElementWithExactTabIndex):
+        (WebCore::nextElementWithGreaterTabIndex):
+        (WebCore::previousElementWithLowerTabIndex):
+        (WebCore::FocusController::nextFocusableNode):
+        (WebCore::FocusController::previousFocusableNode):
+
+            Make this code deal in Element* when doing tab index stuff. FocusController needs
+            more Node->Element cleanup, but let's do that separately.
+
+        * html/HTMLAnchorElement.h:
+        * html/HTMLElement.h:
+        * html/HTMLFormControlElement.h:
+
+            Sprinkle OVERRIDE.
+
+2013-05-25  Andreas Kling  <akling@apple.com>
+
+        Don't instantiate ChildNodeLists just to get a child count.
+        <http://webkit.org/b/116776>
+
+        Reviewed by Ryosuke Niwa.
+
+        Use ContainerNode::childNodeCount() instead of Node::childNodes()->length().
+
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::mergeEndWithNextIfIdentical):
+
+2013-05-25  Andreas Kling  <akling@apple.com>
+
+        PluginDocument::pluginNode() should be pluginElement() instead.
+        <http://webkit.org/b/116774>
+
+        Reviewed by Anders Carlsson.
+
+        Make PluginDocument hand out a HTMLPlugInElement* instead of a Node*.
+
+        * dom/Document.cpp:
+        (WebCore::eventTargetNodeForDocument):
+        * html/PluginDocument.h:
+        * html/PluginDocument.cpp:
+        (WebCore::PluginDocumentParser::createDocumentStructure):
+        (WebCore::PluginDocument::pluginWidget):
+        (WebCore::PluginDocument::setPluginElement):
+        (WebCore::PluginDocument::detach):
+
+2013-05-25  Andreas Kling  <akling@apple.com>
+
+        Remove Document::getFocusableNodes().
+        <http://webkit.org/b/116773>
+
+        Reviewed by Joseph Pecoraro.
+
+        This was added in r42191 and there are no remaining clients of the API.
+
+        * dom/Document.cpp:
+        * dom/Document.h:
+        * WebCore.exp.in:
+
+2013-05-25  Andreas Kling  <akling@apple.com>
+
+        Move Node::focusDelegate() to Element.
+        <http://webkit.org/b/116768>
+
+        Reviewed by Anders Carlsson.
+
+        Only Element can be a focus delegate (it's currently only ever HTMLInputElement actually)
+        so move Node::focusDelegate() to Element. Sprinkled isElementNode() checks as needed.
+
+        * dom/Node.cpp:
+        * dom/Node.h:
+        * dom/Element.h:
+        * dom/Element.cpp:
+        * html/shadow/SliderThumbElement.cpp:
+        (WebCore::SliderThumbElement::focusDelegate):
+        * html/shadow/SliderThumbElement.h:
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::isFocused):
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::paintSliderThumb):
+
+2013-05-25  Alberto Garcia  <agarcia@igalia.com>
+
+        Path: clean up addPathForRoundedRect()
+        https://bugs.webkit.org/show_bug.cgi?id=116765
+
+        Reviewed by Andreas Kling.
+
+        Reorganize code that is a bit redundant.
+
+        No new tests, no behavior change.
+
+        * platform/graphics/Path.cpp:
+        (WebCore::Path::addPathForRoundedRect):
+
+2013-05-25  Simon Fraser  <simon.fraser@apple.com>
+
+        Unprefix Page Visibility API
+        https://bugs.webkit.org/show_bug.cgi?id=102340
+
+        Reviewed by Tim Horton.
+        
+        Remove prefixes from the document properties, and the visibilitychanged event.
+        
+        Rename the "preview" state to "unloaded". The "unloaded" state is never
+        reached yet (see https://bugs.webkit.org/show_bug.cgi?id=116769).
+        
+        Add some comments to places where we should update the visibility state
+        when going in and out of the page cache, but cannot safely do so yet.
+
+        Tested by existing Page Visibility tests.
+
+        * dom/Document.cpp:
+        (WebCore::Document::pageVisibilityState):
+        (WebCore::Document::visibilityState):
+        (WebCore::Document::hidden):
+        (WebCore::Document::dispatchVisibilityStateChangeEvent):
+        * dom/Document.h:
+        * dom/Document.idl:
+        * dom/EventNames.h:
+        * history/CachedFrame.cpp:
+        (WebCore::CachedFrameBase::restore):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::stopLoading):
+        * page/Page.cpp:
+        (WebCore::Page::setVisibilityState):
+        * page/PageVisibilityState.cpp:
+        (WebCore::pageVisibilityStateString):
+        * page/PageVisibilityState.h:
+
+2013-05-25  Andreas Kling  <akling@apple.com>
+
+        Move Node::isMouseFocusable() to Element.
+        <http://webkit.org/b/116762>
+
+        Reviewed by Anders Carlsson.
+
+        Node::isMouseFocusable() would just return isFocusable(), which is never true for a non-Element
+        since Node::supportsFocus() always returns false. So move it to Element!
+
+        * dom/Node.h:
+        * dom/Node.cpp:
+        * dom/Element.h:
+        * dom/Element.cpp:
+        (WebCore::Element::isMouseFocusable):
+
+            Moved here from Node.
+
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::setFocusedNodeIfNeeded):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::dispatchMouseEvent):
+
+            Walk up the parent chain with parentOrShadowHostElement() instead of parentOrShadowHostNode().
+            Removed a misleading no-op hunk about mouse-focusable ShadowRoots, since ShadowRoots are not
+            Elements and thus cannot be mouse-focusable.
+
+        * page/TouchAdjustment.cpp:
+        (WebCore::TouchAdjustment::nodeRespondsToTapGesture):
+
+            Check that the Node is an Element before asking if it's mouse-focusable.
+
+        * html/HTMLAnchorElement.h:
+        * html/HTMLAreaElement.h:
+        * html/HTMLFormControlElement.h:
+        * html/HTMLInputElement.h:
+        * html/HTMLMediaElement.h:
+        * html/HTMLSelectElement.h:
+        * html/HTMLTextAreaElement.h:
+        * html/shadow/ClearButtonElement.h:
+        * html/shadow/TextControlInnerElements.h:
+        * svg/SVGAElement.h:
+        * svg/SVGStyledElement.h:
+
+            Sprinkle OVERRIDE.
+
+2013-05-25  Andreas Kling  <akling@apple.com>
+
+        Move Node::isKeyboardFocusable() to Element.
+        <http://webkit.org/b/116761>
+
+        Reviewed by Antti Koivisto.
+
+        Only Elements can be keyboard-focusable. Move the base isKeyboardFocusable() implementation to Element
+        and sprinkle OVERRIDE on subclass overrides.
+        FocusController gets some temporary type checks that will go away as that code moves to dealing in
+        Elements instead of Node.
+
+        * dom/Node.h:
+        * dom/Node.cpp:
+        * dom/Element.h:
+        * dom/Element.cpp:
+        (WebCore::Element::isKeyboardFocusable):
+
+            Move isKeyboardFocusable() from Node to Element.
+
+        * page/FocusController.cpp:
+        (WebCore::isNonFocusableShadowHost):
+        (WebCore::isFocusableShadowHost):
+        (WebCore::shouldVisit):
+        (WebCore::FocusController::advanceFocusInDocumentOrder):
+
+            Check that the inspected Node is an Element before querying isKeyboardFocusable().
+
+        * html/HTMLAnchorElement.h:
+        * html/HTMLAreaElement.h:
+        * html/HTMLFormControlElement.h:
+        * html/HTMLFrameOwnerElement.h:
+        * html/HTMLInputElement.h:
+        * html/HTMLPlugInElement.h:
+        * html/HTMLSelectElement.h:
+        * html/HTMLTextAreaElement.h:
+        * svg/SVGAElement.h:
+        * svg/SVGStyledElement.h:
+
+            Sprinkle OVERRIDE.
+
+2013-05-25  Andreas Kling  <akling@apple.com>
+
+        Begin moving "focus" state logic from Node to Element.
+        <http://webkit.org/b/116760>
+
+        Reviewed by Antti Koivisto.
+
+        Only Elements can be focused, so merge the "focus" state logic from Node and ContainerNode
+        and move it into Element. There's a lot more iceberg under this tip, but we'll be starting
+        with setFocus(bool) and focused().
+
+        * dom/Node.h:
+        * dom/ContainerNode.cpp:
+        * dom/ContainerNode.h:
+        * dom/Element.cpp:
+        (WebCore::Element::isUserActionElementFocused):
+        (WebCore::Element::setFocus):
+        * dom/Element.h:
+        (WebCore::Element::focused):
+        * dom/Node.cpp:
+
+            Move focused() and setFocus(bool) from Node/ContainerNode to Element.
+
+        * dom/Document.cpp:
+        (WebCore::Document::setFocusedNode):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::dispatchMouseEvent):
+
+            Check if the inspected Node is an Element before asking if it's focused.
+
 2013-05-25  Noam Rosenthal  <noam.rosenthal@nokia.com>
 
         Direct pattern compositing breaks when no-repeat is set on a large layer