Flutter macOS Embedder
FlutterPlatformNodeDelegateMac.h
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 #ifndef FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMNODEDELEGATEMAC_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMNODEDELEGATEMAC_H_
7 
8 #import <Cocoa/Cocoa.h>
9 
11 
12 #include "flutter/fml/macros.h"
15 #include "flutter/shell/platform/embedder/embedder.h"
16 
17 namespace flutter {
18 
19 //------------------------------------------------------------------------------
20 /// The macOS implementation of FlutterPlatformNodeDelegate. This class uses
21 /// AXPlatformNodeMac to manage the macOS-specific accessibility objects.
23  public:
24  FlutterPlatformNodeDelegateMac(std::weak_ptr<AccessibilityBridge> bridge,
25  __weak FlutterViewController* view_controller);
27 
28  void Init(std::weak_ptr<OwnerBridge> bridge, ui::AXNode* node) override;
29 
30  void NodeDataChanged(const ui::AXNodeData& old_node_data,
31  const ui::AXNodeData& new_node_data) override;
32 
33  // |ui::AXPlatformNodeDelegateBase|
34  const ui::AXNodeData& GetData() const override;
35 
36  //---------------------------------------------------------------------------
37  /// @brief Gets the live region text of this node in UTF-8 format. This
38  /// is useful to determine the changes in between semantics
39  /// updates when generating accessibility events.
40  std::string GetLiveRegionText() const;
41 
42  // |ui::AXPlatformNodeDelegate|
43  gfx::NativeViewAccessible GetNativeViewAccessible() override;
44 
45  // |ui::AXPlatformNodeDelegate|
46  gfx::NativeViewAccessible GetNSWindow() override;
47 
48  // |FlutterPlatformNodeDelegate|
49  gfx::NativeViewAccessible GetParent() override;
50 
51  // |FlutterPlatformNodeDelegate|
52  gfx::Rect GetBoundsRect(
53  const ui::AXCoordinateSystem coordinate_system,
54  const ui::AXClippingBehavior clipping_behavior,
55  ui::AXOffscreenResult* offscreen_result) const override;
56 
57  private:
58  ui::AXPlatformNode* ax_platform_node_;
59  std::weak_ptr<AccessibilityBridge> bridge_;
60  __weak FlutterViewController* view_controller_;
61  mutable ui::AXNodeData cached_data_;
62 
63  gfx::RectF ConvertBoundsFromLocalToScreen(
64  const gfx::RectF& local_bounds) const;
65  gfx::RectF ConvertBoundsFromScreenToGlobal(
66  const gfx::RectF& window_bounds) const;
67 
68  FML_DISALLOW_COPY_AND_ASSIGN(FlutterPlatformNodeDelegateMac);
69 };
70 
71 } // namespace flutter
72 
73 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERPLATFORMNODEDELEGATEMAC_H_
const ui::AXNodeData & GetData() const override
gfx::NativeViewAccessible GetNativeViewAccessible() override
void NodeDataChanged(const ui::AXNodeData &old_node_data, const ui::AXNodeData &new_node_data) override
gfx::NativeViewAccessible GetParent() override
gfx::NativeViewAccessible GetNSWindow() override
FlutterPlatformNodeDelegateMac(std::weak_ptr< AccessibilityBridge > bridge, __weak FlutterViewController *view_controller)
gfx::Rect GetBoundsRect(const ui::AXCoordinateSystem coordinate_system, const ui::AXClippingBehavior clipping_behavior, ui::AXOffscreenResult *offscreen_result) const override
void Init(std::weak_ptr< OwnerBridge > bridge, ui::AXNode *node) override
Called only once, immediately after construction. The constructor doesn't take any arguments because ...
std::string GetLiveRegionText() const
Gets the live region text of this node in UTF-8 format. This is useful to determine the changes in be...