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

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

Issue 1288883002: Make SelectionController not to set invalid selection by mouse down (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-13T18:48:09 Created 5 years, 4 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 8d0e83dcff0230bf94efb0f9a7f9fb90a9c5e6fb..52a649e6c7de3fadedd5e7ad63c318882823ed33 100644
--- a/Source/core/editing/VisibleSelection.cpp
+++ b/Source/core/editing/VisibleSelection.cpp
@@ -738,6 +738,18 @@ void VisibleSelection::resetPositionsInComposedTree()
adjustStartAndEndInComposedTree();
}
+bool VisibleSelection::isValidFor(const Document& document) const
+{
+ if (isNone())
+ return true;
+
+ return m_base.document() == &document
+ && !m_base.isOrphan() && !m_extent.isOrphan()
+ && !m_start.isOrphan() && !m_end.isOrphan()
+ && !m_baseInComposedTree.isOrphan() && !m_extentInComposedTree.isOrphan()
+ && !m_startInComposedTree.isOrphan() && !m_endInComposedTree.isOrphan();
+}
+
// FIXME: This function breaks the invariant of this class.
// But because we use VisibleSelection to store values in editing commands for use when
// undoing the command, we need to be able to create a selection that while currently
« 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