Extended Color: Replace Color constructors taking numeric values with type specific...
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Jun 2020 14:17:12 +0000 (14:17 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Jun 2020 14:17:12 +0000 (14:17 +0000)
commit0bf12a34b6b389d4ca0decac8848d5aaedc3e568
tree5cae1548f02345d676b3eb0530f50eafd12e650b
parent3de8025807cc509ee0f21aeda02a3bc171fd230b
Extended Color: Replace Color constructors taking numeric values with type specific factory functions
https://bugs.webkit.org/show_bug.cgi?id=212576

Reviewed by Tim Horton.

Replaces all remaining implicit and explicit uses of the Color constructors taking numeric
values with explicit calls to makeSimpleColor/makeSimpleColorFromFloats/makeExtendedColor,
giving us a consistent way to create colors. Also addes use constexpr SimpleColors where possible.

Source/WebCore:

* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::initializeAttributeData):
* css/CSSValuePool.cpp:
(WebCore::StaticCSSValuePool::StaticCSSValuePool):
* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::createInnerTextStyle):
* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::shadowColor const):
(WebCore::CanvasRenderingContext2DBase::setShadow):
* html/canvas/CanvasStyle.cpp:
(WebCore::CanvasStyle::CanvasStyle):
(WebCore::CanvasStyle::isEquivalentRGBA const):
* inspector/InspectorOverlay.cpp:
(WebCore::drawOutlinedQuadWithClip):
(WebCore::drawShapeHighlight):
(WebCore::InspectorOverlay::paint):
(WebCore::InspectorOverlay::drawPaintRects):
(WebCore::InspectorOverlay::drawBounds):
(WebCore::InspectorOverlay::drawRulers):
(WebCore::InspectorOverlay::drawElementTitle):
* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::parseColor):
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::debugTextShadow):
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::captionsBackgroundCSS const):
* page/DebugPageOverlays.cpp:
(WebCore::touchEventRegionColors):
(WebCore::NonFastScrollableRegionOverlay::drawRect):
* page/FrameView.cpp:
(WebCore::FrameView::paintContents):
* page/PrintContext.cpp:
(WebCore::PrintContext::spoolAllPagesWithBoundaries):
* page/linux/ResourceUsageOverlayLinux.cpp:
(WebCore::ResourceUsageOverlay::platformInitialize):
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::draw):
* platform/graphics/Color.cpp:
(WebCore::Color::light const):
(WebCore::Color::dark const):
(WebCore::Color::blendWithWhite const):
(WebCore::Color::colorWithAlphaMultipliedBy const):
(WebCore::Color::colorWithAlphaMultipliedByUsingAlternativeRounding const):
(WebCore::Color::colorWithAlpha const):
(WebCore::Color::colorWithAlphaUsingAlternativeRounding const):
(WebCore::blendWithoutPremultiply):
(WebCore::extendedColorsEqual): Deleted.
(WebCore::Color::tagAsValid): Deleted.
* platform/graphics/Color.h:
(WebCore::Color::Color):
(WebCore::Color::tagAsSemantic):
(WebCore::Color::tagAsValid):
(WebCore::extendedColorsEqual):
(WebCore::Color::decode):
(WebCore::Color::setIsSemantic): Deleted.
* platform/graphics/ExtendedColor.cpp:
(WebCore::makeExtendedColor):
* platform/graphics/ExtendedColor.h:
(WebCore::ExtendedColor::ExtendedColor):
(): Deleted.
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::getDebugBorderInfo const):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::recursiveCommitChanges):
(WebCore::contentsLayerDebugBorderColor):
(WebCore::cloneLayerDebugBorderColor):
(WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
* platform/graphics/ca/PlatformCALayer.cpp:
(WebCore::PlatformCALayer::drawRepaintIndicator):
* platform/graphics/ca/TileCoverageMap.cpp:
(WebCore::TileCoverageMap::TileCoverageMap):
(WebCore::TileCoverageMap::update):
* platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
(PlatformCALayerWinInternal::drawRepaintCounters):
* platform/graphics/cairo/GradientCairo.cpp:
(WebCore::interpolateColorStop):
* platform/graphics/cg/ColorCG.cpp:
(WebCore::Color::Color):
* platform/graphics/cg/NativeImageCG.cpp:
(WebCore::nativeImageSinglePixelSolidColor):
* platform/graphics/cocoa/GraphicsContextCocoa.mm:
(WebCore::colorForMarkerLineStyle):
* platform/graphics/filters/FilterOperation.cpp:
(WebCore::DropShadowFilterOperation::blend):
* platform/graphics/mac/ColorMac.mm:
(WebCore::colorFromNSColor):
* platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
(WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
* platform/ios/DragImageIOS.mm:
(WebCore::createDragImageForLink):
* platform/ios/LegacyTileCache.mm:
(WebCore::LegacyTileCache::colorForGridTileBorder const):
* platform/win/DragImageWin.cpp:
(WebCore::createDragImageForLink):
* rendering/PaintInfo.h:
(WebCore::PaintInfo::forcedTextColor const):
* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::paintReplaced):
(WebCore::replacementTextRoundedRectPressedColor): Deleted.
(WebCore::replacementTextRoundedRectColor): Deleted.
(WebCore::replacementTextColor): Deleted.
(WebCore::unavailablePluginBorderColor): Deleted.
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::paintColumnBorder):
(WebCore::RenderFrameSet::paintRowBorder):
(WebCore::borderStartEdgeColor): Deleted.
(WebCore::borderEndEdgeColor): Deleted.
(WebCore::borderFillColor): Deleted.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::beginTransparencyLayers):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::paintDebugOverlays):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::platformActiveSelectionBackgroundColor const):
(WebCore::RenderTheme::platformInactiveSelectionBackgroundColor const):
(WebCore::RenderTheme::platformTextSearchHighlightColor const):
(WebCore::RenderTheme::paintSystemPreviewBadge):
(WebCore::RenderTheme::platformTapHighlightColor const):
* rendering/RenderTheme.h:
(WebCore::RenderTheme::platformFocusRingColor const):
* rendering/RenderThemeIOS.h:
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::paintCheckboxDecorations):
(WebCore::RenderThemeIOS::paintRadioDecorations):
(WebCore::RenderThemeIOS::paintMenuListButtonDecorations):
(WebCore::RenderThemeIOS::paintSliderTrack):
(WebCore::RenderThemeIOS::paintProgressBar):
(WebCore::paintAttachmentProgress):
(WebCore::paintAttachmentBorder):
(WebCore::RenderThemeIOS::paintSystemPreviewBadge):
(WebCore::RenderThemeIOS::shadowColor const): Deleted.
(WebCore::attachmentBorderColor): Deleted.
(WebCore::attachmentProgressColor): Deleted.
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintMenuListButtonDecorations):
(WebCore::titleTextColorForAttachment):
(WebCore::AttachmentLayout::layOutSubtitle):
(WebCore::paintAttachmentIconBackground):
(WebCore::paintAttachmentTitleBackground):
(WebCore::paintAttachmentProgress):
(WebCore::paintAttachmentPlaceholderBorder):
(WebCore::attachmentIconBackgroundColor): Deleted.
(WebCore::attachmentIconBorderColor): Deleted.
(WebCore::attachmentTitleInactiveBackgroundColor): Deleted.
(WebCore::attachmentTitleInactiveTextColor): Deleted.
(WebCore::attachmentSubtitleTextColor): Deleted.
(WebCore::attachmentProgressBarBackgroundColor): Deleted.
(WebCore::attachmentProgressBarFillColor): Deleted.
(WebCore::attachmentProgressBarBorderColor): Deleted.
(WebCore::attachmentPlaceholderBorderColor): Deleted.
* rendering/RenderThemeWin.cpp:
(WebCore::RenderThemeWin::platformActiveSelectionBackgroundColor const):
(WebCore::RenderThemeWin::platformInactiveSelectionBackgroundColor const):
(WebCore::RenderThemeWin::platformActiveSelectionForegroundColor const):
(WebCore::RenderThemeWin::systemColor const):
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::paintFlow):
* rendering/mathml/RenderMathMLBlock.cpp:
(WebCore::RenderMathMLBlock::paint):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::colorResolvingCurrentColor const):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::initialStrokeColor):
* rendering/style/SVGRenderStyle.h:
(WebCore::SVGRenderStyle::initialStopColor):
(WebCore::SVGRenderStyle::initialFloodColor):
(WebCore::SVGRenderStyle::initialLightingColor):
* svg/SVGStopElement.cpp:
(WebCore::SVGStopElement::stopColorIncludingOpacity const):
* svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
(WebCore::SVGAnimationColorFunction::animate):
* testing/MockPageOverlayClient.cpp:
(WebCore::MockPageOverlayClient::drawRect):
* testing/cocoa/WebViewVisualIdentificationOverlay.mm:
(-[WebViewVisualIdentificationOverlay initWithWebView:kind:deprecated:]):

Source/WebKit:

* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::drawInContext):
* UIProcess/API/wpe/WebKitColor.cpp:
(webkitColorToWebCoreColor):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _tapHighlightColorForFastClick:]):
* WebProcess/Inspector/WebInspectorClient.cpp:
(WebKit::WebInspectorClient::showPaintRect):
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::drawRect):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::paintSnapshotAtSize):
* WebProcess/WebPage/ios/FindControllerIOS.mm:
(WebKit::FindIndicatorOverlayClientIOS::drawRect):
(WebKit::highlightColor): Deleted.

Source/WebKitLegacy/mac:

* WebView/WebIndicateLayer.mm:

Source/WebKitLegacy/win:

* WebView.cpp:
(compositionToUnderlines):

Tools:

* TestWebKitAPI/Tests/WebCore/ColorTests.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebCore/ExtendedColorTests.cpp:
(TestWebKitAPI::TEST):
(TestWebKitAPI::makeColor):
* TestWebKitAPI/Tests/WebKitCocoa/PDFSnapshot.mm:
(TestWebKitAPI::TEST):
* TestWebKitAPI/cocoa/TestPDFDocument.mm:
(TestWebKitAPI::TestPDFPage::colorAtPoint const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@262377 268f45cc-cd09-0410-ab3c-d52691b4dbfc
72 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp
Source/WebCore/css/CSSValuePool.cpp
Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp
Source/WebCore/html/canvas/CanvasStyle.cpp
Source/WebCore/inspector/InspectorOverlay.cpp
Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp
Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp
Source/WebCore/page/DebugPageOverlays.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/PrintContext.cpp
Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp
Source/WebCore/platform/graphics/BitmapImage.cpp
Source/WebCore/platform/graphics/Color.cpp
Source/WebCore/platform/graphics/Color.h
Source/WebCore/platform/graphics/ExtendedColor.cpp
Source/WebCore/platform/graphics/ExtendedColor.h
Source/WebCore/platform/graphics/GraphicsLayer.cpp
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp
Source/WebCore/platform/graphics/ca/TileCoverageMap.cpp
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp
Source/WebCore/platform/graphics/cairo/GradientCairo.cpp
Source/WebCore/platform/graphics/cg/ColorCG.cpp
Source/WebCore/platform/graphics/cg/NativeImageCG.cpp
Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm
Source/WebCore/platform/graphics/filters/FilterOperation.cpp
Source/WebCore/platform/graphics/mac/ColorMac.mm
Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp
Source/WebCore/platform/ios/DragImageIOS.mm
Source/WebCore/platform/ios/LegacyTileCache.mm
Source/WebCore/platform/win/DragImageWin.cpp
Source/WebCore/rendering/PaintInfo.h
Source/WebCore/rendering/RenderEmbeddedObject.cpp
Source/WebCore/rendering/RenderFrameSet.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderTheme.h
Source/WebCore/rendering/RenderThemeIOS.h
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebCore/rendering/RenderThemeWin.cpp
Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp
Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/SVGRenderStyle.h
Source/WebCore/svg/SVGStopElement.cpp
Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h
Source/WebCore/testing/MockPageOverlayClient.cpp
Source/WebCore/testing/cocoa/WebViewVisualIdentificationOverlay.mm
Source/WebKit/ChangeLog
Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm
Source/WebKit/UIProcess/API/wpe/WebKitColor.cpp
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Source/WebKit/WebProcess/Inspector/WebInspectorClient.cpp
Source/WebKit/WebProcess/WebPage/FindController.cpp
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/ios/FindControllerIOS.mm
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebIndicateLayer.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/WebView.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebCore/ColorTests.cpp
Tools/TestWebKitAPI/Tests/WebCore/ExtendedColorTests.cpp
Tools/TestWebKitAPI/Tests/WebKitCocoa/PDFSnapshot.mm
Tools/TestWebKitAPI/cocoa/TestPDFDocument.mm