这个过程被称作重排版。
在这个糟糕的例子中,它导致浏览器重排版了三次。
In the worst case, this will cause the browser to reflow three times.
浏览器需要重排版的部分越小,应用程序的响应速度就越快。
The less the browser needs to reflow, the more responsive your application will be.
某些改变可导致重排版整个页面:例如,当一个滚动条出现时。
Some changes may cause a reflow of the whole page: for example, when a scroll bar appears.
重排版完成时,浏览器在一个重绘进程中重新绘制屏幕上受影响的部分。
Once the reflow is complete, the browser redraws the affected parts of the screen in a process called repaint.
如果你忽略了这两个步骤,那么第二步中每次改变都将引发一次重排版。
If you omit those steps, every change you make in step 2 could cause its own reflows.
在这种情况下,只需要重绘(不需要重排版),因为元素的布局没有改变。
In this case, there is a repaint only (no reflow), because the layout of the element hasn't changed.
这是一个重绘过程,但只影响页面的一小部分,避免重排版并重绘一大块页面。
This is a repaint, but only of a small part of the page instead of a reflow and repaint of a big page chunk.
正如前面所提到的,当布局和几何改变时需要重排版。在下述情况中会发生重排版。
As mentioned earlier, a reflow is needed whenever layout and geometry change. This happens when.
重排版有时只影响渲染树的一小部分,但也可以影响很大的一部分,甚至整个渲染树。
Reflows sometimes affect only a small part of the render tree, but they can affect a larger portion, or even the whole tree.
注意重绘和重排版;批量修改风格,离线操作DOM树,缓存并减少对布局信息的访问。
Be mindful of repaints and reflows; batch style changes, manipulate the DOM tree "offline," and cache and minimize access to layout information.
重排版和重绘代价昂贵,所以,提高程序响应速度一个好策略是减少此类操作发生的机会。
Reflows and repaints can be expensive, and therefore a good strategy for responsive applications is to reduce their number.
另一种减少重排版次数的方法是:在文档之外创建并更新一个文档片断,然后将它附加在原始列表上。
Another way to minimize the number of reflows is to create and update a document fragment, completely off the document, and then append it to the original list.
所以当一个页面顶部的动画推移了差不多整个页面时,将引发巨大的重排版动作,使用户感到动画卡顿。
So when an animation at the top of the page pushes down almost the whole page, this will cause a big reflow and can be expensive, appearing choppy to the user.
尽管在原版演出之时,桑德海在音乐上的贡献几乎被忽略和无视,但在后来的多次重排版中,他谱写的音乐和歌词却成了最为瞩目的部分。
While Sondheim's contributions to the show were mostly ignored or dismissed at the time of the original production, subsequent revivals have made his music and lyrics the show's most heralded aspect.
尽管在原版演出之时,桑德海在音乐上的贡献几乎被忽略和无视,但在后来的多次重排版中,他谱写的音乐和歌词却成了最为瞩目的部分。
While Sondheim's contributions to the show were mostly ignored or dismissed at the time of the original production, subsequent revivals have made his music and lyrics the show's most heralded aspect.
应用推荐