mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb: Cache state of the contenteditable attribute on HTMLElement
Instead of recomputing the state whenever someone asks for it, we now cache it when the attribute is added/changed/removed. Before this change, HTMLElement::is_editable() was 6.5% of CPU time when furiously resizing Hacker News. After, it's less than 0.5%. :^)
This commit is contained in:
parent
990e7219d6
commit
20e2c9a7dd
Notes:
sideshowbarker
2024-07-16 22:17:03 +09:00
Author: https://github.com/awesomekling
Commit: 20e2c9a7dd
Pull-request: https://github.com/SerenityOS/serenity/pull/18848
2 changed files with 25 additions and 16 deletions
|
@ -67,6 +67,7 @@ protected:
|
|||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
|
||||
virtual void did_remove_attribute(DeprecatedFlyString const& name) override;
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
|
@ -81,7 +82,7 @@ private:
|
|||
False,
|
||||
Inherit,
|
||||
};
|
||||
ContentEditableState content_editable_state() const;
|
||||
ContentEditableState m_content_editable_state { ContentEditableState::Inherit };
|
||||
|
||||
JS::GCPtr<DOMStringMap> m_dataset;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue