[webkit-changes] [WebKit/WebKit] c4f1f9: Implement input validation for CSSRGB constructor ...

Chris Dumez noreply at github.com
Wed Oct 26 10:14:30 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c4f1f9c6e5d1a6085ded4dfbc458a965024ed8a4
      https://github.com/WebKit/WebKit/commit/c4f1f9c6e5d1a6085ded4dfbc458a965024ed8a4
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2022-10-26 (Wed, 26 Oct 2022)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssRGB-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssRGB.html
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/css/typedom/color/CSSColorValue.cpp
    M Source/WebCore/css/typedom/color/CSSColorValue.h
    M Source/WebCore/css/typedom/color/CSSRGB.cpp
    M Source/WebCore/css/typedom/color/CSSRGB.h

  Log Message:
  -----------
  Implement input validation for CSSRGB constructor and setters
https://bugs.webkit.org/show_bug.cgi?id=246972

Reviewed by Antti Koivisto.

Implement input validation for CSSRGB constructor and setters:
- https://drafts.css-houdini.org/css-typed-om-1/#dom-cssrgb-cssrgb-r-g-b-optional-alpha
- https://drafts.css-houdini.org/css-typed-om-1/#rectify-a-csscolorrgbcomp
- https://drafts.css-houdini.org/css-typed-om-1/#rectify-a-csscolorpercent

* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssRGB-expected.txt:

* LayoutTests/imported/w3c/web-platform-tests/css/css-typed-om/stylevalue-subclasses/cssRGB.html:
Made some fixes to the test, which I will export to WPT:
- Expect a Syntax error instead of a TypeError, as per the specification.
- The loop for iterating over invalid test cases for the setters was wrong. As a result, the setters kept
  getting called with the string "undefined" instead of the actual test value.

* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/css/typedom/color/CSSColorValue.cpp: Added.
(WebCore::CSSColorValue::colorSpace):
(WebCore::CSSColorValue::to):
(WebCore::CSSColorValue::parse):
(WebCore::CSSColorValue::rectifyCSSColorPercent):
(WebCore::CSSColorValue::toCSSColorPercent):
* Source/WebCore/css/typedom/color/CSSColorValue.h:
(WebCore::CSSColorValue::colorSpace): Deleted.
(WebCore::CSSColorValue::to): Deleted.
(WebCore::CSSColorValue::parse): Deleted.
* Source/WebCore/css/typedom/color/CSSRGB.cpp:
(WebCore::toCSSColorRGBComp):
(WebCore::CSSRGB::create):
(WebCore::CSSRGB::CSSRGB):
(WebCore::CSSRGB::r const):
(WebCore::CSSRGB::setR):
(WebCore::CSSRGB::g const):
(WebCore::CSSRGB::setG):
(WebCore::CSSRGB::b const):
(WebCore::CSSRGB::setB):
(WebCore::CSSRGB::alpha const):
(WebCore::CSSRGB::setAlpha):
(WebCore::CSSRGB::rectifyCSSColorRGBComp):
* Source/WebCore/css/typedom/color/CSSRGB.h:
(WebCore::CSSRGB::create): Deleted.
(WebCore::CSSRGB::r const): Deleted.
(WebCore::CSSRGB::setR): Deleted.
(WebCore::CSSRGB::g const): Deleted.
(WebCore::CSSRGB::setG): Deleted.
(WebCore::CSSRGB::b const): Deleted.
(WebCore::CSSRGB::setB): Deleted.
(WebCore::CSSRGB::alpha const): Deleted.
(WebCore::CSSRGB::setAlpha): Deleted.

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




More information about the webkit-changes mailing list