-
Notifications
You must be signed in to change notification settings - Fork 6k
loadfontfromlist should send fontchange message to framework #14805
Conversation
This is ready for review |
lib/ui/text.dart
Outdated
if (window.onPlatformMessage != null) | ||
window.onPlatformMessage( | ||
'flutter/system', | ||
utf8.encoder.convert(json.encode(<String, dynamic>{'type': 'fontsChange'})).buffer.asByteData(), |
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.
This seems wasteful. Could you instead create a static buffer which already contains this data?
|
||
FutureOr<void> _sendFontChangeMessage(void result) async { | ||
if (window.onPlatformMessage != null) | ||
window.onPlatformMessage( |
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.
Same 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.
I moved it out to a final variable
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.
Awesome!
@jonahwilliams thanks for reviewing! I pushed the change |
).then(_sendFontChangeMessage); | ||
} | ||
|
||
final ByteData _fontChangeMessage = utf8.encoder.convert( |
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.
This could also be static, to prevent creating multiple instances
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.
This is not in a class. Do you mean put this field to be a static member for some class? I am not familiar with how dart compile the code, I thought define it in the scope of this file is the same thing as a static member of a class?
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.
Oh, reading fail on my part. it is fine as a top level
81d9ea1
to
e89fd84
Compare
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.
LGTM
lib/web_ui/lib/src/ui/text.dart
Outdated
_fontChangeMessage, | ||
(_) {}, | ||
); | ||
} |
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.
Add a newline at the end of the file for consistency
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.
LGTM if LGT @hterkelsen
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.
LGTM
lib/ui/text.dart
Outdated
json.encode(<String, dynamic>{'type': 'fontsChange'}) | ||
).buffer.asByteData(); | ||
|
||
FutureOr<void> _sendFontChangeMessage(void result) async { |
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.
nit: I think it would be clearer if this function didn't have an unused parameter named result
and instead we wrote .then((_) => _sendFontChangeMessage())
But it's not a hard preference
90c2f81
to
585a7a0
Compare
``` git log 8df1757..ba045a2 --first-parent --oneline 2020-01-17 skia-flutter-autoroll@skia.org Roll src/third_party/dart c8f8c11b70b4..843bd2990881 (5 commits) (flutter/engine#15714) 2020-01-17 aam@google.com Roll dart to c8f8c11b70 (flutter/engine#15708) 2020-01-17 garyq@google.com Samsung fix duplication on punctuation: Update keyboard on finish compose. (flutter/engine#15701) 2020-01-17 skia-flutter-autoroll@skia.org Roll src/third_party/skia 2cd5d43f022c..d58b643f10f5 (21 commits) (flutter/engine#15707) 2020-01-17 chinmaygarde@google.com Disable GPUThreadMerger tests inline instead of via harness flags. (flutter/engine#15706) 2020-01-17 dnfield@google.com implicit casts and add missing docs (flutter/engine#15698) 2020-01-17 47866232+chunhtai@users.noreply.github.com loadfontfromlist should send fontchange message to framework (flutter/engine#14805) ```
``` git log 8df1757..ba045a2 --first-parent --oneline 2020-01-17 skia-flutter-autoroll@skia.org Roll src/third_party/dart c8f8c11b70b4..843bd2990881 (5 commits) (flutter/engine#15714) 2020-01-17 aam@google.com Roll dart to c8f8c11b70 (flutter/engine#15708) 2020-01-17 garyq@google.com Samsung fix duplication on punctuation: Update keyboard on finish compose. (flutter/engine#15701) 2020-01-17 skia-flutter-autoroll@skia.org Roll src/third_party/skia 2cd5d43f022c..d58b643f10f5 (21 commits) (flutter/engine#15707) 2020-01-17 chinmaygarde@google.com Disable GPUThreadMerger tests inline instead of via harness flags. (flutter/engine#15706) 2020-01-17 dnfield@google.com implicit casts and add missing docs (flutter/engine#15698) 2020-01-17 47866232+chunhtai@users.noreply.github.com loadfontfromlist should send fontchange message to framework (flutter/engine#14805) ```
flutter/engine@8df1757...98c1aea git log 8df1757..98c1aea --first-parent --oneline 2020-01-17 ferhat@gmail.com Clipping path fix for browsers that don't use correct units when applying clip-path css using svg (flutter/engine#15712) 2020-01-17 dnfield@google.com fix typo, update path metrics docs (flutter/engine#15715) 2020-01-17 skia-flutter-autoroll@skia.org Roll src/third_party/dart c8f8c11b70b4..843bd2990881 (5 commits) (flutter/engine#15714) 2020-01-17 aam@google.com Roll dart to c8f8c11b70 (flutter/engine#15708) 2020-01-17 garyq@google.com Samsung fix duplication on punctuation: Update keyboard on finish compose. (flutter/engine#15701) 2020-01-17 skia-flutter-autoroll@skia.org Roll src/third_party/skia 2cd5d43f022c..d58b643f10f5 (21 commits) (flutter/engine#15707) 2020-01-17 chinmaygarde@google.com Disable GPUThreadMerger tests inline instead of via harness flags. (flutter/engine#15706) 2020-01-17 dnfield@google.com implicit casts and add missing docs (flutter/engine#15698) 2020-01-17 47866232+chunhtai@users.noreply.github.com loadfontfromlist should send fontchange message to framework (flutter/engine#14805) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC jimgraham@google.com on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
…lutter#14805)" This reverts commit da025ac.
flutter/flutter#44460
This pr makes sure the ui.windows loadfontfromlist api will notify framework to rebuild