mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 23:48:11 +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
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