Exemple #1
0
        public bool NeedsExpansion(CssDeclaration declaration, Browser[] browsers)
        {
            if (browsers == null || browsers.Length == 0) return false;

            if (!Compatibility.HasPatches) return false;

            foreach (var browser in browsers)
            {
                if (Compatibility.HasPatch(declaration, browser)) return true;
            }

            return false;
        }
Exemple #2
0
        public void WritePatchedDeclaration(CssDeclaration declaration, int level)
        {
            var prop = declaration.Info;

            if (browserSupport != null && prop.Compatibility.HasPatches)
            {
                var prefixes = BrowserPrefixKind.None;

                foreach (var browser in browserSupport)
                {
                    // Skip the prefix if we've already added it
                    if (prefixes.HasFlag(browser.Prefix.Kind)) continue;

                    if (!prop.Compatibility.HasPatch(declaration, browser)) continue;

                    var patch = prop.Compatibility.GetPatch(browser, declaration);

                    Indent(level);

                    writer.Write(patch.Name);
                    writer.Write(": ");
                    WriteValue(patch.Value);
                    writer.Write(";");

                    writer.WriteLine();

                    prefixes |= browser.Prefix.Kind;
                }
            }

            // Finally, write the standards declaration

            WriteDeclaration(declaration, level);
        }
Exemple #3
0
        public void WriteDeclaration(CssDeclaration declaration, int level)
        {
            Indent(level);

            writer.Write(declaration.Name);
            writer.Write(": ");
            WriteValue(declaration.Value);
            writer.Write(";");
        }