Changeset 150796 in webkit


Ignore:
Timestamp:
May 28, 2013 5:46:31 AM (11 years ago)
Author:
akling@apple.com
Message:

Document::setFocusedNode() should be setFocusedElement().
<http://webkit.org/b/116857>

Reviewed by Antti Koivisto.

Source/WebCore:

Only Elements can be focused, so tighten Document's idea of what's focused.

Most of this patch is just updating call sites for the new names and removing
now-unnecessary isElementNode() checks and casts.

  • WebCore.exp.in:
  • accessibility/AXObjectCache.cpp:

(WebCore::AXObjectCache::focusedUIElementForPage):

  • accessibility/AccessibilityNodeObject.cpp:

(WebCore::AccessibilityNodeObject::canSetFocusAttribute):

  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::isFocused):
(WebCore::AccessibilityRenderObject::setFocused):
(WebCore::AccessibilityRenderObject::handleActiveDescendantChanged):

  • bindings/objc/DOM.mm:

(-[DOMElement isFocused]):

  • dom/Document.cpp:

(WebCore::Document::dispose):
(WebCore::Document::detach):
(WebCore::Document::focusedNodeRemoved):
(WebCore::Document::removeFocusedNodeOfSubtree):
(WebCore::Document::setFocusedElement):
(WebCore::Document::updateFocusAppearanceTimerFired):
(WebCore::eventTargetNodeForDocument):

  • dom/Document.h:

(Document):
(WebCore::Document::focusedElement):

  • dom/Element.cpp:

(WebCore::Element::attach):
(WebCore::Element::focus):
(WebCore::Element::blur):
(WebCore::Element::cancelFocusAppearanceUpdate):

  • dom/Node.cpp:

(WebCore::Node::rendererIsEditable):

  • dom/TreeScope.cpp:

(WebCore::TreeScope::focusedElement):

  • dom/UserTypingGestureIndicator.cpp:

(WebCore::UserTypingGestureIndicator::UserTypingGestureIndicator):

  • editing/Editor.cpp:

(WebCore::Editor::setBaseWritingDirection):
(WebCore::Editor::setComposition):
(WebCore::Editor::guessesForMisspelledOrUngrammatical):

  • editing/EditorCommand.cpp:

(WebCore::verticalScrollDistance):

  • editing/FrameSelection.cpp:

(WebCore::FrameSelection::selectAll):
(WebCore::FrameSelection::focusedOrActiveStateChanged):
(WebCore::FrameSelection::setFocusedElementIfNeeded):
(WebCore::FrameSelection::currentForm):

  • history/CachedPage.cpp:

(WebCore::CachedPage::restore):

  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::updateType):
(WebCore::HTMLInputElement::attach):

  • html/HTMLTextAreaElement.cpp:

(WebCore::HTMLTextAreaElement::setValueCommon):

  • html/HTMLTextFormControlElement.cpp:

(WebCore::HTMLTextFormControlElement::placeholderShouldBeVisible):
(WebCore::HTMLTextFormControlElement::selectionStart):
(WebCore::HTMLTextFormControlElement::selectionEnd):
(WebCore::HTMLTextFormControlElement::selectionDirection):

  • html/RadioInputType.cpp:

(WebCore::RadioInputType::handleKeydownEvent):
(WebCore::RadioInputType::isKeyboardFocusable):

  • html/shadow/DateTimeEditElement.cpp:

(WebCore::DateTimeEditElement::focusedFieldIndex):

  • loader/FrameLoader.cpp:

(WebCore::FrameLoader::stopLoading):

  • page/DOMWindow.cpp:

(WebCore::DOMWindow::focus):

  • page/EventHandler.cpp:

(WebCore::EventHandler::scrollOverflow):
(WebCore::EventHandler::logicalScrollOverflow):
(WebCore::EventHandler::dispatchMouseEvent):
(WebCore::EventHandler::sendContextMenuEventForKey):
(WebCore::EventHandler::capsLockStateMayHaveChanged):

  • page/FocusController.cpp:

(WebCore::dispatchEventsOnWindowAndFocusedNode):
(WebCore::FocusController::advanceFocusInDocumentOrder):
(WebCore::FocusController::setFocusedElement):
(WebCore::FocusController::findFocusCandidateInContainer):
(WebCore::FocusController::advanceFocusDirectionallyInContainer):
(WebCore::FocusController::advanceFocusDirectionally):

  • page/FrameView.cpp:

(WebCore::FrameView::scrollToAnchor):

  • plugins/PluginView.cpp:

(WebCore::PluginView::focusPluginElement):

  • plugins/efl/PluginViewEfl.cpp:

(WebCore::PluginView::setFocus):

  • plugins/mac/PluginViewMac.mm:

(WebCore::PluginView::platformStart):

  • rendering/RenderImage.cpp:

(WebCore::RenderImage::paintAreaElementFocusRing):

  • rendering/RenderListBox.cpp:

(WebCore::RenderListBox::paintItemForeground):
(WebCore::RenderListBox::paintItemBackground):

  • rendering/RenderTextControlSingleLine.cpp:

(WebCore::RenderTextControlSingleLine::capsLockStateMayHaveChanged):
(WebCore::RenderTextControlSingleLine::textShouldBeTruncated):

  • rendering/RenderTheme.cpp:

(WebCore::RenderTheme::isFocused):

Source/WebKit/blackberry:

  • Api/WebPage.cpp:

(BlackBerry::WebKit::WebPagePrivate::focusNodeRect):
(BlackBerry::WebKit::WebPagePrivate::contextNode):
(BlackBerry::WebKit::WebPagePrivate::clearFocusNode):
(BlackBerry::WebKit::WebPage::setNodeFocus):

  • WebCoreSupport/EditorClientBlackBerry.cpp:

(WebCore::EditorClientBlackBerry::shouldSpellCheckFocusedField):
(WebCore::EditorClientBlackBerry::shouldChangeSelectedRange):

  • WebKitSupport/InputHandler.cpp:

(BlackBerry::WebKit::InputHandler::focusedNodeChanged):

  • WebKitSupport/SelectionHandler.cpp:

(BlackBerry::WebKit::SelectionHandler::setCaretPosition):
(BlackBerry::WebKit::SelectionHandler::extendSelectionToFieldBoundary):
(BlackBerry::WebKit::SelectionHandler::updateOrHandleInputSelection):
(BlackBerry::WebKit::SelectionHandler::clipPointToVisibleContainer):
(BlackBerry::WebKit::SelectionHandler::inputNodeOverridesTouch):
(BlackBerry::WebKit::SelectionHandler::selectionPositionChanged):

Source/WebKit/efl:

  • ewk/ewk_frame.cpp:

(ewk_frame_focused_element_geometry_get):

  • ewk/ewk_view.cpp:

(ewk_view_input_method_state_set):

Source/WebKit/gtk:

  • webkit/webkitwebview.cpp:

(getFocusedNode):

Source/WebKit/mac:

  • WebView/WebHTMLView.mm:

(-[WebHTMLView clearFocus]):
(-[WebHTMLView becomeFirstResponder]):

Source/WebKit/qt:

  • Api/qwebelement.cpp:

(QWebElement::hasFocus):
(QWebElement::setFocus):

  • WebCoreSupport/EditorClientQt.cpp:

(WebCore::EditorClientQt::setInputMethodState):

  • WebCoreSupport/QWebPageAdapter.cpp:

(QWebPageAdapter::mousePressEvent):
(QWebPageAdapter::handleSoftwareInputPanel):
(QWebPageAdapter::inputMethodQuery):
(QWebPageAdapter::hasFocusedNode):

Source/WebKit/win:

  • DOMCoreClasses.cpp:

(DOMElement::isFocused):

  • WebView.cpp:

(WebView::setInitialFocus):

Source/WebKit2:

  • WebProcess/Plugins/PluginView.cpp:

(WebKit::PluginView::focusPluginElement):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::focusedPluginViewForFrame):
(WebKit::WebPage::setInitialFocus):

Location:
trunk/Source
Files:
55 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r150791 r150796  
     12013-05-28  Andreas Kling  <akling@apple.com>
     2
     3        Document::setFocusedNode() should be setFocusedElement().
     4        <http://webkit.org/b/116857>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Only Elements can be focused, so tighten Document's idea of what's focused.
     9
     10        Most of this patch is just updating call sites for the new names and removing
     11        now-unnecessary isElementNode() checks and casts.
     12
     13        * WebCore.exp.in:
     14        * accessibility/AXObjectCache.cpp:
     15        (WebCore::AXObjectCache::focusedUIElementForPage):
     16        * accessibility/AccessibilityNodeObject.cpp:
     17        (WebCore::AccessibilityNodeObject::canSetFocusAttribute):
     18        * accessibility/AccessibilityRenderObject.cpp:
     19        (WebCore::AccessibilityRenderObject::isFocused):
     20        (WebCore::AccessibilityRenderObject::setFocused):
     21        (WebCore::AccessibilityRenderObject::handleActiveDescendantChanged):
     22        * bindings/objc/DOM.mm:
     23        (-[DOMElement isFocused]):
     24        * dom/Document.cpp:
     25        (WebCore::Document::dispose):
     26        (WebCore::Document::detach):
     27        (WebCore::Document::focusedNodeRemoved):
     28        (WebCore::Document::removeFocusedNodeOfSubtree):
     29        (WebCore::Document::setFocusedElement):
     30        (WebCore::Document::updateFocusAppearanceTimerFired):
     31        (WebCore::eventTargetNodeForDocument):
     32        * dom/Document.h:
     33        (Document):
     34        (WebCore::Document::focusedElement):
     35        * dom/Element.cpp:
     36        (WebCore::Element::attach):
     37        (WebCore::Element::focus):
     38        (WebCore::Element::blur):
     39        (WebCore::Element::cancelFocusAppearanceUpdate):
     40        * dom/Node.cpp:
     41        (WebCore::Node::rendererIsEditable):
     42        * dom/TreeScope.cpp:
     43        (WebCore::TreeScope::focusedElement):
     44        * dom/UserTypingGestureIndicator.cpp:
     45        (WebCore::UserTypingGestureIndicator::UserTypingGestureIndicator):
     46        * editing/Editor.cpp:
     47        (WebCore::Editor::setBaseWritingDirection):
     48        (WebCore::Editor::setComposition):
     49        (WebCore::Editor::guessesForMisspelledOrUngrammatical):
     50        * editing/EditorCommand.cpp:
     51        (WebCore::verticalScrollDistance):
     52        * editing/FrameSelection.cpp:
     53        (WebCore::FrameSelection::selectAll):
     54        (WebCore::FrameSelection::focusedOrActiveStateChanged):
     55        (WebCore::FrameSelection::setFocusedElementIfNeeded):
     56        (WebCore::FrameSelection::currentForm):
     57        * history/CachedPage.cpp:
     58        (WebCore::CachedPage::restore):
     59        * html/HTMLInputElement.cpp:
     60        (WebCore::HTMLInputElement::updateType):
     61        (WebCore::HTMLInputElement::attach):
     62        * html/HTMLTextAreaElement.cpp:
     63        (WebCore::HTMLTextAreaElement::setValueCommon):
     64        * html/HTMLTextFormControlElement.cpp:
     65        (WebCore::HTMLTextFormControlElement::placeholderShouldBeVisible):
     66        (WebCore::HTMLTextFormControlElement::selectionStart):
     67        (WebCore::HTMLTextFormControlElement::selectionEnd):
     68        (WebCore::HTMLTextFormControlElement::selectionDirection):
     69        * html/RadioInputType.cpp:
     70        (WebCore::RadioInputType::handleKeydownEvent):
     71        (WebCore::RadioInputType::isKeyboardFocusable):
     72        * html/shadow/DateTimeEditElement.cpp:
     73        (WebCore::DateTimeEditElement::focusedFieldIndex):
     74        * loader/FrameLoader.cpp:
     75        (WebCore::FrameLoader::stopLoading):
     76        * page/DOMWindow.cpp:
     77        (WebCore::DOMWindow::focus):
     78        * page/EventHandler.cpp:
     79        (WebCore::EventHandler::scrollOverflow):
     80        (WebCore::EventHandler::logicalScrollOverflow):
     81        (WebCore::EventHandler::dispatchMouseEvent):
     82        (WebCore::EventHandler::sendContextMenuEventForKey):
     83        (WebCore::EventHandler::capsLockStateMayHaveChanged):
     84        * page/FocusController.cpp:
     85        (WebCore::dispatchEventsOnWindowAndFocusedNode):
     86        (WebCore::FocusController::advanceFocusInDocumentOrder):
     87        (WebCore::FocusController::setFocusedElement):
     88        (WebCore::FocusController::findFocusCandidateInContainer):
     89        (WebCore::FocusController::advanceFocusDirectionallyInContainer):
     90        (WebCore::FocusController::advanceFocusDirectionally):
     91        * page/FrameView.cpp:
     92        (WebCore::FrameView::scrollToAnchor):
     93        * plugins/PluginView.cpp:
     94        (WebCore::PluginView::focusPluginElement):
     95        * plugins/efl/PluginViewEfl.cpp:
     96        (WebCore::PluginView::setFocus):
     97        * plugins/mac/PluginViewMac.mm:
     98        (WebCore::PluginView::platformStart):
     99        * rendering/RenderImage.cpp:
     100        (WebCore::RenderImage::paintAreaElementFocusRing):
     101        * rendering/RenderListBox.cpp:
     102        (WebCore::RenderListBox::paintItemForeground):
     103        (WebCore::RenderListBox::paintItemBackground):
     104        * rendering/RenderTextControlSingleLine.cpp:
     105        (WebCore::RenderTextControlSingleLine::capsLockStateMayHaveChanged):
     106        (WebCore::RenderTextControlSingleLine::textShouldBeTruncated):
     107        * rendering/RenderTheme.cpp:
     108        (WebCore::RenderTheme::isFocused):
     109
    11102013-05-28  Sergio Villar Senin  <svillar@igalia.com>
    2111
  • trunk/Source/WebCore/WebCore.exp.in

    r150771 r150796  
    10481048__ZN7WebCore8Document13createElementERKNS_13QualifiedNameEb
    10491049__ZN7WebCore8Document14createTextNodeERKN3WTF6StringE
    1050 __ZN7WebCore8Document14setFocusedNodeEN3WTF10PassRefPtrINS_4NodeEEENS_14FocusDirectionE
     1050__ZN7WebCore8Document17setFocusedElementEN3WTF10PassRefPtrINS_7ElementEEENS_14FocusDirectionE
    10511051__ZN7WebCore8Document16isPageBoxVisibleEi
    10521052__ZN7WebCore8Document16shortcutIconURLsEv
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r150145 r150796  
    163163    // get the focused node in the page
    164164    Document* focusedDocument = page->focusController()->focusedOrMainFrame()->document();
    165     Node* focusedNode = focusedDocument->focusedNode();
    166     if (!focusedNode)
    167         focusedNode = focusedDocument;
    168 
    169     if (focusedNode->hasTagName(areaTag))
    170         return focusedImageMapUIElement(static_cast<HTMLAreaElement*>(focusedNode));
    171    
    172     AccessibilityObject* obj = focusedNode->document()->axObjectCache()->getOrCreate(focusedNode);
     165    Element* focusedElement = focusedDocument->focusedElement();
     166    if (focusedElement && focusedElement->hasTagName(areaTag))
     167        return focusedImageMapUIElement(static_cast<HTMLAreaElement*>(focusedElement));
     168
     169    AccessibilityObject* obj = focusedDocument->axObjectCache()->getOrCreate(focusedElement ? static_cast<Node*>(focusedElement) : focusedDocument);
    173170    if (!obj)
    174171        return 0;
  • trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp

    r150715 r150796  
    17821782        return true;
    17831783   
    1784     // NOTE: It would be more accurate to ask the document whether setFocusedNode() would
    1785     // do anything. For example, setFocusedNode() will do nothing if the current focused
     1784    // NOTE: It would be more accurate to ask the document whether setFocusedElement() would
     1785    // do anything. For example, setFocusedElement() will do nothing if the current focused
    17861786    // node will not relinquish the focus.
    17871787    if (!node)
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r150716 r150796  
    15771577        return false;
    15781578   
    1579     Node* focusedNode = document->focusedNode();
    1580     if (!focusedNode)
     1579    Element* focusedElement = document->focusedElement();
     1580    if (!focusedElement)
    15811581        return false;
    15821582   
    15831583    // A web area is represented by the Document node in the DOM tree, which isn't focusable.
    15841584    // Check instead if the frame's selection controller is focused
    1585     if (focusedNode == m_renderer->node()
     1585    if (focusedElement == m_renderer->node()
    15861586        || (roleValue() == WebAreaRole && document->frame()->selection()->isFocusedAndActive()))
    15871587        return true;
     
    15961596   
    15971597    Document* document = this->document();
    1598     if (!on)
    1599         document->setFocusedNode(0);
    1600     else {
    1601         Node* node = this->node();
    1602         if (node && node->isElementNode()) {
    1603             // If this node is already the currently focused node, then calling focus() won't do anything.
    1604             // That is a problem when focus is removed from the webpage to chrome, and then returns.
    1605             // In these cases, we need to do what keyboard and mouse focus do, which is reset focus first.
    1606             if (document->focusedNode() == node)
    1607                 document->setFocusedNode(0);
    1608            
    1609             toElement(node)->focus();
    1610         } else
    1611             document->setFocusedNode(node);
    1612     }
     1598    Node* node = this->node();
     1599
     1600    if (!on || !node || !node->isElementNode()) {
     1601        document->setFocusedElement(0);
     1602        return;
     1603    }
     1604
     1605    // If this node is already the currently focused node, then calling focus() won't do anything.
     1606    // That is a problem when focus is removed from the webpage to chrome, and then returns.
     1607    // In these cases, we need to do what keyboard and mouse focus do, which is reset focus first.
     1608    if (document->focusedElement() == node)
     1609        document->setFocusedElement(0);
     1610
     1611    toElement(node)->focus();
    16131612}
    16141613
     
    23312330        return;
    23322331    Document* doc = renderer()->document();
    2333     if (!doc->frame()->selection()->isFocusedAndActive() || doc->focusedNode() != element)
     2332    if (!doc->frame()->selection()->isFocusedAndActive() || doc->focusedElement() != element)
    23342333        return;
    23352334    AccessibilityRenderObject* activedescendant = static_cast<AccessibilityRenderObject*>(activeDescendant());
  • trunk/Source/WebCore/bindings/objc/DOM.mm

    r148545 r150796  
    406406    // FIXME: Could we move this function to WebCore::Element and autogenerate?
    407407    WebCore::Element* element = core(self);
    408     return element->document()->focusedNode() == element;
     408    return element->document()->focusedElement() == element;
    409409}
    410410
  • trunk/Source/WebCore/dom/Document.cpp

    r150752 r150796  
    661661    // these extra pointers or we will create a reference cycle.
    662662    m_docType = 0;
    663     m_focusedNode = 0;
     663    m_focusedElement = 0;
    664664    m_hoveredElement = 0;
    665665    m_activeElement = 0;
     
    21052105
    21062106    m_hoveredElement = 0;
    2107     m_focusedNode = 0;
     2107    m_focusedElement = 0;
    21082108    m_activeElement = 0;
    21092109
     
    32573257void Document::focusedNodeRemoved()
    32583258{
    3259     setFocusedNode(0);
     3259    setFocusedElement(0);
    32603260}
    32613261
    32623262void Document::removeFocusedNodeOfSubtree(Node* node, bool amongChildrenOnly)
    32633263{
    3264     if (!m_focusedNode || this->inPageCache()) // If the document is in the page cache, then we don't need to clear out the focused node.
     3264    if (!m_focusedElement || this->inPageCache()) // If the document is in the page cache, then we don't need to clear out the focused node.
    32653265        return;
    32663266
     
    33143314#endif
    33153315
    3316 bool Document::setFocusedNode(PassRefPtr<Node> prpNewFocusedNode, FocusDirection direction)
    3317 {
    3318     RefPtr<Node> newFocusedNode = prpNewFocusedNode;
    3319 
    3320     // Make sure newFocusedNode is actually in this document
    3321     if (newFocusedNode && (newFocusedNode->document() != this))
     3316bool Document::setFocusedElement(PassRefPtr<Element> prpNewFocusedElement, FocusDirection direction)
     3317{
     3318    RefPtr<Element> newFocusedElement = prpNewFocusedElement;
     3319
     3320    // Make sure newFocusedElement is actually in this document
     3321    if (newFocusedElement && (newFocusedElement->document() != this))
    33223322        return true;
    33233323
    3324     if (m_focusedNode == newFocusedNode)
     3324    if (m_focusedElement == newFocusedElement)
    33253325        return true;
    33263326
     
    33293329
    33303330    bool focusChangeBlocked = false;
    3331     RefPtr<Node> oldFocusedNode = m_focusedNode;
    3332     m_focusedNode = 0;
     3331    RefPtr<Element> oldFocusedElement = m_focusedElement.release();
    33333332
    33343333    // Remove focus from the existing focus node (if any)
    3335     if (oldFocusedNode) {
    3336         ASSERT(!oldFocusedNode->inDetach());
    3337 
    3338         if (oldFocusedNode->isElementNode()) {
    3339             Element* oldFocusedElement = toElement(oldFocusedNode.get());
    3340             if (oldFocusedElement->active())
    3341                 oldFocusedElement->setActive(false);
    3342 
    3343             toElement(oldFocusedNode.get())->setFocus(false);
    3344         }
     3334    if (oldFocusedElement) {
     3335        ASSERT(!oldFocusedElement->inDetach());
     3336
     3337        if (oldFocusedElement->active())
     3338            oldFocusedElement->setActive(false);
     3339
     3340        oldFocusedElement->setFocus(false);
    33453341
    33463342        // Dispatch a change event for form control elements that have been edited.
    3347         if (oldFocusedNode->isElementNode() && toElement(oldFocusedNode.get())->isFormControlElement()) {
    3348             HTMLFormControlElement* formControlElement = toHTMLFormControlElement(oldFocusedNode.get());
     3343        if (oldFocusedElement->isFormControlElement()) {
     3344            HTMLFormControlElement* formControlElement = toHTMLFormControlElement(oldFocusedElement.get());
    33493345            if (formControlElement->wasChangedSinceLastFormControlChangeEvent())
    33503346                formControlElement->dispatchFormControlChangeEvent();
     
    33523348
    33533349        // Dispatch the blur event and let the node do any other blur related activities (important for text fields)
    3354         oldFocusedNode->dispatchBlurEvent(newFocusedNode);
    3355 
    3356         if (m_focusedNode) {
     3350        oldFocusedElement->dispatchBlurEvent(newFocusedElement);
     3351
     3352        if (m_focusedElement) {
    33573353            // handler shifted focus
    33583354            focusChangeBlocked = true;
    3359             newFocusedNode = 0;
     3355            newFocusedElement = 0;
    33603356        }
    33613357       
    3362         oldFocusedNode->dispatchFocusOutEvent(eventNames().focusoutEvent, newFocusedNode); // DOM level 3 name for the bubbling blur event.
     3358        oldFocusedElement->dispatchFocusOutEvent(eventNames().focusoutEvent, newFocusedElement); // DOM level 3 name for the bubbling blur event.
    33633359        // FIXME: We should remove firing DOMFocusOutEvent event when we are sure no content depends
    33643360        // on it, probably when <rdar://problem/8503958> is resolved.
    3365         oldFocusedNode->dispatchFocusOutEvent(eventNames().DOMFocusOutEvent, newFocusedNode); // DOM level 2 name for compatibility.
    3366 
    3367         if (m_focusedNode) {
     3361        oldFocusedElement->dispatchFocusOutEvent(eventNames().DOMFocusOutEvent, newFocusedElement); // DOM level 2 name for compatibility.
     3362
     3363        if (m_focusedElement) {
    33683364            // handler shifted focus
    33693365            focusChangeBlocked = true;
    3370             newFocusedNode = 0;
     3366            newFocusedElement = 0;
    33713367        }
    3372         if (oldFocusedNode == this && oldFocusedNode->hasOneRef())
    3373             return true;
    33743368           
    3375         if (oldFocusedNode->isRootEditableElement())
     3369        if (oldFocusedElement->isRootEditableElement())
    33763370            frame()->editor().didEndEditing();
    33773371
    33783372        if (view()) {
    3379             Widget* oldWidget = widgetForNode(oldFocusedNode.get());
     3373            Widget* oldWidget = widgetForNode(oldFocusedElement.get());
    33803374            if (oldWidget)
    33813375                oldWidget->setFocus(false);
     
    33853379    }
    33863380
    3387     if (newFocusedNode && newFocusedNode->isElementNode() && toElement(newFocusedNode.get())->isFocusable()) {
    3388         if (newFocusedNode->isRootEditableElement() && !acceptsEditingFocus(newFocusedNode.get())) {
     3381    if (newFocusedElement && newFocusedElement->isFocusable()) {
     3382        if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(newFocusedElement.get())) {
    33893383            // delegate blocks focus change
    33903384            focusChangeBlocked = true;
     
    33923386        }
    33933387        // Set focus on the new node
    3394         m_focusedNode = newFocusedNode;
     3388        m_focusedElement = newFocusedElement;
    33953389
    33963390        // Dispatch the focus event and let the node do any other focus related activities (important for text fields)
    3397         m_focusedNode->dispatchFocusEvent(oldFocusedNode, direction);
    3398 
    3399         if (m_focusedNode != newFocusedNode) {
     3391        m_focusedElement->dispatchFocusEvent(oldFocusedElement, direction);
     3392
     3393        if (m_focusedElement != newFocusedElement) {
    34003394            // handler shifted focus
    34013395            focusChangeBlocked = true;
     
    34033397        }
    34043398
    3405         m_focusedNode->dispatchFocusInEvent(eventNames().focusinEvent, oldFocusedNode); // DOM level 3 bubbling focus event.
    3406 
    3407         if (m_focusedNode != newFocusedNode) {
     3399        m_focusedElement->dispatchFocusInEvent(eventNames().focusinEvent, oldFocusedElement); // DOM level 3 bubbling focus event.
     3400
     3401        if (m_focusedElement != newFocusedElement) {
    34083402            // handler shifted focus
    34093403            focusChangeBlocked = true;
     
    34133407        // FIXME: We should remove firing DOMFocusInEvent event when we are sure no content depends
    34143408        // on it, probably when <rdar://problem/8503958> is m.
    3415         m_focusedNode->dispatchFocusInEvent(eventNames().DOMFocusInEvent, oldFocusedNode); // DOM level 2 for compatibility.
    3416 
    3417         if (m_focusedNode != newFocusedNode) {
     3409        m_focusedElement->dispatchFocusInEvent(eventNames().DOMFocusInEvent, oldFocusedElement); // DOM level 2 for compatibility.
     3410
     3411        if (m_focusedElement != newFocusedElement) {
    34183412            // handler shifted focus
    34193413            focusChangeBlocked = true;
     
    34213415        }
    34223416
    3423         if (m_focusedNode->isElementNode())
    3424             toElement(m_focusedNode.get())->setFocus(true);
    3425 
    3426         if (m_focusedNode->isRootEditableElement())
     3417        m_focusedElement->setFocus(true);
     3418
     3419        if (m_focusedElement->isRootEditableElement())
    34273420            frame()->editor().didBeginEditing();
    34283421
     
    34303423        // ### find a better place in the code for this
    34313424        if (view()) {
    3432             Widget* focusWidget = widgetForNode(m_focusedNode.get());
     3425            Widget* focusWidget = widgetForNode(m_focusedElement.get());
    34333426            if (focusWidget) {
    34343427                // Make sure a widget has the right size before giving it focus.
     
    34373430                updateLayout();
    34383431                // Re-get the widget in case updating the layout changed things.
    3439                 focusWidget = widgetForNode(m_focusedNode.get());
     3432                focusWidget = widgetForNode(m_focusedElement.get());
    34403433            }
    34413434            if (focusWidget)
     
    34463439    }
    34473440
    3448     if (!focusChangeBlocked && m_focusedNode) {
     3441    if (!focusChangeBlocked && m_focusedElement) {
    34493442        // Create the AXObject cache in a focus change because GTK relies on it.
    34503443        if (AXObjectCache* cache = axObjectCache())
    3451             cache->handleFocusedUIElementChanged(oldFocusedNode.get(), newFocusedNode.get());
     3444            cache->handleFocusedUIElementChanged(oldFocusedElement.get(), newFocusedElement.get());
    34523445    }
    34533446
    34543447    if (!focusChangeBlocked)
    3455         page()->chrome().focusedNodeChanged(m_focusedNode.get());
     3448        page()->chrome().focusedNodeChanged(m_focusedElement.get());
    34563449
    34573450SetFocusedNodeDone:
     
    47044697void Document::updateFocusAppearanceTimerFired(Timer<Document>*)
    47054698{
    4706     Node* node = focusedNode();
    4707     if (!node)
    4708         return;
    4709     if (!node->isElementNode())
     4699    Element* element = focusedElement();
     4700    if (!element)
    47104701        return;
    47114702
    47124703    updateLayout();
    4713 
    4714     Element* element = toElement(node);
    47154704    if (element->isFocusable())
    47164705        element->updateFocusAppearance(m_updateFocusAppearanceRestoresSelection);
     
    57675756    if (!doc)
    57685757        return 0;
    5769     Node* node = doc->focusedNode();
     5758    Node* node = doc->focusedElement();
    57705759    if (!node && doc->isPluginDocument()) {
    57715760        PluginDocument* pluginDocument = toPluginDocument(doc);
  • trunk/Source/WebCore/dom/Document.h

    r150752 r150796  
    671671    void setSelectedStylesheetSet(const String&);
    672672
    673     bool setFocusedNode(PassRefPtr<Node>, FocusDirection = FocusDirectionNone);
    674     Node* focusedNode() const { return m_focusedNode.get(); }
     673    bool setFocusedElement(PassRefPtr<Element>, FocusDirection = FocusDirectionNone);
     674    Element* focusedElement() const { return m_focusedElement.get(); }
    675675    UserActionElementSet& userActionElements()  { return m_userActionElements; }
    676676    const UserActionElementSet& userActionElements() const { return m_userActionElements; }
     
    13461346    Color m_textColor;
    13471347
    1348     RefPtr<Node> m_focusedNode;
     1348    RefPtr<Element> m_focusedElement;
    13491349    RefPtr<Element> m_hoveredElement;
    13501350    RefPtr<Element> m_activeElement;
  • trunk/Source/WebCore/dom/Element.cpp

    r150752 r150796  
    14441444        ElementRareData* data = elementRareData();
    14451445        if (data->needsFocusAppearanceUpdateSoonAfterAttach()) {
    1446             if (isFocusable() && document()->focusedNode() == this)
     1446            if (isFocusable() && document()->focusedElement() == this)
    14471447                document()->updateFocusAppearanceSoon(false /* don't restore selection */);
    14481448            data->setNeedsFocusAppearanceUpdateSoonAfterAttach(false);
     
    20882088
    20892089    Document* doc = document();
    2090     if (doc->focusedNode() == this)
     2090    if (doc->focusedElement() == this)
    20912091        return;
    20922092
     
    21552155            doc->frame()->page()->focusController()->setFocusedElement(0, doc->frame());
    21562156        else
    2157             doc->setFocusedNode(0);
     2157            doc->setFocusedElement(0);
    21582158    }
    21592159}
     
    24082408    if (hasRareData())
    24092409        elementRareData()->setNeedsFocusAppearanceUpdateSoonAfterAttach(false);
    2410     if (document()->focusedNode() == this)
     2410    if (document()->focusedElement() == this)
    24112411        document()->cancelFocusAppearanceUpdate();
    24122412}
  • trunk/Source/WebCore/dom/Node.cpp

    r150783 r150796  
    686686    // Ideally we'd call ASSERT(!needsStyleRecalc()) here, but
    687687    // ContainerNode::setFocus() calls setNeedsStyleRecalc(), so the assertion
    688     // would fire in the middle of Document::setFocusedNode().
     688    // would fire in the middle of Document::setFocusedElement().
    689689
    690690    for (const Node* node = this; node; node = node->parentNode()) {
  • trunk/Source/WebCore/dom/TreeScope.cpp

    r150733 r150796  
    393393{
    394394    Document* document = rootNode()->document();
    395     Node* node = document->focusedNode();
    396 
    397     ASSERT(!node || node->isElementNode());
    398     Element* element = toElement(node);
     395    Element* element = document->focusedElement();
    399396
    400397    if (!element && document->page())
  • trunk/Source/WebCore/dom/UserTypingGestureIndicator.cpp

    r95901 r150796  
    2828
    2929#include "Document.h"
     30#include "Element.h"
    3031#include "Frame.h"
    31 #include "Node.h"
    3232#include <wtf/StdLibExtras.h>
    3333
     
    5656{
    5757    s_processingUserTypingGesture = true;
    58     focusedNode() = frame->document() ? frame->document()->focusedNode() : 0;
     58    focusedNode() = frame->document() ? frame->document()->focusedElement() : 0;
    5959}
    6060
  • trunk/Source/WebCore/editing/Editor.cpp

    r150534 r150796  
    13701370void Editor::setBaseWritingDirection(WritingDirection direction)
    13711371{
    1372     Node* focusedNode = frame()->document()->focusedNode();
    1373     if (focusedNode && isHTMLTextFormControlElement(focusedNode)) {
     1372    Element* focusedElement = frame()->document()->focusedElement();
     1373    if (focusedElement && isHTMLTextFormControlElement(focusedElement)) {
    13741374        if (direction == NaturalWritingDirection)
    13751375            return;
    1376         toHTMLElement(focusedNode)->setAttribute(dirAttr, direction == LeftToRightWritingDirection ? "ltr" : "rtl");
    1377         focusedNode->dispatchInputEvent();
     1376        toHTMLElement(focusedElement)->setAttribute(dirAttr, direction == LeftToRightWritingDirection ? "ltr" : "rtl");
     1377        focusedElement->dispatchInputEvent();
    13781378        frame()->document()->updateStyleIfNeeded();
    13791379        return;
     
    14811481    // We should send this event before sending a TextEvent as written in Section 6.2.2 and 6.2.3 of
    14821482    // the DOM Event specification.
    1483     Node* target = m_frame->document()->focusedNode();
     1483    Element* target = m_frame->document()->focusedElement();
    14841484    if (target) {
    14851485        RefPtr<CompositionEvent> event = CompositionEvent::create(eventNames().compositionendEvent, m_frame->document()->domWindow(), text);
     
    15231523    }
    15241524
    1525     Node* target = m_frame->document()->focusedNode();
     1525    Element* target = m_frame->document()->focusedElement();
    15261526    if (target) {
    15271527        // Dispatch an appropriate composition event to the focused node.
     
    19061906    }
    19071907
    1908     String misspelledWord = behavior().shouldAllowSpellingSuggestionsWithoutSelection() ? misspelledWordAtCaretOrRange(m_frame->document()->focusedNode()) : misspelledSelectionString();
     1908    String misspelledWord = behavior().shouldAllowSpellingSuggestionsWithoutSelection() ? misspelledWordAtCaretOrRange(m_frame->document()->focusedElement()) : misspelledSelectionString();
    19091909    misspelled = !misspelledWord.isEmpty();
    19101910
  • trunk/Source/WebCore/editing/EditorCommand.cpp

    r150214 r150796  
    250250static unsigned verticalScrollDistance(Frame* frame)
    251251{
    252     Node* focusedNode = frame->document()->focusedNode();
    253     if (!focusedNode)
     252    Element* focusedElement = frame->document()->focusedElement();
     253    if (!focusedElement)
    254254        return 0;
    255     RenderObject* renderer = focusedNode->renderer();
     255    RenderObject* renderer = focusedElement->renderer();
    256256    if (!renderer || !renderer->isBox())
    257257        return 0;
     
    259259    if (!style)
    260260        return 0;
    261     if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || focusedNode->rendererIsEditable()))
     261    if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || focusedElement->rendererIsEditable()))
    262262        return 0;
    263263    int height = std::min<int>(toRenderBox(renderer)->clientHeight(), frame->view()->visibleHeight());
  • trunk/Source/WebCore/editing/FrameSelection.cpp

    r150712 r150796  
    16341634    Document* document = m_frame->document();
    16351635
    1636     if (document->focusedNode() && document->focusedNode()->hasTagName(selectTag)) {
    1637         HTMLSelectElement* selectElement = toHTMLSelectElement(document->focusedNode());
     1636    if (document->focusedElement() && document->focusedElement()->hasTagName(selectTag)) {
     1637        HTMLSelectElement* selectElement = toHTMLSelectElement(document->focusedElement());
    16381638        if (selectElement->canSelectAll()) {
    16391639            selectElement->selectAll();
     
    17231723    // RenderTheme::isFocused() check if the frame is active, we have to
    17241724    // update style and theme state that depended on those.
    1725     if (Node* node = m_frame->document()->focusedNode()) {
    1726         node->setNeedsStyleRecalc();
    1727         if (RenderObject* renderer = node->renderer())
     1725    if (Element* element = m_frame->document()->focusedElement()) {
     1726        element->setNeedsStyleRecalc();
     1727        if (RenderObject* renderer = element->renderer())
    17281728            if (renderer && renderer->style()->hasAppearance())
    17291729                renderer->theme()->stateChanged(renderer, FocusState);
     
    19021902            target = target->parentOrShadowHostElement();
    19031903        }
    1904         m_frame->document()->setFocusedNode(0);
     1904        m_frame->document()->setFocusedElement(0);
    19051905    }
    19061906
     
    19881988{
    19891989    // Start looking either at the active (first responder) node, or where the selection is.
    1990     Node* start = m_frame->document()->focusedNode();
     1990    Node* start = m_frame->document()->focusedElement();
    19911991    if (!start)
    19921992        start = this->start().deprecatedNode();
  • trunk/Source/WebCore/history/CachedPage.cpp

    r145826 r150796  
    8585    // FIXME: Right now we don't support pages w/ frames in the b/f cache.  This may need to be tweaked when we add support for that.
    8686    Document* focusedDocument = page->focusController()->focusedOrMainFrame()->document();
    87     if (Node* node = focusedDocument->focusedNode()) {
    88         if (node->isElementNode())
    89             toElement(node)->updateFocusAppearance(true);
    90     }
     87    if (Element* element = focusedDocument->focusedElement())
     88        element->updateFocusAppearance(true);
    9189
    9290    if (m_needStyleRecalcForVisitedLinks) {
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r150683 r150796  
    538538    if (wasAttached) {
    539539        attach();
    540         if (document()->focusedNode() == this)
     540        if (document()->focusedElement() == this)
    541541            updateFocusAppearance(true);
    542542    }
     
    814814    m_inputType->attach();
    815815
    816     if (document()->focusedNode() == this)
     816    if (document()->focusedElement() == this)
    817817        document()->updateFocusAppearanceSoon(true /* restore selection */);
    818818}
  • trunk/Source/WebCore/html/HTMLTextAreaElement.cpp

    r150140 r150796  
    390390
    391391    // Set the caret to the end of the text value.
    392     if (document()->focusedNode() == this) {
     392    if (document()->focusedElement() == this) {
    393393        unsigned endOfString = m_value.length();
    394394        setSelectionRange(endOfString, endOfString);
  • trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp

    r148921 r150796  
    154154        && isEmptySuggestedValue()
    155155        && !isPlaceholderEmpty()
    156         && (document()->focusedNode() != this || (renderer() && renderer()->theme()->shouldShowPlaceholderWhenFocused()))
     156        && (document()->focusedElement() != this || (renderer() && renderer()->theme()->shouldShowPlaceholderWhenFocused()))
    157157        && (!renderer() || renderer()->style()->visibility() == VISIBLE);
    158158}
     
    363363    if (!isTextFormControl())
    364364        return 0;
    365     if (document()->focusedNode() != this && hasCachedSelection())
     365    if (document()->focusedElement() != this && hasCachedSelection())
    366366        return m_cachedSelectionStart;
    367367
     
    383383    if (!isTextFormControl())
    384384        return 0;
    385     if (document()->focusedNode() != this && hasCachedSelection())
     385    if (document()->focusedElement() != this && hasCachedSelection())
    386386        return m_cachedSelectionEnd;
    387387    return computeSelectionEnd();
     
    421421    if (!isTextFormControl())
    422422        return directionString(SelectionHasNoDirection);
    423     if (document()->focusedNode() != this && hasCachedSelection())
     423    if (document()->focusedElement() != this && hasCachedSelection())
    424424        return directionString(m_cachedSelectionDirection);
    425425
  • trunk/Source/WebCore/html/RadioInputType.cpp

    r137221 r150796  
    9797            break;
    9898        if (inputElement->isRadioButton() && inputElement->name() == element()->name() && inputElement->isFocusable()) {
    99             document->setFocusedNode(inputElement);
     99            document->setFocusedElement(inputElement);
    100100            inputElement->dispatchSimulatedClick(event, SendNoEvents, DoNotShowPressedLook);
    101101            event->setDefaultHandled();
     
    128128    // Never allow keyboard tabbing to leave you in the same radio group.  Always
    129129    // skip any other elements in the group.
    130     Node* currentFocusedNode = element()->document()->focusedNode();
     130    Element* currentFocusedNode = element()->document()->focusedElement();
    131131    if (currentFocusedNode && currentFocusedNode->hasTagName(inputTag)) {
    132132        HTMLInputElement* focusedInput = static_cast<HTMLInputElement*>(currentFocusedNode);
  • trunk/Source/WebCore/html/shadow/DateTimeEditElement.cpp

    r149392 r150796  
    578578size_t DateTimeEditElement::focusedFieldIndex() const
    579579{
    580     Node* const focusedFieldNode = document()->focusedNode();
     580    Node* const focusedFieldNode = document()->focusedElement();
    581581    for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) {
    582582        if (m_fields[fieldIndex] == focusedFieldNode)
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r150695 r150796  
    395395        if (m_frame->document()) {
    396396            if (m_didCallImplicitClose && !m_wasUnloadEventEmitted) {
    397                 Node* currentFocusedNode = m_frame->document()->focusedNode();
    398                 if (currentFocusedNode && currentFocusedNode->toInputElement())
    399                     currentFocusedNode->toInputElement()->endEditing();
     397                Element* currentFocusedElement = m_frame->document()->focusedElement();
     398                if (currentFocusedElement && currentFocusedElement->toInputElement())
     399                    currentFocusedElement->toInputElement()->endEditing();
    400400                if (m_pageDismissalEventBeingDispatched == NoDismissal) {
    401401                    if (unloadEventPolicy == UnloadEventPolicyUnloadAndPageHide) {
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r150490 r150796  
    945945    Frame* focusedFrame = page->focusController()->focusedFrame();
    946946    if (focusedFrame && focusedFrame != m_frame)
    947         focusedFrame->document()->setFocusedNode(0);
     947        focusedFrame->document()->setFocusedElement(0);
    948948
    949949    m_frame->eventHandler()->focusDocumentView();
  • trunk/Source/WebCore/page/EventHandler.cpp

    r150712 r150796  
    10851085
    10861086    if (!node)
    1087         node = m_frame->document()->focusedNode();
     1087        node = m_frame->document()->focusedElement();
    10881088
    10891089    if (!node)
     
    11061106
    11071107    if (!node)
    1108         node = m_frame->document()->focusedNode();
     1108        node = m_frame->document()->focusedElement();
    11091109
    11101110    if (!node)
     
    23472347                if (m_frame->selection()->isRange()
    23482348                    && m_frame->selection()->toNormalizedRange()->compareNode(element, IGNORE_EXCEPTION) == Range::NODE_INSIDE
    2349                     && element->isDescendantOf(m_frame->document()->focusedNode()))
     2349                    && element->isDescendantOf(m_frame->document()->focusedElement()))
    23502350                    return true;
    23512351                   
     
    29462946    IntPoint location;
    29472947
    2948     Node* focusedNode = doc->focusedNode();
     2948    Element* focusedElement = doc->focusedElement();
    29492949    FrameSelection* selection = m_frame->selection();
    29502950    Position start = selection->selection().start();
     
    29582958        int y = firstRect.maxY() ? firstRect.maxY() - 1 : 0;
    29592959        location = IntPoint(x, y);
    2960     } else if (focusedNode) {
    2961         RenderBoxModelObject* box = focusedNode->renderBoxModelObject();
     2960    } else if (focusedElement) {
     2961        RenderBoxModelObject* box = focusedElement->renderBoxModelObject();
    29622962        if (!box)
    29632963            return false;
     
    29752975    IntPoint globalPosition = view->hostWindow()->rootViewToScreen(IntRect(position, IntSize())).location();
    29762976
    2977     Node* targetNode = doc->focusedNode();
     2977    Node* targetNode = doc->focusedElement();
    29782978    if (!targetNode)
    29792979        targetNode = doc;
     
    37763776{
    37773777    Document* d = m_frame->document();
    3778     if (Node* node = d->focusedNode()) {
    3779         if (RenderObject* r = node->renderer()) {
     3778    if (Element* element = d->focusedElement()) {
     3779        if (RenderObject* r = element->renderer()) {
    37803780            if (r->isTextField())
    37813781                toRenderTextControlSingleLine(r)->capsLockStateMayHaveChanged();
  • trunk/Source/WebCore/page/FocusController.cpp

    r150713 r150796  
    123123    }
    124124
    125     if (!focused && document->focusedNode())
    126         document->focusedNode()->dispatchBlurEvent(0);
     125    if (!focused && document->focusedElement())
     126        document->focusedElement()->dispatchBlurEvent(0);
    127127    document->dispatchWindowEvent(Event::create(focused ? eventNames().focusEvent : eventNames().blurEvent, false, false));
    128     if (focused && document->focusedNode())
    129         document->focusedNode()->dispatchFocusEvent(0, FocusDirectionNone);
     128    if (focused && document->focusedElement())
     129        document->focusedElement()->dispatchFocusEvent(0, FocusDirectionNone);
    130130}
    131131
     
    285285    Document* document = frame->document();
    286286
    287     Node* currentNode = document->focusedNode();
     287    Node* currentNode = document->focusedElement();
    288288    // FIXME: Not quite correct when it comes to focus transitions leaving/entering the WebView itself
    289289    bool caretBrowsing = frame->settings() && frame->settings()->caretBrowsingEnabled();
     
    299299        // We didn't find a node to focus, so we should try to pass focus to Chrome.
    300300        if (!initialFocus && m_page->chrome().canTakeFocus(direction)) {
    301             document->setFocusedNode(0);
     301            document->setFocusedElement(0);
    302302            setFocusedFrame(0);
    303303            m_page->chrome().takeFocus(direction);
     
    315315    ASSERT(node);
    316316
    317     if (node == document->focusedNode())
     317    if (node == document->focusedElement())
    318318        // Focus wrapped around to the same node.
    319319        return true;
     
    332332            return false;
    333333
    334         document->setFocusedNode(0);
     334        document->setFocusedElement(0);
    335335        setFocusedFrame(owner->contentFrame());
    336336        return true;
    337337    }
    338338   
    339     // FIXME: It would be nice to just be able to call setFocusedNode(node) here, but we can't do
     339    // FIXME: It would be nice to just be able to call setFocusedElement(node) here, but we can't do
    340340    // that because some elements (e.g. HTMLInputElement and HTMLTextAreaElement) do extra work in
    341341    // their focus() methods.
     
    345345    if (newDocument != document)
    346346        // Focus is going away from this document, so clear the focused node.
    347         document->setFocusedNode(0);
     347        document->setFocusedElement(0);
    348348
    349349    if (newDocument)
     
    596596    RefPtr<Document> oldDocument = oldFocusedFrame ? oldFocusedFrame->document() : 0;
    597597   
    598     Node* oldFocusedNode = oldDocument ? oldDocument->focusedNode() : 0;
    599     if (oldFocusedNode == element)
     598    Element* oldFocusedElement = oldDocument ? oldDocument->focusedElement() : 0;
     599    if (oldFocusedElement == element)
    600600        return true;
    601601
    602602    // FIXME: Might want to disable this check for caretBrowsing
    603     if (oldFocusedNode && oldFocusedNode->isRootEditableElement() && !relinquishesEditingFocus(oldFocusedNode))
     603    if (oldFocusedElement && oldFocusedElement->isRootEditableElement() && !relinquishesEditingFocus(oldFocusedElement))
    604604        return false;
    605605
     
    610610    if (!element) {
    611611        if (oldDocument)
    612             oldDocument->setFocusedNode(0);
     612            oldDocument->setFocusedElement(0);
    613613        m_page->editorClient()->setInputMethodState(false);
    614614        return true;
     
    617617    RefPtr<Document> newDocument = element->document();
    618618
    619     if (newDocument && newDocument->focusedNode() == element) {
     619    if (newDocument && newDocument->focusedElement() == element) {
    620620        m_page->editorClient()->setInputMethodState(element->shouldUseInputMethod());
    621621        return true;
     
    623623   
    624624    if (oldDocument && oldDocument != newDocument)
    625         oldDocument->setFocusedNode(0);
     625        oldDocument->setFocusedElement(0);
    626626
    627627    if (newFocusedFrame && !newFocusedFrame->page()) {
     
    633633    RefPtr<Element> protect(element);
    634634    if (newDocument) {
    635         bool successfullyFocused = newDocument->setFocusedNode(element, direction);
     635        bool successfullyFocused = newDocument->setFocusedElement(element, direction);
    636636        if (!successfullyFocused)
    637637            return false;
    638638    }
    639639
    640     if (newDocument->focusedNode() == element)
     640    if (newDocument->focusedElement() == element)
    641641        m_page->editorClient()->setInputMethodState(element->shouldUseInputMethod());
    642642
     
    755755{
    756756    ASSERT(container);
    757     Node* focusedNode = (focusedFrame() && focusedFrame()->document()) ? focusedFrame()->document()->focusedNode() : 0;
     757    Node* focusedNode = (focusedFrame() && focusedFrame()->document()) ? focusedFrame()->document()->focusedElement() : 0;
    758758
    759759    Element* element = ElementTraversal::firstWithin(container);
     
    814814        // Navigate into a new frame.
    815815        LayoutRect rect;
    816         Node* focusedNode = focusedOrMainFrame()->document()->focusedNode();
    817         if (focusedNode && !hasOffscreenRect(focusedNode))
    818             rect = nodeRectInAbsoluteCoordinates(focusedNode, true /* ignore border */);
     816        Element* focusedElement = focusedOrMainFrame()->document()->focusedElement();
     817        if (focusedElement && !hasOffscreenRect(focusedElement))
     818            rect = nodeRectInAbsoluteCoordinates(focusedElement, true /* ignore border */);
    819819        frameElement->contentFrame()->document()->updateLayoutIgnorePendingStylesheets();
    820820        if (!advanceFocusDirectionallyInContainer(frameElement->contentFrame()->document(), rect, direction, event)) {
     
    832832        // Navigate into a new scrollable container.
    833833        LayoutRect startingRect;
    834         Node* focusedNode = focusedOrMainFrame()->document()->focusedNode();
    835         if (focusedNode && !hasOffscreenRect(focusedNode))
    836             startingRect = nodeRectInAbsoluteCoordinates(focusedNode, true);
     834        Element* focusedElement = focusedOrMainFrame()->document()->focusedElement();
     835        if (focusedElement && !hasOffscreenRect(focusedElement))
     836            startingRect = nodeRectInAbsoluteCoordinates(focusedElement, true);
    837837        return advanceFocusDirectionallyInContainer(focusCandidate.visibleNode, startingRect, direction, event);
    838838    }
     
    860860        return false;
    861861
    862     Node* focusedNode = focusedDocument->focusedNode();
     862    Element* focusedElement = focusedDocument->focusedElement();
    863863    Node* container = focusedDocument;
    864864
     
    868868    // Figure out the starting rect.
    869869    LayoutRect startingRect;
    870     if (focusedNode) {
    871         if (!hasOffscreenRect(focusedNode)) {
    872             container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(direction, focusedNode);
    873             startingRect = nodeRectInAbsoluteCoordinates(focusedNode, true /* ignore border */);
    874         } else if (focusedNode->hasTagName(areaTag)) {
    875             HTMLAreaElement* area = static_cast<HTMLAreaElement*>(focusedNode);
     870    if (focusedElement) {
     871        if (!hasOffscreenRect(focusedElement)) {
     872            container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(direction, focusedElement);
     873            startingRect = nodeRectInAbsoluteCoordinates(focusedElement, true /* ignore border */);
     874        } else if (focusedElement->hasTagName(areaTag)) {
     875            HTMLAreaElement* area = static_cast<HTMLAreaElement*>(focusedElement);
    876876            container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(direction, area->imageElement());
    877877            startingRect = virtualRectForAreaElementAndDirection(area, direction);
  • trunk/Source/WebCore/page/FrameView.cpp

    r150768 r150796  
    18661866    // If the anchor accepts keyboard focus, move focus there to aid users relying on keyboard navigation.
    18671867    if (anchorElement && anchorElement->isFocusable())
    1868         m_frame->document()->setFocusedNode(anchorElement);
     1868        m_frame->document()->setFocusedElement(anchorElement);
    18691869   
    18701870    return true;
  • trunk/Source/WebCore/plugins/PluginView.cpp

    r150712 r150796  
    888888void PluginView::focusPluginElement()
    889889{
    890     // Focus the plugin
    891890    if (Page* page = m_parentFrame->page())
    892891        page->focusController()->setFocusedElement(m_element, m_parentFrame);
    893892    else
    894         m_parentFrame->document()->setFocusedNode(m_element);
     893        m_parentFrame->document()->setFocusedElement(m_element);
    895894}
    896895
  • trunk/Source/WebCore/plugins/efl/PluginViewEfl.cpp

    r148696 r150796  
    126126{
    127127    if (focused)
    128         m_element->document()->setFocusedNode(m_element);
     128        m_element->document()->setFocusedElement(m_element);
    129129
    130130    Widget::setFocus(focused);
  • trunk/Source/WebCore/plugins/mac/PluginViewMac.mm

    r149716 r150796  
    709709            if (Page* page = m_parentFrame->page())
    710710                page->focusController()->setFocusedFrame(m_parentFrame);
    711             m_parentFrame->document()->setFocusedNode(m_element);
     711            m_parentFrame->document()->setFocusedElement(m_element);
    712712        } else if (event->type() == eventNames().mouseupEvent) {
    713713            record.what = mouseUp;
     
    753753                if (Page* page = m_parentFrame->page())
    754754                    page->focusController()->setFocusedFrame(m_parentFrame);
    755                 m_parentFrame->document()->setFocusedNode(m_element);
     755                m_parentFrame->document()->setFocusedElement(m_element);
    756756                break;
    757757               
  • trunk/Source/WebCore/rendering/RenderImage.cpp

    r149980 r150796  
    425425        return;
    426426
    427     Node* focusedNode = document->focusedNode();
    428     if (!focusedNode || !focusedNode->hasTagName(areaTag))
    429         return;
    430 
    431     HTMLAreaElement* areaElement = static_cast<HTMLAreaElement*>(focusedNode);
     427    Element* focusedElement = document->focusedElement();
     428    if (!focusedElement || !focusedElement->hasTagName(areaTag))
     429        return;
     430
     431    HTMLAreaElement* areaElement = static_cast<HTMLAreaElement*>(focusedElement);
    432432    if (areaElement->imageElement() != node())
    433433        return;
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r150399 r150796  
    413413    Color textColor = element->renderStyle() ? element->renderStyle()->visitedDependentColor(CSSPropertyColor) : style()->visitedDependentColor(CSSPropertyColor);
    414414    if (isOptionElement && toHTMLOptionElement(element)->selected()) {
    415         if (frame()->selection()->isFocusedAndActive() && document()->focusedNode() == node())
     415        if (frame()->selection()->isFocusedAndActive() && document()->focusedElement() == node())
    416416            textColor = theme()->activeListBoxSelectionForegroundColor();
    417417        // Honor the foreground color for disabled items
     
    446446    Color backColor;
    447447    if (element->hasTagName(optionTag) && toHTMLOptionElement(element)->selected()) {
    448         if (frame()->selection()->isFocusedAndActive() && document()->focusedNode() == node())
     448        if (frame()->selection()->isFocusedAndActive() && document()->focusedElement() == node())
    449449            backColor = theme()->activeListBoxSelectionBackgroundColor();
    450450        else
  • trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp

    r150716 r150796  
    277277        shouldDrawCapsLockIndicator = inputElement()->isPasswordField()
    278278                                      && frame->selection()->isFocusedAndActive()
    279                                       && document()->focusedNode() == node()
     279                                      && document()->focusedElement() == node()
    280280                                      && PlatformKeyboardEvent::currentCapsLockState();
    281281
     
    404404bool RenderTextControlSingleLine::textShouldBeTruncated() const
    405405{
    406     return document()->focusedNode() != node()
     406    return document()->focusedElement() != node()
    407407        && style()->textOverflow() == TextOverflowEllipsis;
    408408}
  • trunk/Source/WebCore/rendering/RenderTheme.cpp

    r150715 r150796  
    801801    Document* document = focusDelegate->document();
    802802    Frame* frame = document->frame();
    803     return focusDelegate == document->focusedNode() && frame && frame->selection()->isFocusedAndActive();
     803    return focusDelegate == document->focusedElement() && frame && frame->selection()->isFocusedAndActive();
    804804}
    805805
  • trunk/Source/WebKit/blackberry/Api/WebPage.cpp

    r150770 r150796  
    25572557    const Platform::ViewportAccessor* viewportAccessor = m_webkitThreadViewportAccessor;
    25582558
    2559     IntRect focusRect = rectForNode(doc->focusedNode());
    2560     focusRect = adjustRectOffsetForFrameOffset(focusRect, doc->focusedNode());
     2559    IntRect focusRect = rectForNode(doc->focusedElement());
     2560    focusRect = adjustRectOffsetForFrameOffset(focusRect, doc->focusedElement());
    25612561    focusRect = viewportAccessor->roundToPixelFromDocumentContents(WebCore::FloatRect(focusRect));
    25622562    focusRect.intersect(viewportAccessor->pixelContentsRect());
     
    25732573    if (m_webSettings->doesGetFocusNodeContext() && !isTouching) {
    25742574        RefPtr<Node> node;
    2575         node = m_page->focusController()->focusedOrMainFrame()->document()->focusedNode();
     2575        node = m_page->focusController()->focusedOrMainFrame()->document()->focusedElement();
    25762576        if (node) {
    25772577            IntRect visibleRect = IntRect(IntPoint(), actualVisibleSize());
     
    41694169    ASSERT(frame->document());
    41704170
    4171     if (frame->document()->focusedNode())
     4171    if (frame->document()->focusedElement())
    41724172        frame->page()->focusController()->setFocusedElement(0, frame);
    41734173}
     
    49144914                    toElement(nodeImpl)->updateFocusAppearance(true);
    49154915                d->m_inputHandler->didNodeOpenPopup(nodeImpl);
    4916             } else if (doc->focusedNode() == nodeImpl) // && !on
     4916            } else if (doc->focusedElement() == nodeImpl) // && !on
    49174917                page->focusController()->setFocusedElement(0, doc->frame());
    49184918
  • trunk/Source/WebKit/blackberry/ChangeLog

    r150795 r150796  
     12013-05-28  Andreas Kling  <akling@apple.com>
     2
     3        Document::setFocusedNode() should be setFocusedElement().
     4        <http://webkit.org/b/116857>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * Api/WebPage.cpp:
     9        (BlackBerry::WebKit::WebPagePrivate::focusNodeRect):
     10        (BlackBerry::WebKit::WebPagePrivate::contextNode):
     11        (BlackBerry::WebKit::WebPagePrivate::clearFocusNode):
     12        (BlackBerry::WebKit::WebPage::setNodeFocus):
     13        * WebCoreSupport/EditorClientBlackBerry.cpp:
     14        (WebCore::EditorClientBlackBerry::shouldSpellCheckFocusedField):
     15        (WebCore::EditorClientBlackBerry::shouldChangeSelectedRange):
     16        * WebKitSupport/InputHandler.cpp:
     17        (BlackBerry::WebKit::InputHandler::focusedNodeChanged):
     18        * WebKitSupport/SelectionHandler.cpp:
     19        (BlackBerry::WebKit::SelectionHandler::setCaretPosition):
     20        (BlackBerry::WebKit::SelectionHandler::extendSelectionToFieldBoundary):
     21        (BlackBerry::WebKit::SelectionHandler::updateOrHandleInputSelection):
     22        (BlackBerry::WebKit::SelectionHandler::clipPointToVisibleContainer):
     23        (BlackBerry::WebKit::SelectionHandler::inputNodeOverridesTouch):
     24        (BlackBerry::WebKit::SelectionHandler::selectionPositionChanged):
     25
    1262013-05-28  Carlos Garcia Campos  <cgarcia@igalia.com>
    227
  • trunk/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp

    r150140 r150796  
    9797        return false;
    9898
    99     const Node* node = frame->document()->focusedNode();
     99    const Node* node = frame->document()->focusedElement();
    100100    // NOTE: This logic is taken from EditorClientImpl::shouldSpellcheckByDefault
    101101    // If |node| is null, we default to allowing spellchecking. This is done in
     
    191191    Frame* frame = m_webPagePrivate->focusedOrMainFrame();
    192192    if (frame && frame->document()) {
    193         if (Node* focusedNode = frame->document()->focusedNode()) {
    194             if (focusedNode->hasTagName(HTMLNames::selectTag))
     193        if (Element* focusedElement = frame->document()->focusedElement()) {
     194            if (focusedElement->hasTagName(HTMLNames::selectTag))
    195195                return false;
    196             if (focusedNode->isElementNode() && DOMSupport::isPopupInputField(toElement(focusedNode)))
     196            if (DOMSupport::isPopupInputField(focusedElement))
    197197                return false;
    198198        }
  • trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp

    r150779 r150796  
    428428        return;
    429429
    430     Node* node = frame->document()->focusedNode();
     430    Node* node = frame->document()->focusedElement();
    431431
    432432    if (isActiveTextEdit() && m_currentFocusElement == node) {
  • trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp

    r150712 r150796  
    247247void SelectionHandler::setCaretPosition(const WebCore::IntPoint& position)
    248248{
    249     if (!m_webPage->m_inputHandler->isInputMode() || !m_webPage->focusedOrMainFrame()->document()->focusedNode())
     249    if (!m_webPage->m_inputHandler->isInputMode() || !m_webPage->focusedOrMainFrame()->document()->focusedElement())
    250250        return;
    251251
     
    370370{
    371371    Frame* focusedFrame = m_webPage->focusedOrMainFrame();
    372     if (!focusedFrame->document()->focusedNode() || !focusedFrame->document()->focusedNode()->renderer())
     372    if (!focusedFrame->document()->focusedElement() || !focusedFrame->document()->focusedElement()->renderer())
    373373        return 0;
    374374
     
    377377    WebCore::IntRect caretRect = isStartHandle ? activeSelection.visibleStart().absoluteCaretBounds() : activeSelection.visibleEnd().absoluteCaretBounds();
    378378
    379     WebCore::IntRect nodeBoundingBox = focusedFrame->document()->focusedNode()->renderer()->absoluteBoundingBoxRect();
     379    WebCore::IntRect nodeBoundingBox = focusedFrame->document()->focusedElement()->renderer()->absoluteBoundingBoxRect();
    380380    nodeBoundingBox.inflate(-1);
    381381
     
    415415
    416416    Frame* focusedFrame = m_webPage->focusedOrMainFrame();
    417     Node* focusedNode = focusedFrame->document()->focusedNode();
     417    Node* focusedNode = focusedFrame->document()->focusedElement();
    418418    if (!focusedNode || !focusedNode->renderer())
    419419        return false;
     
    10651065
    10661066    if (m_webPage->m_inputHandler->isInputMode()
    1067         && frame->document()->focusedNode()
    1068         && frame->document()->focusedNode()->renderer()) {
    1069             WebCore::IntRect boundingBox(frame->document()->focusedNode()->renderer()->absoluteBoundingBoxRect());
     1067        && frame->document()->focusedElement()
     1068        && frame->document()->focusedElement()->renderer()) {
     1069            WebCore::IntRect boundingBox(frame->document()->focusedElement()->renderer()->absoluteBoundingBoxRect());
    10701070            boundingBox.inflate(-1);
    10711071            clippedPoint = WebCore::IntPoint(clamp(boundingBox.x(), clippedPoint.x(), boundingBox.maxX()), clamp(boundingBox.y(), clippedPoint.y(), boundingBox.maxY()));
     
    11091109        return false;
    11101110
    1111     Node* focusedNode = m_webPage->focusedOrMainFrame()->document()->focusedNode();
     1111    Node* focusedNode = m_webPage->focusedOrMainFrame()->document()->focusedElement();
    11121112    if (!focusedNode || !focusedNode->isElementNode())
    11131113        return false;
     
    11671167        return;
    11681168
    1169     if (Node* focusedNode = frame->document()->focusedNode()) {
     1169    if (Node* focusedNode = frame->document()->focusedElement()) {
    11701170        if (focusedNode->hasTagName(HTMLNames::selectTag) || (focusedNode->isElementNode() && DOMSupport::isPopupInputField(toElement(focusedNode)))) {
    11711171            SelectionLog(Platform::LogLevelInfo, "SelectionHandler::selectionPositionChanged selection is on a popup control, skipping rendering.");
  • trunk/Source/WebKit/efl/ChangeLog

    r150790 r150796  
     12013-05-28  Andreas Kling  <akling@apple.com>
     2
     3        Document::setFocusedNode() should be setFocusedElement().
     4        <http://webkit.org/b/116857>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * ewk/ewk_frame.cpp:
     9        (ewk_frame_focused_element_geometry_get):
     10        * ewk/ewk_view.cpp:
     11        (ewk_view_input_method_state_set):
     12
    1132013-05-28  Ryuan Choi  <ryuan.choi@samsung.com>
    214
  • trunk/Source/WebKit/efl/ewk/ewk_frame.cpp

    r150140 r150796  
    870870    if (!document)
    871871        return false;
    872     WebCore::Node* focusedNode = document->focusedNode();
     872    WebCore::Node* focusedNode = document->focusedElement();
    873873    if (!focusedNode)
    874874        return false;
  • trunk/Source/WebKit/efl/ewk/ewk_view.cpp

    r150663 r150796  
    30623062    if (focusedFrame
    30633063        && focusedFrame->document()
    3064         && focusedFrame->document()->focusedNode()
    3065         && focusedFrame->document()->focusedNode()->hasTagName(WebCore::HTMLNames::inputTag)) {
     3064        && focusedFrame->document()->focusedElement()
     3065        && focusedFrame->document()->focusedElement()->hasTagName(WebCore::HTMLNames::inputTag)) {
    30663066        WebCore::HTMLInputElement* inputElement;
    30673067
    3068         inputElement = static_cast<WebCore::HTMLInputElement*>(focusedFrame->document()->focusedNode());
     3068        inputElement = static_cast<WebCore::HTMLInputElement*>(focusedFrame->document()->focusedElement());
    30693069        if (inputElement) {
    30703070            // for password fields, active == false
  • trunk/Source/WebKit/gtk/ChangeLog

    r150663 r150796  
     12013-05-28  Andreas Kling  <akling@apple.com>
     2
     3        Document::setFocusedNode() should be setFocusedElement().
     4        <http://webkit.org/b/116857>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * webkit/webkitwebview.cpp:
     9        (getFocusedNode):
     10
    1112013-05-24  Christophe Dumez  <ch.dumez@sisa.samsung.com>
    212
  • trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp

    r150663 r150796  
    304304{
    305305    if (Document* doc = frame->document())
    306         return doc->focusedNode();
     306        return doc->focusedElement();
    307307    return 0;
    308308}
  • trunk/Source/WebKit/mac/ChangeLog

    r150699 r150796  
     12013-05-28  Andreas Kling  <akling@apple.com>
     2
     3        Document::setFocusedNode() should be setFocusedElement().
     4        <http://webkit.org/b/116857>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * WebView/WebHTMLView.mm:
     9        (-[WebHTMLView clearFocus]):
     10        (-[WebHTMLView becomeFirstResponder]):
     11
    1122013-05-25  Andreas Kling  <akling@apple.com>
    213
  • trunk/Source/WebKit/mac/WebView/WebHTMLView.mm

    r150668 r150796  
    31453145        return;
    31463146   
    3147     document->setFocusedNode(0);
     3147    document->setFocusedElement(0);
    31483148}
    31493149
     
    38183818
    38193819    if (Document* document = frame->document())
    3820         document->setFocusedNode(0);
     3820        document->setFocusedElement(0);
    38213821    page->focusController()->setInitialFocus(direction == NSSelectingNext ? FocusDirectionForward : FocusDirectionBackward,
    38223822                                             currentKeyboardEvent(frame).get());
  • trunk/Source/WebKit/qt/Api/qwebelement.cpp

    r149800 r150796  
    522522        return false;
    523523    if (m_element->document())
    524         return m_element == m_element->document()->focusedNode();
     524        return m_element == m_element->document()->focusedElement();
    525525    return false;
    526526}
     
    536536        return;
    537537    if (m_element->document() && m_element->isFocusable())
    538         m_element->document()->setFocusedNode(m_element);
     538        m_element->document()->setFocusedElement(m_element);
    539539}
    540540
  • trunk/Source/WebKit/qt/ChangeLog

    r150749 r150796  
     12013-05-28  Andreas Kling  <akling@apple.com>
     2
     3        Document::setFocusedNode() should be setFocusedElement().
     4        <http://webkit.org/b/116857>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * Api/qwebelement.cpp:
     9        (QWebElement::hasFocus):
     10        (QWebElement::setFocus):
     11        * WebCoreSupport/EditorClientQt.cpp:
     12        (WebCore::EditorClientQt::setInputMethodState):
     13        * WebCoreSupport/QWebPageAdapter.cpp:
     14        (QWebPageAdapter::mousePressEvent):
     15        (QWebPageAdapter::handleSoftwareInputPanel):
     16        (QWebPageAdapter::inputMethodQuery):
     17        (QWebPageAdapter::hasFocusedNode):
     18
    1192013-05-27  Jocelyn Turcotte  <jocelyn.turcotte@digia.com>
    220
  • trunk/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp

    r150140 r150796  
    619619        HTMLInputElement* inputElement = 0;
    620620        Frame* frame = m_page->page->focusController()->focusedOrMainFrame();
    621         if (frame && frame->document() && frame->document()->focusedNode())
    622             if (frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag))
    623                 inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedNode());
     621        if (frame && frame->document() && frame->document()->focusedElement())
     622            if (frame->document()->focusedElement()->hasTagName(HTMLNames::inputTag))
     623                inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedElement());
    624624
    625625        if (inputElement) {
  • trunk/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp

    r150214 r150796  
    434434    Frame* focusedFrame = page->focusController()->focusedFrame();
    435435    if (Document* focusedDocument = focusedFrame ? focusedFrame->document() : 0)
    436         oldNode = focusedDocument->focusedNode();
     436        oldNode = focusedDocument->focusedElement();
    437437
    438438    if (tripleClickTimer.isActive()
     
    452452    focusedFrame = page->focusController()->focusedFrame();
    453453    if (Document* focusedDocument = focusedFrame ? focusedFrame->document() : 0)
    454         newNode = focusedDocument->focusedNode();
     454        newNode = focusedDocument->focusedElement();
    455455
    456456    if (newNode && oldNode != newNode)
     
    512512
    513513    if (client && client->inputMethodEnabled()
    514         && frame->document()->focusedNode()
     514        && frame->document()->focusedElement()
    515515            && button == Qt::LeftButton && qGuiApp->property("autoSipEnabled").toBool()) {
    516516        if (!clickCausedFocus || requestSoftwareInputPanel()) {
     
    710710    case Qt::ImMaximumTextLength: {
    711711        if (frame->selection()->isContentEditable()) {
    712             if (frame->document() && frame->document()->focusedNode()) {
    713                 if (frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag)) {
    714                     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedNode());
     712            if (frame->document() && frame->document()->focusedElement()) {
     713                if (frame->document()->focusedElement()->hasTagName(HTMLNames::inputTag)) {
     714                    HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedElement());
    715715                    return QVariant(inputElement->maxLength());
    716716                }
     
    12101210    if (frame) {
    12111211        Document* document = frame->document();
    1212         hasFocus = document && document->focusedNode();
     1212        hasFocus = document && document->focusedElement();
    12131213    }
    12141214    return hasFocus;
  • trunk/Source/WebKit/win/ChangeLog

    r150772 r150796  
     12013-05-28  Andreas Kling  <akling@apple.com>
     2
     3        Document::setFocusedNode() should be setFocusedElement().
     4        <http://webkit.org/b/116857>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * DOMCoreClasses.cpp:
     9        (DOMElement::isFocused):
     10        * WebView.cpp:
     11        (WebView::setInitialFocus):
     12
    1132013-05-27  Xueqing Huang  <huangxueqing@baidu.com>
    214
  • trunk/Source/WebKit/win/DOMCoreClasses.cpp

    r150718 r150796  
    12171217        return E_FAIL;
    12181218
    1219     if (m_element->document()->focusedNode() == m_element)
     1219    if (m_element->document()->focusedElement() == m_element)
    12201220        *result = TRUE;
    12211221    else
  • trunk/Source/WebKit/win/WebView.cpp

    r150712 r150796  
    52845284    if (m_page && m_page->focusController()) {
    52855285        Frame* frame = m_page->focusController()->focusedOrMainFrame();
    5286         frame->document()->setFocusedNode(0);
     5286        frame->document()->setFocusedElement(0);
    52875287        m_page->focusController()->setInitialFocus(forward ? FocusDirectionForward : FocusDirectionBackward, 0);
    52885288    }
  • trunk/Source/WebKit2/ChangeLog

    r150792 r150796  
     12013-05-28  Andreas Kling  <akling@apple.com>
     2
     3        Document::setFocusedNode() should be setFocusedElement().
     4        <http://webkit.org/b/116857>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * WebProcess/Plugins/PluginView.cpp:
     9        (WebKit::PluginView::focusPluginElement):
     10        * WebProcess/WebPage/WebPage.cpp:
     11        (WebKit::WebPage::focusedPluginViewForFrame):
     12        (WebKit::WebPage::setInitialFocus):
     13
    1142013-05-28  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    215
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp

    r150771 r150796  
    10421042        page->focusController()->setFocusedElement(m_pluginElement.get(), frame());
    10431043    else
    1044        frame()->document()->setFocusedNode(m_pluginElement);
     1044        frame()->document()->setFocusedElement(m_pluginElement);
    10451045}
    10461046
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r150758 r150796  
    745745    PluginDocument* pluginDocument = static_cast<PluginDocument*>(frame->document());
    746746
    747     if (pluginDocument->focusedNode() != pluginDocument->pluginElement())
     747    if (pluginDocument->focusedElement() != pluginDocument->pluginElement())
    748748        return 0;
    749749
     
    20492049
    20502050    Frame* frame = m_page->focusController()->focusedOrMainFrame();
    2051     frame->document()->setFocusedNode(0);
     2051    frame->document()->setFocusedElement(0);
    20522052
    20532053    if (isKeyboardEventValid && event.type() == WebEvent::KeyDown) {
Note: See TracChangeset for help on using the changeset viewer.