From 9dbeecb73db473f5d26e0398a49779234fdbdded Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 9 Apr 2025 12:45:18 +0100 Subject: [PATCH] LibWeb: Correct some spec typos Corresponds to https://github.com/whatwg/html/commit/285a58bf30eed08a5dd10f74a7d217fc59431999 --- Libraries/LibWeb/DOM/DocumentLoading.cpp | 2 +- Libraries/LibWeb/DOM/Element.cpp | 2 +- Libraries/LibWeb/HTML/Dates.cpp | 20 +++++++++---------- Libraries/LibWeb/HTML/EventSource.cpp | 2 +- Libraries/LibWeb/HTML/HTMLLinkElement.cpp | 2 +- Libraries/LibWeb/HTML/HTMLMediaElement.cpp | 2 +- .../HTML/Parser/HTMLEncodingDetection.cpp | 2 +- .../LibWeb/HTML/Scripting/ClassicScript.cpp | 2 +- Libraries/LibWeb/HTML/Scripting/Fetching.cpp | 2 +- .../LibWeb/HTML/WindowOrWorkerGlobalScope.cpp | 5 +++-- .../LibWeb/Page/DragAndDropEventHandler.cpp | 4 ++-- 11 files changed, 23 insertions(+), 22 deletions(-) diff --git a/Libraries/LibWeb/DOM/DocumentLoading.cpp b/Libraries/LibWeb/DOM/DocumentLoading.cpp index 058ea46d4e8..0bc8f5853b9 100644 --- a/Libraries/LibWeb/DOM/DocumentLoading.cpp +++ b/Libraries/LibWeb/DOM/DocumentLoading.cpp @@ -448,7 +448,7 @@ GC::Ptr load_document(HTML::NavigationParams const& navigation_pa // sourceSnapshotParams, and initiatorOrigin. } - // -> A supported image, video, or audio type + // -> a supported image, video, or audio type if (type.is_image() || type.is_audio_or_video()) { // Return the result of loading a media document given navigationParams and type. diff --git a/Libraries/LibWeb/DOM/Element.cpp b/Libraries/LibWeb/DOM/Element.cpp index c4f9bc70b72..0f238ed60d4 100644 --- a/Libraries/LibWeb/DOM/Element.cpp +++ b/Libraries/LibWeb/DOM/Element.cpp @@ -2548,7 +2548,7 @@ JS::ThrowCompletionOr Element::upgrade_element(GC::Ref parse_a_month_component(GenericLexer& input) { // 1. Collect a sequence of code points that are ASCII digits from input given position. If the collected sequence is // not at least four characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. - // Let that number be the year. + // Let year be that number. auto year_string = input.consume_while(is_ascii_digit); if (year_string.length() < 4) return {}; @@ -252,8 +252,8 @@ static Optional parse_a_month_component(GenericLexer& input) return {}; // 4. Collect a sequence of code points that are ASCII digits from input given position. If the collected sequence is not - // exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that - // number be the month. + // exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let month + // be that number. auto month_string = input.consume_while(is_ascii_digit); if (month_string.length() != 2) return {}; @@ -301,7 +301,7 @@ Optional parse_a_week_string(StringView input_view) // 3. Collect a sequence of code points that are ASCII digits from input given position. If the collected sequence is // not at least four characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. - // Let that number be the year. + // Let year be that number. auto year_string = input.consume_while(is_ascii_digit); if (year_string.length() < 4) return {}; @@ -325,8 +325,8 @@ Optional parse_a_week_string(StringView input_view) return {}; // 7. Collect a sequence of code points that are ASCII digits from input given position. If the collected sequence is not - // exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that - // number be the week. + // exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let week + // be that number. auto week_string = input.consume_while(is_ascii_digit); if (week_string.length() != 2) return {}; @@ -365,8 +365,8 @@ static Optional parse_a_date_component(GenericLexer& input) return {}; // 4. Collect a sequence of code points that are ASCII digits from input given position. If the collected sequence is not - // exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let that - // number be the day. + // exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. Let day + // be that number. auto day_string = input.consume_while(is_ascii_digit); if (day_string.length() != 2) return {}; @@ -406,7 +406,7 @@ static Optional parse_a_time_component(GenericLexer& input) { // 1. Collect a sequence of code points that are ASCII digits from input given position. If the collected sequence // is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten - // integer. Let that number be the hour. + // integer. Let hour be that number. auto hour_string = input.consume_while(is_ascii_digit); if (hour_string.length() != 2) return {}; @@ -426,7 +426,7 @@ static Optional parse_a_time_component(GenericLexer& input) // 4. Collect a sequence of code points that are ASCII digits from input given position. If the collected sequence // is not exactly two characters long, then fail. Otherwise, interpret the resulting sequence as a base-ten integer. - // Let that number be the minute. + // Let minute be that number. auto minute_string = input.consume_while(is_ascii_digit); if (minute_string.length() != 2) return {}; diff --git a/Libraries/LibWeb/HTML/EventSource.cpp b/Libraries/LibWeb/HTML/EventSource.cpp index 6bca0823226..324eec8ec51 100644 --- a/Libraries/LibWeb/HTML/EventSource.cpp +++ b/Libraries/LibWeb/HTML/EventSource.cpp @@ -389,7 +389,7 @@ void EventSource::process_field(StringView field, StringView value) { // -> If the field name is "event" if (field == "event"sv) { - // Set the event type buffer to field value. + // Set the event type buffer to the field value. m_event_type = MUST(String::from_utf8(value)); } // -> If the field name is "data" diff --git a/Libraries/LibWeb/HTML/HTMLLinkElement.cpp b/Libraries/LibWeb/HTML/HTMLLinkElement.cpp index 03d2e373c67..0adacae602e 100644 --- a/Libraries/LibWeb/HTML/HTMLLinkElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLLinkElement.cpp @@ -280,7 +280,7 @@ HTMLLinkElement::LinkProcessingOptions HTMLLinkElement::create_link_options() options.policy_container = document.policy_container(); // document document options.document = &document; - // FIXME: cryptographic nonce metadata The current value of el's [[CryptographicNonce]] internal slot + // FIXME: cryptographic nonce metadata the current value of el's [[CryptographicNonce]] internal slot // fetch priority the state of el's fetchpriority content attribute options.fetch_priority = Fetch::Infrastructure::request_priority_from_string(get_attribute_value(HTML::AttributeNames::fetchpriority)).value_or(Fetch::Infrastructure::Request::Priority::Auto); diff --git a/Libraries/LibWeb/HTML/HTMLMediaElement.cpp b/Libraries/LibWeb/HTML/HTMLMediaElement.cpp index 5043ccbad74..b7366baf4af 100644 --- a/Libraries/LibWeb/HTML/HTMLMediaElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLMediaElement.cpp @@ -1008,7 +1008,7 @@ WebIDL::ExceptionOr HTMLMediaElement::fetch_resource(URL::URL const& url_r // 6. Let byteRange, which is "entire resource" or a (number, number or "until end") tuple, be the byte range required to satisfy missing data in // media data. This value is implementation-defined and may rely on codec, network conditions or other heuristics. The user-agent may determine // to fetch the resource in full, in which case byteRange would be "entire resource", to fetch from a byte offset until the end, in which case - // byteRange would be (number, "until end"), or to fetch a range between two byte offsets, im which case byteRange would be a (number, number) + // byteRange would be (number, "until end"), or to fetch a range between two byte offsets, in which case byteRange would be a (number, number) // tuple representing the two offsets. ByteRange byte_range = EntireResource {}; diff --git a/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp b/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp index 4d860159b78..a67b9ea0b01 100644 --- a/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp +++ b/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp @@ -384,7 +384,7 @@ ByteString run_encoding_sniffing_algorithm(DOM::Document& document, ByteBuffer c return maybe_transport_encoding; } - // 5. Optionally prescan the byte stream to determine its encoding, with the end condition being when the user agent decides that scanning further bytes would not + // 5. Optionally, prescan the byte stream to determine its encoding, with the end condition being when the user agent decides that scanning further bytes would not // be efficient. User agents are encouraged to only prescan the first 1024 bytes. User agents may decide that scanning any bytes is not efficient, in which case // these substeps are entirely skipped. // The aforementioned algorithm returns either a character encoding or failure. If it returns a character encoding, then return the same encoding, with confidence tentative. diff --git a/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp b/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp index e800404996b..1801eea755a 100644 --- a/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp +++ b/Libraries/LibWeb/HTML/Scripting/ClassicScript.cpp @@ -80,7 +80,7 @@ JS::Completion ClassicScript::run(RethrowErrors rethrow_errors, GC::Ptrrealm(); - // 2. Check if we can run script with realm. If this returns "do not run" then return NormalCompletion(empty). + // 2. Check if we can run script with realm. If this returns "do not run", then return NormalCompletion(empty). if (can_run_script(realm) == RunScriptDecision::DoNotRun) return JS::normal_completion(JS::js_undefined()); diff --git a/Libraries/LibWeb/HTML/Scripting/Fetching.cpp b/Libraries/LibWeb/HTML/Scripting/Fetching.cpp index 24c29999f1d..e8f93ecac49 100644 --- a/Libraries/LibWeb/HTML/Scripting/Fetching.cpp +++ b/Libraries/LibWeb/HTML/Scripting/Fetching.cpp @@ -152,7 +152,7 @@ WebIDL::ExceptionOr resolve_module_specifier(Optional referri } } - // 11. If result is null, set result be the result of resolving an imports match given normalizedSpecifier, asURL, and importMap's imports. + // 11. If result is null, set result to the result of resolving an imports match given normalizedSpecifier, asURL, and importMap's imports. if (!result.has_value()) result = TRY(resolve_imports_match(normalized_specifier.to_byte_string(), as_url, import_map.imports())); diff --git a/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp b/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp index 5d95a07b8ee..2b226197edb 100644 --- a/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp +++ b/Libraries/LibWeb/HTML/WindowOrWorkerGlobalScope.cpp @@ -378,7 +378,8 @@ i32 WindowOrWorkerGlobalScopeMixin::run_timer_initialization_steps(TimerHandler })); }; - // 13. Set uniqueHandle to the result of running steps after a timeout given global, "setTimeout/setInterval", timeout, completionStep. + // 13. Set uniqueHandle to the result of running steps after a timeout given global, "setTimeout/setInterval", + // timeout, and completionStep. // FIXME: run_steps_after_a_timeout() needs to be updated to return a unique internal value that can be used here. run_steps_after_a_timeout_impl(timeout, move(completion_step), id); @@ -994,7 +995,7 @@ void WindowOrWorkerGlobalScopeMixin::report_an_exception(JS::Value exception, Om if (false) { // FIXME: 1. Let workerObject be the Worker object associated with global. - // FIXME: 2. Set notHandled be the result of firing an event named error at workerObject, using ErrorEvent, + // FIXME: 2. Set notHandled to the result of firing an event named error at workerObject, using ErrorEvent, // with the cancelable attribute initialized to true, and additional attributes initialized // according to errorInfo. diff --git a/Libraries/LibWeb/Page/DragAndDropEventHandler.cpp b/Libraries/LibWeb/Page/DragAndDropEventHandler.cpp index 7a966821fbe..36d7003af9f 100644 --- a/Libraries/LibWeb/Page/DragAndDropEventHandler.cpp +++ b/Libraries/LibWeb/Page/DragAndDropEventHandler.cpp @@ -568,8 +568,8 @@ GC::Ref DragAndDropEventHandler::fire_a_drag_and_drop_event( if (!name.is_one_of(HTML::EventNames::dragleave, HTML::EventNames::dragend)) event_init.cancelable = true; - // 11. Initialize event's mouse and key attributes initialized according to the state of the input devices as they - // would be for user interaction events. + // 11. Initialize event's mouse and key attributes according to the state of the input devices as they would be for + // user interaction events. event_init.ctrl_key = (modifiers & UIEvents::Mod_Ctrl) != 0; event_init.shift_key = (modifiers & UIEvents::Mod_Shift) != 0; event_init.alt_key = (modifiers & UIEvents::Mod_Alt) != 0;