summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/editing/suggestion
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-10-24 11:30:15 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-10-30 12:56:19 +0000
commit6036726eb981b6c4b42047513b9d3f4ac865daac (patch)
tree673593e70678e7789766d1f732eb51f613a2703b /chromium/third_party/blink/renderer/core/editing/suggestion
parent466052c4e7c052268fd931888cd58961da94c586 (diff)
downloadqtwebengine-chromium-6036726eb981b6c4b42047513b9d3f4ac865daac.tar.gz
BASELINE: Update Chromium to 70.0.3538.78
Change-Id: Ie634710bf039e26c1957f4ae45e101bd4c434ae7 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/editing/suggestion')
-rw-r--r--chromium/third_party/blink/renderer/core/editing/suggestion/text_suggestion_controller.cc24
-rw-r--r--chromium/third_party/blink/renderer/core/editing/suggestion/text_suggestion_controller_test.cc12
2 files changed, 20 insertions, 16 deletions
diff --git a/chromium/third_party/blink/renderer/core/editing/suggestion/text_suggestion_controller.cc b/chromium/third_party/blink/renderer/core/editing/suggestion/text_suggestion_controller.cc
index e66b7394c4c..f12657dda8e 100644
--- a/chromium/third_party/blink/renderer/core/editing/suggestion/text_suggestion_controller.cc
+++ b/chromium/third_party/blink/renderer/core/editing/suggestion/text_suggestion_controller.cc
@@ -102,6 +102,7 @@ EphemeralRangeInFlatTree ComputeRangeSurroundingCaret(
struct SuggestionInfosWithNodeAndHighlightColor {
STACK_ALLOCATED();
+ public:
Persistent<Node> text_node;
Color highlight_color;
Vector<TextSuggestionInfo> suggestion_infos;
@@ -224,8 +225,10 @@ void TextSuggestionController::HandlePotentialSuggestionTap(
const std::pair<const Node*, const DocumentMarker*>& node_and_marker =
FirstMarkerIntersectingRange(
- range_to_check, DocumentMarker::kSpelling | DocumentMarker::kGrammar |
- DocumentMarker::kSuggestion);
+ range_to_check,
+ DocumentMarker::MarkerTypes(DocumentMarker::kSpelling |
+ DocumentMarker::kGrammar |
+ DocumentMarker::kSuggestion));
if (!node_and_marker.first)
return;
@@ -255,7 +258,7 @@ void TextSuggestionController::ReplaceActiveSuggestionRange(
const HeapVector<std::pair<Member<Node>, Member<DocumentMarker>>>&
node_marker_pairs =
GetFrame().GetDocument()->Markers().MarkersIntersectingRange(
- range_to_check, DocumentMarker::kActiveSuggestion);
+ range_to_check, DocumentMarker::MarkerTypes::ActiveSuggestion());
if (node_marker_pairs.IsEmpty())
return;
@@ -291,7 +294,7 @@ void TextSuggestionController::ApplyTextSuggestion(int32_t marker_tag,
const HeapVector<std::pair<Member<Node>, Member<DocumentMarker>>>&
node_marker_pairs =
GetFrame().GetDocument()->Markers().MarkersIntersectingRange(
- range_to_check, DocumentMarker::kSuggestion);
+ range_to_check, DocumentMarker::MarkerTypes::Suggestion());
const Node* marker_text_node = nullptr;
SuggestionMarker* marker = nullptr;
@@ -356,7 +359,7 @@ void TextSuggestionController::OnSuggestionMenuClosed() {
return;
GetDocument().Markers().RemoveMarkersOfTypes(
- DocumentMarker::kActiveSuggestion);
+ DocumentMarker::MarkerTypes::ActiveSuggestion());
GetFrame().Selection().SetCaretVisible(true);
is_suggestion_menu_open_ = false;
}
@@ -381,7 +384,7 @@ void TextSuggestionController::SuggestionMenuTimeoutCallback(
const HeapVector<std::pair<Member<Node>, Member<DocumentMarker>>>&
node_suggestion_marker_pairs =
GetFrame().GetDocument()->Markers().MarkersIntersectingRange(
- range_to_check, DocumentMarker::kSuggestion);
+ range_to_check, DocumentMarker::MarkerTypes::Suggestion());
if (!node_suggestion_marker_pairs.IsEmpty()) {
ShowSuggestionMenu(node_suggestion_marker_pairs, max_number_of_suggestions);
return;
@@ -391,7 +394,7 @@ void TextSuggestionController::SuggestionMenuTimeoutCallback(
const HeapVector<std::pair<Member<Node>, Member<DocumentMarker>>>
node_spelling_marker_pairs =
GetFrame().GetDocument()->Markers().MarkersIntersectingRange(
- range_to_check, DocumentMarker::MisspellingMarkers());
+ range_to_check, DocumentMarker::MarkerTypes::Misspelling());
if (!node_spelling_marker_pairs.IsEmpty())
ShowSpellCheckMenu(node_spelling_marker_pairs.front());
@@ -416,7 +419,7 @@ void TextSuggestionController::ShowSpellCheckMenu(
GetFrame().Selection().SetCaretVisible(false);
GetDocument().Markers().AddActiveSuggestionMarker(
active_suggestion_range, SK_ColorTRANSPARENT,
- ui::mojom::ImeTextSpanThickness::kNone,
+ ws::mojom::ImeTextSpanThickness::kNone,
LayoutTheme::GetTheme().PlatformActiveSpellingMarkerHighlightColor());
Vector<String> suggestions;
@@ -478,7 +481,7 @@ void TextSuggestionController::ShowSuggestionMenu(
Position(text_node, span_union_end));
GetDocument().Markers().AddActiveSuggestionMarker(
- marker_range, SK_ColorTRANSPARENT, ui::mojom::ImeTextSpanThickness::kThin,
+ marker_range, SK_ColorTRANSPARENT, ws::mojom::ImeTextSpanThickness::kThin,
suggestion_infos_with_node_and_highlight_color.highlight_color);
is_suggestion_menu_open_ = true;
@@ -580,7 +583,8 @@ TextSuggestionController::FirstMarkerTouchingSelection(
void TextSuggestionController::AttemptToDeleteActiveSuggestionRange() {
const std::pair<const Node*, const DocumentMarker*>& node_and_marker =
- FirstMarkerTouchingSelection(DocumentMarker::kActiveSuggestion);
+ FirstMarkerTouchingSelection(
+ DocumentMarker::MarkerTypes::ActiveSuggestion());
if (!node_and_marker.first)
return;
diff --git a/chromium/third_party/blink/renderer/core/editing/suggestion/text_suggestion_controller_test.cc b/chromium/third_party/blink/renderer/core/editing/suggestion/text_suggestion_controller_test.cc
index f7906a27bbe..eab4b202994 100644
--- a/chromium/third_party/blink/renderer/core/editing/suggestion/text_suggestion_controller_test.cc
+++ b/chromium/third_party/blink/renderer/core/editing/suggestion/text_suggestion_controller_test.cc
@@ -13,7 +13,7 @@
#include "third_party/blink/renderer/core/editing/testing/editing_test_base.h"
#include "third_party/blink/renderer/core/editing/visible_selection.h"
-using ui::mojom::ImeTextSpanThickness;
+using ws::mojom::ImeTextSpanThickness;
namespace blink {
@@ -57,7 +57,7 @@ TEST_F(TextSuggestionControllerTest, ApplyTextSuggestion) {
"word1 word2 word3 word4"
"</div>");
Element* div = GetDocument().QuerySelector("div");
- Node* text = div->firstChild();
+ Text* text = ToText(div->firstChild());
// Add marker on "word1". This marker should *not* be cleared by the
// replace operation.
@@ -120,7 +120,7 @@ TEST_F(TextSuggestionControllerTest, ApplyTextSuggestion) {
// This returns the markers sorted by start offset; we need them sorted by
// start *and* end offset, since we have multiple markers starting at 0.
- DocumentMarkerVector markers = GetDocument().Markers().MarkersFor(text);
+ DocumentMarkerVector markers = GetDocument().Markers().MarkersFor(*text);
std::sort(markers.begin(), markers.end(),
[](const DocumentMarker* marker1, const DocumentMarker* marker2) {
if (marker1->StartOffset() != marker2->StartOffset())
@@ -169,7 +169,7 @@ TEST_F(TextSuggestionControllerTest,
"mispelled"
"</div>");
Element* div = GetDocument().QuerySelector("div");
- Node* text = div->firstChild();
+ Text* text = ToText(div->firstChild());
// Add marker on "mispelled". This marker should be cleared by the replace
// operation.
@@ -183,7 +183,7 @@ TEST_F(TextSuggestionControllerTest,
// Check the tag for the marker that was just added (the current tag value is
// not reset between test cases).
int32_t marker_tag =
- ToSuggestionMarker(GetDocument().Markers().MarkersFor(text)[0])->Tag();
+ ToSuggestionMarker(GetDocument().Markers().MarkersFor(*text)[0])->Tag();
// Select immediately before "mispelled".
GetDocument().GetFrame()->Selection().SetSelectionAndEndTyping(
@@ -195,7 +195,7 @@ TEST_F(TextSuggestionControllerTest,
GetDocument().GetFrame()->GetTextSuggestionController().ApplyTextSuggestion(
marker_tag, 0);
- EXPECT_EQ(0u, GetDocument().Markers().MarkersFor(text).size());
+ EXPECT_EQ(0u, GetDocument().Markers().MarkersFor(*text).size());
EXPECT_EQ("misspelled", text->textContent());
}