#include "third_party/blink/renderer/core/editing/suggestion/text_suggestion_controller.h"
#include "base/ranges/algorithm.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "third_party/blink/renderer/core/editing/editing_utilities.h"
#include "third_party/blink/renderer/core/editing/editor.h"
#include "third_party/blink/renderer/core/editing/ephemeral_range.h"
#include "third_party/blink/renderer/core/editing/frame_selection.h"
#include "third_party/blink/renderer/core/editing/markers/document_marker_controller.h"
#include "third_party/blink/renderer/core/editing/markers/spell_check_marker.h"
#include "third_party/blink/renderer/core/editing/markers/suggestion_marker.h"
#include "third_party/blink/renderer/core/editing/markers/suggestion_marker_replacement_scope.h"
#include "third_party/blink/renderer/core/editing/plain_text_range.h"
#include "third_party/blink/renderer/core/editing/position.h"
#include "third_party/blink/renderer/core/editing/selection_template.h"
#include "third_party/blink/renderer/core/editing/spellcheck/spell_checker.h"
#include "third_party/blink/renderer/core/editing/suggestion/text_suggestion_info.h"
#include "third_party/blink/renderer/core/frame/frame_view.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/layout/layout_theme.h"
namespace blink {
namespace {
bool ShouldDeleteNextCharacter(const Node& marker_text_node,
const DocumentMarker& marker) { … }
EphemeralRangeInFlatTree ComputeRangeSurroundingCaret(
const PositionInFlatTree& caret_position) { … }
struct SuggestionInfosWithNodeAndHighlightColor { … };
SuggestionInfosWithNodeAndHighlightColor ComputeSuggestionInfos(
const HeapVector<std::pair<Member<const Text>, Member<DocumentMarker>>>&
node_suggestion_marker_pairs,
size_t max_number_of_suggestions) { … }
}
TextSuggestionController::TextSuggestionController(LocalDOMWindow& window)
: … { … }
bool TextSuggestionController::IsMenuOpen() const { … }
void TextSuggestionController::HandlePotentialSuggestionTap(
const PositionInFlatTree& caret_position) { … }
void TextSuggestionController::Trace(Visitor* visitor) const { … }
void TextSuggestionController::ReplaceActiveSuggestionRange(
const String& suggestion) { … }
void TextSuggestionController::ApplySpellCheckSuggestion(
const String& suggestion) { … }
void TextSuggestionController::ApplyTextSuggestion(int32_t marker_tag,
uint32_t suggestion_index) { … }
void TextSuggestionController::DeleteActiveSuggestionRange() { … }
void TextSuggestionController::OnNewWordAddedToDictionary(const String& word) { … }
void TextSuggestionController::OnSuggestionMenuClosed() { … }
void TextSuggestionController::SuggestionMenuTimeoutCallback(
size_t max_number_of_suggestions) { … }
void TextSuggestionController::ShowSpellCheckMenu(
const std::pair<const Text*, DocumentMarker*>& node_spelling_marker_pair) { … }
void TextSuggestionController::ShowSuggestionMenu(
const HeapVector<std::pair<Member<const Text>, Member<DocumentMarker>>>&
node_suggestion_marker_pairs,
size_t max_number_of_suggestions) { … }
void TextSuggestionController::CallMojoShowTextSuggestionMenu(
const Vector<TextSuggestionInfo>& text_suggestion_infos,
const String& misspelled_word) { … }
Document& TextSuggestionController::GetDocument() const { … }
bool TextSuggestionController::IsAvailable() const { … }
LocalFrame& TextSuggestionController::GetFrame() const { … }
std::pair<const Node*, const DocumentMarker*>
TextSuggestionController::FirstMarkerIntersectingRange(
const EphemeralRangeInFlatTree& range,
DocumentMarker::MarkerTypes types) const { … }
std::pair<const Node*, const DocumentMarker*>
TextSuggestionController::FirstMarkerTouchingSelection(
DocumentMarker::MarkerTypes types) const { … }
void TextSuggestionController::AttemptToDeleteActiveSuggestionRange() { … }
void TextSuggestionController::ReplaceRangeWithText(const EphemeralRange& range,
const String& replacement) { … }
}