Diff
Modified: trunk/Source/WebCore/ChangeLog (259803 => 259804)
--- trunk/Source/WebCore/ChangeLog 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/ChangeLog 2020-04-09 16:18:19 UTC (rev 259804)
@@ -1,3 +1,37 @@
+2020-04-09 Alex Christensen <achristen...@webkit.org>
+
+ IPC serialization of enums should serialize std::underlying_type instead of uint64_t
+ https://bugs.webkit.org/show_bug.cgi?id=210228
+
+ Reviewed by Chris Dumez and Darin Adler.
+
+ No change in behavior, other than less memory and time spent in IPC code.
+
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::drawTextInternal):
+ * platform/graphics/GraphicsContext.cpp:
+ (WebCore::GraphicsContextStateChange::dump const):
+ * platform/graphics/GraphicsContext.h:
+ * platform/graphics/ca/PlatformCALayer.cpp:
+ (WebCore::PlatformCALayer::drawRepaintIndicator):
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::GraphicsContext::setPlatformTextDrawingMode):
+ * platform/graphics/cocoa/FontCascadeCocoa.mm:
+ (WebCore::shouldUseLetterpressEffect):
+ (WebCore::FontCascade::drawGlyphs):
+ * platform/mock/MockRealtimeVideoSource.cpp:
+ (WebCore::MockRealtimeVideoSource::drawText):
+ * rendering/TextPaintStyle.cpp:
+ (WebCore::updateGraphicsContext):
+ * rendering/TextPainter.cpp:
+ (WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded):
+ * rendering/svg/RenderSVGResourceGradient.cpp:
+ (WebCore::RenderSVGResourceGradient::applyResource):
+ * rendering/svg/RenderSVGResourcePattern.cpp:
+ (WebCore::RenderSVGResourcePattern::applyResource):
+ * rendering/svg/RenderSVGResourceSolidColor.cpp:
+ (WebCore::RenderSVGResourceSolidColor::applyResource):
+
2020-04-09 Antti Koivisto <an...@apple.com>
Use more WeakPtr in RenderTreeBuilder::FirstLetter
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (259803 => 259804)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2020-04-09 16:18:19 UTC (rev 259804)
@@ -558,7 +558,7 @@
maskImageContext.setStrokeThickness(c->strokeThickness());
}
- maskImageContext.setTextDrawingMode(fill ? TextModeFill : TextModeStroke);
+ maskImageContext.setTextDrawingMode(fill ? TextDrawingMode::Fill : TextDrawingMode::Stroke);
if (useMaxWidth) {
maskImageContext.translate(location - maskRect.location());
@@ -578,7 +578,7 @@
}
#endif
- c->setTextDrawingMode(fill ? TextModeFill : TextModeStroke);
+ c->setTextDrawingMode(fill ? TextDrawingMode::Fill : TextDrawingMode::Stroke);
GraphicsContextStateSaver stateSaver(*c);
if (useMaxWidth) {
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (259803 => 259804)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp 2020-04-09 16:18:19 UTC (rev 259804)
@@ -285,7 +285,7 @@
ts.dumpProperty("stroke-thickness", m_state.strokeThickness);
if (m_changeFlags.contains(GraphicsContextState::TextDrawingModeChange))
- ts.dumpProperty("text-drawing-mode", m_state.textDrawingMode);
+ ts.dumpProperty("text-drawing-mode", m_state.textDrawingMode.toRaw());
if (m_changeFlags.contains(GraphicsContextState::StrokeColorChange))
ts.dumpProperty("stroke-color", m_state.strokeColor);
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (259803 => 259804)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2020-04-09 16:18:19 UTC (rev 259804)
@@ -98,14 +98,14 @@
class TextRun;
class TransformationMatrix;
-enum TextDrawingMode {
- TextModeFill = 1 << 0,
- TextModeStroke = 1 << 1,
+enum class TextDrawingMode : uint8_t {
+ Fill = 1 << 0,
+ Stroke = 1 << 1,
#if ENABLE(LETTERPRESS)
- TextModeLetterpress = 1 << 2,
+ Letterpress = 1 << 2,
#endif
};
-typedef unsigned TextDrawingModeFlags;
+using TextDrawingModeFlags = OptionSet<TextDrawingMode>;
enum StrokeStyle {
NoStroke,
@@ -210,7 +210,7 @@
float strokeThickness { 0 };
float shadowBlur { 0 };
- TextDrawingModeFlags textDrawingMode { TextModeFill };
+ TextDrawingModeFlags textDrawingMode { TextDrawingMode::Fill };
Color strokeColor { Color::black };
Color fillColor { Color::black };
Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp (259803 => 259804)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp 2020-04-09 16:18:19 UTC (rev 259804)
@@ -132,7 +132,7 @@
if (!platformCALayer->isOpaque() && platformCALayer->supportsSubpixelAntialiasedText() && platformCALayer->acceleratesDrawing()) {
graphicsContext.setStrokeColor(linearGlyphMaskOutlineColor);
graphicsContext.setStrokeThickness(4.5);
- graphicsContext.setTextDrawingMode(TextModeFill | TextModeStroke);
+ graphicsContext.setTextDrawingMode(TextDrawingModeFlags { TextDrawingMode::Fill, TextDrawingMode::Stroke });
}
graphicsContext.setFillColor(platformCALayer->acceleratesDrawing() ? acceleratedContextLabelColor : unacceleratedContextLabelColor);
Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp (259803 => 259804)
--- trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp 2020-04-09 16:18:19 UTC (rev 259804)
@@ -315,7 +315,7 @@
static void drawGlyphsShadow(PlatformContextCairo& platformContext, const ShadowState& shadowState, TextDrawingModeFlags textDrawingMode, const FloatSize& shadowOffset, const Color& shadowColor, const FloatPoint& point, cairo_scaled_font_t* scaledFont, double syntheticBoldOffset, const Vector<cairo_glyph_t>& glyphs, FontSmoothingMode fontSmoothingMode)
{
ShadowBlur shadow({ shadowState.blur, shadowState.blur }, shadowState.offset, shadowState.color, shadowState.ignoreTransforms);
- if (!(textDrawingMode & TextModeFill) || shadow.type() == ShadowBlur::NoShadow)
+ if (!textDrawingMode.contains(TextDrawingMode::Fill) || shadow.type() == ShadowBlur::NoShadow)
return;
if (!shadowState.isRequired(platformContext)) {
@@ -832,7 +832,7 @@
cairo_t* cr = platformContext.cr();
cairo_save(cr);
- if (textDrawingMode & TextModeFill) {
+ if (textDrawingMode.contains(TextDrawingMode::Fill)) {
prepareForFilling(cr, fillSource, AdjustPatternForGlobalAlpha);
drawGlyphsToContext(cr, scaledFont, syntheticBoldOffset, glyphs, fontSmoothingMode);
}
@@ -841,7 +841,7 @@
// twice the size of the width of the text we will not ask cairo to stroke
// the text as even one single stroke would cover the full wdth of the text.
// See https://bugs.webkit.org/show_bug.cgi?id=33759.
- if (textDrawingMode & TextModeStroke && strokeThickness < 2 * xOffset) {
+ if (textDrawingMode.contains(TextDrawingMode::Stroke) && strokeThickness < 2 * xOffset) {
prepareForStroking(cr, strokeSource, PreserveAlpha);
cairo_set_line_width(cr, strokeThickness);
Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (259803 => 259804)
--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2020-04-09 16:18:19 UTC (rev 259804)
@@ -1760,19 +1760,15 @@
ASSERT(hasPlatformContext());
CGContextRef context = platformContext();
- switch (mode) {
- case TextModeFill:
+
+ bool fill = mode.contains(TextDrawingMode::Fill);
+ bool stroke = mode.contains(TextDrawingMode::Stroke);
+ if (fill && stroke)
+ CGContextSetTextDrawingMode(context, kCGTextFillStroke);
+ else if (fill)
CGContextSetTextDrawingMode(context, kCGTextFill);
- break;
- case TextModeStroke:
+ else if (stroke)
CGContextSetTextDrawingMode(context, kCGTextStroke);
- break;
- case TextModeFill | TextModeStroke:
- CGContextSetTextDrawingMode(context, kCGTextFillStroke);
- break;
- default:
- break;
- }
}
void GraphicsContext::setPlatformStrokeColor(const Color& color)
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (259803 => 259804)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm 2020-04-09 16:18:19 UTC (rev 259804)
@@ -91,7 +91,7 @@
static inline bool shouldUseLetterpressEffect(const GraphicsContext& context)
{
#if ENABLE(LETTERPRESS)
- return context.textDrawingMode() & TextModeLetterpress;
+ return context.textDrawingMode().contains(TextDrawingMode::Letterpress);
#else
UNUSED_PARAM(context);
return false;
@@ -278,7 +278,7 @@
}
};
- bool hasSimpleShadow = context.textDrawingMode() == TextModeFill && shadowColor.isValid() && !shadowBlur && !platformData.isColorBitmapFont() && (!context.shadowsIgnoreTransforms() || contextCTM.isIdentityOrTranslationOrFlipped()) && !context.isInTransparencyLayer();
+ bool hasSimpleShadow = context.textDrawingMode() == TextDrawingMode::Fill && shadowColor.isValid() && !shadowBlur && !platformData.isColorBitmapFont() && (!context.shadowsIgnoreTransforms() || contextCTM.isIdentityOrTranslationOrFlipped()) && !context.isInTransparencyLayer();
if (hasSimpleShadow) {
// Paint simple shadows ourselves instead of relying on CG shadows, to avoid losing subpixel antialiasing.
context.clearShadow();
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h (259803 => 259804)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h 2020-04-09 16:18:19 UTC (rev 259804)
@@ -416,7 +416,7 @@
encoder << state.strokeThickness;
if (changeFlags.contains(GraphicsContextState::TextDrawingModeChange))
- encoder.encodeEnum(state.textDrawingMode);
+ encoder << state.textDrawingMode;
if (changeFlags.contains(GraphicsContextState::StrokeColorChange))
encoder << state.strokeColor;
@@ -568,11 +568,12 @@
}
if (stateChange.m_changeFlags.contains(GraphicsContextState::TextDrawingModeChange)) {
- TextDrawingModeFlags textDrawingMode;
- if (!decoder.decodeEnum(textDrawingMode))
+ Optional<TextDrawingModeFlags> textDrawingMode;
+ decoder >> textDrawingMode;
+ if (!textDrawingMode)
return WTF::nullopt;
- stateChange.m_state.textDrawingMode = textDrawingMode;
+ stateChange.m_state.textDrawingMode = WTFMove(*textDrawingMode);
}
if (stateChange.m_changeFlags.contains(GraphicsContextState::StrokeColorChange)) {
Modified: trunk/Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp (259803 => 259804)
--- trunk/Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp 2020-04-09 16:18:19 UTC (rev 259804)
@@ -45,7 +45,7 @@
GraphicsContext& context = imageBuffer->context();
context.setImageInterpolationQuality(InterpolationQuality::Default);
- context.setTextDrawingMode(TextModeFill);
+ context.setTextDrawingMode(TextDrawingMode::Fill);
IntRect sourceRect(targetRect);
sourceRect.setLocation(offset);
Modified: trunk/Source/WebCore/platform/graphics/win/Direct2DOperations.cpp (259803 => 259804)
--- trunk/Source/WebCore/platform/graphics/win/Direct2DOperations.cpp 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/platform/graphics/win/Direct2DOperations.cpp 2020-04-09 16:18:19 UTC (rev 259804)
@@ -775,7 +775,7 @@
Color shadowColor;
graphicsContext.getShadow(shadowOffset, shadowBlur, shadowColor);
- bool hasSimpleShadow = graphicsContext.textDrawingMode() == TextModeFill && shadowColor.isValid() && !shadowBlur && (!graphicsContext.shadowsIgnoreTransforms() || graphicsContext.getCTM().isIdentityOrTranslationOrFlipped());
+ bool hasSimpleShadow = graphicsContext.textDrawingMode() == TextDrawingMode::Fill && shadowColor.isValid() && !shadowBlur && (!graphicsContext.shadowsIgnoreTransforms() || graphicsContext.getCTM().isIdentityOrTranslationOrFlipped());
if (hasSimpleShadow) {
// Paint simple shadows ourselves instead of relying on CG shadows, to avoid losing subpixel antialiasing.
graphicsContext.clearShadow();
Modified: trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp (259803 => 259804)
--- trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/platform/graphics/win/FontCGWin.cpp 2020-04-09 16:18:19 UTC (rev 259804)
@@ -181,7 +181,7 @@
Color shadowColor;
graphicsContext.getShadow(shadowOffset, shadowBlur, shadowColor);
- bool hasSimpleShadow = graphicsContext.textDrawingMode() == TextModeFill && shadowColor.isValid() && !shadowBlur && (!graphicsContext.shadowsIgnoreTransforms() || graphicsContext.getCTM().isIdentityOrTranslationOrFlipped());
+ bool hasSimpleShadow = graphicsContext.textDrawingMode() == TextDrawingMode::Fill && shadowColor.isValid() && !shadowBlur && (!graphicsContext.shadowsIgnoreTransforms() || graphicsContext.getCTM().isIdentityOrTranslationOrFlipped());
if (hasSimpleShadow) {
// Paint simple shadows ourselves instead of relying on CG shadows, to avoid losing subpixel antialiasing.
graphicsContext.clearShadow();
Modified: trunk/Source/WebCore/platform/graphics/win/FontCascadeDirect2D.cpp (259803 => 259804)
--- trunk/Source/WebCore/platform/graphics/win/FontCascadeDirect2D.cpp 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/platform/graphics/win/FontCascadeDirect2D.cpp 2020-04-09 16:18:19 UTC (rev 259804)
@@ -116,7 +116,7 @@
Color shadowColor;
graphicsContext.getShadow(shadowOffset, shadowBlur, shadowColor);
- bool hasSimpleShadow = graphicsContext.textDrawingMode() == TextModeFill && shadowColor.isValid() && !shadowBlur && (!graphicsContext.shadowsIgnoreTransforms() || graphicsContext.getCTM().isIdentityOrTranslationOrFlipped());
+ bool hasSimpleShadow = graphicsContext.textDrawingMode() == TextDrawingMode::Fill && shadowColor.isValid() && !shadowBlur && (!graphicsContext.shadowsIgnoreTransforms() || graphicsContext.getCTM().isIdentityOrTranslationOrFlipped());
if (hasSimpleShadow) {
// Paint simple shadows ourselves instead of relying on CG shadows, to avoid losing subpixel antialiasing.
graphicsContext.clearShadow();
Modified: trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp (259803 => 259804)
--- trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp 2020-04-09 16:18:19 UTC (rev 259804)
@@ -353,7 +353,7 @@
IntSize captureSize = this->captureSize();
FloatPoint timeLocation(captureSize.width() * .05, captureSize.height() * .15);
context.setFillColor(Color::white);
- context.setTextDrawingMode(TextModeFill);
+ context.setTextDrawingMode(TextDrawingMode::Fill);
String string = makeString(pad('0', 2, hours), ':', pad('0', 2, minutes), ':', pad('0', 2, seconds), '.', pad('0', 3, milliseconds % 1000));
context.drawText(timeFont, TextRun((StringView(string))), timeLocation);
Modified: trunk/Source/WebCore/rendering/TextPaintStyle.cpp (259803 => 259804)
--- trunk/Source/WebCore/rendering/TextPaintStyle.cpp 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/rendering/TextPaintStyle.cpp 2020-04-09 16:18:19 UTC (rev 259804)
@@ -185,12 +185,12 @@
TextDrawingModeFlags newMode = mode;
#if ENABLE(LETTERPRESS)
if (paintStyle.useLetterpressEffect)
- newMode |= TextModeLetterpress;
+ newMode.add(TextDrawingMode::Letterpress);
else
- newMode &= ~TextModeLetterpress;
+ newMode.remove(TextDrawingMode::Letterpress);
#endif
if (paintStyle.strokeWidth > 0 && paintStyle.strokeColor.isVisible())
- newMode |= TextModeStroke;
+ newMode.add(TextDrawingMode::Stroke);
if (mode != newMode) {
context.setTextDrawingMode(newMode);
mode = newMode;
@@ -201,10 +201,10 @@
#endif
Color fillColor = fillColorType == UseEmphasisMarkColor ? paintStyle.emphasisMarkColor : paintStyle.fillColor;
- if (mode & TextModeFill && (fillColor != context.fillColor()))
+ if (mode.contains(TextDrawingMode::Fill) && (fillColor != context.fillColor()))
context.setFillColor(fillColor);
- if (mode & TextModeStroke) {
+ if (mode & TextDrawingMode::Stroke) {
if (paintStyle.strokeColor != context.strokeColor())
context.setStrokeColor(paintStyle.strokeColor);
if (paintStyle.strokeWidth != context.strokeThickness())
Modified: trunk/Source/WebCore/rendering/TextPainter.cpp (259803 => 259804)
--- trunk/Source/WebCore/rendering/TextPainter.cpp 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/rendering/TextPainter.cpp 2020-04-09 16:18:19 UTC (rev 259804)
@@ -159,17 +159,23 @@
for (auto order : paintOrder) {
switch (order) {
- case PaintType::Fill:
- m_context.setTextDrawingMode(textDrawingMode & ~TextModeStroke);
+ case PaintType::Fill: {
+ auto textDrawingModeWithoutStroke = textDrawingMode;
+ textDrawingModeWithoutStroke.remove(TextDrawingMode::Stroke);
+ m_context.setTextDrawingMode(textDrawingModeWithoutStroke);
paintTextWithShadows(shadowToUse, shadowColorFilter, *m_font, textRun, boxRect, textOrigin, startOffset, endOffset, nullAtom(), 0, false);
shadowToUse = nullptr;
m_context.setTextDrawingMode(textDrawingMode);
break;
- case PaintType::Stroke:
- m_context.setTextDrawingMode(textDrawingMode & ~TextModeFill);
+ }
+ case PaintType::Stroke: {
+ auto textDrawingModeWithoutFill = textDrawingMode;
+ textDrawingModeWithoutFill.remove(TextDrawingMode::Fill);
+ m_context.setTextDrawingMode(textDrawingModeWithoutFill);
paintTextWithShadows(shadowToUse, shadowColorFilter, *m_font, textRun, boxRect, textOrigin, startOffset, endOffset, nullAtom(), 0, paintStyle.strokeWidth > 0);
shadowToUse = nullptr;
m_context.setTextDrawingMode(textDrawingMode);
+ }
break;
case PaintType::Markers:
continue;
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp (259803 => 259804)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp 2020-04-09 16:18:19 UTC (rev 259804)
@@ -167,7 +167,7 @@
}
#endif
- context->setTextDrawingMode(resourceMode.contains(RenderSVGResourceMode::ApplyToFill) ? TextModeFill : TextModeStroke);
+ context->setTextDrawingMode(resourceMode.contains(RenderSVGResourceMode::ApplyToFill) ? TextDrawingMode::Fill : TextDrawingMode::Stroke);
}
const SVGRenderStyle& svgStyle = style.svgStyle();
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp (259803 => 259804)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp 2020-04-09 16:18:19 UTC (rev 259804)
@@ -185,13 +185,13 @@
if (resourceMode.contains(RenderSVGResourceMode::ApplyToText)) {
if (resourceMode.contains(RenderSVGResourceMode::ApplyToFill)) {
- context->setTextDrawingMode(TextModeFill);
+ context->setTextDrawingMode(TextDrawingMode::Fill);
#if USE(CG)
context->applyFillPattern();
#endif
} else if (resourceMode.contains(RenderSVGResourceMode::ApplyToStroke)) {
- context->setTextDrawingMode(TextModeStroke);
+ context->setTextDrawingMode(TextDrawingMode::Stroke);
#if USE(CG)
context->applyStrokePattern();
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.cpp (259803 => 259804)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.cpp 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.cpp 2020-04-09 16:18:19 UTC (rev 259804)
@@ -51,7 +51,7 @@
context->setFillRule(svgStyle.fillRule());
if (resourceMode.contains(RenderSVGResourceMode::ApplyToText))
- context->setTextDrawingMode(TextModeFill);
+ context->setTextDrawingMode(TextDrawingMode::Fill);
} else if (resourceMode.contains(RenderSVGResourceMode::ApplyToStroke)) {
// When rendering the mask for a RenderSVGResourceClipper, the stroke code path is never hit.
ASSERT(!isRenderingMask);
@@ -61,7 +61,7 @@
SVGRenderSupport::applyStrokeStyleToContext(context, style, renderer);
if (resourceMode.contains(RenderSVGResourceMode::ApplyToText))
- context->setTextDrawingMode(TextModeStroke);
+ context->setTextDrawingMode(TextDrawingMode::Stroke);
}
return true;
Modified: trunk/Source/WebKit/ChangeLog (259803 => 259804)
--- trunk/Source/WebKit/ChangeLog 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebKit/ChangeLog 2020-04-09 16:18:19 UTC (rev 259804)
@@ -1,3 +1,19 @@
+2020-04-09 Alex Christensen <achristen...@webkit.org>
+
+ IPC serialization of enums should serialize std::underlying_type instead of uint64_t
+ https://bugs.webkit.org/show_bug.cgi?id=210228
+
+ Reviewed by Chris Dumez and Darin Adler.
+
+ * Platform/IPC/Decoder.h:
+ (IPC::Decoder::decode):
+ (IPC::Decoder::operator>>):
+ (IPC::Decoder::decodeEnum):
+ * Platform/IPC/Encoder.h:
+ * Shared/cf/ArgumentCodersCF.cpp:
+ (IPC::encode):
+ (IPC::decode):
+
2020-04-09 Youenn Fablet <you...@apple.com>
[MacOS] REGRESSION (r253275): Stopping a cloned audio capture track should not stop the original audio track
Modified: trunk/Source/WebKit/Platform/IPC/Decoder.h (259803 => 259804)
--- trunk/Source/WebKit/Platform/IPC/Decoder.h 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebKit/Platform/IPC/Decoder.h 2020-04-09 16:18:19 UTC (rev 259804)
@@ -104,10 +104,10 @@
bool decode(double&);
Decoder& operator>>(Optional<double>&);
- template<typename E>
- auto decode(E& e) -> std::enable_if_t<std::is_enum<E>::value, bool>
+ template<typename E, typename = std::enable_if_t<std::is_enum<E>::value>>
+ bool decode(E& e)
{
- uint64_t value;
+ typename std::underlying_type<E>::type value;
if (!decode(value))
return false;
if (!isValidEnum<E>(value))
@@ -117,10 +117,10 @@
return true;
}
- template<typename E, std::enable_if_t<std::is_enum<E>::value>* = nullptr>
+ template<typename E, typename = std::enable_if_t<std::is_enum<E>::value>>
Decoder& operator>>(Optional<E>& optional)
{
- Optional<uint64_t> value;
+ Optional<typename std::underlying_type<E>::type> value;
*this >> value;
if (value && isValidEnum<E>(*value))
optional = static_cast<E>(*value);
@@ -129,12 +129,10 @@
template<typename T> bool decodeEnum(T& result)
{
- static_assert(sizeof(T) <= 8, "Enum type T must not be larger than 64 bits!");
-
- uint64_t value;
+ typename std::underlying_type<T>::type value;
if (!decode(value))
return false;
-
+
result = static_cast<T>(value);
return true;
}
Modified: trunk/Source/WebKit/Platform/IPC/Encoder.h (259803 => 259804)
--- trunk/Source/WebKit/Platform/IPC/Encoder.h 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebKit/Platform/IPC/Encoder.h 2020-04-09 16:18:19 UTC (rev 259804)
@@ -61,9 +61,7 @@
template<typename T> void encodeEnum(T t)
{
- COMPILE_ASSERT(sizeof(T) <= sizeof(uint64_t), enum_type_must_not_be_larger_than_64_bits);
-
- encode(static_cast<uint64_t>(t));
+ encode(static_cast<typename std::underlying_type<T>::type>(t));
}
template<typename T, std::enable_if_t<!std::is_enum<typename std::remove_const_t<std::remove_reference_t<T>>>::value>* = nullptr>
@@ -75,7 +73,7 @@
template<typename T, std::enable_if_t<std::is_enum<T>::value>* = nullptr>
Encoder& operator<<(T&& t)
{
- encode(static_cast<uint64_t>(t));
+ encode(static_cast<typename std::underlying_type<T>::type>(t));
return *this;
}
@@ -113,10 +111,8 @@
template<typename E>
auto encode(E value) -> std::enable_if_t<std::is_enum<E>::value>
{
- static_assert(sizeof(E) <= sizeof(uint64_t), "Enum type must not be larger than 64 bits.");
-
- ASSERT(isValidEnum<E>(static_cast<uint64_t>(value)));
- encode(static_cast<uint64_t>(value));
+ ASSERT(isValidEnum<E>(static_cast<typename std::underlying_type<E>::type>(value)));
+ encode(static_cast<typename std::underlying_type<E>::type>(value));
}
void encodeHeader();
Modified: trunk/Source/WebKit/Shared/cf/ArgumentCodersCF.cpp (259803 => 259804)
--- trunk/Source/WebKit/Shared/cf/ArgumentCodersCF.cpp 2020-04-09 16:13:28 UTC (rev 259803)
+++ trunk/Source/WebKit/Shared/cf/ArgumentCodersCF.cpp 2020-04-09 16:18:19 UTC (rev 259804)
@@ -491,7 +491,7 @@
bool result = CFNumberGetValue(number, numberType, buffer.data());
ASSERT_UNUSED(result, result);
- encoder.encodeEnum(numberType);
+ encoder << static_cast<uint8_t>(numberType);
encoder << IPC::DataReference(buffer);
}
@@ -537,9 +537,11 @@
bool decode(Decoder& decoder, RetainPtr<CFNumberRef>& result)
{
- CFNumberType numberType;
- if (!decoder.decodeEnum(numberType))
+ Optional<uint8_t> numberTypeFromIPC;
+ decoder >> numberTypeFromIPC;
+ if (!numberTypeFromIPC || *numberTypeFromIPC > kCFNumberMaxType)
return false;
+ auto numberType = static_cast<CFNumberType>(*numberTypeFromIPC);
IPC::DataReference dataReference;
if (!decoder.decode(dataReference))
@@ -571,15 +573,17 @@
numConvertedBytes = CFStringGetBytes(string, range, encoding, 0, false, buffer.data(), buffer.size(), &bufferLength);
ASSERT(numConvertedBytes == length);
- encoder.encodeEnum(encoding);
+ encoder << static_cast<UInt32>(encoding);
encoder << IPC::DataReference(buffer);
}
bool decode(Decoder& decoder, RetainPtr<CFStringRef>& result)
{
- CFStringEncoding encoding;
- if (!decoder.decodeEnum(encoding))
+ UInt32 encodingFromIPC;
+ if (!decoder.decode(encodingFromIPC))
return false;
+ // FIXME: Should we validate that this value is an expected value?
+ auto encoding = static_cast<CFStringEncoding>(encodingFromIPC);
if (!CFStringIsEncodingAvailable(encoding))
return false;