"Auto" width for items in horizontal legend

This is essentially a better version of #561. Improvements:

1. Leaner, more focused tests for switching automatic item width for legends.
1. Additional test checking if the second item in a horizontal legend has different offset with auto width turned on and off.
1. Is branched from the most recent master on dc.js, with modifications to legend.js from #561 carried over but also updated to match current code style in the project.