Extended Color Cleanup: Use the name SimpleColor consistently
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 May 2020 18:30:16 +0000 (18:30 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 May 2020 18:30:16 +0000 (18:30 +0000)
commite4b63ff0e822b91b61f3171f0eff5f505690ec6d
tree81c748cd4150314cb1145a74e664d12d2e082284
parent1938432ab38018cfafb3e9613e4e59bd74a51af7
Extended Color Cleanup: Use the name SimpleColor consistently
https://bugs.webkit.org/show_bug.cgi?id=212337

Reviewed by Anders Carlsson.
Source/WebCore:

- Removes RGBA32 type alias, updating all remaining users of it.
- Renames functions that take/return SimpleColor to use the name
  SimpleColor rather than RGB (e.g. makeRGBA -> makeSimpleColor)
- Moves hex color parsing from Color to SimpleColor, as that is
  the type it returns. Also took the opportunity to make it return
  an Optional<SimpleColor> instead of using a bool/out parameter.
- Move Color::compositionFill to editing/CompositionHighlight.h
  It makes no real sense to keep it in Color.h
- Replaces rgb() function in Color with asSimpleColor() for
  symmetry with asExtended().
- Replaced std::max(a, std::min(value, b)) with std::clamp(value, a, b)
  for clarity.

* css/parser/CSSParserFastPaths.cpp:
(WebCore::fastParseColorInternal):
(WebCore::CSSParserFastPaths::parseColor):
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::parseRGBParameters):
(WebCore::CSSPropertyParserHelpers::parseHSLParameters):
(WebCore::CSSPropertyParserHelpers::parseHexColor):
* editing/CompositionHighlight.h:
* editing/cocoa/DataDetection.mm:
(WebCore::DataDetection::detectContentInRange):
* html/ColorInputType.cpp:
(WebCore::parseSimpleColorValue):
* html/HTMLElement.cpp:
(WebCore::parseColorStringWithCrazyLegacyRules):
* platform/adwaita/ScrollbarThemeAdwaita.cpp:
* platform/adwaita/ThemeAdwaita.cpp:
(WebCore::ThemeAdwaita::activeSelectionForegroundColor const):
(WebCore::ThemeAdwaita::activeSelectionBackgroundColor const):
(WebCore::ThemeAdwaita::inactiveSelectionForegroundColor const):
* platform/graphics/Color.cpp:
(WebCore::differenceSquared):
(WebCore::Color::Color):
(WebCore::Color::operator=):
(WebCore::Color::serialized const):
(WebCore::Color::cssText const):
(WebCore::Color::nameForRenderTreeAsText const):
(WebCore::Color::light const):
(WebCore::Color::dark const):
(WebCore::Color::blend const):
(WebCore::Color::blendWithWhite const):
(WebCore::Color::colorWithAlpha const):
(WebCore::Color::colorWithAlphaUsingAlternativeRounding const):
(WebCore::Color::invertedColorWithAlpha const):
(WebCore::Color::colorSpaceAndComponents const):
(WebCore::Color::toSRGBASimpleColorLossy const):
(WebCore::blend):
(WebCore::Color::tagAsValid):
(WebCore::parseHexColorInternal): Deleted.
(WebCore::Color::parseHexColor): Deleted.
(WebCore::Color::asExtended const): Deleted.
* platform/graphics/Color.h:
(WebCore::Color::Color):
(WebCore::Color::isHashTableDeletedValue const):
(WebCore::Color::isValid const):
(WebCore::Color::isOpaque const):
(WebCore::Color::isVisible const):
(WebCore::Color::alpha const):
(WebCore::Color::alphaAsFloat const):
(WebCore::Color::isSemantic const):
(WebCore::Color::isExtended const):
(WebCore::Color::setIsSemantic):
(WebCore::operator==):
(WebCore::equalIgnoringSemanticColor):
(WebCore::Color::hash const):
(WebCore::Color::asExtended const):
(WebCore::Color::asSimpleColor const):
(WebCore::Color::setSimpleColor):
(WebCore::Color::isBlackColor):
(WebCore::Color::isWhiteColor):
(WebCore::Color::encode const):
(WebCore::Color::decode):
(WebCore::Color::setRGB): Deleted.
(WebCore::Color::rgb const): Deleted.
* platform/graphics/ColorUtilities.h:
(WebCore::clampedColorComponent):
* platform/graphics/ImageBackingStore.h:
(WebCore::ImageBackingStore::blendPixel):
(WebCore::ImageBackingStore::pixelValue const):
* platform/graphics/SimpleColor.cpp:
(WebCore::makePremultipliedSimpleColor):
(WebCore::makeUnpremultipliedSimpleColor):
(WebCore::makeSimpleColorFromFloats):
(WebCore::makeSimpleColorFromHSLA):
(WebCore::makeSimpleColorFromCMYKA):
(WebCore::parseHexColorInternal):
(WebCore::SimpleColor::parseHexColor):
(WebCore::makePremultipliedRGBA): Deleted.
(WebCore::makeUnPremultipliedRGBA): Deleted.
(WebCore::makeRGBA32FromFloats): Deleted.
(WebCore::makeRGBAFromHSLA): Deleted.
(WebCore::makeRGBAFromCMYKA): Deleted.
* platform/graphics/SimpleColor.h:
(WebCore::roundAndClampColorChannel):
(WebCore::colorFloatToSimpleColorByte):
(WebCore::makeSimpleColor):
(WebCore::colorFloatToRGBAByte): Deleted.
(WebCore::makeRGB): Deleted.
(WebCore::makeRGBA): Deleted.
* platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
(WebCore::makeSimpleColorFromARGBCFArray):
(WebCore::InbandTextTrackPrivateAVF::processCueAttributes):
(WebCore::makeRGBA32FromARGBCFArray): Deleted.
* platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp:
(WebCore::ImageBufferCairoImageSurfaceBackend::platformTransformColorSpace):
* platform/graphics/cairo/NativeImageCairo.cpp:
(WebCore::nativeImageSinglePixelSolidColor):
* platform/graphics/cg/ColorCG.cpp:
(WebCore::makeSimpleColorFromCGColor):
(WebCore::Color::Color):
(WebCore::cachedCGColor):
(WebCore::makeRGBAFromCGColor): Deleted.
* platform/graphics/gtk/ColorGtk.cpp:
(WebCore::Color::Color):
* platform/graphics/mac/ColorMac.mm:
(WebCore::makeSimpleColorFromNSColor):
(WebCore::colorFromNSColor):
(WebCore::semanticColorFromNSColor):
(WebCore::makeRGBAFromNSColor): Deleted.
* platform/graphics/win/ColorDirect2D.cpp:
(WebCore::Color::Color):
* platform/graphics/win/GraphicsContextCGWin.cpp:
(WebCore::GraphicsContext::drawDotsForDocumentMarker):
* platform/graphics/win/PlatformContextDirect2D.cpp:
(WebCore::PlatformContextDirect2D::brushWithColor):
* platform/ios/ColorIOS.mm:
(WebCore::colorFromUIColor):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintCompositionBackground):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintResizer):
* rendering/RenderLayerBacking.cpp:
(WebCore::patternForTouchAction):
(WebCore::patternForEventListenerRegionType):
* rendering/RenderThemeAdwaita.cpp:
* rendering/RenderThemeMac.mm:
(WebCore::menuBackgroundColor):

Source/WebKit:

* UIProcess/ios/WKContentViewInteraction.mm:
(compositionHighlights):
Update for new name of CompositionHighlight::defaultCompositionFillColor.

Tools:

* TestWebKitAPI/Tests/WebCore/ColorTests.cpp:
(TestWebKitAPI::TEST):
Update test for rename of makeRGBAFromHSLA to makeSimpleColorFromHSLA.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262128 268f45cc-cd09-0410-ab3c-d52691b4dbfc
34 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/parser/CSSParserFastPaths.cpp
Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
Source/WebCore/editing/CompositionHighlight.h
Source/WebCore/editing/cocoa/DataDetection.mm
Source/WebCore/html/ColorInputType.cpp
Source/WebCore/html/HTMLElement.cpp
Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp
Source/WebCore/platform/adwaita/ThemeAdwaita.cpp
Source/WebCore/platform/graphics/Color.cpp
Source/WebCore/platform/graphics/Color.h
Source/WebCore/platform/graphics/ColorUtilities.h
Source/WebCore/platform/graphics/ImageBackingStore.h
Source/WebCore/platform/graphics/SimpleColor.cpp
Source/WebCore/platform/graphics/SimpleColor.h
Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp
Source/WebCore/platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp
Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp
Source/WebCore/platform/graphics/cg/ColorCG.cpp
Source/WebCore/platform/graphics/gtk/ColorGtk.cpp
Source/WebCore/platform/graphics/mac/ColorMac.mm
Source/WebCore/platform/graphics/win/ColorDirect2D.cpp
Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
Source/WebCore/platform/graphics/win/PlatformContextDirect2D.cpp
Source/WebCore/platform/ios/ColorIOS.mm
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderThemeAdwaita.cpp
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebCore/ColorTests.cpp