Diff
Modified: trunk/Source/WebCore/ChangeLog (253045 => 253046)
--- trunk/Source/WebCore/ChangeLog 2019-12-03 16:28:22 UTC (rev 253045)
+++ trunk/Source/WebCore/ChangeLog 2019-12-03 16:50:43 UTC (rev 253046)
@@ -1,3 +1,95 @@
+2019-12-03 Tim Horton <timothy_hor...@apple.com>
+
+ Start adding encoding support for DisplayList and some DisplayListItems
+ https://bugs.webkit.org/show_bug.cgi?id=204740
+
+ Reviewed by Simon Fraser.
+
+ To be used in a later patch.
+
+ Start encoding and decoding DisplayList, and its child items. We
+ currently support only a subset of the item subclasses.
+
+ * platform/graphics/GraphicsContext.cpp:
+ (WebCore::GraphicsContextStateChange::changesFromState const):
+ (WebCore::GraphicsContextStateChange::accumulate):
+ (WebCore::GraphicsContextStateChange::apply const):
+ * platform/graphics/GraphicsContext.h:
+ Adopt OptionSet for GraphicsContextState::StateChangeFlags.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/graphics/Pattern.h:
+ * platform/graphics/displaylists/DisplayList.h:
+ (WebCore::DisplayList::DisplayList::encode const):
+ (WebCore::DisplayList::DisplayList::decode):
+ * platform/graphics/displaylists/DisplayListItems.cpp:
+ (WebCore::DisplayList::Item::Item):
+ (WebCore::DisplayList::DrawingItem::DrawingItem):
+ (WebCore::DisplayList::Save::Save):
+ (WebCore::DisplayList::Restore::Restore):
+ (WebCore::DisplayList::Translate::Translate):
+ (WebCore::DisplayList::Rotate::Rotate):
+ (WebCore::DisplayList::Scale::Scale):
+ (WebCore::DisplayList::SetState::SetState):
+ (WebCore::DisplayList::DrawRect::DrawRect):
+ (WebCore::DisplayList::DrawPath::DrawPath):
+ (WebCore::DisplayList::FillRect::FillRect):
+ (WebCore::DisplayList::FillRectWithColor::FillRectWithColor):
+ (WebCore::DisplayList::FillCompositedRect::FillCompositedRect):
+ (WebCore::DisplayList::FillPath::FillPath):
+ (WebCore::DisplayList::ClearRect::ClearRect):
+ * platform/graphics/displaylists/DisplayListItems.h:
+ (WebCore::DisplayList::Item::isStateItemType):
+ (WebCore::DisplayList::Save::encode const):
+ (WebCore::DisplayList::Save::decode):
+ (WebCore::DisplayList::Restore::encode const):
+ (WebCore::DisplayList::Restore::decode):
+ (WebCore::DisplayList::Translate::encode const):
+ (WebCore::DisplayList::Translate::decode):
+ (WebCore::DisplayList::Rotate::encode const):
+ (WebCore::DisplayList::Rotate::decode):
+ (WebCore::DisplayList::Scale::encode const):
+ (WebCore::DisplayList::Scale::decode):
+ (WebCore::DisplayList::ConcatenateCTM::encode const):
+ (WebCore::DisplayList::ConcatenateCTM::decode):
+ (WebCore::DisplayList::SetState::create):
+ (WebCore::DisplayList::SetState::encode const):
+ (WebCore::DisplayList::SetState::decode):
+ (WebCore::DisplayList::DrawRect::encode const):
+ (WebCore::DisplayList::DrawRect::decode):
+ (WebCore::DisplayList::DrawPath::encode const):
+ (WebCore::DisplayList::DrawPath::decode):
+ (WebCore::DisplayList::FillRect::encode const):
+ (WebCore::DisplayList::FillRect::decode):
+ (WebCore::DisplayList::FillRectWithColor::encode const):
+ (WebCore::DisplayList::FillRectWithColor::decode):
+ (WebCore::DisplayList::FillCompositedRect::encode const):
+ (WebCore::DisplayList::FillCompositedRect::decode):
+ (WebCore::DisplayList::FillPath::encode const):
+ (WebCore::DisplayList::FillPath::decode):
+ (WebCore::DisplayList::ClearRect::encode const):
+ (WebCore::DisplayList::ClearRect::decode):
+ (WebCore::DisplayList::Item::encode const):
+ (WebCore::DisplayList::Item::decode):
+ (WebCore::DisplayList::Item::Item): Deleted.
+ (WebCore::DisplayList::DrawingItem::DrawingItem): Deleted.
+ (WebCore::DisplayList::Save::Save): Deleted.
+ (WebCore::DisplayList::Restore::Restore): Deleted.
+ (WebCore::DisplayList::Translate::Translate): Deleted.
+ (WebCore::DisplayList::Rotate::Rotate): Deleted.
+ (WebCore::DisplayList::Scale::Scale): Deleted.
+ (WebCore::DisplayList::SetState::SetState): Deleted.
+ (WebCore::DisplayList::DrawRect::DrawRect): Deleted.
+ (WebCore::DisplayList::DrawPath::DrawPath): Deleted.
+ (WebCore::DisplayList::FillRect::FillRect): Deleted.
+ (WebCore::DisplayList::FillRectWithColor::FillRectWithColor): Deleted.
+ (WebCore::DisplayList::FillCompositedRect::FillCompositedRect): Deleted.
+ (WebCore::DisplayList::FillPath::FillPath): Deleted.
+ (WebCore::DisplayList::ClearRect::ClearRect): Deleted.
+ * platform/graphics/displaylists/DisplayListRecorder.h:
+ * platform/graphics/displaylists/DisplayListReplayer.h:
+ (WebCore::DisplayList::Replayer::replay):
+
2019-12-03 Antti Koivisto <an...@apple.com>
[LFC][Integration] Rename RenderBlockFlowLineLayout and move it to LayoutIntegration namespace
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (253045 => 253046)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-12-03 16:28:22 UTC (rev 253045)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-12-03 16:50:43 UTC (rev 253046)
@@ -351,10 +351,10 @@
0FDA7C271883333200C954B5 /* JSWebKitPlaybackTargetAvailabilityEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FDA7C251883333200C954B5 /* JSWebKitPlaybackTargetAvailabilityEvent.h */; };
0FDCD7F31D47E655009F08BC /* LogInitialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FDCD7F21D47E655009F08BC /* LogInitialization.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FE5806419327A6200DE32EB /* ScrollingTreeMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE5806219327A6200DE32EB /* ScrollingTreeMac.h */; };
- 0FE5FBD31C3DD51E0007A2CA /* DisplayList.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE5FBCB1C3DD51E0007A2CA /* DisplayList.h */; };
- 0FE5FBD51C3DD51E0007A2CA /* DisplayListItems.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE5FBCD1C3DD51E0007A2CA /* DisplayListItems.h */; };
- 0FE5FBD71C3DD51E0007A2CA /* DisplayListRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE5FBCF1C3DD51E0007A2CA /* DisplayListRecorder.h */; };
- 0FE5FBD91C3DD51E0007A2CA /* DisplayListReplayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE5FBD11C3DD51E0007A2CA /* DisplayListReplayer.h */; };
+ 0FE5FBD31C3DD51E0007A2CA /* DisplayList.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE5FBCB1C3DD51E0007A2CA /* DisplayList.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 0FE5FBD51C3DD51E0007A2CA /* DisplayListItems.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE5FBCD1C3DD51E0007A2CA /* DisplayListItems.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 0FE5FBD71C3DD51E0007A2CA /* DisplayListRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE5FBCF1C3DD51E0007A2CA /* DisplayListRecorder.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 0FE5FBD91C3DD51E0007A2CA /* DisplayListReplayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE5FBD11C3DD51E0007A2CA /* DisplayListReplayer.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FE71406142170B800DB33BA /* ScrollbarThemeMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE71404142170B800DB33BA /* ScrollbarThemeMock.h */; };
0FEA3E7B191B2FC5000F1B55 /* ScrollingStateFrameScrollingNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEA3E79191B2FC5000F1B55 /* ScrollingStateFrameScrollingNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
0FEA3E80191B3169000F1B55 /* ScrollingTreeOverflowScrollingNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEA3E7E191B3169000F1B55 /* ScrollingTreeOverflowScrollingNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -825,6 +825,7 @@
2D9BF7461DBFDC47007A7D99 /* MediaKeys.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D9BF7331DBFDC0F007A7D99 /* MediaKeys.cpp */; };
2D9BF7471DBFDC49007A7D99 /* MediaKeyMessageEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D9BF72F1DBFDC0F007A7D99 /* MediaKeyMessageEvent.cpp */; };
2D9F0E1314FF1CBF00BA0FF7 /* linearSRGB.icc in Resources */ = {isa = PBXBuildFile; fileRef = 2D9F0E1214FF1CBF00BA0FF7 /* linearSRGB.icc */; };
+ 2DACB9E923755D0000B4C185 /* GraphicsContextImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F00123F1FAD87D600531D76 /* GraphicsContextImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
2DAF343D1EA7E0F100382CD3 /* ConstantPropertyMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DAF343B1EA7E0F100382CD3 /* ConstantPropertyMap.h */; };
2DD5A7271EBEE47D009BA597 /* CompositionUnderline.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DD5A7261EBEE47D009BA597 /* CompositionUnderline.h */; settings = {ATTRIBUTES = (Private, ); }; };
2DDE1CE31F574AE500D1A365 /* JSVRFieldOfView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DDE1CE01F574AD100D1A365 /* JSVRFieldOfView.h */; };
@@ -29914,6 +29915,7 @@
31AB5000122878A2001A7DB0 /* GraphicsContext3DIOS.h in Headers */,
D0843A4B20FEBE3D00FE860E /* GraphicsContext3DManager.h in Headers */,
934907E4125BBBC8007F23A0 /* GraphicsContextCG.h in Headers */,
+ 2DACB9E923755D0000B4C185 /* GraphicsContextImpl.h in Headers */,
A80D67080E9E9DEB00E420F0 /* GraphicsContextPlatformPrivateCG.h in Headers */,
0F580B0D0F12A2690051D689 /* GraphicsLayer.h in Headers */,
499B3ED7128CD31400E726C2 /* GraphicsLayerCA.h in Headers */,
@@ -31170,6 +31172,7 @@
1199FA46208E35A3002358CC /* LayoutContainer.h in Headers */,
6F26BB6C23343E6F002F2BEA /* LayoutContext.h in Headers */,
11310CF520BA4A4C0065A8D0 /* LayoutDescendantIterator.h in Headers */,
+ E4ABABDD236088FE00FA4345 /* LayoutIntegrationLineLayout.h in Headers */,
11310CF420BA4A3D0065A8D0 /* LayoutIterator.h in Headers */,
931D72F615FE695300C4C07E /* LayoutMilestone.h in Headers */,
141DC051164834B900371E5A /* LayoutPoint.h in Headers */,
@@ -31774,7 +31777,6 @@
7CD494CD1A86EB1D000A87EC /* RenderAttachment.h in Headers */,
BCEA4860097D93020094C9E4 /* RenderBlock.h in Headers */,
BC10D76817D8EE71005E2626 /* RenderBlockFlow.h in Headers */,
- E4ABABDD236088FE00FA4345 /* LayoutIntegrationLineLayout.h in Headers */,
BCEA4862097D93020094C9E4 /* RenderBox.h in Headers */,
BCEB179C143379F50052EAE9 /* RenderBoxFragmentInfo.h in Headers */,
BC96DB430F3A880E00573CB3 /* RenderBoxModelObject.h in Headers */,
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (253045 => 253046)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp 2019-12-03 16:28:22 UTC (rev 253045)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp 2019-12-03 16:50:43 UTC (rev 253046)
@@ -72,8 +72,8 @@
};
#define CHECK_FOR_CHANGED_PROPERTY(flag, property) \
- if ((m_changeFlags & GraphicsContextState::flag) && (m_state.property != state.property)) \
- changeFlags |= GraphicsContextState::flag;
+ if (m_changeFlags.contains(GraphicsContextState::flag) && (m_state.property != state.property)) \
+ changeFlags.add(GraphicsContextState::flag);
GraphicsContextState::StateChangeFlags GraphicsContextStateChange::changesFromState(const GraphicsContextState& state) const
{
@@ -84,11 +84,11 @@
CHECK_FOR_CHANGED_PROPERTY(FillGradientChange, fillGradient);
CHECK_FOR_CHANGED_PROPERTY(FillPatternChange, fillPattern);
- if ((m_changeFlags & GraphicsContextState::ShadowChange)
+ if (m_changeFlags.contains(GraphicsContextState::ShadowChange)
&& (m_state.shadowOffset != state.shadowOffset
|| m_state.shadowBlur != state.shadowBlur
|| m_state.shadowColor != state.shadowColor))
- changeFlags |= GraphicsContextState::ShadowChange;
+ changeFlags.add(GraphicsContextState::ShadowChange);
CHECK_FOR_CHANGED_PROPERTY(StrokeThicknessChange, strokeThickness);
CHECK_FOR_CHANGED_PROPERTY(TextDrawingModeChange, textDrawingMode);
@@ -98,9 +98,11 @@
CHECK_FOR_CHANGED_PROPERTY(FillRuleChange, fillRule);
CHECK_FOR_CHANGED_PROPERTY(AlphaChange, alpha);
- if ((m_changeFlags & (GraphicsContextState::CompositeOperationChange | GraphicsContextState::BlendModeChange))
- && (m_state.compositeOperator != state.compositeOperator || m_state.blendMode != state.blendMode))
- changeFlags |= (GraphicsContextState::CompositeOperationChange | GraphicsContextState::BlendModeChange);
+ if (m_changeFlags.containsAny({ GraphicsContextState::CompositeOperationChange, GraphicsContextState::BlendModeChange })
+ && (m_state.compositeOperator != state.compositeOperator || m_state.blendMode != state.blendMode)) {
+ changeFlags.add(GraphicsContextState::CompositeOperationChange);
+ changeFlags.add(GraphicsContextState::BlendModeChange);
+ }
CHECK_FOR_CHANGED_PROPERTY(ShouldAntialiasChange, shouldAntialias);
CHECK_FOR_CHANGED_PROPERTY(ShouldSmoothFontsChange, shouldSmoothFonts);
@@ -119,19 +121,19 @@
void GraphicsContextStateChange::accumulate(const GraphicsContextState& state, GraphicsContextState::StateChangeFlags flags)
{
// FIXME: This code should move to GraphicsContextState.
- if (flags & GraphicsContextState::StrokeGradientChange)
+ if (flags.contains(GraphicsContextState::StrokeGradientChange))
m_state.strokeGradient = state.strokeGradient;
- if (flags & GraphicsContextState::StrokePatternChange)
+ if (flags.contains(GraphicsContextState::StrokePatternChange))
m_state.strokePattern = state.strokePattern;
- if (flags & GraphicsContextState::FillGradientChange)
+ if (flags.contains(GraphicsContextState::FillGradientChange))
m_state.fillGradient = state.fillGradient;
- if (flags & GraphicsContextState::FillPatternChange)
+ if (flags.contains(GraphicsContextState::FillPatternChange))
m_state.fillPattern = state.fillPattern;
- if (flags & GraphicsContextState::ShadowChange) {
+ if (flags.contains(GraphicsContextState::ShadowChange)) {
// FIXME: Deal with state.shadowsUseLegacyRadius.
m_state.shadowOffset = state.shadowOffset;
m_state.shadowBlur = state.shadowBlur;
@@ -138,73 +140,73 @@
m_state.shadowColor = state.shadowColor;
}
- if (flags & GraphicsContextState::StrokeThicknessChange)
+ if (flags.contains(GraphicsContextState::StrokeThicknessChange))
m_state.strokeThickness = state.strokeThickness;
- if (flags & GraphicsContextState::TextDrawingModeChange)
+ if (flags.contains(GraphicsContextState::TextDrawingModeChange))
m_state.textDrawingMode = state.textDrawingMode;
- if (flags & GraphicsContextState::StrokeColorChange)
+ if (flags.contains(GraphicsContextState::StrokeColorChange))
m_state.strokeColor = state.strokeColor;
- if (flags & GraphicsContextState::FillColorChange)
+ if (flags.contains(GraphicsContextState::FillColorChange))
m_state.fillColor = state.fillColor;
- if (flags & GraphicsContextState::StrokeStyleChange)
+ if (flags.contains(GraphicsContextState::StrokeStyleChange))
m_state.strokeStyle = state.strokeStyle;
- if (flags & GraphicsContextState::FillRuleChange)
+ if (flags.contains(GraphicsContextState::FillRuleChange))
m_state.fillRule = state.fillRule;
- if (flags & GraphicsContextState::AlphaChange)
+ if (flags.contains(GraphicsContextState::AlphaChange))
m_state.alpha = state.alpha;
- if (flags & (GraphicsContextState::CompositeOperationChange | GraphicsContextState::BlendModeChange)) {
+ if (flags.containsAny({ GraphicsContextState::CompositeOperationChange, GraphicsContextState::BlendModeChange })) {
m_state.compositeOperator = state.compositeOperator;
m_state.blendMode = state.blendMode;
}
- if (flags & GraphicsContextState::ShouldAntialiasChange)
+ if (flags.contains(GraphicsContextState::ShouldAntialiasChange))
m_state.shouldAntialias = state.shouldAntialias;
- if (flags & GraphicsContextState::ShouldSmoothFontsChange)
+ if (flags.contains(GraphicsContextState::ShouldSmoothFontsChange))
m_state.shouldSmoothFonts = state.shouldSmoothFonts;
- if (flags & GraphicsContextState::ShouldSubpixelQuantizeFontsChange)
+ if (flags.contains(GraphicsContextState::ShouldSubpixelQuantizeFontsChange))
m_state.shouldSubpixelQuantizeFonts = state.shouldSubpixelQuantizeFonts;
- if (flags & GraphicsContextState::ShadowsIgnoreTransformsChange)
+ if (flags.contains(GraphicsContextState::ShadowsIgnoreTransformsChange))
m_state.shadowsIgnoreTransforms = state.shadowsIgnoreTransforms;
- if (flags & GraphicsContextState::DrawLuminanceMaskChange)
+ if (flags.contains(GraphicsContextState::DrawLuminanceMaskChange))
m_state.drawLuminanceMask = state.drawLuminanceMask;
- if (flags & GraphicsContextState::ImageInterpolationQualityChange)
+ if (flags.contains(GraphicsContextState::ImageInterpolationQualityChange))
m_state.imageInterpolationQuality = state.imageInterpolationQuality;
#if HAVE(OS_DARK_MODE_SUPPORT)
- if (flags & GraphicsContextState::UseDarkAppearanceChange)
+ if (flags.contains(GraphicsContextState::UseDarkAppearanceChange))
m_state.useDarkAppearance = state.useDarkAppearance;
#endif
- m_changeFlags |= flags;
+ m_changeFlags.add(flags);
}
void GraphicsContextStateChange::apply(GraphicsContext& context) const
{
- if (m_changeFlags & GraphicsContextState::StrokeGradientChange)
+ if (m_changeFlags.contains(GraphicsContextState::StrokeGradientChange))
context.setStrokeGradient(*m_state.strokeGradient);
- if (m_changeFlags & GraphicsContextState::StrokePatternChange)
+ if (m_changeFlags.contains(GraphicsContextState::StrokePatternChange))
context.setStrokePattern(*m_state.strokePattern);
- if (m_changeFlags & GraphicsContextState::FillGradientChange)
+ if (m_changeFlags.contains(GraphicsContextState::FillGradientChange))
context.setFillGradient(*m_state.fillGradient);
- if (m_changeFlags & GraphicsContextState::FillPatternChange)
+ if (m_changeFlags.contains(GraphicsContextState::FillPatternChange))
context.setFillPattern(*m_state.fillPattern);
- if (m_changeFlags & GraphicsContextState::ShadowChange) {
+ if (m_changeFlags.contains(GraphicsContextState::ShadowChange)) {
#if USE(CG)
if (m_state.shadowsUseLegacyRadius)
context.setLegacyShadow(m_state.shadowOffset, m_state.shadowBlur, m_state.shadowColor);
@@ -213,50 +215,50 @@
context.setShadow(m_state.shadowOffset, m_state.shadowBlur, m_state.shadowColor);
}
- if (m_changeFlags & GraphicsContextState::StrokeThicknessChange)
+ if (m_changeFlags.contains(GraphicsContextState::StrokeThicknessChange))
context.setStrokeThickness(m_state.strokeThickness);
- if (m_changeFlags & GraphicsContextState::TextDrawingModeChange)
+ if (m_changeFlags.contains(GraphicsContextState::TextDrawingModeChange))
context.setTextDrawingMode(m_state.textDrawingMode);
- if (m_changeFlags & GraphicsContextState::StrokeColorChange)
+ if (m_changeFlags.contains(GraphicsContextState::StrokeColorChange))
context.setStrokeColor(m_state.strokeColor);
- if (m_changeFlags & GraphicsContextState::FillColorChange)
+ if (m_changeFlags.contains(GraphicsContextState::FillColorChange))
context.setFillColor(m_state.fillColor);
- if (m_changeFlags & GraphicsContextState::StrokeStyleChange)
+ if (m_changeFlags.contains(GraphicsContextState::StrokeStyleChange))
context.setStrokeStyle(m_state.strokeStyle);
- if (m_changeFlags & GraphicsContextState::FillRuleChange)
+ if (m_changeFlags.contains(GraphicsContextState::FillRuleChange))
context.setFillRule(m_state.fillRule);
- if (m_changeFlags & GraphicsContextState::AlphaChange)
+ if (m_changeFlags.contains(GraphicsContextState::AlphaChange))
context.setAlpha(m_state.alpha);
- if (m_changeFlags & (GraphicsContextState::CompositeOperationChange | GraphicsContextState::BlendModeChange))
+ if (m_changeFlags.containsAny({ GraphicsContextState::CompositeOperationChange, GraphicsContextState::BlendModeChange }))
context.setCompositeOperation(m_state.compositeOperator, m_state.blendMode);
- if (m_changeFlags & GraphicsContextState::ShouldAntialiasChange)
+ if (m_changeFlags.contains(GraphicsContextState::ShouldAntialiasChange))
context.setShouldAntialias(m_state.shouldAntialias);
- if (m_changeFlags & GraphicsContextState::ShouldSmoothFontsChange)
+ if (m_changeFlags.contains(GraphicsContextState::ShouldSmoothFontsChange))
context.setShouldSmoothFonts(m_state.shouldSmoothFonts);
- if (m_changeFlags & GraphicsContextState::ShouldSubpixelQuantizeFontsChange)
+ if (m_changeFlags.contains(GraphicsContextState::ShouldSubpixelQuantizeFontsChange))
context.setShouldSubpixelQuantizeFonts(m_state.shouldSubpixelQuantizeFonts);
- if (m_changeFlags & GraphicsContextState::ShadowsIgnoreTransformsChange)
+ if (m_changeFlags.contains(GraphicsContextState::ShadowsIgnoreTransformsChange))
context.setShadowsIgnoreTransforms(m_state.shadowsIgnoreTransforms);
- if (m_changeFlags & GraphicsContextState::DrawLuminanceMaskChange)
+ if (m_changeFlags.contains(GraphicsContextState::DrawLuminanceMaskChange))
context.setDrawLuminanceMask(m_state.drawLuminanceMask);
- if (m_changeFlags & GraphicsContextState::ImageInterpolationQualityChange)
+ if (m_changeFlags.contains(GraphicsContextState::ImageInterpolationQualityChange))
context.setImageInterpolationQuality(m_state.imageInterpolationQuality);
#if HAVE(OS_DARK_MODE_SUPPORT)
- if (m_changeFlags & GraphicsContextState::UseDarkAppearanceChange)
+ if (m_changeFlags.contains(GraphicsContextState::UseDarkAppearanceChange))
context.setUseDarkAppearance(m_state.useDarkAppearance);
#endif
}
@@ -263,21 +265,21 @@
void GraphicsContextStateChange::dump(TextStream& ts) const
{
- ts.dumpProperty("change-flags", m_changeFlags);
+ ts.dumpProperty("change-flags", m_changeFlags.toRaw());
- if (m_changeFlags & GraphicsContextState::StrokeGradientChange)
+ if (m_changeFlags.contains(GraphicsContextState::StrokeGradientChange))
ts.dumpProperty("stroke-gradient", m_state.strokeGradient.get());
- if (m_changeFlags & GraphicsContextState::StrokePatternChange)
+ if (m_changeFlags.contains(GraphicsContextState::StrokePatternChange))
ts.dumpProperty("stroke-pattern", m_state.strokePattern.get());
- if (m_changeFlags & GraphicsContextState::FillGradientChange)
+ if (m_changeFlags.contains(GraphicsContextState::FillGradientChange))
ts.dumpProperty("fill-gradient", m_state.fillGradient.get());
- if (m_changeFlags & GraphicsContextState::FillPatternChange)
+ if (m_changeFlags.contains(GraphicsContextState::FillPatternChange))
ts.dumpProperty("fill-pattern", m_state.fillPattern.get());
- if (m_changeFlags & GraphicsContextState::ShadowChange) {
+ if (m_changeFlags.contains(GraphicsContextState::ShadowChange)) {
ts.dumpProperty("shadow-blur", m_state.shadowBlur);
ts.dumpProperty("shadow-offset", m_state.shadowOffset);
#if USE(CG)
@@ -285,50 +287,50 @@
#endif
}
- if (m_changeFlags & GraphicsContextState::StrokeThicknessChange)
+ if (m_changeFlags.contains(GraphicsContextState::StrokeThicknessChange))
ts.dumpProperty("stroke-thickness", m_state.strokeThickness);
- if (m_changeFlags & GraphicsContextState::TextDrawingModeChange)
+ if (m_changeFlags.contains(GraphicsContextState::TextDrawingModeChange))
ts.dumpProperty("text-drawing-mode", m_state.textDrawingMode);
- if (m_changeFlags & GraphicsContextState::StrokeColorChange)
+ if (m_changeFlags.contains(GraphicsContextState::StrokeColorChange))
ts.dumpProperty("stroke-color", m_state.strokeColor);
- if (m_changeFlags & GraphicsContextState::FillColorChange)
+ if (m_changeFlags.contains(GraphicsContextState::FillColorChange))
ts.dumpProperty("fill-color", m_state.fillColor);
- if (m_changeFlags & GraphicsContextState::StrokeStyleChange)
+ if (m_changeFlags.contains(GraphicsContextState::StrokeStyleChange))
ts.dumpProperty("stroke-style", m_state.strokeStyle);
- if (m_changeFlags & GraphicsContextState::FillRuleChange)
+ if (m_changeFlags.contains(GraphicsContextState::FillRuleChange))
ts.dumpProperty("fill-rule", m_state.fillRule);
- if (m_changeFlags & GraphicsContextState::AlphaChange)
+ if (m_changeFlags.contains(GraphicsContextState::AlphaChange))
ts.dumpProperty("alpha", m_state.alpha);
- if (m_changeFlags & GraphicsContextState::CompositeOperationChange)
+ if (m_changeFlags.contains(GraphicsContextState::CompositeOperationChange))
ts.dumpProperty("composite-operator", m_state.compositeOperator);
- if (m_changeFlags & GraphicsContextState::BlendModeChange)
+ if (m_changeFlags.contains(GraphicsContextState::BlendModeChange))
ts.dumpProperty("blend-mode", m_state.blendMode);
- if (m_changeFlags & GraphicsContextState::ShouldAntialiasChange)
+ if (m_changeFlags.contains(GraphicsContextState::ShouldAntialiasChange))
ts.dumpProperty("should-antialias", m_state.shouldAntialias);
- if (m_changeFlags & GraphicsContextState::ShouldSmoothFontsChange)
+ if (m_changeFlags.contains(GraphicsContextState::ShouldSmoothFontsChange))
ts.dumpProperty("should-smooth-fonts", m_state.shouldSmoothFonts);
- if (m_changeFlags & GraphicsContextState::ShouldSubpixelQuantizeFontsChange)
+ if (m_changeFlags.contains(GraphicsContextState::ShouldSubpixelQuantizeFontsChange))
ts.dumpProperty("should-subpixel-quantize-fonts", m_state.shouldSubpixelQuantizeFonts);
- if (m_changeFlags & GraphicsContextState::ShadowsIgnoreTransformsChange)
+ if (m_changeFlags.contains(GraphicsContextState::ShadowsIgnoreTransformsChange))
ts.dumpProperty("shadows-ignore-transforms", m_state.shadowsIgnoreTransforms);
- if (m_changeFlags & GraphicsContextState::DrawLuminanceMaskChange)
+ if (m_changeFlags.contains(GraphicsContextState::DrawLuminanceMaskChange))
ts.dumpProperty("draw-luminance-mask", m_state.drawLuminanceMask);
#if HAVE(OS_DARK_MODE_SUPPORT)
- if (m_changeFlags & GraphicsContextState::UseDarkAppearanceChange)
+ if (m_changeFlags.contains(GraphicsContextState::UseDarkAppearanceChange))
ts.dumpProperty("use-dark-appearance", m_state.useDarkAppearance);
#endif
}
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (253045 => 253046)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2019-12-03 16:28:22 UTC (rev 253045)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2019-12-03 16:50:43 UTC (rev 253046)
@@ -37,6 +37,7 @@
#include "Pattern.h"
#include <wtf/Function.h>
#include <wtf/Noncopyable.h>
+#include <wtf/OptionSet.h>
#if USE(CG)
typedef struct CGContext PlatformGraphicsContext;
@@ -171,7 +172,7 @@
UseDarkAppearanceChange = 1 << 22,
#endif
};
- typedef uint32_t StateChangeFlags;
+ typedef OptionSet<Change> StateChangeFlags;
RefPtr<Gradient> strokeGradient;
RefPtr<Pattern> strokePattern;
Modified: trunk/Source/WebCore/platform/graphics/Pattern.h (253045 => 253046)
--- trunk/Source/WebCore/platform/graphics/Pattern.h 2019-12-03 16:28:22 UTC (rev 253045)
+++ trunk/Source/WebCore/platform/graphics/Pattern.h 2019-12-03 16:50:43 UTC (rev 253046)
@@ -58,7 +58,7 @@
class Pattern final : public RefCounted<Pattern> {
public:
static Ref<Pattern> create(Ref<Image>&& tileImage, bool repeatX, bool repeatY);
- ~Pattern();
+ WEBCORE_EXPORT ~Pattern();
Image& tileImage() const { return m_tileImage.get(); }
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.h (253045 => 253046)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.h 2019-12-03 16:28:22 UTC (rev 253045)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.h 2019-12-03 16:50:43 UTC (rev 253046)
@@ -79,9 +79,13 @@
#if !defined(NDEBUG) || !LOG_DISABLED
WTF::CString description() const;
- void dump() const;
+ WEBCORE_EXPORT void dump() const;
#endif
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<DisplayList> decode(Decoder&);
+
+
private:
Item& append(Ref<Item>&& item)
{
@@ -102,6 +106,38 @@
Vector<Ref<Item>> m_list;
};
+
+template<class Encoder>
+void DisplayList::encode(Encoder& encoder) const
+{
+ encoder << static_cast<uint64_t>(m_list.size());
+
+ for (auto& item : m_list)
+ encoder << item.get();
+}
+
+template<class Decoder>
+Optional<DisplayList> DisplayList::decode(Decoder& decoder)
+{
+ Optional<uint64_t> itemCount;
+ decoder >> itemCount;
+ if (!itemCount)
+ return WTF::nullopt;
+
+ DisplayList displayList;
+
+ for (uint64_t i = 0; i < *itemCount; i++) {
+ auto item = Item::decode(decoder);
+ // FIXME: Once we can decode all types, failing to decode an item should turn into a decode failure.
+ // For now, we just have to ignore it.
+ if (!item)
+ continue;
+ displayList.append(WTFMove(*item));
+ }
+
+ return displayList;
+}
+
} // DisplayList
WTF::TextStream& operator<<(WTF::TextStream&, const DisplayList::DisplayList&);
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp (253045 => 253046)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp 2019-12-03 16:28:22 UTC (rev 253045)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp 2019-12-03 16:50:43 UTC (rev 253046)
@@ -29,6 +29,10 @@
#include "FontCascade.h"
#include <wtf/text/TextStream.h>
+#if USE(CG)
+#include "GraphicsContextPlatformPrivateCG.h"
+#endif
+
namespace WebCore {
namespace DisplayList {
@@ -44,6 +48,13 @@
}
#endif
+Item::Item(ItemType type)
+ : m_type(type)
+{
+}
+
+Item::~Item() = default;
+
size_t Item::sizeInBytes(const Item& item)
{
switch (item.type()) {
@@ -162,6 +173,20 @@
return ts;
}
+DrawingItem::DrawingItem(ItemType type)
+ : Item(type)
+{
+}
+
+DrawingItem::~DrawingItem() = default;
+
+Save::Save()
+ : Item(ItemType::Save)
+{
+}
+
+Save::~Save() = default;
+
void Save::apply(GraphicsContext& context) const
{
context.save();
@@ -173,11 +198,27 @@
return ts;
}
+Restore::Restore()
+ : Item(ItemType::Restore)
+{
+}
+
+Restore::~Restore() = default;
+
void Restore::apply(GraphicsContext& context) const
{
context.restore();
}
+Translate::Translate(float x, float y)
+ : Item(ItemType::Translate)
+ , m_x(x)
+ , m_y(y)
+{
+}
+
+Translate::~Translate() = default;
+
void Translate::apply(GraphicsContext& context) const
{
context.translate(m_x, m_y);
@@ -191,6 +232,14 @@
return ts;
}
+Rotate::Rotate(float angle)
+ : Item(ItemType::Rotate)
+ , m_angle(angle)
+{
+}
+
+Rotate::~Rotate() = default;
+
void Rotate::apply(GraphicsContext& context) const
{
context.rotate(m_angle);
@@ -203,6 +252,14 @@
return ts;
}
+Scale::Scale(const FloatSize& size)
+ : Item(ItemType::Scale)
+ , m_size(size)
+{
+}
+
+Scale::~Scale() = default;
+
void Scale::apply(GraphicsContext& context) const
{
context.scale(m_size);
@@ -221,6 +278,8 @@
{
}
+ConcatenateCTM::~ConcatenateCTM() = default;
+
void ConcatenateCTM::apply(GraphicsContext& context) const
{
context.concatCTM(m_transform);
@@ -233,6 +292,20 @@
return ts;
}
+SetState::SetState(const GraphicsContextState& state, GraphicsContextState::StateChangeFlags flags)
+ : Item(ItemType::SetState)
+ , m_state(state, flags)
+{
+}
+
+SetState::SetState(const GraphicsContextStateChange& stateChange)
+ : Item(ItemType::SetState)
+ , m_state(stateChange)
+{
+}
+
+SetState::~SetState() = default;
+
void SetState::apply(GraphicsContext& context) const
{
m_state.apply(context);
@@ -551,6 +624,15 @@
return ts;
}
+DrawRect::DrawRect(const FloatRect& rect, float borderThickness)
+ : DrawingItem(ItemType::DrawRect)
+ , m_rect(rect)
+ , m_borderThickness(borderThickness)
+{
+}
+
+DrawRect::~DrawRect() = default;
+
void DrawRect::apply(GraphicsContext& context) const
{
context.drawRect(m_rect, m_borderThickness);
@@ -643,6 +725,14 @@
return ts;
}
+DrawPath::DrawPath(const Path& path)
+ : DrawingItem(ItemType::DrawPath)
+ , m_path(path)
+{
+}
+
+DrawPath::~DrawPath() = default;
+
void DrawPath::apply(GraphicsContext& context) const
{
#if USE(CG)
@@ -705,6 +795,14 @@
return ts;
}
+FillRect::FillRect(const FloatRect& rect)
+ : DrawingItem(ItemType::FillRect)
+ , m_rect(rect)
+{
+}
+
+FillRect::~FillRect() = default;
+
void FillRect::apply(GraphicsContext& context) const
{
context.fillRect(m_rect);
@@ -717,6 +815,15 @@
return ts;
}
+FillRectWithColor::FillRectWithColor(const FloatRect& rect, const Color& color)
+ : DrawingItem(ItemType::FillRectWithColor)
+ , m_rect(rect)
+ , m_color(color)
+{
+}
+
+FillRectWithColor::~FillRectWithColor() = default;
+
void FillRectWithColor::apply(GraphicsContext& context) const
{
context.fillRect(m_rect, m_color);
@@ -743,6 +850,17 @@
return ts;
}
+FillCompositedRect::FillCompositedRect(const FloatRect& rect, const Color& color, CompositeOperator op, BlendMode blendMode)
+ : DrawingItem(ItemType::FillCompositedRect)
+ , m_rect(rect)
+ , m_color(color)
+ , m_op(op)
+ , m_blendMode(blendMode)
+{
+}
+
+FillCompositedRect::~FillCompositedRect() = default;
+
void FillCompositedRect::apply(GraphicsContext& context) const
{
context.fillRect(m_rect, m_color, m_op, m_blendMode);
@@ -786,6 +904,14 @@
return ts;
}
+FillPath::FillPath(const Path& path)
+ : DrawingItem(ItemType::FillPath)
+ , m_path(path)
+{
+}
+
+FillPath::~FillPath() = default;
+
void FillPath::apply(GraphicsContext& context) const
{
context.fillPath(m_path);
@@ -873,6 +999,14 @@
return ts;
}
+ClearRect::ClearRect(const FloatRect& rect)
+ : DrawingItem(ItemType::ClearRect)
+ , m_rect(rect)
+{
+}
+
+ClearRect::~ClearRect() = default;
+
void ClearRect::apply(GraphicsContext& context) const
{
context.clearRect(m_rect);
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h (253045 => 253046)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h 2019-12-03 16:28:22 UTC (rev 253045)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h 2019-12-03 16:50:43 UTC (rev 253046)
@@ -35,10 +35,6 @@
#include <wtf/RefCounted.h>
#include <wtf/TypeCasts.h>
-#if USE(CG)
-#include "GraphicsContextPlatformPrivateCG.h"
-#endif
-
namespace WTF {
class TextStream;
}
@@ -49,7 +45,7 @@
namespace DisplayList {
-enum class ItemType {
+enum class ItemType : uint8_t {
Save,
Restore,
Translate,
@@ -107,13 +103,9 @@
public:
Item() = delete;
- Item(ItemType type)
- : m_type(type)
- {
- }
+ WEBCORE_EXPORT Item(ItemType);
+ WEBCORE_EXPORT virtual ~Item();
- virtual ~Item() = default;
-
ItemType type() const
{
return m_type;
@@ -134,16 +126,16 @@
static bool isStateItemType(ItemType itemType)
{
switch (itemType) {
- case ItemType:: Translate:
- case ItemType:: Rotate:
- case ItemType:: Scale:
- case ItemType:: ConcatenateCTM:
- case ItemType:: SetState:
- case ItemType:: SetLineCap:
- case ItemType:: SetLineDash:
- case ItemType:: SetLineJoin:
- case ItemType:: SetMiterLimit:
- case ItemType:: ClearShadow:
+ case ItemType::Translate:
+ case ItemType::Rotate:
+ case ItemType::Scale:
+ case ItemType::ConcatenateCTM:
+ case ItemType::SetState:
+ case ItemType::SetLineCap:
+ case ItemType::SetLineDash:
+ case ItemType::SetLineJoin:
+ case ItemType::SetMiterLimit:
+ case ItemType::ClearShadow:
return true;
default:
return false;
@@ -156,6 +148,9 @@
#endif
static size_t sizeInBytes(const Item&);
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<Ref<Item>> decode(Decoder&);
+
private:
ItemType m_type;
};
@@ -162,11 +157,10 @@
class DrawingItem : public Item {
public:
- explicit DrawingItem(ItemType type)
- : Item(type)
- {
- }
+ WEBCORE_EXPORT explicit DrawingItem(ItemType);
+ WEBCORE_EXPORT virtual ~DrawingItem();
+
void setExtent(const FloatRect& r) { m_extent = r; }
const FloatRect& extent() const { return m_extent.value(); }
@@ -189,15 +183,17 @@
return adoptRef(*new Save);
}
+ WEBCORE_EXPORT virtual ~Save();
+
// Index in the display list of the corresponding Restore item. 0 if unmatched.
size_t restoreIndex() const { return m_restoreIndex; }
void setRestoreIndex(size_t index) { m_restoreIndex = index; }
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<Ref<Save>> decode(Decoder&);
+
private:
- Save()
- : Item(ItemType::Save)
- {
- }
+ WEBCORE_EXPORT Save();
void apply(GraphicsContext&) const override;
@@ -204,6 +200,26 @@
size_t m_restoreIndex { 0 };
};
+template<class Encoder>
+void Save::encode(Encoder& encoder) const
+{
+ encoder << static_cast<uint64_t>(m_restoreIndex);
+}
+
+template<class Decoder>
+Optional<Ref<Save>> Save::decode(Decoder& decoder)
+{
+ Optional<uint64_t> restoreIndex;
+ decoder >> restoreIndex;
+ if (!restoreIndex)
+ return WTF::nullopt;
+
+ // FIXME: Validate restoreIndex? But we don't have the list context here.
+ auto save = Save::create();
+ save->setRestoreIndex(static_cast<size_t>(*restoreIndex));
+ return save;
+}
+
class Restore : public Item {
public:
static Ref<Restore> create()
@@ -211,15 +227,28 @@
return adoptRef(*new Restore);
}
+ WEBCORE_EXPORT virtual ~Restore();
+
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<Ref<Restore>> decode(Decoder&);
+
private:
- Restore()
- : Item(ItemType::Restore)
- {
- }
+ WEBCORE_EXPORT Restore();
void apply(GraphicsContext&) const override;
};
+template<class Encoder>
+void Restore::encode(Encoder&) const
+{
+}
+
+template<class Decoder>
+Optional<Ref<Restore>> Restore::decode(Decoder&)
+{
+ return Restore::create();
+}
+
class Translate : public Item {
public:
static Ref<Translate> create(float x, float y)
@@ -227,16 +256,16 @@
return adoptRef(*new Translate(x, y));
}
+ WEBCORE_EXPORT virtual ~Translate();
+
float x() const { return m_x; }
float y() const { return m_y; }
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<Ref<Translate>> decode(Decoder&);
+
private:
- Translate(float x, float y)
- : Item(ItemType::Translate)
- , m_x(x)
- , m_y(y)
- {
- }
+ WEBCORE_EXPORT Translate(float x, float y);
void apply(GraphicsContext&) const override;
@@ -244,6 +273,29 @@
float m_y;
};
+template<class Encoder>
+void Translate::encode(Encoder& encoder) const
+{
+ encoder << m_x;
+ encoder << m_y;
+}
+
+template<class Decoder>
+Optional<Ref<Translate>> Translate::decode(Decoder& decoder)
+{
+ Optional<float> x;
+ decoder >> x;
+ if (!x)
+ return WTF::nullopt;
+
+ Optional<float> y;
+ decoder >> y;
+ if (!y)
+ return WTF::nullopt;
+
+ return Translate::create(*x, *y);
+}
+
class Rotate : public Item {
public:
static Ref<Rotate> create(float angleInRadians)
@@ -251,14 +303,15 @@
return adoptRef(*new Rotate(angleInRadians));
}
+ WEBCORE_EXPORT virtual ~Rotate();
+
float angle() const { return m_angle; }
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<Ref<Rotate>> decode(Decoder&);
+
private:
- Rotate(float angle)
- : Item(ItemType::Rotate)
- , m_angle(angle)
- {
- }
+ WEBCORE_EXPORT Rotate(float angle);
void apply(GraphicsContext&) const override;
@@ -265,6 +318,23 @@
float m_angle; // In radians.
};
+template<class Encoder>
+void Rotate::encode(Encoder& encoder) const
+{
+ encoder << m_angle;
+}
+
+template<class Decoder>
+Optional<Ref<Rotate>> Rotate::decode(Decoder& decoder)
+{
+ Optional<float> angle;
+ decoder >> angle;
+ if (!angle)
+ return WTF::nullopt;
+
+ return Rotate::create(*angle);
+}
+
class Scale : public Item {
public:
static Ref<Scale> create(const FloatSize& size)
@@ -272,14 +342,15 @@
return adoptRef(*new Scale(size));
}
+ WEBCORE_EXPORT virtual ~Scale();
+
const FloatSize& amount() const { return m_size; }
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<Ref<Scale>> decode(Decoder&);
+
private:
- Scale(const FloatSize& size)
- : Item(ItemType::Scale)
- , m_size(size)
- {
- }
+ WEBCORE_EXPORT Scale(const FloatSize&);
void apply(GraphicsContext&) const override;
@@ -286,6 +357,23 @@
FloatSize m_size;
};
+template<class Encoder>
+void Scale::encode(Encoder& encoder) const
+{
+ encoder << m_size;
+}
+
+template<class Decoder>
+Optional<Ref<Scale>> Scale::decode(Decoder& decoder)
+{
+ Optional<FloatSize> scale;
+ decoder >> scale;
+ if (!scale)
+ return WTF::nullopt;
+
+ return Scale::create(*scale);
+}
+
class ConcatenateCTM : public Item {
public:
static Ref<ConcatenateCTM> create(const AffineTransform& matrix)
@@ -293,10 +381,15 @@
return adoptRef(*new ConcatenateCTM(matrix));
}
+ WEBCORE_EXPORT virtual ~ConcatenateCTM();
+
const AffineTransform& transform() const { return m_transform; }
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<Ref<ConcatenateCTM>> decode(Decoder&);
+
private:
- ConcatenateCTM(const AffineTransform&);
+ WEBCORE_EXPORT ConcatenateCTM(const AffineTransform&);
void apply(GraphicsContext&) const override;
@@ -303,6 +396,23 @@
AffineTransform m_transform;
};
+template<class Encoder>
+void ConcatenateCTM::encode(Encoder& encoder) const
+{
+ encoder << m_transform;
+}
+
+template<class Decoder>
+Optional<Ref<ConcatenateCTM>> ConcatenateCTM::decode(Decoder& decoder)
+{
+ Optional<AffineTransform> transform;
+ decoder >> transform;
+ if (!transform)
+ return WTF::nullopt;
+
+ return ConcatenateCTM::create(*transform);
+}
+
class SetState : public Item {
public:
static Ref<SetState> create(const GraphicsContextState& state, GraphicsContextState::StateChangeFlags flags)
@@ -309,6 +419,13 @@
{
return adoptRef(*new SetState(state, flags));
}
+
+ static Ref<SetState> create(const GraphicsContextStateChange& stateChange)
+ {
+ return adoptRef(*new SetState(stateChange));
+ }
+
+ WEBCORE_EXPORT virtual ~SetState();
const GraphicsContextStateChange& state() const { return m_state; }
@@ -319,12 +436,13 @@
static void builderState(GraphicsContext&, const GraphicsContextState&, GraphicsContextState::StateChangeFlags);
static void dumpStateChanges(WTF::TextStream&, const GraphicsContextState&, GraphicsContextState::StateChangeFlags);
+
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<Ref<SetState>> decode(Decoder&);
+
private:
- SetState(const GraphicsContextState& state, GraphicsContextState::StateChangeFlags flags)
- : Item(ItemType::SetState)
- , m_state(state, flags)
- {
- }
+ WEBCORE_EXPORT SetState(const GraphicsContextState&, GraphicsContextState::StateChangeFlags);
+ WEBCORE_EXPORT SetState(const GraphicsContextStateChange&);
void apply(GraphicsContext&) const override;
@@ -331,6 +449,64 @@
GraphicsContextStateChange m_state;
};
+template<class Encoder>
+void SetState::encode(Encoder& encoder) const
+{
+ encoder << m_state.m_changeFlags;
+
+ // FIXME: Encode the other state changes.
+
+ if (m_state.m_changeFlags.contains(GraphicsContextState::StrokeColorChange))
+ encoder << m_state.m_state.strokeColor;
+
+ if (m_state.m_changeFlags.contains(GraphicsContextState::FillColorChange))
+ encoder << m_state.m_state.fillColor;
+
+ if (m_state.m_changeFlags.contains(GraphicsContextState::AlphaChange))
+ encoder << m_state.m_state.alpha;
+}
+
+template<class Decoder>
+Optional<Ref<SetState>> SetState::decode(Decoder& decoder)
+{
+ Optional<GraphicsContextState::StateChangeFlags> changeFlags;
+ decoder >> changeFlags;
+ if (!changeFlags)
+ return WTF::nullopt;
+
+ GraphicsContextStateChange stateChange;
+ stateChange.m_changeFlags = *changeFlags;
+
+ if (stateChange.m_changeFlags.contains(GraphicsContextState::StrokeColorChange)) {
+ Optional<Color> strokeColor;
+ decoder >> strokeColor;
+ if (!strokeColor)
+ return WTF::nullopt;
+
+ stateChange.m_state.strokeColor = *strokeColor;
+ }
+
+ if (stateChange.m_changeFlags.contains(GraphicsContextState::FillColorChange)) {
+ Optional<Color> fillColor;
+ decoder >> fillColor;
+ if (!fillColor)
+ return WTF::nullopt;
+
+ stateChange.m_state.fillColor = *fillColor;
+ }
+
+ if (stateChange.m_changeFlags.contains(GraphicsContextState::AlphaChange)) {
+ Optional<float> alpha;
+ decoder >> alpha;
+ if (!alpha)
+ return WTF::nullopt;
+
+ stateChange.m_state.alpha = *alpha;
+ }
+
+ return SetState::create(stateChange);
+}
+
class SetLineCap : public Item {
public:
static Ref<SetLineCap> create(LineCap lineCap)
@@ -741,16 +917,16 @@
return adoptRef(*new DrawRect(rect, borderThickness));
}
+ WEBCORE_EXPORT virtual ~DrawRect();
+
FloatRect rect() const { return m_rect; }
float borderThickness() const { return m_borderThickness; }
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<Ref<DrawRect>> decode(Decoder&);
+
private:
- DrawRect(const FloatRect& rect, float borderThickness)
- : DrawingItem(ItemType::DrawRect)
- , m_rect(rect)
- , m_borderThickness(borderThickness)
- {
- }
+ WEBCORE_EXPORT DrawRect(const FloatRect&, float borderThickness);
void apply(GraphicsContext&) const override;
Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; }
@@ -759,6 +935,34 @@
float m_borderThickness;
};
+template<class Encoder>
+void DrawRect::encode(Encoder& encoder) const
+{
+ encoder << m_rect;
+ encoder << m_borderThickness;
+}
+
+template<class Decoder>
+Optional<Ref<DrawRect>> DrawRect::decode(Decoder& decoder)
+{
+ Optional<FloatRect> rect;
+ decoder >> rect;
+ if (!rect)
+ return WTF::nullopt;
+
+ Optional<float> borderThickness;
+ decoder >> borderThickness;
+ if (!borderThickness)
+ return WTF::nullopt;
+
+ auto item = DrawRect::create(*rect, *borderThickness);
+
+ if (!decodeForDrawingItem(decoder, item.get()))
+ return WTF::nullopt;
+
+ return item;
+}
+
class DrawLine : public DrawingItem {
public:
static Ref<DrawLine> create(const FloatPoint& point1, const FloatPoint& point2)
@@ -878,14 +1082,15 @@
return adoptRef(*new DrawPath(path));
}
+ WEBCORE_EXPORT virtual ~DrawPath();
+
const Path& path() const { return m_path; }
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<Ref<DrawPath>> decode(Decoder&);
+
private:
- DrawPath(const Path& path)
- : DrawingItem(ItemType::DrawPath)
- , m_path(path)
- {
- }
+ WEBCORE_EXPORT DrawPath(const Path&);
void apply(GraphicsContext&) const override;
@@ -894,6 +1099,28 @@
const Path m_path;
};
+template<class Encoder>
+void DrawPath::encode(Encoder& encoder) const
+{
+ encoder << m_path;
+}
+
+template<class Decoder>
+Optional<Ref<DrawPath>> DrawPath::decode(Decoder& decoder)
+{
+ Optional<Path> path;
+ decoder >> path;
+ if (!path)
+ return WTF::nullopt;
+
+ auto item = DrawPath::create(*path);
+
+ if (!decodeForDrawingItem(decoder, item.get()))
+ return WTF::nullopt;
+
+ return item;
+}
+
class DrawFocusRingPath : public DrawingItem {
public:
static Ref<DrawFocusRingPath> create(const Path& path, float width, float offset, const Color& color)
@@ -965,14 +1192,15 @@
return adoptRef(*new FillRect(rect));
}
+ WEBCORE_EXPORT virtual ~FillRect();
+
FloatRect rect() const { return m_rect; }
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<Ref<FillRect>> decode(Decoder&);
+
private:
- FillRect(const FloatRect& rect)
- : DrawingItem(ItemType::FillRect)
- , m_rect(rect)
- {
- }
+ WEBCORE_EXPORT FillRect(const FloatRect&);
void apply(GraphicsContext&) const override;
Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; }
@@ -980,6 +1208,28 @@
FloatRect m_rect;
};
+template<class Encoder>
+void FillRect::encode(Encoder& encoder) const
+{
+ encoder << m_rect;
+}
+
+template<class Decoder>
+Optional<Ref<FillRect>> FillRect::decode(Decoder& decoder)
+{
+ Optional<FloatRect> rect;
+ decoder >> rect;
+ if (!rect)
+ return WTF::nullopt;
+
+ auto item = FillRect::create(*rect);
+
+ if (!decodeForDrawingItem(decoder, item.get()))
+ return WTF::nullopt;
+
+ return item;
+}
+
// FIXME: Make these inherit from FillRect proper.
class FillRectWithColor : public DrawingItem {
public:
@@ -988,16 +1238,16 @@
return adoptRef(*new FillRectWithColor(rect, color));
}
+ WEBCORE_EXPORT virtual ~FillRectWithColor();
+
FloatRect rect() const { return m_rect; }
const Color& color() const { return m_color; }
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<Ref<FillRectWithColor>> decode(Decoder&);
+
private:
- FillRectWithColor(const FloatRect& rect, const Color& color)
- : DrawingItem(ItemType::FillRectWithColor)
- , m_rect(rect)
- , m_color(color)
- {
- }
+ WEBCORE_EXPORT FillRectWithColor(const FloatRect&, const Color&);
void apply(GraphicsContext&) const override;
Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; }
@@ -1006,6 +1256,34 @@
Color m_color;
};
+template<class Encoder>
+void FillRectWithColor::encode(Encoder& encoder) const
+{
+ encoder << m_rect;
+ encoder << m_color;
+}
+
+template<class Decoder>
+Optional<Ref<FillRectWithColor>> FillRectWithColor::decode(Decoder& decoder)
+{
+ Optional<FloatRect> rect;
+ decoder >> rect;
+ if (!rect)
+ return WTF::nullopt;
+
+ Optional<Color> color;
+ decoder >> color;
+ if (!color)
+ return WTF::nullopt;
+
+ auto item = FillRectWithColor::create(*rect, *color);
+
+ if (!decodeForDrawingItem(decoder, item.get()))
+ return WTF::nullopt;
+
+ return item;
+}
+
class FillRectWithGradient : public DrawingItem {
public:
static Ref<FillRectWithGradient> create(const FloatRect& rect, Gradient& gradient)
@@ -1037,20 +1315,18 @@
return adoptRef(*new FillCompositedRect(rect, color, op, blendMode));
}
+ WEBCORE_EXPORT virtual ~FillCompositedRect();
+
FloatRect rect() const { return m_rect; }
const Color& color() const { return m_color; }
CompositeOperator compositeOperator() const { return m_op; }
BlendMode blendMode() const { return m_blendMode; }
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<Ref<FillCompositedRect>> decode(Decoder&);
+
private:
- FillCompositedRect(const FloatRect& rect, const Color& color, CompositeOperator op, BlendMode blendMode)
- : DrawingItem(ItemType::FillCompositedRect)
- , m_rect(rect)
- , m_color(color)
- , m_op(op)
- , m_blendMode(blendMode)
- {
- }
+ WEBCORE_EXPORT FillCompositedRect(const FloatRect&, const Color&, CompositeOperator, BlendMode);
void apply(GraphicsContext&) const override;
Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; }
@@ -1061,6 +1337,46 @@
BlendMode m_blendMode;
};
+template<class Encoder>
+void FillCompositedRect::encode(Encoder& encoder) const
+{
+ encoder << m_rect;
+ encoder << m_color;
+ encoder << m_op;
+ encoder << m_blendMode;
+}
+
+template<class Decoder>
+Optional<Ref<FillCompositedRect>> FillCompositedRect::decode(Decoder& decoder)
+{
+ Optional<FloatRect> rect;
+ decoder >> rect;
+ if (!rect)
+ return WTF::nullopt;
+
+ Optional<Color> color;
+ decoder >> color;
+ if (!color)
+ return WTF::nullopt;
+
+ Optional<CompositeOperator> op;
+ decoder >> op;
+ if (!op)
+ return WTF::nullopt;
+
+ Optional<BlendMode> blendMode;
+ decoder >> blendMode;
+ if (!blendMode)
+ return WTF::nullopt;
+
+ auto item = FillCompositedRect::create(*rect, *color, *op, *blendMode);
+
+ if (!decodeForDrawingItem(decoder, item.get()))
+ return WTF::nullopt;
+
+ return item;
+}
+
class FillRoundedRect : public DrawingItem {
public:
static Ref<FillRoundedRect> create(const FloatRoundedRect& rect, const Color& color, BlendMode blendMode)
@@ -1124,14 +1440,15 @@
return adoptRef(*new FillPath(path));
}
+ WEBCORE_EXPORT virtual ~FillPath();
+
const Path& path() const { return m_path; }
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<Ref<FillPath>> decode(Decoder&);
+
private:
- FillPath(const Path& path)
- : DrawingItem(ItemType::FillPath)
- , m_path(path)
- {
- }
+ WEBCORE_EXPORT FillPath(const Path&);
void apply(GraphicsContext&) const override;
Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_path.fastBoundingRect(); }
@@ -1139,6 +1456,28 @@
const Path m_path;
};
+template<class Encoder>
+void FillPath::encode(Encoder& encoder) const
+{
+ encoder << m_path;
+}
+
+template<class Decoder>
+Optional<Ref<FillPath>> FillPath::decode(Decoder& decoder)
+{
+ Optional<Path> path;
+ decoder >> path;
+ if (!path)
+ return WTF::nullopt;
+
+ auto item = FillPath::create(*path);
+
+ if (!decodeForDrawingItem(decoder, item.get()))
+ return WTF::nullopt;
+
+ return item;
+}
+
class FillEllipse : public DrawingItem {
public:
static Ref<FillEllipse> create(const FloatRect& rect)
@@ -1239,14 +1578,15 @@
return adoptRef(*new ClearRect(rect));
}
+ WEBCORE_EXPORT virtual ~ClearRect();
+
FloatRect rect() const { return m_rect; }
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<Ref<ClearRect>> decode(Decoder&);
+
private:
- ClearRect(const FloatRect& rect)
- : DrawingItem(ItemType::ClearRect)
- , m_rect(rect)
- {
- }
+ WEBCORE_EXPORT ClearRect(const FloatRect&);
void apply(GraphicsContext&) const override;
Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; }
@@ -1254,6 +1594,28 @@
FloatRect m_rect;
};
+template<class Encoder>
+void ClearRect::encode(Encoder& encoder) const
+{
+ encoder << m_rect;
+}
+
+template<class Decoder>
+Optional<Ref<ClearRect>> ClearRect::decode(Decoder& decoder)
+{
+ Optional<FloatRect> rect;
+ decoder >> rect;
+ if (!rect)
+ return WTF::nullopt;
+
+ auto item = ClearRect::create(*rect);
+
+ if (!decodeForDrawingItem(decoder, item.get()))
+ return WTF::nullopt;
+
+ return item;
+}
+
#if USE(CG)
class ApplyStrokePattern : public Item {
public:
@@ -1311,6 +1673,333 @@
WTF::TextStream& operator<<(WTF::TextStream&, const Item&);
+template<class Encoder>
+void Item::encode(Encoder& encoder) const
+{
+ encoder << m_type;
+
+ switch (m_type) {
+ case ItemType::Save:
+ encoder << downcast<Save>(*this);
+ break;
+ case ItemType::Restore:
+ encoder << downcast<Restore>(*this);
+ break;
+ case ItemType::Translate:
+ encoder << downcast<Translate>(*this);
+ break;
+ case ItemType::Rotate:
+ encoder << downcast<Rotate>(*this);
+ break;
+ case ItemType::Scale:
+ encoder << downcast<Scale>(*this);
+ break;
+ case ItemType::ConcatenateCTM:
+ encoder << downcast<ConcatenateCTM>(*this);
+ break;
+ case ItemType::SetState:
+ encoder << downcast<SetState>(*this);
+ break;
+ case ItemType::SetLineCap:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode SetLineCap");
+ break;
+ case ItemType::SetLineDash:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode SetLineDash");
+ break;
+ case ItemType::SetLineJoin:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode SetLineJoin");
+ break;
+ case ItemType::SetMiterLimit:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode SetMiterLimit");
+ break;
+ case ItemType::ClearShadow:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode ClearShadow");
+ break;
+ case ItemType::Clip:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode Clip");
+ break;
+ case ItemType::ClipOut:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode ClipOut");
+ break;
+ case ItemType::ClipOutToPath:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode ClipOutToPath");
+ break;
+ case ItemType::ClipPath:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode ClipPath");
+ break;
+ case ItemType::DrawGlyphs:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode DrawGlyphs");
+ break;
+ case ItemType::DrawImage:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode DrawImage");
+ break;
+ case ItemType::DrawTiledImage:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode DrawTiledImage");
+ break;
+ case ItemType::DrawTiledScaledImage:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode DrawTiledScaledImage");
+ break;
+#if USE(CG) || USE(CAIRO) || USE(DIRECT2D)
+ case ItemType::DrawNativeImage:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode DrawNativeImage");
+ break;
+#endif
+ case ItemType::DrawPattern:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode DrawPattern");
+ break;
+ case ItemType::DrawRect:
+ encoder << downcast<DrawRect>(*this);
+ break;
+ case ItemType::DrawLine:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode DrawLine");
+ break;
+ case ItemType::DrawLinesForText:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode DrawLinesForText");
+ break;
+ case ItemType::DrawDotsForDocumentMarker:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode DrawDotsForDocumentMarker");
+ break;
+ case ItemType::DrawEllipse:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode DrawEllipse");
+ break;
+ case ItemType::DrawPath:
+ encoder << downcast<DrawPath>(*this);
+ break;
+ case ItemType::DrawFocusRingPath:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode DrawFocusRingPath");
+ break;
+ case ItemType::DrawFocusRingRects:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode DrawFocusRingRects");
+ break;
+ case ItemType::FillRect:
+ encoder << downcast<FillRect>(*this);
+ break;
+ case ItemType::FillRectWithColor:
+ encoder << downcast<FillRectWithColor>(*this);
+ break;
+ case ItemType::FillRectWithGradient:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode FillRectWithGradient");
+ break;
+ case ItemType::FillCompositedRect:
+ encoder << downcast<FillCompositedRect>(*this);
+ break;
+ case ItemType::FillRoundedRect:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode FillRoundedRect");
+ break;
+ case ItemType::FillRectWithRoundedHole:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode FillRectWithRoundedHole");
+ break;
+ case ItemType::FillPath:
+ encoder << downcast<FillPath>(*this);
+ break;
+ case ItemType::FillEllipse:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode FillEllipse");
+ break;
+ case ItemType::StrokeRect:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode StrokeRect");
+ break;
+ case ItemType::StrokePath:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode StrokePath");
+ break;
+ case ItemType::StrokeEllipse:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode StrokeEllipse");
+ break;
+ case ItemType::ClearRect:
+ encoder << downcast<ClearRect>(*this);
+ break;
+ case ItemType::BeginTransparencyLayer:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode BeginTransparencyLayer");
+ break;
+ case ItemType::EndTransparencyLayer:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode EndTransparencyLayer");
+ break;
+#if USE(CG)
+ case ItemType::ApplyStrokePattern:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode ApplyStrokePattern");
+ break;
+ case ItemType::ApplyFillPattern:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode ApplyFillPattern");
+ break;
+#endif
+ case ItemType::ApplyDeviceScaleFactor:
+ WTFLogAlways("DisplayList::Item::encode cannot yet encode ApplyDeviceScaleFactor");
+ break;
+ }
+}
+
+template<class Decoder>
+Optional<Ref<Item>> Item::decode(Decoder& decoder)
+{
+ Optional<ItemType> itemType;
+ decoder >> itemType;
+ if (!itemType)
+ return WTF::nullopt;
+
+ switch (*itemType) {
+ case ItemType::Save:
+ if (auto item = Save::decode(decoder))
+ return static_reference_cast<Item>(WTFMove(*item));
+ break;
+ case ItemType::Restore:
+ if (auto item = Restore::decode(decoder))
+ return static_reference_cast<Item>(WTFMove(*item));
+ break;
+ case ItemType::Translate:
+ if (auto item = Translate::decode(decoder))
+ return static_reference_cast<Item>(WTFMove(*item));
+ break;
+ case ItemType::Rotate:
+ if (auto item = Rotate::decode(decoder))
+ return static_reference_cast<Item>(WTFMove(*item));
+ break;
+ case ItemType::Scale:
+ if (auto item = Scale::decode(decoder))
+ return static_reference_cast<Item>(WTFMove(*item));
+ break;
+ case ItemType::ConcatenateCTM:
+ if (auto item = ConcatenateCTM::decode(decoder))
+ return static_reference_cast<Item>(WTFMove(*item));
+ break;
+ case ItemType::SetState:
+ if (auto item = SetState::decode(decoder))
+ return static_reference_cast<Item>(WTFMove(*item));
+ break;
+ case ItemType::SetLineCap:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode SetLineCap");
+ break;
+ case ItemType::SetLineDash:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode SetLineDash");
+ break;
+ case ItemType::SetLineJoin:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode SetLineJoin");
+ break;
+ case ItemType::SetMiterLimit:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode SetMiterLimit");
+ break;
+ case ItemType::ClearShadow:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode ClearShadow");
+ break;
+ case ItemType::Clip:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode Clip");
+ break;
+ case ItemType::ClipOut:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode ClipOut");
+ break;
+ case ItemType::ClipOutToPath:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode ClipOutToPath");
+ break;
+ case ItemType::ClipPath:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode ClipPath");
+ break;
+ case ItemType::DrawGlyphs:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode DrawGlyphs");
+ break;
+ case ItemType::DrawImage:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode DrawImage");
+ break;
+ case ItemType::DrawTiledImage:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode DrawTiledImage");
+ break;
+ case ItemType::DrawTiledScaledImage:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode DrawTiledScaledImage");
+ break;
+#if USE(CG) || USE(CAIRO) || USE(DIRECT2D)
+ case ItemType::DrawNativeImage:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode DrawNativeImage");
+ break;
+#endif
+ case ItemType::DrawPattern:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode DrawPattern");
+ break;
+ case ItemType::DrawRect:
+ if (auto item = DrawRect::decode(decoder))
+ return static_reference_cast<Item>(WTFMove(*item));
+ break;
+ case ItemType::DrawLine:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode DrawLine");
+ break;
+ case ItemType::DrawLinesForText:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode DrawLinesForText");
+ break;
+ case ItemType::DrawDotsForDocumentMarker:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode DrawDotsForDocumentMarker");
+ break;
+ case ItemType::DrawEllipse:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode DrawEllipse");
+ break;
+ case ItemType::DrawPath:
+ if (auto item = DrawPath::decode(decoder))
+ return static_reference_cast<Item>(WTFMove(*item));
+ break;
+ case ItemType::DrawFocusRingPath:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode DrawFocusRingPath");
+ break;
+ case ItemType::DrawFocusRingRects:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode DrawFocusRingRects");
+ break;
+ case ItemType::FillRect:
+ if (auto item = FillRect::decode(decoder))
+ return static_reference_cast<Item>(WTFMove(*item));
+ break;
+ case ItemType::FillRectWithColor:
+ if (auto item = FillRectWithColor::decode(decoder))
+ return static_reference_cast<Item>(WTFMove(*item));
+ break;
+ case ItemType::FillRectWithGradient:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode FillRectWithGradient");
+ break;
+ case ItemType::FillCompositedRect:
+ if (auto item = FillCompositedRect::decode(decoder))
+ return static_reference_cast<Item>(WTFMove(*item));
+ break;
+ case ItemType::FillRoundedRect:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode FillRoundedRect");
+ break;
+ case ItemType::FillRectWithRoundedHole:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode FillRectWithRoundedHole");
+ break;
+ case ItemType::FillPath:
+ if (auto item = FillPath::decode(decoder))
+ return static_reference_cast<Item>(WTFMove(*item));
+ break;
+ case ItemType::FillEllipse:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode FillEllipse");
+ break;
+ case ItemType::StrokeRect:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode StrokeRect");
+ break;
+ case ItemType::StrokePath:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode StrokePath");
+ break;
+ case ItemType::StrokeEllipse:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode StrokeEllipse");
+ break;
+ case ItemType::ClearRect:
+ if (auto item = ClearRect::decode(decoder))
+ return static_reference_cast<Item>(WTFMove(*item));
+ break;
+ case ItemType::BeginTransparencyLayer:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode BeginTransparencyLayer");
+ break;
+ case ItemType::EndTransparencyLayer:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode EndTransparencyLayer");
+ break;
+#if USE(CG)
+ case ItemType::ApplyStrokePattern:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode ApplyStrokePattern");
+ break;
+ case ItemType::ApplyFillPattern:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode ApplyFillPattern");
+ break;
+#endif
+ case ItemType::ApplyDeviceScaleFactor:
+ WTFLogAlways("DisplayList::Item::decode cannot yet decode ApplyDeviceScaleFactor");
+ break;
+ }
+
+ return WTF::nullopt;
+}
+
} // namespace DisplayList
} // namespace WebCore
@@ -1379,3 +2068,63 @@
SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(ApplyDeviceScaleFactor)
SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(ClearShadow)
+namespace WTF {
+
+template<> struct EnumTraits<WebCore::DisplayList::ItemType> {
+ using values = EnumValues<
+ WebCore::DisplayList::ItemType,
+ WebCore::DisplayList::ItemType::Save,
+ WebCore::DisplayList::ItemType::Restore,
+ WebCore::DisplayList::ItemType::Translate,
+ WebCore::DisplayList::ItemType::Rotate,
+ WebCore::DisplayList::ItemType::Scale,
+ WebCore::DisplayList::ItemType::ConcatenateCTM,
+ WebCore::DisplayList::ItemType::SetState,
+ WebCore::DisplayList::ItemType::SetLineCap,
+ WebCore::DisplayList::ItemType::SetLineDash,
+ WebCore::DisplayList::ItemType::SetLineJoin,
+ WebCore::DisplayList::ItemType::SetMiterLimit,
+ WebCore::DisplayList::ItemType::ClearShadow,
+ WebCore::DisplayList::ItemType::Clip,
+ WebCore::DisplayList::ItemType::ClipOut,
+ WebCore::DisplayList::ItemType::ClipOutToPath,
+ WebCore::DisplayList::ItemType::ClipPath,
+ WebCore::DisplayList::ItemType::DrawGlyphs,
+ WebCore::DisplayList::ItemType::DrawImage,
+ WebCore::DisplayList::ItemType::DrawTiledImage,
+ WebCore::DisplayList::ItemType::DrawTiledScaledImage,
+#if USE(CG) || USE(CAIRO) || USE(DIRECT2D)
+ WebCore::DisplayList::ItemType::DrawNativeImage,
+#endif
+ WebCore::DisplayList::ItemType::DrawPattern,
+ WebCore::DisplayList::ItemType::DrawRect,
+ WebCore::DisplayList::ItemType::DrawLine,
+ WebCore::DisplayList::ItemType::DrawLinesForText,
+ WebCore::DisplayList::ItemType::DrawDotsForDocumentMarker,
+ WebCore::DisplayList::ItemType::DrawEllipse,
+ WebCore::DisplayList::ItemType::DrawPath,
+ WebCore::DisplayList::ItemType::DrawFocusRingPath,
+ WebCore::DisplayList::ItemType::DrawFocusRingRects,
+ WebCore::DisplayList::ItemType::FillRect,
+ WebCore::DisplayList::ItemType::FillRectWithColor,
+ WebCore::DisplayList::ItemType::FillRectWithGradient,
+ WebCore::DisplayList::ItemType::FillCompositedRect,
+ WebCore::DisplayList::ItemType::FillRoundedRect,
+ WebCore::DisplayList::ItemType::FillRectWithRoundedHole,
+ WebCore::DisplayList::ItemType::FillPath,
+ WebCore::DisplayList::ItemType::FillEllipse,
+ WebCore::DisplayList::ItemType::StrokeRect,
+ WebCore::DisplayList::ItemType::StrokePath,
+ WebCore::DisplayList::ItemType::StrokeEllipse,
+ WebCore::DisplayList::ItemType::ClearRect,
+ WebCore::DisplayList::ItemType::BeginTransparencyLayer,
+ WebCore::DisplayList::ItemType::EndTransparencyLayer,
+#if USE(CG)
+ WebCore::DisplayList::ItemType::ApplyStrokePattern,
+ WebCore::DisplayList::ItemType::ApplyFillPattern,
+#endif
+ WebCore::DisplayList::ItemType::ApplyDeviceScaleFactor
+ >;
+};
+
+} // namespace WTF
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp (253045 => 253046)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp 2019-12-03 16:28:22 UTC (rev 253045)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp 2019-12-03 16:50:43 UTC (rev 253046)
@@ -62,7 +62,7 @@
if (changesFromLastState) {
LOG_WITH_STREAM(DisplayLists, stream << "pre-drawing, saving state " << GraphicsContextStateChange(stateChanges.m_state, changesFromLastState));
m_displayList.append(SetState::create(stateChanges.m_state, changesFromLastState));
- stateChanges.m_changeFlags = 0;
+ stateChanges.m_changeFlags = { };
currentState().lastDrawingState = stateChanges.m_state;
}
currentState().wasUsedForDrawing = true;
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h (253045 => 253046)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h 2019-12-03 16:28:22 UTC (rev 253045)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h 2019-12-03 16:50:43 UTC (rev 253046)
@@ -51,8 +51,8 @@
WTF_MAKE_FAST_ALLOCATED;
WTF_MAKE_NONCOPYABLE(Recorder);
public:
- Recorder(GraphicsContext&, DisplayList&, const GraphicsContextState&, const FloatRect& initialClip, const AffineTransform&);
- virtual ~Recorder();
+ WEBCORE_EXPORT Recorder(GraphicsContext&, DisplayList&, const GraphicsContextState&, const FloatRect& initialClip, const AffineTransform&);
+ WEBCORE_EXPORT virtual ~Recorder();
size_t itemCount() const { return m_displayList.itemCount(); }
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h (253045 => 253046)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h 2019-12-03 16:28:22 UTC (rev 253045)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h 2019-12-03 16:50:43 UTC (rev 253046)
@@ -39,10 +39,10 @@
class Replayer {
WTF_MAKE_NONCOPYABLE(Replayer);
public:
- Replayer(GraphicsContext&, const DisplayList&);
- ~Replayer();
+ WEBCORE_EXPORT Replayer(GraphicsContext&, const DisplayList&);
+ WEBCORE_EXPORT ~Replayer();
- std::unique_ptr<DisplayList> replay(const FloatRect& initialClip = { }, bool trackReplayList = false);
+ WEBCORE_EXPORT std::unique_ptr<DisplayList> replay(const FloatRect& initialClip = { }, bool trackReplayList = false);
private:
const DisplayList& m_displayList;