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 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
22 changes: 3 additions & 19 deletions lib/web_ui/lib/src/engine/text/paragraph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class EngineParagraph implements ui.Paragraph {
@required ui.TextAlign textAlign,
@required ui.TextDirection textDirection,
@required ui.Paint background,
@required List<ui.Shadow> shadows,
}) : assert((plainText == null && paint == null) ||
(plainText != null && paint != null)),
_paragraphElement = paragraphElement,
Expand All @@ -27,8 +26,7 @@ class EngineParagraph implements ui.Paragraph {
_textAlign = textAlign,
_textDirection = textDirection,
_paint = paint,
_background = background,
_shadows = shadows;
_background = background;

final html.HtmlElement _paragraphElement;
final ParagraphGeometricStyle _geometricStyle;
Expand All @@ -37,7 +35,6 @@ class EngineParagraph implements ui.Paragraph {
final ui.TextAlign _textAlign;
final ui.TextDirection _textDirection;
final ui.Paint _background;
final List<ui.Shadow> _shadows;

@visibleForTesting
String get plainText => _plainText;
Expand Down Expand Up @@ -325,7 +322,6 @@ class EngineParagraphStyle implements ui.ParagraphStyle {
ui.StrutStyle strutStyle,
String ellipsis,
ui.Locale locale,
List<ui.Shadow> shadows,
}) : _textAlign = textAlign,
_textDirection = textDirection,
_fontWeight = fontWeight,
Expand All @@ -337,8 +333,7 @@ class EngineParagraphStyle implements ui.ParagraphStyle {
// TODO(b/128317744): add support for strut style.
_strutStyle = strutStyle,
_ellipsis = ellipsis,
_locale = locale,
_shadows = shadows;
_locale = locale;

final ui.TextAlign _textAlign;
final ui.TextDirection _textDirection;
Expand All @@ -351,7 +346,6 @@ class EngineParagraphStyle implements ui.ParagraphStyle {
final EngineStrutStyle _strutStyle;
final String _ellipsis;
final ui.Locale _locale;
final List<ui.Shadow> _shadows;

String get _effectiveFontFamily {
if (assertionsEnabled) {
Expand Down Expand Up @@ -419,8 +413,7 @@ class EngineParagraphStyle implements ui.ParagraphStyle {
'fontSize: ${_fontSize != null ? _fontSize.toStringAsFixed(1) : "unspecified"}, '
'height: ${_height != null ? "${_height.toStringAsFixed(1)}x" : "unspecified"}, '
'ellipsis: ${_ellipsis != null ? "\"$_ellipsis\"" : "unspecified"}, '
'locale: ${_locale ?? "unspecified"}, '
'shadows: ${_shadows ?? "unspecified"}'
'locale: ${_locale ?? "unspecified"}'
')';
} else {
return super.toString();
Expand Down Expand Up @@ -913,7 +906,6 @@ class EngineParagraphBuilder implements ui.ParagraphBuilder {
wordSpacing: wordSpacing,
decoration: _textDecorationToCssString(decoration, decorationStyle),
ellipsis: _paragraphStyle._ellipsis,
shadows: shadows,
),
plainText: '',
paint: paint,
Expand Down Expand Up @@ -967,7 +959,6 @@ class EngineParagraphBuilder implements ui.ParagraphBuilder {
wordSpacing: wordSpacing,
decoration: _textDecorationToCssString(decoration, decorationStyle),
ellipsis: _paragraphStyle._ellipsis,
shadows: shadows,
),
plainText: plainText,
paint: paint,
Expand Down Expand Up @@ -1011,7 +1002,6 @@ class EngineParagraphBuilder implements ui.ParagraphBuilder {
lineHeight: _paragraphStyle._height,
maxLines: _paragraphStyle._maxLines,
ellipsis: _paragraphStyle._ellipsis,
shadows: _paragraphStyle._shadows,
),
plainText: null,
paint: null,
Expand Down Expand Up @@ -1098,9 +1088,6 @@ void _applyParagraphStyleToElement({
if (style._effectiveFontFamily != null) {
cssStyle.fontFamily = canonicalizeFontFamily(style._effectiveFontFamily);
}
if (style._shadows != null) {
cssStyle.textShadow = _shadowListToCss(style._shadows);
}
} else {
if (style._textAlign != previousStyle._textAlign) {
cssStyle.textAlign = textAlignToCssValue(
Expand All @@ -1127,9 +1114,6 @@ void _applyParagraphStyleToElement({
if (style._fontFamily != previousStyle._fontFamily) {
cssStyle.fontFamily = canonicalizeFontFamily(style._fontFamily);
}
if (style._shadows != previousStyle._shadows) {
cssStyle.textShadow = _shadowListToCss(style._shadows);
}
}
}

Expand Down
14 changes: 1 addition & 13 deletions lib/web_ui/lib/src/engine/text/ruler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class ParagraphGeometricStyle {
this.wordSpacing,
this.decoration,
this.ellipsis,
this.shadows,
});

final ui.FontWeight fontWeight;
Expand All @@ -30,7 +29,6 @@ class ParagraphGeometricStyle {
final double wordSpacing;
final String decoration;
final String ellipsis;
final List<ui.Shadow> shadows;

// Since all fields above are primitives, cache hashcode since ruler lookups
// use this style as key.
Expand Down Expand Up @@ -111,8 +109,7 @@ class ParagraphGeometricStyle {
letterSpacing == typedOther.letterSpacing &&
wordSpacing == typedOther.wordSpacing &&
decoration == typedOther.decoration &&
ellipsis == typedOther.ellipsis &&
shadows == typedOther.shadows;
ellipsis == typedOther.ellipsis;
}

@override
Expand All @@ -127,12 +124,8 @@ class ParagraphGeometricStyle {
wordSpacing,
decoration,
ellipsis,
_hashShadows(shadows),
);

int _hashShadows(List<ui.Shadow> shadows) =>
(shadows == null ? '' : _shadowListToCss(shadows)).hashCode;

@override
String toString() {
if (assertionsEnabled) {
Expand All @@ -144,7 +137,6 @@ class ParagraphGeometricStyle {
' wordSpacing: $wordSpacing,'
' decoration: $decoration,'
' ellipsis: $ellipsis,'
' shadows: $shadows,'
')';
} else {
return super.toString();
Expand Down Expand Up @@ -249,10 +241,6 @@ class TextDimensions {
if (style.lineHeight != null) {
_element.style.lineHeight = style.lineHeight.toString();
}
final List<ui.Shadow> shadowList = style.shadows;
if (shadowList != null) {
_element.style.textShadow = _shadowListToCss(shadowList);
}
_invalidateBoundsCache();
}

Expand Down