Flutter Engine
The Flutter Engine
string_attribute.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/lib/ui/semantics/string_attribute.h"
6
7#include "flutter/fml/logging.h"
8#include "flutter/lib/ui/ui_dart_state.h"
11
12#include <memory>
13#include <utility>
14
15namespace flutter {
16
18
19NativeStringAttribute::NativeStringAttribute() {}
20
22
24 Dart_Handle string_attribute_handle,
25 int32_t start,
26 int32_t end) {
28 auto native_string_attribute = fml::MakeRefCounted<NativeStringAttribute>();
29 native_string_attribute->AssociateWithDartWrapper(string_attribute_handle);
30
31 native_string_attribute->attribute_ =
32 std::make_shared<SpellOutStringAttribute>();
33 native_string_attribute->attribute_->start = start;
34 native_string_attribute->attribute_->end = end;
35 native_string_attribute->attribute_->type = StringAttributeType::kSpellOut;
36}
37
39 Dart_Handle string_attribute_handle,
40 int32_t start,
41 int32_t end,
42 std::string locale) {
44 auto native_string_attribute = fml::MakeRefCounted<NativeStringAttribute>();
45 native_string_attribute->AssociateWithDartWrapper(string_attribute_handle);
46
47 auto locale_attribute = std::make_shared<LocaleStringAttribute>();
48 locale_attribute->start = start;
49 locale_attribute->end = end;
50 locale_attribute->type = StringAttributeType::kLocale;
51 locale_attribute->locale = std::move(locale);
52 native_string_attribute->attribute_ = locale_attribute;
53}
54
56 return attribute_;
57}
58
59} // namespace flutter
The peer class for all of the StringAttribute subclasses in semantics.dart.
const StringAttributePtr GetAttribute() const
Returns the c++ representataion of StringAttribute.
static void initSpellOutStringAttribute(Dart_Handle string_attribute_handle, int32_t start, int32_t end)
The init method for SpellOutStringAttribute constructor.
static void initLocaleStringAttribute(Dart_Handle string_attribute_handle, int32_t start, int32_t end, std::string locale)
The init method for LocaleStringAttribute constructor.
static void ThrowIfUIOperationsProhibited()
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
glong glong end
IMPLEMENT_WRAPPERTYPEINFO(flutter_gpu, FlutterGpuTestClass)
std::shared_ptr< flutter::StringAttribute > StringAttributePtr