-
Notifications
You must be signed in to change notification settings - Fork 599
ui: remove unused style rules #2826
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
base: main
Are you sure you want to change the base?
Conversation
9676054
to
164969d
Compare
@stevegolton I see the same test failures in the integration tests as on current main branch, mostly having to do with the indentation of grouped tracks. I don't see obvious regressions otherwise. |
ui/src/assets/common.scss
Outdated
outline: inherit; | ||
} | ||
.pf-overlay-container { | ||
button { |
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 suspect we might be able to get rid of this button style entirely actually!
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 think in general most of these styles in common.scss can go and nothing uses them any more. Let me confirm this...
Also, in terms of using the pf-overlay-container as a general perfetto container - the overlay container was really for placing overlays like popups and tooltips rather than attaching them to the body, so that they don't leak out into the containing application. In the spirit of the SRP I'm not convinced I'd like to attach another responsibility to this class. In fact I'd prefer a general .perfetto
container like you did in your other PR.
I am however a little surprised about these leaks and the work I have done was in an attempt to avoid needing a .perfetto
container at all.
Anyway, please see the comments.
ui/src/assets/common.scss
Outdated
|
||
button.close { | ||
font-family: var(--pf-font-monospace); | ||
button.close { |
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.
And this one
ui/src/assets/common.scss
Outdated
h1, | ||
h2, | ||
h3 { | ||
font-family: inherit; | ||
font-size: inherit; | ||
font-weight: inherit; | ||
padding: 0; | ||
margin: 0; | ||
} | ||
table { | ||
-webkit-user-select: text; |
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.
We could probably get rid of these too, I think. Let me check...
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.
In testing I found that the heading styles are actually needed: see commit dc4e3f5
ui/src/assets/common.scss
Outdated
code { | ||
font-family: var(--pf-font-monospace); | ||
.pf-overlay-container { | ||
pre, |
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.
OK I think most of the styles in this file are redundant to be honest.
Eh, I'm not sure I follow you here? The integration tests look good on this PR + on main. Am I missing something? |
That would be great. I never know to what extent other bits of the Perfetto app that I'm not familiar with might be relying on things that seem obsolete.
Yes, that makes sense. Here I was trying to minimize the impact of my changes by not introducing new elements, but if you have other reasons to introduce another container, then that's even better for my use case 😀
Yeah, there weren't many leaks remaining and it sounds like they are all from rules that can be deleted ... ? wbn |
When I run the integration tests on my machine, there are 11 or 12 failures on both |
Aha, gotcha. Yes unfortunately the golden screenshot tests are not particularly portable! |
d86360b
to
f766678
Compare
OK, thanks a lot for your feedback @stevegolton . I've updated the PR to implement what I think is a cleaner solution more closely aligned to your goals.
|
I think it's the right idea to put the styles into the widgets/components that actually need them, but I think you've missed a few.
Also I don't think this list of properties you've added to pf-button properly resets the browser styling (at least on chrome on macos), you need:
Maybe a @mixin would help if we need to repeat those styles everywhere. I think the The I'm not sure about the h1, h2, etc - I haven't checked those yet.
I was going to ask about that - I'm guessing you change the initialization in typescript for your build because if it ran verbatim it would add the perfetto class to your main application's body which would cause issues. I mean it currently also clears the body and mounts Mithril in there, so I guess you must change it! Assuming you have a conditional build anyway, I was thinking maybe we could conditionally just exclude common.scss (or rather some other smaller sass file with just the problematic styles) for embedded builds? |
Thanks for the pointers, and for letting the UI integration test action run. I'll track these down. Yes, I expect a mixin will help.
Yes, I found no trace of it.
We could qualify these with the
In my application I'm working on the basis of #2267, which skips the instantiation of the UI in the
Thanks to your work on the theme provider, there is now no conditional or other compile-time variation point. My application just takes the Perfetto UI build as is 😀 |
A number of style rules that actually are no longer needed were leaking into applications that embed the Perfetto UI. So these are deleted. Add a 'perfetto' class to the document body to ensure proper confinement of the UI with internal scrolling instead of scrolling all content. Fixes google#2166 Signed-off-by: Christian W. Damus <[email protected]>
Instead of a rule targeting all button elements, define a button-base mixin to include common button styling in rules that need it. Signed-off-by: Christian W. Damus <[email protected]>
f766678
to
74f8c69
Compare
Commit 74f8c69 uses a new |
The selection tab and other components use the heading styles and relied on their styles, which are restored but scoped using the new 'perfetto' style class. Signed-off-by: Christian W. Damus <[email protected]>
And the heading styles were needed for selection tab and more, so those are restored as I suggested with the perfetto ancestor class in commit dc4e3f5. |
Sorry for the late reply, I've been OOO for a couple days. I've been ruminating on what the best approach is for sorting out these styles. I'm not convinced the .perfetto class is the right thing necessarily for some of the styles, though it probably will be needed for the final html/body overriding styles. I've hacked around a bit and tidied up a few messy parts in #2864. The general approach I've taken is to move everything into the UIMain component, so that if used in isolation without the ThemeProvider then everything will work except the theme scss variables obviously. I've moved the catch-all button, h[1,2,3,4,5,6], pre, code, and box-sizing into .pf-ui-main, and moved the OverlayContext inside UIMain too so that popups still get the right styling. I've used :where(...) to specify the elements which has the same specificity as the widget level selectors, but they appear after so they take precedence. I think this replaces the need for the Next I've moved the various variables attached to Next, I've moved the various Sass mixins into theme.scss (which is now more of a badly named 'utils' file). Next I've moved the filedrag styles into UIMain too, which probably weren't causing issues but it makes sense to contain them anyway. Finally I've cleaned up the html, body styles to what I think is the bare minimum. Now, this isn't perfect as the html an body styles still exist, but I think everything is a lot neater now. Again, apologies for just duplicating a lot of what's in PR, but it's the sort of job you just need to poke around and get a feel for, which is a lot easier than me trying to guide you through it, so I hope you don't mind! I think it would be best if, once I've landed #2864, if you rebase on top of that, and that'll give us a much more stable ground on which to finalize the last pieces of the puzzle. |
Absolutely no need to apologize! Thanks for the update.
OK, cool. I was using the ThemeProvider to inject my application's fonts and colours. I don't imagine that it won't still work 😀
Yes, that sounds good.
They weren't a problem as I obviously don't use them in my app, but neither will moving them be a problem.
Yeah, that wasn't a problem, but agreed that this is cleaner.
I think they were mostly compatible with my application anyways, which has similar space-filling requirements.
Again, no apology needed. I appreciate the effort that you're putting into this. I've been trying too hard to fit my proposed changes into the current structure and I certainly don't mind you taking the helm when you're willing to blow it all up, as it were.
Absolutely. I'll be happy to validate those changes for my use case and follow up for any remaining gaps, here! Thanks so much. |
Ahh I hadn't imagined you'd be interested in changing the fonts - in that case I'll put them in the theme provider. The idea is that you only need to remove the ThemeProvider in order to get a raw UI that you can embed and theme. Good, sound like everything else should be pretty much there aside from the bare html/body styles, but we're getting closer! Thanks for bearing with me. |
A number of style rules that actually are no longer needed were leaking
into applications that embed the Perfetto UI. So these are deleted.
Add a 'perfetto' class to the document body to ensure proper confinement
of the UI with internal scrolling instead of scrolling all content.
Fixes #2166