Diff
Modified: trunk/Source/WebCore/ChangeLog (264583 => 264584)
--- trunk/Source/WebCore/ChangeLog 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/ChangeLog 2020-07-19 20:07:07 UTC (rev 264584)
@@ -1,3 +1,104 @@
+2020-07-19 Sam Weinig <[email protected]>
+
+ Remove ColorBuilder
+ https://bugs.webkit.org/show_bug.cgi?id=214521
+
+ Reviewed by Darin Adler.
+
+ ColorBuilder is unnecessary and just makes deduction contexts more complicated.
+ Instead, we can get the same behavior by having color types inherit from a shared
+ base class ColorType that uses the curiously recurring template pattern, which
+ exposes the colorWithAlphaByte function (renamed from colorWithAlpha for clarity
+ of the parameter).
+
+ * Headers.cmake:
+ * WebCore.xcodeproj/project.pbxproj:
+ Remove ColorBuilder.
+
+ * platform/graphics/ColorBuilder.h: Removed.
+
+ * platform/graphics/Color.cpp:
+ (WebCore::Color::lightened const):
+ * platform/graphics/Color.h:
+ (WebCore::Color::alphaByte const):
+ (WebCore::Color::alpha const): Deleted.
+ Stop using ColorBuilder for color named color types and rename Color::alpha to Color:alphaByte()
+ for consistency with colorWithAlphaByte().
+
+ * platform/graphics/ColorTypes.h:
+ (WebCore::ColorType::colorWithAlphaByte const):
+ (WebCore::LinearSRGBA::LinearSRGBA):
+ (WebCore::DisplayP3::DisplayP3):
+ (WebCore::LinearDisplayP3::LinearDisplayP3):
+ (WebCore::HSLA::HSLA):
+ (WebCore::CMYKA::CMYKA):
+ (WebCore::XYZA::XYZA):
+ Switch each color type to inheriting from new ColorWithAlphaHelper struct. Use the opertunity to
+ give each color type the same construction interface as well. Now that each type has constructors,
+ the deduction guides are no longer necessary.
+
+ * platform/graphics/ColorBlending.cpp:
+ (WebCore::blendSourceOver):
+ Switch from !color.alpha() to !color.isVisible() to more clearly indicate the intent.
+
+ * accessibility/AccessibilityTable.cpp:
+ (WebCore::AccessibilityTable::isDataTable const):
+ Update to call alphaByte() and add FIXME indicating that it is probably incorrect and filed
+ https://bugs.webkit.org/show_bug.cgi?id=214537 to track things further.
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::createInnerTextStyle):
+ * inspector/InspectorOverlay.cpp:
+ (WebCore::InspectorOverlay::drawPaintRects):
+ (WebCore::InspectorOverlay::drawBounds):
+ (WebCore::InspectorOverlay::drawRulers):
+ * page/CaptionUserPreferencesMediaAF.cpp:
+ (WebCore::CaptionUserPreferencesMediaAF::captionsBackgroundCSS const):
+ * page/DebugPageOverlays.cpp:
+ (WebCore::NonFastScrollableRegionOverlay::drawRect):
+ * page/DragController.cpp:
+ (WebCore::DragController::insertDroppedImagePlaceholdersAtCaret):
+ * page/linux/ResourceUsageOverlayLinux.cpp:
+ (WebCore::ResourceUsageOverlay::platformInitialize):
+ * platform/graphics/BitmapImage.cpp:
+ (WebCore::BitmapImage::draw):
+ * platform/graphics/GraphicsLayer.cpp:
+ (WebCore::GraphicsLayer::getDebugBorderInfo const):
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::recursiveCommitChanges):
+ * platform/graphics/ca/PlatformCALayer.cpp:
+ (WebCore::PlatformCALayer::drawRepaintIndicator):
+ * platform/graphics/ca/TileCoverageMap.cpp:
+ (WebCore::TileCoverageMap::TileCoverageMap):
+ * platform/mock/ScrollbarThemeMock.cpp:
+ (WebCore::ScrollbarThemeMock::paintTrackBackground):
+ * platform/win/DragImageWin.cpp:
+ (WebCore::createDragImageForLink):
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::resolveStyleForMarkedText):
+ * rendering/RenderEmbeddedObject.cpp:
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::patternForTouchAction):
+ (WebCore::patternForEventListenerRegionType):
+ (WebCore::RenderLayerBacking::paintDebugOverlays):
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::platformTapHighlightColor const):
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::paintMenuListButtonDecorations):
+ * rendering/SimpleLineLayoutFunctions.cpp:
+ (WebCore::SimpleLineLayout::paintFlow):
+ * testing/cocoa/WebViewVisualIdentificationOverlay.mm:
+ (-[WebViewVisualIdentificationOverlay initWithWebView:kind:deprecated:]):
+ Update to call colorWithAlphaByte rather than colorWithAlpha.
+
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::RenderThemeIOS::addRoundedBorderClip):
+ (WebCore::RenderThemeIOS::paintCheckboxDecorations):
+ (WebCore::RenderThemeIOS::paintRadioDecorations):
+ (WebCore::RenderThemeIOS::paintMenuListButtonDecorations):
+ (WebCore::RenderThemeIOS::paintSystemPreviewBadge):
+ Update to use colorWithAlphaByte rather than colorWithAlpha and alphaByte rather than alpha.
+
2020-07-19 Rob Buis <[email protected]>
Remove findCharsetInMediaType
Modified: trunk/Source/WebCore/Headers.cmake (264583 => 264584)
--- trunk/Source/WebCore/Headers.cmake 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/Headers.cmake 2020-07-19 20:07:07 UTC (rev 264584)
@@ -1083,7 +1083,6 @@
platform/graphics/AudioTrackPrivate.h
platform/graphics/BitmapImage.h
platform/graphics/Color.h
- platform/graphics/ColorBuilder.h
platform/graphics/ColorComponents.h
platform/graphics/ColorConversion.h
platform/graphics/ColorHash.h
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (264583 => 264584)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-07-19 20:07:07 UTC (rev 264584)
@@ -2209,7 +2209,6 @@
7AF9B20F18CFB5F400C64BEF /* JSVTTRegionList.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AF9B20B18CFB5F300C64BEF /* JSVTTRegionList.h */; };
7BE7427381FA906FBB4F0F2C /* JSSVGGraphicsElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 950C4C02BED8936F818E2F99 /* JSSVGGraphicsElement.h */; };
7C029C6E2493C8F800268204 /* ColorTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C029C6D2493C8F800268204 /* ColorTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 7C14A00724B5FE21001A6C6C /* ColorBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C14A00624B5FE21001A6C6C /* ColorBuilder.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C1843FE1C8B7283002EB973 /* Autofill.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C1843FC1C8B7283002EB973 /* Autofill.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C193BBB1F5E0EED0088F3E6 /* CanvasDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C193BB61F5E0EB90088F3E6 /* CanvasDirection.h */; };
7C193BBC1F5E0EED0088F3E6 /* CanvasFillRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C193BA11F5E0EAB0088F3E6 /* CanvasFillRule.h */; };
@@ -9932,7 +9931,6 @@
7C0CEF2E1E4A5832008DEB80 /* JSDOMBuiltinConstructorBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMBuiltinConstructorBase.cpp; sourceTree = "<group>"; };
7C0CEF2F1E4A58AD008DEB80 /* JSDOMConstructorBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMConstructorBase.cpp; sourceTree = "<group>"; };
7C0CEF301E4A58F1008DEB80 /* JSDOMConstructorWithDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMConstructorWithDocument.cpp; sourceTree = "<group>"; };
- 7C14A00624B5FE21001A6C6C /* ColorBuilder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ColorBuilder.h; sourceTree = "<group>"; };
7C1843FB1C8B7283002EB973 /* Autofill.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Autofill.cpp; sourceTree = "<group>"; };
7C1843FC1C8B7283002EB973 /* Autofill.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Autofill.h; sourceTree = "<group>"; };
7C193B9A1F5E0EA70088F3E6 /* CanvasDrawImage.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CanvasDrawImage.idl; sourceTree = "<group>"; };
@@ -25547,7 +25545,6 @@
B27535390B053814002CE64F /* Color.h */,
7C1B4A6524A997590033727F /* ColorBlending.cpp */,
7C1B4A6724A997660033727F /* ColorBlending.h */,
- 7C14A00624B5FE21001A6C6C /* ColorBuilder.h */,
7CAC6AEC247F1C5100E61D59 /* ColorComponents.h */,
7C514E0224AF80580050710F /* ColorConversion.cpp */,
7C514E0024AF80580050710F /* ColorConversion.h */,
@@ -30150,7 +30147,6 @@
46EBEA021B7D4D6500BE4941 /* CollectionTraversal.h in Headers */,
93C442000F813AE100C1A634 /* CollectionType.h in Headers */,
B27535670B053814002CE64F /* Color.h in Headers */,
- 7C14A00724B5FE21001A6C6C /* ColorBuilder.h in Headers */,
C330A22313EC196B0000B45B /* ColorChooser.h in Headers */,
C37CDEBD149EF2030042090D /* ColorChooserClient.h in Headers */,
F48D2AA52159740D00C6752B /* ColorCocoa.h in Headers */,
@@ -34342,7 +34338,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "if [ \"${ACTION}\" = \"installhdrs\" -o \"${ACTION}\" = \"installapi\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-weak-vtables-and-externals ]; then\n ../../Tools/Scripts/check-for-weak-vtables-and-externals || exit $?\nfi";
+ shellScript = "if [ \"${ACTION}\" = \"installhdrs\" -o \"${ACTION}\" = \"installapi\" ]; then\n exit 0;\nfi\n\nif [ -f ../../Tools/Scripts/check-for-weak-vtables-and-externals ]; then\n ../../Tools/Scripts/check-for-weak-vtables-and-externals || exit $?\nfi\n";
};
5D2F7DA00C6879C600B5B72B /* Update Info.plist with version information */ = {
isa = PBXShellScriptBuildPhase;
Modified: trunk/Source/WebCore/accessibility/AccessibilityTable.cpp (264583 => 264584)
--- trunk/Source/WebCore/accessibility/AccessibilityTable.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/accessibility/AccessibilityTable.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -285,7 +285,7 @@
// then it is probably a data table cell (spacing and colors take the place of borders).
Color cellColor = renderStyle.visitedDependentColor(CSSPropertyBackgroundColor);
if (table.hBorderSpacing() > 0 && table.vBorderSpacing() > 0
- && tableBGColor != cellColor && cellColor.alpha() != 1)
+ && tableBGColor != cellColor && cellColor.alphaByte() != 1) // FIXME (https://bugs.webkit.org/show_bug.cgi?id=214537): This comparison to 1 is likely incorrect. It likely should be checking !cellColor.isOpaque().
++backgroundDifferenceCellCount;
// If we've found 10 "good" cells, we don't need to keep searching.
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (264583 => 264584)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -2085,7 +2085,7 @@
if (hasAutoFillStrongPasswordButton() && !isDisabledOrReadOnly()) {
textBlockStyle.setDisplay(DisplayType::InlineBlock);
textBlockStyle.setMaxWidth(Length { 100, Percent });
- textBlockStyle.setColor(Color::black.colorWithAlpha(153));
+ textBlockStyle.setColor(Color::black.colorWithAlphaByte(153));
textBlockStyle.setTextOverflow(TextOverflow::Clip);
textBlockStyle.setMaskImage(StyleGeneratedImage::create(autoFillStrongPasswordMaskImage()));
// A stacking context is needed for the mask.
Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (264583 => 264584)
--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -611,7 +611,7 @@
{
GraphicsContextStateSaver stateSaver(context);
- constexpr auto paintRectsColor = Color::red.colorWithAlpha(128);
+ constexpr auto paintRectsColor = Color::red.colorWithAlphaByte(128);
context.setFillColor(paintRectsColor);
for (const TimeRectPair& pair : paintRects)
@@ -662,7 +662,7 @@
context.setStrokeThickness(1);
- constexpr auto boundsColor = Color::red.colorWithAlpha(153);
+ constexpr auto boundsColor = Color::red.colorWithAlphaByte(153);
context.setStrokeColor(boundsColor);
context.strokePath(path);
@@ -670,9 +670,9 @@
void InspectorOverlay::drawRulers(GraphicsContext& context, const InspectorOverlay::RulerExclusion& rulerExclusion)
{
- constexpr auto rulerBackgroundColor = Color::white.colorWithAlpha(153);
- constexpr auto lightRulerColor = Color::black.colorWithAlpha(51);
- constexpr auto darkRulerColor = Color::black.colorWithAlpha(128);
+ constexpr auto rulerBackgroundColor = Color::white.colorWithAlphaByte(153);
+ constexpr auto lightRulerColor = Color::black.colorWithAlphaByte(51);
+ constexpr auto darkRulerColor = Color::black.colorWithAlphaByte(128);
IntPoint scrollOffset;
Modified: trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp (264583 => 264584)
--- trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -289,7 +289,7 @@
{
// This default value must be the same as the one specified in mediaControls.css for -webkit-media-text-track-past-nodes
// and webkit-media-text-track-future-nodes.
- constexpr auto defaultBackgroundColor = Color::black.colorWithAlpha(204);
+ constexpr auto defaultBackgroundColor = Color::black.colorWithAlphaByte(204);
MACaptionAppearanceBehavior behavior;
Modified: trunk/Source/WebCore/page/DebugPageOverlays.cpp (264583 => 264584)
--- trunk/Source/WebCore/page/DebugPageOverlays.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/page/DebugPageOverlays.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -118,7 +118,7 @@
private:
explicit NonFastScrollableRegionOverlay(Page& page)
- : RegionOverlay(page, Color::orange.colorWithAlpha(102))
+ : RegionOverlay(page, Color::orange.colorWithAlphaByte(102))
{
}
@@ -236,7 +236,7 @@
#endif
for (const auto& synchronousEventRegion : m_eventTrackingRegions.eventSpecificSynchronousDispatchRegions) {
- auto regionColor = Color::black.colorWithAlpha(64).color();
+ auto regionColor = Color::black.colorWithAlphaByte(64);
auto it = touchEventRegionColors().find(synchronousEventRegion.key);
if (it != touchEventRegionColors().end())
regionColor = it->value;
Modified: trunk/Source/WebCore/page/DragController.cpp (264583 => 264584)
--- trunk/Source/WebCore/page/DragController.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/page/DragController.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -1445,7 +1445,7 @@
image->setAttributeWithoutSynchronization(HTMLNames::widthAttr, AtomString::number(size.width()));
image->setAttributeWithoutSynchronization(HTMLNames::heightAttr, AtomString::number(size.height()));
image->setInlineStyleProperty(CSSPropertyMaxWidth, 100, CSSUnitType::CSS_PERCENTAGE);
- image->setInlineStyleProperty(CSSPropertyBackgroundColor, serializationForCSS(Color::black.colorWithAlpha(13)));
+ image->setInlineStyleProperty(CSSPropertyBackgroundColor, serializationForCSS(Color::black.colorWithAlphaByte(13)));
image->setIsDroppedImagePlaceholder();
fragment->appendChild(WTFMove(image));
}
Modified: trunk/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp (264583 => 264584)
--- trunk/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -88,7 +88,7 @@
void paintContents(const GraphicsLayer*, GraphicsContext& context, const FloatRect& clip, GraphicsLayerPaintBehavior) override
{
GraphicsContextStateSaver stateSaver(context);
- context.fillRect(clip, Color::black.colorWithAlpha(204));
+ context.fillRect(clip, Color::black.colorWithAlphaByte(204));
context.setFillColor(SRGBA<uint8_t> { 230, 230, 230 });
FloatPoint position = { 10, 20 };
@@ -137,7 +137,7 @@
m_paintLayer = GraphicsLayer::create(overlay().page()->chrome().client().graphicsLayerFactory(), *m_overlayPainter);
m_paintLayer->setAnchorPoint(FloatPoint3D());
m_paintLayer->setSize({ normalWidth, normalHeight });
- m_paintLayer->setBackgroundColor(Color::black.colorWithAlpha(204));
+ m_paintLayer->setBackgroundColor(Color::black.colorWithAlphaByte(204));
m_paintLayer->setDrawsContent(true);
overlay().layer().addChild(*m_paintLayer);
Modified: trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp (264583 => 264584)
--- trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -45,7 +45,7 @@
static const double scrollbarOpacity = 0.8;
static constexpr auto scrollbarBackgroundColor = SRGBA<uint8_t> { 252, 252, 252 };
static constexpr auto scrollbarBorderColor = SRGBA<uint8_t> { 220, 223, 227 };
-static constexpr auto overlayThumbBorderColor = Color::white.colorWithAlpha(100);
+static constexpr auto overlayThumbBorderColor = Color::white.colorWithAlphaByte(100);
static constexpr auto overlayThumbColor = SRGBA<uint8_t> { 46, 52, 54, 100 };
static constexpr auto thumbHoveredColor = SRGBA<uint8_t> { 86, 91, 92 };
static constexpr auto thumbPressedColor = SRGBA<uint8_t> { 27, 106, 203 };
Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.cpp (264583 => 264584)
--- trunk/Source/WebCore/platform/graphics/BitmapImage.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -237,7 +237,7 @@
if (!frameHasDecodedNativeImageCompatibleWithOptionsAtIndex(m_currentFrame, m_currentSubsamplingLevel, DecodingOptions(DecodingMode::Asynchronous))) {
if (m_showDebugBackground)
- fillWithSolidColor(context, destRect, Color::yellow.colorWithAlpha(128), options.compositeOperator());
+ fillWithSolidColor(context, destRect, Color::yellow.colorWithAlphaByte(128), options.compositeOperator());
return result;
}
@@ -248,7 +248,7 @@
ASSERT_IMPLIES(status == StartAnimationStatus::DecodingActive, (!m_currentFrame && !m_repetitionsComplete) || frameHasFullSizeNativeImageAtIndex(m_currentFrame, m_currentSubsamplingLevel));
if (status == StartAnimationStatus::DecodingActive && m_showDebugBackground) {
- fillWithSolidColor(context, destRect, Color::yellow.colorWithAlpha(128), options.compositeOperator());
+ fillWithSolidColor(context, destRect, Color::yellow.colorWithAlphaByte(128), options.compositeOperator());
return result;
}
@@ -266,7 +266,7 @@
} else if (frameIsBeingDecoded) {
// FIXME: instead of showing the yellow rectangle and returning we need to wait for this frame to finish decoding.
if (m_showDebugBackground) {
- fillWithSolidColor(context, destRect, Color::yellow.colorWithAlpha(128), options.compositeOperator());
+ fillWithSolidColor(context, destRect, Color::yellow.colorWithAlphaByte(128), options.compositeOperator());
LOG(Images, "BitmapImage::%s - %p - url: %s [waiting for async decoding to finish]", __FUNCTION__, this, sourceURL().string().utf8().data());
}
return ImageDrawResult::DidRequestDecoding;
Modified: trunk/Source/WebCore/platform/graphics/Color.cpp (264583 => 264584)
--- trunk/Source/WebCore/platform/graphics/Color.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/platform/graphics/Color.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -33,8 +33,8 @@
namespace WebCore {
-static constexpr auto lightenedBlack = ColorBuilder<SRGBA<uint8_t>> { 84, 84, 84 };
-static constexpr auto darkenedWhite = ColorBuilder<SRGBA<uint8_t>> { 171, 171, 171 };
+static constexpr auto lightenedBlack = SRGBA<uint8_t> { 84, 84, 84 };
+static constexpr auto darkenedWhite = SRGBA<uint8_t> { 171, 171, 171 };
Color::Color(const Color& other)
: m_colorData(other.m_colorData)
@@ -87,7 +87,7 @@
float v = std::max({ r, g, b });
if (v == 0.0f)
- return lightenedBlack.colorWithAlpha(alpha());
+ return lightenedBlack.colorWithAlphaByte(alphaByte());
float multiplier = std::min(1.0f, v + 0.33f) / v;
Modified: trunk/Source/WebCore/platform/graphics/Color.h (264583 => 264584)
--- trunk/Source/WebCore/platform/graphics/Color.h 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/platform/graphics/Color.h 2020-07-19 20:07:07 UTC (rev 264584)
@@ -25,7 +25,6 @@
#pragma once
-#include "ColorBuilder.h"
#include "ColorSpace.h"
#include "ColorUtilities.h"
#include "ExtendedColor.h"
@@ -101,7 +100,7 @@
bool isOpaque() const { return isExtended() ? asExtended().alpha() == 1.0 : asInline().alpha == 255; }
bool isVisible() const { return isExtended() ? asExtended().alpha() > 0.0 : asInline().alpha > 0; }
- uint8_t alpha() const { return isExtended() ? convertToComponentByte(asExtended().alpha()) : asInline().alpha; }
+ uint8_t alphaByte() const { return isExtended() ? convertToComponentByte(asExtended().alpha()) : asInline().alpha; }
float alphaAsFloat() const { return isExtended() ? asExtended().alpha() : convertToComponentFloat(asInline().alpha); }
WEBCORE_EXPORT float luminance() const;
@@ -146,20 +145,20 @@
WEBCORE_EXPORT operator D2D1_VECTOR_4F() const;
#endif
- static constexpr auto black = ColorBuilder<SRGBA<uint8_t>> { 0, 0, 0 };
- static constexpr auto white = ColorBuilder<SRGBA<uint8_t>> { 255, 255, 255 };
- static constexpr auto darkGray = ColorBuilder<SRGBA<uint8_t>> { 128, 128, 128 };
- static constexpr auto gray = ColorBuilder<SRGBA<uint8_t>> { 160, 160, 160 };
- static constexpr auto lightGray = ColorBuilder<SRGBA<uint8_t>> { 192, 192, 192 };
- static constexpr auto transparent = ColorBuilder<SRGBA<uint8_t>> { };
- static constexpr auto cyan = ColorBuilder<SRGBA<uint8_t>> { 0, 255, 255 };
- static constexpr auto yellow = ColorBuilder<SRGBA<uint8_t>> { 255, 255, 0 };
- static constexpr auto red = ColorBuilder<SRGBA<uint8_t>> { 255, 0, 0 };
- static constexpr auto magenta = ColorBuilder<SRGBA<uint8_t>> { 255, 0, 255 };
- static constexpr auto blue = ColorBuilder<SRGBA<uint8_t>> { 0, 0, 255 };
- static constexpr auto green = ColorBuilder<SRGBA<uint8_t>> { 0, 255, 0 };
- static constexpr auto darkGreen = ColorBuilder<SRGBA<uint8_t>> { 0, 128, 0 };
- static constexpr auto orange = ColorBuilder<SRGBA<uint8_t>> { 255, 128, 0 };
+ static constexpr auto black = SRGBA<uint8_t> { 0, 0, 0 };
+ static constexpr auto white = SRGBA<uint8_t> { 255, 255, 255 };
+ static constexpr auto darkGray = SRGBA<uint8_t> { 128, 128, 128 };
+ static constexpr auto gray = SRGBA<uint8_t> { 160, 160, 160 };
+ static constexpr auto lightGray = SRGBA<uint8_t> { 192, 192, 192 };
+ static constexpr auto transparent = SRGBA<uint8_t> { };
+ static constexpr auto cyan = SRGBA<uint8_t> { 0, 255, 255 };
+ static constexpr auto yellow = SRGBA<uint8_t> { 255, 255, 0 };
+ static constexpr auto red = SRGBA<uint8_t> { 255, 0, 0 };
+ static constexpr auto magenta = SRGBA<uint8_t> { 255, 0, 255 };
+ static constexpr auto blue = SRGBA<uint8_t> { 0, 0, 255 };
+ static constexpr auto green = SRGBA<uint8_t> { 0, 255, 0 };
+ static constexpr auto darkGreen = SRGBA<uint8_t> { 0, 128, 0 };
+ static constexpr auto orange = SRGBA<uint8_t> { 255, 128, 0 };
bool isExtended() const { return !(m_colorData.inlineColorAndFlags & invalidInlineColor); }
bool isInline() const { return !isExtended(); }
Modified: trunk/Source/WebCore/platform/graphics/ColorBlending.cpp (264583 => 264584)
--- trunk/Source/WebCore/platform/graphics/ColorBlending.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/platform/graphics/ColorBlending.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -36,7 +36,7 @@
if (!backdrop.isVisible() || source.isOpaque())
return source;
- if (!source.alpha())
+ if (!source.isVisible())
return backdrop;
auto [backdropR, backdropG, backdropB, backdropA] = backdrop.toSRGBALossy<uint8_t>();
Deleted: trunk/Source/WebCore/platform/graphics/ColorBuilder.h (264583 => 264584)
--- trunk/Source/WebCore/platform/graphics/ColorBuilder.h 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/platform/graphics/ColorBuilder.h 2020-07-19 20:07:07 UTC (rev 264584)
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-namespace WebCore {
-
-// Helper to allow convenient syntax for working with color types.
-// e.g. auto yellowWith50PercentAlpha = Color::yellow.colorWithAlpha(128);
-template<typename ColorType> struct ColorBuilder : ColorType {
- using ColorType::ColorType;
-
- constexpr ColorType color() const
- {
- return *this;
- }
-
- constexpr ColorBuilder colorWithAlpha(uint8_t overrideAlpha) const
- {
- static_assert(std::is_same_v<decltype(ColorType().alpha), uint8_t>, "Only uint8_t based color types are supported.");
-
- auto copy = *this;
- copy.alpha = overrideAlpha;
- return copy;
- }
-};
-
-}
Modified: trunk/Source/WebCore/platform/graphics/ColorTypes.h (264583 => 264584)
--- trunk/Source/WebCore/platform/graphics/ColorTypes.h 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/platform/graphics/ColorTypes.h 2020-07-19 20:07:07 UTC (rev 264584)
@@ -42,7 +42,20 @@
static constexpr float maxValue = 1.0f;
};
-template<typename T> struct SRGBA {
+template<typename Parent> struct ColorWithAlphaHelper {
+ // Helper to allow convenient syntax for working with color types.
+ // e.g. auto yellowWith50PercentAlpha = Color::yellow.colorWithAlphaByte(128);
+ constexpr Parent colorWithAlphaByte(uint8_t overrideAlpha) const
+ {
+ static_assert(std::is_same_v<decltype(std::declval<Parent>().alpha), uint8_t>, "Only uint8_t based color types are supported.");
+
+ auto copy = *static_cast<const Parent*>(this);
+ copy.alpha = overrideAlpha;
+ return copy;
+ }
+};
+
+template<typename T> struct SRGBA : ColorWithAlphaHelper<SRGBA<T>> {
using ComponentType = T;
static constexpr auto colorSpace = ColorSpace::SRGB;
@@ -86,18 +99,29 @@
}
-template<typename T> struct LinearSRGBA {
+template<typename T> struct LinearSRGBA : ColorWithAlphaHelper<LinearSRGBA<T>> {
+ using ComponentType = T;
+ static constexpr auto colorSpace = ColorSpace::LinearRGB;
+
+ constexpr LinearSRGBA(T red, T green, T blue, T alpha = ComponentTraits<T>::maxValue)
+ : red { red }
+ , green { green }
+ , blue { blue }
+ , alpha { alpha }
+ {
+ }
+
+ constexpr LinearSRGBA()
+ : LinearSRGBA { ComponentTraits<T>::minValue, ComponentTraits<T>::minValue, ComponentTraits<T>::minValue, ComponentTraits<T>::minValue }
+ {
+ }
+
T red;
T green;
T blue;
T alpha;
-
- using ComponentType = T;
- static constexpr auto colorSpace = ColorSpace::LinearRGB;
};
-template<typename T> LinearSRGBA(T, T, T, T) -> LinearSRGBA<T>;
-
template<typename T> constexpr ColorComponents<T> asColorComponents(const LinearSRGBA<T>& c)
{
return { c.red, c.green, c.blue, c.alpha };
@@ -119,18 +143,29 @@
}
-template<typename T> struct DisplayP3 {
+template<typename T> struct DisplayP3 : ColorWithAlphaHelper<DisplayP3<T>> {
+ using ComponentType = T;
+ static constexpr auto colorSpace = ColorSpace::DisplayP3;
+
+ constexpr DisplayP3(T red, T green, T blue, T alpha = ComponentTraits<T>::maxValue)
+ : red { red }
+ , green { green }
+ , blue { blue }
+ , alpha { alpha }
+ {
+ }
+
+ constexpr DisplayP3()
+ : DisplayP3 { ComponentTraits<T>::minValue, ComponentTraits<T>::minValue, ComponentTraits<T>::minValue, ComponentTraits<T>::minValue }
+ {
+ }
+
T red;
T green;
T blue;
T alpha;
-
- using ComponentType = T;
- static constexpr auto colorSpace = ColorSpace::DisplayP3;
};
-template<typename T> DisplayP3(T, T, T, T) -> DisplayP3<T>;
-
template<typename T> constexpr ColorComponents<T> asColorComponents(const DisplayP3<T>& c)
{
return { c.red, c.green, c.blue, c.alpha };
@@ -152,17 +187,28 @@
}
-template<typename T> struct LinearDisplayP3 {
+template<typename T> struct LinearDisplayP3 : ColorWithAlphaHelper<LinearDisplayP3<T>> {
+ using ComponentType = T;
+
+ constexpr LinearDisplayP3(T red, T green, T blue, T alpha = ComponentTraits<T>::maxValue)
+ : red { red }
+ , green { green }
+ , blue { blue }
+ , alpha { alpha }
+ {
+ }
+
+ constexpr LinearDisplayP3()
+ : LinearDisplayP3 { ComponentTraits<T>::minValue, ComponentTraits<T>::minValue, ComponentTraits<T>::minValue, ComponentTraits<T>::minValue }
+ {
+ }
+
T red;
T green;
T blue;
T alpha;
-
- using ComponentType = T;
};
-template<typename T> LinearDisplayP3(T, T, T, T) -> LinearDisplayP3<T>;
-
template<typename T> constexpr ColorComponents<T> asColorComponents(const LinearDisplayP3<T>& c)
{
return { c.red, c.green, c.blue, c.alpha };
@@ -184,13 +230,26 @@
}
-template<typename T> struct HSLA {
+template<typename T> struct HSLA : ColorWithAlphaHelper<HSLA<T>> {
+ using ComponentType = T;
+
+ constexpr HSLA(T hue, T saturation, T lightness, T alpha = ComponentTraits<T>::maxValue)
+ : hue { hue }
+ , saturation { saturation }
+ , lightness { lightness }
+ , alpha { alpha }
+ {
+ }
+
+ constexpr HSLA()
+ : HSLA { ComponentTraits<T>::minValue, ComponentTraits<T>::minValue, ComponentTraits<T>::minValue, ComponentTraits<T>::minValue }
+ {
+ }
+
T hue;
T saturation;
T lightness;
T alpha;
-
- using ComponentType = T;
};
template<typename T> HSLA(T, T, T, T) -> HSLA<T>;
@@ -217,18 +276,30 @@
// FIXME: When ColorComponents supports more than length == 4, add conversion to/from ColorComponents<T> for CMYKA
-template<typename T> struct CMYKA {
+template<typename T> struct CMYKA : ColorWithAlphaHelper<CMYKA<T>> {
+ using ComponentType = T;
+
+ constexpr CMYKA(T cyan, T magenta, T yellow, T black, T alpha = ComponentTraits<T>::maxValue)
+ : cyan { cyan }
+ , magenta { magenta }
+ , yellow { yellow }
+ , black { black }
+ , alpha { alpha }
+ {
+ }
+
+ constexpr CMYKA()
+ : CMYKA { ComponentTraits<T>::minValue, ComponentTraits<T>::minValue, ComponentTraits<T>::minValue, ComponentTraits<T>::minValue, ComponentTraits<T>::minValue }
+ {
+ }
+
T cyan;
T magenta;
T yellow;
T black;
T alpha;
-
- using ComponentType = T;
};
-template<typename T> CMYKA(T, T, T, T, T) -> CMYKA<T>;
-
template<typename T> constexpr bool operator==(const CMYKA<T>& a, const CMYKA<T>& b)
{
return a.cyan == b.cyan && a.magenta == b.magenta && a.yellow == b.yellow && a.black == b.black && a.alpha == b.alpha;
@@ -240,17 +311,28 @@
}
-template<typename T> struct XYZA {
+template<typename T> struct XYZA : ColorWithAlphaHelper<XYZA<T>> {
+ using ComponentType = T;
+
+ constexpr XYZA(T x, T y, T z, T alpha = ComponentTraits<T>::maxValue)
+ : x { x }
+ , y { y }
+ , z { z }
+ , alpha { alpha }
+ {
+ }
+
+ constexpr XYZA()
+ : XYZA { ComponentTraits<T>::minValue, ComponentTraits<T>::minValue, ComponentTraits<T>::minValue, ComponentTraits<T>::minValue }
+ {
+ }
+
T x;
T y;
T z;
T alpha;
-
- using ComponentType = T;
};
-template<typename T> XYZA(T, T, T, T) -> XYZA<T>;
-
template<typename T> constexpr ColorComponents<T> asColorComponents(const XYZA<T>& c)
{
return { c.x, c.y, c.z, c.alpha };
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (264583 => 264584)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -598,7 +598,7 @@
width = 2;
if (needsBackdrop()) {
- color = Color::magenta.colorWithAlpha(128); // has backdrop: magenta
+ color = Color::magenta.colorWithAlphaByte(128); // has backdrop: magenta
width = 12;
return;
}
@@ -605,7 +605,7 @@
if (drawsContent()) {
if (tiledBacking()) {
- color = Color::orange.colorWithAlpha(128); // tiled layer: orange
+ color = Color::orange.colorWithAlphaByte(128); // tiled layer: orange
return;
}
@@ -625,7 +625,7 @@
return;
}
- color = Color::yellow.colorWithAlpha(192); // container: yellow
+ color = Color::yellow.colorWithAlphaByte(192); // container: yellow
}
void GraphicsLayer::updateDebugIndicators()
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (264583 => 264584)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -1590,8 +1590,8 @@
// Use having a transform as a key to making the tile wash layer. If every layer gets a wash,
// they start to obscure useful information.
if ((!m_transform.isIdentity() || tiledBacking()) && !m_visibleTileWashLayer) {
- constexpr auto washFillColor = Color::red.colorWithAlpha(50);
- constexpr auto washBorderColor = Color::red.colorWithAlpha(100);
+ constexpr auto washFillColor = Color::red.colorWithAlphaByte(50);
+ constexpr auto washBorderColor = Color::red.colorWithAlphaByte(100);
m_visibleTileWashLayer = createPlatformCALayer(PlatformCALayer::LayerTypeLayer, this);
String name = makeString("Visible Tile Wash Layer 0x", hex(reinterpret_cast<uintptr_t>(m_visibleTileWashLayer->platformLayer()), Lowercase));
Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp (264583 => 264584)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -87,8 +87,8 @@
constexpr auto backgroundColor = SRGBA<uint8_t> { 128, 64, 255 };
constexpr auto acceleratedContextLabelColor = Color::red;
constexpr auto unacceleratedContextLabelColor = Color::white;
- constexpr auto linearGlyphMaskOutlineColor = Color::black.colorWithAlpha(192);
- constexpr auto displayListBorderColor = Color::black.colorWithAlpha(166);
+ constexpr auto linearGlyphMaskOutlineColor = Color::black.colorWithAlphaByte(192);
+ constexpr auto displayListBorderColor = Color::black.colorWithAlphaByte(166);
TextRun textRun(String::number(repaintCount));
Modified: trunk/Source/WebCore/platform/graphics/ca/TileCoverageMap.cpp (264583 => 264584)
--- trunk/Source/WebCore/platform/graphics/ca/TileCoverageMap.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/platform/graphics/ca/TileCoverageMap.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -51,7 +51,7 @@
m_visibleViewportIndicatorLayer.get().setName("visible viewport indicator");
m_visibleViewportIndicatorLayer.get().setBorderWidth(2);
m_visibleViewportIndicatorLayer.get().setAnchorPoint(FloatPoint3D());
- m_visibleViewportIndicatorLayer.get().setBorderColor(Color::red.colorWithAlpha(200));
+ m_visibleViewportIndicatorLayer.get().setBorderColor(Color::red.colorWithAlphaByte(200));
m_layoutViewportIndicatorLayer.get().setName("layout viewport indicator");
m_layoutViewportIndicatorLayer.get().setBorderWidth(2);
Modified: trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp (264583 => 264584)
--- trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/platform/mock/ScrollbarThemeMock.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -46,7 +46,7 @@
void ScrollbarThemeMock::paintTrackBackground(GraphicsContext& context, Scrollbar& scrollbar, const IntRect& trackRect)
{
- context.fillRect(trackRect, scrollbar.enabled() ? Color::lightGray.color() : SRGBA<uint8_t> { 224, 224, 224 });
+ context.fillRect(trackRect, scrollbar.enabled() ? Color::lightGray : SRGBA<uint8_t> { 224, 224, 224 });
}
void ScrollbarThemeMock::paintThumb(GraphicsContext& context, Scrollbar& scrollbar, const IntRect& thumbRect)
Modified: trunk/Source/WebCore/platform/win/DragImageWin.cpp (264583 => 264584)
--- trunk/Source/WebCore/platform/win/DragImageWin.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/platform/win/DragImageWin.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -196,7 +196,7 @@
// Draw the text
constexpr auto topColor = Color::black; // original alpha = 0.75
- constexpr auto bottomColor = Color::white.colorWithAlpha(127); // original alpha = 0.5
+ constexpr auto bottomColor = Color::white.colorWithAlphaByte(127); // original alpha = 0.5
if (drawURLString) {
if (clipURLString)
urlString = StringTruncator::rightTruncate(urlString, imageSize.width() - (DragLabelBorderX * 2.0f), *urlFont);
Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (264583 => 264584)
--- trunk/Source/WebCore/rendering/InlineTextBox.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -853,7 +853,7 @@
Color selectionBackgroundColor = renderer().selectionBackgroundColor();
style.backgroundColor = selectionBackgroundColor;
- if (selectionBackgroundColor.isValid() && selectionBackgroundColor.alpha() && style.textStyles.fillColor == selectionBackgroundColor)
+ if (selectionBackgroundColor.isValid() && selectionBackgroundColor.isVisible() && style.textStyles.fillColor == selectionBackgroundColor)
style.backgroundColor = selectionBackgroundColor.invertedColorWithAlpha(1.0);
break;
}
Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (264583 => 264584)
--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -77,7 +77,7 @@
static constexpr auto replacementTextRoundedRectPressedColor = SRGBA<uint8_t> { 105, 105, 105, 242 };
static constexpr auto replacementTextRoundedRectColor = SRGBA<uint8_t> { 125, 125, 125, 242 };
static constexpr auto replacementTextColor = SRGBA<uint8_t> { 240, 240, 240 };
-static constexpr auto unavailablePluginBorderColor = Color::white.colorWithAlpha(216);
+static constexpr auto unavailablePluginBorderColor = Color::white.colorWithAlphaByte(216);
RenderEmbeddedObject::RenderEmbeddedObject(HTMLFrameOwnerElement& element, RenderStyle&& style)
: RenderWidget(element, WTFMove(style))
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (264583 => 264584)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -3161,7 +3161,7 @@
return 0;
};
- constexpr auto fillColor = Color::black.colorWithAlpha(128);
+ constexpr auto fillColor = Color::black.colorWithAlphaByte(128);
static const PatternDescription patternDescriptions[] = {
{ "auto"_s, { }, fillColor },
@@ -3183,7 +3183,7 @@
#if ENABLE(WHEEL_EVENT_REGIONS)
static RefPtr<Pattern> patternForEventListenerRegionType(EventListenerRegionType type, FloatSize contentOffset, GraphicsContext& destContext)
{
- constexpr auto fillColor = Color::darkGreen.colorWithAlpha(128);
+ constexpr auto fillColor = Color::darkGreen.colorWithAlphaByte(128);
auto patternAndPhase = [&]() -> PatternDescription {
switch (type) {
@@ -3220,7 +3220,7 @@
#if ENABLE(TOUCH_ACTION_REGIONS)
// Paint rects for touch action.
if (visibleDebugOverlayRegions & TouchActionRegion) {
- constexpr auto regionColor = Color::blue.colorWithAlpha(50);
+ constexpr auto regionColor = Color::blue.colorWithAlphaByte(50);
context.setFillColor(regionColor);
for (auto rect : eventRegion.region().rects())
context.fillRect(rect);
Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (264583 => 264584)
--- trunk/Source/WebCore/rendering/RenderTheme.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -1527,7 +1527,7 @@
{
// This color is expected to be drawn on a semi-transparent overlay,
// making it more transparent than its alpha value indicates.
- return Color::black.colorWithAlpha(102);
+ return Color::black.colorWithAlphaByte(102);
}
#endif
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (264583 => 264584)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2020-07-19 20:07:07 UTC (rev 264584)
@@ -330,10 +330,10 @@
context.clip(border.rect());
if (isChecked(box)) {
- ASSERT(style.visitedDependentColor(CSSPropertyBorderTopColor).alpha() % 255 == 0);
- ASSERT(style.visitedDependentColor(CSSPropertyBorderRightColor).alpha() % 255 == 0);
- ASSERT(style.visitedDependentColor(CSSPropertyBorderBottomColor).alpha() % 255 == 0);
- ASSERT(style.visitedDependentColor(CSSPropertyBorderLeftColor).alpha() % 255 == 0);
+ ASSERT(style.visitedDependentColor(CSSPropertyBorderTopColor).alphaByte() % 255 == 0);
+ ASSERT(style.visitedDependentColor(CSSPropertyBorderRightColor).alphaByte() % 255 == 0);
+ ASSERT(style.visitedDependentColor(CSSPropertyBorderBottomColor).alphaByte() % 255 == 0);
+ ASSERT(style.visitedDependentColor(CSSPropertyBorderLeftColor).alphaByte() % 255 == 0);
}
return border.rect();
@@ -381,7 +381,7 @@
if (checked || indeterminate) {
auto border = box.style().getRoundedBorderFor(rect);
- paintInfo.context().fillRoundedRect(border.pixelSnappedRoundedRectForPainting(box.document().deviceScaleFactor()), Color::black.colorWithAlpha(204));
+ paintInfo.context().fillRoundedRect(border.pixelSnappedRoundedRectForPainting(box.document().deviceScaleFactor()), Color::black.colorWithAlphaByte(204));
auto clip = addRoundedBorderClip(box, paintInfo.context(), rect);
auto width = clip.width();
@@ -417,10 +417,10 @@
}
lineWidth = std::max<float>(lineWidth, 1);
- drawJoinedLines(cgContext, Vector<CGPoint> { WTFMove(shadow) }, kCGLineCapSquare, lineWidth, Color::black.colorWithAlpha(179));
+ drawJoinedLines(cgContext, Vector<CGPoint> { WTFMove(shadow) }, kCGLineCapSquare, lineWidth, Color::black.colorWithAlphaByte(179));
lineWidth = std::max<float>(std::min(width, height) * thicknessRatio, 1);
- drawJoinedLines(cgContext, Vector<CGPoint> { WTFMove(line) }, kCGLineCapButt, lineWidth, Color::white.colorWithAlpha(240));
+ drawJoinedLines(cgContext, Vector<CGPoint> { WTFMove(line) }, kCGLineCapButt, lineWidth, Color::white.colorWithAlphaByte(240));
} else {
auto clip = addRoundedBorderClip(box, paintInfo.context(), rect);
auto width = clip.width();
@@ -478,7 +478,7 @@
if (isChecked(box)) {
auto border = box.style().getRoundedBorderFor(rect);
- paintInfo.context().fillRoundedRect(border.pixelSnappedRoundedRectForPainting(box.document().deviceScaleFactor()), Color::black.colorWithAlpha(204));
+ paintInfo.context().fillRoundedRect(border.pixelSnappedRoundedRectForPainting(box.document().deviceScaleFactor()), Color::black.colorWithAlphaByte(204));
auto clip = addRoundedBorderClip(box, paintInfo.context(), rect);
drawAxialGradient(cgContext, gradientWithName(ConcaveGradient), clip.location(), FloatPoint(clip.x(), clip.maxY()), LinearInterpolation);
@@ -491,7 +491,7 @@
clip.inflateX(-clip.width() * InnerInverseRatio);
clip.inflateY(-clip.height() * InnerInverseRatio);
- constexpr auto shadowColor = Color::black.colorWithAlpha(179);
+ constexpr auto shadowColor = Color::black.colorWithAlphaByte(179);
paintInfo.context().drawRaisedEllipse(clip, Color::white, shadowColor);
FloatSize radius(clip.width() / 2.0f, clip.height() / 2.0f);
@@ -739,7 +739,7 @@
FloatRect ellipse(buttonClip.x() + (buttonClip.width() - count * (size + padding) + padding) / 2.0, buttonClip.maxY() - 10.0, size, size);
for (int i = 0; i < count; ++i) {
- paintInfo.context().drawRaisedEllipse(ellipse, Color::white, Color::black.colorWithAlpha(128));
+ paintInfo.context().drawRaisedEllipse(ellipse, Color::white, Color::black.colorWithAlphaByte(128));
ellipse.move(size + padding, 0);
}
} else {
@@ -759,8 +759,8 @@
};
uint8_t opacity = isReadOnlyControl(box) ? 51 : 128;
- paintInfo.context().setStrokeColor(Color::black.colorWithAlpha(opacity));
- paintInfo.context().setFillColor(Color::black.colorWithAlpha(opacity));
+ paintInfo.context().setStrokeColor(Color::black.colorWithAlphaByte(opacity));
+ paintInfo.context().setFillColor(Color::black.colorWithAlphaByte(opacity));
paintInfo.context().drawPath(Path::polygonPathFromPoints(shadow));
paintInfo.context().setStrokeColor(Color::white);
@@ -1856,7 +1856,7 @@
// Draw a drop shadow around the circle.
// Use the GraphicsContext function, because it calculates the blur radius in context space,
// rather than screen space.
- constexpr auto shadowColor = Color::black.colorWithAlpha(26);
+ constexpr auto shadowColor = Color::black.colorWithAlphaByte(26);
graphicsContext.setShadow(FloatSize { }, 16, shadowColor);
// The circle must have an alpha channel value of 1 for the shadow color to appear.
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (264583 => 264584)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2020-07-19 20:07:07 UTC (rev 264584)
@@ -1592,8 +1592,8 @@
};
paintInfo.context().fillPath(Path::polygonPathFromPoints(arrow2));
- constexpr auto leftSeparatorColor = Color::black.colorWithAlpha(40);
- constexpr auto rightSeparatorColor = Color::white.colorWithAlpha(40);
+ constexpr auto leftSeparatorColor = Color::black.colorWithAlphaByte(40);
+ constexpr auto rightSeparatorColor = Color::white.colorWithAlphaByte(40);
// FIXME: Should the separator thickness and space be scaled up by fontScale?
int separatorSpace = 2; // Deliberately ignores zoom since it looks nicer if it stays thin.
@@ -2413,8 +2413,8 @@
const CGFloat attachmentIconBackgroundRadius = 3;
const CGFloat attachmentIconToTitleMargin = 2;
-constexpr auto attachmentIconBackgroundColor = Color::black.colorWithAlpha(30);
-constexpr auto attachmentIconBorderColor = Color::white.colorWithAlpha(125);
+constexpr auto attachmentIconBackgroundColor = Color::black.colorWithAlphaByte(30);
+constexpr auto attachmentIconBorderColor = Color::white.colorWithAlphaByte(125);
const CGFloat attachmentTitleFontSize = 12;
const CGFloat attachmentTitleBackgroundRadius = 3;
@@ -2433,12 +2433,12 @@
const CGFloat attachmentProgressBarHeight = 5;
const CGFloat attachmentProgressBarOffset = -9;
const CGFloat attachmentProgressBarBorderWidth = 1;
-constexpr auto attachmentProgressBarBackgroundColor = Color::black.colorWithAlpha(89);
+constexpr auto attachmentProgressBarBackgroundColor = Color::black.colorWithAlphaByte(89);
constexpr auto attachmentProgressBarFillColor = Color::white;
-constexpr auto attachmentProgressBarBorderColor = Color::black.colorWithAlpha(128);
+constexpr auto attachmentProgressBarBorderColor = Color::black.colorWithAlphaByte(128);
const CGFloat attachmentPlaceholderBorderRadius = 5;
-constexpr auto attachmentPlaceholderBorderColor = Color::black.colorWithAlpha(56);
+constexpr auto attachmentPlaceholderBorderColor = Color::black.colorWithAlphaByte(56);
const CGFloat attachmentPlaceholderBorderWidth = 2;
const CGFloat attachmentPlaceholderBorderDashLength = 6;
Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp (264583 => 264584)
--- trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -102,7 +102,7 @@
std::unique_ptr<ShadowData> debugShadow = nullptr;
if (flow.settings().simpleLineLayoutDebugBordersEnabled()) {
- debugShadow = makeUnique<ShadowData>(IntPoint(0, 0), 10, 20, ShadowStyle::Normal, true, Color::green.colorWithAlpha(200));
+ debugShadow = makeUnique<ShadowData>(IntPoint(0, 0), 10, 20, ShadowStyle::Normal, true, Color::green.colorWithAlphaByte(200));
textPainter.setShadow(debugShadow.get());
}
Modified: trunk/Source/WebCore/testing/cocoa/WebViewVisualIdentificationOverlay.mm (264583 => 264584)
--- trunk/Source/WebCore/testing/cocoa/WebViewVisualIdentificationOverlay.mm 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebCore/testing/cocoa/WebViewVisualIdentificationOverlay.mm 2020-07-19 20:07:07 UTC (rev 264584)
@@ -91,7 +91,7 @@
_layer = adoptNS([[CATiledLayer alloc] init]);
[_layer setName:@"WebViewVisualIdentificationOverlay"];
[_layer setFrame:CGRectMake(0, 0, [_view bounds].size.width, [_view bounds].size.height)];
- auto viewColor = isDeprecated ? WebCore::Color::red.colorWithAlpha(50) : WebCore::Color::blue.colorWithAlpha(32);
+ auto viewColor = isDeprecated ? WebCore::Color::red.colorWithAlphaByte(50) : WebCore::Color::blue.colorWithAlphaByte(32);
[_layer setBackgroundColor:cachedCGColor(viewColor)];
[_layer setZPosition:999];
[_layer setDelegate:self];
Modified: trunk/Source/WebKit/ChangeLog (264583 => 264584)
--- trunk/Source/WebKit/ChangeLog 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebKit/ChangeLog 2020-07-19 20:07:07 UTC (rev 264584)
@@ -1,3 +1,16 @@
+2020-07-19 Sam Weinig <[email protected]>
+
+ Remove ColorBuilder
+ https://bugs.webkit.org/show_bug.cgi?id=214521
+
+ Reviewed by Darin Adler.
+
+ * WebProcess/Inspector/WebInspectorClient.cpp:
+ (WebKit::WebInspectorClient::showPaintRect):
+ * WebProcess/WebPage/FindController.cpp:
+ (WebKit::FindController::drawRect):
+ Update for rename from colorWithAlpha to colorWithAlphaByte.
+
2020-07-19 Michael Catanzaro <[email protected]>
Enable cross-platform release logging in ResourceLoadStatisticsDatabaseStore.cpp
Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspectorClient.cpp (264583 => 264584)
--- trunk/Source/WebKit/WebProcess/Inspector/WebInspectorClient.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspectorClient.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -177,7 +177,7 @@
paintLayer->setAnchorPoint(FloatPoint3D());
paintLayer->setPosition(rect.location());
paintLayer->setSize(rect.size());
- paintLayer->setBackgroundColor(Color::red.colorWithAlpha(51));
+ paintLayer->setBackgroundColor(Color::red.colorWithAlphaByte(51));
KeyframeValueList fadeKeyframes(AnimatedPropertyOpacity);
fadeKeyframes.insert(makeUnique<FloatAnimationValue>(0, 1));
Modified: trunk/Source/WebKit/WebProcess/WebPage/FindController.cpp (264583 => 264584)
--- trunk/Source/WebKit/WebProcess/WebPage/FindController.cpp 2020-07-19 19:57:02 UTC (rev 264583)
+++ trunk/Source/WebKit/WebProcess/WebPage/FindController.cpp 2020-07-19 20:07:07 UTC (rev 264584)
@@ -509,7 +509,7 @@
const int borderWidth = 1;
constexpr auto overlayBackgroundColor = SRGBA<uint8_t> { 26, 26, 26, 64 };
- constexpr auto shadowColor = Color::black.colorWithAlpha(128);
+ constexpr auto shadowColor = Color::black.colorWithAlphaByte(128);
IntRect borderInflatedDirtyRect = dirtyRect;
borderInflatedDirtyRect.inflate(borderWidth);