Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
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, std::string minValue, std::string maxValue)
 
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 160 of file semantics_update_builder.cc.

160 {
161 SemanticsUpdate::create(semantics_update_handle, std::move(nodes_),
162 std::move(actions_));
164}
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 148 of file semantics_update_builder.cc.

151 {
152 CustomAccessibilityAction action;
153 action.id = id;
154 action.overrideId = overrideId;
155 action.label = std::move(label);
156 action.hint = std::move(hint);
157 actions_[id] = action;
158}
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,
std::string  minValue,
std::string  maxValue 
)

Definition at line 33 of file semantics_update_builder.cc.

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