What is the difference between reflow and repaint?

I am a bit unclear regarding the difference between reflow + repaint (if there is any difference whatsoever)

It seems that reflow can shift the position of various DOM elements, where repaint simply creates a new object. For example. reflow will happen when an element is deleted, and when its color changes, redrawing will occur.

It's true?

+46
performance javascript reflow repaint
Mar 30 '10 at 22:59
source share
3 answers

This post appears to cover payment issues compared to redrawing.

http://www.stubbornella.org/content/2009/03/27/reflows-repaints-css-performance-making-your-javascript-slow/

As for the definitions, from this post:

A repaint occurs when changes are made to the skin of elements, which changes visibly, but does not affect its layout.

Examples of this include outline , visibility , background , or color . According to Opera, repainting is expensive because the browser needs to check the visibility of all other nodes in the DOM tree.

A reflow is even more important for performance because it is associated with changes that affect the layout of part of the page (or the whole page).

Examples that cause remodeling include: adding or removing content, implicitly or explicitly changing width , height , font-family , font-size , etc.

Find out which css properties are redrawn and viewed at http://csstriggers.com

+59
Mar 30 '10 at 23:06
source share

In my opinion, redrawing affects only the DOM itself, but reflow affects the entire page.

Repainting occurs when some changes that are just his skin styles, such as color and visibility.

Reflow occurs when the DOM page changes its layout.

I recently discovered that a site might be looking for which attribute would cause a redraw or payment. http://csstriggers.com/

+5
Jan 07 '15 at 4:00
source share

Here is another great post: http://blog.letitialew.com/post/30425074101/repaints-and-reflows-manipulating-the-dom

Repainting or redrawing passes through all the elements and determines their visibility, color, contour and other properties of the visual style, and then updates the corresponding parts of the screen.

Layout calculates page layout. Recalculating an element analyzes the dimensions and position of the element, and also leads to further re-planning of these elements of the child elements, ancestors, and elements that appear after it in the DOM. Then he calls the final redraw. Reflowing is very expensive.

It is also introduced when overflow occurs and how to minimize payment.

+4
Jul 26 '15 at 20:21
source share



All Articles