#include "third_party/blink/renderer/core/editing/ime/stylus_writing_gesture.h"
#include "third_party/blink/public/mojom/input/stylus_writing_gesture.mojom-blink.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/ime/input_method_controller.h"
#include "third_party/blink/renderer/core/editing/iterators/text_iterator.h"
#include "third_party/blink/renderer/core/editing/plain_text_range.h"
#include "third_party/blink/renderer/core/editing/selection_template.h"
#include "third_party/blink/renderer/core/html/parser/html_parser_idioms.h"
namespace blink {
namespace {
class StylusWritingTwoRectGesture : public StylusWritingGesture { … };
class StylusWritingGestureDelete : public StylusWritingTwoRectGesture { … };
class StylusWritingGestureRemoveSpaces : public StylusWritingTwoRectGesture { … };
class StylusWritingGestureSelect : public StylusWritingTwoRectGesture { … };
class StylusWritingGestureAddText : public StylusWritingGesture { … };
class StylusWritingGestureSplitOrMerge : public StylusWritingGesture { … };
std::unique_ptr<StylusWritingGesture> CreateGesture(
mojom::blink::StylusWritingGestureDataPtr gesture_data) { … }
PlainTextRange ExpandWithWordGranularity(
EphemeralRange ephemeral_range,
Element* const root_editable_element,
InputMethodController& input_method_controller) { … }
std::optional<PlainTextRange> GestureRangeForPoints(
LocalFrame* local_frame,
const gfx::Point& start_point,
const gfx::Point& end_point,
const mojom::blink::StylusWritingGestureGranularity granularity) { … }
std::optional<PlainTextRange> GetTextRangeForSpaces(
PlainTextRange& gesture_range,
const String& gesture_text) { … }
}
mojom::blink::HandwritingGestureResult StylusWritingGesture::ApplyGesture(
LocalFrame* local_frame,
mojom::blink::StylusWritingGestureDataPtr gesture_data) { … }
StylusWritingGesture::StylusWritingGesture(const gfx::Rect& start_rect,
const String& text_alternative)
: … { … }
wtf_size_t StylusWritingGesture::GetStartTextIndex(LocalFrame* local_frame) { … }
StylusWritingTwoRectGesture::StylusWritingTwoRectGesture(
const gfx::Rect& start_rect,
const gfx::Rect& end_rect,
const String& text_alternative)
: … { … }
std::optional<PlainTextRange> StylusWritingTwoRectGesture::GestureRange(
LocalFrame* local_frame,
const mojom::blink::StylusWritingGestureGranularity granularity) { … }
StylusWritingGestureDelete::StylusWritingGestureDelete(
const gfx::Rect& start_rect,
const gfx::Rect& end_rect,
const String& text_alternative,
const mojom::blink::StylusWritingGestureGranularity granularity)
: … { … }
bool StylusWritingGestureDelete::MaybeApplyGesture(LocalFrame* frame) { … }
std::optional<PlainTextRange> StylusWritingGestureDelete::AdjustRange(
std::optional<PlainTextRange> range,
InputMethodController& input_method_controller) { … }
StylusWritingGestureRemoveSpaces::StylusWritingGestureRemoveSpaces(
const gfx::Rect& start_rect,
const gfx::Rect& end_rect,
const String& text_alternative)
: … { … }
bool StylusWritingGestureRemoveSpaces::MaybeApplyGesture(LocalFrame* frame) { … }
StylusWritingGestureSelect::StylusWritingGestureSelect(
const gfx::Rect& start_rect,
const gfx::Rect& end_rect,
const String& text_alternative,
const mojom::StylusWritingGestureGranularity granularity)
: … { … }
bool StylusWritingGestureSelect::MaybeApplyGesture(LocalFrame* frame) { … }
std::optional<PlainTextRange> StylusWritingGestureSelect::AdjustRange(
std::optional<PlainTextRange> range,
InputMethodController& input_method_controller) { … }
StylusWritingGestureAddText::StylusWritingGestureAddText(
const gfx::Rect& start_rect,
const String& text_to_insert,
const String& text_alternative)
: … { … }
bool StylusWritingGestureAddText::MaybeApplyGesture(LocalFrame* frame) { … }
StylusWritingGestureSplitOrMerge::StylusWritingGestureSplitOrMerge(
const gfx::Rect& start_rect,
const String& text_alternative)
: … { … }
bool StylusWritingGestureSplitOrMerge::MaybeApplyGesture(LocalFrame* frame) { … }
}