Changeset 150796 in webkit
- Timestamp:
- May 28, 2013 5:46:31 AM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 55 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r150791 r150796 1 2013-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 1 110 2013-05-28 Sergio Villar Senin <svillar@igalia.com> 2 111 -
trunk/Source/WebCore/WebCore.exp.in
r150771 r150796 1048 1048 __ZN7WebCore8Document13createElementERKNS_13QualifiedNameEb 1049 1049 __ZN7WebCore8Document14createTextNodeERKN3WTF6StringE 1050 __ZN7WebCore8Document1 4setFocusedNodeEN3WTF10PassRefPtrINS_4NodeEEENS_14FocusDirectionE1050 __ZN7WebCore8Document17setFocusedElementEN3WTF10PassRefPtrINS_7ElementEEENS_14FocusDirectionE 1051 1051 __ZN7WebCore8Document16isPageBoxVisibleEi 1052 1052 __ZN7WebCore8Document16shortcutIconURLsEv -
trunk/Source/WebCore/accessibility/AXObjectCache.cpp
r150145 r150796 163 163 // get the focused node in the page 164 164 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); 173 170 if (!obj) 174 171 return 0; -
trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp
r150715 r150796 1782 1782 return true; 1783 1783 1784 // NOTE: It would be more accurate to ask the document whether setFocused Node() would1785 // do anything. For example, setFocused Node() will do nothing if the current focused1784 // 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 1786 1786 // node will not relinquish the focus. 1787 1787 if (!node) -
trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
r150716 r150796 1577 1577 return false; 1578 1578 1579 Node* focusedNode = document->focusedNode();1580 if (!focused Node)1579 Element* focusedElement = document->focusedElement(); 1580 if (!focusedElement) 1581 1581 return false; 1582 1582 1583 1583 // A web area is represented by the Document node in the DOM tree, which isn't focusable. 1584 1584 // Check instead if the frame's selection controller is focused 1585 if (focused Node== m_renderer->node()1585 if (focusedElement == m_renderer->node() 1586 1586 || (roleValue() == WebAreaRole && document->frame()->selection()->isFocusedAndActive())) 1587 1587 return true; … … 1596 1596 1597 1597 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(); 1613 1612 } 1614 1613 … … 2331 2330 return; 2332 2331 Document* doc = renderer()->document(); 2333 if (!doc->frame()->selection()->isFocusedAndActive() || doc->focused Node() != element)2332 if (!doc->frame()->selection()->isFocusedAndActive() || doc->focusedElement() != element) 2334 2333 return; 2335 2334 AccessibilityRenderObject* activedescendant = static_cast<AccessibilityRenderObject*>(activeDescendant()); -
trunk/Source/WebCore/bindings/objc/DOM.mm
r148545 r150796 406 406 // FIXME: Could we move this function to WebCore::Element and autogenerate? 407 407 WebCore::Element* element = core(self); 408 return element->document()->focused Node() == element;408 return element->document()->focusedElement() == element; 409 409 } 410 410 -
trunk/Source/WebCore/dom/Document.cpp
r150752 r150796 661 661 // these extra pointers or we will create a reference cycle. 662 662 m_docType = 0; 663 m_focused Node= 0;663 m_focusedElement = 0; 664 664 m_hoveredElement = 0; 665 665 m_activeElement = 0; … … 2105 2105 2106 2106 m_hoveredElement = 0; 2107 m_focused Node= 0;2107 m_focusedElement = 0; 2108 2108 m_activeElement = 0; 2109 2109 … … 3257 3257 void Document::focusedNodeRemoved() 3258 3258 { 3259 setFocused Node(0);3259 setFocusedElement(0); 3260 3260 } 3261 3261 3262 3262 void Document::removeFocusedNodeOfSubtree(Node* node, bool amongChildrenOnly) 3263 3263 { 3264 if (!m_focused Node|| 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. 3265 3265 return; 3266 3266 … … 3314 3314 #endif 3315 3315 3316 bool Document::setFocused Node(PassRefPtr<Node> prpNewFocusedNode, FocusDirection direction)3317 { 3318 RefPtr< Node> newFocusedNode = prpNewFocusedNode;3319 3320 // Make sure newFocused Nodeis actually in this document3321 if (newFocused Node && (newFocusedNode->document() != this))3316 bool 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)) 3322 3322 return true; 3323 3323 3324 if (m_focused Node == newFocusedNode)3324 if (m_focusedElement == newFocusedElement) 3325 3325 return true; 3326 3326 … … 3329 3329 3330 3330 bool focusChangeBlocked = false; 3331 RefPtr<Node> oldFocusedNode = m_focusedNode; 3332 m_focusedNode = 0; 3331 RefPtr<Element> oldFocusedElement = m_focusedElement.release(); 3333 3332 3334 3333 // 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); 3345 3341 3346 3342 // Dispatch a change event for form control elements that have been edited. 3347 if (oldFocused Node->isElementNode() && toElement(oldFocusedNode.get())->isFormControlElement()) {3348 HTMLFormControlElement* formControlElement = toHTMLFormControlElement(oldFocused Node.get());3343 if (oldFocusedElement->isFormControlElement()) { 3344 HTMLFormControlElement* formControlElement = toHTMLFormControlElement(oldFocusedElement.get()); 3349 3345 if (formControlElement->wasChangedSinceLastFormControlChangeEvent()) 3350 3346 formControlElement->dispatchFormControlChangeEvent(); … … 3352 3348 3353 3349 // Dispatch the blur event and let the node do any other blur related activities (important for text fields) 3354 oldFocused Node->dispatchBlurEvent(newFocusedNode);3355 3356 if (m_focused Node) {3350 oldFocusedElement->dispatchBlurEvent(newFocusedElement); 3351 3352 if (m_focusedElement) { 3357 3353 // handler shifted focus 3358 3354 focusChangeBlocked = true; 3359 newFocused Node= 0;3355 newFocusedElement = 0; 3360 3356 } 3361 3357 3362 oldFocused Node->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. 3363 3359 // FIXME: We should remove firing DOMFocusOutEvent event when we are sure no content depends 3364 3360 // on it, probably when <rdar://problem/8503958> is resolved. 3365 oldFocused Node->dispatchFocusOutEvent(eventNames().DOMFocusOutEvent, newFocusedNode); // DOM level 2 name for compatibility.3366 3367 if (m_focused Node) {3361 oldFocusedElement->dispatchFocusOutEvent(eventNames().DOMFocusOutEvent, newFocusedElement); // DOM level 2 name for compatibility. 3362 3363 if (m_focusedElement) { 3368 3364 // handler shifted focus 3369 3365 focusChangeBlocked = true; 3370 newFocused Node= 0;3366 newFocusedElement = 0; 3371 3367 } 3372 if (oldFocusedNode == this && oldFocusedNode->hasOneRef())3373 return true;3374 3368 3375 if (oldFocused Node->isRootEditableElement())3369 if (oldFocusedElement->isRootEditableElement()) 3376 3370 frame()->editor().didEndEditing(); 3377 3371 3378 3372 if (view()) { 3379 Widget* oldWidget = widgetForNode(oldFocused Node.get());3373 Widget* oldWidget = widgetForNode(oldFocusedElement.get()); 3380 3374 if (oldWidget) 3381 3375 oldWidget->setFocus(false); … … 3385 3379 } 3386 3380 3387 if (newFocused Node && newFocusedNode->isElementNode() && toElement(newFocusedNode.get())->isFocusable()) {3388 if (newFocused Node->isRootEditableElement() && !acceptsEditingFocus(newFocusedNode.get())) {3381 if (newFocusedElement && newFocusedElement->isFocusable()) { 3382 if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(newFocusedElement.get())) { 3389 3383 // delegate blocks focus change 3390 3384 focusChangeBlocked = true; … … 3392 3386 } 3393 3387 // Set focus on the new node 3394 m_focused Node = newFocusedNode;3388 m_focusedElement = newFocusedElement; 3395 3389 3396 3390 // Dispatch the focus event and let the node do any other focus related activities (important for text fields) 3397 m_focused Node->dispatchFocusEvent(oldFocusedNode, direction);3398 3399 if (m_focused Node != newFocusedNode) {3391 m_focusedElement->dispatchFocusEvent(oldFocusedElement, direction); 3392 3393 if (m_focusedElement != newFocusedElement) { 3400 3394 // handler shifted focus 3401 3395 focusChangeBlocked = true; … … 3403 3397 } 3404 3398 3405 m_focused Node->dispatchFocusInEvent(eventNames().focusinEvent, oldFocusedNode); // DOM level 3 bubbling focus event.3406 3407 if (m_focused Node != newFocusedNode) {3399 m_focusedElement->dispatchFocusInEvent(eventNames().focusinEvent, oldFocusedElement); // DOM level 3 bubbling focus event. 3400 3401 if (m_focusedElement != newFocusedElement) { 3408 3402 // handler shifted focus 3409 3403 focusChangeBlocked = true; … … 3413 3407 // FIXME: We should remove firing DOMFocusInEvent event when we are sure no content depends 3414 3408 // on it, probably when <rdar://problem/8503958> is m. 3415 m_focused Node->dispatchFocusInEvent(eventNames().DOMFocusInEvent, oldFocusedNode); // DOM level 2 for compatibility.3416 3417 if (m_focused Node != newFocusedNode) {3409 m_focusedElement->dispatchFocusInEvent(eventNames().DOMFocusInEvent, oldFocusedElement); // DOM level 2 for compatibility. 3410 3411 if (m_focusedElement != newFocusedElement) { 3418 3412 // handler shifted focus 3419 3413 focusChangeBlocked = true; … … 3421 3415 } 3422 3416 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()) 3427 3420 frame()->editor().didBeginEditing(); 3428 3421 … … 3430 3423 // ### find a better place in the code for this 3431 3424 if (view()) { 3432 Widget* focusWidget = widgetForNode(m_focused Node.get());3425 Widget* focusWidget = widgetForNode(m_focusedElement.get()); 3433 3426 if (focusWidget) { 3434 3427 // Make sure a widget has the right size before giving it focus. … … 3437 3430 updateLayout(); 3438 3431 // Re-get the widget in case updating the layout changed things. 3439 focusWidget = widgetForNode(m_focused Node.get());3432 focusWidget = widgetForNode(m_focusedElement.get()); 3440 3433 } 3441 3434 if (focusWidget) … … 3446 3439 } 3447 3440 3448 if (!focusChangeBlocked && m_focused Node) {3441 if (!focusChangeBlocked && m_focusedElement) { 3449 3442 // Create the AXObject cache in a focus change because GTK relies on it. 3450 3443 if (AXObjectCache* cache = axObjectCache()) 3451 cache->handleFocusedUIElementChanged(oldFocused Node.get(), newFocusedNode.get());3444 cache->handleFocusedUIElementChanged(oldFocusedElement.get(), newFocusedElement.get()); 3452 3445 } 3453 3446 3454 3447 if (!focusChangeBlocked) 3455 page()->chrome().focusedNodeChanged(m_focused Node.get());3448 page()->chrome().focusedNodeChanged(m_focusedElement.get()); 3456 3449 3457 3450 SetFocusedNodeDone: … … 4704 4697 void Document::updateFocusAppearanceTimerFired(Timer<Document>*) 4705 4698 { 4706 Node* node = focusedNode(); 4707 if (!node) 4708 return; 4709 if (!node->isElementNode()) 4699 Element* element = focusedElement(); 4700 if (!element) 4710 4701 return; 4711 4702 4712 4703 updateLayout(); 4713 4714 Element* element = toElement(node);4715 4704 if (element->isFocusable()) 4716 4705 element->updateFocusAppearance(m_updateFocusAppearanceRestoresSelection); … … 5767 5756 if (!doc) 5768 5757 return 0; 5769 Node* node = doc->focused Node();5758 Node* node = doc->focusedElement(); 5770 5759 if (!node && doc->isPluginDocument()) { 5771 5760 PluginDocument* pluginDocument = toPluginDocument(doc); -
trunk/Source/WebCore/dom/Document.h
r150752 r150796 671 671 void setSelectedStylesheetSet(const String&); 672 672 673 bool setFocused Node(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(); } 675 675 UserActionElementSet& userActionElements() { return m_userActionElements; } 676 676 const UserActionElementSet& userActionElements() const { return m_userActionElements; } … … 1346 1346 Color m_textColor; 1347 1347 1348 RefPtr< Node> m_focusedNode;1348 RefPtr<Element> m_focusedElement; 1349 1349 RefPtr<Element> m_hoveredElement; 1350 1350 RefPtr<Element> m_activeElement; -
trunk/Source/WebCore/dom/Element.cpp
r150752 r150796 1444 1444 ElementRareData* data = elementRareData(); 1445 1445 if (data->needsFocusAppearanceUpdateSoonAfterAttach()) { 1446 if (isFocusable() && document()->focused Node() == this)1446 if (isFocusable() && document()->focusedElement() == this) 1447 1447 document()->updateFocusAppearanceSoon(false /* don't restore selection */); 1448 1448 data->setNeedsFocusAppearanceUpdateSoonAfterAttach(false); … … 2088 2088 2089 2089 Document* doc = document(); 2090 if (doc->focused Node() == this)2090 if (doc->focusedElement() == this) 2091 2091 return; 2092 2092 … … 2155 2155 doc->frame()->page()->focusController()->setFocusedElement(0, doc->frame()); 2156 2156 else 2157 doc->setFocused Node(0);2157 doc->setFocusedElement(0); 2158 2158 } 2159 2159 } … … 2408 2408 if (hasRareData()) 2409 2409 elementRareData()->setNeedsFocusAppearanceUpdateSoonAfterAttach(false); 2410 if (document()->focused Node() == this)2410 if (document()->focusedElement() == this) 2411 2411 document()->cancelFocusAppearanceUpdate(); 2412 2412 } -
trunk/Source/WebCore/dom/Node.cpp
r150783 r150796 686 686 // Ideally we'd call ASSERT(!needsStyleRecalc()) here, but 687 687 // ContainerNode::setFocus() calls setNeedsStyleRecalc(), so the assertion 688 // would fire in the middle of Document::setFocused Node().688 // would fire in the middle of Document::setFocusedElement(). 689 689 690 690 for (const Node* node = this; node; node = node->parentNode()) { -
trunk/Source/WebCore/dom/TreeScope.cpp
r150733 r150796 393 393 { 394 394 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(); 399 396 400 397 if (!element && document->page()) -
trunk/Source/WebCore/dom/UserTypingGestureIndicator.cpp
r95901 r150796 28 28 29 29 #include "Document.h" 30 #include "Element.h" 30 31 #include "Frame.h" 31 #include "Node.h"32 32 #include <wtf/StdLibExtras.h> 33 33 … … 56 56 { 57 57 s_processingUserTypingGesture = true; 58 focusedNode() = frame->document() ? frame->document()->focused Node() : 0;58 focusedNode() = frame->document() ? frame->document()->focusedElement() : 0; 59 59 } 60 60 -
trunk/Source/WebCore/editing/Editor.cpp
r150534 r150796 1370 1370 void Editor::setBaseWritingDirection(WritingDirection direction) 1371 1371 { 1372 Node* focusedNode = frame()->document()->focusedNode();1373 if (focused Node && isHTMLTextFormControlElement(focusedNode)) {1372 Element* focusedElement = frame()->document()->focusedElement(); 1373 if (focusedElement && isHTMLTextFormControlElement(focusedElement)) { 1374 1374 if (direction == NaturalWritingDirection) 1375 1375 return; 1376 toHTMLElement(focused Node)->setAttribute(dirAttr, direction == LeftToRightWritingDirection ? "ltr" : "rtl");1377 focused Node->dispatchInputEvent();1376 toHTMLElement(focusedElement)->setAttribute(dirAttr, direction == LeftToRightWritingDirection ? "ltr" : "rtl"); 1377 focusedElement->dispatchInputEvent(); 1378 1378 frame()->document()->updateStyleIfNeeded(); 1379 1379 return; … … 1481 1481 // We should send this event before sending a TextEvent as written in Section 6.2.2 and 6.2.3 of 1482 1482 // the DOM Event specification. 1483 Node* target = m_frame->document()->focusedNode();1483 Element* target = m_frame->document()->focusedElement(); 1484 1484 if (target) { 1485 1485 RefPtr<CompositionEvent> event = CompositionEvent::create(eventNames().compositionendEvent, m_frame->document()->domWindow(), text); … … 1523 1523 } 1524 1524 1525 Node* target = m_frame->document()->focusedNode();1525 Element* target = m_frame->document()->focusedElement(); 1526 1526 if (target) { 1527 1527 // Dispatch an appropriate composition event to the focused node. … … 1906 1906 } 1907 1907 1908 String misspelledWord = behavior().shouldAllowSpellingSuggestionsWithoutSelection() ? misspelledWordAtCaretOrRange(m_frame->document()->focused Node()) : misspelledSelectionString();1908 String misspelledWord = behavior().shouldAllowSpellingSuggestionsWithoutSelection() ? misspelledWordAtCaretOrRange(m_frame->document()->focusedElement()) : misspelledSelectionString(); 1909 1909 misspelled = !misspelledWord.isEmpty(); 1910 1910 -
trunk/Source/WebCore/editing/EditorCommand.cpp
r150214 r150796 250 250 static unsigned verticalScrollDistance(Frame* frame) 251 251 { 252 Node* focusedNode = frame->document()->focusedNode();253 if (!focused Node)252 Element* focusedElement = frame->document()->focusedElement(); 253 if (!focusedElement) 254 254 return 0; 255 RenderObject* renderer = focused Node->renderer();255 RenderObject* renderer = focusedElement->renderer(); 256 256 if (!renderer || !renderer->isBox()) 257 257 return 0; … … 259 259 if (!style) 260 260 return 0; 261 if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || focused Node->rendererIsEditable()))261 if (!(style->overflowY() == OSCROLL || style->overflowY() == OAUTO || focusedElement->rendererIsEditable())) 262 262 return 0; 263 263 int height = std::min<int>(toRenderBox(renderer)->clientHeight(), frame->view()->visibleHeight()); -
trunk/Source/WebCore/editing/FrameSelection.cpp
r150712 r150796 1634 1634 Document* document = m_frame->document(); 1635 1635 1636 if (document->focused Node() && document->focusedNode()->hasTagName(selectTag)) {1637 HTMLSelectElement* selectElement = toHTMLSelectElement(document->focused Node());1636 if (document->focusedElement() && document->focusedElement()->hasTagName(selectTag)) { 1637 HTMLSelectElement* selectElement = toHTMLSelectElement(document->focusedElement()); 1638 1638 if (selectElement->canSelectAll()) { 1639 1639 selectElement->selectAll(); … … 1723 1723 // RenderTheme::isFocused() check if the frame is active, we have to 1724 1724 // 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()) 1728 1728 if (renderer && renderer->style()->hasAppearance()) 1729 1729 renderer->theme()->stateChanged(renderer, FocusState); … … 1902 1902 target = target->parentOrShadowHostElement(); 1903 1903 } 1904 m_frame->document()->setFocused Node(0);1904 m_frame->document()->setFocusedElement(0); 1905 1905 } 1906 1906 … … 1988 1988 { 1989 1989 // Start looking either at the active (first responder) node, or where the selection is. 1990 Node* start = m_frame->document()->focused Node();1990 Node* start = m_frame->document()->focusedElement(); 1991 1991 if (!start) 1992 1992 start = this->start().deprecatedNode(); -
trunk/Source/WebCore/history/CachedPage.cpp
r145826 r150796 85 85 // 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. 86 86 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); 91 89 92 90 if (m_needStyleRecalcForVisitedLinks) { -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r150683 r150796 538 538 if (wasAttached) { 539 539 attach(); 540 if (document()->focused Node() == this)540 if (document()->focusedElement() == this) 541 541 updateFocusAppearance(true); 542 542 } … … 814 814 m_inputType->attach(); 815 815 816 if (document()->focused Node() == this)816 if (document()->focusedElement() == this) 817 817 document()->updateFocusAppearanceSoon(true /* restore selection */); 818 818 } -
trunk/Source/WebCore/html/HTMLTextAreaElement.cpp
r150140 r150796 390 390 391 391 // Set the caret to the end of the text value. 392 if (document()->focused Node() == this) {392 if (document()->focusedElement() == this) { 393 393 unsigned endOfString = m_value.length(); 394 394 setSelectionRange(endOfString, endOfString); -
trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp
r148921 r150796 154 154 && isEmptySuggestedValue() 155 155 && !isPlaceholderEmpty() 156 && (document()->focused Node() != this || (renderer() && renderer()->theme()->shouldShowPlaceholderWhenFocused()))156 && (document()->focusedElement() != this || (renderer() && renderer()->theme()->shouldShowPlaceholderWhenFocused())) 157 157 && (!renderer() || renderer()->style()->visibility() == VISIBLE); 158 158 } … … 363 363 if (!isTextFormControl()) 364 364 return 0; 365 if (document()->focused Node() != this && hasCachedSelection())365 if (document()->focusedElement() != this && hasCachedSelection()) 366 366 return m_cachedSelectionStart; 367 367 … … 383 383 if (!isTextFormControl()) 384 384 return 0; 385 if (document()->focused Node() != this && hasCachedSelection())385 if (document()->focusedElement() != this && hasCachedSelection()) 386 386 return m_cachedSelectionEnd; 387 387 return computeSelectionEnd(); … … 421 421 if (!isTextFormControl()) 422 422 return directionString(SelectionHasNoDirection); 423 if (document()->focused Node() != this && hasCachedSelection())423 if (document()->focusedElement() != this && hasCachedSelection()) 424 424 return directionString(m_cachedSelectionDirection); 425 425 -
trunk/Source/WebCore/html/RadioInputType.cpp
r137221 r150796 97 97 break; 98 98 if (inputElement->isRadioButton() && inputElement->name() == element()->name() && inputElement->isFocusable()) { 99 document->setFocused Node(inputElement);99 document->setFocusedElement(inputElement); 100 100 inputElement->dispatchSimulatedClick(event, SendNoEvents, DoNotShowPressedLook); 101 101 event->setDefaultHandled(); … … 128 128 // Never allow keyboard tabbing to leave you in the same radio group. Always 129 129 // skip any other elements in the group. 130 Node* currentFocusedNode = element()->document()->focusedNode();130 Element* currentFocusedNode = element()->document()->focusedElement(); 131 131 if (currentFocusedNode && currentFocusedNode->hasTagName(inputTag)) { 132 132 HTMLInputElement* focusedInput = static_cast<HTMLInputElement*>(currentFocusedNode); -
trunk/Source/WebCore/html/shadow/DateTimeEditElement.cpp
r149392 r150796 578 578 size_t DateTimeEditElement::focusedFieldIndex() const 579 579 { 580 Node* const focusedFieldNode = document()->focused Node();580 Node* const focusedFieldNode = document()->focusedElement(); 581 581 for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) { 582 582 if (m_fields[fieldIndex] == focusedFieldNode) -
trunk/Source/WebCore/loader/FrameLoader.cpp
r150695 r150796 395 395 if (m_frame->document()) { 396 396 if (m_didCallImplicitClose && !m_wasUnloadEventEmitted) { 397 Node* currentFocusedNode = m_frame->document()->focusedNode();398 if (currentFocused Node && currentFocusedNode->toInputElement())399 currentFocused Node->toInputElement()->endEditing();397 Element* currentFocusedElement = m_frame->document()->focusedElement(); 398 if (currentFocusedElement && currentFocusedElement->toInputElement()) 399 currentFocusedElement->toInputElement()->endEditing(); 400 400 if (m_pageDismissalEventBeingDispatched == NoDismissal) { 401 401 if (unloadEventPolicy == UnloadEventPolicyUnloadAndPageHide) { -
trunk/Source/WebCore/page/DOMWindow.cpp
r150490 r150796 945 945 Frame* focusedFrame = page->focusController()->focusedFrame(); 946 946 if (focusedFrame && focusedFrame != m_frame) 947 focusedFrame->document()->setFocused Node(0);947 focusedFrame->document()->setFocusedElement(0); 948 948 949 949 m_frame->eventHandler()->focusDocumentView(); -
trunk/Source/WebCore/page/EventHandler.cpp
r150712 r150796 1085 1085 1086 1086 if (!node) 1087 node = m_frame->document()->focused Node();1087 node = m_frame->document()->focusedElement(); 1088 1088 1089 1089 if (!node) … … 1106 1106 1107 1107 if (!node) 1108 node = m_frame->document()->focused Node();1108 node = m_frame->document()->focusedElement(); 1109 1109 1110 1110 if (!node) … … 2347 2347 if (m_frame->selection()->isRange() 2348 2348 && m_frame->selection()->toNormalizedRange()->compareNode(element, IGNORE_EXCEPTION) == Range::NODE_INSIDE 2349 && element->isDescendantOf(m_frame->document()->focused Node()))2349 && element->isDescendantOf(m_frame->document()->focusedElement())) 2350 2350 return true; 2351 2351 … … 2946 2946 IntPoint location; 2947 2947 2948 Node* focusedNode = doc->focusedNode();2948 Element* focusedElement = doc->focusedElement(); 2949 2949 FrameSelection* selection = m_frame->selection(); 2950 2950 Position start = selection->selection().start(); … … 2958 2958 int y = firstRect.maxY() ? firstRect.maxY() - 1 : 0; 2959 2959 location = IntPoint(x, y); 2960 } else if (focused Node) {2961 RenderBoxModelObject* box = focused Node->renderBoxModelObject();2960 } else if (focusedElement) { 2961 RenderBoxModelObject* box = focusedElement->renderBoxModelObject(); 2962 2962 if (!box) 2963 2963 return false; … … 2975 2975 IntPoint globalPosition = view->hostWindow()->rootViewToScreen(IntRect(position, IntSize())).location(); 2976 2976 2977 Node* targetNode = doc->focused Node();2977 Node* targetNode = doc->focusedElement(); 2978 2978 if (!targetNode) 2979 2979 targetNode = doc; … … 3776 3776 { 3777 3777 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()) { 3780 3780 if (r->isTextField()) 3781 3781 toRenderTextControlSingleLine(r)->capsLockStateMayHaveChanged(); -
trunk/Source/WebCore/page/FocusController.cpp
r150713 r150796 123 123 } 124 124 125 if (!focused && document->focused Node())126 document->focused Node()->dispatchBlurEvent(0);125 if (!focused && document->focusedElement()) 126 document->focusedElement()->dispatchBlurEvent(0); 127 127 document->dispatchWindowEvent(Event::create(focused ? eventNames().focusEvent : eventNames().blurEvent, false, false)); 128 if (focused && document->focused Node())129 document->focused Node()->dispatchFocusEvent(0, FocusDirectionNone);128 if (focused && document->focusedElement()) 129 document->focusedElement()->dispatchFocusEvent(0, FocusDirectionNone); 130 130 } 131 131 … … 285 285 Document* document = frame->document(); 286 286 287 Node* currentNode = document->focused Node();287 Node* currentNode = document->focusedElement(); 288 288 // FIXME: Not quite correct when it comes to focus transitions leaving/entering the WebView itself 289 289 bool caretBrowsing = frame->settings() && frame->settings()->caretBrowsingEnabled(); … … 299 299 // We didn't find a node to focus, so we should try to pass focus to Chrome. 300 300 if (!initialFocus && m_page->chrome().canTakeFocus(direction)) { 301 document->setFocused Node(0);301 document->setFocusedElement(0); 302 302 setFocusedFrame(0); 303 303 m_page->chrome().takeFocus(direction); … … 315 315 ASSERT(node); 316 316 317 if (node == document->focused Node())317 if (node == document->focusedElement()) 318 318 // Focus wrapped around to the same node. 319 319 return true; … … 332 332 return false; 333 333 334 document->setFocused Node(0);334 document->setFocusedElement(0); 335 335 setFocusedFrame(owner->contentFrame()); 336 336 return true; 337 337 } 338 338 339 // FIXME: It would be nice to just be able to call setFocused Node(node) here, but we can't do339 // FIXME: It would be nice to just be able to call setFocusedElement(node) here, but we can't do 340 340 // that because some elements (e.g. HTMLInputElement and HTMLTextAreaElement) do extra work in 341 341 // their focus() methods. … … 345 345 if (newDocument != document) 346 346 // Focus is going away from this document, so clear the focused node. 347 document->setFocused Node(0);347 document->setFocusedElement(0); 348 348 349 349 if (newDocument) … … 596 596 RefPtr<Document> oldDocument = oldFocusedFrame ? oldFocusedFrame->document() : 0; 597 597 598 Node* oldFocusedNode = oldDocument ? oldDocument->focusedNode() : 0;599 if (oldFocused Node== element)598 Element* oldFocusedElement = oldDocument ? oldDocument->focusedElement() : 0; 599 if (oldFocusedElement == element) 600 600 return true; 601 601 602 602 // FIXME: Might want to disable this check for caretBrowsing 603 if (oldFocused Node && oldFocusedNode->isRootEditableElement() && !relinquishesEditingFocus(oldFocusedNode))603 if (oldFocusedElement && oldFocusedElement->isRootEditableElement() && !relinquishesEditingFocus(oldFocusedElement)) 604 604 return false; 605 605 … … 610 610 if (!element) { 611 611 if (oldDocument) 612 oldDocument->setFocused Node(0);612 oldDocument->setFocusedElement(0); 613 613 m_page->editorClient()->setInputMethodState(false); 614 614 return true; … … 617 617 RefPtr<Document> newDocument = element->document(); 618 618 619 if (newDocument && newDocument->focused Node() == element) {619 if (newDocument && newDocument->focusedElement() == element) { 620 620 m_page->editorClient()->setInputMethodState(element->shouldUseInputMethod()); 621 621 return true; … … 623 623 624 624 if (oldDocument && oldDocument != newDocument) 625 oldDocument->setFocused Node(0);625 oldDocument->setFocusedElement(0); 626 626 627 627 if (newFocusedFrame && !newFocusedFrame->page()) { … … 633 633 RefPtr<Element> protect(element); 634 634 if (newDocument) { 635 bool successfullyFocused = newDocument->setFocused Node(element, direction);635 bool successfullyFocused = newDocument->setFocusedElement(element, direction); 636 636 if (!successfullyFocused) 637 637 return false; 638 638 } 639 639 640 if (newDocument->focused Node() == element)640 if (newDocument->focusedElement() == element) 641 641 m_page->editorClient()->setInputMethodState(element->shouldUseInputMethod()); 642 642 … … 755 755 { 756 756 ASSERT(container); 757 Node* focusedNode = (focusedFrame() && focusedFrame()->document()) ? focusedFrame()->document()->focused Node() : 0;757 Node* focusedNode = (focusedFrame() && focusedFrame()->document()) ? focusedFrame()->document()->focusedElement() : 0; 758 758 759 759 Element* element = ElementTraversal::firstWithin(container); … … 814 814 // Navigate into a new frame. 815 815 LayoutRect rect; 816 Node* focusedNode = focusedOrMainFrame()->document()->focusedNode();817 if (focused Node && !hasOffscreenRect(focusedNode))818 rect = nodeRectInAbsoluteCoordinates(focused Node, true /* ignore border */);816 Element* focusedElement = focusedOrMainFrame()->document()->focusedElement(); 817 if (focusedElement && !hasOffscreenRect(focusedElement)) 818 rect = nodeRectInAbsoluteCoordinates(focusedElement, true /* ignore border */); 819 819 frameElement->contentFrame()->document()->updateLayoutIgnorePendingStylesheets(); 820 820 if (!advanceFocusDirectionallyInContainer(frameElement->contentFrame()->document(), rect, direction, event)) { … … 832 832 // Navigate into a new scrollable container. 833 833 LayoutRect startingRect; 834 Node* focusedNode = focusedOrMainFrame()->document()->focusedNode();835 if (focused Node && !hasOffscreenRect(focusedNode))836 startingRect = nodeRectInAbsoluteCoordinates(focused Node, true);834 Element* focusedElement = focusedOrMainFrame()->document()->focusedElement(); 835 if (focusedElement && !hasOffscreenRect(focusedElement)) 836 startingRect = nodeRectInAbsoluteCoordinates(focusedElement, true); 837 837 return advanceFocusDirectionallyInContainer(focusCandidate.visibleNode, startingRect, direction, event); 838 838 } … … 860 860 return false; 861 861 862 Node* focusedNode = focusedDocument->focusedNode();862 Element* focusedElement = focusedDocument->focusedElement(); 863 863 Node* container = focusedDocument; 864 864 … … 868 868 // Figure out the starting rect. 869 869 LayoutRect startingRect; 870 if (focused Node) {871 if (!hasOffscreenRect(focused Node)) {872 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(direction, focused Node);873 startingRect = nodeRectInAbsoluteCoordinates(focused Node, true /* ignore border */);874 } else if (focused Node->hasTagName(areaTag)) {875 HTMLAreaElement* area = static_cast<HTMLAreaElement*>(focused Node);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); 876 876 container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(direction, area->imageElement()); 877 877 startingRect = virtualRectForAreaElementAndDirection(area, direction); -
trunk/Source/WebCore/page/FrameView.cpp
r150768 r150796 1866 1866 // If the anchor accepts keyboard focus, move focus there to aid users relying on keyboard navigation. 1867 1867 if (anchorElement && anchorElement->isFocusable()) 1868 m_frame->document()->setFocused Node(anchorElement);1868 m_frame->document()->setFocusedElement(anchorElement); 1869 1869 1870 1870 return true; -
trunk/Source/WebCore/plugins/PluginView.cpp
r150712 r150796 888 888 void PluginView::focusPluginElement() 889 889 { 890 // Focus the plugin891 890 if (Page* page = m_parentFrame->page()) 892 891 page->focusController()->setFocusedElement(m_element, m_parentFrame); 893 892 else 894 m_parentFrame->document()->setFocused Node(m_element);893 m_parentFrame->document()->setFocusedElement(m_element); 895 894 } 896 895 -
trunk/Source/WebCore/plugins/efl/PluginViewEfl.cpp
r148696 r150796 126 126 { 127 127 if (focused) 128 m_element->document()->setFocused Node(m_element);128 m_element->document()->setFocusedElement(m_element); 129 129 130 130 Widget::setFocus(focused); -
trunk/Source/WebCore/plugins/mac/PluginViewMac.mm
r149716 r150796 709 709 if (Page* page = m_parentFrame->page()) 710 710 page->focusController()->setFocusedFrame(m_parentFrame); 711 m_parentFrame->document()->setFocused Node(m_element);711 m_parentFrame->document()->setFocusedElement(m_element); 712 712 } else if (event->type() == eventNames().mouseupEvent) { 713 713 record.what = mouseUp; … … 753 753 if (Page* page = m_parentFrame->page()) 754 754 page->focusController()->setFocusedFrame(m_parentFrame); 755 m_parentFrame->document()->setFocused Node(m_element);755 m_parentFrame->document()->setFocusedElement(m_element); 756 756 break; 757 757 -
trunk/Source/WebCore/rendering/RenderImage.cpp
r149980 r150796 425 425 return; 426 426 427 Node* focusedNode = document->focusedNode();428 if (!focused Node || !focusedNode->hasTagName(areaTag))429 return; 430 431 HTMLAreaElement* areaElement = static_cast<HTMLAreaElement*>(focused Node);427 Element* focusedElement = document->focusedElement(); 428 if (!focusedElement || !focusedElement->hasTagName(areaTag)) 429 return; 430 431 HTMLAreaElement* areaElement = static_cast<HTMLAreaElement*>(focusedElement); 432 432 if (areaElement->imageElement() != node()) 433 433 return; -
trunk/Source/WebCore/rendering/RenderListBox.cpp
r150399 r150796 413 413 Color textColor = element->renderStyle() ? element->renderStyle()->visitedDependentColor(CSSPropertyColor) : style()->visitedDependentColor(CSSPropertyColor); 414 414 if (isOptionElement && toHTMLOptionElement(element)->selected()) { 415 if (frame()->selection()->isFocusedAndActive() && document()->focused Node() == node())415 if (frame()->selection()->isFocusedAndActive() && document()->focusedElement() == node()) 416 416 textColor = theme()->activeListBoxSelectionForegroundColor(); 417 417 // Honor the foreground color for disabled items … … 446 446 Color backColor; 447 447 if (element->hasTagName(optionTag) && toHTMLOptionElement(element)->selected()) { 448 if (frame()->selection()->isFocusedAndActive() && document()->focused Node() == node())448 if (frame()->selection()->isFocusedAndActive() && document()->focusedElement() == node()) 449 449 backColor = theme()->activeListBoxSelectionBackgroundColor(); 450 450 else -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp
r150716 r150796 277 277 shouldDrawCapsLockIndicator = inputElement()->isPasswordField() 278 278 && frame->selection()->isFocusedAndActive() 279 && document()->focused Node() == node()279 && document()->focusedElement() == node() 280 280 && PlatformKeyboardEvent::currentCapsLockState(); 281 281 … … 404 404 bool RenderTextControlSingleLine::textShouldBeTruncated() const 405 405 { 406 return document()->focused Node() != node()406 return document()->focusedElement() != node() 407 407 && style()->textOverflow() == TextOverflowEllipsis; 408 408 } -
trunk/Source/WebCore/rendering/RenderTheme.cpp
r150715 r150796 801 801 Document* document = focusDelegate->document(); 802 802 Frame* frame = document->frame(); 803 return focusDelegate == document->focused Node() && frame && frame->selection()->isFocusedAndActive();803 return focusDelegate == document->focusedElement() && frame && frame->selection()->isFocusedAndActive(); 804 804 } 805 805 -
trunk/Source/WebKit/blackberry/Api/WebPage.cpp
r150770 r150796 2557 2557 const Platform::ViewportAccessor* viewportAccessor = m_webkitThreadViewportAccessor; 2558 2558 2559 IntRect focusRect = rectForNode(doc->focused Node());2560 focusRect = adjustRectOffsetForFrameOffset(focusRect, doc->focused Node());2559 IntRect focusRect = rectForNode(doc->focusedElement()); 2560 focusRect = adjustRectOffsetForFrameOffset(focusRect, doc->focusedElement()); 2561 2561 focusRect = viewportAccessor->roundToPixelFromDocumentContents(WebCore::FloatRect(focusRect)); 2562 2562 focusRect.intersect(viewportAccessor->pixelContentsRect()); … … 2573 2573 if (m_webSettings->doesGetFocusNodeContext() && !isTouching) { 2574 2574 RefPtr<Node> node; 2575 node = m_page->focusController()->focusedOrMainFrame()->document()->focused Node();2575 node = m_page->focusController()->focusedOrMainFrame()->document()->focusedElement(); 2576 2576 if (node) { 2577 2577 IntRect visibleRect = IntRect(IntPoint(), actualVisibleSize()); … … 4169 4169 ASSERT(frame->document()); 4170 4170 4171 if (frame->document()->focused Node())4171 if (frame->document()->focusedElement()) 4172 4172 frame->page()->focusController()->setFocusedElement(0, frame); 4173 4173 } … … 4914 4914 toElement(nodeImpl)->updateFocusAppearance(true); 4915 4915 d->m_inputHandler->didNodeOpenPopup(nodeImpl); 4916 } else if (doc->focused Node() == nodeImpl) // && !on4916 } else if (doc->focusedElement() == nodeImpl) // && !on 4917 4917 page->focusController()->setFocusedElement(0, doc->frame()); 4918 4918 -
trunk/Source/WebKit/blackberry/ChangeLog
r150795 r150796 1 2013-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 1 26 2013-05-28 Carlos Garcia Campos <cgarcia@igalia.com> 2 27 -
trunk/Source/WebKit/blackberry/WebCoreSupport/EditorClientBlackBerry.cpp
r150140 r150796 97 97 return false; 98 98 99 const Node* node = frame->document()->focused Node();99 const Node* node = frame->document()->focusedElement(); 100 100 // NOTE: This logic is taken from EditorClientImpl::shouldSpellcheckByDefault 101 101 // If |node| is null, we default to allowing spellchecking. This is done in … … 191 191 Frame* frame = m_webPagePrivate->focusedOrMainFrame(); 192 192 if (frame && frame->document()) { 193 if ( Node* focusedNode = frame->document()->focusedNode()) {194 if (focused Node->hasTagName(HTMLNames::selectTag))193 if (Element* focusedElement = frame->document()->focusedElement()) { 194 if (focusedElement->hasTagName(HTMLNames::selectTag)) 195 195 return false; 196 if ( focusedNode->isElementNode() && DOMSupport::isPopupInputField(toElement(focusedNode)))196 if (DOMSupport::isPopupInputField(focusedElement)) 197 197 return false; 198 198 } -
trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp
r150779 r150796 428 428 return; 429 429 430 Node* node = frame->document()->focused Node();430 Node* node = frame->document()->focusedElement(); 431 431 432 432 if (isActiveTextEdit() && m_currentFocusElement == node) { -
trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp
r150712 r150796 247 247 void SelectionHandler::setCaretPosition(const WebCore::IntPoint& position) 248 248 { 249 if (!m_webPage->m_inputHandler->isInputMode() || !m_webPage->focusedOrMainFrame()->document()->focused Node())249 if (!m_webPage->m_inputHandler->isInputMode() || !m_webPage->focusedOrMainFrame()->document()->focusedElement()) 250 250 return; 251 251 … … 370 370 { 371 371 Frame* focusedFrame = m_webPage->focusedOrMainFrame(); 372 if (!focusedFrame->document()->focused Node() || !focusedFrame->document()->focusedNode()->renderer())372 if (!focusedFrame->document()->focusedElement() || !focusedFrame->document()->focusedElement()->renderer()) 373 373 return 0; 374 374 … … 377 377 WebCore::IntRect caretRect = isStartHandle ? activeSelection.visibleStart().absoluteCaretBounds() : activeSelection.visibleEnd().absoluteCaretBounds(); 378 378 379 WebCore::IntRect nodeBoundingBox = focusedFrame->document()->focused Node()->renderer()->absoluteBoundingBoxRect();379 WebCore::IntRect nodeBoundingBox = focusedFrame->document()->focusedElement()->renderer()->absoluteBoundingBoxRect(); 380 380 nodeBoundingBox.inflate(-1); 381 381 … … 415 415 416 416 Frame* focusedFrame = m_webPage->focusedOrMainFrame(); 417 Node* focusedNode = focusedFrame->document()->focused Node();417 Node* focusedNode = focusedFrame->document()->focusedElement(); 418 418 if (!focusedNode || !focusedNode->renderer()) 419 419 return false; … … 1065 1065 1066 1066 if (m_webPage->m_inputHandler->isInputMode() 1067 && frame->document()->focused Node()1068 && frame->document()->focused Node()->renderer()) {1069 WebCore::IntRect boundingBox(frame->document()->focused Node()->renderer()->absoluteBoundingBoxRect());1067 && frame->document()->focusedElement() 1068 && frame->document()->focusedElement()->renderer()) { 1069 WebCore::IntRect boundingBox(frame->document()->focusedElement()->renderer()->absoluteBoundingBoxRect()); 1070 1070 boundingBox.inflate(-1); 1071 1071 clippedPoint = WebCore::IntPoint(clamp(boundingBox.x(), clippedPoint.x(), boundingBox.maxX()), clamp(boundingBox.y(), clippedPoint.y(), boundingBox.maxY())); … … 1109 1109 return false; 1110 1110 1111 Node* focusedNode = m_webPage->focusedOrMainFrame()->document()->focused Node();1111 Node* focusedNode = m_webPage->focusedOrMainFrame()->document()->focusedElement(); 1112 1112 if (!focusedNode || !focusedNode->isElementNode()) 1113 1113 return false; … … 1167 1167 return; 1168 1168 1169 if (Node* focusedNode = frame->document()->focused Node()) {1169 if (Node* focusedNode = frame->document()->focusedElement()) { 1170 1170 if (focusedNode->hasTagName(HTMLNames::selectTag) || (focusedNode->isElementNode() && DOMSupport::isPopupInputField(toElement(focusedNode)))) { 1171 1171 SelectionLog(Platform::LogLevelInfo, "SelectionHandler::selectionPositionChanged selection is on a popup control, skipping rendering."); -
trunk/Source/WebKit/efl/ChangeLog
r150790 r150796 1 2013-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 1 13 2013-05-28 Ryuan Choi <ryuan.choi@samsung.com> 2 14 -
trunk/Source/WebKit/efl/ewk/ewk_frame.cpp
r150140 r150796 870 870 if (!document) 871 871 return false; 872 WebCore::Node* focusedNode = document->focused Node();872 WebCore::Node* focusedNode = document->focusedElement(); 873 873 if (!focusedNode) 874 874 return false; -
trunk/Source/WebKit/efl/ewk/ewk_view.cpp
r150663 r150796 3062 3062 if (focusedFrame 3063 3063 && focusedFrame->document() 3064 && focusedFrame->document()->focused Node()3065 && focusedFrame->document()->focused Node()->hasTagName(WebCore::HTMLNames::inputTag)) {3064 && focusedFrame->document()->focusedElement() 3065 && focusedFrame->document()->focusedElement()->hasTagName(WebCore::HTMLNames::inputTag)) { 3066 3066 WebCore::HTMLInputElement* inputElement; 3067 3067 3068 inputElement = static_cast<WebCore::HTMLInputElement*>(focusedFrame->document()->focused Node());3068 inputElement = static_cast<WebCore::HTMLInputElement*>(focusedFrame->document()->focusedElement()); 3069 3069 if (inputElement) { 3070 3070 // for password fields, active == false -
trunk/Source/WebKit/gtk/ChangeLog
r150663 r150796 1 2013-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 1 11 2013-05-24 Christophe Dumez <ch.dumez@sisa.samsung.com> 2 12 -
trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp
r150663 r150796 304 304 { 305 305 if (Document* doc = frame->document()) 306 return doc->focused Node();306 return doc->focusedElement(); 307 307 return 0; 308 308 } -
trunk/Source/WebKit/mac/ChangeLog
r150699 r150796 1 2013-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 1 12 2013-05-25 Andreas Kling <akling@apple.com> 2 13 -
trunk/Source/WebKit/mac/WebView/WebHTMLView.mm
r150668 r150796 3145 3145 return; 3146 3146 3147 document->setFocused Node(0);3147 document->setFocusedElement(0); 3148 3148 } 3149 3149 … … 3818 3818 3819 3819 if (Document* document = frame->document()) 3820 document->setFocused Node(0);3820 document->setFocusedElement(0); 3821 3821 page->focusController()->setInitialFocus(direction == NSSelectingNext ? FocusDirectionForward : FocusDirectionBackward, 3822 3822 currentKeyboardEvent(frame).get()); -
trunk/Source/WebKit/qt/Api/qwebelement.cpp
r149800 r150796 522 522 return false; 523 523 if (m_element->document()) 524 return m_element == m_element->document()->focused Node();524 return m_element == m_element->document()->focusedElement(); 525 525 return false; 526 526 } … … 536 536 return; 537 537 if (m_element->document() && m_element->isFocusable()) 538 m_element->document()->setFocused Node(m_element);538 m_element->document()->setFocusedElement(m_element); 539 539 } 540 540 -
trunk/Source/WebKit/qt/ChangeLog
r150749 r150796 1 2013-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 1 19 2013-05-27 Jocelyn Turcotte <jocelyn.turcotte@digia.com> 2 20 -
trunk/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
r150140 r150796 619 619 HTMLInputElement* inputElement = 0; 620 620 Frame* frame = m_page->page->focusController()->focusedOrMainFrame(); 621 if (frame && frame->document() && frame->document()->focused Node())622 if (frame->document()->focused Node()->hasTagName(HTMLNames::inputTag))623 inputElement = static_cast<HTMLInputElement*>(frame->document()->focused Node());621 if (frame && frame->document() && frame->document()->focusedElement()) 622 if (frame->document()->focusedElement()->hasTagName(HTMLNames::inputTag)) 623 inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedElement()); 624 624 625 625 if (inputElement) { -
trunk/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
r150214 r150796 434 434 Frame* focusedFrame = page->focusController()->focusedFrame(); 435 435 if (Document* focusedDocument = focusedFrame ? focusedFrame->document() : 0) 436 oldNode = focusedDocument->focused Node();436 oldNode = focusedDocument->focusedElement(); 437 437 438 438 if (tripleClickTimer.isActive() … … 452 452 focusedFrame = page->focusController()->focusedFrame(); 453 453 if (Document* focusedDocument = focusedFrame ? focusedFrame->document() : 0) 454 newNode = focusedDocument->focused Node();454 newNode = focusedDocument->focusedElement(); 455 455 456 456 if (newNode && oldNode != newNode) … … 512 512 513 513 if (client && client->inputMethodEnabled() 514 && frame->document()->focused Node()514 && frame->document()->focusedElement() 515 515 && button == Qt::LeftButton && qGuiApp->property("autoSipEnabled").toBool()) { 516 516 if (!clickCausedFocus || requestSoftwareInputPanel()) { … … 710 710 case Qt::ImMaximumTextLength: { 711 711 if (frame->selection()->isContentEditable()) { 712 if (frame->document() && frame->document()->focused Node()) {713 if (frame->document()->focused Node()->hasTagName(HTMLNames::inputTag)) {714 HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(frame->document()->focused Node());712 if (frame->document() && frame->document()->focusedElement()) { 713 if (frame->document()->focusedElement()->hasTagName(HTMLNames::inputTag)) { 714 HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedElement()); 715 715 return QVariant(inputElement->maxLength()); 716 716 } … … 1210 1210 if (frame) { 1211 1211 Document* document = frame->document(); 1212 hasFocus = document && document->focused Node();1212 hasFocus = document && document->focusedElement(); 1213 1213 } 1214 1214 return hasFocus; -
trunk/Source/WebKit/win/ChangeLog
r150772 r150796 1 2013-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 1 13 2013-05-27 Xueqing Huang <huangxueqing@baidu.com> 2 14 -
trunk/Source/WebKit/win/DOMCoreClasses.cpp
r150718 r150796 1217 1217 return E_FAIL; 1218 1218 1219 if (m_element->document()->focused Node() == m_element)1219 if (m_element->document()->focusedElement() == m_element) 1220 1220 *result = TRUE; 1221 1221 else -
trunk/Source/WebKit/win/WebView.cpp
r150712 r150796 5284 5284 if (m_page && m_page->focusController()) { 5285 5285 Frame* frame = m_page->focusController()->focusedOrMainFrame(); 5286 frame->document()->setFocused Node(0);5286 frame->document()->setFocusedElement(0); 5287 5287 m_page->focusController()->setInitialFocus(forward ? FocusDirectionForward : FocusDirectionBackward, 0); 5288 5288 } -
trunk/Source/WebKit2/ChangeLog
r150792 r150796 1 2013-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 1 14 2013-05-28 Gyuyoung Kim <gyuyoung.kim@samsung.com> 2 15 -
trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
r150771 r150796 1042 1042 page->focusController()->setFocusedElement(m_pluginElement.get(), frame()); 1043 1043 else 1044 frame()->document()->setFocusedNode(m_pluginElement);1044 frame()->document()->setFocusedElement(m_pluginElement); 1045 1045 } 1046 1046 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r150758 r150796 745 745 PluginDocument* pluginDocument = static_cast<PluginDocument*>(frame->document()); 746 746 747 if (pluginDocument->focused Node() != pluginDocument->pluginElement())747 if (pluginDocument->focusedElement() != pluginDocument->pluginElement()) 748 748 return 0; 749 749 … … 2049 2049 2050 2050 Frame* frame = m_page->focusController()->focusedOrMainFrame(); 2051 frame->document()->setFocused Node(0);2051 frame->document()->setFocusedElement(0); 2052 2052 2053 2053 if (isKeyboardEventValid && event.type() == WebEvent::KeyDown) {
Note: See TracChangeset
for help on using the changeset viewer.