Simplify and streamline some Color-related code to prepare for some Color/ExtendedCol...
[WebKit-https.git] / Source / WebCore / ChangeLog
index 358abe1..745c81d 100644 (file)
@@ -1,3 +1,57 @@
+2017-12-07  Darin Adler  <darin@apple.com>
+
+        Simplify and streamline some Color-related code to prepare for some Color/ExtendedColor work
+        https://bugs.webkit.org/show_bug.cgi?id=180569
+
+        Reviewed by Sam Weinig.
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::colorValue const): Use valueAsColor instead of
+        having custom code here to parse the color string.
+
+        * css/CSSGradientValue.cpp:
+        (WebCore::interpolate): Deleted.
+        (WebCore::CSSGradientValue::computeStops): Call blend instead of interpolate. The only
+        difference is that the interpolate function truncated when converting from floating point
+        to integer, and the blend function rounds instead.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::colorFromPrimitiveValue const): Removed unneeded special case
+        for identifier of 0, since StyleColor::colorFromKeyword already handles that correctly.
+        Also got rid of unneded local variable "state".
+
+        * html/ColorInputType.cpp:
+        (WebCore::isValidSimpleColor): Rewrote to take a StringView instead of a String and
+        to stay with a single loop since this does not need the extra efficiency of a separate
+        8-bit and 16-bit character version. Renamed to more closely match what the specification
+        calls this algorithm.
+        (WebCore::parseSimpleColorValue): Added. To be used instead of relying on the behavior of
+        the Color constructor that takes a String, so we can remove that later.
+        (WebCore::ColorInputType::sanitizeValue const): Updated for name change.
+        (WebCore::ColorInputType::valueAsColor const): Use parseSimpleColorValue instead of the
+        Color constructor that takes a string.
+        (WebCore::ColorInputType::typeMismatchFor const): Updated for name change.
+        (WebCore::ColorInputType::selectColor): Updated to take a StringView instead of a Color.
+        Note that this function is used for testing only.
+
+        * html/ColorInputType.h: Marked everything final instead of override. Updated the
+        selectColor function to take a StringView instead of a Color.
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::selectColor): Take a StringView instead of a Color.
+        * html/HTMLInputElement.h: Ditto.
+
+        * html/InputType.cpp:
+        (WebCore::InputType::selectColor): Take a StringView instead of a Color.
+        * html/InputType.h: Ditto.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::selectColorInColorChooser): Pass the string directly instead of
+        constructing a Color with it.
+        (WebCore::Internals::setViewBaseBackgroundColor): Instead of pasring the passed in string
+        with the Color constructor, implemented the two names that are actually used with this
+        function in tests: "transparent" and "white".
+
 2017-12-08  Konstantin Tokarev  <annulen@yandex.ru>
 
         Unreviewed, fix wrong letter case in #import HTMLIframeElement.h