Harbs commented on issue #1171:
URL: https://github.com/apache/royale-asjs/issues/1171#issuecomment-1003327588


   After thinking about this some more:
   * It seems like instead of adding to `IStyleableObject`, we should add a new 
interface (`ICSSStyleable`) which inherits from `IStyleableObject`.
   * I'm not sure if `UIBase` should implement `ICSSStyleable` or there should 
be a subclass of that which does.
   * There should probably be 5 distinct methods in `ICSSStyleable`.
      1. `saveStyle` (or similar) would save a default for the class.
      2. `findStyle` would get a style from the defaults walking up the 
inheritance if necessary. The results should be cached so the walk would only 
happen once per style per class.
      3. `findInheritedStyle` would call find style up the parent chain until 
it finds a style. The parent chain results would not be cached by default. We'd 
need to figure out whether caching is ever a good idea.
      4. `setStyle` would apply a style to an instance. In the case of HTML, 
this should apply the change to the element's inline css.
      5. `getStyle` would get the directly applied style of the instance (if 
any).
   * In MX/Spark `setStyle` and `getStyle` already have defined meanings. We'd 
need to figure out how/if that fits with the above. `mx.core.UIComponent` might 
need a different implementation. This might be a reason to make the 
implementation a subclass of `UIBase`.
   * For many current uses of `ValuesManager.valuesImpl.getValue()`, there is 
no need to walk up the parent chain (such as finding default beads). For such 
cases simply calling `findStyle()` would be enough.
   * It's worth researching whether we can/should have an option to avoid style 
lookups for cases where it's not needed (such as HTML elements where it's known 
that styling is applied by HTML CSS). This might provide significant 
performance improvements.
   * It's worth researching how expensive it currently is to get an element's 
parent. It currently uses the DOM for HTML elements to get the DOM element's 
parent. The rule of thumb is that DOM operations are much more expensive than 
native JS. It might be worthwhile looking into whether keeping track of the 
parent is something that can improve performance. If yes, this would need to be 
done carefully to make sure that parent references don't get out of sync.
   
   I'd love to hear others' thoughts on all of this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@royale.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to