diff --git a/lib/stub_ui/lib/src/ui/compositing.dart b/lib/stub_ui/lib/src/ui/compositing.dart index 840236018fddc..7f6efcda0bdf4 100644 --- a/lib/stub_ui/lib/src/ui/compositing.dart +++ b/lib/stub_ui/lib/src/ui/compositing.dart @@ -875,6 +875,12 @@ class SceneHost { /// The scene host takes ownership of the provided export token handle. SceneHost(dynamic exportTokenHandle); + SceneHost.fromViewHolderToken( + dynamic viewHolderTokenHandle, + void Function() viewConnectedCallback, + void Function() viewDisconnectedCallback, + void Function(bool) viewStateChangedCallback); + /// Releases the resources associated with the child scene host. /// /// After calling this function, the child scene host cannot be used further. diff --git a/lib/stub_ui/lib/src/ui/painting.dart b/lib/stub_ui/lib/src/ui/painting.dart index 3f6addebd53cc..29db5d905338f 100644 --- a/lib/stub_ui/lib/src/ui/painting.dart +++ b/lib/stub_ui/lib/src/ui/painting.dart @@ -962,8 +962,8 @@ class Paint { double get strokeMiterLimit { return null; } - set strokeMiterLimit(double value) { - } + + set strokeMiterLimit(double value) {} /// Whether to paint inside shapes, the edges of shapes, or both. /// @@ -1213,7 +1213,8 @@ abstract class Gradient extends Shader { List colors, [ List colorStops, TileMode tileMode = TileMode.clamp, - Float64List matrix4, // TODO(yjbanov): Implement this https://github.com/flutter/flutter/issues/32819 + Float64List + matrix4, // TODO(yjbanov): Implement this https://github.com/flutter/flutter/issues/32819 ]) => _GradientLinear(from, to, colors, colorStops, tileMode); @@ -1490,6 +1491,25 @@ class ColorFilter { : _color = color, _blendMode = blendMode; + /// Construct a color filter that transforms a color by a 4x5 matrix. The + /// matrix is in row-major order and the translation column is specified in + /// unnormalized, 0...255, space. + const ColorFilter.matrix(List matrix) + : _color = null, + _blendMode = null; + + /// Construct a color filter that applies the sRGB gamma curve to the RGB + /// channels. + const ColorFilter.linearToSrgbGamma() + : _color = null, + _blendMode = null; + + /// Creates a color filter that applies the inverse of the sRGB gamma curve + /// to the RGB channels. + const ColorFilter.srgbToLinearGamma() + : _color = null, + _blendMode = null; + final Color _color; final BlendMode _blendMode; @@ -1632,6 +1652,14 @@ class ImageFilter { ImageFilter.blur({double sigmaX = 0.0, double sigmaY = 0.0}) { _initBlur(sigmaX, sigmaY); } + + /// Creates an image filter that applies a matrix transformation. + /// + /// For example, applying a positive scale matrix (see [Matrix4.diagonal3]) + /// when used with [BackdropFilter] would magnify the background image. + ImageFilter.matrix(Float64List matrix4, + {FilterQuality filterQuality = FilterQuality.low}) {} + void _initBlur(double sigmaX, double sigmaY) { // TODO(b/128318717): Implement me. } diff --git a/lib/stub_ui/lib/src/ui/text.dart b/lib/stub_ui/lib/src/ui/text.dart index d2612271d1447..8fd97ae82a73c 100644 --- a/lib/stub_ui/lib/src/ui/text.dart +++ b/lib/stub_ui/lib/src/ui/text.dart @@ -458,6 +458,7 @@ class TextStyle { Paint background, Paint foreground, List shadows, + List fontFeatures, }) : assert( color == null || foreground == null, 'Cannot provide both a color and a foreground\n' diff --git a/lib/stub_ui/lib/src/ui/window.dart b/lib/stub_ui/lib/src/ui/window.dart index 57f5432fbf4dd..b71d0a11e4681 100644 --- a/lib/stub_ui/lib/src/ui/window.dart +++ b/lib/stub_ui/lib/src/ui/window.dart @@ -1197,7 +1197,9 @@ class PluginUtilities { } } -class ImageShader {} +class ImageShader { + ImageShader(Image image, TileMode tmx, TileMode tmy, Float64List matrix4); +} class IsolateNameServer { static SendPort lookupPortByName(String name) { diff --git a/web_sdk/test/api_conform_test.dart b/web_sdk/test/api_conform_test.dart index 1dd8b850c1e0c..137237bc79bd9 100644 --- a/web_sdk/test/api_conform_test.dart +++ b/web_sdk/test/api_conform_test.dart @@ -39,10 +39,70 @@ void main() { } // Next will check that the public methods exposed in each library are // identical. - final Map uiMethods = {}; - final Map webMethods = {}; + final Map uiMethods = + {}; + final Map webMethods = + {}; + final Map uiConstructors = + {}; + final Map webConstructors = + {}; _collectPublicMethods(uiClass, uiMethods); _collectPublicMethods(webClass, webMethods); + _collectPublicConstructors(uiClass, uiConstructors); + _collectPublicConstructors(webClass, webConstructors); + + for (String name in uiConstructors.keys) { + final ConstructorDeclaration uiConstructor = uiConstructors[name]; + final ConstructorDeclaration webConstructor = webConstructors[name]; + if (webConstructor == null) { + failed = true; + print( + 'Warning: lib/ui/ui.dart $className.$name is missing from lib/stub_ui/ui.dart.', + ); + continue; + } + + if (uiConstructor.parameters.parameters.length != + webConstructor.parameters.parameters.length) { + failed = true; + print( + 'Warning: lib/ui/ui.dart $className.$name has a different parameter ' + 'length than in lib/stub_ui/ui.dart.'); + } + + for (int i = 0; + i < uiConstructor.parameters.parameters.length && + i < uiConstructor.parameters.parameters.length; + i++) { + // Technically you could re-order named parameters and still be valid, + // but we enforce that they are identical. + for (int i = 0; + i < uiConstructor.parameters.parameters.length && + i < webConstructor.parameters.parameters.length; + i++) { + final FormalParameter uiParam = + uiConstructor.parameters.parameters[i]; + final FormalParameter webParam = + webConstructor.parameters.parameters[i]; + if (webParam.identifier.name != uiParam.identifier.name) { + failed = true; + print('Warning: lib/ui/ui.dart $className.$name parameter $i' + ' ${uiParam.identifier.name} has a different name in lib/stub_ui/ui.dart.'); + } + if (uiParam.isPositional != webParam.isPositional) { + failed = true; + print('Warning: lib/ui/ui.dart $className.$name parameter $i' + '${uiParam.identifier.name} is positional, but not in lib/stub_ui/ui.dart.'); + } + if (uiParam.isNamed != webParam.isNamed) { + failed = true; + print('Warning: lib/ui/ui.dart $className.$name parameter $i' + '${uiParam.identifier.name} is named, but not in lib/stub_ui/ui.dart.'); + } + } + } + } for (String methodName in uiMethods.keys) { final MethodDeclaration uiMethod = uiMethods[methodName]; @@ -57,7 +117,8 @@ void main() { if (uiMethod.parameters == null || webMethod.parameters == null) { continue; } - if (uiMethod.parameters.parameters.length != webMethod.parameters.parameters.length) { + if (uiMethod.parameters.parameters.length != + webMethod.parameters.parameters.length) { failed = true; print( 'Warning: lib/ui/ui.dart $className.$methodName has a different parameter ' @@ -65,7 +126,10 @@ void main() { } // Technically you could re-order named parameters and still be valid, // but we enforce that they are identical. - for (int i = 0; i < uiMethod.parameters.parameters.length && i < webMethod.parameters.parameters.length; i++) { + for (int i = 0; + i < uiMethod.parameters.parameters.length && + i < webMethod.parameters.parameters.length; + i++) { final FormalParameter uiParam = uiMethod.parameters.parameters[i]; final FormalParameter webParam = webMethod.parameters.parameters[i]; if (webParam.identifier.name != uiParam.identifier.name) { @@ -73,12 +137,12 @@ void main() { print('Warning: lib/ui/ui.dart $className.$methodName parameter $i' ' ${uiParam.identifier.name} has a different name in lib/stub_ui/ui.dart.'); } - if (uiParam.isPositional && !webParam.isPositional) { + if (uiParam.isPositional != webParam.isPositional) { failed = true; print('Warning: lib/ui/ui.dart $className.$methodName parameter $i' '${uiParam.identifier.name} is positional, but not in lib/stub_ui/ui.dart.'); } - if (uiParam.isNamed && !webParam.isNamed) { + if (uiParam.isNamed != webParam.isNamed) { failed = true; print('Warning: lib/ui/ui.dart $className.$methodName parameter $i' '${uiParam.identifier.name} is named, but not in lib/stub_ui/ui.dart.'); @@ -94,6 +158,8 @@ void main() { exit(0); } +void _checkParameters() {} + // Collects all public classes defined by the part files of [unit]. void _collectPublicClasses(CompilationUnit unit, Map destination, String root) { @@ -121,6 +187,24 @@ void _collectPublicClasses(CompilationUnit unit, } } +void _collectPublicConstructors(ClassDeclaration classDeclaration, + Map destination) { + for (ClassMember member in classDeclaration.members) { + if (member is! ConstructorDeclaration) { + continue; + } + final ConstructorDeclaration method = member; + if (method?.name?.name == null) { + destination['Unnamed Constructor'] = method; + continue; + } + if (method.name.name.startsWith('_')) { + continue; + } + destination[method.name.name] = method; + } +} + void _collectPublicMethods(ClassDeclaration classDeclaration, Map destination) { for (ClassMember member in classDeclaration.members) {