Diff
Modified: trunk/Source/WebCore/ChangeLog (268063 => 268064)
--- trunk/Source/WebCore/ChangeLog 2020-10-06 19:08:30 UTC (rev 268063)
+++ trunk/Source/WebCore/ChangeLog 2020-10-06 19:36:02 UTC (rev 268064)
@@ -1,3 +1,34 @@
+2020-10-06 Alex Christensen <achristen...@webkit.org>
+
+ Rename namespace Packed to namespace PackedColor
+ https://bugs.webkit.org/show_bug.cgi?id=217391
+
+ Reviewed by Simon Fraser.
+
+ Otherwise "using WTF::Packed;" in wtf/Packed.h causes problems if both headers are included in the same translation unit.
+
+ * css/StyleColor.cpp:
+ (WebCore::StyleColor::colorFromKeyword):
+ * css/parser/CSSParserFastPaths.cpp:
+ (WebCore::finishParsingHexColor):
+ (WebCore::finishParsingNamedColor):
+ * platform/graphics/Color.h:
+ (WebCore::Color::asInline const):
+ (WebCore::Color::setColor):
+ (WebCore::Color::encode const):
+ (WebCore::Color::decode):
+ * platform/graphics/ColorTypes.h:
+ (WebCore::asSRGBA):
+ (WebCore::Packed::RGBA::RGBA): Deleted.
+ (WebCore::Packed::ARGB::ARGB): Deleted.
+ * platform/graphics/ImageBackingStore.h:
+ (WebCore::ImageBackingStore::blendPixel):
+ (WebCore::ImageBackingStore::pixelValue const):
+ * platform/graphics/cg/ColorCG.cpp:
+ (WebCore::cachedCGColor):
+ * platform/graphics/mac/ColorMac.mm:
+ (WebCore::nsColor):
+
2020-10-06 Zalan Bujtas <za...@apple.com>
[LFC][Floating] Remove redundant FormattingContextRoot in FloatingContext c'tor
Modified: trunk/Source/WebCore/css/StyleColor.cpp (268063 => 268064)
--- trunk/Source/WebCore/css/StyleColor.cpp 2020-10-06 19:08:30 UTC (rev 268063)
+++ trunk/Source/WebCore/css/StyleColor.cpp 2020-10-06 19:36:02 UTC (rev 268064)
@@ -41,7 +41,7 @@
{
if (const char* valueName = getValueName(keyword)) {
if (const NamedColor* namedColor = findColor(valueName, strlen(valueName)))
- return asSRGBA(Packed::ARGB { namedColor->ARGBValue });
+ return asSRGBA(PackedColor::ARGB { namedColor->ARGBValue });
}
return RenderTheme::singleton().systemColor(keyword, options);
Modified: trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp (268063 => 268064)
--- trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp 2020-10-06 19:08:30 UTC (rev 268063)
+++ trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp 2020-10-06 19:36:02 UTC (rev 268064)
@@ -414,9 +414,9 @@
switch (length) {
case 3:
// #abc converts to #aabbcc
- // FIXME: Replace conversion to Packed::ARGB with simpler bit math to construct
+ // FIXME: Replace conversion to PackedColor::ARGB with simpler bit math to construct
// the SRGBA<uint8_t> directly.
- return asSRGBA(Packed::ARGB {
+ return asSRGBA(PackedColor::ARGB {
0xFF000000
| (value & 0xF00) << 12 | (value & 0xF00) << 8
| (value & 0xF0) << 8 | (value & 0xF0) << 4
@@ -423,19 +423,19 @@
| (value & 0xF) << 4 | (value & 0xF) });
case 4:
// #abcd converts to ddaabbcc since alpha bytes are the high bytes.
- // FIXME: Replace conversion to Packed::ARGB with simpler bit math to construct
+ // FIXME: Replace conversion to PackedColor::ARGB with simpler bit math to construct
// the SRGBA<uint8_t> directly.
- return asSRGBA(Packed::ARGB {
+ return asSRGBA(PackedColor::ARGB {
(value & 0xF) << 28 | (value & 0xF) << 24
| (value & 0xF000) << 8 | (value & 0xF000) << 4
| (value & 0xF00) << 4 | (value & 0xF00)
| (value & 0xF0) | (value & 0xF0) >> 4 });
case 6:
- // FIXME: Replace conversion to Packed::ARGB with simpler bit math to construct
+ // FIXME: Replace conversion to PackedColor::ARGB with simpler bit math to construct
// the SRGBA<uint8_t> directly.
- return asSRGBA(Packed::ARGB { 0xFF000000 | value });
+ return asSRGBA(PackedColor::ARGB { 0xFF000000 | value });
case 8:
- return asSRGBA(Packed::RGBA { value });
+ return asSRGBA(PackedColor::RGBA { value });
}
return WTF::nullopt;
}
@@ -539,7 +539,7 @@
auto namedColor = findColor(buffer, length);
if (!namedColor)
return WTF::nullopt;
- return asSRGBA(Packed::ARGB { namedColor->ARGBValue });
+ return asSRGBA(PackedColor::ARGB { namedColor->ARGBValue });
}
template<typename CharacterType> static Optional<SRGBA<uint8_t>> parseNamedColorInternal(const CharacterType* characters, unsigned length)
Modified: trunk/Source/WebCore/platform/graphics/Color.h (268063 => 268064)
--- trunk/Source/WebCore/platform/graphics/Color.h 2020-10-06 19:08:30 UTC (rev 268063)
+++ trunk/Source/WebCore/platform/graphics/Color.h 2020-10-06 19:36:02 UTC (rev 268064)
@@ -393,12 +393,12 @@
inline SRGBA<uint8_t> Color::asInline() const
{
ASSERT(isInline());
- return asSRGBA(Packed::RGBA { static_cast<uint32_t>(m_colorData.inlineColorAndFlags >> 32) });
+ return asSRGBA(PackedColor::RGBA { static_cast<uint32_t>(m_colorData.inlineColorAndFlags >> 32) });
}
inline void Color::setColor(SRGBA<uint8_t> color)
{
- m_colorData.inlineColorAndFlags = static_cast<uint64_t>(Packed::RGBA { color }.value) << 32;
+ m_colorData.inlineColorAndFlags = static_cast<uint64_t>(PackedColor::RGBA { color }.value) << 32;
tagAsValid();
}
@@ -465,7 +465,7 @@
// FIXME: This should encode whether the color is semantic.
encoder << true;
- encoder << Packed::RGBA { asInline() }.value;
+ encoder << PackedColor::RGBA { asInline() }.value;
}
template<class Decoder> Optional<Color> Color::decode(Decoder& decoder)
@@ -504,7 +504,7 @@
if (!decoder.decode(value))
return WTF::nullopt;
- return Color { asSRGBA(Packed::RGBA { value }) };
+ return Color { asSRGBA(PackedColor::RGBA { value }) };
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/ColorTypes.h (268063 => 268064)
--- trunk/Source/WebCore/platform/graphics/ColorTypes.h 2020-10-06 19:08:30 UTC (rev 268063)
+++ trunk/Source/WebCore/platform/graphics/ColorTypes.h 2020-10-06 19:36:02 UTC (rev 268064)
@@ -356,7 +356,7 @@
// Packed Color Formats
-namespace Packed {
+namespace PackedColor {
struct RGBA {
constexpr explicit RGBA(uint32_t rgba)
@@ -388,12 +388,12 @@
}
-constexpr SRGBA<uint8_t> asSRGBA(Packed::RGBA color)
+constexpr SRGBA<uint8_t> asSRGBA(PackedColor::RGBA color)
{
return { static_cast<uint8_t>(color.value >> 24), static_cast<uint8_t>(color.value >> 16), static_cast<uint8_t>(color.value >> 8), static_cast<uint8_t>(color.value) };
}
-constexpr SRGBA<uint8_t> asSRGBA(Packed::ARGB color)
+constexpr SRGBA<uint8_t> asSRGBA(PackedColor::ARGB color)
{
return { static_cast<uint8_t>(color.value >> 16), static_cast<uint8_t>(color.value >> 8), static_cast<uint8_t>(color.value), static_cast<uint8_t>(color.value >> 24) };
}
Modified: trunk/Source/WebCore/platform/graphics/ImageBackingStore.h (268063 => 268064)
--- trunk/Source/WebCore/platform/graphics/ImageBackingStore.h 2020-10-06 19:08:30 UTC (rev 268063)
+++ trunk/Source/WebCore/platform/graphics/ImageBackingStore.h 2020-10-06 19:36:02 UTC (rev 268064)
@@ -152,7 +152,7 @@
if (!a)
return;
- auto pixel = asSRGBA(Packed::ARGB { *dest });
+ auto pixel = asSRGBA(PackedColor::ARGB { *dest });
if (a >= 255 || !pixel.alpha) {
setPixel(dest, r, g, b, a);
@@ -174,7 +174,7 @@
if (!m_premultiplyAlpha)
result = unpremultiplied(result);
- *dest = Packed::ARGB { result }.value;
+ *dest = PackedColor::ARGB { result }.value;
}
static bool isOverSize(const IntSize& size)
@@ -231,7 +231,7 @@
if (m_premultiplyAlpha && a < 255)
result = premultipliedFlooring(result);
- return Packed::ARGB { result }.value;
+ return PackedColor::ARGB { result }.value;
}
RefPtr<SharedBuffer::DataSegment> m_pixels;
Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp (268063 => 268064)
--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp 2020-10-06 19:08:30 UTC (rev 268063)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoImageSurfaceBackend.cpp 2020-10-06 19:36:02 UTC (rev 268064)
@@ -81,9 +81,9 @@
unsigned* row = reinterpret_cast_ptr<unsigned*>(dataSrc + stride * y);
for (int x = 0; x < m_logicalSize.width(); x++) {
unsigned* pixel = row + x;
- auto pixelComponents = unpremultiplied(asSRGBA(Packed::ARGB { *pixel }));
+ auto pixelComponents = unpremultiplied(asSRGBA(PackedColor::ARGB { *pixel }));
pixelComponents = { lookUpTable[pixelComponents.red], lookUpTable[pixelComponents.green], lookUpTable[pixelComponents.blue], pixelComponents.alpha };
- *pixel = Packed::ARGB { premultipliedCeiling(pixelComponents) }.value;
+ *pixel = PackedColor::ARGB { premultipliedCeiling(pixelComponents) }.value;
}
}
cairo_surface_mark_dirty_rectangle(m_surface.get(), 0, 0, m_logicalSize.width(), m_logicalSize.height());
Modified: trunk/Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp (268063 => 268064)
--- trunk/Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp 2020-10-06 19:08:30 UTC (rev 268063)
+++ trunk/Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp 2020-10-06 19:36:02 UTC (rev 268064)
@@ -54,7 +54,7 @@
return Color();
unsigned* pixel = reinterpret_cast_ptr<unsigned*>(cairo_image_surface_get_data(image.get()));
- return unpremultiplied(asSRGBA(Packed::ARGB { *pixel }));
+ return unpremultiplied(asSRGBA(PackedColor::ARGB { *pixel }));
}
void drawNativeImage(const NativeImagePtr& image, GraphicsContext& context, const FloatRect& destRect, const FloatRect& srcRect, const IntSize& imageSize, const ImagePaintingOptions& options)
Modified: trunk/Source/WebCore/platform/graphics/cg/ColorCG.cpp (268063 => 268064)
--- trunk/Source/WebCore/platform/graphics/cg/ColorCG.cpp 2020-10-06 19:08:30 UTC (rev 268063)
+++ trunk/Source/WebCore/platform/graphics/cg/ColorCG.cpp 2020-10-06 19:36:02 UTC (rev 268064)
@@ -117,16 +117,16 @@
CGColorRef cachedCGColor(const Color& color)
{
if (color.isInline()) {
- switch (Packed::RGBA { color.asInline() }.value) {
- case Packed::RGBA { Color::transparentBlack }.value: {
+ switch (PackedColor::RGBA { color.asInline() }.value) {
+ case PackedColor::RGBA { Color::transparentBlack }.value: {
static CGColorRef transparentCGColor = leakCGColor(color);
return transparentCGColor;
}
- case Packed::RGBA { Color::black }.value: {
+ case PackedColor::RGBA { Color::black }.value: {
static CGColorRef blackCGColor = leakCGColor(color);
return blackCGColor;
}
- case Packed::RGBA { Color::white }.value: {
+ case PackedColor::RGBA { Color::white }.value: {
static CGColorRef whiteCGColor = leakCGColor(color);
return whiteCGColor;
}
Modified: trunk/Source/WebCore/platform/graphics/mac/ColorMac.mm (268063 => 268064)
--- trunk/Source/WebCore/platform/graphics/mac/ColorMac.mm 2020-10-06 19:08:30 UTC (rev 268063)
+++ trunk/Source/WebCore/platform/graphics/mac/ColorMac.mm 2020-10-06 19:36:02 UTC (rev 268064)
@@ -114,16 +114,16 @@
NSColor *nsColor(const Color& color)
{
if (color.isInline()) {
- switch (Packed::RGBA { color.asInline() }.value) {
- case Packed::RGBA { Color::transparentBlack }.value: {
+ switch (PackedColor::RGBA { color.asInline() }.value) {
+ case PackedColor::RGBA { Color::transparentBlack }.value: {
static NSColor *clearColor = [[NSColor colorWithSRGBRed:0 green:0 blue:0 alpha:0] retain];
return clearColor;
}
- case Packed::RGBA { Color::black }.value: {
+ case PackedColor::RGBA { Color::black }.value: {
static NSColor *blackColor = [[NSColor colorWithSRGBRed:0 green:0 blue:0 alpha:1] retain];
return blackColor;
}
- case Packed::RGBA { Color::white }.value: {
+ case PackedColor::RGBA { Color::white }.value: {
static NSColor *whiteColor = [[NSColor colorWithSRGBRed:1 green:1 blue:1 alpha:1] retain];
return whiteColor;
}