Simplify DOM tree traversal in FrameSelection::setSelectionFromNone()
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Sep 2014 00:40:09 +0000 (00:40 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Sep 2014 00:40:09 +0000 (00:40 +0000)
commit40e10a321f89909d685d2ad60f435d1fa5fda3a5
tree507b4d3d4b77b616ea707a19abcd102d170ff60a
parent43a33798a6c3f61242e41f08bdad293cacf923cf
Simplify DOM tree traversal in FrameSelection::setSelectionFromNone()
https://bugs.webkit.org/show_bug.cgi?id=136763

Reviewed by Ryosuke Niwa.

We only need to traverse the direct children of the Document element to
find the body. The previous code was potentially traversing descendants.
The new code is consistent with Document::body() except that we only
look for an HTMLBodyElement (and ignore HTMLFrameSetElement).

Also update the code to use tighter typing for clarity.

No new tests, no behavior change.

* editing/FrameSelection.cpp:
(WebCore::FrameSelection::setSelectionFromNone):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173549 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/editing/FrameSelection.cpp