Index: third_party/WebKit/Source/core/editing/LayoutSelection.cpp |
diff --git a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp |
index 94e940e64aafc89983658ae60cd20f2586b09209..c642d71bebf080c0da96a5d94666819ac35b303b 100644 |
--- a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp |
+++ b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp |
@@ -31,8 +31,13 @@ |
namespace blink { |
-LayoutSelection::LayoutSelection(FrameSelection& frame_selection) |
- : frame_selection_(&frame_selection), has_pending_selection_(false) {} |
+LayoutSelection::LayoutSelection(FrameSelection& frameSelection) |
dcheng
2017/04/11 06:29:14
Nit: mind fixing the name to be frame_selection?
yoichio
2017/04/11 07:23:58
Done.
|
+ : frame_selection_(&frameSelection), |
+ has_pending_selection_(false), |
+ selection_start_(nullptr), |
+ selection_end_(nullptr), |
+ selection_start_pos_(-1), |
+ selection_end_pos_(-1) {} |
const VisibleSelection& LayoutSelection::GetVisibleSelection() const { |
return frame_selection_->ComputeVisibleSelectionInDOMTree(); |
@@ -127,7 +132,7 @@ void LayoutSelection::Commit(LayoutView& layout_view) { |
CreateVisibleSelection(CalcVisibleSelection(original_selection)); |
if (!selection.IsRange()) { |
- layout_view.ClearSelection(); |
+ ClearSelection(); |
return; |
} |
@@ -159,9 +164,16 @@ void LayoutSelection::Commit(LayoutView& layout_view) { |
return; |
DCHECK(layout_view == start_layout_object->View()); |
DCHECK(layout_view == end_layout_object->View()); |
- layout_view.SetSelection(start_layout_object, |
- start_pos.ComputeEditingOffset(), end_layout_object, |
- end_pos.ComputeEditingOffset()); |
+ SetSelection(start_layout_object, start_pos.ComputeEditingOffset(), |
+ end_layout_object, end_pos.ComputeEditingOffset()); |
+} |
+ |
+void LayoutSelection::OnDocumentShutdown() { |
+ has_pending_selection_ = false; |
+ selection_start_ = nullptr; |
+ selection_end_ = nullptr; |
+ selection_start_pos_ = -1; |
+ selection_end_pos_ = -1; |
} |
DEFINE_TRACE(LayoutSelection) { |