Skip to content

Make TextDecoration final and unify maskValue across platforms#183070

Merged
auto-submit[bot] merged 1 commit intoflutter:masterfrom
SpiralMomentum:fix/text-decoration-final-class-181662
Mar 2, 2026
Merged

Make TextDecoration final and unify maskValue across platforms#183070
auto-submit[bot] merged 1 commit intoflutter:masterfrom
SpiralMomentum:fix/text-decoration-final-class-181662

Conversation

@SpiralMomentum
Copy link
Contributor

@SpiralMomentum SpiralMomentum commented Feb 28, 2026

Description

Make TextDecoration a final class and add the maskValue getter to the non-web implementation for API consistency.

Problem

TextDecoration has a platform-inconsistent API: the web implementation exposes a maskValue getter (used by Skwasm) that the non-web implementation does not. Code that implements TextDecoration compiles on mobile but fails on web due to the missing maskValue.

Solution

  1. Make TextDecoration a final class in both web and non-web implementations to prevent external extension/implementation
  2. Add maskValue getter to the non-web implementation so the public API is consistent across platforms

As @jason-simmons suggested, adding maskValue to the non-web side provides consistency, similar to how enum-based text style attributes expose their index property.

Changes

  • engine/src/flutter/lib/ui/text.dart: classfinal class, add maskValue getter
  • engine/src/flutter/lib/web_ui/lib/text.dart: classfinal class (already has maskValue)
  • engine/src/flutter/testing/dart/text_test.dart: add testTextDecoration verifying maskValue for predefined and combined decorations

No usages of extends TextDecoration or implements TextDecoration exist in the codebase, so the final change has no internal impact.

Tests

Added 3 test cases in engine/src/flutter/testing/dart/text_test.dart:

  • maskValue returns correct bit mask for each predefined decoration (none, underline, overline, lineThrough)
  • maskValue returns combined bit mask for TextDecoration.combine with partial decorations
  • maskValue returns combined bit mask for all decorations combined

Related Issue

Closes #181662

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide.
  • I listed at least one issue that this PR fixes in the description above.
  • I added tests to cover the new maskValue getter.
  • I updated/added relevant documentation (doc comments, etc.)

cc @mdebbar @jason-simmons

@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems engine flutter/engine related. See also e: labels. platform-web Web applications specifically labels Feb 28, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies the TextDecoration class in engine/src/flutter/lib/ui/text.dart and engine/src/flutter/lib/web_ui/lib/text.dart by adding the final keyword. This change makes TextDecoration a final class, preventing it from being extended or implemented, which addresses a platform inconsistency in its API.

@SpiralMomentum SpiralMomentum changed the base branch from main to master February 28, 2026 15:26
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@SpiralMomentum SpiralMomentum force-pushed the fix/text-decoration-final-class-181662 branch from 1291ac4 to 59fcf20 Compare February 28, 2026 15:32
@SpiralMomentum SpiralMomentum changed the title Make TextDecoration a final class Make TextDecoration final and unify maskValue across platforms Feb 28, 2026
TextDecoration has a platform-inconsistent API: the web implementation
exposes a maskValue getter that the non-web implementation does not.
Code that implements TextDecoration compiles on mobile but fails on web.

This change:
- Makes TextDecoration a final class to prevent external extension/implementation
- Adds maskValue getter to the non-web implementation for API consistency
- Adds tests for maskValue on predefined and combined decorations

Closes flutter#181662
@SpiralMomentum SpiralMomentum force-pushed the fix/text-decoration-final-class-181662 branch from 59fcf20 to bb63f67 Compare February 28, 2026 15:37
Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!

@mdebbar mdebbar requested a review from jason-simmons March 2, 2026 17:17
@mdebbar mdebbar added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 2, 2026
@auto-submit auto-submit bot added this pull request to the merge queue Mar 2, 2026
Merged via the queue into flutter:master with commit c46f6f4 Mar 2, 2026
183 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 2, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 3, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 3, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 3, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 4, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 4, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 4, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 4, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 4, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 4, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 5, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 5, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 5, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 5, 2026
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Mar 5, 2026
Roll Flutter from 46fb7210422d to d3dd7744e81f (33 revisions)

flutter/flutter@46fb721...d3dd774

2026-03-04 [email protected] Show warning when plugins do not support SwiftPM (flutter/flutter#182506)
2026-03-04 [email protected] Give guided message when project is not compatible with SwiftPM (flutter/flutter#182394)
2026-03-04 [email protected] Pass --web-define through to web runner when using --machine mode (flutter/flutter#183228)
2026-03-04 [email protected] Improve SwiftPM minimum platform mismatch diagnostics (flutter/flutter#182375)
2026-03-04 [email protected] Use dart::bin::SetupDartIo to setup dart:io (flutter/flutter#176714)
2026-03-04 [email protected] Roll Skia from 3197848b14ad to ada0b7628c79 (5 revisions) (flutter/flutter#183221)
2026-03-04 [email protected] Roll Skia from fe9e9f22c531 to 3197848b14ad (15 revisions) (flutter/flutter#183198)
2026-03-04 [email protected] refactor: remove material in reorderable_list_test, scroll_notification_test, scroll_physics_test, shortcuts_test, sliver_floating_header_test, snapshot_widget_test (flutter/flutter#182698)
2026-03-04 [email protected] refactor: remove material in pop_scope_test, route_notification_message_test, two_dimensional_utils, two_dimensional_viewport_test (flutter/flutter#182699)
2026-03-04 [email protected] Add dev/benchmarks/README.md (flutter/flutter#182976)
2026-03-03 [email protected] Roll RapidJSON to a branch based on the current upstream head (flutter/flutter#183048)
2026-03-03 [email protected] [Impeller] Update comments to reflect new info about 2-pass rendering (flutter/flutter#183050)
2026-03-03 [email protected] Add vmservices for accessibilityEvaluation (flutter/flutter#182791)
2026-03-03 [email protected] Roll Fuchsia Linux SDK from 0dCDM2oORHwDf_pyb... to JJw5EJ87vLGqFVl4h... (flutter/flutter#183177)
2026-03-03 [email protected] Support mixed color spaces in `Color.lerp` (flutter/flutter#182934)
2026-03-03 [email protected] Add warning when there is a widget with color between `Material` and `ListTile` (flutter/flutter#181402)
2026-03-03 [email protected] [ios]uitest for admob banner in scrollable list gesture issue (flutter/flutter#183128)
2026-03-03 [email protected] Roll Packages from faa4e22 to 9083bc9 (4 revisions) (flutter/flutter#183164)
2026-03-03 [email protected] Build App and native asset frameworks for Add to App FlutterPluginRegistrant (flutter/flutter#183136)
2026-03-03 [email protected] Roll Skia from f886711f180d to fe9e9f22c531 (4 revisions) (flutter/flutter#183155)
2026-03-03 [email protected] Roll Dart SDK from e86dbe9aa742 to c597ef90d2dc (2 revisions) (flutter/flutter#183147)
2026-03-03 [email protected] fix: bump matcher (flutter/flutter#183167)
2026-03-02 [email protected] Use isA to test for exceptions (flutter/flutter#183129)
2026-03-02 [email protected] [two_dimensional_scrollables] Fix tableview janks when first row/column pinned (flutter/flutter#180563)
2026-03-02 [email protected] Add await to callsites of BasicMessageChannel.send (flutter/flutter#182868)
2026-03-02 [email protected] Roll pub packages (flutter/flutter#183133)
2026-03-02 [email protected] Improve FFI code for windowing (flutter/flutter#183098)
2026-03-02 [email protected] [workflow] Update the changelog merge action to fetch the stable branch (flutter/flutter#183132)
2026-03-02 [email protected] Roll Skia from e180358b7a7a to f886711f180d (2 revisions) (flutter/flutter#183130)
2026-03-02 [email protected] Merge changelog from 3.41.3. (flutter/flutter#183131)
2026-03-02 [email protected] Make TextDecoration final and unify maskValue across platforms (flutter/flutter#183070)
2026-03-02 [email protected] Roll pub packages (flutter/flutter#182640)
2026-03-02 [email protected] Enable SwiftPM by default on master and beta (flutter/flutter#182923)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
...
xxxOVALxxx pushed a commit to xxxOVALxxx/flutter that referenced this pull request Mar 10, 2026
…er#183070)

## Description

Make `TextDecoration` a `final class` and add the `maskValue` getter to
the non-web implementation for API consistency.

### Problem

`TextDecoration` has a platform-inconsistent API: the web implementation
exposes a `maskValue` getter (used by Skwasm) that the non-web
implementation does not. Code that `implements TextDecoration` compiles
on mobile but fails on web due to the missing `maskValue`.

### Solution

1. Make `TextDecoration` a `final class` in both web and non-web
implementations to prevent external extension/implementation
2. Add `maskValue` getter to the non-web implementation so the public
API is consistent across platforms

As @jason-simmons suggested, adding `maskValue` to the non-web side
provides consistency, similar to how enum-based text style attributes
expose their `index` property.

## Changes

- `engine/src/flutter/lib/ui/text.dart`: `class` → `final class`, add
`maskValue` getter
- `engine/src/flutter/lib/web_ui/lib/text.dart`: `class` → `final class`
(already has `maskValue`)
- `engine/src/flutter/testing/dart/text_test.dart`: add
`testTextDecoration` verifying `maskValue` for predefined and combined
decorations

No usages of `extends TextDecoration` or `implements TextDecoration`
exist in the codebase, so the `final` change has no internal impact.

## Tests

Added 3 test cases in `engine/src/flutter/testing/dart/text_test.dart`:
- `maskValue` returns correct bit mask for each predefined decoration
(`none`, `underline`, `overline`, `lineThrough`)
- `maskValue` returns combined bit mask for `TextDecoration.combine`
with partial decorations
- `maskValue` returns combined bit mask for all decorations combined

## Related Issue

Closes flutter#181662

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added tests to cover the new `maskValue` getter.
- [x] I updated/added relevant documentation (doc comments, etc.)

cc @mdebbar @jason-simmons

[Contributor Guide]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems engine flutter/engine related. See also e: labels. platform-web Web applications specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent TextDecoration API across platforms

3 participants