Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/FrameSelection.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp |
| index 87da464c3e58dd84af4fe4492893e167581a7fb0..3628756a19139e70353fcef6f3d7562d2d43ca1e 100644 |
| --- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp |
| +++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp |
| @@ -223,7 +223,9 @@ static void adjustEndpointsAtBidiBoundary( |
| } |
| } |
| -void FrameSelection::setNonDirectionalSelectionIfNeeded( |
| +// TODO(yosin): We should move |setNonDirectionalSelectionIfNeeded()| to |
| +// "SelectionController.cpp" |
| +void SelectionController::setNonDirectionalSelectionIfNeeded( |
| const VisibleSelectionInFlatTree& passedNewSelection, |
| TextGranularity granularity, |
| EndPointsAdjustmentMode endpointsAdjustmentMode) { |
| @@ -256,7 +258,7 @@ void FrameSelection::setNonDirectionalSelectionIfNeeded( |
| newSelection.setBase(newBase); |
| newSelection.setExtent(newExtent); |
| } else if (originalBase.isNotNull()) { |
| - if (visibleSelection<EditingInFlatTreeStrategy>().base() == |
| + if (selection().visibleSelection<EditingInFlatTreeStrategy>().base() == |
| newSelection.base()) |
| newSelection.setBase(originalBase); |
| m_originalBaseInFlatTree = VisiblePositionInFlatTree(); |
| @@ -264,12 +266,13 @@ void FrameSelection::setNonDirectionalSelectionIfNeeded( |
| // Adjusting base and extent will make newSelection always directional |
| newSelection.setIsDirectional(isDirectional); |
| - if (visibleSelection<EditingInFlatTreeStrategy>() == newSelection) |
| + if (selection().visibleSelection<EditingInFlatTreeStrategy>() == newSelection) |
| return; |
| - const SetSelectionOptions options = CloseTyping | ClearTypingStyle; |
| - setSelection(newSelection, options, CursorAlignOnScroll::IfNeeded, |
| - granularity); |
| + const FrameSelection::SetSelectionOptions options = |
| + FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle; |
| + selection().setSelection(newSelection, options, CursorAlignOnScroll::IfNeeded, |
| + granularity); |
| } |
| template <typename Strategy> |
| @@ -813,7 +816,6 @@ void FrameSelection::documentAttached(Document* document) { |
| void FrameSelection::documentDetached(const Document& document) { |
| DCHECK_EQ(m_document, document); |
| m_document = nullptr; |
| - m_originalBaseInFlatTree = VisiblePositionInFlatTree(); |
| m_granularity = CharacterGranularity; |
| LayoutViewItem view = m_frame->contentLayoutItem(); |
| @@ -823,6 +825,7 @@ void FrameSelection::documentDetached(const Document& document) { |
| clearTypingStyle(); |
| m_selectionEditor->documentDetached(document); |
| m_frameCaret->documentDetached(); |
| + m_frame->eventHandler().selectionController().documentDetached(); |
|
Xiaocheng
2016/10/24 03:53:11
SelectionController::DocumentDetached doesn't seem
yosin_UTC9
2016/10/24 07:12:12
Done.
|
| } |
| LayoutBlock* FrameSelection::caretLayoutObject() const { |
| @@ -1368,7 +1371,6 @@ DEFINE_TRACE(FrameSelection) { |
| visitor->trace(m_frame); |
| visitor->trace(m_pendingSelection); |
| visitor->trace(m_selectionEditor); |
| - visitor->trace(m_originalBaseInFlatTree); |
| visitor->trace(m_typingStyle); |
| visitor->trace(m_frameCaret); |
| } |