See comments in bug 33383.
Created attachment 48193 [details] Patch
This is great.
Committed r54428: <http://trac.webkit.org/changeset/54428>