flutter-tizen / embedder

Flutter embedder for Tizen
BSD 3-Clause "New" or "Revised" License
5 stars 7 forks source link

[a11y] Move to new update semantics API #24

Closed swift-kim closed 1 year ago

swift-kim commented 1 year ago

Align the Tizen embedder with the new update_semantics_callback embedder API.

For details, please see https://github.com/flutter/engine/pull/37404. I referred to Windows and macOS implementations.

loic-sharma commented 1 year ago

@swift-kim Hello, we just realized that FlutterSemanticsUpdate is flawed: array indexing on FlutterSemanticsUpdate.nodes and FlutterSemanticsUpdate.custom_actions will break when we add new members to FlutterSemanticsNode or FlutterSemanticsCustomAction. Instead, you'll need to use the FlutterSemanticsNode.struct_size and FlutterSemanticsCustomAction.struct_size to determine the next element's pointer.

This code is bad:

FlutterSemanticsUpdate update = ...;
FlutterSemanticsNode first = update.nodes[0];
FlutterSemanticsNode second = update.nodes[1]; // BAD! This could crash.

You'll want something like this instead:

// Note: untested
FlutterSemanticsUpdate update = ...;
FlutterSemanticsNode first = update.nodes[0];
FlutterSemanticsNode* second = static_cast<FlutterSemanticsNode*>(
  static_cast<char*>(update.nodes) + 1 * first.struct_size);

I'd suggest reverting this change and staying on the old semantics update callbacks for now. Apologies for the inconvenience.

swift-kim commented 1 year ago

@loic-sharma Thank you for informing us. We always stay on the Flutter SDK stable channel and the embedder.h and engine implementation will remain unchanged on our side until the next stable engine release. So the current code should work at least until then. I'll keep track of any changes to embedder.h and FlutterSemanticsNode and make necessary changes to our embedder when I update the engine next time, so you don't have to worry. Thanks again for your great work.