Index: third_party/WebKit/Source/core/editing/PendingSelection.cpp |
diff --git a/third_party/WebKit/Source/core/editing/PendingSelection.cpp b/third_party/WebKit/Source/core/editing/PendingSelection.cpp |
index 1b106656d49673990d8f12016ed2f04fad889264..6317e9a83b714e578d9016c6384677ea3b644ee6 100644 |
--- a/third_party/WebKit/Source/core/editing/PendingSelection.cpp |
+++ b/third_party/WebKit/Source/core/editing/PendingSelection.cpp |
@@ -38,23 +38,6 @@ const VisibleSelection& PendingSelection::visibleSelection() const { |
return m_frameSelection->computeVisibleSelectionInDOMTree(); |
} |
-static bool isSelectionInDocument( |
- const VisibleSelectionInFlatTree& visibleSelection, |
- const Document& document) { |
- const PositionInFlatTree& start = visibleSelection.start(); |
- if (start.isNotNull() && |
- (!start.isConnected() || start.document() != document)) |
- return false; |
- const PositionInFlatTree& end = visibleSelection.end(); |
- if (end.isNotNull() && (!end.isConnected() || end.document() != document)) |
- return false; |
- const PositionInFlatTree extent = visibleSelection.extent(); |
- if (extent.isNotNull() && |
- (!extent.isConnected() || extent.document() != document)) |
- return false; |
- return true; |
-} |
- |
SelectionInFlatTree PendingSelection::calcVisibleSelection( |
const VisibleSelectionInFlatTree& originalSelection) const { |
const PositionInFlatTree& start = originalSelection.start(); |
@@ -126,7 +109,8 @@ void PendingSelection::commit(LayoutView& layoutView) { |
const VisibleSelectionInFlatTree& selection = |
createVisibleSelection(calcVisibleSelection(originalSelection)); |
- if (!selection.isRange()) { |
+ const LocalFrame& frame = *layoutView.document().frame(); |
+ if (!selection.isRange() || !selectionHasFocus(frame)) { |
layoutView.clearSelection(); |
return; |
} |