The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

CSS margin

These changes was commited to the Birdfont repository Sat, 18 Jun 2016 08:37:03 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Sat, 18 Jun 2016 08:37:03 +0000 (10:37 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Sat, 18 Jun 2016 08:37:03 +0000 (10:37 +0200)
commit 125a3ccf315823fbd16852c2131cc7ebac1a8481
tree 5330863f35d576d77281771b02eb4b4538bc8d9f
parent 0f3498248d696b9ab4e09cc579fcbd68661b9901
CSS margin

libsvgbird/Gradient.vala
libsvgbird/SvgStyle.vala
--- a/libsvgbird/Gradient.vala +++ b/libsvgbird/Gradient.vala @@ -52,8 +52,6 @@ g.id = id; g.href = href; transforms = transforms.copy (); - - print (@"$(this)\n"); return g; }
--- a/libsvgbird/SvgStyle.vala +++ b/libsvgbird/SvgStyle.vala @@ -284,10 +284,32 @@ if (k == "padding") { parse_padding_shorthand (v); + } else if (k == "margin") { + parse_margin_shorthand (v); } else { style.set (k, v); } } + } + } + + void parse_margin_shorthand (string arguments) { + string[] args = StyleSheet.replace_whitespace (arguments).split (" "); + + if (args.length > 0) { + style.set ("margin-top", args[0]); + } + + if (args.length > 1) { + style.set ("margin-right", args[1]); + } + + if (args.length > 2) { + style.set ("margin-bottom", args[2]); + } + + if (args.length > 3) { + style.set ("margin-left", args[3]); } }