| Flutter macOS Embedder |

text_editing_delta.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "flutter/shell/platform/common/text_editing_delta.h"
6
7 #include "flutter/fml/string_conversion.h"
8
9 namespace flutter {
10
11 TextEditingDelta::TextEditingDelta(const std::u16string& text_before_change,
12 const TextRange& range,
13 const std::u16string& text)
14 : old_text_(text_before_change),
15 delta_text_(text),
16 delta_start_(range.start()),
17 delta_end_(range.start() + range.length()) {}
18
19 TextEditingDelta::TextEditingDelta(const std::string& text_before_change,
20 const TextRange& range,
21 const std::string& text)
22 : old_text_(fml::Utf8ToUtf16(text_before_change)),
23 delta_text_(fml::Utf8ToUtf16(text)),
24 delta_start_(range.start()),
25 delta_end_(range.start() + range.length()) {}
26
27 TextEditingDelta::TextEditingDelta(const std::u16string& text)
28 : old_text_(text), delta_text_(u""), delta_start_(-1), delta_end_(-1) {}
29
30 TextEditingDelta::TextEditingDelta(const std::string& text)
31 : old_text_(fml::Utf8ToUtf16(text)),
32 delta_text_(u""),
33 delta_start_(-1),
34 delta_end_(-1) {}
35
36 } // namespace flutter
flutter::TextRange
Definition: text_range.h:19
flutter
Definition: AccessibilityBridgeMac.h:16
flutter::TextEditingDelta::TextEditingDelta
TextEditingDelta(const std::u16string &text_before_change, const TextRange &range, const std::u16string &text)
Definition: text_editing_delta.cc:11
text_editing_delta.h