Changeset 150709 in webkit
- Timestamp:
- May 25, 2013 10:05:37 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r150707 r150709 1 2013-05-25 Andreas Kling <akling@apple.com> 2 3 Move Node::isFocusable() to Element. 4 <http://webkit.org/b/116777> 5 6 Reviewed by Anders Carlsson. 7 8 Nodes cannot be focusable, so move isFocusable() from Node to Element. 9 10 * dom/Node.cpp: 11 * dom/Node.h: 12 * dom/Element.h: 13 * dom/Element.cpp: 14 (WebCore::Element::isFocusable): 15 16 Moved here from Node. 17 18 * dom/Document.cpp: 19 (WebCore::Document::setFocusedNode): 20 * accessibility/AccessibilityNodeObject.cpp: 21 (WebCore::AccessibilityNodeObject::determineAccessibilityRole): 22 23 Check that the underlying node is an Element before asking if it's focusable. 24 25 * page/FrameView.cpp: 26 (WebCore::FrameView::scrollToAnchor): 27 28 Renamed the 'anchorNode' variable to 'anchorElement' because reasons. 29 30 * html/HTMLAreaElement.h: 31 * html/HTMLFormControlElement.h: 32 * html/HTMLLabelElement.h: 33 * html/HTMLOptionElement.h: 34 * svg/SVGAElement.h: 35 36 Sprinkle OVERRIDE. 37 38 * html/ValidationMessage.cpp: 39 (WebCore::ValidationMessage::setMessage): 40 41 Update a comment to refer to Element::isFocusable() instead of Node. 42 1 43 2013-05-25 Andreas Kling <akling@apple.com> 2 44 -
trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp
r150684 r150709 316 316 if (node()->hasTagName(labelTag)) 317 317 return LabelRole; 318 if (node()->is Focusable())318 if (node()->isElementNode() && toElement(node())->isFocusable()) 319 319 return GroupRole; 320 320 -
trunk/Source/WebCore/dom/Document.cpp
r150700 r150709 3387 3387 } 3388 3388 3389 if (newFocusedNode && newFocusedNode->is Focusable()) {3389 if (newFocusedNode && newFocusedNode->isElementNode() && toElement(newFocusedNode.get())->isFocusable()) { 3390 3390 if (newFocusedNode->isRootEditableElement() && !acceptsEditingFocus(newFocusedNode.get())) { 3391 3391 // delegate blocks focus change -
trunk/Source/WebCore/dom/Element.cpp
r150697 r150709 418 418 } 419 419 420 bool Element::isFocusable() const 421 { 422 if (!inDocument() || !supportsFocus()) 423 return false; 424 425 // Elements in canvas fallback content are not rendered, but they are allowed to be 426 // focusable as long as their canvas is displayed and visible. 427 if (isInCanvasSubtree()) { 428 const Element* e = this; 429 while (e && !e->hasLocalName(canvasTag)) 430 e = e->parentElement(); 431 ASSERT(e); 432 return e->renderer() && e->renderer()->style()->visibility() == VISIBLE; 433 } 434 435 if (renderer()) 436 ASSERT(!renderer()->needsLayout()); 437 else { 438 // If the node is in a display:none tree it might say it needs style recalc but 439 // the whole document is actually up to date. 440 ASSERT(!document()->childNeedsStyleRecalc()); 441 } 442 443 // FIXME: Even if we are not visible, we might have a child that is visible. 444 // Hyatt wants to fix that some day with a "has visible content" flag or the like. 445 if (!renderer() || renderer()->style()->visibility() != VISIBLE) 446 return false; 447 448 return true; 449 } 450 420 451 bool Element::isUserActionElementFocused() const 421 452 { -
trunk/Source/WebCore/dom/Element.h
r150707 r150709 433 433 virtual void setFocus(bool flag); 434 434 435 virtual bool isFocusable() const; 435 436 virtual bool isKeyboardFocusable(KeyboardEvent*) const; 436 437 virtual bool isMouseFocusable() const; -
trunk/Source/WebCore/dom/Node.cpp
r150707 r150709 851 851 } 852 852 853 bool Node::isFocusable() const854 {855 if (!inDocument() || !supportsFocus())856 return false;857 858 // Elements in canvas fallback content are not rendered, but they are allowed to be859 // focusable as long as their canvas is displayed and visible.860 if (isElementNode() && toElement(this)->isInCanvasSubtree()) {861 const Element* e = toElement(this);862 while (e && !e->hasLocalName(canvasTag))863 e = e->parentElement();864 ASSERT(e);865 return e->renderer() && e->renderer()->style()->visibility() == VISIBLE;866 }867 868 if (renderer())869 ASSERT(!renderer()->needsLayout());870 else871 // If the node is in a display:none tree it might say it needs style recalc but872 // the whole document is actually up to date.873 ASSERT(!document()->childNeedsStyleRecalc());874 875 // FIXME: Even if we are not visible, we might have a child that is visible.876 // Hyatt wants to fix that some day with a "has visible content" flag or the like.877 if (!renderer() || renderer()->style()->visibility() != VISIBLE)878 return false;879 880 return true;881 }882 883 853 unsigned Node::nodeIndex() const 884 854 { -
trunk/Source/WebCore/dom/Node.h
r150707 r150709 403 403 // not focusable but some elements, such as form controls and links, are. 404 404 virtual bool supportsFocus() const; 405 // Whether the node can actually be focused.406 virtual bool isFocusable() const;407 405 408 406 enum UserSelectAllTreatment { -
trunk/Source/WebCore/html/HTMLAreaElement.h
r150692 r150709 56 56 virtual bool isKeyboardFocusable(KeyboardEvent*) const OVERRIDE; 57 57 virtual bool isMouseFocusable() const OVERRIDE; 58 virtual bool isFocusable() const ;58 virtual bool isFocusable() const OVERRIDE; 59 59 virtual void updateFocusAppearance(bool /*restorePreviousSelection*/); 60 60 virtual void setFocus(bool) OVERRIDE; -
trunk/Source/WebCore/html/HTMLFormControlElement.h
r150707 r150709 67 67 virtual bool isDisabledFormControl() const OVERRIDE; 68 68 69 virtual bool isFocusable() const ;69 virtual bool isFocusable() const OVERRIDE; 70 70 virtual bool isEnumeratable() const { return false; } 71 71 -
trunk/Source/WebCore/html/HTMLLabelElement.h
r150684 r150709 42 42 HTMLLabelElement(const QualifiedName&, Document*); 43 43 44 virtual bool isFocusable() const ;44 virtual bool isFocusable() const OVERRIDE; 45 45 46 46 virtual void accessKeyAction(bool sendMouseEvents); -
trunk/Source/WebCore/html/HTMLOptionElement.h
r149960 r150709 71 71 72 72 virtual bool supportsFocus() const; 73 virtual bool isFocusable() const ;73 virtual bool isFocusable() const OVERRIDE; 74 74 virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; } 75 75 virtual void attach(); -
trunk/Source/WebCore/html/ValidationMessage.cpp
r142247 r150709 111 111 112 112 // Don't modify the DOM tree in this context. 113 // If so, an assertion in Node::isFocusable() fails.113 // If so, an assertion in Element::isFocusable() fails. 114 114 ASSERT(!message.isEmpty()); 115 115 m_message = message; -
trunk/Source/WebCore/page/FrameView.cpp
r150666 r150709 1843 1843 m_frame->document()->setGotoAnchorNeededAfterStylesheetsLoad(false); 1844 1844 1845 Element* anchor Node= m_frame->document()->findAnchor(name);1845 Element* anchorElement = m_frame->document()->findAnchor(name); 1846 1846 1847 1847 // Setting to null will clear the current target. 1848 m_frame->document()->setCSSTarget(anchor Node);1848 m_frame->document()->setCSSTarget(anchorElement); 1849 1849 1850 1850 #if ENABLE(SVG) 1851 1851 if (m_frame->document()->isSVGDocument()) { 1852 1852 if (SVGSVGElement* svg = toSVGDocument(m_frame->document())->rootElement()) { 1853 svg->setupInitialView(name, anchor Node);1854 if (!anchor Node)1853 svg->setupInitialView(name, anchorElement); 1854 if (!anchorElement) 1855 1855 return true; 1856 1856 } … … 1859 1859 1860 1860 // Implement the rule that "" and "top" both mean top of page as in other browsers. 1861 if (!anchor Node&& !(name.isEmpty() || equalIgnoringCase(name, "top")))1861 if (!anchorElement && !(name.isEmpty() || equalIgnoringCase(name, "top"))) 1862 1862 return false; 1863 1863 1864 maintainScrollPositionAtAnchor(anchor Node ? static_cast<Node*>(anchorNode) : m_frame->document());1864 maintainScrollPositionAtAnchor(anchorElement ? static_cast<Node*>(anchorElement) : m_frame->document()); 1865 1865 1866 1866 // If the anchor accepts keyboard focus, move focus there to aid users relying on keyboard navigation. 1867 if (anchor Node && anchorNode->isFocusable())1868 m_frame->document()->setFocusedNode(anchor Node);1867 if (anchorElement && anchorElement->isFocusable()) 1868 m_frame->document()->setFocusedNode(anchorElement); 1869 1869 1870 1870 return true; -
trunk/Source/WebCore/svg/SVGAElement.h
r150692 r150709 60 60 virtual bool isMouseFocusable() const OVERRIDE; 61 61 virtual bool isKeyboardFocusable(KeyboardEvent*) const OVERRIDE; 62 virtual bool isFocusable() const ;62 virtual bool isFocusable() const OVERRIDE; 63 63 virtual bool isURLAttribute(const Attribute&) const; 64 64
Note: See TracChangeset
for help on using the changeset viewer.