ladybird
ladybird copied to clipboard
LibWeb: Use fast path for input boxes
Typing into input boxes is slow, as the entire page layout is invalidated and redone. This PR makes a "fast-path" so only the necessary portions of the page are invalidated.
First, when the webpage is laid out fresh (initial load or relayout), the details necessary to create each input box are saved in the BlockContainer object in the layout tree.
Second, when the user types into an input box, the Document object for that webpage tracks whether that is the only change that has occurred since the last relayout.
Third, when the document updates its layout, if only an input box has been typed into, the document calls .run() on a FormattingContext object created just for the BlockContainer associated with the input box (instead of calling .run() on the root FormattingContext).