Truly independent web browser
LibWeb: Remove unused CSS Typed OM entry points
Andreas Kling19c608b3d886
diff --git a/Libraries/LibWeb/Bindings/Rust/src/css/exports.rs b/Libraries/LibWeb/Bindings/Rust/src/css/exports.rsindex cce09761f30..a66c965bee9 100644--- a/Libraries/LibWeb/Bindings/Rust/src/css/exports.rs+++ b/Libraries/LibWeb/Bindings/Rust/src/css/exports.rs@@ -52,7 +52,7 @@ use super::css_rule_list::CSSRuleList;use super::css_scope_rule::CSSScopeRule;use super::css_style_rule::CSSStyleRule;use super::css_style_sheet::CSSStyleSheet;-use super::css_style_value::{AnyCSSStyleValue, CSSStyleValue, PerformTypeCheck};+use super::css_style_value::{AnyCSSStyleValue, CSSStyleValue};use super::css_supports_rule::CSSSupportsRule;use super::css_transform_value::CSSTransformValue;use super::css_unit_value::CSSUnitValue;@@ -68,7 +68,6 @@ use super::style_sheet_list::StyleSheetList;use super::transition_event::{TransitionEvent, TransitionEventInit};use super::typed_om;use super::visual_viewport::VisualViewport;-use crate::bindings::Exception;use crate::bindings::conversions::CppInterface;use crate::bindings::cpp_cell::CppCell;use crate::bindings::interface::{Ref, allocate, cell_from_abi, cell_if_abi, cell_into_abi, realm_arguments};@@ -189,15 +188,6 @@ unsafe fn numeric_value_from_abi(cell: *mut c_void) -> AnyCSSNumericValue {.expect("C++ passes the cell of a CSSNumericValue")}-/// Hands the message of a type error to C++, which throws it, as the steps that C++ calls throw nothing else.-fn type_error_into_abi(exception: Exception, error: *mut usize) {- let Exception::TypeError(message) = exception else {- unreachable!("the steps of the CSS Typed OM that C++ calls only throw TypeErrors");- };- // SAFETY: The caller of the export passes a place for the string.- unsafe { *error = message.into_raw() };-}-/// A new CSSStyleValue, given a raw string and a style value that C++ hands over.////// # Safety@@ -250,40 +240,6 @@ pub unsafe extern "C" fn web_css_style_value_reify(typed_om::reify(vm, &value, &associated_property).cell_into_abi()}-/// The first value of parsing a CSSStyleValue, or null with the message of the TypeError in `error`.-///-/// # Safety-///-/// `vm` must be the live VM, `property` and `css_text` raw strings that C++ hands over, and `error` a place for a raw-/// string.-#[unsafe(no_mangle)]-pub unsafe extern "C" fn web_css_style_value_parse(- vm: *mut c_void,- property: usize,- css_text: usize,- error: *mut usize,-) -> *mut c_void {- // SAFETY: The caller passes the live VM.- let vm = unsafe { vm_from_abi(vm) };- // SAFETY: The caller hands over the strings.- let (property, css_text) = unsafe {- (- Utf16String::from_raw_owned(property),- Utf16String::from_raw_owned(css_text),- )- };- match typed_om::parse_values(vm, property, css_text) {- Ok(values) => values- .get(0)- .expect("parsing results in at least one value")- .cell_into_abi(),- Err(exception) => {- type_error_into_abi(exception, error);- core::ptr::null_mut()- }- }-}-/// Whether the value has an associated property, which goes to `associated_property` as a raw string.////// # Safety@@ -304,41 +260,6 @@ pub unsafe extern "C" fn web_css_style_value_associated_property(true}-/// The internal representation as a strong reference, or null with the message of the TypeError in `error`.-///-/// # Safety-///-/// `vm` must be the live VM, `value` the live cell of a CSSStyleValue, `property_name` a raw string that C++ hands over,-/// and `error` a place for a raw string.-#[unsafe(no_mangle)]-pub unsafe extern "C" fn web_css_style_value_create_an_internal_representation(- vm: *mut c_void,- value: *mut c_void,- property_id: u16,- property_name: usize,- perform_type_check: bool,- error: *mut usize,-) -> *const c_void {- // SAFETY: The caller passes the live VM.- let vm = unsafe { vm_from_abi(vm) };- // SAFETY: The caller passes a live cell.- let value = unsafe { style_value_from_abi(value) };- // SAFETY: The caller hands over the string.- let property_name = unsafe { Utf16String::from_raw_owned(property_name) };- let perform_type_check = if perform_type_check {- PerformTypeCheck::Yes- } else {- PerformTypeCheck::No- };- match value.create_an_internal_representation(vm, property_id, &property_name, perform_type_check) {- Ok(representation) => representation.into_raw(),- Err(exception) => {- type_error_into_abi(exception, error);- core::ptr::null()- }- }-}-/// What C++ distinguishes CSSStyleValues by, whose order is that of `enum class StyleValueKind` in/// Libraries/LibWeb/CSS/TypedOM.cpp.#[repr(u8)]diff --git a/Libraries/LibWeb/CSS/CSSStyleValue.h b/Libraries/LibWeb/CSS/CSSStyleValue.hindex abf58183aa9..3f8be1ea87a 100644--- a/Libraries/LibWeb/CSS/CSSStyleValue.h+++ b/Libraries/LibWeb/CSS/CSSStyleValue.h@@ -16,7 +16,6 @@#include <LibWeb/CSS/SerializationMode.h>#include <LibWeb/Export.h>#include <LibWeb/Forward.h>-#include <LibWeb/WebIDL/ExceptionOr.h>namespace Web::CSS {@@ -27,24 +26,13 @@ class WEB_API CSSStyleValue : public Bindings::RustInterfaceCell {WEB_RUST_INTERFACE(CSSStyleValue, css_style_value)public:- enum class PerformTypeCheck : u8 {- No,- Yes,- };-static GC::Ref<CSSStyleValue> create(Utf16FlyString associated_property, StyleValue const&, SerializationMode = SerializationMode::Normal);// https://drafts.css-houdini.org/css-typed-om-1/#reify-stylevaluestatic GC::Ref<CSSStyleValue> reify(StyleValue const&, Utf16FlyString const& associated_property);- // https://drafts.css-houdini.org/css-typed-om-1/#parse-a-cssstylevalue, with parseMultiple set to false.- static WebIDL::ExceptionOr<GC::Ref<CSSStyleValue>> parse_a_css_style_value(Utf16FlyString const& property, Utf16View css_text);-Optional<Utf16FlyString> associated_property() const;- // https://drafts.css-houdini.org/css-typed-om-1/#create-an-internal-representation- WebIDL::ExceptionOr<NonnullRefPtr<StyleValue const>> create_an_internal_representation(PropertyNameAndID const&, PerformTypeCheck) const;-bool is_unparsed_value() const;template<typename T>diff --git a/Libraries/LibWeb/CSS/TypedOM.cpp b/Libraries/LibWeb/CSS/TypedOM.cppindex 5741a609711..81a4213e955 100644--- a/Libraries/LibWeb/CSS/TypedOM.cpp+++ b/Libraries/LibWeb/CSS/TypedOM.cpp@@ -9,7 +9,6 @@#include <LibWeb/CSS/CSSKeywordValue.h>#include <LibWeb/CSS/CSSNumericValue.h>#include <LibWeb/CSS/CSSUnitValue.h>-#include <LibWeb/CSS/PropertyNameAndID.h>// What LibWeb's C++ code asks of the Rust implementation of the CSS Typed OM (Libraries/LibWeb/Bindings/Rust/src/css).@@ -24,9 +23,7 @@ extern "C" {// Defined in Bindings/Rust/src/css/exports.rs.void* web_css_style_value_create(JSVM*, FlatPtr associated_property, StyleValueData const*, u8 serialization_mode);void* web_css_style_value_reify(JSVM*, StyleValueData const*, FlatPtr associated_property);-void* web_css_style_value_parse(JSVM*, FlatPtr property, FlatPtr css_text, FlatPtr* error);bool web_css_style_value_associated_property(void* value, FlatPtr* associated_property);-StyleValueData const* web_css_style_value_create_an_internal_representation(JSVM*, void* value, u16 property_id, FlatPtr property_name, bool perform_type_check, FlatPtr* error);u8 web_css_style_value_kind(void* value);void* web_css_numeric_value_create_sum(JSVM*, void* first, void* second);FfiNumericType web_css_numeric_value_type(void* value);@@ -68,15 +65,6 @@ GC::Ref<CSSStyleValue> CSSStyleValue::reify(StyleValue const& value, Utf16FlyStrreturn GC::Ref { *static_cast<CSSStyleValue*>(reified_value) };}-WebIDL::ExceptionOr<GC::Ref<CSSStyleValue>> CSSStyleValue::parse_a_css_style_value(Utf16FlyString const& property, Utf16View css_text)-{- FlatPtr error = 0;- auto* value = web_css_style_value_parse(vm_abi(), property.to_utf16_string().into_raw(), Utf16String::from_utf16(css_text).into_raw(), &error);- if (!value)- return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, Utf16String::adopt_raw(error) };- return GC::Ref { *static_cast<CSSStyleValue*>(value) };-}-Optional<Utf16FlyString> CSSStyleValue::associated_property() const{FlatPtr associated_property = 0;@@ -85,15 +73,6 @@ Optional<Utf16FlyString> CSSStyleValue::associated_property() constreturn Utf16FlyString { Utf16String::adopt_raw(associated_property) };}-WebIDL::ExceptionOr<NonnullRefPtr<StyleValue const>> CSSStyleValue::create_an_internal_representation(PropertyNameAndID const& property, PerformTypeCheck perform_type_check) const-{- FlatPtr error = 0;- auto const* value = web_css_style_value_create_an_internal_representation(vm_abi(), const_cast<CSSStyleValue*>(this), to_underlying(property.id()), property.name().to_utf16_string().into_raw(), perform_type_check == PerformTypeCheck::Yes, &error);- if (!value)- return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, Utf16String::adopt_raw(error) };- return NonnullRefPtr<StyleValue const> { *StyleValue::adopt_rust_style_value_data(value) };-}-bool CSSStyleValue::is_numeric_value() const{auto kind = kind_of(*this);