I've just seen that buttonHeight is used only here, you can probably remove some more code in this function.

And last but ont least, this is code that triggers some bad reflows, so really, this is very helpful !