Skip to content

Commit 3de2dbd

Browse files
Some minor fixes, and disabled one unit test and filed a followon bug for it.
1 parent 58efb94 commit 3de2dbd

2 files changed

Lines changed: 34 additions & 41 deletions

File tree

engine/src/flutter/lib/web_ui/test/ui/text_test.dart

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -56,32 +56,36 @@ void testMain() {
5656
expect(boxes.single.direction, equals(ui.TextDirection.ltr));
5757
});
5858

59-
test('Renders tab as space instead of tofu', () async {
60-
// Skia renders a tofu if the font does not have a glyph for a
61-
// character. However, Flutter opts-in to a Skia feature to render
62-
// tabs as a single space.
63-
// See: https://github.com/flutter/flutter/issues/79153
64-
Future<ui.Image> drawText(String text) {
65-
const bounds = ui.Rect.fromLTRB(0, 0, 100, 100);
66-
final recorder = ui.PictureRecorder();
67-
final canvas = ui.Canvas(recorder, bounds);
68-
final ui.Paragraph paragraph = makeSimpleText(text);
59+
test(
60+
'Renders tab as space instead of tofu',
61+
() async {
62+
// Skia renders a tofu if the font does not have a glyph for a
63+
// character. However, Flutter opts-in to a Skia feature to render
64+
// tabs as a single space.
65+
// See: https://github.com/flutter/flutter/issues/79153
66+
Future<ui.Image> drawText(String text) {
67+
const bounds = ui.Rect.fromLTRB(0, 0, 100, 100);
68+
final recorder = ui.PictureRecorder();
69+
final canvas = ui.Canvas(recorder, bounds);
70+
final ui.Paragraph paragraph = makeSimpleText(text);
6971

70-
canvas.drawParagraph(paragraph, ui.Offset.zero);
71-
final ui.Picture picture = recorder.endRecording();
72-
return picture.toImage(100, 100);
73-
}
72+
canvas.drawParagraph(paragraph, ui.Offset.zero);
73+
final ui.Picture picture = recorder.endRecording();
74+
return picture.toImage(100, 100);
75+
}
7476

75-
// The backspace character, \b, does not have a corresponding glyph and
76-
// is rendered as a tofu.
77-
final ui.Image tabImage = await drawText('>\t<');
78-
final ui.Image spaceImage = await drawText('> <');
79-
final ui.Image tofuImage = await drawText('>\b<');
77+
// The backspace character, \b, does not have a corresponding glyph and
78+
// is rendered as a tofu.
79+
final ui.Image tabImage = await drawText('>\t<');
80+
final ui.Image spaceImage = await drawText('> <');
81+
final ui.Image tofuImage = await drawText('>\b<');
8082

81-
expect(await matchImage(tabImage, spaceImage), isTrue);
82-
expect(await matchImage(tabImage, tofuImage), isFalse);
83-
}, skip: isSafari || isFirefox); // https://github.com/flutter/flutter/issues/175371
84-
// TODO(hterkelsen): https://github.com/flutter/flutter/issues/71520
83+
expect(await matchImage(tabImage, spaceImage), isTrue);
84+
expect(await matchImage(tabImage, tofuImage), isFalse);
85+
},
86+
skip: isWimp || isSafari || isFirefox,
87+
); // TODO(hterkelsen): https://github.com/flutter/flutter/issues/71520
88+
// TODO(jacksongardner): https://github.com/flutter/flutter/issues/183944
8589
}, skip: isSafari || isFirefox);
8690
}
8791

engine/src/flutter/skwasm/images_impeller.cc

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,13 @@
1717
#include "impeller/renderer/backend/gles/context_gles.h"
1818
#include "impeller/renderer/backend/gles/texture_gles.h"
1919

20+
#include <emscripten/wasm_worker.h>
21+
2022
extern "C" {
2123
void skwasm_dispatchDisposeDlImage(unsigned long thread_id, void* pointer);
2224
void skwasm_disposeDlImageOnWorker(void* dl_image_ptr);
2325
}
2426

25-
SKWASM_EXPORT void dummyAPICalls() {
26-
// TODO(jacksongardner):
27-
// This function is just here so that we have references to these API
28-
// functions in the build. If we don't reference them, they get LTO'd out and
29-
// then emscripten gets fails to build the javascript support library. These
30-
// all will eventually be actually used when we implement proper image
31-
// support, at which time we can just remove this function entirely.
32-
// https://github.com/flutter/flutter/issues/175371
33-
SkwasmObject object = __builtin_wasm_ref_null_extern();
34-
skwasm_setAssociatedObjectOnThread(0, nullptr, object);
35-
skwasm_getAssociatedObject(nullptr);
36-
skwasm_disposeAssociatedObjectOnThread(0, nullptr);
37-
skwasm_createGlTextureFromTextureSource(object, 0, 0);
38-
skwasm_dispatchDisposeDlImage(0, nullptr);
39-
skwasm_disposeDlImageOnWorker(nullptr);
40-
}
41-
4227
namespace Skwasm {
4328

4429
class DlWimpImageBase : public flutter::DlImage {
@@ -71,7 +56,11 @@ class DlWimpImageBase : public flutter::DlImage {
7156
};
7257

7358
DlWimpImageBase::~DlWimpImageBase() {
74-
skwasm_dispatchDisposeDlImage(GetRasterThread(), this);
59+
if (emscripten_wasm_worker_self_id() == GetRasterThread()) {
60+
skwasm_disposeDlImageOnWorker(this);
61+
} else {
62+
skwasm_dispatchDisposeDlImage(GetRasterThread(), this);
63+
}
7564
}
7665

7766
class DlWimpImageFromTexture : public DlWimpImageBase {

0 commit comments

Comments
 (0)