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

Unified Diff: third_party/WebKit/Source/core/editing/LayoutSelection.cpp

Issue 2800813006: Move layouet/LayoutView::setSelection() to editing/LayoutSelection (Closed)
Patch Set: nit Created 3 years, 8 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
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..540146afea59317b2f41c95f2de8b3f74415c3f7 100644
--- a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp
@@ -32,7 +32,12 @@
namespace blink {
LayoutSelection::LayoutSelection(FrameSelection& frame_selection)
- : frame_selection_(&frame_selection), has_pending_selection_(false) {}
+ : frame_selection_(&frame_selection),
+ 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) {

Powered by Google App Engine
This is Rietveld 408576698