Esempio n. 1
0
        // Private Utilities

        static void GetInlineStyleSheetAndRule(VisualTreeAsset vta, VisualElement element, out StyleSheet styleSheet, out StyleRule styleRule)
        {
            var vea = element.GetVisualElementAsset();

            styleSheet = vta.GetOrCreateInlineStyleSheet();
            styleRule  = vta.GetOrCreateInlineStyleRule(vea);
        }
Esempio n. 2
0
        public static StyleRule GetOrCreateInlineStyleRule(this VisualTreeAsset vta, VisualElementAsset vea, out bool wasCreated)
        {
            wasCreated = vea.ruleIndex < 0;
            if (wasCreated)
            {
                var inlineSheet = vta.GetOrCreateInlineStyleSheet();
                vea.ruleIndex = inlineSheet.AddRule();
            }

            return(vta.inlineSheet.GetRule(vea.ruleIndex));
        }