Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Roll Skia from dfb838747295 to 9e51c2c9e231 (26 revisions) #38827

Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ vars = {
'llvm_git': 'https://llvm.googlesource.com',
# OCMock is for testing only so there is no google clone
'ocmock_git': 'https://github.com/erikdoe/ocmock.git',
'skia_revision': 'dfb838747295b9109343e6f536b25e9fa3fe933e',
'skia_revision': '9e51c2c9e231cf1350a476c2b1695066144593ce',

# WARNING: DO NOT EDIT canvaskit_cipd_instance MANUALLY
# See `lib/web_ui/README.md` for how to roll CanvasKit to a new version.
'canvaskit_cipd_instance': 'ztaLvbs5GPmlAwUosC7VVp7EQnNVknRpNuKdv7vmzaAC',
'canvaskit_cipd_instance': '61aeJQ9laGfEFF_Vlc_u0MCkqB6xb2hAYHRBxKH-Uw4C',

# Do not download the Emscripten SDK by default.
# This prevents us from downloading the Emscripten toolchain for builds
Expand Down
8 changes: 1 addition & 7 deletions ci/licenses_golden/licenses_skia
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Signature: fa9e0cdd5cd2189db5a01faa94515a3d
Signature: 6fb22ea5d126038c1276ad346f1fb34b

====================================================================================================
LIBRARY: etc1
Expand Down Expand Up @@ -1216,7 +1216,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

====================================================================================================
LIBRARY: skia
ORIGIN: ../../../third_party/skia/include/gpu/GrConfig.h + ../../../third_party/skia/LICENSE
ORIGIN: ../../../third_party/skia/include/gpu/GrTypes.h + ../../../third_party/skia/LICENSE
ORIGIN: ../../../third_party/skia/src/core/SkImageInfo.cpp + ../../../third_party/skia/LICENSE
ORIGIN: ../../../third_party/skia/src/core/SkRasterClip.cpp + ../../../third_party/skia/LICENSE
Expand All @@ -1239,7 +1238,6 @@ ORIGIN: ../../../third_party/skia/src/gpu/ganesh/geometry/GrRect.h + ../../../th
ORIGIN: ../../../third_party/skia/src/ports/SkDebug_win.cpp + ../../../third_party/skia/LICENSE
ORIGIN: ../../../third_party/skia/src/text/gpu/Glyph.h + ../../../third_party/skia/LICENSE
TYPE: LicenseType.bsd
FILE: ../../../third_party/skia/include/gpu/GrConfig.h
FILE: ../../../third_party/skia/include/gpu/GrTypes.h
FILE: ../../../third_party/skia/src/core/SkImageInfo.cpp
FILE: ../../../third_party/skia/src/core/SkRasterClip.cpp
Expand Down Expand Up @@ -8924,15 +8922,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

====================================================================================================
LIBRARY: skia
ORIGIN: ../../../third_party/skia/include/private/SkDeque.h + ../../../third_party/skia/LICENSE
ORIGIN: ../../../third_party/skia/include/private/SkMalloc.h + ../../../third_party/skia/LICENSE
ORIGIN: ../../../third_party/skia/include/private/SkTo.h + ../../../third_party/skia/LICENSE
ORIGIN: ../../../third_party/skia/src/core/SkDiscardableMemory.h + ../../../third_party/skia/LICENSE
ORIGIN: ../../../third_party/skia/src/core/SkFloatingPoint.cpp + ../../../third_party/skia/LICENSE
TYPE: LicenseType.bsd
FILE: ../../../third_party/skia/include/private/SkDeque.h
FILE: ../../../third_party/skia/include/private/SkMalloc.h
FILE: ../../../third_party/skia/include/private/SkTo.h
FILE: ../../../third_party/skia/src/core/SkDiscardableMemory.h
FILE: ../../../third_party/skia/src/core/SkFloatingPoint.cpp
----------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion lib/web_ui/dev/canvaskit_lock.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Specifies the version of CanvasKit to use for Flutter Web apps.
#
# See `lib/web_ui/README.md` for how to update this file.
canvaskit_version: "0.37.1"
canvaskit_version: "0.38.0"
14 changes: 12 additions & 2 deletions lib/web_ui/lib/src/engine/canvaskit/canvaskit_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2167,6 +2167,16 @@ extension SkLineMetricsExtension on SkLineMetrics {
external double get lineNumber;
}

@JS()
@anonymous
@staticInterop
class SkRectWithDirection {}

extension SkRectWithDirectionExtension on SkRectWithDirection {
external Float32List rect;
external SkTextDirection dir;
}

@JS()
@anonymous
@staticInterop
Expand All @@ -2182,13 +2192,13 @@ extension SkParagraphExtension on SkParagraph {
external double getMaxIntrinsicWidth();
external double getMinIntrinsicWidth();
external double getMaxWidth();
external /* List<Float32List> */ List<Object?> getRectsForRange(
external /* List<SkRectWithDirection> */ List<Object?> getRectsForRange(
int start,
int end,
SkRectHeightStyle heightStyle,
SkRectWidthStyle widthStyle,
);
external /* List<Float32List> */ List<Object?> getRectsForPlaceholders();
external /* List<SkRectWithDirection> */ List<Object?> getRectsForPlaceholders();
external SkTextPosition getGlyphPositionAtCoordinate(
double x,
double y,
Expand Down
15 changes: 7 additions & 8 deletions lib/web_ui/lib/src/engine/canvaskit/text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'dart:typed_data';
import 'package:meta/meta.dart';
import 'package:ui/ui.dart' as ui;

import '../safe_browser_api.dart';
import '../util.dart';
import 'canvaskit_api.dart';
import 'font_fallbacks.dart';
Expand Down Expand Up @@ -631,7 +630,7 @@ class CkParagraph extends SkiaObject<SkParagraph> implements ui.Paragraph {
_width = paragraph.getMaxWidth();
_boxesForPlaceholders =
skRectsToTextBoxes(
paragraph.getRectsForPlaceholders().cast<Float32List>());
paragraph.getRectsForPlaceholders().cast<SkRectWithDirection>());
} catch (e) {
printWarning('CanvasKit threw an exception while laying '
'out the paragraph. The font was "${_paragraphStyle._fontFamily}". '
Expand Down Expand Up @@ -732,23 +731,23 @@ class CkParagraph extends SkiaObject<SkParagraph> implements ui.Paragraph {
}

final SkParagraph paragraph = _ensureInitialized(_lastLayoutConstraints!);
final List<Float32List> skRects = paragraph.getRectsForRange(
final List<SkRectWithDirection> skRects = paragraph.getRectsForRange(
start,
end,
toSkRectHeightStyle(boxHeightStyle),
toSkRectWidthStyle(boxWidthStyle),
).cast<Float32List>();
).cast<SkRectWithDirection>();

return skRectsToTextBoxes(skRects);
}

List<ui.TextBox> skRectsToTextBoxes(List<Float32List> skRects) {
List<ui.TextBox> skRectsToTextBoxes(List<SkRectWithDirection> skRects) {
final List<ui.TextBox> result = <ui.TextBox>[];

for (int i = 0; i < skRects.length; i++) {
final Float32List rect = skRects[i];
final int skTextDirection =
getJsProperty(getJsProperty(rect, 'direction'), 'value');
final SkRectWithDirection skRect = skRects[i];
final Float32List rect = skRect.rect;
final int skTextDirection = skRect.dir.value.toInt();
result.add(ui.TextBox.fromLTRBD(
rect[0],
rect[1],
Expand Down
2 changes: 1 addition & 1 deletion lib/web_ui/lib/src/engine/configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import 'dom.dart';
/// The version of CanvasKit used by the web engine by default.
// DO NOT EDIT THE NEXT LINE OF CODE MANUALLY
// See `lib/web_ui/README.md` for how to roll CanvasKit to a new version.
const String _canvaskitVersion = '0.37.1';
const String _canvaskitVersion = '0.38.0';

/// The Web Engine configuration for the current application.
FlutterConfiguration get configuration =>
Expand Down
28 changes: 16 additions & 12 deletions lib/web_ui/test/canvaskit/canvaskit_api_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1669,8 +1669,14 @@ void _paragraphTests() {
expectAlmost(paragraph.getMaxIntrinsicWidth(), 263);
expectAlmost(paragraph.getMinIntrinsicWidth(), 135);
expectAlmost(paragraph.getMaxWidth(), 500);
final SkRectWithDirection rectWithDirection =
paragraph.getRectsForRange(
1,
3,
canvasKit.RectHeightStyle.Tight,
canvasKit.RectWidthStyle.Max).single! as SkRectWithDirection;
expect(
paragraph.getRectsForRange(1, 3, canvasKit.RectHeightStyle.Tight, canvasKit.RectWidthStyle.Max).single,
rectWithDirection.rect,
hasLength(4),
);
expect(paragraph.getRectsForPlaceholders(), hasLength(1));
Expand Down Expand Up @@ -1739,17 +1745,15 @@ void _paragraphTests() {
final SkParagraph paragraph = builder.build();
paragraph.layout(500);

expect(
paragraph.getRectsForRange(
0,
1,
canvasKit.RectHeightStyle.Strut,
canvasKit.RectWidthStyle.Tight,
),
<List<double>>[
<double>[0, 0, 13.770000457763672, 75],
],
);
final List<SkRectWithDirection> rects = paragraph.getRectsForRange(
0,
1,
canvasKit.RectHeightStyle.Strut,
canvasKit.RectWidthStyle.Tight,
).cast<SkRectWithDirection>();
expect(rects.length, 1);
final SkRectWithDirection rect = rects.first;
expect(rect.rect, <double>[0, 0, 13.770000457763672, 75]);
});

test('TextHeightBehavior', () {
Expand Down