What does it mean when "paint" takes a long time to happen?

In my game, there are random lag spikes that occur. I used the Firefox performance tool to see what was causing the slowdown, and it appears that “Paint” took a look time to happen. I’m not exactly sure how to improve that. It took 20ms which considerably slowed down the game for brief amounts of time. Can somebody help me? Am I doing something wrong??

I vaguely understand this chart. What happens in paint exactly? Why does it take so much time?