Skip to content

Commit b358dc5

Browse files
authored
Remove extra shadows from Web Engine EngineParagraphStyle (flutter#13805)
1 parent 6936b48 commit b358dc5

File tree

2 files changed

+4
-32
lines changed

2 files changed

+4
-32
lines changed

lib/web_ui/lib/src/engine/text/paragraph.dart

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class EngineParagraph implements ui.Paragraph {
1818
@required ui.TextAlign textAlign,
1919
@required ui.TextDirection textDirection,
2020
@required ui.Paint background,
21-
@required List<ui.Shadow> shadows,
2221
}) : assert((plainText == null && paint == null) ||
2322
(plainText != null && paint != null)),
2423
_paragraphElement = paragraphElement,
@@ -27,8 +26,7 @@ class EngineParagraph implements ui.Paragraph {
2726
_textAlign = textAlign,
2827
_textDirection = textDirection,
2928
_paint = paint,
30-
_background = background,
31-
_shadows = shadows;
29+
_background = background;
3230

3331
final html.HtmlElement _paragraphElement;
3432
final ParagraphGeometricStyle _geometricStyle;
@@ -37,7 +35,6 @@ class EngineParagraph implements ui.Paragraph {
3735
final ui.TextAlign _textAlign;
3836
final ui.TextDirection _textDirection;
3937
final ui.Paint _background;
40-
final List<ui.Shadow> _shadows;
4138

4239
@visibleForTesting
4340
String get plainText => _plainText;
@@ -325,7 +322,6 @@ class EngineParagraphStyle implements ui.ParagraphStyle {
325322
ui.StrutStyle strutStyle,
326323
String ellipsis,
327324
ui.Locale locale,
328-
List<ui.Shadow> shadows,
329325
}) : _textAlign = textAlign,
330326
_textDirection = textDirection,
331327
_fontWeight = fontWeight,
@@ -337,8 +333,7 @@ class EngineParagraphStyle implements ui.ParagraphStyle {
337333
// TODO(b/128317744): add support for strut style.
338334
_strutStyle = strutStyle,
339335
_ellipsis = ellipsis,
340-
_locale = locale,
341-
_shadows = shadows;
336+
_locale = locale;
342337

343338
final ui.TextAlign _textAlign;
344339
final ui.TextDirection _textDirection;
@@ -351,7 +346,6 @@ class EngineParagraphStyle implements ui.ParagraphStyle {
351346
final EngineStrutStyle _strutStyle;
352347
final String _ellipsis;
353348
final ui.Locale _locale;
354-
final List<ui.Shadow> _shadows;
355349

356350
String get _effectiveFontFamily {
357351
if (assertionsEnabled) {
@@ -419,8 +413,7 @@ class EngineParagraphStyle implements ui.ParagraphStyle {
419413
'fontSize: ${_fontSize != null ? _fontSize.toStringAsFixed(1) : "unspecified"}, '
420414
'height: ${_height != null ? "${_height.toStringAsFixed(1)}x" : "unspecified"}, '
421415
'ellipsis: ${_ellipsis != null ? "\"$_ellipsis\"" : "unspecified"}, '
422-
'locale: ${_locale ?? "unspecified"}, '
423-
'shadows: ${_shadows ?? "unspecified"}'
416+
'locale: ${_locale ?? "unspecified"}'
424417
')';
425418
} else {
426419
return super.toString();
@@ -913,7 +906,6 @@ class EngineParagraphBuilder implements ui.ParagraphBuilder {
913906
wordSpacing: wordSpacing,
914907
decoration: _textDecorationToCssString(decoration, decorationStyle),
915908
ellipsis: _paragraphStyle._ellipsis,
916-
shadows: shadows,
917909
),
918910
plainText: '',
919911
paint: paint,
@@ -967,7 +959,6 @@ class EngineParagraphBuilder implements ui.ParagraphBuilder {
967959
wordSpacing: wordSpacing,
968960
decoration: _textDecorationToCssString(decoration, decorationStyle),
969961
ellipsis: _paragraphStyle._ellipsis,
970-
shadows: shadows,
971962
),
972963
plainText: plainText,
973964
paint: paint,
@@ -1011,7 +1002,6 @@ class EngineParagraphBuilder implements ui.ParagraphBuilder {
10111002
lineHeight: _paragraphStyle._height,
10121003
maxLines: _paragraphStyle._maxLines,
10131004
ellipsis: _paragraphStyle._ellipsis,
1014-
shadows: _paragraphStyle._shadows,
10151005
),
10161006
plainText: null,
10171007
paint: null,
@@ -1098,9 +1088,6 @@ void _applyParagraphStyleToElement({
10981088
if (style._effectiveFontFamily != null) {
10991089
cssStyle.fontFamily = canonicalizeFontFamily(style._effectiveFontFamily);
11001090
}
1101-
if (style._shadows != null) {
1102-
cssStyle.textShadow = _shadowListToCss(style._shadows);
1103-
}
11041091
} else {
11051092
if (style._textAlign != previousStyle._textAlign) {
11061093
cssStyle.textAlign = textAlignToCssValue(
@@ -1127,9 +1114,6 @@ void _applyParagraphStyleToElement({
11271114
if (style._fontFamily != previousStyle._fontFamily) {
11281115
cssStyle.fontFamily = canonicalizeFontFamily(style._fontFamily);
11291116
}
1130-
if (style._shadows != previousStyle._shadows) {
1131-
cssStyle.textShadow = _shadowListToCss(style._shadows);
1132-
}
11331117
}
11341118
}
11351119

lib/web_ui/lib/src/engine/text/ruler.dart

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ class ParagraphGeometricStyle {
1717
this.wordSpacing,
1818
this.decoration,
1919
this.ellipsis,
20-
this.shadows,
2120
});
2221

2322
final ui.FontWeight fontWeight;
@@ -30,7 +29,6 @@ class ParagraphGeometricStyle {
3029
final double wordSpacing;
3130
final String decoration;
3231
final String ellipsis;
33-
final List<ui.Shadow> shadows;
3432

3533
// Since all fields above are primitives, cache hashcode since ruler lookups
3634
// use this style as key.
@@ -111,8 +109,7 @@ class ParagraphGeometricStyle {
111109
letterSpacing == typedOther.letterSpacing &&
112110
wordSpacing == typedOther.wordSpacing &&
113111
decoration == typedOther.decoration &&
114-
ellipsis == typedOther.ellipsis &&
115-
shadows == typedOther.shadows;
112+
ellipsis == typedOther.ellipsis;
116113
}
117114

118115
@override
@@ -127,12 +124,8 @@ class ParagraphGeometricStyle {
127124
wordSpacing,
128125
decoration,
129126
ellipsis,
130-
_hashShadows(shadows),
131127
);
132128

133-
int _hashShadows(List<ui.Shadow> shadows) =>
134-
(shadows == null ? '' : _shadowListToCss(shadows)).hashCode;
135-
136129
@override
137130
String toString() {
138131
if (assertionsEnabled) {
@@ -144,7 +137,6 @@ class ParagraphGeometricStyle {
144137
' wordSpacing: $wordSpacing,'
145138
' decoration: $decoration,'
146139
' ellipsis: $ellipsis,'
147-
' shadows: $shadows,'
148140
')';
149141
} else {
150142
return super.toString();
@@ -249,10 +241,6 @@ class TextDimensions {
249241
if (style.lineHeight != null) {
250242
_element.style.lineHeight = style.lineHeight.toString();
251243
}
252-
final List<ui.Shadow> shadowList = style.shadows;
253-
if (shadowList != null) {
254-
_element.style.textShadow = _shadowListToCss(shadowList);
255-
}
256244
_invalidateBoundsCache();
257245
}
258246

0 commit comments

Comments
 (0)