mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-15 20:49:41 +00:00
DOMMatrix.to_string() throws exceptions if any of its values are non-finite. This ends up affecting CSSStyleValue because its subclass CSSTransformValue (which is about to be added) serializes CSSTransformComponents, and one of those is CSSMatrixComponent, which calls DOMMatrix.to_string(). This is all quite unfortunate, and because at the time the spec for DOMMatrix was written, CSS couldn't represent NaN or infinity. That's no longer true, so I'm hoping the spec can be updated and this can be reverted. https://github.com/w3c/fxtf-drafts/issues/611
42 lines
1.3 KiB
C++
42 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/FlyString.h>
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
|
|
|
namespace Web::CSS {
|
|
|
|
class CSSVariableReferenceValue : public Bindings::PlatformObject {
|
|
WEB_PLATFORM_OBJECT(CSSVariableReferenceValue, Bindings::PlatformObject);
|
|
GC_DECLARE_ALLOCATOR(CSSVariableReferenceValue);
|
|
|
|
public:
|
|
[[nodiscard]] static GC::Ref<CSSVariableReferenceValue> create(JS::Realm&, FlyString variable, GC::Ptr<CSSUnparsedValue> fallback = nullptr);
|
|
static WebIDL::ExceptionOr<GC::Ref<CSSVariableReferenceValue>> construct_impl(JS::Realm&, FlyString variable, GC::Ptr<CSSUnparsedValue> fallback);
|
|
|
|
virtual ~CSSVariableReferenceValue() override;
|
|
|
|
String variable() const;
|
|
WebIDL::ExceptionOr<void> set_variable(FlyString);
|
|
|
|
GC::Ptr<CSSUnparsedValue> fallback() const;
|
|
WebIDL::ExceptionOr<void> set_fallback(GC::Ptr<CSSUnparsedValue>);
|
|
|
|
WebIDL::ExceptionOr<String> to_string() const;
|
|
|
|
private:
|
|
CSSVariableReferenceValue(JS::Realm&, FlyString variable, GC::Ptr<CSSUnparsedValue> fallback);
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
virtual void visit_edges(Visitor&) override;
|
|
|
|
FlyString m_variable;
|
|
GC::Ptr<CSSUnparsedValue> m_fallback;
|
|
};
|
|
|
|
}
|