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 |