The browser's rendering mechanism1. Browsers use two engines to process pages, and different browsers use different rendering engines Rendering Engine: js engine 2. The browser will parse HTML into DOM tree, parse css into CSSOM (CSS Object Model); 3. Then the DOM tree and CSSOM will be combined to produce render tree(render tree); 4. After the render tree is completed, the browser will layout according to the render tree. After the layout is completed, a "box model" will be output, which will accurately capture the position and size of each node in the view, and all measurements will be converted into physical pixel values on the screen; (This step will cause 5. After the layout is completed, the browser will immediately issue a paint stup event to convert the render tree into screen pixels; (this step will cause 6.After the above steps, the page will be displayed on the screen. Note that reflow will inevitably cause redrawing, but redrawing does not necessarily cause reflow Reflow and repaintReflowconcept: When part or all of the render tree changes due to changes in the structure, size, layout, etc. of the elements, the browser re-renders part or all of the DOM. Emphasize that the position and distance of element nodes have changed. Actions that cause reflux:
Redrawconcept: When the style of a page element changes without affecting its position in the document flow, the browser simply assigns the new style to the element and repaints it. Emphasize the style of element nodes, such as color, border solid line becomes dashed line (without changing position and distance). Operations that cause redrawing:
The above is the detailed content of the principles and differences of reflow and repaint, which are frequently asked in Web interviews. For more information about reflow and repaint in Web interviews, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: How to use libudev in Linux to get USB device VID and PID
>>: How to connect to MySQL remotely through Navicat
1. ip_hash: ip_hash uses a source address hash al...
1. Introduction I recently worked on a project an...
Table of contents Basic Overview Enable GTID onli...
Preface: Partitioning is a table design pattern. ...
1. Development environment vue 2. Computer system...
The storage size and range of each floating point...
MYSQL version: MySQL Community Server 5.7.17, ins...
Prepare war package 1. Prepare the existing Sprin...
Basic concepts: Macvlan working principle: Macvla...
Docker usage of gitlab gitlab docker Startup Comm...
Preface Usually, a "paging" strategy is...
Today, when we were learning about the Niu Nan new...
Table of contents 1. Handwritten instanceof 2. Im...
need: Implement dynamic display of option values ...
Effect Need environment vue elementUI Drag and dr...