Changeset 150783 in webkit
- Timestamp:
- May 27, 2013 4:53:47 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r150782 r150783 1 2013-05-27 Darin Adler <darin@apple.com> 2 3 Move hasNonEmptyBoundingBox from Node to HTMLAnchorElement 4 https://bugs.webkit.org/show_bug.cgi?id=116842 5 6 Reviewed by Antti Koivisto. 7 8 * dom/Node.cpp: Removed hasNonEmptyBoundingBox. 9 * dom/Node.h: Ditto. 10 11 * html/HTMLAnchorElement.cpp: 12 (WebCore::HTMLAnchorElement::isMouseFocusable): Fixed #if to be more readable and 13 added more-explicit clearer comments. No behavior change. 14 (WebCore::hasNonEmptyBox): Added. Has the same code that was in 15 Node::hasNonEmptyBoundingBox with some additional comments. 16 (WebCore::HTMLAnchorElement::isKeyboardFocusable): Call hasNonEmptyBox. 17 1 18 2013-05-27 Darin Adler <darin@apple.com> 2 19 -
trunk/Source/WebCore/dom/Node.cpp
r150782 r150783 774 774 } 775 775 776 bool Node::hasNonEmptyBoundingBox() const777 {778 // Before calling absoluteRects, check for the common case where the renderer779 // is non-empty, since this is a faster check and almost always returns true.780 RenderBoxModelObject* box = renderBoxModelObject();781 if (!box)782 return false;783 if (!box->borderBoundingBox().isEmpty())784 return true;785 786 Vector<IntRect> rects;787 FloatPoint absPos = renderer()->localToAbsolute();788 renderer()->absoluteRects(rects, flooredLayoutPoint(absPos));789 size_t n = rects.size();790 for (size_t i = 0; i < n; ++i)791 if (!rects[i].isEmpty())792 return true;793 794 return false;795 }796 797 776 inline void Node::setStyleChange(StyleChangeType changeType) 798 777 { -
trunk/Source/WebCore/dom/Node.h
r150782 r150783 427 427 IntRect pixelSnappedRenderRect(bool* isReplaced) { return pixelSnappedIntRect(renderRect(isReplaced)); } 428 428 429 // Returns true if the node has a non-empty bounding box in layout.430 // This does not 100% guarantee the user can see it, but is pretty close.431 // Note: This method only works properly after layout has occurred.432 bool hasNonEmptyBoundingBox() const;433 434 429 unsigned nodeIndex() const; 435 430 -
trunk/Source/WebCore/html/HTMLAnchorElement.cpp
r150715 r150783 95 95 bool HTMLAnchorElement::isMouseFocusable() const 96 96 { 97 // Anchor elements should be mouse focusable, https://bugs.webkit.org/show_bug.cgi?id=26856 98 #if !PLATFORM(GTK) && !PLATFORM(QT) && !PLATFORM(EFL) 97 #if !(PLATFORM(EFL) || PLATFORM(GTK) || PLATFORM(QT)) 98 // Only allow links with tabIndex or contentEditable to be mouse focusable. 99 // This is our rule for the Mac platform; on many other platforms we focus any link you click on. 99 100 if (isLink()) 100 // Only allow links with tabIndex or contentEditable to be mouse focusable.101 101 return HTMLElement::supportsFocus(); 102 102 #endif 103 103 104 // Allow tab index etc to control focus.105 104 return HTMLElement::isMouseFocusable(); 105 } 106 107 static bool hasNonEmptyBox(RenderModelBoxObject* renderer) 108 { 109 if (!renderer) 110 return false; 111 112 // Before calling absoluteRects, check for the common case where borderBoundingBox 113 // is non-empty, since this is a faster check and almost always returns true. 114 // FIXME: Why do we need to call absoluteRects at all? 115 if (!renderer->borderBoundingBox().isEmpty()) 116 return true; 117 118 // FIXME: Since all we are checking is whether the rects are empty, could we just 119 // pass in 0,0 for the layout point instead of calling localToAbsolute? 120 Vector<IntRect> rects; 121 renderer->absoluteRects(rects, flooredLayoutPoint(renderer->localToAbsolute())); 122 size_t size = rects.size(); 123 for (size_t i = 0; i < size; ++i) { 124 if (!rects[i].isEmpty()) 125 return true; 126 } 127 128 return false; 106 129 } 107 130 … … 123 146 return true; 124 147 125 return hasNonEmptyBo undingBox();148 return hasNonEmptyBox(renderBoxModelObject()); 126 149 } 127 150
Note: See TracChangeset
for help on using the changeset viewer.