mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 19:45:07 +00:00
LibWeb: Add hack to disable StyleInvalidator while parsing document
Running a StyleInvalidator for every attribute set in a new document was making it impossible to load larger sites. :^)
This commit is contained in:
parent
23f70535e2
commit
58bade25dd
3 changed files with 11 additions and 0 deletions
|
@ -33,6 +33,8 @@ namespace Web::CSS {
|
|||
StyleInvalidator::StyleInvalidator(DOM::Document& document)
|
||||
: m_document(document)
|
||||
{
|
||||
if (!m_document.should_invalidate_styles_on_attribute_changes())
|
||||
return;
|
||||
auto& style_resolver = m_document.style_resolver();
|
||||
m_document.for_each_in_subtree_of_type<DOM::Element>([&](auto& element) {
|
||||
m_elements_and_matching_rules_before.set(&element, style_resolver.collect_matching_rules(element));
|
||||
|
@ -42,6 +44,8 @@ StyleInvalidator::StyleInvalidator(DOM::Document& document)
|
|||
|
||||
StyleInvalidator::~StyleInvalidator()
|
||||
{
|
||||
if (!m_document.should_invalidate_styles_on_attribute_changes())
|
||||
return;
|
||||
auto& style_resolver = m_document.style_resolver();
|
||||
m_document.for_each_in_subtree_of_type<DOM::Element>([&](auto& element) {
|
||||
auto maybe_matching_rules_before = m_elements_and_matching_rules_before.get(&element);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue