Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 1448ba5

Browse files
committed
comments
1 parent e52699b commit 1448ba5

18 files changed

+195
-107
lines changed

shell/platform/darwin/macos/framework/Source/AccessibilityBridgeMacDelegate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class AccessibilityBridgeMacDelegate : public AccessibilityBridge::Accessibility
6464

6565
//---------------------------------------------------------------------------
6666
/// @brief Whether the given event is in current pending events.
67-
/// @param[in] event_type The event you would like to look up.
67+
/// @param[in] event_type The event to look up.
6868
bool HasPendingEvent(ui::AXEventGenerator::Event event) const;
6969

7070
//---------------------------------------------------------------------------

shell/platform/darwin/macos/framework/Source/AccessibilityBridgeMacDelegate.mm

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
inline constexpr int32_t kRootNode = 0;
1616

1717
// Native mac notifications fired. These notifications are not publicly documented.
18-
// We have to define them ourselves.
1918
static NSString* const AccessibilityLoadCompleteNotification = @"AXLoadComplete";
2019
static NSString* const AccessibilityInvalidStatusChangedNotification = @"AXInvalidStatusChanged";
2120
static NSString* const AccessibilityLiveRegionCreatedNotification = @"AXLiveRegionCreated";
@@ -29,7 +28,7 @@
2928
void AccessibilityBridgeMacDelegate::OnAccessibilityEvent(
3029
ui::AXEventGenerator::TargetedEvent targeted_event) {
3130
if (!flutter_engine_.viewController.viewLoaded || !flutter_engine_.viewController.view.window) {
32-
// We don't need to send accessibility events if the there is no view or window.
31+
// Don't need to send accessibility events if the there is no view or window.
3332
return;
3433
}
3534
ui::AXNode* ax_node = targeted_event.node;
@@ -67,16 +66,16 @@
6766
.user_info = nil,
6867
});
6968
} else if (ax_node.data().role == ax::mojom::Role::kTextFieldWithComboBox) {
70-
// Even though the selected item in the combo box has changed, we don't
71-
// want to post a focus change because this will take the focus out of
69+
// Even though the selected item in the combo box has changed, don't
70+
// post a focus change because this will take the focus out of
7271
// the combo box where the user might be typing.
7372
events.push_back({
7473
.name = NSAccessibilitySelectedChildrenChangedNotification,
7574
.target = native_node,
7675
.user_info = nil,
7776
});
7877
}
79-
// In all other cases we should post
78+
// In all other cases this delegate should post
8079
// |NSAccessibilityFocusedUIElementChangedNotification|, but this is
8180
// handled elsewhere.
8281
break;
@@ -125,7 +124,7 @@
125124
id focused = mac_platform_node_delegate->GetFocus();
126125
if ([focused isKindOfClass:[FlutterTextField class]]) {
127126
// If it is a text field, the selection notifications are handled by
128-
// the FlutterTextField directly. We only need to make sure it is the
127+
// the FlutterTextField directly. Only need to make sure it is the
129128
// first responder.
130129
FlutterTextField* native_text_field = (FlutterTextField*)focused;
131130
if (native_text_field == mac_platform_node_delegate->GetFocus()) {
@@ -167,7 +166,7 @@
167166
case ui::AXEventGenerator::Event::VALUE_CHANGED: {
168167
if (ax_node.data().role == ax::mojom::Role::kTextField) {
169168
// If it is a text field, the value change notifications are handled by
170-
// the FlutterTextField directly. We only need to make sure it is the
169+
// the FlutterTextField directly. Only need to make sure it is the
171170
// first responder.
172171
FlutterTextField* native_text_field =
173172
(FlutterTextField*)mac_platform_node_delegate->GetNativeViewAccessible();

shell/platform/darwin/macos/framework/Source/FlutterCompositor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class FlutterCompositor {
2525
// Creates a BackingStore and saves updates the backing_store_out
2626
// data with the new BackingStore data.
2727
// If the backing store is being requested for the first time
28-
// for a given frame, we do not create a new backing store but
29-
// rather return the backing store associated with the
28+
// for a given frame, this compositor do not create a new backing
29+
// store but rather return the backing store associated with the
3030
// FlutterView's FlutterSurfaceManager.
3131
//
3232
// Any additional state allocated for the backing store and

shell/platform/darwin/macos/framework/Source/FlutterEmbedderKeyResponder.mm

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ static NSUInteger computeModifierFlagOfInterestMask() {
198198
// which is used for the "Apple logo" character (Option-Shift-K on a US
199199
// keyboard.)
200200
//
201-
// We hereby assume that non-printable function keys are defined from
201+
// Assume that non-printable function keys are defined from
202202
// 0xF700 upwards, and printable private keys are defined from 0xF8FF
203-
// downwards. We want to keep the printable private keys, therefore we only
204-
// filter out 0xF700-0xF7FF.
203+
// downwards. This function filter out 0xF700-0xF7FF in order to keep
204+
// the printable private keys.
205205
return nullptr;
206206
}
207207
return [characters UTF8String];
@@ -215,8 +215,8 @@ static NSUInteger computeModifierFlagOfInterestMask() {
215215
* The embedder functions only accept C-functions as callbacks, as well as an
216216
* arbitrary user_data. In order to send an instance method of
217217
* |FlutterEmbedderKeyResponder.handleResponse| to the engine's |SendKeyEvent|,
218-
* we wrap the invocation into a C-function |HandleResponse| and invocation
219-
* context |FlutterKeyPendingResponse|.
218+
* the embedder wrap the invocation into a C-function |HandleResponse| and
219+
* invocation context |FlutterKeyPendingResponse|.
220220
*
221221
* When this object is sent to the engine's |SendKeyEvent| as |user_data|, it
222222
* must be attached with |__bridge_retained|. When this object is parsed
@@ -544,7 +544,8 @@ - (void)sendCapsLockTapWithTimestamp:(NSTimeInterval)timestamp
544544
// MacOS sends a down *or* an up when CapsLock is tapped, alternatively on
545545
// even taps and odd taps. A CapsLock down or CapsLock up should always be
546546
// converted to a down *and* an up, and the up should always be a synthesized
547-
// event, since we will never know when the button is released.
547+
// event, since the FlutterEmbedderKeyResponder will never know when the
548+
// button is released.
548549
FlutterKeyEvent flutterEvent = {
549550
.struct_size = sizeof(FlutterKeyEvent),
550551
.timestamp = GetFlutterTimestampFrom(timestamp),

shell/platform/darwin/macos/framework/Source/FlutterEngine.mm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,7 @@ - (void)setSemanticsEnabled:(BOOL)enabled {
454454
return;
455455
}
456456
_semanticsEnabled = enabled;
457-
// We need to remove the accessibility children from flutter view
458-
// before we reset the bridge.
457+
// Remove the accessibility children from flutter view before reseting the bridge.
459458
if (!_semanticsEnabled && self.viewController.viewLoaded) {
460459
self.viewController.flutterView.accessibilityChildren = nil;
461460
}

shell/platform/darwin/macos/framework/Source/FlutterGLCompositor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class FlutterGLCompositor : public FlutterCompositor {
2727
// Creates a BackingStore and saves updates the backing_store_out
2828
// data with the new BackingStore data.
2929
// If the backing store is being requested for the first time
30-
// for a given frame, we do not create a new backing store but
31-
// rather return the backing store associated with the
30+
// for a given frame, this compositor do not create a new backing
31+
// store but rather return the backing store associated with the
3232
// FlutterView's FlutterSurfaceManager.
3333
//
3434
// Any additional state allocated for the backing store and

shell/platform/darwin/macos/framework/Source/FlutterKeyboardManager.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ - (void)addSecondaryResponder:(nonnull id<FlutterKeySecondaryResponder>)responde
4646
}
4747

4848
- (void)handleEvent:(nonnull NSEvent*)event {
49-
// Be sure to add a handling method in propagateKeyEvent if you allow more
49+
// Be sure to add a handling method in propagateKeyEvent when allowing more
5050
// event types here.
5151
if (event.type != NSEventTypeKeyDown && event.type != NSEventTypeKeyUp &&
5252
event.type != NSEventTypeFlagsChanged) {

shell/platform/darwin/macos/framework/Source/FlutterMetalCompositor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class FlutterMetalCompositor : public FlutterCompositor {
2121
// backing store.
2222
//
2323
// If the backing store is being requested for the first time
24-
// for a given frame, we do not create a new backing store but
25-
// rather return the backing store associated with the
24+
// for a given frame, this compositor do not create a new backing
25+
// store but rather return the backing store associated with the
2626
// FlutterView's FlutterSurfaceManager.
2727
//
2828
// Any additional state allocated for the backing store and

shell/platform/darwin/macos/framework/Source/FlutterPlatformNodeDelegateMac.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@
9999
NSMakeRect(local_bounds.x(), local_bounds.y(), local_bounds.width(), local_bounds.height());
100100
// The macOS XY coordinates start at bottom-left and increase toward top-right,
101101
// which is different from the Flutter's XY coordinates that start at top-left
102-
// increasing to bottom-right. Therefore, We need to flip the y coordinate when
103-
// we convert from flutter coordinates to macOS coordinates.
102+
// increasing to bottom-right. Therefore, this method need to flip the y coordinate when
103+
// it converts the bounds from flutter coordinates to macOS coordinates.
104104
ns_local_bounds.origin.y = -ns_local_bounds.origin.y - ns_local_bounds.size.height;
105105

106106
NSCAssert(engine_, @"Flutter engine should not be deallocated");
@@ -119,7 +119,7 @@
119119
gfx::RectF FlutterPlatformNodeDelegateMac::ConvertBoundsFromScreenToGlobal(
120120
const gfx::RectF& screen_bounds) const {
121121
// The VoiceOver seems to only accept bounds that are relative to primary screen.
122-
// Thus, we use [[NSScreen screens] firstObject] instead of [NSScreen mainScreen].
122+
// Thus, this method uses [[NSScreen screens] firstObject] instead of [NSScreen mainScreen].
123123
NSScreen* screen = [[NSScreen screens] firstObject];
124124
NSRect primary_screen_bounds = [screen frame];
125125
// The screen is flipped against y axis.

shell/platform/darwin/macos/framework/Source/FlutterPlatformNodeDelegateMacTest.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,9 @@
280280
double pixelRatio = view.bounds.size.width == 0 ? 1 : scaledSize.width / view.bounds.size.width;
281281

282282
double expectedFrameSize = rectSize * transformFactor / pixelRatio;
283-
EXPECT_EQ(NSEqualRects(native_text_field.frame, NSMakeRect(0, 600 - expectedFrameSize,
284-
expectedFrameSize, expectedFrameSize)),
285-
YES);
283+
EXPECT_EQ(
284+
NSEqualRects(native_text_field.frame, NSMakeRect(0, 0, expectedFrameSize, expectedFrameSize)),
285+
YES);
286286
// The text of TextInputPlugin only starts syncing editing state to the
287287
// native text field when it becomes the first responder.
288288
[native_text_field becomeFirstResponder];

0 commit comments

Comments
 (0)