mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 20:35:06 +00:00
LibWeb: Use JS::MarkedVector while parsing CSS keyframe rules
We need to be sure they are marked in case the GC runs while we're in the CSS parser.
This commit is contained in:
parent
bb4eca2037
commit
9577cd853a
3 changed files with 4 additions and 4 deletions
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
JS::NonnullGCPtr<CSSKeyframesRule> CSSKeyframesRule::create(JS::Realm& realm, AK::FlyString name, Vector<JS::NonnullGCPtr<CSSKeyframeRule>> keyframes)
|
JS::NonnullGCPtr<CSSKeyframesRule> CSSKeyframesRule::create(JS::Realm& realm, FlyString name, JS::MarkedVector<JS::NonnullGCPtr<CSSKeyframeRule>> keyframes)
|
||||||
{
|
{
|
||||||
return realm.heap().allocate<CSSKeyframesRule>(realm, realm, move(name), move(keyframes));
|
return realm.heap().allocate<CSSKeyframesRule>(realm, realm, move(name), move(keyframes));
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ class CSSKeyframesRule final : public CSSRule {
|
||||||
WEB_PLATFORM_OBJECT(CSSKeyframesRule, CSSRule);
|
WEB_PLATFORM_OBJECT(CSSKeyframesRule, CSSRule);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
[[nodiscard]] static JS::NonnullGCPtr<CSSKeyframesRule> create(JS::Realm&, FlyString name, Vector<JS::NonnullGCPtr<CSSKeyframeRule>>);
|
[[nodiscard]] static JS::NonnullGCPtr<CSSKeyframesRule> create(JS::Realm&, FlyString name, JS::MarkedVector<JS::NonnullGCPtr<CSSKeyframeRule>>);
|
||||||
|
|
||||||
virtual ~CSSKeyframesRule() = default;
|
virtual ~CSSKeyframesRule() = default;
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ public:
|
||||||
void set_name(String const& name) { m_name = name; }
|
void set_name(String const& name) { m_name = name; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CSSKeyframesRule(JS::Realm& realm, FlyString name, Vector<JS::NonnullGCPtr<CSSKeyframeRule>> keyframes)
|
CSSKeyframesRule(JS::Realm& realm, FlyString name, JS::MarkedVector<JS::NonnullGCPtr<CSSKeyframeRule>> keyframes)
|
||||||
: CSSRule(realm)
|
: CSSRule(realm)
|
||||||
, m_name(move(name))
|
, m_name(move(name))
|
||||||
, m_keyframes(move(keyframes))
|
, m_keyframes(move(keyframes))
|
||||||
|
|
|
@ -1505,7 +1505,7 @@ CSSRule* Parser::convert_to_rule(NonnullRefPtr<Rule> rule)
|
||||||
|
|
||||||
auto child_tokens = TokenStream { rule->block()->values() };
|
auto child_tokens = TokenStream { rule->block()->values() };
|
||||||
|
|
||||||
Vector<JS::NonnullGCPtr<CSSKeyframeRule>> keyframes;
|
JS::MarkedVector<JS::NonnullGCPtr<CSSKeyframeRule>> keyframes(m_context.realm().heap());
|
||||||
while (child_tokens.has_next_token()) {
|
while (child_tokens.has_next_token()) {
|
||||||
child_tokens.skip_whitespace();
|
child_tokens.skip_whitespace();
|
||||||
// keyframe-selector = <keyframe-keyword> | <percentage>
|
// keyframe-selector = <keyframe-keyword> | <percentage>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue