-
Notifications
You must be signed in to change notification settings - Fork 6k
last flutter web sync: cc38319841 #11732
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -293,7 +293,7 @@ class EngineParagraph implements ui.Paragraph { | |
|
|
||
| @override | ||
| List<ui.LineMetrics> computeLineMetrics() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @GaryQian does anything in flutter call this yet? Will returning null be safe here?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nothing calls this yet. API just landed today/yesterday. Should be safe to return null.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you look at the overall diff for this PR you'll notice that there's no change here. IOW, returning null is exactly what we're already doing. However, I filed an issue for us to implement this properly: flutter/flutter#39537
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated the TODO with the issue link |
||
| // TODO(flutter_web): Implement this. | ||
| // TODO(flutter_web): https://github.com/flutter/flutter/issues/39537 | ||
| return null; | ||
| } | ||
| } | ||
|
|
@@ -1059,7 +1059,7 @@ void _applyParagraphStyleToElement({ | |
| cssStyle.lineHeight = '${style._lineHeight}'; | ||
| } | ||
| if (style._textDirection != null) { | ||
| cssStyle.direction = _textDirectionToCssValue(style._textDirection); | ||
| cssStyle.direction = _textDirectionToCss(style._textDirection); | ||
| } | ||
| if (style._fontSize != null) { | ||
| cssStyle.fontSize = '${style._fontSize.floor()}px'; | ||
|
|
@@ -1083,7 +1083,7 @@ void _applyParagraphStyleToElement({ | |
| cssStyle.lineHeight = '${style._lineHeight}'; | ||
| } | ||
| if (style._textDirection != previousStyle._textDirection) { | ||
| cssStyle.direction = _textDirectionToCssValue(style._textDirection); | ||
| cssStyle.direction = _textDirectionToCss(style._textDirection); | ||
| } | ||
| if (style._fontSize != previousStyle._fontSize) { | ||
| cssStyle.fontSize = | ||
|
|
@@ -1272,10 +1272,28 @@ String _decorationStyleToCssString(ui.TextDecorationStyle decorationStyle) { | |
| /// ```css | ||
| /// direction: rtl; | ||
| /// ``` | ||
| String _textDirectionToCssValue(ui.TextDirection textDirection) { | ||
| return textDirection == ui.TextDirection.ltr | ||
| ? null // it's the default | ||
| : 'rtl'; | ||
| String _textDirectionToCss(ui.TextDirection textDirection) { | ||
| if (textDirection == null) { | ||
| return null; | ||
| } | ||
| return textDirectionIndexToCss(textDirection.index); | ||
| } | ||
|
|
||
| String textDirectionIndexToCss(int textDirectionIndex) { | ||
| switch (textDirectionIndex) { | ||
| case 0: | ||
| return 'rtl'; | ||
| case 1: | ||
| return null; // ltr is the default | ||
| } | ||
|
|
||
| assert(() { | ||
| throw AssertionError( | ||
| 'Failed to convert text direction $textDirectionIndex to CSS', | ||
| ); | ||
| }()); | ||
|
|
||
| return null; | ||
| } | ||
|
|
||
| /// Converts [align] to its corresponding CSS value. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return empty List here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Should be good now. Once and for all!