[External] : Re: CSS Lookups and their origins (possible regression)

Andy Goryachev andy.goryachev at oracle.com
Tue Jul 9 19:34:27 UTC 2024


Thank you for clarification!

Glad you were able to do what you wanted.  But really, if there are bugs, I would rather have them filed and fixed.

-andy



From: Pedro Duque Vieira <pedro.duquevieira at gmail.com>
Date: Tuesday, July 9, 2024 at 12:26
To: Andy Goryachev <andy.goryachev at oracle.com>
Cc: openjfx-dev at openjdk.org <openjfx-dev at openjdk.org>
Subject: Re: [External] : Re: CSS Lookups and their origins (possible regression)
Perhaps I should have been clearer. I mentioned that example merely to make a point on how having a stylesheet set as an AUTHOR stylesheet can be a problem (Modena or a custom theme library like JMetro)  :-) .
It wasn't actually to create a new separate discussion.

As for the other discussion not exactly related to the one in this thread (having custom themes be user agent stylesheets) I think I have found a way to make multiple stylesheets be a user agent stylesheet.
That was my main problem as JMetro is composed of more than 1 stylesheet. I'm also doing it while still just using the javafx standard API. Thus far it's working except for some minor bugs (which I'm inclined to think are bugs in JavaFX itself).

Thanks!

On Tue, Jul 9, 2024 at 8:17 PM Andy Goryachev <andy.goryachev at oracle.com<mailto:andy.goryachev at oracle.com>> wrote:
If your stylesheet defines the necessary variables, the "users" should be able to redefine them, correct?

Or maybe allow for programmatic control of the stylesheet, similar to
https://github.com/andy-goryachev/AppFramework/blob/7f74f58ecd4de239be923c4384e10142e48ade7c/src/goryachev/fx/FxFramework.java#L31<https://urldefense.com/v3/__https:/github.com/andy-goryachev/AppFramework/blob/7f74f58ecd4de239be923c4384e10142e48ade7c/src/goryachev/fx/FxFramework.java*L31__;Iw!!ACWV5N9M2RV99hQ!JM0pqIGTO_sPclbb2MbtvHgeNEDFgduJbJorYQTyhqptr9KT3ceFnMAznrQH610hptO_dhJUC7Cp2dssqEcpNKskcKgEqM8$>
https://github.com/andy-goryachev/AppFramework/blob/main/src/demo/appfw/Styles.java<https://urldefense.com/v3/__https:/github.com/andy-goryachev/AppFramework/blob/main/src/demo/appfw/Styles.java__;!!ACWV5N9M2RV99hQ!JM0pqIGTO_sPclbb2MbtvHgeNEDFgduJbJorYQTyhqptr9KT3ceFnMAznrQH610hptO_dhJUC7Cp2dssqEcpNKskOaoBCDc$>

Alternatively, we would need a new public API to allow you to do what you want how you want.  Perhaps if you could tell us about the problem you are trying to solve, exactly, and the APIs that are missing.

-andy




From: Pedro Duque Vieira <pedro.duquevieira at gmail.com<mailto:pedro.duquevieira at gmail.com>>
Date: Tuesday, July 9, 2024 at 12:00
To: Andy Goryachev <andy.goryachev at oracle.com<mailto:andy.goryachev at oracle.com>>
Cc: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org>>
Subject: Re: [External] : Re: CSS Lookups and their origins (possible regression)
>>  That's why now in the new theme I'm creating I'm setting everything to be an user agent stylesheet.

> and this is probably the right approach.

Correct. That's why I agree with John and why the current behavior is likely undesired. :-)

On Tue, Jul 9, 2024 at 7:40 PM Andy Goryachev <andy.goryachev at oracle.com<mailto:andy.goryachev at oracle.com>> wrote:
>  That's why now in the new theme I'm creating I'm setting everything to be an user agent stylesheet.

and this is probably the right approach.

-andy



From: openjfx-dev <openjfx-dev-retn at openjdk.org<mailto:openjfx-dev-retn at openjdk.org>> on behalf of Pedro Duque Vieira <pedro.duquevieira at gmail.com<mailto:pedro.duquevieira at gmail.com>>
Date: Tuesday, July 9, 2024 at 11:28
To: openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org> <openjfx-dev at openjdk.org<mailto:openjfx-dev at openjdk.org>>
Subject: Re: [External] : Re: CSS Lookups and their origins (possible regression)
Hi guys,

I agree with John Hendrikx on this.

The thing is not that you override the "css variable" value but that you end up overriding the priority of the rules in Modena which the developer won't likely want to.

One other thing I'd add is that developers also like to use css themselves. If modena rules suddenly start to have the priority of AUTHOR this becomes much harder. They have to make their rules always more specific than Modena's that now have increased priority besides the fact that they need to be aware that this is actually happening and is the problem (in my experience many developers won't know this).

On a related note, I created a theme called JMetro. When implementing it I made it so that it was composed of author stylesheets (there wasn't a way to set it as a user agent stylesheet back when I started). That's also how 90% of themes work.
However this is an issue as developers wanting to override styles set by JMetro will have a hard time figuring out how to make their rules specificity in their CSS higher than JMetro's so they get overridden (I've had complaints on this). That's why now in the new theme I'm creating I'm setting everything to be an user agent stylesheet.

Thanks,

--
Pedro Duque Vieira (Duke) - https://www.pixelduke.com<https://urldefense.com/v3/__https:/www.pixelduke.com__;!!ACWV5N9M2RV99hQ!NnLY0nSsEY93YxbhJsdC4TvA_CwObtH-KxcDs-JoCjZJZuX50rhGPjVRRbkZRNsLFo819RzmhmodWXd_NsA8s_UqbxTANLg$>


--
Pedro Duque Vieira (Duke) - https://www.pixelduke.com<https://urldefense.com/v3/__https:/www.pixelduke.com__;!!ACWV5N9M2RV99hQ!NnLY0nSsEY93YxbhJsdC4TvA_CwObtH-KxcDs-JoCjZJZuX50rhGPjVRRbkZRNsLFo819RzmhmodWXd_NsA8s_UqbxTANLg$>


--
Pedro Duque Vieira (Duke) - https://www.pixelduke.com<https://urldefense.com/v3/__https:/www.pixelduke.com__;!!ACWV5N9M2RV99hQ!JM0pqIGTO_sPclbb2MbtvHgeNEDFgduJbJorYQTyhqptr9KT3ceFnMAznrQH610hptO_dhJUC7Cp2dssqEcpNKskANBmcZ0$>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20240709/d93c103e/attachment-0001.htm>


More information about the openjfx-dev mailing list