-
Notifications
You must be signed in to change notification settings - Fork 624
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
Support default-font-* properties in Live-Preview #7011
base: master
Are you sure you want to change the base?
Conversation
... by changing the resolution for the `WindowItem` to traverse the item tree from the current item, instead of going to the window. This doesn't quite fix #4298 because `rem` resolution is still missing. That requires the built-in default font size function to be fixed as well, which is non-trivial. cc #4298
67231b9
to
8d487c2
Compare
self_component: &vtable::VRc<ItemTreeVTable>, | ||
self_index: u32, |
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.
why not self_rc: &ItemRc,
like the other functions in this vtable have?
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.
Ah yes, this is quite annoying. The issue is that &ItemRc
translates to *const ItemRc
in the C signature. This is the only function that's called from the C++ code straight into the vtable where a &ItemRc
is needed. But because this takes a pointer, I can't write ...->layout_info(..., &ItemRc{{ ... })
as that's taking the address of a temporary. In all the other places in the FFI we also pass this "pair".
I could alternatively change this to &ItemRc
but then on the C++ code call a helper function in our private header files that stores the ItemRc
on the stack and passes the address. Would you prefer that?
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 could alternatively change this to &ItemRc but then on the C++ code call a helper function in our private header files that stores the ItemRc on the stack and passes the address. Would you prefer that?
Yes, I think it is cleaner, don't you thik?
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.
Yes, that's indeed cleaner.
No tests? Could you make a test that involve a PopupWindow. I have a suspicion that it may not work because the PopupWindow inject a WindowItem that doesn't define these default-font-* properties. eg: export component TestCase inherits Window {
default-font-size: 140px;
PopupWindow {
// the font size of this text must be large
Text { text: "hello"; }
}
}
`` |
That's an excellent point - this is indeed also not handled (besides the |
... by changing the resolution for the
WindowItem
to traverse the item tree from the current item, instead of going to the window.This doesn't quite fix #4298 because
rem
resolution is still missing. That requires the built-in default font size function to be fixed as well, which is non-trivial.cc #4298