Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/web_ui/dev/browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
2 changes: 2 additions & 0 deletions lib/web_ui/lib/src/engine/compositor/embedded_views.dart
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,8 @@ class Mutator {
return matrix == typedOther.matrix;
case MutatorType.opacity:
return alpha == typedOther.alpha;
default:
return false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/web_ui/lib/src/engine/compositor/surface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Surface {

SubmitCallback submitCallback =
(SurfaceFrame surfaceFrame, SkCanvas canvas) {
_presentSurface(canvas);
return _presentSurface(canvas);
};

return SurfaceFrame(surface, submitCallback);
Expand Down
1 change: 1 addition & 0 deletions lib/web_ui/lib/src/engine/compositor/text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ Map<String, js.JsObject> toSkFontStyle(
break;
}
}
return style;
}

class SkParagraph implements ui.Paragraph {
Expand Down
22 changes: 15 additions & 7 deletions lib/web_ui/lib/src/engine/compositor/vertices.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(
Expand All @@ -41,15 +46,12 @@ 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,
if (!_init(mode, encodedPositions, _textureCoordinates, encodedColors,
encodedIndices))
throw ArgumentError('Invalid configuration for vertices.');
}
Expand All @@ -64,7 +66,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(
Expand Down Expand Up @@ -134,4 +138,8 @@ class SkVertices implements ui.Vertices {

@override
ui.VertexMode get mode => _mode;

Float32List get textureCoordinates => _textureCoordinates;

Uint16List get indices => _indices;
}
1 change: 1 addition & 0 deletions lib/web_ui/lib/src/engine/semantics/text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions lib/web_ui/lib/src/engine/surface/painting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions lib/web_ui/lib/src/ui/canvas.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
1 change: 1 addition & 0 deletions lib/web_ui/lib/src/ui/natives.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
part of ui;

// Corelib 'print' implementation.
// ignore: unused_element
void _print(dynamic arg) {
_Logger._printString(arg.toString());
}
Expand Down
2 changes: 1 addition & 1 deletion lib/web_ui/lib/src/ui/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down