Changeset 173549 in webkit
- Timestamp:
- Sep 11, 2014, 5:40:09 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
editing/FrameSelection.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r173548 r173549 1 2014-09-11 Chris Dumez <cdumez@apple.com> 2 3 Simplify DOM tree traversal in FrameSelection::setSelectionFromNone() 4 https://bugs.webkit.org/show_bug.cgi?id=136763 5 6 Reviewed by Ryosuke Niwa. 7 8 We only need to traverse the direct children of the Document element to 9 find the body. The previous code was potentially traversing descendants. 10 The new code is consistent with Document::body() except that we only 11 look for an HTMLBodyElement (and ignore HTMLFrameSetElement). 12 13 Also update the code to use tighter typing for clarity. 14 15 No new tests, no behavior change. 16 17 * editing/FrameSelection.cpp: 18 (WebCore::FrameSelection::setSelectionFromNone): 19 1 20 2014-09-11 Chris Fleizach <cfleizach@apple.com> 2 21 -
trunk/Source/WebCore/editing/FrameSelection.cpp
r173246 r173549 42 42 #include "FrameView.h" 43 43 #include "GraphicsContext.h" 44 #include "HTMLBodyElement.h" 44 45 #include "HTMLFormElement.h" 45 46 #include "HTMLFrameElementBase.h" … … 2112 2113 #endif 2113 2114 2114 Node* node= document->documentElement();2115 while (node && !node->hasTagName(bodyTag))2116 node = NodeTraversal::next(node);2117 if ( node)2118 setSelection(VisibleSelection(firstPositionInOrBeforeNode( node), DOWNSTREAM));2115 Element* documentElement = document->documentElement(); 2116 if (!documentElement) 2117 return; 2118 if (auto body = childrenOfType<HTMLBodyElement>(*documentElement).first()) 2119 setSelection(VisibleSelection(firstPositionInOrBeforeNode(body), DOWNSTREAM)); 2119 2120 } 2120 2121
Note:
See TracChangeset
for help on using the changeset viewer.