Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
flutter::FlutterTextPlatformNode Class Reference

The ax platform node for a text field. More...

#include <FlutterTextInputSemanticsObject.h>

Inheritance diagram for flutter::FlutterTextPlatformNode:
ui::AXPlatformNodeBase ui::AXPlatformNode

Public Member Functions

 FlutterTextPlatformNode (FlutterPlatformNodeDelegate *delegate, __weak FlutterViewController *view_controller)
 Creates a FlutterTextPlatformNode that uses a FlutterTextField as its NativeViewAccessible.
 
 ~FlutterTextPlatformNode () override
 
NSRect GetFrame ()
 Gets the frame of this platform node relative to the view of FlutterViewController. This is used by the FlutterTextField to get its frame rect because the FlutterTextField is a subview of the FlutterViewController.view.
 
gfx::NativeViewAccessible GetNativeViewAccessible () override
 
- Public Member Functions inherited from ui::AXPlatformNodeBase
 AXPlatformNodeBase ()
 
 ~AXPlatformNodeBase () override
 
virtual void Init (AXPlatformNodeDelegate *delegate)
 
const AXNodeDataGetData () const
 
gfx::NativeViewAccessible GetFocus ()
 
gfx::NativeViewAccessible GetParent () const
 
int GetChildCount () const
 
gfx::NativeViewAccessible ChildAtIndex (int index) const
 
std::string GetName () const
 
std::u16string GetNameAsString16 () const
 
virtual std::optional< intGetIndexInParent ()
 
std::stack< gfx::NativeViewAccessibleGetAncestors ()
 
std::optional< intCompareTo (AXPlatformNodeBase &other)
 
void Destroy () override
 
void NotifyAccessibilityEvent (ax::mojom::Event event_type) override
 
AXPlatformNodeDelegateGetDelegate () const override
 
bool IsDescendantOf (AXPlatformNode *ancestor) const override
 
AXPlatformNodeBaseGetPreviousSibling () const
 
AXPlatformNodeBaseGetNextSibling () const
 
AXPlatformNodeBaseGetFirstChild () const
 
AXPlatformNodeBaseGetLastChild () const
 
bool IsDescendant (AXPlatformNodeBase *descendant)
 
AXPlatformNodeChildIterator AXPlatformNodeChildrenBegin () const
 
AXPlatformNodeChildIterator AXPlatformNodeChildrenEnd () const
 
bool HasBoolAttribute (ax::mojom::BoolAttribute attr) const
 
bool GetBoolAttribute (ax::mojom::BoolAttribute attr) const
 
bool GetBoolAttribute (ax::mojom::BoolAttribute attr, bool *value) const
 
bool HasFloatAttribute (ax::mojom::FloatAttribute attr) const
 
float GetFloatAttribute (ax::mojom::FloatAttribute attr) const
 
bool GetFloatAttribute (ax::mojom::FloatAttribute attr, float *value) const
 
bool HasIntAttribute (ax::mojom::IntAttribute attribute) const
 
int GetIntAttribute (ax::mojom::IntAttribute attribute) const
 
bool GetIntAttribute (ax::mojom::IntAttribute attribute, int *value) const
 
bool HasStringAttribute (ax::mojom::StringAttribute attribute) const
 
const std::string & GetStringAttribute (ax::mojom::StringAttribute attribute) const
 
bool GetStringAttribute (ax::mojom::StringAttribute attribute, std::string *value) const
 
bool GetString16Attribute (ax::mojom::StringAttribute attribute, std::u16string *value) const
 
std::u16string GetString16Attribute (ax::mojom::StringAttribute attribute) const
 
bool HasInheritedStringAttribute (ax::mojom::StringAttribute attribute) const
 
const std::string & GetInheritedStringAttribute (ax::mojom::StringAttribute attribute) const
 
std::u16string GetInheritedString16Attribute (ax::mojom::StringAttribute attribute) const
 
bool GetInheritedStringAttribute (ax::mojom::StringAttribute attribute, std::string *value) const
 
bool GetInheritedString16Attribute (ax::mojom::StringAttribute attribute, std::u16string *value) const
 
bool HasIntListAttribute (ax::mojom::IntListAttribute attribute) const
 
const std::vector< int32_t > & GetIntListAttribute (ax::mojom::IntListAttribute attribute) const
 
bool GetIntListAttribute (ax::mojom::IntListAttribute attribute, std::vector< int32_t > *value) const
 
AXPlatformNodeBaseGetSelectionContainer () const
 
AXPlatformNodeBaseGetTable () const
 
AXPlatformNodeBaseGetTableCaption () const
 
AXPlatformNodeBaseGetTableCell (int index) const
 
AXPlatformNodeBaseGetTableCell (int row, int column) const
 
std::optional< intGetTableCellIndex () const
 
std::optional< intGetTableColumn () const
 
std::optional< intGetTableColumnCount () const
 
std::optional< intGetTableAriaColumnCount () const
 
std::optional< intGetTableColumnSpan () const
 
std::optional< intGetTableRow () const
 
std::optional< intGetTableRowCount () const
 
std::optional< intGetTableAriaRowCount () const
 
std::optional< intGetTableRowSpan () const
 
std::optional< float > GetFontSizeInPoints () const
 
bool HasCaret (const AXTree::Selection *unignored_selection=nullptr)
 
bool IsChildOfLeaf () const
 
bool IsLeaf () const
 
bool IsInvisibleOrIgnored () const
 
bool IsScrollable () const
 
bool IsHorizontallyScrollable () const
 
bool IsVerticallyScrollable () const
 
bool IsTextField () const
 
bool IsPlainTextField () const
 
bool IsRichTextField () const
 
bool IsText () const
 
virtual bool IsPlatformCheckable () const
 
bool HasFocus ()
 
std::u16string GetHypertext () const
 
std::u16string GetInnerText () const
 
virtual std::u16string GetValue () const
 
bool ScrollToNode (ScrollType scroll_type)
 
AXPlatformNodeBaseNearestLeafToPoint (gfx::Point point) const
 
int NearestTextIndexToPoint (gfx::Point point)
 
ui::TextAttributeList ComputeTextAttributes () const
 
int GetSelectionCount () const
 
AXPlatformNodeBaseGetSelectedItem (int selected_index) const
 
int GetSelectedItems (int max_items, std::vector< AXPlatformNodeBase * > *out_selected_items=nullptr) const
 
- Public Member Functions inherited from ui::AXPlatformNode
void SetIsPrimaryWebContentsForWindow (bool is_primary)
 
bool IsPrimaryWebContentsForWindow () const
 
int32_t GetUniqueId () const
 
std::string ToString ()
 
std::string SubtreeToString ()
 
virtual ~AXPlatformNode ()
 

Additional Inherited Members

- Public Types inherited from ui::AXPlatformNodeBase
enum  ScrollType {
  TopLeft , BottomRight , TopEdge , BottomEdge ,
  LeftEdge , RightEdge , Anywhere
}
 
using AXPlatformNodeChildIterator = ui::AXNode::ChildIteratorBase< AXPlatformNodeBase, &AXPlatformNodeBase::GetNextSibling, &AXPlatformNodeBase::GetPreviousSibling, &AXPlatformNodeBase::GetFirstChild, &AXPlatformNodeBase::GetLastChild >
 
- Public Types inherited from ui::AXPlatformNode
typedef AXPlatformNodeNativeWindowHandlerCallback(gfx::NativeWindow)
 
- Static Public Member Functions inherited from ui::AXPlatformNodeBase
static AXPlatformNodeGetFromUniqueId (int32_t unique_id)
 
static size_t GetInstanceCountForTesting ()
 
static void SetOnNotifyEventCallbackForTesting (ax::mojom::Event event_type, std::function< void()> callback)
 
- Static Public Member Functions inherited from ui::AXPlatformNode
static AXPlatformNodeCreate (AXPlatformNodeDelegate *delegate)
 
static AXPlatformNodeFromNativeViewAccessible (gfx::NativeViewAccessible accessible)
 
static AXPlatformNodeFromNativeWindow (gfx::NativeWindow native_window)
 
static void RegisterNativeWindowHandler (std::function< NativeWindowHandlerCallback > handler)
 
static void AddAXModeObserver (AXModeObserver *observer)
 
static void RemoveAXModeObserver (AXModeObserver *observer)
 
static AXMode GetAccessibilityMode ()
 
static void NotifyAddAXModeFlags (AXMode mode_flags)
 
static gfx::NativeViewAccessible GetPopupFocusOverride ()
 
static void SetPopupFocusOverride (gfx::NativeViewAccessible focus_override)
 
- Public Attributes inherited from ui::AXPlatformNodeBase
AXPlatformNodeDelegatedelegate_ = nullptr
 
- Static Public Attributes inherited from ui::AXPlatformNodeBase
static const char16_t kEmbeddedCharacter = L'\xfffc'
 
- Protected Types inherited from ui::AXPlatformNodeBase
using PlatformAttributeList = std::vector< std::u16string >
 
- Protected Member Functions inherited from ui::AXPlatformNodeBase
bool IsDocument () const
 
bool IsSelectionItemSupported () const
 
std::u16string GetRangeValueText () const
 
std::u16string GetRoleDescription () const
 
std::u16string GetRoleDescriptionFromImageAnnotationStatusOrFromAttribute () const
 
virtual void Dispose ()
 
bool SetHypertextSelection (int start_offset, int end_offset)
 
void ComputeAttributes (PlatformAttributeList *attributes)
 
void AddAttributeToList (const ax::mojom::StringAttribute attribute, const char *name, PlatformAttributeList *attributes)
 
void AddAttributeToList (const ax::mojom::BoolAttribute attribute, const char *name, PlatformAttributeList *attributes)
 
void AddAttributeToList (const ax::mojom::IntAttribute attribute, const char *name, PlatformAttributeList *attributes)
 
virtual void AddAttributeToList (const char *name, const std::string &value, PlatformAttributeList *attributes)
 
virtual void AddAttributeToList (const char *name, const char *value, PlatformAttributeList *attributes)
 
virtual void SanitizeTextAttributeValue (const std::string &input, std::string *output) const
 
void UpdateComputedHypertext () const
 
int GetSelectionAnchor (const AXTree::Selection *selection)
 
int GetSelectionFocus (const AXTree::Selection *selection)
 
void GetSelectionOffsets (int *selection_start, int *selection_end)
 
void GetSelectionOffsets (const AXTree::Selection *selection, int *selection_start, int *selection_end)
 
void GetSelectionOffsetsFromTree (const AXTree::Selection *selection, int *selection_start, int *selection_end)
 
AXPlatformNodeBaseGetHyperlinkFromHypertextOffset (int offset)
 
int32_t GetHyperlinkIndexFromChild (AXPlatformNodeBase *child)
 
int32_t GetHypertextOffsetFromHyperlinkIndex (int32_t hyperlink_index)
 
int32_t GetHypertextOffsetFromChild (AXPlatformNodeBase *child)
 
int32_t GetHypertextOffsetFromDescendant (AXPlatformNodeBase *descendant)
 
int GetHypertextOffsetFromEndpoint (AXPlatformNodeBase *endpoint_object, int endpoint_offset)
 
bool IsSameHypertextCharacter (const AXHypertext &old_hypertext, size_t old_char_index, size_t new_char_index)
 
std::optional< intGetPosInSet () const
 
std::optional< intGetSetSize () const
 
std::string GetInvalidValue () const
 
int GetMaxSelectableItems () const
 
- Protected Member Functions inherited from ui::AXPlatformNode
 AXPlatformNode ()
 
- Static Protected Member Functions inherited from ui::AXPlatformNodeBase
static AXPlatformNodeBaseFromNativeViewAccessible (gfx::NativeViewAccessible accessible)
 
static void SanitizeStringAttribute (const std::string &input, std::string *output)
 
- Protected Attributes inherited from ui::AXPlatformNodeBase
AXHypertext hypertext_
 

Detailed Description

The ax platform node for a text field.

Definition at line 22 of file FlutterTextInputSemanticsObject.h.

Constructor & Destructor Documentation

◆ FlutterTextPlatformNode()

flutter::FlutterTextPlatformNode::FlutterTextPlatformNode ( FlutterPlatformNodeDelegate delegate,
__weak FlutterViewController view_controller 
)
explicit

Creates a FlutterTextPlatformNode that uses a FlutterTextField as its NativeViewAccessible.

Parameters
[in]delegateThe delegate that provides accessibility data.
[in]view_controllerThe view_controller that is used for querying the information about FlutterView and FlutterTextInputPlugin.

Definition at line 161 of file FlutterTextInputSemanticsObject.mm.

162 {
163 Init(delegate);
164 view_controller_ = view_controller;
165 appkit_text_field_ =
166 [[FlutterTextField alloc] initWithPlatformNode:this
167 fieldEditor:view_controller.textInputPlugin];
168 appkit_text_field_.bezeled = NO;
169 appkit_text_field_.drawsBackground = NO;
170 appkit_text_field_.bordered = NO;
171 appkit_text_field_.focusRingType = NSFocusRingTypeNone;
172}
void Init()

◆ ~FlutterTextPlatformNode()

flutter::FlutterTextPlatformNode::~FlutterTextPlatformNode ( )
override

Definition at line 174 of file FlutterTextInputSemanticsObject.mm.

174 {
175 [appkit_text_field_ setPlatformNode:nil];
176 EnsureDetachedFromView();
177}

Member Function Documentation

◆ GetFrame()

NSRect flutter::FlutterTextPlatformNode::GetFrame ( )

Gets the frame of this platform node relative to the view of FlutterViewController. This is used by the FlutterTextField to get its frame rect because the FlutterTextField is a subview of the FlutterViewController.view.

Definition at line 186 of file FlutterTextInputSemanticsObject.mm.

186 {
187 if (!view_controller_.viewLoaded) {
188 return NSZeroRect;
189 }
190 FlutterPlatformNodeDelegate* delegate = static_cast<FlutterPlatformNodeDelegate*>(GetDelegate());
191 bool offscreen;
192 auto bridge_ptr = delegate->GetOwnerBridge().lock();
193 gfx::RectF bounds = bridge_ptr->RelativeToGlobalBounds(delegate->GetAXNode(), offscreen, true);
194
195 // Converts to NSRect to use NSView rect conversion.
196 NSRect ns_local_bounds = NSMakeRect(bounds.x(), bounds.y(), bounds.width(), bounds.height());
197 // The macOS XY coordinates start at bottom-left and increase toward top-right,
198 // which is different from the Flutter's XY coordinates that start at top-left
199 // increasing to bottom-right. Flip the y coordinate to convert from Flutter
200 // coordinates to macOS coordinates.
201 ns_local_bounds.origin.y = -ns_local_bounds.origin.y - ns_local_bounds.size.height;
202 NSRect ns_view_bounds = [view_controller_.flutterView convertRectFromBacking:ns_local_bounds];
203 return [view_controller_.flutterView convertRect:ns_view_bounds toView:nil];
204}
AXPlatformNodeDelegate * GetDelegate() const override
Optional< SkRect > bounds
Definition SkRecords.h:189

◆ GetNativeViewAccessible()

gfx::NativeViewAccessible flutter::FlutterTextPlatformNode::GetNativeViewAccessible ( )
overridevirtual

Reimplemented from ui::AXPlatformNodeBase.

Definition at line 179 of file FlutterTextInputSemanticsObject.mm.

179 {
180 if (EnsureAttachedToView()) {
181 return appkit_text_field_;
182 }
183 return nil;
184}

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