Diff
Modified: trunk/Source/WebCore/ChangeLog (217462 => 217463)
--- trunk/Source/WebCore/ChangeLog 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/ChangeLog 2017-05-26 01:31:05 UTC (rev 217463)
@@ -1,3 +1,60 @@
+2017-05-25 Simon Fraser <[email protected]>
+
+ Use a typedef for SVG resource mode flags union
+ https://bugs.webkit.org/show_bug.cgi?id=172580
+
+ Reviewed by Sam Weinig.
+
+ Use an OptionSet<> for RenderSVGResourceModes flags, and use it in render
+ SVG resource classes.
+
+ * rendering/svg/RenderSVGResource.cpp:
+ (WebCore::requestPaintingResource):
+ (WebCore::RenderSVGResource::fillPaintingResource):
+ (WebCore::RenderSVGResource::strokePaintingResource):
+ * rendering/svg/RenderSVGResource.h:
+ (WebCore::RenderSVGResource::postApplyResource):
+ * rendering/svg/RenderSVGResourceClipper.cpp:
+ (WebCore::RenderSVGResourceClipper::applyResource):
+ * rendering/svg/RenderSVGResourceClipper.h:
+ * rendering/svg/RenderSVGResourceFilter.cpp:
+ (WebCore::RenderSVGResourceFilter::applyResource):
+ (WebCore::RenderSVGResourceFilter::postApplyResource):
+ * rendering/svg/RenderSVGResourceFilter.h:
+ * rendering/svg/RenderSVGResourceGradient.cpp:
+ (WebCore::RenderSVGResourceGradient::applyResource):
+ * rendering/svg/RenderSVGResourceGradient.h:
+ * rendering/svg/RenderSVGResourceMarker.h:
+ * rendering/svg/RenderSVGResourceMasker.cpp:
+ (WebCore::RenderSVGResourceMasker::applyResource):
+ * rendering/svg/RenderSVGResourceMasker.h:
+ * rendering/svg/RenderSVGResourcePattern.cpp:
+ (WebCore::RenderSVGResourcePattern::buildPattern):
+ (WebCore::RenderSVGResourcePattern::applyResource):
+ (WebCore::RenderSVGResourcePattern::postApplyResource):
+ * rendering/svg/RenderSVGResourcePattern.h:
+ * rendering/svg/RenderSVGResourceSolidColor.cpp:
+ (WebCore::RenderSVGResourceSolidColor::applyResource):
+ (WebCore::RenderSVGResourceSolidColor::postApplyResource):
+ * rendering/svg/RenderSVGResourceSolidColor.h:
+ * rendering/svg/RenderSVGShape.cpp:
+ (WebCore::RenderSVGShape::fillShape):
+ (WebCore::RenderSVGShape::strokeShape):
+ * rendering/svg/SVGInlineTextBox.cpp:
+ (WebCore::SVGInlineTextBox::SVGInlineTextBox):
+ (WebCore::SVGInlineTextBox::paintSelectionBackground):
+ (WebCore::SVGInlineTextBox::paint):
+ (WebCore::SVGInlineTextBox::acquirePaintingResource):
+ (WebCore::SVGInlineTextBox::releasePaintingResource):
+ (WebCore::SVGInlineTextBox::paintDecoration):
+ (WebCore::SVGInlineTextBox::paintDecorationWithStyle):
+ * rendering/svg/SVGInlineTextBox.h:
+ * rendering/svg/SVGRenderingContext.cpp:
+ (WebCore::SVGRenderingContext::~SVGRenderingContext):
+ (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
+ (WebCore::SVGRenderingContext::renderSubtreeToImageBuffer): Avoid needless IntPoint -> LayoutPoint
+ conversion.
+
2017-05-25 Chris Dumez <[email protected]>
Regression(r215686): Videos sometimes do not load in iBooks
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResource.cpp (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResource.cpp 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResource.cpp 2017-05-26 01:31:05 UTC (rev 217463)
@@ -47,7 +47,7 @@
return true;
}
-static inline RenderSVGResource* requestPaintingResource(RenderSVGResourceMode mode, RenderElement& renderer, const RenderStyle& style, Color& fallbackColor)
+static inline RenderSVGResource* requestPaintingResource(OptionSet<RenderSVGResourceMode> mode, RenderElement& renderer, const RenderStyle& style, Color& fallbackColor)
{
const SVGRenderStyle& svgStyle = style.svgStyle();
@@ -54,7 +54,7 @@
bool isRenderingMask = renderer.view().frameView().paintBehavior() & PaintBehaviorRenderingSVGMask;
// If we have no fill/stroke, return nullptr.
- if (mode == ApplyToFillMode) {
+ if (mode == RenderSVGResourceMode::ApplyToFill) {
// When rendering the mask for a RenderSVGResourceClipper, always use the initial fill paint server, and ignore stroke.
if (isRenderingMask) {
RenderSVGResourceSolidColor* colorResource = RenderSVGResource::sharedSolidPaintingResource();
@@ -69,7 +69,7 @@
return nullptr;
}
- bool applyToFill = mode == ApplyToFillMode;
+ bool applyToFill = mode == RenderSVGResourceMode::ApplyToFill;
SVGPaintType paintType = applyToFill ? svgStyle.fillPaintType() : svgStyle.strokePaintType();
if (paintType == SVG_PAINTTYPE_NONE)
return nullptr;
@@ -119,7 +119,7 @@
}
// If the requested resource is not available, return the color resource.
- RenderSVGResource* uriResource = mode == ApplyToFillMode ? resources->fill() : resources->stroke();
+ RenderSVGResource* uriResource = mode == RenderSVGResourceMode::ApplyToFill ? resources->fill() : resources->stroke();
if (!uriResource) {
if (!inheritColorFromParentStyleIfNeeded(renderer, applyToFill, color))
return nullptr;
@@ -136,12 +136,12 @@
RenderSVGResource* RenderSVGResource::fillPaintingResource(RenderElement& renderer, const RenderStyle& style, Color& fallbackColor)
{
- return requestPaintingResource(ApplyToFillMode, renderer, style, fallbackColor);
+ return requestPaintingResource(RenderSVGResourceMode::ApplyToFill, renderer, style, fallbackColor);
}
RenderSVGResource* RenderSVGResource::strokePaintingResource(RenderElement& renderer, const RenderStyle& style, Color& fallbackColor)
{
- return requestPaintingResource(ApplyToStrokeMode, renderer, style, fallbackColor);
+ return requestPaintingResource(RenderSVGResourceMode::ApplyToStroke, renderer, style, fallbackColor);
}
RenderSVGResourceSolidColor* RenderSVGResource::sharedSolidPaintingResource()
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResource.h (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResource.h 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResource.h 2017-05-26 01:31:05 UTC (rev 217463)
@@ -38,11 +38,11 @@
};
// If this enum changes change the unsigned bitfields using it.
-enum RenderSVGResourceMode {
- ApplyToDefaultMode = 1 << 0, // used for all resources except gradient/pattern
- ApplyToFillMode = 1 << 1,
- ApplyToStrokeMode = 1 << 2,
- ApplyToTextMode = 1 << 3 // used in combination with ApplyTo{Fill|Stroke}Mode
+enum class RenderSVGResourceMode {
+ ApplyToDefault = 1 << 0, // used for all resources except gradient/pattern
+ ApplyToFill = 1 << 1,
+ ApplyToStroke = 1 << 2,
+ ApplyToText = 1 << 3 // used in combination with ApplyTo{Fill|Stroke}Mode
};
class Color;
@@ -61,8 +61,8 @@
virtual void removeAllClientsFromCache(bool markForInvalidation = true) = 0;
virtual void removeClientFromCache(RenderElement&, bool markForInvalidation = true) = 0;
- virtual bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, unsigned short resourceMode) = 0;
- virtual void postApplyResource(RenderElement&, GraphicsContext*&, unsigned short, const Path*, const RenderSVGShape*) { }
+ virtual bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>) = 0;
+ virtual void postApplyResource(RenderElement&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>, const Path*, const RenderSVGShape*) { }
virtual FloatRect resourceBoundingBox(const RenderObject&) = 0;
virtual RenderSVGResourceType resourceType() const = 0;
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.cpp 2017-05-26 01:31:05 UTC (rev 217463)
@@ -64,10 +64,10 @@
markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidation : ParentOnlyInvalidation);
}
-bool RenderSVGResourceClipper::applyResource(RenderElement& renderer, const RenderStyle&, GraphicsContext*& context, unsigned short resourceMode)
+bool RenderSVGResourceClipper::applyResource(RenderElement& renderer, const RenderStyle&, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode)
{
ASSERT(context);
- ASSERT_UNUSED(resourceMode, resourceMode == ApplyToDefaultMode);
+ ASSERT_UNUSED(resourceMode, resourceMode == RenderSVGResourceMode::ApplyToDefault);
return applyClippingToContext(renderer, renderer.objectBoundingBox(), renderer.repaintRectInLocalCoordinates(), *context);
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h 2017-05-26 01:31:05 UTC (rev 217463)
@@ -42,7 +42,7 @@
void removeAllClientsFromCache(bool markForInvalidation = true) override;
void removeClientFromCache(RenderElement&, bool markForInvalidation = true) override;
- bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, unsigned short resourceMode) override;
+ bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>) override;
// clipPath can be clipped too, but don't have a boundingBox or repaintRect. So we can't call
// applyResource directly and use the rects from the object, since they are empty for RenderSVGResources
// FIXME: We made applyClippingToContext public because we cannot call applyResource on HTML elements (it asserts on RenderObject::objectBoundingBox)
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp 2017-05-26 01:31:05 UTC (rev 217463)
@@ -96,10 +96,10 @@
return builder;
}
-bool RenderSVGResourceFilter::applyResource(RenderElement& renderer, const RenderStyle&, GraphicsContext*& context, unsigned short resourceMode)
+bool RenderSVGResourceFilter::applyResource(RenderElement& renderer, const RenderStyle&, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode)
{
ASSERT(context);
- ASSERT_UNUSED(resourceMode, resourceMode == ApplyToDefaultMode);
+ ASSERT_UNUSED(resourceMode, resourceMode == RenderSVGResourceMode::ApplyToDefault);
if (m_filter.contains(&renderer)) {
FilterData* filterData = m_filter.get(&renderer);
@@ -210,10 +210,10 @@
return true;
}
-void RenderSVGResourceFilter::postApplyResource(RenderElement& renderer, GraphicsContext*& context, unsigned short resourceMode, const Path*, const RenderSVGShape*)
+void RenderSVGResourceFilter::postApplyResource(RenderElement& renderer, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode, const Path*, const RenderSVGShape*)
{
ASSERT(context);
- ASSERT_UNUSED(resourceMode, resourceMode == ApplyToDefaultMode);
+ ASSERT_UNUSED(resourceMode, resourceMode == RenderSVGResourceMode::ApplyToDefault);
FilterData* filterData = m_filter.get(&renderer);
if (!filterData)
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h 2017-05-26 01:31:05 UTC (rev 217463)
@@ -68,8 +68,8 @@
void removeAllClientsFromCache(bool markForInvalidation = true) override;
void removeClientFromCache(RenderElement&, bool markForInvalidation = true) override;
- bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, unsigned short resourceMode) override;
- void postApplyResource(RenderElement&, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*) override;
+ bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>) override;
+ void postApplyResource(RenderElement&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>, const Path*, const RenderSVGShape*) override;
FloatRect resourceBoundingBox(const RenderObject&) override;
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp 2017-05-26 01:31:05 UTC (rev 217463)
@@ -95,10 +95,10 @@
}
#endif
-bool RenderSVGResourceGradient::applyResource(RenderElement& renderer, const RenderStyle& style, GraphicsContext*& context, unsigned short resourceMode)
+bool RenderSVGResourceGradient::applyResource(RenderElement& renderer, const RenderStyle& style, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode)
{
ASSERT(context);
- ASSERT(resourceMode != ApplyToDefaultMode);
+ ASSERT(resourceMode != RenderSVGResourceMode::ApplyToDefault);
// Be sure to synchronize all SVG properties on the gradientElement _before_ processing any further.
// Otherwhise the call to collectGradientAttributes() in createTileImage(), may cause the SVG DOM property
@@ -122,7 +122,7 @@
if (!gradientData)
gradientData = std::make_unique<GradientData>();
- bool isPaintingText = resourceMode & ApplyToTextMode;
+ bool isPaintingText = resourceMode.contains(RenderSVGResourceMode::ApplyToText);
// Create gradient object
if (!gradientData->gradient) {
@@ -168,16 +168,16 @@
}
#endif
- context->setTextDrawingMode(resourceMode & ApplyToFillMode ? TextModeFill : TextModeStroke);
+ context->setTextDrawingMode(resourceMode.contains(RenderSVGResourceMode::ApplyToFill) ? TextModeFill : TextModeStroke);
}
const SVGRenderStyle& svgStyle = style.svgStyle();
- if (resourceMode & ApplyToFillMode) {
+ if (resourceMode.contains(RenderSVGResourceMode::ApplyToFill)) {
context->setAlpha(svgStyle.fillOpacity());
context->setFillGradient(*gradientData->gradient);
context->setFillRule(svgStyle.fillRule());
- } else if (resourceMode & ApplyToStrokeMode) {
+ } else if (resourceMode.contains(RenderSVGResourceMode::ApplyToStroke)) {
if (svgStyle.vectorEffect() == VE_NON_SCALING_STROKE)
gradientData->gradient->setGradientSpaceTransform(transformOnNonScalingStroke(&renderer, gradientData->userspaceTransform));
context->setAlpha(svgStyle.strokeOpacity());
@@ -188,12 +188,12 @@
return true;
}
-void RenderSVGResourceGradient::postApplyResource(RenderElement& renderer, GraphicsContext*& context, unsigned short resourceMode, const Path* path, const RenderSVGShape* shape)
+void RenderSVGResourceGradient::postApplyResource(RenderElement& renderer, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode, const Path* path, const RenderSVGShape* shape)
{
ASSERT(context);
- ASSERT(resourceMode != ApplyToDefaultMode);
+ ASSERT(resourceMode != RenderSVGResourceMode::ApplyToDefault);
- if (resourceMode & ApplyToTextMode) {
+ if (resourceMode.contains(RenderSVGResourceMode::ApplyToText)) {
#if USE(CG)
// CG requires special handling for gradient on text
GradientData* gradientData;
@@ -216,13 +216,13 @@
UNUSED_PARAM(renderer);
#endif
} else {
- if (resourceMode & ApplyToFillMode) {
+ if (resourceMode.contains(RenderSVGResourceMode::ApplyToFill)) {
if (path)
context->fillPath(*path);
else if (shape)
shape->fillShape(*context);
}
- if (resourceMode & ApplyToStrokeMode) {
+ if (resourceMode.contains(RenderSVGResourceMode::ApplyToStroke)) {
if (path)
context->strokePath(*path);
else if (shape)
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceGradient.h 2017-05-26 01:31:05 UTC (rev 217463)
@@ -46,8 +46,8 @@
void removeAllClientsFromCache(bool markForInvalidation = true) final;
void removeClientFromCache(RenderElement&, bool markForInvalidation = true) final;
- bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, unsigned short resourceMode) final;
- void postApplyResource(RenderElement&, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*) final;
+ bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>) final;
+ void postApplyResource(RenderElement&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>, const Path*, const RenderSVGShape*) final;
FloatRect resourceBoundingBox(const RenderObject&) final { return FloatRect(); }
protected:
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceMarker.h (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceMarker.h 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceMarker.h 2017-05-26 01:31:05 UTC (rev 217463)
@@ -50,7 +50,7 @@
const AffineTransform& localToParentTransform() const override;
AffineTransform markerTransformation(const FloatPoint& origin, float angle, float strokeWidth) const;
- bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, unsigned short) override { return false; }
+ bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>) override { return false; }
FloatRect resourceBoundingBox(const RenderObject&) override { return FloatRect(); }
FloatPoint referencePoint() const;
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.cpp 2017-05-26 01:31:05 UTC (rev 217463)
@@ -53,10 +53,10 @@
markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidation : ParentOnlyInvalidation);
}
-bool RenderSVGResourceMasker::applyResource(RenderElement& renderer, const RenderStyle&, GraphicsContext*& context, unsigned short resourceMode)
+bool RenderSVGResourceMasker::applyResource(RenderElement& renderer, const RenderStyle&, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode)
{
ASSERT(context);
- ASSERT_UNUSED(resourceMode, resourceMode == ApplyToDefaultMode);
+ ASSERT_UNUSED(resourceMode, resourceMode == RenderSVGResourceMode::ApplyToDefault);
bool missingMaskerData = !m_masker.contains(&renderer);
if (missingMaskerData)
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.h (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.h 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceMasker.h 2017-05-26 01:31:05 UTC (rev 217463)
@@ -44,7 +44,7 @@
void removeAllClientsFromCache(bool markForInvalidation = true) override;
void removeClientFromCache(RenderElement&, bool markForInvalidation = true) override;
- bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, unsigned short resourceMode) override;
+ bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>) override;
FloatRect resourceBoundingBox(const RenderObject&) override;
SVGUnitTypes::SVGUnitType maskUnits() const { return maskElement().maskUnits(); }
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp 2017-05-26 01:31:05 UTC (rev 217463)
@@ -69,7 +69,7 @@
}
}
-PatternData* RenderSVGResourcePattern::buildPattern(RenderElement& renderer, unsigned short resourceMode, GraphicsContext& context)
+PatternData* RenderSVGResourcePattern::buildPattern(RenderElement& renderer, OptionSet<RenderSVGResourceMode> resourceMode, GraphicsContext& context)
{
ASSERT(!m_shouldCollectPatternAttributes);
@@ -127,7 +127,7 @@
patternData->transform = patternTransform * patternData->transform;
// Account for text drawing resetting the context to non-scaled, see SVGInlineTextBox::paintTextWithShadows.
- if (resourceMode & ApplyToTextMode) {
+ if (resourceMode.contains(RenderSVGResourceMode::ApplyToText)) {
AffineTransform additionalTextTransformation;
if (shouldTransformOnTextPainting(renderer, additionalTextTransformation))
patternData->transform *= additionalTextTransformation;
@@ -140,10 +140,10 @@
return m_patternMap.set(&renderer, WTFMove(patternData)).iterator->value.get();
}
-bool RenderSVGResourcePattern::applyResource(RenderElement& renderer, const RenderStyle& style, GraphicsContext*& context, unsigned short resourceMode)
+bool RenderSVGResourcePattern::applyResource(RenderElement& renderer, const RenderStyle& style, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode)
{
ASSERT(context);
- ASSERT(resourceMode != ApplyToDefaultMode);
+ ASSERT(resourceMode != RenderSVGResourceMode::ApplyToDefault);
if (m_shouldCollectPatternAttributes) {
patternElement().synchronizeAnimatedSVGAttribute(anyQName());
@@ -168,11 +168,11 @@
const SVGRenderStyle& svgStyle = style.svgStyle();
- if (resourceMode & ApplyToFillMode) {
+ if (resourceMode.contains(RenderSVGResourceMode::ApplyToFill)) {
context->setAlpha(svgStyle.fillOpacity());
context->setFillPattern(*patternData->pattern);
context->setFillRule(svgStyle.fillRule());
- } else if (resourceMode & ApplyToStrokeMode) {
+ } else if (resourceMode.contains(RenderSVGResourceMode::ApplyToStroke)) {
if (svgStyle.vectorEffect() == VE_NON_SCALING_STROKE)
patternData->pattern->setPatternSpaceTransform(transformOnNonScalingStroke(&renderer, patternData->transform));
context->setAlpha(svgStyle.strokeOpacity());
@@ -180,14 +180,14 @@
SVGRenderSupport::applyStrokeStyleToContext(context, style, renderer);
}
- if (resourceMode & ApplyToTextMode) {
- if (resourceMode & ApplyToFillMode) {
+ if (resourceMode.contains(RenderSVGResourceMode::ApplyToText)) {
+ if (resourceMode.contains(RenderSVGResourceMode::ApplyToFill)) {
context->setTextDrawingMode(TextModeFill);
#if USE(CG)
context->applyFillPattern();
#endif
- } else if (resourceMode & ApplyToStrokeMode) {
+ } else if (resourceMode.contains(RenderSVGResourceMode::ApplyToStroke)) {
context->setTextDrawingMode(TextModeStroke);
#if USE(CG)
@@ -199,18 +199,18 @@
return true;
}
-void RenderSVGResourcePattern::postApplyResource(RenderElement&, GraphicsContext*& context, unsigned short resourceMode, const Path* path, const RenderSVGShape* shape)
+void RenderSVGResourcePattern::postApplyResource(RenderElement&, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode, const Path* path, const RenderSVGShape* shape)
{
ASSERT(context);
- ASSERT(resourceMode != ApplyToDefaultMode);
+ ASSERT(resourceMode != RenderSVGResourceMode::ApplyToDefault);
- if (resourceMode & ApplyToFillMode) {
+ if (resourceMode.contains(RenderSVGResourceMode::ApplyToFill)) {
if (path)
context->fillPath(*path);
else if (shape)
shape->fillShape(*context);
}
- if (resourceMode & ApplyToStrokeMode) {
+ if (resourceMode.contains(RenderSVGResourceMode::ApplyToStroke)) {
if (path)
context->strokePath(*path);
else if (shape)
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.h 2017-05-26 01:31:05 UTC (rev 217463)
@@ -46,8 +46,8 @@
void removeAllClientsFromCache(bool markForInvalidation = true) override;
void removeClientFromCache(RenderElement&, bool markForInvalidation = true) override;
- bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, unsigned short resourceMode) override;
- void postApplyResource(RenderElement&, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*) override;
+ bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>) override;
+ void postApplyResource(RenderElement&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>, const Path*, const RenderSVGShape*) override;
FloatRect resourceBoundingBox(const RenderObject&) override { return FloatRect(); }
RenderSVGResourceType resourceType() const override { return PatternResourceType; }
@@ -62,7 +62,7 @@
std::unique_ptr<ImageBuffer> createTileImage(const PatternAttributes&, const FloatRect& tileBoundaries, const FloatRect& absoluteTileBoundaries, const AffineTransform& tileImageTransform, FloatRect& clampedAbsoluteTileBoundaries, RenderingMode) const;
- PatternData* buildPattern(RenderElement&, unsigned short resourceMode, GraphicsContext&);
+ PatternData* buildPattern(RenderElement&, OptionSet<RenderSVGResourceMode>, GraphicsContext&);
bool m_shouldCollectPatternAttributes : 1;
PatternAttributes m_attributes;
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.cpp (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.cpp 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.cpp 2017-05-26 01:31:05 UTC (rev 217463)
@@ -36,16 +36,16 @@
{
}
-bool RenderSVGResourceSolidColor::applyResource(RenderElement& renderer, const RenderStyle& style, GraphicsContext*& context, unsigned short resourceMode)
+bool RenderSVGResourceSolidColor::applyResource(RenderElement& renderer, const RenderStyle& style, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode)
{
ASSERT(context);
- ASSERT(resourceMode != ApplyToDefaultMode);
+ ASSERT(resourceMode != RenderSVGResourceMode::ApplyToDefault);
const SVGRenderStyle& svgStyle = style.svgStyle();
bool isRenderingMask = renderer.view().frameView().paintBehavior() & PaintBehaviorRenderingSVGMask;
- if (resourceMode & ApplyToFillMode) {
+ if (resourceMode.contains(RenderSVGResourceMode::ApplyToFill)) {
if (!isRenderingMask)
context->setAlpha(svgStyle.fillOpacity());
else
@@ -54,9 +54,9 @@
if (!isRenderingMask)
context->setFillRule(svgStyle.fillRule());
- if (resourceMode & ApplyToTextMode)
+ if (resourceMode.contains(RenderSVGResourceMode::ApplyToText))
context->setTextDrawingMode(TextModeFill);
- } else if (resourceMode & ApplyToStrokeMode) {
+ } else if (resourceMode.contains(RenderSVGResourceMode::ApplyToStroke)) {
// When rendering the mask for a RenderSVGResourceClipper, the stroke code path is never hit.
ASSERT(!isRenderingMask);
context->setAlpha(svgStyle.strokeOpacity());
@@ -64,7 +64,7 @@
SVGRenderSupport::applyStrokeStyleToContext(context, style, renderer);
- if (resourceMode & ApplyToTextMode)
+ if (resourceMode.contains(RenderSVGResourceMode::ApplyToText))
context->setTextDrawingMode(TextModeStroke);
}
@@ -71,18 +71,18 @@
return true;
}
-void RenderSVGResourceSolidColor::postApplyResource(RenderElement&, GraphicsContext*& context, unsigned short resourceMode, const Path* path, const RenderSVGShape* shape)
+void RenderSVGResourceSolidColor::postApplyResource(RenderElement&, GraphicsContext*& context, OptionSet<RenderSVGResourceMode> resourceMode, const Path* path, const RenderSVGShape* shape)
{
ASSERT(context);
- ASSERT(resourceMode != ApplyToDefaultMode);
+ ASSERT(resourceMode != RenderSVGResourceMode::ApplyToDefault);
- if (resourceMode & ApplyToFillMode) {
+ if (resourceMode.contains(RenderSVGResourceMode::ApplyToFill)) {
if (path)
context->fillPath(*path);
else if (shape)
shape->fillShape(*context);
}
- if (resourceMode & ApplyToStrokeMode) {
+ if (resourceMode.contains(RenderSVGResourceMode::ApplyToStroke)) {
if (path)
context->strokePath(*path);
else if (shape)
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.h (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.h 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourceSolidColor.h 2017-05-26 01:31:05 UTC (rev 217463)
@@ -33,8 +33,8 @@
void removeAllClientsFromCache(bool = true) override { }
void removeClientFromCache(RenderElement&, bool = true) override { }
- bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, unsigned short resourceMode) override;
- void postApplyResource(RenderElement&, GraphicsContext*&, unsigned short resourceMode, const Path*, const RenderSVGShape*) override;
+ bool applyResource(RenderElement&, const RenderStyle&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>) override;
+ void postApplyResource(RenderElement&, GraphicsContext*&, OptionSet<RenderSVGResourceMode>, const Path*, const RenderSVGShape*) override;
FloatRect resourceBoundingBox(const RenderObject&) override { return FloatRect(); }
RenderSVGResourceType resourceType() const override { return SolidColorResourceType; }
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGShape.cpp 2017-05-26 01:31:05 UTC (rev 217463)
@@ -234,13 +234,13 @@
GraphicsContext* context = &originalContext;
Color fallbackColor;
if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(*this, style, fallbackColor)) {
- if (fillPaintingResource->applyResource(*this, style, context, ApplyToFillMode))
- fillPaintingResource->postApplyResource(*this, context, ApplyToFillMode, 0, this);
+ if (fillPaintingResource->applyResource(*this, style, context, RenderSVGResourceMode::ApplyToFill))
+ fillPaintingResource->postApplyResource(*this, context, RenderSVGResourceMode::ApplyToFill, 0, this);
else if (fallbackColor.isValid()) {
RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource();
fallbackResource->setColor(fallbackColor);
- if (fallbackResource->applyResource(*this, style, context, ApplyToFillMode))
- fallbackResource->postApplyResource(*this, context, ApplyToFillMode, 0, this);
+ if (fallbackResource->applyResource(*this, style, context, RenderSVGResourceMode::ApplyToFill))
+ fallbackResource->postApplyResource(*this, context, RenderSVGResourceMode::ApplyToFill, 0, this);
}
}
}
@@ -250,13 +250,13 @@
GraphicsContext* context = &originalContext;
Color fallbackColor;
if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(*this, style, fallbackColor)) {
- if (strokePaintingResource->applyResource(*this, style, context, ApplyToStrokeMode))
- strokePaintingResource->postApplyResource(*this, context, ApplyToStrokeMode, 0, this);
+ if (strokePaintingResource->applyResource(*this, style, context, RenderSVGResourceMode::ApplyToStroke))
+ strokePaintingResource->postApplyResource(*this, context, RenderSVGResourceMode::ApplyToStroke, 0, this);
else if (fallbackColor.isValid()) {
RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource();
fallbackResource->setColor(fallbackColor);
- if (fallbackResource->applyResource(*this, style, context, ApplyToStrokeMode))
- fallbackResource->postApplyResource(*this, context, ApplyToStrokeMode, 0, this);
+ if (fallbackResource->applyResource(*this, style, context, RenderSVGResourceMode::ApplyToStroke))
+ fallbackResource->postApplyResource(*this, context, RenderSVGResourceMode::ApplyToStroke, 0, this);
}
}
}
Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp 2017-05-26 01:31:05 UTC (rev 217463)
@@ -50,10 +50,8 @@
SVGInlineTextBox::SVGInlineTextBox(RenderSVGInlineText& renderer)
: InlineTextBox(renderer)
- , m_logicalHeight(0)
- , m_paintingResourceMode(ApplyToDefaultMode)
+ , m_paintingResourceMode(OptionSet<RenderSVGResourceMode>(RenderSVGResourceMode::ApplyToDefault).toRaw())
, m_startsNewTextChunk(false)
- , m_paintingResource(nullptr)
{
}
@@ -226,7 +224,7 @@
paintInfo.context().setFillColor(backgroundColor);
paintInfo.context().fillRect(selectionRectForTextFragment(fragment, fragmentStartPosition, fragmentEndPosition, style), backgroundColor);
- m_paintingResourceMode = ApplyToDefaultMode;
+ setPaintingResourceMode(RenderSVGResourceMode::ApplyToDefault);
}
ASSERT(!m_paintingResource);
@@ -305,7 +303,7 @@
case PaintType::Fill:
if (!hasFill)
continue;
- m_paintingResourceMode = ApplyToFillMode | ApplyToTextMode;
+ setPaintingResourceMode({ RenderSVGResourceMode::ApplyToFill, RenderSVGResourceMode::ApplyToText });
ASSERT(selectionStyle);
paintText(paintInfo.context(), style, *selectionStyle, fragment, hasSelection, paintSelectedTextOnly);
break;
@@ -312,7 +310,7 @@
case PaintType::Stroke:
if (!hasVisibleStroke)
continue;
- m_paintingResourceMode = ApplyToStrokeMode | ApplyToTextMode;
+ setPaintingResourceMode({ RenderSVGResourceMode::ApplyToStroke, RenderSVGResourceMode::ApplyToText});
ASSERT(selectionStyle);
paintText(paintInfo.context(), style, *selectionStyle, fragment, hasSelection, paintSelectedTextOnly);
break;
@@ -325,7 +323,7 @@
if (decorations & TextDecorationLineThrough)
paintDecoration(paintInfo.context(), TextDecorationLineThrough, fragment);
- m_paintingResourceMode = ApplyToDefaultMode;
+ setPaintingResourceMode(RenderSVGResourceMode::ApplyToDefault);
}
// Finally, paint the outline if any.
@@ -338,12 +336,12 @@
bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, float scalingFactor, RenderBoxModelObject& renderer, const RenderStyle& style)
{
ASSERT(scalingFactor);
- ASSERT(m_paintingResourceMode != ApplyToDefaultMode);
+ ASSERT(paintingResourceMode() != RenderSVGResourceMode::ApplyToDefault);
Color fallbackColor;
- if (m_paintingResourceMode & ApplyToFillMode)
+ if (paintingResourceMode().contains(RenderSVGResourceMode::ApplyToFill))
m_paintingResource = RenderSVGResource::fillPaintingResource(renderer, style, fallbackColor);
- else if (m_paintingResourceMode & ApplyToStrokeMode)
+ else if (paintingResourceMode().contains(RenderSVGResourceMode::ApplyToStroke))
m_paintingResource = RenderSVGResource::strokePaintingResource(renderer, style, fallbackColor);
else {
// We're either called for stroking or filling.
@@ -353,17 +351,17 @@
if (!m_paintingResource)
return false;
- if (!m_paintingResource->applyResource(renderer, style, context, m_paintingResourceMode)) {
+ if (!m_paintingResource->applyResource(renderer, style, context, paintingResourceMode())) {
if (fallbackColor.isValid()) {
RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::sharedSolidPaintingResource();
fallbackResource->setColor(fallbackColor);
m_paintingResource = fallbackResource;
- m_paintingResource->applyResource(renderer, style, context, m_paintingResourceMode);
+ m_paintingResource->applyResource(renderer, style, context, paintingResourceMode());
}
}
- if (scalingFactor != 1 && m_paintingResourceMode & ApplyToStrokeMode)
+ if (scalingFactor != 1 && paintingResourceMode().contains(RenderSVGResourceMode::ApplyToStroke))
context->setStrokeThickness(context->strokeThickness() * scalingFactor);
return true;
@@ -373,7 +371,7 @@
{
ASSERT(m_paintingResource);
- m_paintingResource->postApplyResource(parent()->renderer(), context, m_paintingResourceMode, path, /*RenderSVGShape*/ nullptr);
+ m_paintingResource->postApplyResource(parent()->renderer(), context, paintingResourceMode(), path, /*RenderSVGShape*/ nullptr);
m_paintingResource = nullptr;
}
@@ -492,12 +490,12 @@
bool hasVisibleDecorationStroke = decorationStyle.hasVisibleStroke();
if (hasDecorationFill) {
- m_paintingResourceMode = ApplyToFillMode;
+ setPaintingResourceMode(RenderSVGResourceMode::ApplyToFill);
paintDecorationWithStyle(context, decoration, fragment, decorationRenderer);
}
if (hasVisibleDecorationStroke) {
- m_paintingResourceMode = ApplyToStrokeMode;
+ setPaintingResourceMode(RenderSVGResourceMode::ApplyToStroke);
paintDecorationWithStyle(context, decoration, fragment, decorationRenderer);
}
}
@@ -505,7 +503,7 @@
void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext& context, TextDecoration decoration, const SVGTextFragment& fragment, RenderBoxModelObject& decorationRenderer)
{
ASSERT(!m_paintingResource);
- ASSERT(m_paintingResourceMode != ApplyToDefaultMode);
+ ASSERT(paintingResourceMode() != RenderSVGResourceMode::ApplyToDefault);
auto& decorationStyle = decorationRenderer.style();
Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h 2017-05-26 01:31:05 UTC (rev 217463)
@@ -64,7 +64,10 @@
int offsetForPositionInFragment(const SVGTextFragment&, float position, bool includePartialGlyphs) const;
FloatRect selectionRectForTextFragment(const SVGTextFragment&, unsigned fragmentStartPosition, unsigned fragmentEndPosition, const RenderStyle&) const;
-
+
+ OptionSet<RenderSVGResourceMode> paintingResourceMode() const { return OptionSet<RenderSVGResourceMode>::fromRaw(m_paintingResourceMode); }
+ void setPaintingResourceMode(OptionSet<RenderSVGResourceMode> mode) { m_paintingResourceMode = mode.toRaw(); }
+
private:
bool isSVGInlineTextBox() const override { return true; }
@@ -84,10 +87,10 @@
bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom, HitTestAction) override;
private:
- float m_logicalHeight;
- unsigned m_paintingResourceMode : 4;
+ float m_logicalHeight { 0 };
+ unsigned m_paintingResourceMode : 4; // RenderSVGResourceMode
unsigned m_startsNewTextChunk : 1;
- RenderSVGResource* m_paintingResource;
+ RenderSVGResource* m_paintingResource { nullptr };
Vector<SVGTextFragment> m_textFragments;
};
Modified: trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp (217462 => 217463)
--- trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp 2017-05-26 00:43:19 UTC (rev 217462)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp 2017-05-26 01:31:05 UTC (rev 217463)
@@ -56,7 +56,7 @@
if (m_renderingFlags & EndFilterLayer) {
ASSERT(m_filter);
GraphicsContext* contextPtr = &m_paintInfo->context();
- m_filter->postApplyResource(*m_renderer, contextPtr, ApplyToDefaultMode, 0, 0);
+ m_filter->postApplyResource(*m_renderer, contextPtr, RenderSVGResourceMode::ApplyToDefault, 0, 0);
m_paintInfo->setContext(*m_savedContext);
m_paintInfo->rect = m_savedPaintRect;
}
@@ -162,7 +162,7 @@
if (!isRenderingMask) {
if (RenderSVGResourceMasker* masker = resources->masker()) {
GraphicsContext* contextPtr = &m_paintInfo->context();
- bool result = masker->applyResource(*m_renderer, style, contextPtr, ApplyToDefaultMode);
+ bool result = masker->applyResource(*m_renderer, style, contextPtr, RenderSVGResourceMode::ApplyToDefault);
m_paintInfo->setContext(*contextPtr);
if (!result)
return;
@@ -172,7 +172,7 @@
RenderSVGResourceClipper* clipper = resources->clipper();
if (!clipPathOperation && clipper) {
GraphicsContext* contextPtr = &m_paintInfo->context();
- bool result = clipper->applyResource(*m_renderer, style, contextPtr, ApplyToDefaultMode);
+ bool result = clipper->applyResource(*m_renderer, style, contextPtr, RenderSVGResourceMode::ApplyToDefault);
m_paintInfo->setContext(*contextPtr);
if (!result)
return;
@@ -187,7 +187,7 @@
// (because it was either drawn before or empty) but we still need to apply the filter.
m_renderingFlags |= EndFilterLayer;
GraphicsContext* contextPtr = &m_paintInfo->context();
- bool result = m_filter->applyResource(*m_renderer, style, contextPtr, ApplyToDefaultMode);
+ bool result = m_filter->applyResource(*m_renderer, style, contextPtr, RenderSVGResourceMode::ApplyToDefault);
m_paintInfo->setContext(*contextPtr);
if (!result)
return;
@@ -303,7 +303,7 @@
contentTransformation = subtreeContentTransformation * contentTransformation;
ASSERT(!item.needsLayout());
- item.paint(info, IntPoint());
+ item.paint(info, { });
contentTransformation = savedContentTransformation;
}