mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 22:48:11 +00:00
LibJS: Replace GlobalObject with VM in Value AOs [Part 4/19]
This is where the fun begins. :^)
This commit is contained in:
parent
f6c4a0f5d0
commit
a022e548b8
129 changed files with 1230 additions and 1325 deletions
|
@ -32,7 +32,7 @@ JS_DEFINE_NATIVE_FUNCTION(CSSNamespace::escape)
|
|||
if (!vm.argument_count())
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::BadArgCountAtLeastOne, "CSS.escape");
|
||||
|
||||
auto identifier = TRY(vm.argument(0).to_string(global_object));
|
||||
auto identifier = TRY(vm.argument(0).to_string(vm));
|
||||
return JS::js_string(vm, Web::CSS::serialize_an_identifier(identifier));
|
||||
}
|
||||
|
||||
|
@ -44,13 +44,13 @@ JS_DEFINE_NATIVE_FUNCTION(CSSNamespace::supports)
|
|||
|
||||
if (vm.argument_count() >= 2) {
|
||||
// When the supports(property, value) method is invoked with two arguments property and value:
|
||||
auto property_name = TRY(vm.argument(0).to_string(global_object));
|
||||
auto property_name = TRY(vm.argument(0).to_string(vm));
|
||||
|
||||
// If property is an ASCII case-insensitive match for any defined CSS property that the UA supports,
|
||||
// and value successfully parses according to that property’s grammar, return true.
|
||||
auto property = CSS::property_id_from_string(property_name);
|
||||
if (property != CSS::PropertyID::Invalid) {
|
||||
auto value_string = TRY(vm.argument(1).to_string(global_object));
|
||||
auto value_string = TRY(vm.argument(1).to_string(vm));
|
||||
if (parse_css_value({}, value_string, property))
|
||||
return JS::Value(true);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ JS_DEFINE_NATIVE_FUNCTION(CSSNamespace::supports)
|
|||
return JS::Value(false);
|
||||
} else {
|
||||
// When the supports(conditionText) method is invoked with a single conditionText argument:
|
||||
auto supports_text = TRY(vm.argument(0).to_string(global_object));
|
||||
auto supports_text = TRY(vm.argument(0).to_string(vm));
|
||||
|
||||
// If conditionText, parsed and evaluated as a <supports-condition>, would return true, return true.
|
||||
if (auto supports = parse_css_supports({}, supports_text); supports && supports->matches())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue