LibWeb+LibGfx: Apply editorial punctuation/whitespace/markup fixes

Corresponds to d426109ea1
and fd08f81d06
This commit is contained in:
Sam Atkins 2025-06-24 11:18:14 +01:00 committed by Shannon Booth
commit 423cdd447d
Notes: github-actions[bot] 2025-06-24 15:13:34 +00:00
35 changed files with 108 additions and 103 deletions

View file

@ -324,9 +324,9 @@ static auto create_radial_gradient_between_two_circles(Gfx::FloatPoint start_cen
// Spec steps: Useless for writing an actual implementation (give it a go :P):
//
// 2. Let x(ω) = (x1-x0)ω + x0
// Let y(ω) = (y1-y0)ω + y0
// Let r(ω) = (r1-r0)ω + r0
// 2. Let x(ω) = (x1-x0)ω + x0.
// Let y(ω) = (y1-y0)ω + y0.
// Let r(ω) = (r1-r0)ω + r0.
// Let the color at ω be the color at that position on the gradient
// (with the colors coming from the interpolation and extrapolation described above).
//

View file

@ -713,7 +713,7 @@ WebIDL::ExceptionOr<Document*> Document::open(Optional<String> const&, Optional<
}));
}
// 1. If document is an XML document, then throw an "InvalidStateError" DOMException exception.
// 1. If document is an XML document, then throw an "InvalidStateError" DOMException.
if (m_type == Type::XML)
return WebIDL::InvalidStateError::create(realm(), "open() called on XML document."_string);
@ -793,7 +793,7 @@ WebIDL::ExceptionOr<Document*> Document::open(Optional<String> const&, Optional<
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-document-open-window
WebIDL::ExceptionOr<GC::Ptr<HTML::WindowProxy>> Document::open(StringView url, StringView name, StringView features)
{
// 1. If this is not fully active, then throw an "InvalidAccessError" DOMException exception.
// 1. If this is not fully active, then throw an "InvalidAccessError" DOMException.
if (!is_fully_active())
return WebIDL::InvalidAccessError::create(realm(), "Cannot perform open on a document that isn't fully active."_string);
@ -4428,7 +4428,7 @@ GC::Ref<DOM::Document> Document::appropriate_template_contents_owner_document()
if (document_type() == Type::HTML)
new_document->set_document_type(Type::HTML);
// 3. Let doc's associated inert template document be new doc.
// 3. Set doc's associated inert template document to new doc.
m_associated_inert_template_document = new_document;
}
// 2. Set doc to doc's associated inert template document.
@ -4879,7 +4879,7 @@ void Document::shared_declarative_refresh_steps(StringView input, GC::Ptr<HTML::
// 4. Let time be 0.
u32 time = 0;
// 5. Collect a sequence of code points that are ASCII digits from input given position, and let the result be timeString.
// 5. Collect a sequence of code points that are ASCII digits from input given position, and let timeString be the result.
auto time_string = lexer.consume_while(is_ascii_digit);
// 6. If timeString is the empty string, then:

View file

@ -2056,6 +2056,7 @@ WebIDL::ExceptionOr<void> Element::insert_adjacent_html(String const& position,
|| (context->document().document_type() == Document::Type::HTML
&& static_cast<Element const&>(*context).local_name() == "html"sv
&& static_cast<Element const&>(*context).namespace_uri() == Namespace::HTML)) {
// then set context to the result of creating an element given this's node document, "body", and the HTML namespace.
context = TRY(create_element(document(), HTML::TagNames::body, Namespace::HTML));
}

View file

@ -149,13 +149,13 @@ AutocompleteElement::AttributeDetails AutocompleteElement::parse_autocomplete_at
AttributeDetails attr_details {};
auto step_default = [&] {
// 32. Default: Let the element's IDL-exposed autofill value be the empty string, and its autofill hint set and autofill scope be empty.
// 32. Default: Set the element's IDL-exposed autofill value to the empty string, and its autofill hint set and autofill scope to empty.
attr_details.value = {};
attr_details.hint_set = {};
attr_details.scope = {};
// 33. If the element's autocomplete attribute is wearing the autofill anchor mantle,
// then let the element's autofill field name be the empty string and return.
// then set the element's autofill field name to the empty string and return.
if (get_autofill_mantle() == AutofillMantle::Anchor) {
attr_details.field_name = {};
return attr_details;
@ -164,11 +164,11 @@ AutocompleteElement::AttributeDetails AutocompleteElement::parse_autocomplete_at
// 34. Let form be the element's form owner, if any, or null otherwise.
auto const* form = as<FormAssociatedElement const>(autocomplete_element_to_html_element()).form();
// 35. If form is not null and form's autocomplete attribute is in the off state, then let the element's autofill field name be "off".
// 35. If form is not null and form's autocomplete attribute is in the off state, then set the element's autofill field name to "off".
if (form && form->attribute(AttributeNames::autocomplete) == idl_enum_to_string(Bindings::Autocomplete::Off)) {
attr_details.field_name = "off"_string;
}
// Otherwise, let the element's autofill field name be "on".
// Otherwise, set the element's autofill field name to "on".
else {
attr_details.field_name = "on"_string;
}
@ -210,8 +210,8 @@ AutocompleteElement::AttributeDetails AutocompleteElement::parse_autocomplete_at
&& get_autofill_mantle() == AutofillMantle::Anchor)
return step_default();
// 10. If category is Off, let the element's autofill field name be the string "off", let its autofill hint set be empty,
// and let its IDL-exposed autofill value be the string "off". Then, return.
// 10. If category is Off, set the element's autofill field name to the string "off", set its autofill hint set to empty,
// and set its IDL-exposed autofill value to the string "off". Then, return.
if (category == Category::Off) {
attr_details.field_name = "off"_string;
attr_details.hint_set = {};
@ -219,8 +219,8 @@ AutocompleteElement::AttributeDetails AutocompleteElement::parse_autocomplete_at
return attr_details;
}
// 11. If category is Automatic, let the element's autofill field name be the string "on", let its autofill hint set be empty,
// and let its IDL-exposed autofill value be the string "on". Then, return.
// 11. If category is Automatic, set the element's autofill field name to the string "on", set its autofill hint set to empty,
// and set its IDL-exposed autofill value to the string "on". Then, return.
if (category == Category::Automatic) {
attr_details.field_name = "on"_string;
attr_details.hint_set = {};
@ -242,19 +242,19 @@ AutocompleteElement::AttributeDetails AutocompleteElement::parse_autocomplete_at
auto idl_value = field.to_ascii_lowercase();
auto step_done = [&] {
// 26. Done: Let the element's autofill hint set be hint tokens.
// 26. Done: Set the element's autofill hint set to hint tokens.
attr_details.hint_set = hint_tokens.values();
// 27. Let the element's non-autofill credential type be credential type.
// 27. Set the element's non-autofill credential type to credential type.
attr_details.credential_type = credential_type;
// 28. Let the element's autofill scope be scope tokens.
// 28. Set the element's autofill scope to scope tokens.
attr_details.scope = scope_tokens;
// 29. Let the element's autofill field name be field.
// 29. Set the element's autofill field name to field.
attr_details.field_name = field;
// 30. Let the element's IDL-exposed autofill value be IDL value.
// 30. Set the element's IDL-exposed autofill value to IDL value.
attr_details.value = idl_value;
// 31. Return.

View file

@ -63,7 +63,7 @@ void CanvasPath::quadratic_curve_to(float cpx, float cpy, float x, float y)
if (!isfinite(cpx) || !isfinite(cpy) || !isfinite(x) || !isfinite(y))
return;
// 2. Ensure there is a subpath for (cpx, cpy)
// 2. Ensure there is a subpath for (cpx, cpy).
ensure_subpath(cpx, cpy);
// 3. Connect the last point in the subpath to the given point (x, y) using a quadratic Bézier curve with control point (cpx, cpy).
@ -78,7 +78,7 @@ void CanvasPath::bezier_curve_to(double cp1x, double cp1y, double cp2x, double c
if (!isfinite(cp1x) || !isfinite(cp1y) || !isfinite(cp2x) || !isfinite(cp2y) || !isfinite(x) || !isfinite(y))
return;
// 2. Ensure there is a subpath for (cp1x, cp1y)
// 2. Ensure there is a subpath for (cp1x, cp1y).
ensure_subpath(cp1x, cp1y);
// 3. Connect the last point in the subpath to the given point (x, y) using a cubic Bézier curve with control points (cp1x, cp1y) and (cp2x, cp2y).

View file

@ -86,7 +86,7 @@ public:
if (segments.size() % 2 == 1)
segments.extend(segments);
// 3. Let the object's dash list be segments.
// 3. Set the object's dash list to segments.
my_drawing_state().dash_list = move(segments);
}

View file

@ -598,7 +598,7 @@ GC::Ref<TextMetrics> CanvasRenderingContext2D::measure_text(StringView text)
{
// The measureText(text) method steps are to run the text preparation
// algorithm, passing it text and the object implementing the CanvasText
// interface, and then using the returned inline box must return a new
// interface, and then using the returned inline box return a new
// TextMetrics object with members behaving as described in the following
// list:
auto prepared_text = prepare_text(text);

View file

@ -68,7 +68,7 @@ bool is_cross_origin_accessible_window_property_name(JS::PropertyKey const& prop
// 7.2.3.2 CrossOriginPropertyFallback ( P ), https://html.spec.whatwg.org/multipage/browsers.html#crossoriginpropertyfallback-(-p-)
JS::ThrowCompletionOr<JS::PropertyDescriptor> cross_origin_property_fallback(JS::VM& vm, JS::PropertyKey const& property_key)
{
// 1. If P is "then", @@toStringTag, @@hasInstance, or @@isConcatSpreadable, then return PropertyDescriptor{ [[Value]]: undefined, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
// 1. If P is "then", @@toStringTag, @@hasInstance, or @@isConcatSpreadable, then return PropertyDescriptor { [[Value]]: undefined, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
auto property_key_is_then = property_key.is_string() && property_key.as_string() == vm.names.then.as_string();
auto property_key_is_allowed_symbol = property_key.is_symbol()
&& (property_key.as_symbol() == vm.well_known_symbol_to_string_tag()
@ -142,7 +142,7 @@ Optional<JS::PropertyDescriptor> cross_origin_get_own_property_helper(Variant<HT
0);
}
// 3. Set crossOriginDesc to PropertyDescriptor{ [[Value]]: value, [[Enumerable]]: false, [[Writable]]: false, [[Configurable]]: true }.
// 3. Set crossOriginDesc to PropertyDescriptor { [[Value]]: value, [[Enumerable]]: false, [[Writable]]: false, [[Configurable]]: true }.
cross_origin_descriptor = JS::PropertyDescriptor { .value = value, .writable = false, .enumerable = false, .configurable = true };
}
// 5. Otherwise:
@ -171,7 +171,7 @@ Optional<JS::PropertyDescriptor> cross_origin_get_own_property_helper(Variant<HT
0);
}
// 5. Set crossOriginDesc to PropertyDescriptor{ [[Get]]: crossOriginGet, [[Set]]: crossOriginSet, [[Enumerable]]: false, [[Configurable]]: true }.
// 5. Set crossOriginDesc to PropertyDescriptor { [[Get]]: crossOriginGet, [[Set]]: crossOriginSet, [[Enumerable]]: false, [[Configurable]]: true }.
cross_origin_descriptor = JS::PropertyDescriptor { .get = cross_origin_get, .set = cross_origin_set, .enumerable = false, .configurable = true };
}

View file

@ -738,7 +738,7 @@ void FormAssociatedTextControlElement::set_the_selection_range(Optional<WebIDL::
auto new_selection_start = AK::min(start.value(), relevant_value_length);
auto new_selection_end = AK::min(end.value(), relevant_value_length);
// If end is less than or equal to start then the start of the selection and the end of the
// If end is less than or equal to start, then the start of the selection and the end of the
// selection must both be placed immediately before the character with offset end. In UAs
// where there is no concept of an empty selection, this must set the cursor to be just
// before the character with offset end.

View file

@ -166,7 +166,7 @@ Variant<GC::Ref<DOM::HTMLCollection>, GC::Ref<DOM::Element>, Empty> HTMLAllColle
// 2. Let subCollection be an HTMLCollection object rooted at the same Document as collection, whose filter matches only elements that are either:
auto sub_collection = DOM::HTMLCollection::create(m_root, DOM::HTMLCollection::Scope::Descendants, [name](DOM::Element const& element) {
// * "all"-named elements with a name attribute equal to name, or,
// * "all"-named elements with a name attribute equal to name, or
if (is_all_named_element(element) && element.name() == name)
return true;

View file

@ -237,7 +237,7 @@ void HTMLButtonElement::activation_behavior(DOM::Event const& event)
MUST(target->show_popover(ThrowExceptions::No, this));
}
// 2. Otheriwse, if the result of running check popover validity given target, true, false, and null is true,
// 2. Otherwise, if the result of running check popover validity given target, true, false, and null is true,
// then run the hide popover algorithm given target, true, true, false and element.
else if (MUST(target->check_popover_validity(ExpectedToBeShowing::Yes, ThrowExceptions::No, nullptr, IgnoreDomState::No))) {
MUST(target->hide_popover(FocusPreviousElement::Yes, FireEvents::Yes, ThrowExceptions::No, IgnoreDomState::No, this));
@ -253,7 +253,8 @@ void HTMLButtonElement::activation_behavior(DOM::Event const& event)
}
}
// 12. Otherwise, if this standard defines invoker command steps for target's local name, then run the corresponding invoker command steps given target, element and command.
// 12. Otherwise, if this standard defines invoker command steps for target's local name,
// then run the corresponding invoker command steps given target, element, and command.
else {
target->invoker_command_steps(*this, command);
}
@ -302,7 +303,7 @@ String HTMLButtonElement::command() const
// NOTE: Steps are re-ordered a bit.
// 4. Return the keword corresponding to the value of command.return
// 4. Return the keyword corresponding to the value of command.return
if (command.has_value()) {
auto command_value = command.value();
for (auto const& value : valid_values) {

View file

@ -331,7 +331,7 @@ String HTMLCanvasElement::to_data_url(StringView type, JS::Value quality)
// FIXME: 1. If this canvas element's bitmap's origin-clean flag is set to false, then throw a "SecurityError" DOMException.
// 2. If this canvas element's bitmap has no pixels (i.e. either its horizontal dimension or its vertical dimension is zero)
// 2. If this canvas element's bitmap has no pixels (i.e. either its horizontal dimension or its vertical dimension is zero),
// then return the string "data:,". (This is the shortest data: URL; it represents the empty string in a text/plain resource.)
if (!surface)
return "data:,"_string;
@ -342,7 +342,7 @@ String HTMLCanvasElement::to_data_url(StringView type, JS::Value quality)
surface->read_into_bitmap(*bitmap);
auto file = serialize_bitmap(bitmap, type, move(quality));
// 4. If file is null then return "data:,".
// 4. If file is null, then return "data:,".
if (file.is_error()) {
dbgln("HTMLCanvasElement: Failed to encode canvas bitmap to {}: {}", type, file.error());
return "data:,"_string;

View file

@ -240,7 +240,7 @@ WebIDL::ExceptionOr<void> HTMLDialogElement::show_a_modal_dialog(HTMLDialogEleme
// 14. Add subject to subject's node document's open dialogs list.
subject.document().open_dialogs_list().append(subject);
// FIXME: 15. Let subject's node document be blocked by the modal dialog subject.
// FIXME: 15. Set subject's node document to be blocked by the modal dialog subject.
// 16. If subject's node document's top layer does not already contain subject, then add an element to the top layer given subject.
if (!subject.document().top_layer_elements().contains(subject))

View file

@ -322,7 +322,7 @@ static Vector<Variant<String, RequiredLineBreakCount>> rendered_text_collection_
// if the computed value of the 'display' property is not 'none':
// FIXME: - select elements have an associated non-replaced inline CSS box whose child boxes include only those of optgroup and option element child nodes;
// FIXME: - optgroup elements have an associated non-replaced block-level CSS box whose child boxes include only those of option element child nodes; and
// FIXME: - option element have an associated non-replaced block-level CSS box whose child boxes are as normal for non-replaced block-level CSS boxes.
// FIXME: - option elements have an associated non-replaced block-level CSS box whose child boxes are as normal for non-replaced block-level CSS boxes.
auto* layout_node = node.layout_node();
if (!layout_node)
return items;
@ -1268,7 +1268,7 @@ WebIDL::ExceptionOr<void> HTMLElement::show_popover(ThrowExceptions throw_except
m_popover_showing_or_hiding = false;
};
// 9. If the result of firing an event named beforetoggle, using ToggleEvent, with the cancelable attribute initialized to true, the oldState attribute initialized to "closed", the newState attribute initialized to "open" at element, and the source attribute initialized to invoker is false, then run cleanupShowingFlag and return.
// 9. If the result of firing an event named beforetoggle, using ToggleEvent, with the cancelable attribute initialized to true, the oldState attribute initialized to "closed", the newState attribute initialized to "open" at element, and the source attribute initialized to invoker at element is false, then run cleanupShowingFlag and return.
ToggleEventInit event_init {};
event_init.old_state = "closed"_string;
event_init.new_state = "open"_string;
@ -1363,7 +1363,7 @@ WebIDL::ExceptionOr<void> HTMLElement::show_popover(ThrowExceptions throw_except
// 2. If originalType is not equal to the value of element's popover attribute, then:
if (original_type != popover()) {
// 1. If throwExceptions is true, then throw a "InvalidStateError" DOMException.
// 1. If throwExceptions is true, then throw an "InvalidStateError" DOMException.
if (throw_exceptions == ThrowExceptions::Yes)
return WebIDL::InvalidStateError::create(realm(), "Element is not in a valid state to show a popover"_string);

View file

@ -49,7 +49,7 @@ Optional<CSS::Keyword> HTMLFontElement::parse_legacy_font_size(StringView string
lexer.consume();
}
// 6. Collect a sequence of code points that are ASCII digits from input given position, and let the resulting sequence be digits.
// 6. Collect a sequence of code points that are ASCII digits from input given position, and let digits be the resulting sequence.
size_t start_index = lexer.tell();
lexer.consume_while(is_ascii_digit);
size_t end_index = lexer.tell();
@ -77,7 +77,7 @@ Optional<CSS::Keyword> HTMLFontElement::parse_legacy_font_size(StringView string
if (value < 1)
value = 1;
// 12. Set 'font-size' to the keyword corresponding to the value of value according to the following table:
// 12. Set the 'font-size' property to the keyword corresponding to the value of value according to the following table:
switch (value) {
case 1:
return CSS::Keyword::XSmall;

View file

@ -616,7 +616,7 @@ bool HTMLFormElement::interactively_validate_constraints()
// For elements that are form-associated custom elements, user agents should use their validation anchor instead, for the purposes of these actions.
// - User agents may report more than one constraint violation.
// - User agents may coalesce related constraint violation reports if appropriate (e.g. if multiple radio buttons in a group are marked as required, only one error need be reported).
// - If one of the controls is not being rendered (e.g. it has the hidden attribute set) then user agents may report a script error.
// - If one of the controls is not being rendered (e.g. it has the hidden attribute set), then user agents may report a script error.
// FIXME: Does this align with other browsers?
auto first_invalid_control = unhandled_invalid_controls.first_matching([](auto control) {
return control->check_visibility({});

View file

@ -530,7 +530,7 @@ void HTMLImageElement::update_the_image_data_impl(bool restart_animations, bool
// 2. FIXME: If the user agent cannot support images, or its support for images has been disabled,
// then abort the image request for the current request and the pending request,
// set current request's state to unavailable, set pending request to null, and return.
// set the current request's state to unavailable, set the pending request to null, and return.
// 3. Let previousURL be the current request's current URL.
auto previous_url = m_current_request->current_url();
@ -578,18 +578,18 @@ void HTMLImageElement::update_the_image_data_impl(bool restart_animations, bool
abort_the_image_request(realm(), m_current_request);
abort_the_image_request(realm(), m_pending_request);
// 3. Set pending request to null.
// 3. Set the pending request to null.
m_pending_request = nullptr;
// 4. Let current request be a new image request whose image data is that of the entry and whose state is completely available.
// 4. Set the current request to a new image request whose image data is that of the entry and whose state is completely available.
m_current_request = ImageRequest::create(realm(), document().page());
m_current_request->set_image_data(entry->image_data);
m_current_request->set_state(ImageRequest::State::CompletelyAvailable);
// 5. Prepare current request for presentation given the img element.
// 5. Prepare the current request for presentation given the img element.
m_current_request->prepare_for_presentation(*this);
// 6. Set current request's current pixel density to selected pixel density.
// 6. Set the current request's current pixel density to selected pixel density.
// FIXME: Spec bug! `selected_pixel_density` can be undefined here, per the spec.
// That's why we value_or(1.0f) it.
m_current_request->set_current_pixel_density(selected_pixel_density.value_or(1.0f));
@ -600,7 +600,7 @@ void HTMLImageElement::update_the_image_data_impl(bool restart_animations, bool
if (restart_animations)
restart_the_animation();
// 2. Set current request's current URL to urlString.
// 2. Set the current request's current URL to urlString.
m_current_request->set_current_url(realm(), url_string);
// 3. If maybe omit events is not set or previousURL is not equal to urlString, then fire an event named load at the img element.
@ -631,7 +631,7 @@ after_step_7:
if (!selected_source.has_value()) {
// 1. Set the current request's state to broken,
// abort the image request for the current request and the pending request,
// and set pending request to null.
// and set the pending request to null.
m_current_request->set_state(ImageRequest::State::Broken);
abort_the_image_request(realm(), m_current_request);
abort_the_image_request(realm(), m_pending_request);
@ -667,7 +667,7 @@ after_step_7:
// 2. Set the current request's state to broken.
m_current_request->set_state(ImageRequest::State::Broken);
// 3. Set pending request to null.
// 3. Set the pending request to null.
m_pending_request = nullptr;
// 4. Queue an element task on the DOM manipulation task source given the img element and the following steps:
@ -689,7 +689,7 @@ after_step_7:
if (m_pending_request && url_string == m_pending_request->current_url())
return;
// 14. If urlString is the same as the current request's current URL and current request's state is partially available,
// 14. If urlString is the same as the current request's current URL and the current request's state is partially available,
// then abort the image request for the pending request,
// queue an element task on the DOM manipulation task source given the img element
// to restart the animation if restart animation is set, and return.
@ -713,7 +713,7 @@ after_step_7:
auto image_request = ImageRequest::create(realm(), document().page());
image_request->set_current_url(realm(), url_string);
// 17. If current request's state is unavailable or broken, then set the current request to image request.
// 17. If the current request's state is unavailable or broken, then set the current request to image request.
// Otherwise, set the pending request to image request.
if (m_current_request->state() == ImageRequest::State::Unavailable || m_current_request->state() == ImageRequest::State::Broken)
m_current_request = image_request;
@ -859,8 +859,8 @@ void HTMLImageElement::react_to_changes_in_the_environment()
// 2. ⌛ If the img element does not use srcset or picture,
// its node document is not fully active,
// FIXME: has image data whose resource type is multipart/x-mixed-replace,
// or the pending request is not null,
// FIXME: it has image data whose resource type is multipart/x-mixed-replace,
// or its pending request is not null,
// then return.
if (!uses_srcset_or_picture() || !document().is_fully_active() || m_pending_request)
return;
@ -910,7 +910,7 @@ void HTMLImageElement::react_to_changes_in_the_environment()
auto image_request = ImageRequest::create(realm(), document().page());
image_request->set_current_url(realm(), url_string);
// 12. ⌛ Let the element's pending request be image request.
// 12. ⌛ Set the element's pending request to image request.
m_pending_request = image_request;
// FIXME: 13. End the synchronous section, continuing the remaining steps in parallel.
@ -918,13 +918,14 @@ void HTMLImageElement::react_to_changes_in_the_environment()
auto step_15 = [this](String const& selected_source, GC::Ref<ImageRequest> image_request, ListOfAvailableImages::Key const& key, GC::Ref<DecodedImageData> image_data) {
// 15. Queue an element task on the DOM manipulation task source given the img element and the following steps:
queue_an_element_task(HTML::Task::Source::DOMManipulation, [this, selected_source, image_request, key, image_data] {
// 1. FIXME: If the img element has experienced relevant mutations since this algorithm started, then let pending request be null and abort these steps.
// 1. FIXME: If the img element has experienced relevant mutations since this algorithm started, then set the pending request to null and abort these steps.
// AD-HOC: Check if we have a pending request still, otherwise we will crash when upgrading the request. This will happen if the image has experienced mutations,
// but since the pending request may be set by another task soon after it is cleared, this check is probably not sufficient.
if (!m_pending_request)
return;
// 2. Let the img element's last selected source be selected source and the img element's current pixel density be selected pixel density.
// 2. Set the img element's last selected source to selected source and the img element's current pixel density to selected pixel density.
// FIXME: pixel density
m_last_selected_source = selected_source;
// 3. Set the image request's state to completely available.
@ -959,7 +960,7 @@ void HTMLImageElement::react_to_changes_in_the_environment()
// 1. Let request be the result of creating a potential-CORS request given urlString, "image", and corsAttributeState.
auto request = create_potential_CORS_request(vm(), *maybe_url, Fetch::Infrastructure::Request::Destination::Image, m_cors_setting);
// 2. Set request's client to client, initiator to "imageset", and set request's synchronous flag.
// 2. Set request's client to client, set request's initiator to "imageset", and set request's synchronous flag.
request->set_client(&client);
request->set_initiator(Fetch::Infrastructure::Request::Initiator::ImageSet);
@ -982,7 +983,7 @@ void HTMLImageElement::react_to_changes_in_the_environment()
// FIXME: or if the resource type is multipart/x-mixed-replace,
// then let pending request be null and abort these steps.
// then set the pending request to null and abort these steps.
batching_dispatcher().enqueue(GC::create_function(realm().heap(), [step_15, selected_source = move(selected_source), image_request, key] {
// 7. Otherwise, response's unsafe response is image request's image data. It can be either CORS-same-origin
@ -1010,11 +1011,11 @@ void HTMLImageElement::react_to_changes_in_the_environment()
// https://html.spec.whatwg.org/multipage/images.html#upgrade-the-pending-request-to-the-current-request
void HTMLImageElement::upgrade_pending_request_to_current_request()
{
// 1. Let the img element's current request be the pending request.
// 1. Set the img element's current request to the pending request.
VERIFY(m_pending_request);
m_current_request = m_pending_request;
// 2. Let the img element's pending request be null.
// 2. Set the img element's pending request to null.
m_pending_request = nullptr;
}
@ -1144,7 +1145,7 @@ static void update_the_source_set(DOM::Element& element)
default_source = href_value.release_value();
}
// 10. Let el's source set be the result of creating a source set given default source, srcset, sizes, and img.
// 10. Set el's source set to the result of creating a source set given default source, srcset, sizes, and img.
if (is<HTMLImageElement>(element))
static_cast<HTMLImageElement&>(element).set_source_set(SourceSet::create(element, default_source, srcset, sizes, img));
else if (is<HTMLLinkElement>(element))
@ -1161,7 +1162,7 @@ static void update_the_source_set(DOM::Element& element)
if (!child->has_attribute(HTML::AttributeNames::srcset))
continue;
// 4. Parse child's srcset attribute and let the returned source set be source set.
// 4. Parse child's srcset attribute and let source set be the returned source set.
auto source_set = parse_a_srcset_attribute(child->get_attribute_value(HTML::AttributeNames::srcset));
// 5. If source set has zero image sources, continue to the next child.
@ -1197,9 +1198,9 @@ static void update_the_source_set(DOM::Element& element)
// 10. Normalize the source densities of source set.
source_set.normalize_source_densities(element);
// 11. Let el's source set be source set.
if (is<HTMLImageElement>(element))
static_cast<HTMLImageElement&>(element).set_source_set(move(source_set));
// 11. Set el's source set to source set.
if (auto* image_element = as_if<HTMLImageElement>(element))
image_element->set_source_set(move(source_set));
else if (is<HTMLLinkElement>(element))
TODO();

View file

@ -1970,13 +1970,13 @@ void HTMLInputElement::legacy_cancelled_activation_behavior()
set_indeterminate(m_before_legacy_pre_activation_behavior_indeterminate);
}
// 2. If this element 's type attribute is in the Radio Button state, then
// 2. If this element's type attribute is in the Radio Button state, then
// if the element to which a reference was obtained in the
// legacy-pre-activation behavior, if any, is still in what is now this
// element' s radio button group, if it still has one, and if so, setting
// element' s radio button group, if it still has one, and if so, set
// that element 's checkedness to true; or else, if there was no such
// element, or that element is no longer in this element' s radio button
// group, or if this element no longer has a radio button group, setting
// group, or if this element no longer has a radio button group, set
// this element's checkedness to false.
if (type_state() == TypeAttributeState::RadioButton) {
bool did_reselect_previous_element = false;

View file

@ -168,7 +168,7 @@ GC::Ref<TimeRanges> HTMLMediaElement::buffered() const
auto& realm = this->realm();
// FIXME: The buffered attribute must return a new static normalized TimeRanges object that represents the ranges of the
// media resource, if any, that the user agent has buffered, at the time the attribute is evaluated. Users agents
// media resource, if any, that the user agent has buffered, at the time the attribute is evaluated. User agents
// must accurately determine the ranges available, even for media streams where this can only be determined by
// tedious inspection.
return realm.create<TimeRanges>(realm);
@ -336,7 +336,7 @@ bool HTMLMediaElement::ended() const
void HTMLMediaElement::set_duration(double duration)
{
// When the length of the media resource changes to a known value (e.g. from being unknown to known, or from a previously established length to a new
// length) the user agent must queue a media element task given the media element to fire an event named durationchange at the media element. (The event
// length), the user agent must queue a media element task given the media element to fire an event named durationchange at the media element. (The event
// is not fired when the duration is reset as part of loading a new media resource.) If the duration is changed such that the current playback position
// ends up being greater than the time of the end of the media resource, then the user agent must also seek to the time of the end of the media resource.
if (!isnan(duration)) {
@ -997,7 +997,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::fetch_resource(URL::URL const& url_r
: Fetch::Infrastructure::Request::Destination::Video;
// 3. Let request be the result of creating a potential-CORS request given current media resource's URL record, destination, and the current state
// of media element's crossorigin content attribute.
// of the media element's crossorigin content attribute.
auto request = create_potential_CORS_request(vm, url_record, destination, m_crossorigin);
// 4. Set request's client to the media element's node document's relevant settings object.
@ -1016,7 +1016,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::fetch_resource(URL::URL const& url_r
ByteRange byte_range = EntireResource {};
// FIXME: 7. If byteRange is not "entire resource", then:
// 1. If byteRange[1] is "until end" then add a range header to request given byteRange[0].
// 1. If byteRange[1] is "until end", then add a range header to request given byteRange[0].
// 2. Otherwise, add a range header to request given byteRange[0] and byteRange[1].
// 8. Fetch request, with processResponse set to the following steps given response response:
@ -1256,7 +1256,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::process_media_data(Function<void(Str
jumped = true;
}
// 9. Let the media element's default playback start position be zero.
// 9. Set the media element's default playback start position to zero.
m_default_playback_start_position = 0;
// FIXME: 10. Let the initial playback position be zero.
@ -1587,7 +1587,7 @@ void HTMLMediaElement::seek_element(double playback_position, MediaSeekMode seek
// then let it be the position in one of the ranges given in the seekable attribute that is the nearest to the new
// playback position.
// If there are no ranges given in the seekable attribute then set the seeking IDL attribute to false and return.
// If there are no ranges given in the seekable attribute, then set the seeking IDL attribute to false and return.
if (time_ranges->length() == 0) {
set_seeking(false);
return;
@ -1610,7 +1610,7 @@ void HTMLMediaElement::seek_element(double playback_position, MediaSeekMode seek
}
// If two positions both satisfy that constraint (i.e. the new playback position is exactly in the middle between two ranges
// in the seekable attribute) then use the position that is closest to the current playback position.
// in the seekable attribute), then use the position that is closest to the current playback position.
if (other_nearest_point.has_value()) {
auto nearest_point_distance = abs(m_current_playback_position - nearest_point);
auto other_nearest_point_distance = abs(m_current_playback_position - other_nearest_point.value());
@ -1717,7 +1717,7 @@ void HTMLMediaElement::set_paused(bool paused)
void HTMLMediaElement::set_default_playback_rate(double new_value)
{
// When the defaultPlaybackRate or playbackRate attributes change value (either by being set by script or by being changed directly by the user agent, e.g. in response to user
// control) the user agent must queue a media element task given the media element to fire an event named ratechange at the media element.
// control), the user agent must queue a media element task given the media element to fire an event named ratechange at the media element.
if (m_default_playback_rate != new_value) {
queue_a_media_element_task([this] {
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::ratechange));
@ -1739,7 +1739,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::set_playback_rate(double new_value)
return WebIDL::NotSupportedError::create(realm(), "Playback rates other than 1 are not supported."_string);
// When the defaultPlaybackRate or playbackRate attributes change value (either by being set by script or by being changed directly by the user agent, e.g. in response to user
// control) the user agent must queue a media element task given the media element to fire an event named ratechange at the media element.
// control), the user agent must queue a media element task given the media element to fire an event named ratechange at the media element.
if (m_playback_rate != new_value) {
queue_a_media_element_task([this] {
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::ratechange));

View file

@ -121,7 +121,7 @@ void HTMLMetaElement::inserted()
if (!has_attribute(AttributeNames::content))
break;
// 2. If the element's content attribute contains a U+002C COMMA character (,) then return.
// 2. If the element's content attribute contains a U+002C COMMA character (,), then return.
auto content = get_attribute_value(AttributeNames::content);
if (content.contains(","sv))
break;

View file

@ -110,10 +110,10 @@ i32 HTMLTextAreaElement::default_tab_index_value() const
// https://html.spec.whatwg.org/multipage/form-elements.html#the-textarea-element:concept-form-reset-control
void HTMLTextAreaElement::reset_algorithm()
{
// The reset algorithm for textarea elements is to set the user validity to false, dirty value flag back to false,
// The reset algorithm for textarea elements is to set the user validity to false, the dirty value flag back to false,
m_user_validity = false;
m_dirty_value = false;
// and set the raw value of element to its child text content.
// and the raw value to its child text content.
set_raw_value(child_text_content());
if (m_text_node) {

View file

@ -190,7 +190,7 @@ void HTMLTrackElement::start_the_track_processing_model_parallel_steps()
// 7. ⌛ Let URL be the track URL of the track element.
auto url = track_url();
// 8. ⌛ If the track element's parent is a media element then let corsAttributeState be the state of the
// 8. ⌛ If the track element's parent is a media element, then let corsAttributeState be the state of the
// parent media element's crossorigin content attribute. Otherwise, let corsAttributeState be No CORS.
auto cors_attribute_state = CORSSettingAttribute::NoCORS;
if (is<HTMLMediaElement>(parent())) {

View file

@ -1146,7 +1146,8 @@ static WebIDL::ExceptionOr<Navigable::NavigationParamsVariant> create_navigation
[](DocumentState::Client) -> GC::Ptr<PolicyContainer> { return {}; });
auto result_policy_container = determine_navigation_params_policy_container(*response_holder->response()->url(), realm.heap(), history_policy_container, source_snapshot_params.source_policy_container, {}, response_policy_container);
// 24. If navigable's container is an iframe, and response's timing allow passed flag is set, then set container's pending resource-timing start time to null.
// 24. If navigable's container is an iframe, and response's timing allow passed flag is set,
// then set navigable's container's pending resource-timing start time to null.
if (navigable->container() && is<HTML::HTMLIFrameElement>(*navigable->container()) && response_holder->response()->timing_allow_passed())
static_cast<HTML::HTMLIFrameElement&>(*navigable->container()).set_pending_resource_start_time({});

View file

@ -97,7 +97,8 @@ Optional<StringView> extract_character_encoding_from_meta_element(ByteString con
// https://html.spec.whatwg.org/multipage/parsing.html#concept-get-attributes-when-sniffing
GC::Ptr<DOM::Attr> prescan_get_attribute(DOM::Document& document, ByteBuffer const& input, size_t& position)
{
// 1. If the byte at position is one of 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), 0x20 (SP), or 0x2F (/) then advance position to the next byte and redo this step.
// 1. If the byte at position is one of 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), 0x20 (SP), or 0x2F (/),
// then advance position to the next byte and redo this step.
if (!prescan_skip_whitespace_and_slashes(input, position))
return {};
@ -145,7 +146,7 @@ GC::Ptr<DOM::Attr> prescan_get_attribute(DOM::Document& document, ByteBuffer con
}
spaces:
// 6. Spaces: If the byte at position is one of 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), or 0x20 (SP)
// 6. Spaces: If the byte at position is one of 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), or 0x20 (SP),
// then advance position to the next byte, then, repeat this step.
if (!prescan_skip_whitespace_and_slashes(input, position))
return {};
@ -159,7 +160,7 @@ spaces:
++position;
value:
// 9. Value: If the byte at position is one of 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), or 0x20 (SP)
// 9. Value: If the byte at position is one of 0x09 (HT), 0x0A (LF), 0x0C (FF), 0x0D (CR), or 0x20 (SP),
// then advance position to the next byte, then, repeat this step.
if (!prescan_skip_whitespace_and_slashes(input, position))
return {};

View file

@ -2795,7 +2795,7 @@ void HTMLParser::handle_in_body(HTMLToken& token)
// 3. Switch the tokenizer to the RCDATA state.
m_tokenizer.switch_to({}, HTMLTokenizer::State::RCDATA);
// 4. Let the original insertion mode be the current insertion mode.
// 4. Set the original insertion mode to the current insertion mode.
m_original_insertion_mode = m_insertion_mode;
// 5. Set the frameset-ok flag to "not ok".
@ -3690,7 +3690,7 @@ void HTMLParser::handle_in_table(HTMLToken& token)
// Let the pending table character tokens be an empty list of tokens.
m_pending_table_character_tokens.clear();
// Let the original insertion mode be the current insertion mode.
// Set the original insertion mode to the current insertion mode.
m_original_insertion_mode = m_insertion_mode;
// Switch the insertion mode to "in table text" and reprocess the token.

View file

@ -81,7 +81,7 @@ WebIDL::ExceptionOr<void> Path2D::add_path(GC::Ref<Path2D> path, Geometry::DOMMa
if (!isfinite(matrix->m11()) || !isfinite(matrix->m12()) || !isfinite(matrix->m21()) || !isfinite(matrix->m22()) || !isfinite(matrix->m41()) || !isfinite(matrix->m42()))
return {};
// 4. Create a copy of all the subpaths in path. Let this copy be known as c.
// 4. Create a copy of all the subpaths in path. Let c be this copy.
// 5. Transform all the coordinates and lines in c by the transform matrix matrix.
auto copy = path->path().copy_transformed(Gfx::AffineTransform { static_cast<float>(matrix->m11()), static_cast<float>(matrix->m12()), static_cast<float>(matrix->m21()), static_cast<float>(matrix->m22()), static_cast<float>(matrix->m41()), static_cast<float>(matrix->m42()) });

View file

@ -49,7 +49,7 @@ ImageSourceAndPixelDensity SourceSet::select_an_image_source()
}
}
// 2. In an implementation-defined manner, choose one image source from sourceSet. Let this be selectedSource.
// 2. In an implementation-defined manner, choose one image source from sourceSet. Let selectedSource be this choice.
// In our case, select the lowest density greater than 1, otherwise the greatest density available.
// 3. Return selectedSource and its associated pixel density.
@ -108,7 +108,7 @@ splitting_loop:
return candidates;
}
// 6. Collect a sequence of code points that are not ASCII whitespace from input given position, and let that be url.
// 6. Collect a sequence of code points that are not ASCII whitespace from input given position, and let url be that result.
auto url = collect_a_sequence_of_code_points(
[](u32 code_point) { return !Infra::is_ascii_whitespace(code_point); },
input, position);
@ -357,7 +357,7 @@ SourceSet SourceSet::create(DOM::Element const& element, String const& default_s
if (!srcset.is_empty())
source_set = parse_a_srcset_attribute(srcset);
// 3. Let source size be the result of parsing sizes with img.
// 3. Set source set's source size to the result of parsing sizes with img.
source_set.m_source_size = parse_a_sizes_attribute(element, sizes, img);
// 4. If default source is not the empty string and source set does not contain an image source

View file

@ -106,7 +106,7 @@ WebIDL::ExceptionOr<void> Storage::set_item(String const& key, String const& val
// 2. Let reorder be true.
// 3. If this's map[key] exists:
// 4. If value cannot be stored, then throw a "QuotaExceededError" DOMException exception.
// 4. If value cannot be stored, then throw a "QuotaExceededError" DOMException.
// 5. Set this's map[key] to value.
auto error = m_storage_bottle->set(key, value);
if (error == WebView::StorageOperationError::QuotaExceededError) {
@ -177,7 +177,7 @@ void Storage::broadcast(Optional<String> const& key, Optional<String> const& old
if (storage->type() != type())
continue;
// * relevant settings object's origin is same origin with storage's relevant settings object's origin.
// * relevant settings object's origin is same origin with storage's relevant settings object's origin
if (!relevant_settings_object(*this).origin().is_same_origin(relevant_settings_object(storage).origin()))
continue;

View file

@ -258,7 +258,7 @@ public:
TRY(serialize_viewed_array_buffer(m_vm, m_serialized, static_cast<JS::DataView&>(value.as_object()), m_for_storage, m_memory));
}
// 15. Otherwise, if value has [[MapData]] internal slot, then:
// 15. Otherwise, if value has a [[MapData]] internal slot, then:
else if (value.is_object() && is<JS::Map>(value.as_object())) {
// 1. Set serialized to { [[Type]]: "Map", [[MapData]]: a new empty List }.
serialize_enum(m_serialized, ValueTag::MapObject);
@ -266,7 +266,7 @@ public:
deep = true;
}
// 16. Otherwise, if value has [[SetData]] internal slot, then:
// 16. Otherwise, if value has a [[SetData]] internal slot, then:
else if (value.is_object() && is<JS::Set>(value.as_object())) {
// 1. Set serialized to { [[Type]]: "Set", [[SetData]]: a new empty List }.
serialize_enum(m_serialized, ValueTag::SetObject);

View file

@ -1371,7 +1371,7 @@ void TraversableNavigable::set_system_visibility_state(VisibilityState visibilit
return;
m_system_visibility_state = visibility_state;
// When a user-agent determines that the system visibility state for
// When a user agent determines that the system visibility state for
// traversable navigable traversable has changed to newState, it must run the following steps:
// 1. Let navigables be the inclusive descendant navigables of traversable's active document.

View file

@ -99,7 +99,7 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> WindowProxy::internal_ge
return throw_completion(WebIDL::SecurityError::create(m_window->realm(), MUST(String::formatted("Can't access property '{}' on cross-origin object", property_key))));
}
// 6. Return PropertyDescriptor{ [[Value]]: value, [[Writable]]: false, [[Enumerable]]: true, [[Configurable]]: true }.
// 6. Return PropertyDescriptor { [[Value]]: value, [[Writable]]: false, [[Enumerable]]: true, [[Configurable]]: true }.
return JS::PropertyDescriptor { .value = move(value), .writable = false, .enumerable = true, .configurable = true };
}
@ -123,7 +123,7 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> WindowProxy::internal_ge
// 1. Let value be the active WindowProxy of the named object of W with the name P.
auto value = navigable.value()->active_window_proxy();
// 2. Return PropertyDescriptor{ [[Value]]: value, [[Enumerable]]: false, [[Writable]]: false, [[Configurable]]: true }.
// 2. Return PropertyDescriptor { [[Value]]: value, [[Enumerable]]: false, [[Writable]]: false, [[Configurable]]: true }.
// NOTE: The reason the property descriptors are non-enumerable, despite this mismatching the same-origin behavior, is for compatibility with existing web content. See issue #3183 for details.
return JS::PropertyDescriptor { .value = value, .writable = false, .enumerable = false, .configurable = true };
}

View file

@ -125,7 +125,7 @@ WebIDL::ExceptionOr<void> WorkerGlobalScope::import_scripts(Vector<String> const
// If this succeeds, let script be the result. Otherwise, rethrow the exception.
auto classic_script = TRY(HTML::fetch_a_classic_worker_imported_script(url_record, settings_object, perform_fetch));
// 2. Run the classic script script, with the rethrow errors argument set to true.
// 2. Run the classic script script, with rethrow errors set to true.
// NOTE: script will run until it either returns, fails to parse, fails to catch an exception,
// or gets prematurely aborted by the terminate a worker algorithm defined above.
// If an exception was thrown or if the script was prematurely aborted, then abort all these steps,

View file

@ -376,7 +376,7 @@ EventResult DragAndDropEventHandler::handle_drag_end(
{
bool dropped = false;
// 1. If the current drag operation is "none" (no drag operation), or, if the user ended the drag-and-drop
// 1. If the current drag operation is "none" (no drag operation), or if the user ended the drag-and-drop
// operation by canceling it (e.g. by hitting the Escape key), or if the current target element is null, then
// the drag operation failed. Run these substeps:
if (m_current_drag_operation == HTML::DataTransferEffect::none || cancelled == Cancelled::Yes || !m_current_target_element) {

View file

@ -951,7 +951,7 @@ Messages::WebDriverClient::ConsumeUserActivationResponse WebDriverConnection::co
// If the current top-level browsing context is no longer open, return error with error code no such window.
TRY(ensure_current_top_level_browsing_context_is_open());
// 1. Let window be current browsing context's active window.
// 1. Let window be the current browsing context's active window.
auto* window = current_browsing_context().active_window();
// 2. Let consume be true if window has transient activation; otherwise false.

View file

@ -95,7 +95,7 @@ void WorkerHost::run(GC::Ref<Web::Page> page, Web::HTML::TransferDataHolder mess
auto destination = is_shared ? Web::Fetch::Infrastructure::Request::Destination::SharedWorker
: Web::Fetch::Infrastructure::Request::Destination::Worker;
// In both cases, let performFetch be the following perform the fetch hook given request, isTopLevel and processCustomFetchResponse:
// In both cases, let performFetch be the following perform the fetch hook given request, isTopLevel, and processCustomFetchResponse:
auto perform_fetch_function = [inside_settings, worker_global_scope, is_shared](GC::Ref<Web::Fetch::Infrastructure::Request> request, Web::HTML::TopLevelModule is_top_level, Web::Fetch::Infrastructure::FetchAlgorithms::ProcessResponseConsumeBodyFunction process_custom_fetch_response) -> Web::WebIDL::ExceptionOr<void> {
auto& realm = inside_settings->realm();
auto& vm = realm.vm();
@ -211,7 +211,7 @@ void WorkerHost::run(GC::Ref<Web::Page> page, Web::HTML::TransferDataHolder mess
inside_port->enable();
}
// 13. If is shared is true, then queue a global task on DOM manipulation task source given worker
// 13. If is shared is true, then queue a global task on the DOM manipulation task source given worker
// global scope to fire an event named connect at worker global scope, using MessageEvent,
// with the data attribute initialized to the empty string, the ports attribute initialized
// to a new frozen array containing inside port, and the source attribute initialized to inside port.