Diff
Modified: trunk/Source/WebCore/ChangeLog (224462 => 224463)
--- trunk/Source/WebCore/ChangeLog 2017-11-04 23:01:56 UTC (rev 224462)
+++ trunk/Source/WebCore/ChangeLog 2017-11-04 23:43:55 UTC (rev 224463)
@@ -1,3 +1,171 @@
+2017-11-04 Simon Fraser <[email protected]>
+
+ Add a GraphicsContextImpl and use it for DispayList::Recorder
+ https://bugs.webkit.org/show_bug.cgi?id=179286
+
+ Reviewed by Sam Weinig.
+
+ Start moving towards a model when GraphicsContext has a pointer to an implementation
+ ("pimpl") by adding GraphicsContextImpl, and converting display list recording to
+ be an implementation of a GraphicsContextImpl.
+
+ No behavior change.
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::DisplayListDrawingContext::DisplayListDrawingContext):
+ * platform/graphics/GraphicsContext.cpp:
+ (WebCore::GraphicsContext::GraphicsContext):
+ (WebCore::GraphicsContext::save):
+ (WebCore::GraphicsContext::restore):
+ (WebCore::GraphicsContext::setStrokeThickness):
+ (WebCore::GraphicsContext::setStrokeStyle):
+ (WebCore::GraphicsContext::setStrokeColor):
+ (WebCore::GraphicsContext::setShadow):
+ (WebCore::GraphicsContext::setLegacyShadow):
+ (WebCore::GraphicsContext::clearShadow):
+ (WebCore::GraphicsContext::setFillColor):
+ (WebCore::GraphicsContext::setShadowsIgnoreTransforms):
+ (WebCore::GraphicsContext::setShouldAntialias):
+ (WebCore::GraphicsContext::setShouldSmoothFonts):
+ (WebCore::GraphicsContext::setShouldSubpixelQuantizeFonts):
+ (WebCore::GraphicsContext::setImageInterpolationQuality):
+ (WebCore::GraphicsContext::setStrokePattern):
+ (WebCore::GraphicsContext::setFillPattern):
+ (WebCore::GraphicsContext::setStrokeGradient):
+ (WebCore::GraphicsContext::setFillRule):
+ (WebCore::GraphicsContext::setFillGradient):
+ (WebCore::GraphicsContext::beginTransparencyLayer):
+ (WebCore::GraphicsContext::endTransparencyLayer):
+ (WebCore::GraphicsContext::drawGlyphs):
+ (WebCore::GraphicsContext::drawImage):
+ (WebCore::GraphicsContext::drawTiledImage):
+ (WebCore::GraphicsContext::setTextDrawingMode):
+ (WebCore::GraphicsContext::fillRect):
+ (WebCore::GraphicsContext::fillRoundedRect):
+ (WebCore::GraphicsContext::setAlpha):
+ (WebCore::GraphicsContext::setCompositeOperation):
+ (WebCore::GraphicsContext::setDrawLuminanceMask):
+ (WebCore::GraphicsContext::applyDeviceScaleFactor):
+ (WebCore::GraphicsContext::fillEllipse):
+ (WebCore::GraphicsContext::strokeEllipse):
+ * platform/graphics/GraphicsContext.h:
+ (WebCore::GraphicsContext::hasPlatformContext const):
+ (WebCore::GraphicsContext::paintingDisabled const):
+ (WebCore::GraphicsContext::setDisplayListRecorder): Deleted.
+ (WebCore::GraphicsContext::isRecording const): Deleted.
+ * platform/graphics/GraphicsContextImpl.cpp: Added.
+ (WebCore::GraphicsContextImpl::GraphicsContextImpl):
+ (WebCore::GraphicsContextImpl::~GraphicsContextImpl):
+ * platform/graphics/GraphicsContextImpl.h: Added.
+ (WebCore::GraphicsContextImpl::graphicsContext const):
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::recursiveCommitChanges):
+ * platform/graphics/cairo/GraphicsContextCairo.cpp:
+ (WebCore::GraphicsContext::getCTM const):
+ (WebCore::GraphicsContext::savePlatformState):
+ (WebCore::GraphicsContext::restorePlatformState):
+ (WebCore::GraphicsContext::drawRect):
+ (WebCore::GraphicsContext::drawNativeImage):
+ (WebCore::GraphicsContext::drawLine):
+ (WebCore::GraphicsContext::drawEllipse):
+ (WebCore::GraphicsContext::fillPath):
+ (WebCore::GraphicsContext::strokePath):
+ (WebCore::GraphicsContext::fillRect):
+ (WebCore::GraphicsContext::clip):
+ (WebCore::GraphicsContext::clipPath):
+ (WebCore::GraphicsContext::clipBounds const):
+ (WebCore::GraphicsContext::drawLinesForText):
+ (WebCore::GraphicsContext::roundToDevicePixels):
+ (WebCore::GraphicsContext::translate):
+ (WebCore::GraphicsContext::setPlatformStrokeThickness):
+ (WebCore::GraphicsContext::setPlatformStrokeStyle):
+ (WebCore::GraphicsContext::concatCTM):
+ (WebCore::GraphicsContext::setCTM):
+ (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
+ (WebCore::GraphicsContext::endPlatformTransparencyLayer):
+ (WebCore::GraphicsContext::clearRect):
+ (WebCore::GraphicsContext::strokeRect):
+ (WebCore::GraphicsContext::setLineCap):
+ (WebCore::GraphicsContext::setLineDash):
+ (WebCore::GraphicsContext::setLineJoin):
+ (WebCore::GraphicsContext::setMiterLimit):
+ (WebCore::GraphicsContext::clipOut):
+ (WebCore::GraphicsContext::rotate):
+ (WebCore::GraphicsContext::scale):
+ (WebCore::GraphicsContext::platformFillRoundedRect):
+ (WebCore::GraphicsContext::fillRectWithRoundedHole):
+ (WebCore::GraphicsContext::drawPattern):
+ (WebCore::GraphicsContext::setPlatformShouldAntialias):
+ (WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
+ (WebCore::GraphicsContext::isAcceleratedContext const):
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::GraphicsContext::savePlatformState):
+ (WebCore::GraphicsContext::restorePlatformState):
+ (WebCore::GraphicsContext::drawNativeImage):
+ (WebCore::GraphicsContext::drawPattern):
+ (WebCore::GraphicsContext::drawRect):
+ (WebCore::GraphicsContext::drawLine):
+ (WebCore::GraphicsContext::drawEllipse):
+ (WebCore::GraphicsContext::applyStrokePattern):
+ (WebCore::GraphicsContext::applyFillPattern):
+ (WebCore::GraphicsContext::drawPath):
+ (WebCore::GraphicsContext::fillPath):
+ (WebCore::GraphicsContext::strokePath):
+ (WebCore::GraphicsContext::fillRect):
+ (WebCore::GraphicsContext::platformFillRoundedRect):
+ (WebCore::GraphicsContext::fillRectWithRoundedHole):
+ (WebCore::GraphicsContext::clip):
+ (WebCore::GraphicsContext::clipOut):
+ (WebCore::GraphicsContext::clipPath):
+ (WebCore::GraphicsContext::clipBounds const):
+ (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
+ (WebCore::GraphicsContext::endPlatformTransparencyLayer):
+ (WebCore::GraphicsContext::setPlatformShadow):
+ (WebCore::GraphicsContext::setMiterLimit):
+ (WebCore::GraphicsContext::clearRect):
+ (WebCore::GraphicsContext::strokeRect):
+ (WebCore::GraphicsContext::setLineCap):
+ (WebCore::GraphicsContext::setLineDash):
+ (WebCore::GraphicsContext::setLineJoin):
+ (WebCore::GraphicsContext::scale):
+ (WebCore::GraphicsContext::rotate):
+ (WebCore::GraphicsContext::translate):
+ (WebCore::GraphicsContext::concatCTM):
+ (WebCore::GraphicsContext::setCTM):
+ (WebCore::GraphicsContext::getCTM const):
+ (WebCore::GraphicsContext::roundToDevicePixels):
+ (WebCore::GraphicsContext::drawLinesForText):
+ (WebCore::GraphicsContext::setURLForRect):
+ (WebCore::GraphicsContext::setIsCALayerContext):
+ (WebCore::GraphicsContext::isCALayerContext const):
+ (WebCore::GraphicsContext::setIsAcceleratedContext):
+ (WebCore::GraphicsContext::isAcceleratedContext const):
+ (WebCore::GraphicsContext::setPlatformTextDrawingMode):
+ (WebCore::GraphicsContext::setPlatformStrokeColor):
+ (WebCore::GraphicsContext::setPlatformStrokeThickness):
+ (WebCore::GraphicsContext::setPlatformFillColor):
+ (WebCore::GraphicsContext::setPlatformShouldAntialias):
+ (WebCore::GraphicsContext::setPlatformShouldSmoothFonts):
+ (WebCore::GraphicsContext::setPlatformAlpha):
+ (WebCore::GraphicsContext::setPlatformCompositeOperation):
+ (WebCore::GraphicsContext::platformApplyDeviceScaleFactor):
+ (WebCore::GraphicsContext::platformFillEllipse):
+ (WebCore::GraphicsContext::platformStrokeEllipse):
+ (WebCore::GraphicsContext::setDestinationForRect):
+ (WebCore::GraphicsContext::addDestinationAtPoint):
+ * platform/graphics/cocoa/GraphicsContextCocoa.mm:
+ (WebCore::GraphicsContext::drawFocusRing):
+ * platform/graphics/displaylists/DisplayListRecorder.cpp:
+ (WebCore::DisplayList::Recorder::Recorder):
+ (WebCore::DisplayList::Recorder::updateItemExtent const):
+ (WebCore::DisplayList::Recorder::extentFromLocalBounds const):
+ * platform/graphics/displaylists/DisplayListRecorder.h:
+ (WebCore::DisplayList::Recorder::itemCount const):
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::paint):
+
2017-11-04 Zalan Bujtas <[email protected]>
[LayoutState cleanup] Move all LayoutState* classes to LayoutState.h/cpp
Modified: trunk/Source/WebCore/Sources.txt (224462 => 224463)
--- trunk/Source/WebCore/Sources.txt 2017-11-04 23:01:56 UTC (rev 224462)
+++ trunk/Source/WebCore/Sources.txt 2017-11-04 23:43:55 UTC (rev 224463)
@@ -1505,6 +1505,7 @@
platform/graphics/Gradient.cpp
platform/graphics/GradientImage.cpp
platform/graphics/GraphicsContext.cpp
+platform/graphics/GraphicsContextImpl.cpp
platform/graphics/GraphicsLayer.cpp
platform/graphics/GraphicsLayerTransform.cpp
platform/graphics/GraphicsLayerUpdater.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (224462 => 224463)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-11-04 23:01:56 UTC (rev 224462)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2017-11-04 23:43:55 UTC (rev 224463)
@@ -5349,6 +5349,8 @@
0C45342610CDBBFA00869157 /* JSWebGLUniformLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLUniformLocation.h; sourceTree = "<group>"; };
0E7058ED1BC5BC190045A507 /* SearchPopupMenuCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SearchPopupMenuCocoa.mm; sourceTree = "<group>"; };
0E7058F31BC5CCD70045A507 /* SearchPopupMenuCocoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SearchPopupMenuCocoa.h; sourceTree = "<group>"; };
+ 0F00123F1FAD87D600531D76 /* GraphicsContextImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GraphicsContextImpl.h; sourceTree = "<group>"; };
+ 0F0012401FAD881000531D76 /* GraphicsContextImpl.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContextImpl.cpp; sourceTree = "<group>"; };
0F03C0731884695E00A5F8CA /* SystemMemory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemMemory.h; sourceTree = "<group>"; };
0F099D0617B968A100FF84B9 /* WebCoreTypedArrayController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebCoreTypedArrayController.cpp; sourceTree = "<group>"; };
0F099D0717B968A100FF84B9 /* WebCoreTypedArrayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreTypedArrayController.h; sourceTree = "<group>"; };
@@ -22636,6 +22638,8 @@
6E21C6BF1126338500A7BE02 /* GraphicsContext3D.cpp */,
49C7B9FB1042D3650009D447 /* GraphicsContext3D.h */,
7C330A011DF8FAC600D3395C /* GraphicsContext3DAttributes.h */,
+ 0F0012401FAD881000531D76 /* GraphicsContextImpl.cpp */,
+ 0F00123F1FAD87D600531D76 /* GraphicsContextImpl.h */,
0F580B090F12A2690051D689 /* GraphicsLayer.cpp */,
0F580B0A0F12A2690051D689 /* GraphicsLayer.h */,
0F580B0B0F12A2690051D689 /* GraphicsLayerClient.h */,
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (224462 => 224463)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2017-11-04 23:01:56 UTC (rev 224462)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2017-11-04 23:43:55 UTC (rev 224463)
@@ -89,11 +89,12 @@
WTF_MAKE_FAST_ALLOCATED;
public:
GraphicsContext context;
- DisplayList::Recorder recorder;
DisplayList::DisplayList displayList;
DisplayListDrawingContext(const FloatRect& clip)
- : recorder(context, displayList, clip, AffineTransform())
+ : context([&](GraphicsContext& context) {
+ return std::make_unique<DisplayList::Recorder>(context, displayList, clip, AffineTransform());
+ })
{
}
};
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (224462 => 224463)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp 2017-11-04 23:01:56 UTC (rev 224462)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp 2017-11-04 23:43:55 UTC (rev 224463)
@@ -28,9 +28,9 @@
#include "BidiResolver.h"
#include "BitmapImage.h"
-#include "DisplayListRecorder.h"
#include "FloatRoundedRect.h"
#include "Gradient.h"
+#include "GraphicsContextImpl.h"
#include "ImageBuffer.h"
#include "IntRect.h"
#include "RoundedRect.h"
@@ -336,6 +336,11 @@
platformInit(platformGraphicsContext);
}
+GraphicsContext::GraphicsContext(const GraphicsContextImplFactory& factoryFunction)
+ : m_impl(factoryFunction(*this))
+{
+}
+
GraphicsContext::~GraphicsContext()
{
ASSERT(m_stack.isEmpty());
@@ -350,8 +355,8 @@
m_stack.append(m_state);
- if (isRecording()) {
- m_displayListRecorder->save();
+ if (m_impl) {
+ m_impl->save();
return;
}
@@ -376,8 +381,8 @@
if (m_stack.isEmpty())
m_stack.clear();
- if (isRecording()) {
- m_displayListRecorder->restore();
+ if (m_impl) {
+ m_impl->restore();
return;
}
@@ -407,8 +412,8 @@
void GraphicsContext::setStrokeThickness(float thickness)
{
m_state.strokeThickness = thickness;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::StrokeThicknessChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::StrokeThicknessChange);
return;
}
@@ -418,8 +423,8 @@
void GraphicsContext::setStrokeStyle(StrokeStyle style)
{
m_state.strokeStyle = style;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::StrokeStyleChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::StrokeStyleChange);
return;
}
setPlatformStrokeStyle(style);
@@ -430,8 +435,8 @@
m_state.strokeColor = color;
m_state.strokeGradient = nullptr;
m_state.strokePattern = nullptr;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::StrokeColorChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::StrokeColorChange);
return;
}
setPlatformStrokeColor(color);
@@ -445,8 +450,8 @@
#if USE(CG)
m_state.shadowsUseLegacyRadius = false;
#endif
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::ShadowChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::ShadowChange);
return;
}
setPlatformShadow(offset, blur, color);
@@ -460,8 +465,8 @@
#if USE(CG)
m_state.shadowsUseLegacyRadius = true;
#endif
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::ShadowChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::ShadowChange);
return;
}
setPlatformShadow(offset, blur, color);
@@ -476,8 +481,8 @@
m_state.shadowsUseLegacyRadius = false;
#endif
- if (isRecording()) {
- m_displayListRecorder->clearShadow();
+ if (m_impl) {
+ m_impl->clearShadow();
return;
}
clearPlatformShadow();
@@ -516,8 +521,8 @@
m_state.fillGradient = nullptr;
m_state.fillPattern = nullptr;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::FillColorChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::FillColorChange);
return;
}
@@ -527,8 +532,8 @@
void GraphicsContext::setShadowsIgnoreTransforms(bool shadowsIgnoreTransforms)
{
m_state.shadowsIgnoreTransforms = shadowsIgnoreTransforms;
- if (isRecording())
- m_displayListRecorder->updateState(m_state, GraphicsContextState::ShadowsIgnoreTransformsChange);
+ if (m_impl)
+ m_impl->updateState(m_state, GraphicsContextState::ShadowsIgnoreTransformsChange);
}
void GraphicsContext::setShouldAntialias(bool shouldAntialias)
@@ -535,8 +540,8 @@
{
m_state.shouldAntialias = shouldAntialias;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::ShouldAntialiasChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::ShouldAntialiasChange);
return;
}
@@ -547,8 +552,8 @@
{
m_state.shouldSmoothFonts = shouldSmoothFonts;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::ShouldSmoothFontsChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::ShouldSmoothFontsChange);
return;
}
@@ -558,8 +563,8 @@
void GraphicsContext::setShouldSubpixelQuantizeFonts(bool shouldSubpixelQuantizeFonts)
{
m_state.shouldSubpixelQuantizeFonts = shouldSubpixelQuantizeFonts;
- if (isRecording())
- m_displayListRecorder->updateState(m_state, GraphicsContextState::ShouldSubpixelQuantizeFontsChange);
+ if (m_impl)
+ m_impl->updateState(m_state, GraphicsContextState::ShouldSubpixelQuantizeFontsChange);
}
void GraphicsContext::setImageInterpolationQuality(InterpolationQuality imageInterpolationQuality)
@@ -569,8 +574,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::ImageInterpolationQualityChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::ImageInterpolationQualityChange);
return;
}
@@ -581,8 +586,8 @@
{
m_state.strokeGradient = nullptr;
m_state.strokePattern = WTFMove(pattern);
- if (isRecording())
- m_displayListRecorder->updateState(m_state, GraphicsContextState::StrokePatternChange);
+ if (m_impl)
+ m_impl->updateState(m_state, GraphicsContextState::StrokePatternChange);
}
void GraphicsContext::setFillPattern(Ref<Pattern>&& pattern)
@@ -589,8 +594,8 @@
{
m_state.fillGradient = nullptr;
m_state.fillPattern = WTFMove(pattern);
- if (isRecording())
- m_displayListRecorder->updateState(m_state, GraphicsContextState::FillPatternChange);
+ if (m_impl)
+ m_impl->updateState(m_state, GraphicsContextState::FillPatternChange);
}
void GraphicsContext::setStrokeGradient(Ref<Gradient>&& gradient)
@@ -597,15 +602,15 @@
{
m_state.strokeGradient = WTFMove(gradient);
m_state.strokePattern = nullptr;
- if (isRecording())
- m_displayListRecorder->updateState(m_state, GraphicsContextState::StrokeGradientChange);
+ if (m_impl)
+ m_impl->updateState(m_state, GraphicsContextState::StrokeGradientChange);
}
void GraphicsContext::setFillRule(WindRule fillRule)
{
m_state.fillRule = fillRule;
- if (isRecording())
- m_displayListRecorder->updateState(m_state, GraphicsContextState::FillRuleChange);
+ if (m_impl)
+ m_impl->updateState(m_state, GraphicsContextState::FillRuleChange);
}
void GraphicsContext::setFillGradient(Ref<Gradient>&& gradient)
@@ -612,14 +617,14 @@
{
m_state.fillGradient = WTFMove(gradient);
m_state.fillPattern = nullptr;
- if (isRecording())
- m_displayListRecorder->updateState(m_state, GraphicsContextState::FillGradientChange); // FIXME: also fill pattern?
+ if (m_impl)
+ m_impl->updateState(m_state, GraphicsContextState::FillGradientChange); // FIXME: also fill pattern?
}
void GraphicsContext::beginTransparencyLayer(float opacity)
{
- if (isRecording()) {
- m_displayListRecorder->beginTransparencyLayer(opacity);
+ if (m_impl) {
+ m_impl->beginTransparencyLayer(opacity);
return;
}
beginPlatformTransparencyLayer(opacity);
@@ -628,8 +633,8 @@
void GraphicsContext::endTransparencyLayer()
{
- if (isRecording()) {
- m_displayListRecorder->endTransparencyLayer();
+ if (m_impl) {
+ m_impl->endTransparencyLayer();
return;
}
endPlatformTransparencyLayer();
@@ -651,8 +656,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawGlyphs(font, buffer, from, numGlyphs, point, fontCascade.fontDescription().fontSmoothing());
+ if (m_impl) {
+ m_impl->drawGlyphs(font, buffer, from, numGlyphs, point, fontCascade.fontDescription().fontSmoothing());
return;
}
@@ -722,8 +727,8 @@
if (paintingDisabled())
return ImageDrawResult::DidNothing;
- if (isRecording()) {
- m_displayListRecorder->drawImage(image, destination, source, imagePaintingOptions);
+ if (m_impl) {
+ m_impl->drawImage(image, destination, source, imagePaintingOptions);
return ImageDrawResult::DidRecord;
}
@@ -736,8 +741,8 @@
if (paintingDisabled())
return ImageDrawResult::DidNothing;
- if (isRecording()) {
- m_displayListRecorder->drawTiledImage(image, destination, source, tileSize, spacing, imagePaintingOptions);
+ if (m_impl) {
+ m_impl->drawTiledImage(image, destination, source, tileSize, spacing, imagePaintingOptions);
return ImageDrawResult::DidRecord;
}
@@ -751,8 +756,8 @@
if (paintingDisabled())
return ImageDrawResult::DidNothing;
- if (isRecording()) {
- m_displayListRecorder->drawTiledImage(image, destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions);
+ if (m_impl) {
+ m_impl->drawTiledImage(image, destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions);
return ImageDrawResult::DidRecord;
}
@@ -848,8 +853,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::TextDrawingModeChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::TextDrawingModeChange);
return;
}
setPlatformTextDrawingMode(mode);
@@ -860,8 +865,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRect(rect, gradient);
+ if (m_impl) {
+ m_impl->fillRect(rect, gradient);
return;
}
@@ -873,8 +878,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRect(rect, color, op, blendMode);
+ if (m_impl) {
+ m_impl->fillRect(rect, color, op, blendMode);
return;
}
@@ -889,8 +894,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRoundedRect(rect, color, blendMode);
+ if (m_impl) {
+ m_impl->fillRoundedRect(rect, color, blendMode);
return;
}
@@ -932,8 +937,8 @@
void GraphicsContext::setAlpha(float alpha)
{
m_state.alpha = alpha;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::AlphaChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::AlphaChange);
return;
}
setPlatformAlpha(alpha);
@@ -943,8 +948,8 @@
{
m_state.compositeOperator = compositeOperation;
m_state.blendMode = blendMode;
- if (isRecording()) {
- m_displayListRecorder->updateState(m_state, GraphicsContextState::CompositeOperationChange);
+ if (m_impl) {
+ m_impl->updateState(m_state, GraphicsContextState::CompositeOperationChange);
return;
}
setPlatformCompositeOperation(compositeOperation, blendMode);
@@ -953,8 +958,8 @@
void GraphicsContext::setDrawLuminanceMask(bool drawLuminanceMask)
{
m_state.drawLuminanceMask = drawLuminanceMask;
- if (isRecording())
- m_displayListRecorder->updateState(m_state, GraphicsContextState::DrawLuminanceMaskChange);
+ if (m_impl)
+ m_impl->updateState(m_state, GraphicsContextState::DrawLuminanceMaskChange);
}
#if !USE(CG) && !USE(DIRECT2D)
@@ -1022,8 +1027,8 @@
{
scale(deviceScaleFactor);
- if (isRecording()) {
- m_displayListRecorder->applyDeviceScaleFactor(deviceScaleFactor);
+ if (m_impl) {
+ m_impl->applyDeviceScaleFactor(deviceScaleFactor);
return;
}
@@ -1045,8 +1050,8 @@
void GraphicsContext::fillEllipse(const FloatRect& ellipse)
{
- if (isRecording()) {
- m_displayListRecorder->fillEllipse(ellipse);
+ if (m_impl) {
+ m_impl->fillEllipse(ellipse);
return;
}
@@ -1055,8 +1060,8 @@
void GraphicsContext::strokeEllipse(const FloatRect& ellipse)
{
- if (isRecording()) {
- m_displayListRecorder->strokeEllipse(ellipse);
+ if (m_impl) {
+ m_impl->strokeEllipse(ellipse);
return;
}
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (224462 => 224463)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2017-11-04 23:01:56 UTC (rev 224462)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2017-11-04 23:43:55 UTC (rev 224463)
@@ -80,6 +80,7 @@
class AffineTransform;
class FloatRoundedRect;
class Gradient;
+class GraphicsContextImpl;
class GraphicsContextPlatformPrivate;
class ImageBuffer;
class IntRect;
@@ -251,6 +252,10 @@
WTF_MAKE_NONCOPYABLE(GraphicsContext); WTF_MAKE_FAST_ALLOCATED;
public:
WEBCORE_EXPORT GraphicsContext(PlatformGraphicsContext*);
+
+ using GraphicsContextImplFactory = WTF::Function<std::unique_ptr<GraphicsContextImpl>(GraphicsContext&)>;
+ WEBCORE_EXPORT GraphicsContext(const GraphicsContextImplFactory&);
+
GraphicsContext() = default;
WEBCORE_EXPORT ~GraphicsContext();
@@ -260,14 +265,12 @@
};
GraphicsContext(NonPaintingReasons);
+ bool hasPlatformContext() const { return m_data; }
WEBCORE_EXPORT PlatformGraphicsContext* platformContext() const;
- bool paintingDisabled() const { return !m_data && !isRecording(); }
+ bool paintingDisabled() const { return !m_data && !m_impl; }
bool updatingControlTints() const { return m_nonPaintingReasons == NonPaintingReasons::UpdatingControlTints; }
- void setDisplayListRecorder(DisplayList::Recorder* recorder) { m_displayListRecorder = recorder; }
- bool isRecording() const { return m_displayListRecorder; }
-
void setStrokeThickness(float);
float strokeThickness() const { return m_state.strokeThickness; }
@@ -640,7 +643,7 @@
Vector<FloatPoint> centerLineAndCutOffCorners(bool isVerticalLine, float cornerWidth, FloatPoint point1, FloatPoint point2) const;
GraphicsContextPlatformPrivate* m_data { nullptr };
- DisplayList::Recorder* m_displayListRecorder { nullptr };
+ std::unique_ptr<GraphicsContextImpl> m_impl;
GraphicsContextState m_state;
Vector<GraphicsContextState, 1> m_stack;
Added: trunk/Source/WebCore/platform/graphics/GraphicsContextImpl.cpp (0 => 224463)
--- trunk/Source/WebCore/platform/graphics/GraphicsContextImpl.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextImpl.cpp 2017-11-04 23:43:55 UTC (rev 224463)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GraphicsContextImpl.h"
+
+namespace WebCore {
+
+GraphicsContextImpl::GraphicsContextImpl(GraphicsContext& context, const FloatRect&, const AffineTransform&)
+ : m_graphicsContext(context)
+{
+}
+
+GraphicsContextImpl::~GraphicsContextImpl()
+{
+}
+
+} // namespace WebCore
Added: trunk/Source/WebCore/platform/graphics/GraphicsContextImpl.h (0 => 224463)
--- trunk/Source/WebCore/platform/graphics/GraphicsContextImpl.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextImpl.h 2017-11-04 23:43:55 UTC (rev 224463)
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "GraphicsContext.h"
+
+namespace WebCore {
+
+class GraphicsContextImpl {
+ WTF_MAKE_NONCOPYABLE(GraphicsContextImpl);
+public:
+ GraphicsContextImpl(GraphicsContext&, const FloatRect& initialClip, const AffineTransform&);
+ virtual ~GraphicsContextImpl();
+
+ GraphicsContext& graphicsContext() const { return m_graphicsContext; }
+
+ virtual void updateState(const GraphicsContextState&, GraphicsContextState::StateChangeFlags) = 0;
+ virtual void clearShadow() = 0;
+
+ virtual void setLineCap(LineCap) = 0;
+ virtual void setLineDash(const DashArray&, float dashOffset) = 0;
+ virtual void setLineJoin(LineJoin) = 0;
+ virtual void setMiterLimit(float) = 0;
+
+ virtual void fillRect(const FloatRect&) = 0;
+ virtual void fillRect(const FloatRect&, const Color&) = 0;
+ virtual void fillRect(const FloatRect&, Gradient&) = 0;
+ virtual void fillRect(const FloatRect&, const Color&, CompositeOperator, BlendMode) = 0;
+ virtual void fillRoundedRect(const FloatRoundedRect&, const Color&, BlendMode) = 0;
+ virtual void fillRectWithRoundedHole(const FloatRect&, const FloatRoundedRect& roundedHoleRect, const Color&) = 0;
+ virtual void fillPath(const Path&) = 0;
+ virtual void fillEllipse(const FloatRect&) = 0;
+ virtual void strokeRect(const FloatRect&, float lineWidth) = 0;
+ virtual void strokePath(const Path&) = 0;
+ virtual void strokeEllipse(const FloatRect&) = 0;
+ virtual void clearRect(const FloatRect&) = 0;
+
+#if USE(CG)
+ virtual void applyStrokePattern() = 0;
+ virtual void applyFillPattern() = 0;
+#endif
+
+ virtual void drawGlyphs(const Font&, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint& anchorPoint, FontSmoothingMode) = 0;
+
+ virtual void drawImage(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&) = 0;
+ virtual void drawTiledImage(Image&, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions&) = 0;
+ virtual void drawTiledImage(Image&, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions&) = 0;
+#if USE(CG) || USE(CAIRO)
+ virtual void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator, BlendMode, ImageOrientation) = 0;
+#endif
+ virtual void drawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendModeNormal) = 0;
+
+ virtual void drawRect(const FloatRect&, float borderThickness) = 0;
+ virtual void drawLine(const FloatPoint&, const FloatPoint&) = 0;
+ virtual void drawLinesForText(const FloatPoint&, const DashArray& widths, bool printing, bool doubleLines, float strokeThickness) = 0;
+ virtual void drawLineForDocumentMarker(const FloatPoint&, float width, GraphicsContext::DocumentMarkerLineStyle) = 0;
+ virtual void drawEllipse(const FloatRect&) = 0;
+ virtual void drawPath(const Path&) = 0;
+
+ virtual void drawFocusRing(const Path&, float width, float offset, const Color&) = 0;
+ virtual void drawFocusRing(const Vector<FloatRect>&, float width, float offset, const Color&) = 0;
+
+ virtual void save() = 0;
+ virtual void restore() = 0;
+
+ virtual void translate(float x, float y) = 0;
+ virtual void rotate(float angleInRadians) = 0;
+ virtual void scale(const FloatSize&) = 0;
+ virtual void concatCTM(const AffineTransform&) = 0;
+
+ virtual void beginTransparencyLayer(float opacity) = 0;
+ virtual void endTransparencyLayer() = 0;
+
+ virtual void clip(const FloatRect&) = 0;
+ virtual void clipOut(const FloatRect&) = 0;
+ virtual void clipOut(const Path&) = 0;
+ virtual void clipPath(const Path&, WindRule) = 0;
+
+ virtual void applyDeviceScaleFactor(float) = 0;
+
+private:
+ friend class GraphicsContext;
+ GraphicsContext& m_graphicsContext;
+};
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (224462 => 224463)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2017-11-04 23:01:56 UTC (rev 224462)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2017-11-04 23:43:55 UTC (rev 224463)
@@ -1550,9 +1550,9 @@
FloatRect initialClip(boundsOrigin(), size());
- GraphicsContext context;
- // The Recorder is large, so heap-allocate.
- std::unique_ptr<DisplayList::Recorder> recorder = std::make_unique<DisplayList::Recorder>(context, *m_displayList, initialClip, AffineTransform());
+ GraphicsContext context([&](GraphicsContext& context) {
+ return std::make_unique<DisplayList::Recorder>(context, *m_displayList, initialClip, AffineTransform());
+ });
paintGraphicsLayerContents(context, FloatRect(FloatPoint(), size()));
}
}
Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (224462 => 224463)
--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp 2017-11-04 23:01:56 UTC (rev 224462)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp 2017-11-04 23:43:55 UTC (rev 224463)
@@ -195,7 +195,7 @@
if (paintingDisabled())
return AffineTransform();
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("GraphicsContext::getCTM() is not yet compatible with recording contexts.");
return AffineTransform();
}
@@ -213,7 +213,7 @@
void GraphicsContext::savePlatformState()
{
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
platformContext()->save();
m_data->save();
}
@@ -220,7 +220,7 @@
void GraphicsContext::restorePlatformState()
{
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
platformContext()->restore();
m_data->restore();
@@ -236,8 +236,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawRect(rect, borderThickness);
+ if (m_impl) {
+ m_impl->drawRect(rect, borderThickness);
return;
}
@@ -265,8 +265,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawNativeImage(image, imageSize, destRect, srcRect, op, blendMode, orientation);
+ if (m_impl) {
+ m_impl->drawNativeImage(image, imageSize, destRect, srcRect, op, blendMode, orientation);
return;
}
@@ -305,8 +305,8 @@
if (strokeStyle() == NoStroke)
return;
- if (isRecording()) {
- m_displayListRecorder->drawLine(point1, point2);
+ if (m_impl) {
+ m_impl->drawLine(point1, point2);
return;
}
@@ -374,8 +374,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawEllipse(rect);
+ if (m_impl) {
+ m_impl->drawEllipse(rect);
return;
}
@@ -406,8 +406,8 @@
if (paintingDisabled() || path.isEmpty())
return;
- if (isRecording()) {
- m_displayListRecorder->fillPath(path);
+ if (m_impl) {
+ m_impl->fillPath(path);
return;
}
@@ -421,8 +421,8 @@
if (paintingDisabled() || path.isEmpty())
return;
- if (isRecording()) {
- m_displayListRecorder->strokePath(path);
+ if (m_impl) {
+ m_impl->strokePath(path);
return;
}
@@ -436,8 +436,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRect(rect);
+ if (m_impl) {
+ m_impl->fillRect(rect);
return;
}
@@ -451,8 +451,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRect(rect, color);
+ if (m_impl) {
+ m_impl->fillRect(rect, color);
return;
}
@@ -467,8 +467,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clip(rect);
+ if (m_impl) {
+ m_impl->clip(rect);
return;
}
@@ -494,8 +494,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clipPath(path, clipRule);
+ if (m_impl) {
+ m_impl->clipPath(path, clipRule);
return;
}
@@ -527,7 +527,7 @@
if (paintingDisabled())
return IntRect();
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("Getting the clip bounds not yet supported with display lists");
return IntRect(-2048, -2048, 4096, 4096); // FIXME: display lists.
}
@@ -635,8 +635,8 @@
if (widths.size() <= 0)
return;
- if (isRecording()) {
- m_displayListRecorder->drawLinesForText(point, widths, printing, doubleUnderlines, strokeThickness());
+ if (m_impl) {
+ m_impl->drawLinesForText(point, widths, printing, doubleUnderlines, strokeThickness());
return;
}
@@ -700,7 +700,7 @@
if (paintingDisabled())
return frect;
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("GraphicsContext::roundToDevicePixels() is not yet compatible with recording contexts.");
return frect;
}
@@ -745,8 +745,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->translate(x, y);
+ if (m_impl) {
+ m_impl->translate(x, y);
return;
}
@@ -772,7 +772,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
cairo_set_line_width(platformContext()->cr(), strokeThickness);
}
@@ -785,7 +785,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
switch (strokeStyle) {
case NoStroke:
@@ -816,8 +816,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->concatCTM(transform);
+ if (m_impl) {
+ m_impl->concatCTM(transform);
return;
}
@@ -832,7 +832,7 @@
if (paintingDisabled())
return;
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("GraphicsContext::setCTM() is not compatible with recording contexts.");
return;
}
@@ -874,7 +874,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
cairo_t* cr = platformContext()->cr();
cairo_push_group(cr);
@@ -886,7 +886,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
cairo_t* cr = platformContext()->cr();
@@ -905,8 +905,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clearRect(rect);
+ if (m_impl) {
+ m_impl->clearRect(rect);
return;
}
@@ -924,8 +924,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->strokeRect(rect, width);
+ if (m_impl) {
+ m_impl->strokeRect(rect, width);
return;
}
@@ -942,8 +942,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->setLineCap(lineCap);
+ if (m_impl) {
+ m_impl->setLineCap(lineCap);
return;
}
@@ -976,8 +976,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->setLineDash(dashes, dashOffset);
+ if (m_impl) {
+ m_impl->setLineDash(dashes, dashOffset);
return;
}
@@ -992,8 +992,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->setLineJoin(lineJoin);
+ if (m_impl) {
+ m_impl->setLineJoin(lineJoin);
return;
}
@@ -1017,9 +1017,9 @@
if (paintingDisabled())
return;
- if (isRecording()) {
+ if (m_impl) {
// Maybe this should be part of the state.
- m_displayListRecorder->setMiterLimit(miter);
+ m_impl->setMiterLimit(miter);
return;
}
@@ -1049,8 +1049,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clipOut(path);
+ if (m_impl) {
+ m_impl->clipOut(path);
return;
}
@@ -1071,8 +1071,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->rotate(radians);
+ if (m_impl) {
+ m_impl->rotate(radians);
return;
}
@@ -1085,8 +1085,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->scale(size);
+ if (m_impl) {
+ m_impl->scale(size);
return;
}
@@ -1099,8 +1099,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clipOut(r);
+ if (m_impl) {
+ m_impl->clipOut(r);
return;
}
@@ -1120,7 +1120,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
if (hasShadow())
platformContext()->shadowBlur().drawRectShadow(*this, rect);
@@ -1140,8 +1140,8 @@
if (paintingDisabled() || !color.isValid())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRectWithRoundedHole(rect, roundedHoleRect, color);
+ if (m_impl) {
+ m_impl->fillRectWithRoundedHole(rect, roundedHoleRect, color);
return;
}
@@ -1167,8 +1167,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawPattern(image, destRect, tileRect, patternTransform, phase, spacing, op, blendMode);
+ if (m_impl) {
+ m_impl->drawPattern(image, destRect, tileRect, patternTransform, phase, spacing, op, blendMode);
return;
}
@@ -1185,7 +1185,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
// When true, use the default Cairo backend antialias mode (usually this
// enables standard 'grayscale' antialiasing); false to explicitly disable
@@ -1195,7 +1195,7 @@
void GraphicsContext::setPlatformImageInterpolationQuality(InterpolationQuality quality)
{
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
platformContext()->setImageInterpolationQuality(quality);
}
@@ -1202,7 +1202,7 @@
bool GraphicsContext::isAcceleratedContext() const
{
- if (isRecording())
+ if (!hasPlatformContext())
return false;
return cairo_surface_get_type(cairo_get_target(platformContext()->cr())) == CAIRO_SURFACE_TYPE_GL;
Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (224462 => 224463)
--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2017-11-04 23:01:56 UTC (rev 224462)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2017-11-04 23:43:55 UTC (rev 224463)
@@ -165,7 +165,7 @@
void GraphicsContext::savePlatformState()
{
ASSERT(!paintingDisabled());
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
// Note: Do not use this function within this class implementation, since we want to avoid the extra
// save of the secondary context (in GraphicsContextPlatformPrivateCG.h).
@@ -176,7 +176,7 @@
void GraphicsContext::restorePlatformState()
{
ASSERT(!paintingDisabled());
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
// Note: Do not use this function within this class implementation, since we want to avoid the extra
// restore of the secondary context (in GraphicsContextPlatformPrivateCG.h).
@@ -190,8 +190,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawNativeImage(image, imageSize, destRect, srcRect, op, blendMode, orientation);
+ if (m_impl) {
+ m_impl->drawNativeImage(image, imageSize, destRect, srcRect, op, blendMode, orientation);
return;
}
@@ -325,8 +325,8 @@
if (paintingDisabled() || !patternTransform.isInvertible())
return;
- if (isRecording()) {
- m_displayListRecorder->drawPattern(image, destRect, tileRect, patternTransform, phase, spacing, op, blendMode);
+ if (m_impl) {
+ m_impl->drawPattern(image, destRect, tileRect, patternTransform, phase, spacing, op, blendMode);
return;
}
@@ -430,8 +430,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawRect(rect, borderThickness);
+ if (m_impl) {
+ m_impl->drawRect(rect, borderThickness);
return;
}
@@ -468,8 +468,8 @@
if (strokeStyle() == NoStroke)
return;
- if (isRecording()) {
- m_displayListRecorder->drawLine(point1, point2);
+ if (m_impl) {
+ m_impl->drawLine(point1, point2);
return;
}
@@ -533,8 +533,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawEllipse(rect);
+ if (m_impl) {
+ m_impl->drawEllipse(rect);
return;
}
@@ -548,8 +548,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->applyStrokePattern();
+ if (m_impl) {
+ m_impl->applyStrokePattern();
return;
}
@@ -572,8 +572,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->applyFillPattern();
+ if (m_impl) {
+ m_impl->applyFillPattern();
return;
}
@@ -623,8 +623,8 @@
if (paintingDisabled() || path.isEmpty())
return;
- if (isRecording()) {
- m_displayListRecorder->drawPath(path);
+ if (m_impl) {
+ m_impl->drawPath(path);
return;
}
@@ -657,8 +657,8 @@
if (paintingDisabled() || path.isEmpty())
return;
- if (isRecording()) {
- m_displayListRecorder->fillPath(path);
+ if (m_impl) {
+ m_impl->fillPath(path);
return;
}
@@ -720,8 +720,8 @@
if (paintingDisabled() || path.isEmpty())
return;
- if (isRecording()) {
- m_displayListRecorder->strokePath(path);
+ if (m_impl) {
+ m_impl->strokePath(path);
return;
}
@@ -782,8 +782,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRect(rect);
+ if (m_impl) {
+ m_impl->fillRect(rect);
return;
}
@@ -835,8 +835,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRect(rect, color);
+ if (m_impl) {
+ m_impl->fillRect(rect, color);
return;
}
@@ -870,7 +870,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
CGContextRef context = platformContext();
Color oldFillColor = fillColor();
@@ -913,8 +913,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->fillRectWithRoundedHole(rect, roundedHoleRect, color);
+ if (m_impl) {
+ m_impl->fillRectWithRoundedHole(rect, roundedHoleRect, color);
return;
}
@@ -959,8 +959,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clip(rect);
+ if (m_impl) {
+ m_impl->clip(rect);
return;
}
@@ -973,8 +973,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clipOut(rect);
+ if (m_impl) {
+ m_impl->clipOut(rect);
return;
}
@@ -995,8 +995,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clipOut(path);
+ if (m_impl) {
+ m_impl->clipOut(path);
return;
}
@@ -1012,8 +1012,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clipPath(path, clipRule);
+ if (m_impl) {
+ m_impl->clipPath(path, clipRule);
return;
}
@@ -1038,7 +1038,7 @@
if (paintingDisabled())
return IntRect();
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("Getting the clip bounds not yet supported with display lists");
return IntRect(-2048, -2048, 4096, 4096); // FIXME: display lists.
}
@@ -1051,7 +1051,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
save();
@@ -1066,7 +1066,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
CGContextRef context = platformContext();
CGContextEndTransparencyLayer(context);
@@ -1112,7 +1112,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
// FIXME: we could avoid the shadow setup cost when we know we'll render the shadow ourselves.
@@ -1164,9 +1164,9 @@
if (paintingDisabled())
return;
- if (isRecording()) {
+ if (m_impl) {
// Maybe this should be part of the state.
- m_displayListRecorder->setMiterLimit(limit);
+ m_impl->setMiterLimit(limit);
return;
}
@@ -1178,8 +1178,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->clearRect(r);
+ if (m_impl) {
+ m_impl->clearRect(r);
return;
}
@@ -1191,8 +1191,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->strokeRect(rect, lineWidth);
+ if (m_impl) {
+ m_impl->strokeRect(rect, lineWidth);
return;
}
@@ -1261,8 +1261,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->setLineCap(cap);
+ if (m_impl) {
+ m_impl->setLineCap(cap);
return;
}
@@ -1284,8 +1284,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->setLineDash(dashes, dashOffset);
+ if (m_impl) {
+ m_impl->setLineDash(dashes, dashOffset);
return;
}
@@ -1304,8 +1304,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->setLineJoin(join);
+ if (m_impl) {
+ m_impl->setLineJoin(join);
return;
}
@@ -1332,8 +1332,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->scale(size);
+ if (m_impl) {
+ m_impl->scale(size);
return;
}
@@ -1347,8 +1347,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->rotate(angle);
+ if (m_impl) {
+ m_impl->rotate(angle);
return;
}
@@ -1362,8 +1362,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->translate(x, y);
+ if (m_impl) {
+ m_impl->translate(x, y);
return;
}
@@ -1377,8 +1377,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->concatCTM(transform);
+ if (m_impl) {
+ m_impl->concatCTM(transform);
return;
}
@@ -1392,7 +1392,7 @@
if (paintingDisabled())
return;
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("GraphicsContext::setCTM() is not compatible with recording contexts.");
return;
}
@@ -1407,7 +1407,7 @@
if (paintingDisabled())
return AffineTransform();
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("GraphicsContext::getCTM() is not yet compatible with recording contexts.");
return AffineTransform();
}
@@ -1426,7 +1426,7 @@
if (paintingDisabled())
return rect;
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("GraphicsContext::roundToDevicePixels() is not yet compatible with recording contexts.");
return rect;
}
@@ -1489,8 +1489,8 @@
if (!widths.size())
return;
- if (isRecording()) {
- m_displayListRecorder->drawLinesForText(point, widths, printing, doubleLines, strokeThickness());
+ if (m_impl) {
+ m_impl->drawLinesForText(point, widths, printing, doubleLines, strokeThickness());
return;
}
@@ -1550,7 +1550,7 @@
if (paintingDisabled())
return;
- if (isRecording()) {
+ if (m_impl) {
WTFLogAlways("GraphicsContext::setURLForRect() is not yet compatible with recording contexts.");
return; // FIXME for display lists.
}
@@ -1603,7 +1603,7 @@
return;
// FIXME
- if (isRecording())
+ if (m_impl)
return;
if (isLayerContext)
@@ -1618,7 +1618,7 @@
return false;
// FIXME
- if (isRecording())
+ if (m_impl)
return false;
return m_data->m_contextFlags & IsLayerCGContext;
@@ -1630,7 +1630,7 @@
return;
// FIXME
- if (isRecording())
+ if (m_impl)
return;
if (isAccelerated)
@@ -1645,7 +1645,7 @@
return false;
// FIXME
- if (isRecording())
+ if (m_impl)
return false;
return m_data->m_contextFlags & IsAcceleratedCGContext;
@@ -1656,7 +1656,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
CGContextRef context = platformContext();
switch (mode) {
@@ -1679,7 +1679,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
setCGStrokeColor(platformContext(), color);
}
@@ -1689,7 +1689,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
CGContextSetLineWidth(platformContext(), std::max(thickness, 0.f));
}
@@ -1699,7 +1699,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
setCGFillColor(platformContext(), color);
}
@@ -1709,7 +1709,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
CGContextSetShouldAntialias(platformContext(), enable);
}
@@ -1719,7 +1719,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
CGContextSetShouldSmoothFonts(platformContext(), enable);
}
@@ -1729,7 +1729,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
CGContextSetAlpha(platformContext(), alpha);
}
@@ -1739,7 +1739,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
CGBlendMode target = kCGBlendModeNormal;
if (blendMode != BlendModeNormal) {
@@ -1852,7 +1852,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
// CoreGraphics expects the base CTM of a HiDPI context to have the scale factor applied to it.
// Failing to change the base level CTM will cause certain CG features, such as focus rings,
@@ -1865,7 +1865,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
// CGContextFillEllipseInRect only supports solid colors.
if (m_state.fillGradient || m_state.fillPattern) {
@@ -1882,7 +1882,7 @@
if (paintingDisabled())
return;
- ASSERT(!isRecording());
+ ASSERT(hasPlatformContext());
// CGContextStrokeEllipseInRect only supports solid colors.
if (m_state.strokeGradient || m_state.strokePattern) {
@@ -1904,6 +1904,8 @@
if (paintingDisabled())
return;
+ ASSERT(hasPlatformContext());
+
CGContextRef context = platformContext();
FloatRect rect = destRect;
@@ -1918,6 +1920,8 @@
if (paintingDisabled())
return;
+ ASSERT(hasPlatformContext());
+
CGContextRef context = platformContext();
CGPoint transformedPoint = CGPointApplyAffineTransform(position, CGContextGetCTM(context));
Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm (224462 => 224463)
--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm 2017-11-04 23:01:56 UTC (rev 224462)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm 2017-11-04 23:43:55 UTC (rev 224463)
@@ -119,8 +119,8 @@
if (paintingDisabled() || path.isNull())
return;
- if (isRecording()) {
- m_displayListRecorder->drawFocusRing(path, width, offset, color);
+ if (m_impl) {
+ m_impl->drawFocusRing(path, width, offset, color);
return;
}
@@ -139,7 +139,7 @@
if (paintingDisabled() || path.isNull())
return;
- if (isRecording()) // FIXME: implement animated focus ring drawing.
+ if (m_impl) // FIXME: implement animated focus ring drawing.
return;
needsRedraw = drawFocusRingToContextAtTime(platformContext(), path.platformPath(), timeOffset);
@@ -150,7 +150,7 @@
if (paintingDisabled())
return;
- if (isRecording()) // FIXME: implement animated focus ring drawing.
+ if (m_impl) // FIXME: implement animated focus ring drawing.
return;
RetainPtr<CGMutablePathRef> focusRingPath = adoptCF(CGPathCreateMutable());
@@ -167,8 +167,8 @@
if (paintingDisabled())
return;
- if (isRecording()) {
- m_displayListRecorder->drawFocusRing(rects, width, offset, color);
+ if (m_impl) {
+ m_impl->drawFocusRing(rects, width, offset, color);
return;
}
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp (224462 => 224463)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp 2017-11-04 23:01:56 UTC (rev 224462)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp 2017-11-04 23:43:55 UTC (rev 224463)
@@ -37,11 +37,10 @@
namespace DisplayList {
Recorder::Recorder(GraphicsContext& context, DisplayList& displayList, const FloatRect& initialClip, const AffineTransform& baseCTM)
- : m_graphicsContext(context)
+ : GraphicsContextImpl(context, initialClip, baseCTM)
, m_displayList(displayList)
{
LOG_WITH_STREAM(DisplayLists, stream << "\nRecording with clip " << initialClip);
- m_graphicsContext.setDisplayListRecorder(this);
m_stateStack.append(ContextState(baseCTM, initialClip));
}
@@ -374,7 +373,7 @@
void Recorder::updateItemExtent(DrawingItem& item) const
{
- if (std::optional<FloatRect> rect = item.localBounds(m_graphicsContext))
+ if (std::optional<FloatRect> rect = item.localBounds(graphicsContext()))
item.setExtent(extentFromLocalBounds(rect.value()));
}
@@ -396,7 +395,7 @@
FloatSize shadowOffset;
float shadowRadius;
Color shadowColor;
- if (m_graphicsContext.getShadow(shadowOffset, shadowRadius, shadowColor)) {
+ if (graphicsContext().getShadow(shadowOffset, shadowRadius, shadowColor)) {
FloatRect shadowExtent= bounds;
shadowExtent.move(shadowOffset);
shadowExtent.inflate(shadowPaintingExtent(shadowRadius));
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h (224462 => 224463)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h 2017-11-04 23:01:56 UTC (rev 224462)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h 2017-11-04 23:43:55 UTC (rev 224463)
@@ -26,7 +26,7 @@
#pragma once
#include "DisplayList.h"
-#include "GraphicsContext.h" // For InterpolationQuality.
+#include "GraphicsContextImpl.h"
#include "Image.h" // For Image::TileRule.
#include "TextFlags.h"
#include <wtf/Noncopyable.h>
@@ -47,79 +47,79 @@
class DrawingItem;
-class Recorder {
+class Recorder : public GraphicsContextImpl {
WTF_MAKE_NONCOPYABLE(Recorder);
public:
Recorder(GraphicsContext&, DisplayList&, const FloatRect& initialClip, const AffineTransform&);
- ~Recorder();
+ virtual ~Recorder();
- void updateState(const GraphicsContextState&, GraphicsContextState::StateChangeFlags);
- void clearShadow();
+ size_t itemCount() const { return m_displayList.itemCount(); }
- void setLineCap(LineCap);
- void setLineDash(const DashArray&, float dashOffset);
- void setLineJoin(LineJoin);
- void setMiterLimit(float);
+private:
+ void updateState(const GraphicsContextState&, GraphicsContextState::StateChangeFlags) override;
+ void clearShadow() override;
- void fillRect(const FloatRect&);
- void fillRect(const FloatRect&, const Color&);
- void fillRect(const FloatRect&, Gradient&);
- void fillRect(const FloatRect&, const Color&, CompositeOperator, BlendMode);
- void fillRoundedRect(const FloatRoundedRect&, const Color&, BlendMode);
- void fillRectWithRoundedHole(const FloatRect&, const FloatRoundedRect& roundedHoleRect, const Color&);
- void fillPath(const Path&);
- void fillEllipse(const FloatRect&);
- void strokeRect(const FloatRect&, float lineWidth);
- void strokePath(const Path&);
- void strokeEllipse(const FloatRect&);
- void clearRect(const FloatRect&);
+ void setLineCap(LineCap) override;
+ void setLineDash(const DashArray&, float dashOffset) override;
+ void setLineJoin(LineJoin) override;
+ void setMiterLimit(float) override;
+ void fillRect(const FloatRect&) override;
+ void fillRect(const FloatRect&, const Color&) override;
+ void fillRect(const FloatRect&, Gradient&) override;
+ void fillRect(const FloatRect&, const Color&, CompositeOperator, BlendMode) override;
+ void fillRoundedRect(const FloatRoundedRect&, const Color&, BlendMode) override;
+ void fillRectWithRoundedHole(const FloatRect&, const FloatRoundedRect& roundedHoleRect, const Color&) override;
+ void fillPath(const Path&) override;
+ void fillEllipse(const FloatRect&) override;
+ void strokeRect(const FloatRect&, float lineWidth) override;
+ void strokePath(const Path&) override;
+ void strokeEllipse(const FloatRect&) override;
+ void clearRect(const FloatRect&) override;
+
#if USE(CG)
- void applyStrokePattern();
- void applyFillPattern();
+ void applyStrokePattern() override;
+ void applyFillPattern() override;
#endif
- void drawGlyphs(const Font&, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint& anchorPoint, FontSmoothingMode);
+ void drawGlyphs(const Font&, const GlyphBuffer&, unsigned from, unsigned numGlyphs, const FloatPoint& anchorPoint, FontSmoothingMode) override;
- void drawImage(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&);
- void drawTiledImage(Image&, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions&);
- void drawTiledImage(Image&, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions&);
+ void drawImage(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&) override;
+ void drawTiledImage(Image&, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions&) override;
+ void drawTiledImage(Image&, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions&) override;
#if USE(CG) || USE(CAIRO)
- void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator, BlendMode, ImageOrientation);
+ void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator, BlendMode, ImageOrientation) override;
#endif
- void drawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendModeNormal);
+ void drawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendModeNormal) override;
- void drawRect(const FloatRect&, float borderThickness);
- void drawLine(const FloatPoint&, const FloatPoint&);
- void drawLinesForText(const FloatPoint&, const DashArray& widths, bool printing, bool doubleLines, float strokeThickness);
- void drawLineForDocumentMarker(const FloatPoint&, float width, GraphicsContext::DocumentMarkerLineStyle);
- void drawEllipse(const FloatRect&);
- void drawPath(const Path&);
+ void drawRect(const FloatRect&, float borderThickness) override;
+ void drawLine(const FloatPoint&, const FloatPoint&) override;
+ void drawLinesForText(const FloatPoint&, const DashArray& widths, bool printing, bool doubleLines, float strokeThickness) override;
+ void drawLineForDocumentMarker(const FloatPoint&, float width, GraphicsContext::DocumentMarkerLineStyle) override;
+ void drawEllipse(const FloatRect&) override;
+ void drawPath(const Path&) override;
- void drawFocusRing(const Path&, float width, float offset, const Color&);
- void drawFocusRing(const Vector<FloatRect>&, float width, float offset, const Color&);
+ void drawFocusRing(const Path&, float width, float offset, const Color&) override;
+ void drawFocusRing(const Vector<FloatRect>&, float width, float offset, const Color&) override;
- void save();
- void restore();
+ void save() override;
+ void restore() override;
- void translate(float x, float y);
- void rotate(float angleInRadians);
- void scale(const FloatSize&);
- void concatCTM(const AffineTransform&);
+ void translate(float x, float y) override;
+ void rotate(float angleInRadians) override;
+ void scale(const FloatSize&) override;
+ void concatCTM(const AffineTransform&) override;
- void beginTransparencyLayer(float opacity);
- void endTransparencyLayer();
+ void beginTransparencyLayer(float opacity) override;
+ void endTransparencyLayer() override;
- void clip(const FloatRect&);
- void clipOut(const FloatRect&);
- void clipOut(const Path&);
- void clipPath(const Path&, WindRule);
+ void clip(const FloatRect&) override;
+ void clipOut(const FloatRect&) override;
+ void clipOut(const Path&) override;
+ void clipPath(const Path&, WindRule) override;
- void applyDeviceScaleFactor(float);
+ void applyDeviceScaleFactor(float) override;
- size_t itemCount() const { return m_displayList.itemCount(); }
-
-private:
Item& appendItem(Ref<Item>&&);
void willAppendItem(const Item&);
@@ -161,7 +161,6 @@
const ContextState& currentState() const;
ContextState& currentState();
- GraphicsContext& m_graphicsContext;
DisplayList& m_displayList;
Vector<ContextState, 32> m_stateStack;
Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp (224462 => 224463)
--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp 2017-11-04 23:01:56 UTC (rev 224462)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp 2017-11-04 23:43:55 UTC (rev 224463)
@@ -29,6 +29,7 @@
#if USE(CG)
#include "AffineTransform.h"
+#include "GraphicsContextImpl.h"
#include "GraphicsContextPlatformPrivateCG.h"
#include "Path.h"
Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (224462 => 224463)
--- trunk/Source/WebCore/rendering/RenderTheme.cpp 2017-11-04 23:01:56 UTC (rev 224462)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp 2017-11-04 23:43:55 UTC (rev 224463)
@@ -283,7 +283,7 @@
if (paintInfo.context().paintingDisabled())
return false;
- if (UNLIKELY(paintInfo.context().isRecording()))
+ if (UNLIKELY(!paintInfo.context().hasPlatformContext()))
return false;
ControlPart part = box.style().appearance();