Add basic support for transparency groups.

Fixes:
#2883
#2049
#1980
#1324
https://bugzilla.mozilla.org/show_bug.cgi?id=843166
https://bugzilla.mozilla.org/show_bug.cgi?id=843321