• Simon McVittie's avatar
    Keep similar theme nodes so we don't have to recompute CSS so often · dc2ec0a8
    Simon McVittie authored
    Because we calculate and cache CSS properties once per StThemeNode,
    and only a certain set of attributes can affect the CSS properties,
    it's advantageous for as many widgets as possible to share a single
    StThemeNode. Similarly, if a widget changes state and then changes back
    (e.g. gaining and losing the :hover pseudo-class), it should ideally
    get its original StThemeNode back again when it returns to the old
    state.
    
    Here, I'm using the StThemeContext as the location for a cache.
    StThemeNodes are currently never freed: this seems OK for Shell's usage
    (a finite number of IDs, classes, pseudo-classes and types).
    
    Bug: https://bugzilla.gnome.org/show_bug.cgi?id=687465Reviewed-by: Jasper St. Pierre's avatarJasper St. Pierre <jstpierre@mecheye.net>
    dc2ec0a8
st-theme-context.c 9.36 KB