Flutter Engine
 
Loading...
Searching...
No Matches
flutter::SemanticsUpdateBuilder Class Reference

#include <semantics_update_builder.h>

Inheritance diagram for flutter::SemanticsUpdateBuilder:
flutter::RefCountedDartWrappable< SemanticsUpdateBuilder > fml::RefCountedThreadSafe< T > tonic::DartWrappable fml::internal::RefCountedThreadSafeBase

Public Member Functions

 ~SemanticsUpdateBuilder () override
 
void updateNode (int id, Dart_Handle flags, int actions, int maxValueLength, int currentValueLength, int textSelectionBase, int textSelectionExtent, int platformViewId, int scrollChildren, int scrollIndex, int traversalParent, double scrollPosition, double scrollExtentMax, double scrollExtentMin, double left, double top, double right, double bottom, std::string identifier, std::string label, const std::vector< NativeStringAttribute * > &labelAttributes, std::string value, const std::vector< NativeStringAttribute * > &valueAttributes, std::string increasedValue, const std::vector< NativeStringAttribute * > &increasedValueAttributes, std::string decreasedValue, const std::vector< NativeStringAttribute * > &decreasedValueAttributes, std::string hint, const std::vector< NativeStringAttribute * > &hintAttributes, std::string tooltip, int textDirection, const tonic::Float64List &transform, const tonic::Float64List &hitTestTransform, const tonic::Int32List &childrenInTraversalOrder, const tonic::Int32List &childrenInHitTestOrder, const tonic::Int32List &customAccessibilityActions, int headingLevel, std::string linkUrl, int role, const std::vector< std::string > &controlsNodes, int validationResult, int hitTestBehavior, int inputType, std::string locale)
 
void updateCustomAction (int id, std::string label, std::string hint, int overrideId)
 
void build (Dart_Handle semantics_update_handle)
 
- Public Member Functions inherited from flutter::RefCountedDartWrappable< SemanticsUpdateBuilder >
virtual void RetainDartWrappableReference () const override
 
virtual void ReleaseDartWrappableReference () const override
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< T >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 
- Public Member Functions inherited from tonic::DartWrappable
 DartWrappable ()
 
virtual const DartWrapperInfoGetDartWrapperInfo () const =0
 
Dart_Handle CreateDartWrapper (DartState *dart_state)
 
void AssociateWithDartWrapper (Dart_Handle wrappable)
 
void ClearDartWrapper ()
 
Dart_WeakPersistentHandle dart_wrapper () const
 

Static Public Member Functions

static void Create (Dart_Handle wrapper)
 

Additional Inherited Members

- Public Types inherited from tonic::DartWrappable
enum  DartNativeFields {
  kPeerIndex ,
  kNumberOfNativeFields
}
 
- Protected Member Functions inherited from fml::RefCountedThreadSafe< T >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 
- Protected Member Functions inherited from tonic::DartWrappable
virtual ~DartWrappable ()
 
- Static Protected Member Functions inherited from tonic::DartWrappable
static Dart_PersistentHandle GetTypeForWrapper (tonic::DartState *dart_state, const tonic::DartWrapperInfo &wrapper_info)
 

Detailed Description

Definition at line 18 of file semantics_update_builder.h.

Constructor & Destructor Documentation

◆ ~SemanticsUpdateBuilder()

flutter::SemanticsUpdateBuilder::~SemanticsUpdateBuilder ( )
overridedefault

References build().

Member Function Documentation

◆ build()

void flutter::SemanticsUpdateBuilder::build ( Dart_Handle  semantics_update_handle)

Definition at line 156 of file semantics_update_builder.cc.

156 {
157 SemanticsUpdate::create(semantics_update_handle, std::move(nodes_),
158 std::move(actions_));
160}
static void create(Dart_Handle semantics_update_handle, SemanticsNodeUpdates nodes, CustomAccessibilityActionUpdates actions)

References tonic::DartWrappable::ClearDartWrapper(), and flutter::SemanticsUpdate::create().

Referenced by ~SemanticsUpdateBuilder().

◆ Create()

static void flutter::SemanticsUpdateBuilder::Create ( Dart_Handle  wrapper)
inlinestatic

Definition at line 24 of file semantics_update_builder.h.

24 {
26 auto res = fml::MakeRefCounted<SemanticsUpdateBuilder>();
27 res->AssociateWithDartWrapper(wrapper);
28 }
static void ThrowIfUIOperationsProhibited()

References flutter::UIDartState::ThrowIfUIOperationsProhibited().

◆ updateCustomAction()

void flutter::SemanticsUpdateBuilder::updateCustomAction ( int  id,
std::string  label,
std::string  hint,
int  overrideId 
)

Definition at line 144 of file semantics_update_builder.cc.

147 {
148 CustomAccessibilityAction action;
149 action.id = id;
150 action.overrideId = overrideId;
151 action.label = std::move(label);
152 action.hint = std::move(hint);
153 actions_[id] = action;
154}
const uintptr_t id

References action, id, and flutter::CustomAccessibilityAction::id.

◆ updateNode()

void flutter::SemanticsUpdateBuilder::updateNode ( int  id,
Dart_Handle  flags,
int  actions,
int  maxValueLength,
int  currentValueLength,
int  textSelectionBase,
int  textSelectionExtent,
int  platformViewId,
int  scrollChildren,
int  scrollIndex,
int  traversalParent,
double  scrollPosition,
double  scrollExtentMax,
double  scrollExtentMin,
double  left,
double  top,
double  right,
double  bottom,
std::string  identifier,
std::string  label,
const std::vector< NativeStringAttribute * > &  labelAttributes,
std::string  value,
const std::vector< NativeStringAttribute * > &  valueAttributes,
std::string  increasedValue,
const std::vector< NativeStringAttribute * > &  increasedValueAttributes,
std::string  decreasedValue,
const std::vector< NativeStringAttribute * > &  decreasedValueAttributes,
std::string  hint,
const std::vector< NativeStringAttribute * > &  hintAttributes,
std::string  tooltip,
int  textDirection,
const tonic::Float64List &  transform,
const tonic::Float64List &  hitTestTransform,
const tonic::Int32List &  childrenInTraversalOrder,
const tonic::Int32List &  childrenInHitTestOrder,
const tonic::Int32List &  customAccessibilityActions,
int  headingLevel,
std::string  linkUrl,
int  role,
const std::vector< std::string > &  controlsNodes,
int  validationResult,
int  hitTestBehavior,
int  inputType,
std::string  locale 
)

Definition at line 33 of file semantics_update_builder.cc.

77 {
78 FML_CHECK(scrollChildren == 0 ||
79 (scrollChildren > 0 && childrenInHitTestOrder.data()))
80 << "Semantics update contained scrollChildren but did not have "
81 "childrenInHitTestOrder";
82 SemanticsNode node;
83 node.id = id;
84 auto* flags_object =
86 node.flags = flags_object->GetFlags();
87 node.actions = actions;
88 node.maxValueLength = maxValueLength;
89 node.currentValueLength = currentValueLength;
90 node.textSelectionBase = textSelectionBase;
91 node.textSelectionExtent = textSelectionExtent;
92 node.platformViewId = platformViewId;
93 node.scrollChildren = scrollChildren;
94 node.scrollIndex = scrollIndex;
95 node.traversalParent = traversalParent;
96 node.scrollPosition = scrollPosition;
97 node.scrollExtentMax = scrollExtentMax;
98 node.scrollExtentMin = scrollExtentMin;
99 node.rect = SkRect::MakeLTRB(SafeNarrow(left), SafeNarrow(top),
100 SafeNarrow(right), SafeNarrow(bottom));
101 node.identifier = std::move(identifier);
102 node.label = std::move(label);
103 pushStringAttributes(node.labelAttributes, labelAttributes);
104 node.value = std::move(value);
105 pushStringAttributes(node.valueAttributes, valueAttributes);
106 node.increasedValue = std::move(increasedValue);
107 pushStringAttributes(node.increasedValueAttributes, increasedValueAttributes);
108 node.decreasedValue = std::move(decreasedValue);
109 pushStringAttributes(node.decreasedValueAttributes, decreasedValueAttributes);
110 node.hint = std::move(hint);
111 pushStringAttributes(node.hintAttributes, hintAttributes);
112 node.tooltip = std::move(tooltip);
113 node.textDirection = textDirection;
114 SkScalar scalarTransform[16];
115 for (int i = 0; i < 16; ++i) {
116 scalarTransform[i] = SafeNarrow(transform.data()[i]);
117 }
118 node.transform = SkM44::ColMajor(scalarTransform);
119 SkScalar scalarHitTestTransform[16];
120 for (int i = 0; i < 16; ++i) {
121 scalarHitTestTransform[i] = SafeNarrow(hitTestTransform.data()[i]);
122 }
123 node.hitTestTransform = SkM44::ColMajor(scalarHitTestTransform);
124 node.childrenInTraversalOrder =
125 std::vector<int32_t>(childrenInTraversalOrder.data(),
126 childrenInTraversalOrder.data() +
127 childrenInTraversalOrder.num_elements());
128 node.childrenInHitTestOrder = std::vector<int32_t>(
129 childrenInHitTestOrder.data(),
130 childrenInHitTestOrder.data() + childrenInHitTestOrder.num_elements());
131 node.customAccessibilityActions = std::vector<int32_t>(
132 localContextActions.data(),
133 localContextActions.data() + localContextActions.num_elements());
134 node.headingLevel = headingLevel;
135 node.linkUrl = std::move(linkUrl);
136 node.role = static_cast<SemanticsRole>(role);
137 node.validationResult =
138 static_cast<SemanticsValidationResult>(validationResult);
139 node.locale = std::move(locale);
140
141 nodes_[id] = node;
142}
#define FML_CHECK(condition)
Definition logging.h:104
void pushStringAttributes(StringAttributes &destination, const std::vector< NativeStringAttribute * > &native_attributes)
SemanticsValidationResult
static float SafeNarrow(double value)

References flutter::SemanticsNode::actions, flutter::SemanticsNode::childrenInHitTestOrder, flutter::SemanticsNode::childrenInTraversalOrder, flutter::SemanticsNode::currentValueLength, flutter::SemanticsNode::customAccessibilityActions, flutter::SemanticsNode::decreasedValue, flutter::SemanticsNode::decreasedValueAttributes, flutter::SemanticsNode::flags, FML_CHECK, flutter::SemanticsNode::headingLevel, flutter::SemanticsNode::hint, flutter::SemanticsNode::hintAttributes, flutter::SemanticsNode::hitTestTransform, i, id, flutter::SemanticsNode::id, flutter::SemanticsNode::identifier, flutter::SemanticsNode::increasedValue, flutter::SemanticsNode::increasedValueAttributes, flutter::SemanticsNode::label, flutter::SemanticsNode::labelAttributes, flutter::SemanticsNode::linkUrl, flutter::SemanticsNode::locale, flutter::SemanticsNode::maxValueLength, flutter::SemanticsNode::platformViewId, flutter::pushStringAttributes(), flutter::SemanticsNode::rect, flutter::SemanticsNode::role, flutter::SafeNarrow(), flutter::SemanticsNode::scrollChildren, flutter::SemanticsNode::scrollExtentMax, flutter::SemanticsNode::scrollExtentMin, flutter::SemanticsNode::scrollIndex, flutter::SemanticsNode::scrollPosition, flutter::SemanticsNode::textDirection, flutter::SemanticsNode::textSelectionBase, flutter::SemanticsNode::textSelectionExtent, flutter::SemanticsNode::tooltip, transform, flutter::SemanticsNode::transform, flutter::SemanticsNode::traversalParent, flutter::SemanticsNode::validationResult, value, flutter::SemanticsNode::value, and flutter::SemanticsNode::valueAttributes.


The documentation for this class was generated from the following files: