未验证 提交 22413efc 编写于 作者: J Jim Graham 提交者: GitHub

Update formatting in web_ui scene bulder to match flutter style and dartfmt. (#14539)

上级 ad1ab564
此差异已折叠。
......@@ -26,12 +26,13 @@ class LayerSceneBuilder implements ui.SceneBuilder {
ContainerLayer currentLayer;
@override
void addChildScene(
{ui.Offset offset = ui.Offset.zero,
double width = 0.0,
double height = 0.0,
ui.SceneHost sceneHost,
bool hitTestable = true}) {
void addChildScene({
ui.Offset offset = ui.Offset.zero,
double width = 0.0,
double height = 0.0,
ui.SceneHost sceneHost,
bool hitTestable = true,
}) {
throw UnimplementedError();
}
......@@ -42,10 +43,13 @@ class LayerSceneBuilder implements ui.SceneBuilder {
}
@override
void addPicture(ui.Offset offset, ui.Picture picture,
{bool isComplexHint = false, bool willChangeHint = false}) {
currentLayer
.add(PictureLayer(picture, offset, isComplexHint, willChangeHint));
void addPicture(
ui.Offset offset,
ui.Picture picture, {
bool isComplexHint = false,
bool willChangeHint = false,
}) {
currentLayer.add(PictureLayer(picture, offset, isComplexHint, willChangeHint));
}
@override
......@@ -57,11 +61,13 @@ class LayerSceneBuilder implements ui.SceneBuilder {
}
@override
void addTexture(int textureId,
{ui.Offset offset = ui.Offset.zero,
double width = 0.0,
double height = 0.0,
bool freeze = false}) {
void addTexture(
int textureId, {
ui.Offset offset = ui.Offset.zero,
double width = 0.0,
double height = 0.0,
bool freeze = false,
}) {
// TODO(b/128315641): implement addTexture.
}
......@@ -90,43 +96,59 @@ class LayerSceneBuilder implements ui.SceneBuilder {
}
@override
ui.BackdropFilterEngineLayer pushBackdropFilter(ui.ImageFilter filter,
{ui.EngineLayer oldLayer}) {
ui.BackdropFilterEngineLayer pushBackdropFilter(
ui.ImageFilter filter, {
ui.EngineLayer oldLayer,
}) {
pushLayer(BackdropFilterLayer(filter));
return null;
}
@override
ui.ClipPathEngineLayer pushClipPath(ui.Path path,
{ui.Clip clipBehavior = ui.Clip.antiAlias, ui.EngineLayer oldLayer}) {
ui.ClipPathEngineLayer pushClipPath(
ui.Path path, {
ui.Clip clipBehavior = ui.Clip.antiAlias,
ui.EngineLayer oldLayer,
}) {
pushLayer(ClipPathLayer(path, clipBehavior));
return null;
}
@override
ui.ClipRRectEngineLayer pushClipRRect(ui.RRect rrect,
{ui.Clip clipBehavior, ui.EngineLayer oldLayer}) {
ui.ClipRRectEngineLayer pushClipRRect(
ui.RRect rrect, {
ui.Clip clipBehavior,
ui.EngineLayer oldLayer,
}) {
pushLayer(ClipRRectLayer(rrect, clipBehavior));
return null;
}
@override
ui.ClipRectEngineLayer pushClipRect(ui.Rect rect,
{ui.Clip clipBehavior = ui.Clip.antiAlias, ui.EngineLayer oldLayer}) {
ui.ClipRectEngineLayer pushClipRect(
ui.Rect rect, {
ui.Clip clipBehavior = ui.Clip.antiAlias,
ui.EngineLayer oldLayer,
}) {
pushLayer(ClipRectLayer(rect, clipBehavior));
return null;
}
@override
ui.ColorFilterEngineLayer pushColorFilter(ui.ColorFilter filter,
{ui.ColorFilterEngineLayer oldLayer}) {
ui.ColorFilterEngineLayer pushColorFilter(
ui.ColorFilter filter, {
ui.ColorFilterEngineLayer oldLayer,
}) {
assert(filter != null);
throw UnimplementedError();
}
@override
ui.OffsetEngineLayer pushOffset(double dx, double dy,
{ui.EngineLayer oldLayer}) {
ui.OffsetEngineLayer pushOffset(
double dx,
double dy, {
ui.EngineLayer oldLayer,
}) {
final Matrix4 matrix = Matrix4.translationValues(dx, dy, 0.0);
final TransformLayer layer = TransformLayer(matrix);
pushLayer(layer);
......@@ -134,8 +156,11 @@ class LayerSceneBuilder implements ui.SceneBuilder {
}
@override
ui.OpacityEngineLayer pushOpacity(int alpha,
{ui.EngineLayer oldLayer, ui.Offset offset = ui.Offset.zero}) {
ui.OpacityEngineLayer pushOpacity(
int alpha, {
ui.EngineLayer oldLayer,
ui.Offset offset = ui.Offset.zero,
}) {
final OpacityLayer layer = OpacityLayer(alpha, offset);
pushLayer(layer);
return layer;
......@@ -158,14 +183,19 @@ class LayerSceneBuilder implements ui.SceneBuilder {
@override
ui.ShaderMaskEngineLayer pushShaderMask(
ui.Shader shader, ui.Rect maskRect, ui.BlendMode blendMode,
{ui.EngineLayer oldLayer}) {
ui.Shader shader,
ui.Rect maskRect,
ui.BlendMode blendMode, {
ui.EngineLayer oldLayer,
}) {
throw UnimplementedError();
}
@override
ui.TransformEngineLayer pushTransform(Float64List matrix4,
{ui.EngineLayer oldLayer}) {
ui.TransformEngineLayer pushTransform(
Float64List matrix4, {
ui.EngineLayer oldLayer,
}) {
final Matrix4 matrix = Matrix4.fromList(matrix4);
pushLayer(TransformLayer(matrix));
return null;
......@@ -201,8 +231,15 @@ class LayerSceneBuilder implements ui.SceneBuilder {
}
@override
void setProperties(double width, double height, double insetTop,
double insetRight, double insetBottom, double insetLeft, bool focusable) {
void setProperties(
double width,
double height,
double insetTop,
double insetRight,
double insetBottom,
double insetLeft,
bool focusable,
) {
throw UnimplementedError();
}
}
......@@ -9,8 +9,7 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
_surfaceStack.add(PersistedScene(_lastFrameScene));
}
final List<PersistedContainerSurface> _surfaceStack =
<PersistedContainerSurface>[];
final List<PersistedContainerSurface> _surfaceStack = <PersistedContainerSurface>[];
/// The scene built by this scene builder.
///
......@@ -19,8 +18,7 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
assert(() {
if (_surfaceStack.length != 1) {
final String surfacePrintout = _surfaceStack
.map<Type>((PersistedContainerSurface surface) =>
surface.runtimeType)
.map<Type>((PersistedContainerSurface surface) => surface.runtimeType)
.toList()
.join(', ');
throw Exception('Incorrect sequence of push/pop operations while '
......@@ -65,8 +63,11 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
///
/// See [pop] for details about the operation stack.
@override
ui.OffsetEngineLayer pushOffset(double dx, double dy,
{ui.OffsetEngineLayer oldLayer}) {
ui.OffsetEngineLayer pushOffset(
double dx,
double dy, {
ui.OffsetEngineLayer oldLayer,
}) {
return _pushSurface(PersistedOffset(oldLayer, dx, dy));
}
......@@ -76,8 +77,10 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
///
/// See [pop] for details about the operation stack.
@override
ui.TransformEngineLayer pushTransform(Float64List matrix4,
{ui.TransformEngineLayer oldLayer}) {
ui.TransformEngineLayer pushTransform(
Float64List matrix4, {
ui.TransformEngineLayer oldLayer,
}) {
if (matrix4 == null) {
throw ArgumentError('"matrix4" argument cannot be null');
}
......@@ -94,8 +97,11 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
/// See [pop] for details about the operation stack, and [Clip] for different clip modes.
/// By default, the clip will be anti-aliased (clip = [Clip.antiAlias]).
@override
ui.ClipRectEngineLayer pushClipRect(ui.Rect rect,
{ui.Clip clipBehavior = ui.Clip.antiAlias, ui.ClipRectEngineLayer oldLayer}) {
ui.ClipRectEngineLayer pushClipRect(
ui.Rect rect, {
ui.Clip clipBehavior = ui.Clip.antiAlias,
ui.ClipRectEngineLayer oldLayer,
}) {
assert(clipBehavior != null);
assert(clipBehavior != ui.Clip.none);
return _pushSurface(PersistedClipRect(oldLayer, rect));
......@@ -107,10 +113,12 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
///
/// See [pop] for details about the operation stack.
@override
ui.ClipRRectEngineLayer pushClipRRect(ui.RRect rrect,
{ui.Clip clipBehavior, ui.ClipRRectEngineLayer oldLayer}) {
return _pushSurface(
PersistedClipRRect(oldLayer, rrect, clipBehavior));
ui.ClipRRectEngineLayer pushClipRRect(
ui.RRect rrect, {
ui.Clip clipBehavior,
ui.ClipRRectEngineLayer oldLayer,
}) {
return _pushSurface(PersistedClipRRect(oldLayer, rrect, clipBehavior));
}
/// Pushes a path clip operation onto the operation stack.
......@@ -119,8 +127,11 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
///
/// See [pop] for details about the operation stack.
@override
ui.ClipPathEngineLayer pushClipPath(ui.Path path,
{ui.Clip clipBehavior = ui.Clip.antiAlias, ui.ClipPathEngineLayer oldLayer}) {
ui.ClipPathEngineLayer pushClipPath(
ui.Path path, {
ui.Clip clipBehavior = ui.Clip.antiAlias,
ui.ClipPathEngineLayer oldLayer,
}) {
assert(clipBehavior != null);
assert(clipBehavior != ui.Clip.none);
return _pushSurface(PersistedClipPath(oldLayer, path, clipBehavior));
......@@ -135,8 +146,11 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
///
/// See [pop] for details about the operation stack.
@override
ui.OpacityEngineLayer pushOpacity(int alpha,
{ui.Offset offset = ui.Offset.zero, ui.OpacityEngineLayer oldLayer}) {
ui.OpacityEngineLayer pushOpacity(
int alpha, {
ui.Offset offset = ui.Offset.zero,
ui.OpacityEngineLayer oldLayer,
}) {
return _pushSurface(PersistedOpacity(oldLayer, alpha, offset));
}
......@@ -151,8 +165,10 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
///
/// See [pop] for details about the operation stack.
@override
ui.ColorFilterEngineLayer pushColorFilter(ui.ColorFilter filter,
{ui.ColorFilterEngineLayer oldLayer}) {
ui.ColorFilterEngineLayer pushColorFilter(
ui.ColorFilter filter, {
ui.ColorFilterEngineLayer oldLayer,
}) {
assert(filter != null);
throw UnimplementedError();
}
......@@ -164,8 +180,10 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
///
/// See [pop] for details about the operation stack.
@override
ui.BackdropFilterEngineLayer pushBackdropFilter(ui.ImageFilter filter,
{ui.BackdropFilterEngineLayer oldLayer}) {
ui.BackdropFilterEngineLayer pushBackdropFilter(
ui.ImageFilter filter, {
ui.BackdropFilterEngineLayer oldLayer,
}) {
return _pushSurface(PersistedBackdropFilter(oldLayer, filter));
}
......@@ -177,8 +195,11 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
/// See [pop] for details about the operation stack.
@override
ui.ShaderMaskEngineLayer pushShaderMask(
ui.Shader shader, ui.Rect maskRect, ui.BlendMode blendMode,
{ui.ShaderMaskEngineLayer oldLayer}) {
ui.Shader shader,
ui.Rect maskRect,
ui.BlendMode blendMode, {
ui.ShaderMaskEngineLayer oldLayer,
}) {
throw UnimplementedError();
}
......@@ -266,8 +287,7 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
/// for more details.
@override
void addPerformanceOverlay(int enabledOptions, ui.Rect bounds) {
_addPerformanceOverlay(
enabledOptions, bounds.left, bounds.right, bounds.top, bounds.bottom);
_addPerformanceOverlay(enabledOptions, bounds.left, bounds.right, bounds.top, bounds.bottom);
}
/// Whether we've already warned the user about the lack of the performance
......@@ -276,12 +296,16 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
/// We use this to avoid spamming the console with redundant warning messages.
static bool _webOnlyDidWarnAboutPerformanceOverlay = false;
void _addPerformanceOverlay(int enabledOptions, double left, double right,
double top, double bottom) {
void _addPerformanceOverlay(
int enabledOptions,
double left,
double right,
double top,
double bottom,
) {
if (!_webOnlyDidWarnAboutPerformanceOverlay) {
_webOnlyDidWarnAboutPerformanceOverlay = true;
html.window.console
.warn('The performance overlay isn\'t supported on the web');
html.window.console.warn('The performance overlay isn\'t supported on the web');
}
}
......@@ -302,8 +326,7 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
if (willChangeHint) {
hints |= 2;
}
_addSurface(
persistedPictureFactory(offset.dx, offset.dy, picture, hints));
_addSurface(persistedPictureFactory(offset.dx, offset.dy, picture, hints));
}
/// Adds a backend texture to the scene.
......@@ -311,17 +334,18 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
/// The texture is scaled to the given size and rasterized at the given
/// offset.
@override
void addTexture(int textureId,
{ui.Offset offset = ui.Offset.zero,
double width = 0.0,
double height = 0.0,
bool freeze = false}) {
void addTexture(
int textureId, {
ui.Offset offset = ui.Offset.zero,
double width = 0.0,
double height = 0.0,
bool freeze = false,
}) {
assert(offset != null, 'Offset argument was null');
_addTexture(offset.dx, offset.dy, width, height, textureId);
}
void _addTexture(
double dx, double dy, double width, double height, int textureId) {
void _addTexture(double dx, double dy, double width, double height, int textureId) {
// In test mode, allow this to be a no-op.
if (!ui.debugEmulateFlutterTesterEnvironment) {
throw UnimplementedError('Textures are not supported in Flutter Web');
......@@ -368,17 +392,24 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
/// (Fuchsia-only) Adds a scene rendered by another application to the scene
/// for this application.
@override
void addChildScene(
{ui.Offset offset = ui.Offset.zero,
double width = 0.0,
double height = 0.0,
ui.SceneHost sceneHost,
bool hitTestable = true}) {
void addChildScene({
ui.Offset offset = ui.Offset.zero,
double width = 0.0,
double height = 0.0,
ui.SceneHost sceneHost,
bool hitTestable = true,
}) {
_addChildScene(offset.dx, offset.dy, width, height, sceneHost, hitTestable);
}
void _addChildScene(double dx, double dy, double width, double height,
ui.SceneHost sceneHost, bool hitTestable) {
void _addChildScene(
double dx,
double dy,
double width,
double height,
ui.SceneHost sceneHost,
bool hitTestable,
) {
throw UnimplementedError();
}
......@@ -475,8 +506,15 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
/// Set properties on the linked scene. These properties include its bounds,
/// as well as whether it can be the target of focus events or not.
@override
void setProperties(double width, double height, double insetTop,
double insetRight, double insetBottom, double insetLeft, bool focusable) {
void setProperties(
double width,
double height,
double insetTop,
double insetRight,
double insetBottom,
double insetLeft,
bool focusable,
) {
throw UnimplementedError();
}
}
......@@ -117,16 +117,21 @@ abstract class SceneBuilder {
/// This is equivalent to [pushTransform] with a matrix with only translation.
///
/// See [pop] for details about the operation stack.
OffsetEngineLayer pushOffset(double dx, double dy,
{OffsetEngineLayer oldLayer});
OffsetEngineLayer pushOffset(
double dx,
double dy, {
OffsetEngineLayer oldLayer,
});
/// Pushes a transform operation onto the operation stack.
///
/// The objects are transformed by the given matrix before rasterization.
///
/// See [pop] for details about the operation stack.
TransformEngineLayer pushTransform(Float64List matrix4,
{TransformEngineLayer oldLayer});
TransformEngineLayer pushTransform(
Float64List matrix4, {
TransformEngineLayer oldLayer,
});
/// Pushes a rectangular clip operation onto the operation stack.
///
......@@ -134,24 +139,33 @@ abstract class SceneBuilder {
///
/// See [pop] for details about the operation stack, and [Clip] for different clip modes.
/// By default, the clip will be anti-aliased (clip = [Clip.antiAlias]).
ClipRectEngineLayer pushClipRect(Rect rect,
{Clip clipBehavior = Clip.antiAlias, ClipRectEngineLayer oldLayer});
ClipRectEngineLayer pushClipRect(
Rect rect, {
Clip clipBehavior = Clip.antiAlias,
ClipRectEngineLayer oldLayer,
});
/// Pushes a rounded-rectangular clip operation onto the operation stack.
///
/// Rasterization outside the given rounded rectangle is discarded.
///
/// See [pop] for details about the operation stack.
ClipRRectEngineLayer pushClipRRect(RRect rrect,
{Clip clipBehavior, ClipRRectEngineLayer oldLayer});
ClipRRectEngineLayer pushClipRRect(
RRect rrect, {
Clip clipBehavior,
ClipRRectEngineLayer oldLayer,
});
/// Pushes a path clip operation onto the operation stack.
///
/// Rasterization outside the given path is discarded.
///
/// See [pop] for details about the operation stack.
ClipPathEngineLayer pushClipPath(Path path,
{Clip clipBehavior = Clip.antiAlias, ClipPathEngineLayer oldLayer});
ClipPathEngineLayer pushClipPath(
Path path, {
Clip clipBehavior = Clip.antiAlias,
ClipPathEngineLayer oldLayer,
});
/// Pushes an opacity operation onto the operation stack.
///
......@@ -161,8 +175,11 @@ abstract class SceneBuilder {
/// opacity).
///
/// See [pop] for details about the operation stack.
OpacityEngineLayer pushOpacity(int alpha,
{Offset offset = Offset.zero, OpacityEngineLayer oldLayer});
OpacityEngineLayer pushOpacity(
int alpha, {
Offset offset = Offset.zero,
OpacityEngineLayer oldLayer,
});
/// Pushes a color filter operation onto the operation stack.
///
......@@ -174,8 +191,10 @@ abstract class SceneBuilder {
/// {@macro dart.ui.sceneBuilder.oldLayerVsRetained}
///
/// See [pop] for details about the operation stack.
ColorFilterEngineLayer pushColorFilter(ColorFilter filter,
{ColorFilterEngineLayer oldLayer});
ColorFilterEngineLayer pushColorFilter(
ColorFilter filter, {
ColorFilterEngineLayer oldLayer,
});
/// Pushes a backdrop filter operation onto the operation stack.
///
......@@ -183,8 +202,10 @@ abstract class SceneBuilder {
/// rasterizing the given objects.
///
/// See [pop] for details about the operation stack.
BackdropFilterEngineLayer pushBackdropFilter(ImageFilter filter,
{BackdropFilterEngineLayer oldLayer});
BackdropFilterEngineLayer pushBackdropFilter(
ImageFilter filter, {
BackdropFilterEngineLayer oldLayer,
});
/// Pushes a shader mask operation onto the operation stack.
///
......@@ -193,8 +214,11 @@ abstract class SceneBuilder {
///
/// See [pop] for details about the operation stack.
ShaderMaskEngineLayer pushShaderMask(
Shader shader, Rect maskRect, BlendMode blendMode,
{ShaderMaskEngineLayer oldLayer});
Shader shader,
Rect maskRect,
BlendMode blendMode, {
ShaderMaskEngineLayer oldLayer,
});
/// Pushes a physical layer operation for an arbitrary shape onto the
/// operation stack.
......@@ -274,11 +298,13 @@ abstract class SceneBuilder {
///
/// The texture is scaled to the given size and rasterized at the given
/// offset.
void addTexture(int textureId,
{Offset offset = Offset.zero,
double width = 0.0,
double height = 0.0,
bool freeze = false});
void addTexture(
int textureId, {
Offset offset = Offset.zero,
double width = 0.0,
double height = 0.0,
bool freeze = false,
});
/// Adds a platform view (e.g an iOS UIView) to the scene.
///
......@@ -305,12 +331,13 @@ abstract class SceneBuilder {
/// (Fuchsia-only) Adds a scene rendered by another application to the scene
/// for this application.
void addChildScene(
{Offset offset = Offset.zero,
double width = 0.0,
double height = 0.0,
SceneHost sceneHost,
bool hitTestable = true});
void addChildScene({
Offset offset = Offset.zero,
double width = 0.0,
double height = 0.0,
SceneHost sceneHost,
bool hitTestable = true,
});
/// Sets a threshold after which additional debugging information should be
/// recorded.
......@@ -357,8 +384,15 @@ abstract class SceneBuilder {
/// Set properties on the linked scene. These properties include its bounds,
/// as well as whether it can be the target of focus events or not.
void setProperties(double width, double height, double insetTop,
double insetRight, double insetBottom, double insetLeft, bool focusable);
void setProperties(
double width,
double height,
double insetTop,
double insetRight,
double insetBottom,
double insetLeft,
bool focusable,
);
}
/// A handle for the framework to hold and retain an engine layer across frames.
......@@ -378,10 +412,11 @@ class SceneHost {
///
/// The SceneHost takes ownership of the provided ViewHolder token.
SceneHost(
dynamic viewHolderToken,
void Function() viewConnectedCallback,
void Function() viewDisconnectedCallback,
void Function(bool) viewStateChangedCallback);
dynamic viewHolderToken,
void Function() viewConnectedCallback,
void Function() viewDisconnectedCallback,
void Function(bool) viewStateChangedCallback,
);
/// Releases the resources associated with the SceneHost.
///
......@@ -390,8 +425,15 @@ class SceneHost {
/// Set properties on the linked scene. These properties include its bounds,
/// as well as whether it can be the target of focus events or not.
void setProperties(double width, double height, double insetTop,
double insetRight, double insetBottom, double insetLeft, bool focusable) {
void setProperties(
double width,
double height,
double insetTop,
double insetRight,
double insetBottom,
double insetLeft,
bool focusable,
) {
throw UnimplementedError();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册