5 ms·
Speaking about reflow, I'm wondering: if I have a piece of text that contains multiple paragraphs, and I change a single character in the text, will Chrome reco
by amelius 11y ago
Speaking about reflow, I'm wondering: if I have a piece of text that contains multiple paragraphs, and I change a single character in the text, will Chrome recompute the layout for all paragraphs? Is changing a character a O(1) operation w.r.t. the number of paragraphs?
- wingnut 11y agoI don't know, but proudly showcasing the fact you've got a hardon for a crappy dead hack like DFW is absolutely O(1)
- gsnedders 11y agoIt depends if it creates a new line (and therefore a new line box).
- paulirish 11y agoJust tried this out and the answer is yes. All subsequent elements will have layout recomputed. There is some room for optimization here (evaluate if the flow content requires new text-wrapping across lineboxes), but luckily these layouts are quite fast. Establishing containers as layout roots (generally fixed height/width and overflow:hidden) will constrain these sorts of costs.