Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

loadfontfromlist should send fontchange message to framework #14805

Merged
merged 7 commits into from
Jan 17, 2020

Conversation

chunhtai
Copy link
Contributor

flutter/flutter#44460

This pr makes sure the ui.windows loadfontfromlist api will notify framework to rebuild

@chunhtai
Copy link
Contributor Author

chunhtai commented Jan 9, 2020

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(),
Copy link
Member

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(
Copy link
Member

Choose a reason for hiding this comment

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

Same here

Copy link
Contributor Author

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

Copy link
Member

Choose a reason for hiding this comment

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

Awesome!

@chunhtai
Copy link
Contributor Author

chunhtai commented Jan 9, 2020

@jonahwilliams thanks for reviewing! I pushed the change

).then(_sendFontChangeMessage);
}

final ByteData _fontChangeMessage = utf8.encoder.convert(
Copy link
Member

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

Copy link
Contributor Author

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?

Copy link
Member

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

Copy link
Member

@jason-simmons jason-simmons left a comment

Choose a reason for hiding this comment

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

LGTM

_fontChangeMessage,
(_) {},
);
}
Copy link
Member

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

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.

LGTM if LGT @hterkelsen

Copy link
Member

@jonahwilliams jonahwilliams left a 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 {
Copy link
Contributor

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

aam added a commit to aam/flutter that referenced this pull request Jan 17, 2020
```
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)
```
aam added a commit to flutter/flutter that referenced this pull request Jan 17, 2020
```
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)
```
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Jan 17, 2020
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
NoamDev pushed a commit to NoamDev/engine that referenced this pull request Feb 27, 2020
NoamDev added a commit to NoamDev/engine that referenced this pull request Feb 27, 2020
filmil pushed a commit to filmil/engine that referenced this pull request Mar 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants