Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(889)

Unified Diff: Source/core/editing/VisibleSelection.cpp

Issue 541633004: Avoid temporary range allocation in FrameSelection::respondToNodeModification. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address review comments. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/editing/VisibleSelection.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/VisibleSelection.cpp
diff --git a/Source/core/editing/VisibleSelection.cpp b/Source/core/editing/VisibleSelection.cpp
index 411437768c0c3bf2662cf67cf1c0bde506e3a3eb..13543de8bc310dcb3a9b7cc4b3c069aae5686b52 100644
--- a/Source/core/editing/VisibleSelection.cpp
+++ b/Source/core/editing/VisibleSelection.cpp
@@ -192,6 +192,16 @@ PassRefPtrWillBeRawPtr<Range> VisibleSelection::firstRange() const
return Range::create(*start.document(), start, end);
}
+bool VisibleSelection::intersectsNode(Node* node) const
+{
+ if (isNone())
+ return false;
+ Position start = m_start.parentAnchoredEquivalent();
+ Position end = m_end.parentAnchoredEquivalent();
+ TrackExceptionState exceptionState;
+ return Range::intersectsNode(node, start, end, exceptionState) && !exceptionState.hadException();
+}
+
PassRefPtrWillBeRawPtr<Range> VisibleSelection::toNormalizedRange() const
{
if (isNone())
« no previous file with comments | « Source/core/editing/VisibleSelection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698