Bug 860318 - Update keyboard visuals to improve performance.

The first commit is just to recover what Pavel do to base on his work.
Please help review cf47a65 only if you have reviewed the first part.

Will squash them before merging.