Flutter Engine
The Flutter Engine
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
9namespace flutter {
10
11TextEditingDelta::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
19TextEditingDelta::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
28 : old_text_(text), delta_text_(u""), delta_start_(-1), delta_end_(-1) {}
29
31 : old_text_(fml::Utf8ToUtf16(text)),
32 delta_text_(u""),
33 delta_start_(-1),
34 delta_end_(-1) {}
35
36} // namespace flutter
size_t length
std::u16string text
Definition: ascii_trie.cc:9
std::u16string Utf8ToUtf16(const std::string_view string)
TextEditingDelta(const std::u16string &text_before_change, const TextRange &range, const std::u16string &text)