[webkit-changes] [WebKit/WebKit] 806925: Parsing of floating-point number values in attribu...

sideshowbarker noreply at github.com
Wed May 8 17:19:31 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 806925c1274e707952092fa37779fd4884587985
      https://github.com/WebKit/WebKit/commit/806925c1274e707952092fa37779fd4884587985
  Author: Michael[tm] Smith <mike at w3.org>
  Date:   2024-05-08 (Wed, 08 May 2024)

  Changed paths:
    M LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties-expected.txt
    M LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties.html
    M LayoutTests/fast/dom/HTMLProgressElement/set-progress-properties-expected.txt
    M LayoutTests/fast/dom/HTMLProgressElement/set-progress-properties.html
    A LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-misc-expected.txt
    A LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/dom/reflection-misc-expected.txt
    R LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt
    R LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt
    A LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt
    A LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/reflection-misc-expected.txt
    R LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt
    R LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/reflection-misc-expected.txt
    R LayoutTests/platform/mac/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt
    R LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/reflection-embedded-expected.txt
    M LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt
    M Source/WebCore/html/HTMLMeterElement.cpp
    M Source/WebCore/html/HTMLProgressElement.cpp
    M Source/WebCore/html/parser/HTMLParserIdioms.cpp
    M Source/WebCore/html/parser/HTMLParserIdioms.h

  Log Message:
  -----------
  Parsing of floating-point number values in attributes should allow leading ascii whitespace, plus sign, and trailing junk
https://bugs.webkit.org/show_bug.cgi?id=268542

Reviewed by Darin Adler.

For any attribute whose value the HTML spec defines as a “floating-point
number” (WebIDL “double”), this change makes WebKit apply the spec
requirements in the “rules for parsing floating-point number values” at
https://html.spec.whatwg.org/#rules-for-parsing-floating-point-number-values
when it should — and thus correctly skip/ignore:

  - any leading ASCII whitespace
  - any leading plus signs
  - any trailing “junk” characters that aren’t ASCII digits

…while also ensuring the U+000B LINE TABULATION (vertical tab) character is
not skipped/ignored — because although Unicode defines U+000B as whitespace,
per https://infra.spec.whatwg.org/#ascii-whitespace, U+000B is not among the
set of “ASCII whitespace” characters the HTML spec allows ignoring/skipping
when applying the “rules for parsing floating-point number values” algorithm.

Otherwise, without this change, WebKit doesn’t apply the relevant spec
requirements when it should, and doesn’t correctly ignore any leading ASCII
whitespace or plus signs, nor ignore any trailing junk — and would also
incorrectly include U+000B among the set of ignorable whitespace characters.

Note: The spec states that the “valid floating-point number” algorithm at
https://html.spec.whatwg.org/#valid-floating-point-number must be applied
when parsing certain attribute values, and that algorithm requires rejecting
values with leading ASCII whitespace or leading plus signs and trailing junk.
But for other attribute values, the spec states that the algorithm at
https://html.spec.whatwg.org/#rules-for-parsing-floating-point-number-values
must be applied instead — and that requires ignoring/skipping any leading
ASCII whitespace or plus signs, and ignoring/skipping any trailing junk.

* LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties-expected.txt:
* LayoutTests/fast/dom/HTMLMeterElement/set-meter-properties.html:
* LayoutTests/fast/dom/HTMLProgressElement/set-progress-properties-expected.txt:
* LayoutTests/fast/dom/HTMLProgressElement/set-progress-properties.html:
* LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-misc-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/dom/reflection-misc-expected.txt: Added.
* LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt: Removed.
* LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt: Added.
* LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/reflection-misc-expected.txt: Added.
* LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt: Removed.
* LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/reflection-misc-expected.txt: Removed.
* LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/reflection-embedded-expected.txt: Removed.
* LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/reflection-forms-expected.txt:
* Source/WebCore/html/HTMLMeterElement.cpp:
(WebCore::HTMLMeterElement::min const):
(WebCore::HTMLMeterElement::max const):
(WebCore::HTMLMeterElement::value const):
(WebCore::HTMLMeterElement::low const):
(WebCore::HTMLMeterElement::high const):
(WebCore::HTMLMeterElement::optimum const):
* Source/WebCore/html/HTMLProgressElement.cpp:
(WebCore::HTMLProgressElement::value const):
(WebCore::HTMLProgressElement::max const):
* Source/WebCore/html/parser/HTMLParserIdioms.cpp:
(WebCore::parseHTMLFloatingPointNumberValueInternal):
(WebCore::parseHTMLFloatingPointNumberValue):
* Source/WebCore/html/parser/HTMLParserIdioms.h:

Canonical link: https://commits.webkit.org/278541@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list