Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add css variables and support link element #961

Merged
merged 13 commits into from
Dec 16, 2021

Conversation

wssgcg1213
Copy link
Member

  1. Support LinkElement with rel equals stylesheet will send request and parse style. Close link 标签 不会发起请求 或者是 不显示在devtools面板 #955
  2. Support ScriptElement with type equals application/javascript and application/x-javascript, since text/javascript is an obsolete mime.
  3. Support CSSVariables Close 支持css var #480
  4. Fix UICommand id and type is a signed int, which was cast to unsigned causing not working in newly version of Flutter.

@@ -249,7 +257,7 @@ class AssetsBundle extends KrakenBundle {
: super(url);

@override
Future<KrakenBundle> resolve(int contextId) async {
Copy link
Member

Choose a reason for hiding this comment

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

这个为啥要加?呀

Copy link
Member Author

Choose a reason for hiding this comment

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

去耦合, 跟 EventTargetContext 是 nullable 的原因一样, KrakenBundle 可以单独测试, contextId 的依赖本质上是依赖 Bridge (这个 id 是 bridge 生成的)

kraken/lib/src/css/variable.dart Outdated Show resolved Hide resolved
kraken/lib/src/launcher/bundle.dart Show resolved Hide resolved
 Please enter the commit message for your changes. Lines starting
@@ -107,32 +110,37 @@ abstract class KrakenBundle {
}


Future<void> eval(int contextId) async {
Copy link
Member

Choose a reason for hiding this comment

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

如果 eval 去掉了contextId 的 耦合的话,我理解 KrakenBundle 应该是一个抽象类,在上面派生出 ,eval 的职责应该丢给 contraoller,然后 controller 提供一个 eval(BundleKraken bundle) 的方法。

Copy link
Member Author

Choose a reason for hiding this comment

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

是的, KrakenBundle 作为抽象类会好一点

Copy link
Member Author

Choose a reason for hiding this comment

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

这里暂时先不改了, 只是为了解决 contextId Nullable 传染性的问题才改了参数声明, 后面单独重构一个 PR 好了

@wssgcg1213 wssgcg1213 closed this Dec 13, 2021
@wssgcg1213 wssgcg1213 reopened this Dec 13, 2021
@@ -853,6 +1087,14 @@ class CSSRenderStyle
return realWidth;
}


@override
void visitChildren<T extends RenderStyle>(RenderStyleVisitor<T> visitor) {
Copy link
Contributor

Choose a reason for hiding this comment

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

这里通过 element 去取 renderStyle children 职责有点不清晰,是不是考虑实现完整的 renderStyle tree,直接遍历 renderStyle tree 就好了

Copy link
Member Author

Choose a reason for hiding this comment

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

是的, 如果有直接的 RenderStyle 树状结构, 就不需要这么去干了
目前没有, 整一个的话成本还有点高, 所以为了结构清晰我先把这个方法抽出来了, 未来实现好了之后改这里就好了

@answershuto answershuto merged commit 8848474 into main Dec 16, 2021
@answershuto answershuto deleted the feat/support-variable branch December 16, 2021 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

link 标签 不会发起请求 或者是 不显示在devtools面板 支持css var
5 participants