Title: [173549] trunk/Source/WebCore
- Revision
- 173549
- Author
- cdu...@apple.com
- Date
- 2014-09-11 17:40:09 -0700 (Thu, 11 Sep 2014)
Log Message
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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (173548 => 173549)
--- trunk/Source/WebCore/ChangeLog 2014-09-12 00:32:05 UTC (rev 173548)
+++ trunk/Source/WebCore/ChangeLog 2014-09-12 00:40:09 UTC (rev 173549)
@@ -1,3 +1,22 @@
+2014-09-11 Chris Dumez <cdu...@apple.com>
+
+ 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):
+
2014-09-11 Chris Fleizach <cfleiz...@apple.com>
AX: Size of web view in Safari as reported by AX changes when adding/removing bars is wrong
Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (173548 => 173549)
--- trunk/Source/WebCore/editing/FrameSelection.cpp 2014-09-12 00:32:05 UTC (rev 173548)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp 2014-09-12 00:40:09 UTC (rev 173549)
@@ -41,6 +41,7 @@
#include "FrameTree.h"
#include "FrameView.h"
#include "GraphicsContext.h"
+#include "HTMLBodyElement.h"
#include "HTMLFormElement.h"
#include "HTMLFrameElementBase.h"
#include "HTMLInputElement.h"
@@ -2111,11 +2112,11 @@
return;
#endif
- Node* node = document->documentElement();
- while (node && !node->hasTagName(bodyTag))
- node = NodeTraversal::next(node);
- if (node)
- setSelection(VisibleSelection(firstPositionInOrBeforeNode(node), DOWNSTREAM));
+ Element* documentElement = document->documentElement();
+ if (!documentElement)
+ return;
+ if (auto body = childrenOfType<HTMLBodyElement>(*documentElement).first())
+ setSelection(VisibleSelection(firstPositionInOrBeforeNode(body), DOWNSTREAM));
}
bool FrameSelection::shouldChangeSelection(const VisibleSelection& newSelection) const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes