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 1dccdebda0a3ee1b88a8e1343b95427310c1fd8c..772eaad7f91dc4254325223a36f19fe8f9e3e4dc 100644 |
--- a/third_party/WebKit/Source/core/editing/LayoutSelection.cpp |
+++ b/third_party/WebKit/Source/core/editing/LayoutSelection.cpp |
@@ -35,6 +35,7 @@ namespace blink { |
LayoutSelection::LayoutSelection(FrameSelection& frame_selection) |
: frame_selection_(&frame_selection), |
has_pending_selection_(false), |
+ force_hide_(false), |
selection_start_(nullptr), |
selection_end_(nullptr), |
selection_start_pos_(-1), |
@@ -337,6 +338,14 @@ void LayoutSelection::ClearSelection() { |
SetSelection(0, -1, 0, -1, kPaintInvalidationNewMinusOld); |
} |
+void LayoutSelection::SetHasPendingSelection(PaintHint hint) { |
+ has_pending_selection_ = true; |
+ if (hint == PaintHint::kHide) |
+ force_hide_ = true; |
+ else if (hint == PaintHint::kPaint) |
+ force_hide_ = false; |
+} |
+ |
void LayoutSelection::Commit(LayoutView& layout_view) { |
if (!HasPendingSelection()) |
return; |
@@ -357,7 +366,7 @@ void LayoutSelection::Commit(LayoutView& layout_view) { |
const VisibleSelectionInFlatTree& selection = |
CreateVisibleSelection(CalcVisibleSelection(original_selection)); |
- if (!selection.IsRange()) { |
+ if (!selection.IsRange() || force_hide_) { |
ClearSelection(); |
return; |
} |
@@ -396,6 +405,7 @@ void LayoutSelection::Commit(LayoutView& layout_view) { |
void LayoutSelection::OnDocumentShutdown() { |
has_pending_selection_ = false; |
+ force_hide_ = false; |
selection_start_ = nullptr; |
selection_end_ = nullptr; |
selection_start_pos_ = -1; |