mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-21 00:38:56 +00:00
LibWeb: Don't redundantly re-sort StyleSheetList on sheet removal
The list is already kept sorted. Removing one sheet anywhere from the list will not make it unsorted.
This commit is contained in:
parent
9d8ab826cb
commit
819f2c1df6
Notes:
sideshowbarker
2024-07-17 22:01:16 +09:00
Author: https://github.com/awesomekling
Commit: 819f2c1df6
Pull-request: https://github.com/SerenityOS/serenity/pull/24058
Reviewed-by: https://github.com/trflynn89 ✅
2 changed files with 0 additions and 12 deletions
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/QuickSort.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/StyleSheetListPrototype.h>
|
||||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
|
@ -125,8 +124,6 @@ void StyleSheetList::remove_sheet(CSSStyleSheet& sheet)
|
|||
return;
|
||||
}
|
||||
|
||||
sort_sheets();
|
||||
|
||||
m_document->style_computer().invalidate_rule_cache();
|
||||
m_document->invalidate_style();
|
||||
}
|
||||
|
@ -176,11 +173,4 @@ WebIDL::ExceptionOr<JS::Value> StyleSheetList::item_value(size_t index) const
|
|||
return m_sheets[index].ptr();
|
||||
}
|
||||
|
||||
void StyleSheetList::sort_sheets()
|
||||
{
|
||||
quick_sort(m_sheets, [](JS::NonnullGCPtr<StyleSheet> a, JS::NonnullGCPtr<StyleSheet> b) {
|
||||
return a->owner_node()->is_before(*b->owner_node());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -50,8 +50,6 @@ private:
|
|||
void add_sheet(CSSStyleSheet&);
|
||||
void remove_sheet(CSSStyleSheet&);
|
||||
|
||||
void sort_sheets();
|
||||
|
||||
JS::NonnullGCPtr<DOM::Document> m_document;
|
||||
Vector<JS::NonnullGCPtr<CSSStyleSheet>> m_sheets;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue