mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add asserts to semantics.dart (flutter/engine#8846)
This commit is contained in:
parent
99e7daa6bc
commit
712fc0f99e
@ -654,8 +654,11 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
|
||||
Int32List childrenInHitTestOrder,
|
||||
Int32List additionalActions,
|
||||
}) {
|
||||
if (transform.length != 16)
|
||||
throw new ArgumentError('transform argument must have 16 entries.');
|
||||
assert(_matrix4IsValid(transform));
|
||||
assert(
|
||||
scrollChildren == 0 || (scrollChildren > 0 && childrenInHitTestOrder != null),
|
||||
'If a node has scrollChildren, it must have childrenInHitTestOrder',
|
||||
);
|
||||
_updateNode(
|
||||
id,
|
||||
flags,
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
#include "flutter/lib/ui/semantics/semantics_update_builder.h"
|
||||
|
||||
#include "third_party/skia/include/core/SkScalar.h"
|
||||
#include "third_party/tonic/converter/dart_converter.h"
|
||||
#include "third_party/tonic/dart_args.h"
|
||||
#include "third_party/tonic/dart_binding_macros.h"
|
||||
@ -63,6 +64,12 @@ void SemanticsUpdateBuilder::updateNode(
|
||||
const tonic::Int32List& childrenInTraversalOrder,
|
||||
const tonic::Int32List& childrenInHitTestOrder,
|
||||
const tonic::Int32List& localContextActions) {
|
||||
FML_CHECK(transform.data() && SkScalarsAreFinite(*transform.data(), 9))
|
||||
<< "Semantics update transform was not set or not finite.";
|
||||
FML_CHECK(scrollChildren == 0 ||
|
||||
(scrollChildren > 0 && childrenInHitTestOrder.data()))
|
||||
<< "Semantics update contained scrollChildren but did not have "
|
||||
"childrenInHitTestOrder";
|
||||
SemanticsNode node;
|
||||
node.id = id;
|
||||
node.flags = flags;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user