1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +00:00

LibWeb: Move DOMException from DOM/ to WebIDL/

This commit is contained in:
Linus Groh 2022-09-25 17:28:46 +01:00
parent ad04d7ac9b
commit bbaa05fcf9
49 changed files with 206 additions and 203 deletions

View file

@ -53,14 +53,14 @@ WebIDL::ExceptionOr<void> CanvasGradient::add_color_stop(double offset, String c
{
// 1. If the offset is less than 0 or greater than 1, then throw an "IndexSizeError" DOMException.
if (offset < 0 || offset > 1)
return DOM::IndexSizeError::create(global_object(), "CanvasGradient color stop offset out of bounds");
return WebIDL::IndexSizeError::create(global_object(), "CanvasGradient color stop offset out of bounds");
// 2. Let parsed color be the result of parsing color.
auto parsed_color = Color::from_string(color);
// 3. If parsed color is failure, throw a "SyntaxError" DOMException.
if (!parsed_color.has_value())
return DOM::SyntaxError::create(global_object(), "Could not parse color for CanvasGradient");
return WebIDL::SyntaxError::create(global_object(), "Could not parse color for CanvasGradient");
// 4. Place a new stop on the gradient, at offset offset relative to the whole gradient, and with the color parsed color.
m_color_stops.append(ColorStop { offset, parsed_color.value() });