mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 03:27:15 +02:00
LibWeb: Support non-fixed <random-value-sharing>
This works by generating random values using XorShift128PlusRNG at compute time and then caching them on the document using the relevant random-caching-key
This commit is contained in:
Notes:
github-actions[bot]
2025-12-01 11:01:47 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/12e8f503aa4 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6707 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/gmta
@@ -98,7 +98,6 @@ ErrorOr<void> generate_implementation_file(JsonObject& functions_data, Core::Fil
|
||||
#include <LibWeb/CSS/Parser/ErrorReporter.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/CSS/StyleValues/CalculatedStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/NumberStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/RandomValueSharingStyleValue.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
@@ -312,8 +311,7 @@ RefPtr<CalculationNode const> Parser::parse_math_function(Function const& functi
|
||||
parameter_generator.set("parse_function", MUST(String::formatted("parse_random_value_sharing(tokens_{})", parameter_index)));
|
||||
parameter_generator.set("check_function", " != nullptr"_string);
|
||||
parameter_generator.set("release_function", ".release_nonnull()"_string);
|
||||
// FIXME: This should be 'auto' rather than 'fixed 0' by default
|
||||
parameter_generator.set("parameter_default", MUST(String::formatted(" = RandomValueSharingStyleValue::create_fixed(NumberStyleValue::create(0))")));
|
||||
parameter_generator.set("parameter_default", MUST(String::formatted(" = RandomValueSharingStyleValue::create_auto(random_value_sharing_auto_name(), false)")));
|
||||
} else {
|
||||
// NOTE: This assumes everything not handled above is a calculation node of some kind.
|
||||
parameter_is_calculation = true;
|
||||
|
||||
Reference in New Issue
Block a user