Fix lint warnings across web_ui, add missing browserEngine case in text field. (flutter/engine#14535)

* Fix lint warnings across web_ui

* add textureCoordinates/indices getters for Vertices

* fix compositor indices
This commit is contained in:
Ferhat 2019-12-19 17:39:33 -08:00 committed by GitHub
parent 77b9134e96
commit 62edec4b08
15 changed files with 31 additions and 30 deletions

View File

@ -12,7 +12,7 @@ import 'package:typed_data/typed_buffers.dart';
import 'package:test_api/src/utils.dart';
import 'common.dart'; // ignore: implementation_imports
import 'common.dart'; // ignore: unused_import
/// An interface for running browser instances.
///

View File

@ -472,6 +472,8 @@ class Mutator {
return matrix == typedOther.matrix;
case MutatorType.opacity:
return alpha == typedOther.alpha;
default:
return false;
}
}

View File

@ -17,7 +17,6 @@ class LayerScene implements ui.Scene {
@override
Future<ui.Image> toImage(int width, int height) => null;
@override
html.Element get webOnlyRootElement => null;
}

View File

@ -52,7 +52,7 @@ class Surface {
SubmitCallback submitCallback =
(SurfaceFrame surfaceFrame, SkCanvas canvas) {
_presentSurface(canvas);
return _presentSurface(canvas);
};
return SurfaceFrame(surface, submitCallback);

View File

@ -285,6 +285,7 @@ Map<String, js.JsObject> toSkFontStyle(
break;
}
}
return style;
}
class SkParagraph implements ui.Paragraph {

View File

@ -16,6 +16,8 @@ class SkVertices implements ui.Vertices {
final Int32List _colors;
final Float32List _positions;
final ui.VertexMode _mode;
final Float32List _textureCoordinates;
final Uint16List _indices;
SkVertices(
ui.VertexMode mode,
@ -28,7 +30,10 @@ class SkVertices implements ui.Vertices {
_colors =
Int32List.fromList(colors.map((ui.Color c) => c.value).toList()),
_positions = encodePointList(positions),
_mode = mode {
_mode = mode,
_textureCoordinates = (textureCoordinates != null)
? encodePointList(textureCoordinates) : null,
_indices = indices != null ? Uint16List.fromList(indices) : null {
if (textureCoordinates != null &&
textureCoordinates.length != positions.length)
throw ArgumentError(
@ -41,16 +46,10 @@ class SkVertices implements ui.Vertices {
'"indices" values must be valid indices in the positions list.');
final Float32List encodedPositions = encodePointList(positions);
final Float32List encodedTextureCoordinates = (textureCoordinates != null)
? encodePointList(textureCoordinates)
: null;
final Int32List encodedColors =
colors != null ? _encodeColorList(colors) : null;
final Uint16List encodedIndices =
indices != null ? Uint16List.fromList(indices) : null;
if (!_init(mode, encodedPositions, encodedTextureCoordinates, encodedColors,
encodedIndices))
if (!_init(mode, encodedPositions, _textureCoordinates, encodedColors,
_indices))
throw ArgumentError('Invalid configuration for vertices.');
}
@ -64,7 +63,9 @@ class SkVertices implements ui.Vertices {
assert(positions != null),
_colors = colors,
_positions = positions,
_mode = mode {
_mode = mode,
_textureCoordinates = textureCoordinates,
_indices = indices {
if (textureCoordinates != null &&
textureCoordinates.length != positions.length)
throw ArgumentError(
@ -134,4 +135,8 @@ class SkVertices implements ui.Vertices {
@override
ui.VertexMode get mode => _mode;
Float32List get textureCoordinates => _textureCoordinates;
Uint16List get indices => _indices;
}

View File

@ -62,6 +62,7 @@ class TextField extends RoleManager {
case BrowserEngine.blink:
case BrowserEngine.edge:
case BrowserEngine.firefox:
case BrowserEngine.ie11:
case BrowserEngine.unknown:
_initializeForBlink();
break;

View File

@ -20,8 +20,6 @@ class SurfacePaint implements ui.Paint {
_paintData.blendMode = value;
}
ui.BlendMode _blendMode;
@override
ui.PaintingStyle get style => _paintData.style ?? ui.PaintingStyle.fill;
@ -102,9 +100,6 @@ class SurfacePaint implements ui.Paint {
@override
set invertColors(bool value) {}
@override
ui.Color _color = _defaultPaintColor;
static const ui.Color _defaultPaintColor = ui.Color(0xFF000000);
@override

View File

@ -63,7 +63,7 @@ class Vertices {
final Float32List _positions;
final Float32List _textureCoordinates;
final Int32List _colors;
final Uint16List _indices;
final Uint16List _indices; // ignore: unused_field
Vertices._(
VertexMode mode,
@ -159,6 +159,8 @@ class Vertices {
VertexMode get mode => _mode;
Int32List get colors => _colors;
Float32List get positions => _positions;
Float32List get textureCoordinates => _textureCoordinates;
Uint16List get indices => _indices;
}
/// Records a [Picture] containing a sequence of graphical operations.
@ -1157,21 +1159,18 @@ class RawRecordingCanvas extends engine.BitmapCanvas
clear();
}
@override
engine.RecordingCanvas beginRecording(Rect bounds) =>
throw UnsupportedError('');
@override
Picture endRecording() => throw UnsupportedError('');
@override
engine.RecordingCanvas _canvas;
engine.RecordingCanvas _canvas; // ignore: unused_field
@override
bool _isRecording = true;
bool _isRecording = true; // ignore: unused_field
@override
bool get isRecording => true;
@override
Rect cullRect;
}

View File

@ -5,6 +5,7 @@
part of ui;
// Corelib 'print' implementation.
// ignore: unused_element
void _print(dynamic arg) {
_Logger._printString(arg.toString());
}

View File

@ -778,7 +778,7 @@ abstract class Window {
/// no later frames to batch.
TimingsCallback get onReportTimings => _onReportTimings;
TimingsCallback _onReportTimings;
Zone _onReportTimingsZone;
Zone _onReportTimingsZone; // ignore: unused_field
set onReportTimings(TimingsCallback callback) {
_onReportTimings = callback;
}

View File

@ -3,7 +3,6 @@
// found in the LICENSE file.
import 'dart:html' as html;
import 'dart:math' as math;
import 'dart:js_util' as js_util;
import 'package:ui/ui.dart' hide TextStyle;
@ -16,7 +15,6 @@ void main() async {
const double screenWidth = 600.0;
const double screenHeight = 800.0;
const Rect screenRect = Rect.fromLTWH(0, 0, screenWidth, screenHeight);
final Paint testPaint = Paint()..color = const Color(0xFFFF0000);
// Commit a recording canvas to a bitmap, and compare with the expected
Future<void> _checkScreenshot(RecordingCanvas rc, String fileName,

View File

@ -16,7 +16,6 @@ void main() async {
const double screenWidth = 600.0;
const double screenHeight = 800.0;
const Rect screenRect = Rect.fromLTWH(0, 0, screenWidth, screenHeight);
final Paint testPaint = Paint()..color = const Color(0xFFFF0000);
// Commit a recording canvas to a bitmap, and compare with the expected
Future<void> _checkScreenshot(RecordingCanvas rc, String fileName,

View File

@ -480,7 +480,7 @@ void _testCullRectComputation() {
await matchGoldenFile('compositing_3d_rotate1.png', region: region);
final PersistedStandardPicture picture = enumeratePictures().single;
final PersistedStandardPicture picture = enumeratePictures().single; // ignore: unused_local_variable
// TODO(https://github.com/flutter/flutter/issues/40395):
// Needs ability to set iframe to 500,100 size. Current screen seems to be 500,500.
// expect(

View File

@ -72,6 +72,7 @@ void main() async {
test('Should draw black hairline triangles when colors array is null'
' and Paint() has no color.',
() async {
// ignore: unused_local_variable
final Int32List colors = Int32List.fromList(<int>[
0xFFFF0000, 0xFF00FF00, 0xFF0000FF,
0xFFFF0000, 0xFF00FF00, 0xFF0000FF,