WebKit Bugzilla
Attachment 345936 Details for
Bug 188116
: Renderer of large image has to be marked as waitingForAsyncDecoding when it is recorded into a DisplayList
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for EWS
bug-188116-20180727123731.patch (text/plain), 297.38 KB, created by
Said Abou-Hallawa
on 2018-07-27 12:37:32 PDT
(
hide
)
Description:
Patch for EWS
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2018-07-27 12:37:32 PDT
Size:
297.38 KB
patch
obsolete
>Subversion Revision: 234227 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index e16c2a630fba747f0f52ebd07183f6e7cca57d3f..25becbb50b43243d5626cde1659c8cf116d9b826 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,701 @@ >+2018-07-27 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ Renderer of large image has to be marked as waitingForAsyncDecoding when it is recorded into a DisplayList >+ https://bugs.webkit.org/show_bug.cgi?id=188116 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This should fix rendering the bitmap images through DisplayLists when they >+ are asynchronously decoded. >+ >+ * html/ImageBitmap.cpp: >+ * loader/cache/CachedImage.cpp: >+ (WebCore::CachedImage::CachedImageObserver::addClientWaitingForAsyncDecoding): >+ * loader/cache/CachedImage.h: >+ * platform/graphics/GraphicsContext.cpp: >+ (WebCore::GraphicsContext::drawImage): >+ (WebCore::GraphicsContext::drawTiledImage): >+ * platform/graphics/GraphicsContext.h: >+ (WebCore::ImagePaintingOptions::ImagePaintingOptions): >+ * platform/graphics/ImageObserver.h: >+ * rendering/RenderBoxModelObject.cpp: >+ (WebCore::RenderBoxModelObject::paintFillLayerExtended): >+ * rendering/RenderImage.cpp: >+ (WebCore::RenderImage::paintIntoRect): >+ >+2018-07-25 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ After replaying a DisplayList, the state of the drawing context has to be restored >+ https://bugs.webkit.org/show_bug.cgi?id=187980 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ A problem could happen if we are replaying multiple display lists to the >+ same drawing context. When replaying its DisplayListItems, the DisplayList >+ expects to find the state of the drawing context to be exactly the same >+ it was at the time it was recorded. >+ >+ * platform/graphics/displaylists/DisplayListReplayer.cpp: >+ (WebCore::DisplayList::Replayer::replay): >+ >+2018-07-25 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ After replaying a DisplayList, the state of the drawing context has to be restored >+ https://bugs.webkit.org/show_bug.cgi?id=187980 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ A problem could happen if we are replaying multiple display lists to the >+ same drawing context. When replaying its DisplayListItems, the DisplayList >+ expects to find the state of the drawing context to be exactly the same >+ it was at the time it was recorded. >+ >+ * platform/graphics/displaylists/DisplayListReplayer.cpp: >+ (WebCore::DisplayList::Replayer::replay): >+ >+2018-07-23 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ DisplayList::DrawRect() should take half of the border thickness into account when calculating the localBounds. >+ https://bugs.webkit.org/show_bug.cgi?id=187921 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Half of the border thickness is drawn outside the rectangle area. We need >+ to inflate the localBounds by this amount. Remember localBounds is used >+ in calculating the DisplayListItem extent which is used to decide whether >+ DisplayListItem intersects the clipping or not. And if they don't intersect >+ the DisplayListItem will not be drawn. >+ >+ * platform/graphics/displaylists/DisplayListItems.h: >+ * platform/graphics/displaylists/DisplayListReplayer.cpp: Deleted. >+ (WebCore::DisplayList::Replayer::~Replayer): >+ * platform/graphics/displaylists/DisplayListReplayer.h: >+ >+2018-07-22 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ Introduce RenderLayerContext >+ https://bugs.webkit.org/show_bug.cgi?id=187898 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This class will control whether the drawing context is a display list or >+ not. It will manage creating the display lists and replaying them in the >+ correct order. >+ >+ * WebCore.xcodeproj/project.pbxproj: >+ * rendering/PaintPhase.h: >+ * rendering/RenderLayer.cpp: >+ (WebCore::RenderLayer::paintLayerContents): >+ (WebCore::RenderLayer::paintCompositedPhasesMultiplePasses): >+ * rendering/RenderLayer.h: >+ * rendering/RenderLayerContext.h: Added. >+ (WebCore::RenderLayerContext::RenderLayerContext): >+ (WebCore::RenderLayerContext::graphicsContext): >+ (WebCore::RenderLayerDisplayListContext::RenderLayerDisplayListContext): >+ (WebCore::RenderLayerDisplayListContext::replay): >+ (WebCore::RenderLayerDisplayListContext::paintOrders): >+ (WebCore::RenderLayerDisplayListContext::paintOrdersSize): >+ (WebCore::RenderLayerDisplayListContext::paintOrderIndex): >+ (WebCore::RenderLayerDisplayListContext::graphicsContext): >+ >+2018-07-20 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ Refactor the RenderLayer composited phases painting into a separate function >+ https://bugs.webkit.org/show_bug.cgi?id=187865 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ The plan is to make RenderLayer::paintLayerContents() choose between different >+ implementations for painting the composited phases. The first implementation >+ is the existing one: multiple passes into the drawing GraphicsContext. In >+ the following patch, a new implementation will be introduced: multiple passes >+ into multiple DisplayLists. Then this implementation will be changed to be: >+ single pass into multiple DisplayLists. >+ >+ * rendering/RenderLayer.cpp: >+ (WebCore::RenderLayer::RenderLayer): >+ (WebCore::RenderLayer::beginTransparencyLayers): >+ (WebCore::RenderLayer::endTransparencyLayers): >+ (WebCore::RenderLayer::paintLayerContents): >+ (WebCore::RenderLayer::paintCompositedPhasesMultiplePasses): >+ * rendering/RenderLayer.h: >+ * rendering/RenderLayerBacking.cpp: >+ (WebCore::RenderLayerBacking::paintIntoLayer): >+ >+2018-07-20 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ Enable DisplayList recording for ShareableBitmap::paint() >+ https://bugs.webkit.org/show_bug.cgi?id=187841 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This drawing function should be record-able. >+ >+ * platform/graphics/GraphicsContext.h: >+ * platform/graphics/GraphicsContextImpl.h: >+ * platform/graphics/Icon.h: >+ * platform/graphics/cairo/GraphicsContextCairo.cpp: >+ (WebCore::GraphicsContext::drawNativeScaledImage): >+ * platform/graphics/cairo/GraphicsContextImplCairo.cpp: >+ (WebCore::GraphicsContextImplCairo::drawNativeScaledImage): >+ * platform/graphics/cairo/GraphicsContextImplCairo.h: >+ * platform/graphics/cg/GraphicsContextCG.cpp: >+ (WebCore::GraphicsContext::drawNativeScaledImage): >+ * platform/graphics/displaylists/DisplayListItems.cpp: >+ * platform/graphics/displaylists/DisplayListItems.h: >+ * platform/graphics/displaylists/DisplayListRecorder.cpp: >+ (WebCore::DisplayList::Recorder::drawNativeScaledImage): >+ * platform/graphics/displaylists/DisplayListRecorder.h: >+ * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp: >+ (Nicosia::CairoOperationRecorder::drawNativeScaledImage): >+ * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h: >+ >+2018-07-18 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ Clipping operations should be platform-independent GraphicsContext functions >+ https://bugs.webkit.org/show_bug.cgi?id=187795 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Recording to DisplayList list happens in the platform-independent APIs. >+ The actual clipping will be done in the platform-dependent sources. >+ >+ * html/canvas/CanvasRenderingContext2D.cpp: >+ (WebCore::CanvasRenderingContext2D::drawTextInternal): >+ * platform/graphics/GraphicsContext.cpp: >+ (WebCore::GraphicsContext::clip): >+ (WebCore::GraphicsContext::clipOut): >+ (WebCore::GraphicsContext::clipPath): >+ (WebCore::GraphicsContext::clipToImageBuffer): >+ * platform/graphics/GraphicsContext.h: >+ * platform/graphics/GraphicsContextImpl.h: >+ * platform/graphics/ImageBuffer.h: >+ * platform/graphics/ShadowBlur.cpp: >+ (WebCore::ShadowBlur::drawShadowBuffer): >+ * platform/graphics/cairo/GraphicsContextCairo.cpp: >+ (WebCore::GraphicsContext::platformClip): >+ (WebCore::GraphicsContext::platformClipPath): >+ (WebCore::GraphicsContext::platformClipOut): >+ (WebCore::GraphicsContext::platformClipToImageBuffer): >+ (WebCore::GraphicsContext::clip): Deleted. >+ (WebCore::GraphicsContext::clipPath): Deleted. >+ (WebCore::GraphicsContext::clipOut): Deleted. >+ (WebCore::GraphicsContext::clipToImageBuffer): Deleted. >+ * platform/graphics/cairo/GraphicsContextImplCairo.cpp: >+ (WebCore::GraphicsContextImplCairo::clipToImageBuffer): >+ * platform/graphics/cairo/GraphicsContextImplCairo.h: >+ * platform/graphics/cairo/ImageBufferCairo.cpp: >+ (WebCore::ImageBuffer::copyNativeImage): >+ * platform/graphics/cg/GraphicsContextCG.cpp: >+ (WebCore::GraphicsContext::platformClipToImageBuffer): >+ (WebCore::GraphicsContext::platformClip): >+ (WebCore::GraphicsContext::platformClipOut): >+ (WebCore::GraphicsContext::platformClipPath): >+ (WebCore::GraphicsContext::beginPlatformTransparencyLayer): >+ (WebCore::GraphicsContext::endPlatformTransparencyLayer): >+ (WebCore::GraphicsContext::clipToImageBuffer): Deleted. >+ (WebCore::GraphicsContext::clip): Deleted. >+ (WebCore::GraphicsContext::clipOut): Deleted. >+ (WebCore::GraphicsContext::clipPath): Deleted. >+ * platform/graphics/displaylists/DisplayListItems.cpp: >+ (WebCore::DisplayList::itemsDescriptors): >+ * platform/graphics/displaylists/DisplayListItems.h: >+ * platform/graphics/displaylists/DisplayListRecorder.cpp: >+ (WebCore::DisplayList::Recorder::clipToImageBuffer): >+ * platform/graphics/displaylists/DisplayListRecorder.h: >+ * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp: >+ (Nicosia::CairoOperationRecorder::clipToImageBuffer): >+ * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h: >+ * rendering/svg/SVGRenderingContext.cpp: >+ (WebCore::SVGRenderingContext::clipToImageBuffer): >+ >+2018-07-18 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ Allow icon, widget, scrollbar and theme to be drawn through DisplayList >+ https://bugs.webkit.org/show_bug.cgi?id=187765 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Drawing these items should go through GraphicsContext which will create >+ special DisplayListItems for drawing them. These DisplayListItems will >+ store all the parameters to be used when replaying the DisplayList back. >+ >+ * platform/ControlStates.h: >+ (WebCore::operator<<): >+ * platform/Scrollbar.cpp: >+ (WebCore::Scrollbar::paint): >+ (WebCore::Scrollbar::platformPaint): >+ * platform/Scrollbar.h: >+ (WebCore::operator<<): >+ * platform/Theme.cpp: >+ (WebCore::Theme::paint): >+ (WebCore::Theme::platformPaint): >+ * platform/Theme.h: >+ (WebCore::operator<<): >+ * platform/Widget.h: >+ (WebCore::operator<<): >+ * platform/graphics/Font.h: >+ (WebCore::operator<<): >+ * platform/graphics/GlyphBuffer.h: >+ (WebCore::operator<<): >+ * platform/graphics/Gradient.h: >+ (WebCore::operator<<): >+ * platform/graphics/GraphicsContext.cpp: >+ (WebCore::GraphicsContext::drawIcon): >+ (WebCore::GraphicsContext::drawWidget): >+ (WebCore::GraphicsContext::drawScrollbar): >+ (WebCore::GraphicsContext::drawTheme): >+ * platform/graphics/GraphicsContext.h: >+ * platform/graphics/GraphicsContextImpl.h: >+ * platform/graphics/Icon.h: >+ (WebCore::Icon::paint): >+ (WebCore::operator<<): >+ * platform/graphics/cairo/GraphicsContextImplCairo.cpp: >+ (WebCore::GraphicsContextImplCairo::drawIcon): >+ (WebCore::GraphicsContextImplCairo::drawWidget): >+ (WebCore::GraphicsContextImplCairo::drawScrollbar): >+ (WebCore::GraphicsContextImplCairo::drawTheme): >+ * platform/graphics/cairo/GraphicsContextImplCairo.h: >+ * platform/graphics/displaylists/DisplayList.cpp: >+ (WebCore::DisplayList::DisplayList::sizeInBytes const): >+ * platform/graphics/displaylists/DisplayList.h: >+ * platform/graphics/displaylists/DisplayListItems.cpp: >+ * platform/graphics/displaylists/DisplayListItems.h: >+ * platform/graphics/displaylists/DisplayListRecorder.cpp: >+ (WebCore::DisplayList::Recorder::drawIcon): >+ (WebCore::DisplayList::Recorder::drawWidget): >+ (WebCore::DisplayList::Recorder::drawScrollbar): >+ (WebCore::DisplayList::Recorder::drawTheme): >+ * platform/graphics/displaylists/DisplayListRecorder.h: >+ * platform/graphics/gtk/IconGtk.cpp: >+ (WebCore::Icon::platformPaint const): >+ (WebCore::Icon::paint): Deleted. >+ * platform/graphics/ios/IconIOS.mm: >+ (WebCore::Icon::platformPaint const): >+ (WebCore::Icon::paint): Deleted. >+ * platform/graphics/mac/IconMac.mm: >+ (WebCore::Icon::platformPaint const): >+ (WebCore::Icon::paint): Deleted. >+ * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp: >+ (Nicosia::CairoOperationRecorder::drawLinesForText): >+ (Nicosia::CairoOperationRecorder::drawIcon): >+ (Nicosia::CairoOperationRecorder::drawWidget): >+ (Nicosia::CairoOperationRecorder::drawScrollbar): >+ (Nicosia::CairoOperationRecorder::drawTheme): >+ (Nicosia::CairoOperationRecorder::drawPath): Deleted. >+ * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h: >+ * platform/graphics/win/IconWin.cpp: >+ (WebCore::Icon::platformPaint const): >+ (WebCore::Icon::paint): Deleted. >+ * platform/graphics/wpe/IconWPE.cpp: >+ (WebCore::Icon::platformPaint const): >+ (WebCore::Icon::paint): Deleted. >+ * platform/gtk/WidgetGtk.cpp: >+ (WebCore::Widget::paint): >+ (WebCore::Widget::platformPaint): >+ * platform/ios/WidgetIOS.mm: >+ (WebCore::Widget::paint): >+ (WebCore::Widget::platformPaint): >+ * platform/mac/ThemeMac.h: >+ * platform/mac/ThemeMac.mm: >+ (WebCore::paintToggleButton): >+ (WebCore::paintButton): >+ (WebCore::paintStepper): >+ (WebCore::ThemeMac::platformPaint): >+ (WebCore::ThemeMac::paint): Deleted. >+ * platform/mac/WidgetMac.mm: >+ (WebCore::Widget::paint): >+ (WebCore::Widget::platformPaint): >+ * platform/text/TextFlags.h: >+ (WebCore::operator<<): >+ * platform/win/WidgetWin.cpp: >+ (WebCore::Widget::paint): >+ (WebCore::Widget::platformPaint): >+ * platform/wpe/ThemeWPE.cpp: >+ (WebCore::ThemeWPE::platformPaint): >+ (WebCore::ThemeWPE::paintCheckbox): >+ (WebCore::ThemeWPE::paintRadio): >+ (WebCore::ThemeWPE::paintButton): >+ (WebCore::ThemeWPE::paint): Deleted. >+ * platform/wpe/ThemeWPE.h: >+ * platform/wpe/WidgetWPE.cpp: >+ (WebCore::Widget::paint): >+ (WebCore::Widget::platformPaint): >+ * rendering/RenderTheme.cpp: >+ (WebCore::RenderTheme::paint): >+ >+2018-07-17 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ Templatize DisplayListItems and use std::tuple to store the arguments >+ https://bugs.webkit.org/show_bug.cgi?id=187002 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ DisplayListItems are simple objects which represent graphics commands and >+ their arguments. The arguments are stored while recording the DisplayList >+ and used when replaying it back. In fact, we do not care much about knowing >+ these arguments expect when debugging the DisplayList. So a mechanical way >+ to store the arguments and passing them to GraphicsContext should be sufficient. >+ This will make adding a new DisplayListItem easier and in makes the code >+ a lot shorter. >+ >+ This patch templatizes the DisplayListItems classes and uses std::tuple to >+ store the arguments. The GraphicsContext function is passed as an argument >+ to the template along with the types of the std::tuple items. The class >+ hierarchy is a little bit different from the original one: >+ >+ -- Item: This is the base class and this is what DisplayList stores. >+ -- GeomtryItem: It is derived from Item and the only difference between >+ it and Item is it knows the extent of the Item. >+ -- GraphicsItem: It's a template class which takes a pointer to a GraphicsContext >+ function, set of arguments' types. Its constructor saves the arguments in >+ std::tuple. Its apply method calls the GraphicsContext function by passing >+ the arguments it stores. >+ -- SettingItem: It is derived from Item and GraphicsItem. >+ -- DrawingItem: It is derived from GeomtryItem and GraphicsItem. >+ >+ Notes and some drawbacks of this patch are: >+ -- The DisplayList replaying back function should be methods of GraphicsContext. >+ -- The operator << has to be defined for all the arguments' types. >+ -- When an arguments is a RefCounted and the GraphicsContex function takes >+ a raw pointer or reference to the object itself, the GraphicsItem can store >+ a Ref or a RefPtr to the object. The implicit casting of RefPtr and Ref >+ will do the magic when the arguments are passed to GraphicsContext. >+ >+ * platform/graphics/Font.h: >+ (WebCore::operator<<): >+ * platform/graphics/GlyphBuffer.h: >+ (WebCore::operator<<): >+ * platform/graphics/Gradient.h: >+ (WebCore::operator<<): >+ * platform/graphics/GraphicsContext.cpp: >+ (WebCore::GraphicsContext::applyStateChange): >+ * platform/graphics/GraphicsContext.h: >+ (WebCore::operator<<): >+ * platform/graphics/GraphicsContextImpl.h: >+ * platform/graphics/cairo/GraphicsContextCairo.cpp: >+ (WebCore::GraphicsContext::drawLinesForText): >+ * platform/graphics/cairo/GraphicsContextImplCairo.cpp: >+ (WebCore::GraphicsContextImplCairo::drawLinesForText): >+ (WebCore::GraphicsContextImplCairo::drawPath): Deleted. >+ * platform/graphics/cairo/GraphicsContextImplCairo.h: >+ * platform/graphics/cg/GraphicsContextCG.cpp: >+ (WebCore::GraphicsContext::drawLinesForText): >+ * platform/graphics/displaylists/DisplayList.cpp: >+ (WebCore::DisplayList::DisplayList::sizeInBytes const): >+ * platform/graphics/displaylists/DisplayList.h: >+ * platform/graphics/displaylists/DisplayListItems.cpp: >+ (WebCore::DisplayList::itemsDescriptors): >+ (WebCore::DisplayList::itemDescriptor): >+ (WebCore::DisplayList::Item::name const): >+ (WebCore::DisplayList::Item::argumentName const): >+ (WebCore::DisplayList::Item::description const): Deleted. >+ (WebCore::DisplayList::Item::sizeInBytes): Deleted. >+ (WebCore::DisplayList::operator<<): Deleted. >+ (WebCore::DisplayList::Save::apply const): Deleted. >+ (WebCore::DisplayList::Restore::apply const): Deleted. >+ (WebCore::DisplayList::Translate::apply const): Deleted. >+ (WebCore::DisplayList::Rotate::apply const): Deleted. >+ (WebCore::DisplayList::Scale::apply const): Deleted. >+ (WebCore::DisplayList::ConcatenateCTM::ConcatenateCTM): Deleted. >+ (WebCore::DisplayList::ConcatenateCTM::apply const): Deleted. >+ (WebCore::DisplayList::SetState::apply const): Deleted. >+ (WebCore::DisplayList::SetState::accumulate): Deleted. >+ (WebCore::DisplayList::SetLineCap::apply const): Deleted. >+ (WebCore::DisplayList::SetLineDash::apply const): Deleted. >+ (WebCore::DisplayList::SetLineJoin::apply const): Deleted. >+ (WebCore::DisplayList::SetMiterLimit::apply const): Deleted. >+ (WebCore::DisplayList::ClearShadow::apply const): Deleted. >+ (WebCore::DisplayList::Clip::apply const): Deleted. >+ (WebCore::DisplayList::ClipOut::apply const): Deleted. >+ (WebCore::DisplayList::ClipOutToPath::apply const): Deleted. >+ (WebCore::DisplayList::ClipPath::apply const): Deleted. >+ (WebCore::DisplayList::DrawGlyphs::DrawGlyphs): Deleted. >+ (WebCore::DisplayList::DrawGlyphs::generateGlyphBuffer const): Deleted. >+ (WebCore::DisplayList::DrawGlyphs::apply const): Deleted. >+ (WebCore::DisplayList::DrawGlyphs::computeBounds): Deleted. >+ (WebCore::DisplayList::DrawGlyphs::localBounds const): Deleted. >+ (WebCore::DisplayList::DrawImage::DrawImage): Deleted. >+ (WebCore::DisplayList::DrawImage::apply const): Deleted. >+ (WebCore::DisplayList::DrawTiledImage::DrawTiledImage): Deleted. >+ (WebCore::DisplayList::DrawTiledImage::apply const): Deleted. >+ (WebCore::DisplayList::DrawTiledScaledImage::DrawTiledScaledImage): Deleted. >+ (WebCore::DisplayList::DrawTiledScaledImage::apply const): Deleted. >+ (WebCore::DisplayList::DrawNativeImage::DrawNativeImage): Deleted. >+ (WebCore::DisplayList::DrawNativeImage::apply const): Deleted. >+ (WebCore::DisplayList::DrawPattern::DrawPattern): Deleted. >+ (WebCore::DisplayList::DrawPattern::apply const): Deleted. >+ (WebCore::DisplayList::DrawRect::apply const): Deleted. >+ (WebCore::DisplayList::DrawLine::localBounds const): Deleted. >+ (WebCore::DisplayList::DrawLine::apply const): Deleted. >+ (WebCore::DisplayList::DrawLinesForText::apply const): Deleted. >+ (WebCore::DisplayList::DrawLinesForText::localBounds const): Deleted. >+ (WebCore::DisplayList::DrawLineForDocumentMarker::apply const): Deleted. >+ (WebCore::DisplayList::DrawLineForDocumentMarker::localBounds const): Deleted. >+ (WebCore::DisplayList::DrawEllipse::apply const): Deleted. >+ (WebCore::DisplayList::DrawPath::apply const): Deleted. >+ (WebCore::DisplayList::DrawFocusRingPath::apply const): Deleted. >+ (WebCore::DisplayList::DrawFocusRingPath::localBounds const): Deleted. >+ (WebCore::DisplayList::DrawFocusRingRects::apply const): Deleted. >+ (WebCore::DisplayList::DrawFocusRingRects::localBounds const): Deleted. >+ (WebCore::DisplayList::FillRect::apply const): Deleted. >+ (WebCore::DisplayList::FillRectWithColor::apply const): Deleted. >+ (WebCore::DisplayList::FillRectWithGradient::apply const): Deleted. >+ (WebCore::DisplayList::FillCompositedRect::apply const): Deleted. >+ (WebCore::DisplayList::FillRoundedRect::apply const): Deleted. >+ (WebCore::DisplayList::FillRectWithRoundedHole::apply const): Deleted. >+ (WebCore::DisplayList::FillPath::apply const): Deleted. >+ (WebCore::DisplayList::FillEllipse::apply const): Deleted. >+ (WebCore::DisplayList::StrokeRect::localBounds const): Deleted. >+ (WebCore::DisplayList::StrokeRect::apply const): Deleted. >+ (WebCore::DisplayList::StrokePath::localBounds const): Deleted. >+ (WebCore::DisplayList::StrokePath::apply const): Deleted. >+ (WebCore::DisplayList::StrokeEllipse::localBounds const): Deleted. >+ (WebCore::DisplayList::StrokeEllipse::apply const): Deleted. >+ (WebCore::DisplayList::ClearRect::apply const): Deleted. >+ (WebCore::DisplayList::BeginTransparencyLayer::apply const): Deleted. >+ (WebCore::DisplayList::EndTransparencyLayer::apply const): Deleted. >+ (WebCore::DisplayList::ApplyStrokePattern::apply const): Deleted. >+ (WebCore::DisplayList::ApplyFillPattern::apply const): Deleted. >+ (WebCore::DisplayList::ApplyDeviceScaleFactor::apply const): Deleted. >+ * platform/graphics/displaylists/DisplayListItems.h: >+ (WebCore::DisplayList::Item::isGeometryItem const): >+ (WebCore::DisplayList::Item::dump const): >+ (WebCore::DisplayList::Item::type const): >+ (WebCore::DisplayList::Item::Item): >+ (WebCore::DisplayList::GeometryItem::setExtent): >+ (WebCore::DisplayList::GeometryItem::extent const): >+ (WebCore::DisplayList::GeometryItem::localBounds const): >+ (WebCore::DisplayList::GeometryItem::GeometryItem): >+ (WebCore::DisplayList::GraphicsItem::GraphicsItem): >+ (WebCore::DisplayList::GraphicsItem::argument const): >+ (WebCore::DisplayList::GraphicsItem::apply const): >+ (WebCore::DisplayList::GraphicsItem::iterarte const): >+ (WebCore::DisplayList::SettingItem::create): >+ (WebCore::DisplayList::SettingItem::SettingItem): >+ (WebCore::DisplayList::DrawingItem::create): >+ (WebCore::DisplayList::DrawingItem::DrawingItem): >+ (WebCore::DisplayList::Save::restoreIndex const): >+ (WebCore::DisplayList::Save::setRestoreIndex): >+ (WebCore::DisplayList::SetState::state const): >+ (WebCore::DisplayList::DrawGlyphs::create): >+ (WebCore::DisplayList::DrawGlyphs::subGlyphBuffer): >+ (WebCore::DisplayList::operator<<): >+ (WebCore::DisplayList::Item::isDrawingItem const): Deleted. >+ (WebCore::DisplayList::Item::isStateItem const): Deleted. >+ (WebCore::DisplayList::Item::isStateItemType): Deleted. >+ (WebCore::DisplayList::DrawingItem::setExtent): Deleted. >+ (WebCore::DisplayList::DrawingItem::extent const): Deleted. >+ (WebCore::DisplayList::DrawingItem::extentKnown const): Deleted. >+ (WebCore::DisplayList::DrawingItem::localBounds const): Deleted. >+ (WebCore::DisplayList::Save::create): Deleted. >+ (WebCore::DisplayList::Save::Save): Deleted. >+ (WebCore::DisplayList::Restore::create): Deleted. >+ (WebCore::DisplayList::Restore::Restore): Deleted. >+ (WebCore::DisplayList::Translate::create): Deleted. >+ (WebCore::DisplayList::Translate::x const): Deleted. >+ (WebCore::DisplayList::Translate::y const): Deleted. >+ (WebCore::DisplayList::Translate::Translate): Deleted. >+ (WebCore::DisplayList::Rotate::create): Deleted. >+ (WebCore::DisplayList::Rotate::angle const): Deleted. >+ (WebCore::DisplayList::Rotate::Rotate): Deleted. >+ (WebCore::DisplayList::Scale::create): Deleted. >+ (WebCore::DisplayList::Scale::amount const): Deleted. >+ (WebCore::DisplayList::Scale::Scale): Deleted. >+ (WebCore::DisplayList::ConcatenateCTM::create): Deleted. >+ (WebCore::DisplayList::ConcatenateCTM::transform const): Deleted. >+ (WebCore::DisplayList::SetState::create): Deleted. >+ (WebCore::DisplayList::SetState::SetState): Deleted. >+ (WebCore::DisplayList::SetLineCap::create): Deleted. >+ (WebCore::DisplayList::SetLineCap::lineCap const): Deleted. >+ (WebCore::DisplayList::SetLineCap::SetLineCap): Deleted. >+ (WebCore::DisplayList::SetLineDash::create): Deleted. >+ (WebCore::DisplayList::SetLineDash::dashArray const): Deleted. >+ (WebCore::DisplayList::SetLineDash::dashOffset const): Deleted. >+ (WebCore::DisplayList::SetLineDash::SetLineDash): Deleted. >+ (WebCore::DisplayList::SetLineJoin::create): Deleted. >+ (WebCore::DisplayList::SetLineJoin::lineJoin const): Deleted. >+ (WebCore::DisplayList::SetLineJoin::SetLineJoin): Deleted. >+ (WebCore::DisplayList::SetMiterLimit::create): Deleted. >+ (WebCore::DisplayList::SetMiterLimit::miterLimit const): Deleted. >+ (WebCore::DisplayList::SetMiterLimit::SetMiterLimit): Deleted. >+ (WebCore::DisplayList::ClearShadow::create): Deleted. >+ (WebCore::DisplayList::ClearShadow::ClearShadow): Deleted. >+ (WebCore::DisplayList::Clip::create): Deleted. >+ (WebCore::DisplayList::Clip::rect const): Deleted. >+ (WebCore::DisplayList::Clip::Clip): Deleted. >+ (WebCore::DisplayList::ClipOut::create): Deleted. >+ (WebCore::DisplayList::ClipOut::rect const): Deleted. >+ (WebCore::DisplayList::ClipOut::ClipOut): Deleted. >+ (WebCore::DisplayList::ClipOutToPath::create): Deleted. >+ (WebCore::DisplayList::ClipOutToPath::path const): Deleted. >+ (WebCore::DisplayList::ClipOutToPath::ClipOutToPath): Deleted. >+ (WebCore::DisplayList::ClipPath::create): Deleted. >+ (WebCore::DisplayList::ClipPath::path const): Deleted. >+ (WebCore::DisplayList::ClipPath::windRule const): Deleted. >+ (WebCore::DisplayList::ClipPath::ClipPath): Deleted. >+ (WebCore::DisplayList::DrawGlyphs::blockLocation const): Deleted. >+ (WebCore::DisplayList::DrawGlyphs::setBlockLocation): Deleted. >+ (WebCore::DisplayList::DrawGlyphs::localAnchor const): Deleted. >+ (WebCore::DisplayList::DrawGlyphs::anchorPoint const): Deleted. >+ (WebCore::DisplayList::DrawGlyphs::glyphs const): Deleted. >+ (WebCore::DisplayList::DrawImage::create): Deleted. >+ (WebCore::DisplayList::DrawImage::image const): Deleted. >+ (WebCore::DisplayList::DrawImage::source const): Deleted. >+ (WebCore::DisplayList::DrawImage::destination const): Deleted. >+ (WebCore::DisplayList::DrawTiledImage::create): Deleted. >+ (WebCore::DisplayList::DrawTiledImage::image const): Deleted. >+ (WebCore::DisplayList::DrawTiledImage::source const): Deleted. >+ (WebCore::DisplayList::DrawTiledImage::destination const): Deleted. >+ (WebCore::DisplayList::DrawTiledImage::tileSize const): Deleted. >+ (WebCore::DisplayList::DrawTiledImage::spacing const): Deleted. >+ (WebCore::DisplayList::DrawTiledScaledImage::create): Deleted. >+ (WebCore::DisplayList::DrawTiledScaledImage::image const): Deleted. >+ (WebCore::DisplayList::DrawTiledScaledImage::source const): Deleted. >+ (WebCore::DisplayList::DrawTiledScaledImage::destination const): Deleted. >+ (WebCore::DisplayList::DrawNativeImage::create): Deleted. >+ (WebCore::DisplayList::DrawNativeImage::source const): Deleted. >+ (WebCore::DisplayList::DrawNativeImage::destination const): Deleted. >+ (WebCore::DisplayList::DrawPattern::create): Deleted. >+ (WebCore::DisplayList::DrawPattern::image const): Deleted. >+ (WebCore::DisplayList::DrawPattern::patternTransform const): Deleted. >+ (WebCore::DisplayList::DrawPattern::tileRect const): Deleted. >+ (WebCore::DisplayList::DrawPattern::destRect const): Deleted. >+ (WebCore::DisplayList::DrawPattern::phase const): Deleted. >+ (WebCore::DisplayList::DrawPattern::spacing const): Deleted. >+ (WebCore::DisplayList::BeginTransparencyLayer::create): Deleted. >+ (WebCore::DisplayList::BeginTransparencyLayer::opacity const): Deleted. >+ (WebCore::DisplayList::BeginTransparencyLayer::BeginTransparencyLayer): Deleted. >+ (WebCore::DisplayList::EndTransparencyLayer::create): Deleted. >+ (WebCore::DisplayList::EndTransparencyLayer::EndTransparencyLayer): Deleted. >+ (WebCore::DisplayList::DrawRect::create): Deleted. >+ (WebCore::DisplayList::DrawRect::rect const): Deleted. >+ (WebCore::DisplayList::DrawRect::borderThickness const): Deleted. >+ (WebCore::DisplayList::DrawRect::DrawRect): Deleted. >+ (WebCore::DisplayList::DrawLine::create): Deleted. >+ (WebCore::DisplayList::DrawLine::point1 const): Deleted. >+ (WebCore::DisplayList::DrawLine::point2 const): Deleted. >+ (WebCore::DisplayList::DrawLine::DrawLine): Deleted. >+ (WebCore::DisplayList::DrawLinesForText::create): Deleted. >+ (WebCore::DisplayList::DrawLinesForText::setBlockLocation): Deleted. >+ (WebCore::DisplayList::DrawLinesForText::blockLocation const): Deleted. >+ (WebCore::DisplayList::DrawLinesForText::localAnchor const): Deleted. >+ (WebCore::DisplayList::DrawLinesForText::point const): Deleted. >+ (WebCore::DisplayList::DrawLinesForText::widths const): Deleted. >+ (WebCore::DisplayList::DrawLinesForText::isPrinting const): Deleted. >+ (WebCore::DisplayList::DrawLinesForText::doubleLines const): Deleted. >+ (WebCore::DisplayList::DrawLinesForText::DrawLinesForText): Deleted. >+ (WebCore::DisplayList::DrawLineForDocumentMarker::create): Deleted. >+ (WebCore::DisplayList::DrawLineForDocumentMarker::point const): Deleted. >+ (WebCore::DisplayList::DrawLineForDocumentMarker::width const): Deleted. >+ (WebCore::DisplayList::DrawLineForDocumentMarker::DrawLineForDocumentMarker): Deleted. >+ (WebCore::DisplayList::DrawEllipse::create): Deleted. >+ (WebCore::DisplayList::DrawEllipse::rect const): Deleted. >+ (WebCore::DisplayList::DrawEllipse::DrawEllipse): Deleted. >+ (WebCore::DisplayList::DrawPath::create): Deleted. >+ (WebCore::DisplayList::DrawPath::path const): Deleted. >+ (WebCore::DisplayList::DrawPath::DrawPath): Deleted. >+ (WebCore::DisplayList::DrawFocusRingPath::create): Deleted. >+ (WebCore::DisplayList::DrawFocusRingPath::path const): Deleted. >+ (WebCore::DisplayList::DrawFocusRingPath::width const): Deleted. >+ (WebCore::DisplayList::DrawFocusRingPath::offset const): Deleted. >+ (WebCore::DisplayList::DrawFocusRingPath::color const): Deleted. >+ (WebCore::DisplayList::DrawFocusRingPath::DrawFocusRingPath): Deleted. >+ (WebCore::DisplayList::DrawFocusRingRects::create): Deleted. >+ (WebCore::DisplayList::DrawFocusRingRects::rects const): Deleted. >+ (WebCore::DisplayList::DrawFocusRingRects::width const): Deleted. >+ (WebCore::DisplayList::DrawFocusRingRects::offset const): Deleted. >+ (WebCore::DisplayList::DrawFocusRingRects::color const): Deleted. >+ (WebCore::DisplayList::DrawFocusRingRects::DrawFocusRingRects): Deleted. >+ (WebCore::DisplayList::FillRect::create): Deleted. >+ (WebCore::DisplayList::FillRect::rect const): Deleted. >+ (WebCore::DisplayList::FillRect::FillRect): Deleted. >+ (WebCore::DisplayList::FillRectWithColor::create): Deleted. >+ (WebCore::DisplayList::FillRectWithColor::rect const): Deleted. >+ (WebCore::DisplayList::FillRectWithColor::color const): Deleted. >+ (WebCore::DisplayList::FillRectWithColor::FillRectWithColor): Deleted. >+ (WebCore::DisplayList::FillRectWithGradient::create): Deleted. >+ (WebCore::DisplayList::FillRectWithGradient::rect const): Deleted. >+ (WebCore::DisplayList::FillRectWithGradient::FillRectWithGradient): Deleted. >+ (WebCore::DisplayList::FillCompositedRect::create): Deleted. >+ (WebCore::DisplayList::FillCompositedRect::rect const): Deleted. >+ (WebCore::DisplayList::FillCompositedRect::color const): Deleted. >+ (WebCore::DisplayList::FillCompositedRect::compositeOperator const): Deleted. >+ (WebCore::DisplayList::FillCompositedRect::blendMode const): Deleted. >+ (WebCore::DisplayList::FillCompositedRect::FillCompositedRect): Deleted. >+ (WebCore::DisplayList::FillRoundedRect::create): Deleted. >+ (WebCore::DisplayList::FillRoundedRect::roundedRect const): Deleted. >+ (WebCore::DisplayList::FillRoundedRect::color const): Deleted. >+ (WebCore::DisplayList::FillRoundedRect::blendMode const): Deleted. >+ (WebCore::DisplayList::FillRoundedRect::FillRoundedRect): Deleted. >+ (WebCore::DisplayList::FillRectWithRoundedHole::create): Deleted. >+ (WebCore::DisplayList::FillRectWithRoundedHole::rect const): Deleted. >+ (WebCore::DisplayList::FillRectWithRoundedHole::roundedHoleRect const): Deleted. >+ (WebCore::DisplayList::FillRectWithRoundedHole::color const): Deleted. >+ (WebCore::DisplayList::FillRectWithRoundedHole::FillRectWithRoundedHole): Deleted. >+ (WebCore::DisplayList::FillPath::create): Deleted. >+ (WebCore::DisplayList::FillPath::path const): Deleted. >+ (WebCore::DisplayList::FillPath::FillPath): Deleted. >+ (WebCore::DisplayList::FillEllipse::create): Deleted. >+ (WebCore::DisplayList::FillEllipse::rect const): Deleted. >+ (WebCore::DisplayList::FillEllipse::FillEllipse): Deleted. >+ (WebCore::DisplayList::StrokeRect::create): Deleted. >+ (WebCore::DisplayList::StrokeRect::rect const): Deleted. >+ (WebCore::DisplayList::StrokeRect::lineWidth const): Deleted. >+ (WebCore::DisplayList::StrokeRect::StrokeRect): Deleted. >+ (WebCore::DisplayList::StrokePath::create): Deleted. >+ (WebCore::DisplayList::StrokePath::path const): Deleted. >+ (WebCore::DisplayList::StrokePath::StrokePath): Deleted. >+ (WebCore::DisplayList::StrokeEllipse::create): Deleted. >+ (WebCore::DisplayList::StrokeEllipse::rect const): Deleted. >+ (WebCore::DisplayList::StrokeEllipse::StrokeEllipse): Deleted. >+ (WebCore::DisplayList::ClearRect::create): Deleted. >+ (WebCore::DisplayList::ClearRect::rect const): Deleted. >+ (WebCore::DisplayList::ClearRect::ClearRect): Deleted. >+ (WebCore::DisplayList::ApplyStrokePattern::create): Deleted. >+ (WebCore::DisplayList::ApplyStrokePattern::ApplyStrokePattern): Deleted. >+ (WebCore::DisplayList::ApplyFillPattern::create): Deleted. >+ (WebCore::DisplayList::ApplyFillPattern::ApplyFillPattern): Deleted. >+ (WebCore::DisplayList::ApplyDeviceScaleFactor::create): Deleted. >+ (WebCore::DisplayList::ApplyDeviceScaleFactor::scaleFactor const): Deleted. >+ (WebCore::DisplayList::ApplyDeviceScaleFactor::ApplyDeviceScaleFactor): Deleted. >+ * platform/graphics/displaylists/DisplayListRecorder.cpp: >+ (WebCore::DisplayList::Recorder::willAppendItem): >+ (WebCore::DisplayList::Recorder::drawGlyphs): >+ (WebCore::DisplayList::Recorder::drawImage): >+ (WebCore::DisplayList::Recorder::drawTiledImage): >+ (WebCore::DisplayList::Recorder::drawNativeImage): >+ (WebCore::DisplayList::Recorder::drawPattern): >+ (WebCore::DisplayList::Recorder::beginTransparencyLayer): >+ (WebCore::DisplayList::Recorder::drawRect): >+ (WebCore::DisplayList::Recorder::drawLine): >+ (WebCore::DisplayList::Recorder::drawLinesForText): >+ (WebCore::DisplayList::Recorder::drawLineForDocumentMarker): >+ (WebCore::DisplayList::Recorder::drawEllipse): >+ (WebCore::DisplayList::Recorder::drawPath): >+ (WebCore::DisplayList::Recorder::drawFocusRing): >+ (WebCore::DisplayList::Recorder::fillRect): >+ (WebCore::DisplayList::Recorder::fillRoundedRect): >+ (WebCore::DisplayList::Recorder::fillRectWithRoundedHole): >+ (WebCore::DisplayList::Recorder::fillPath): >+ (WebCore::DisplayList::Recorder::fillEllipse): >+ (WebCore::DisplayList::Recorder::strokeRect): >+ (WebCore::DisplayList::Recorder::strokePath): >+ (WebCore::DisplayList::Recorder::strokeEllipse): >+ (WebCore::DisplayList::Recorder::clearRect): >+ (WebCore::DisplayList::Recorder::updateItemExtent const): >+ * platform/graphics/displaylists/DisplayListRecorder.h: >+ * platform/graphics/displaylists/DisplayListReplayer.cpp: >+ (WebCore::DisplayList::Replayer::replay): >+ * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp: >+ (Nicosia::CairoOperationRecorder::drawLinesForText): >+ (Nicosia::CairoOperationRecorder::drawPath): Deleted. >+ * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h: >+ * platform/graphics/win/GraphicsContextDirect2D.cpp: >+ (WebCore::GraphicsContext::drawLinesForText): >+ * platform/text/TextFlags.h: >+ (WebCore::operator<<): >+ > 2018-07-25 Chris Dumez <cdumez@apple.com> > > Allow ActiveDOMObject's canSuspend / suspend / resume overrides to destroy ActiveDOMObjects >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index a7252eee19ddc7797b3329ecbf95d0aaaedea73c..629b9b9611e9e573f451d97136128a292bce4a45 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,16 @@ >+2018-07-25 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ Enable DisplayList recording for ShareableBitmap::paint() >+ https://bugs.webkit.org/show_bug.cgi?id=187841 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Platform/cg/CGUtilities.cpp: Removed. >+ * Platform/cg/CGUtilities.h: Removed. >+ * Shared/cg/ShareableBitmapCG.cpp: >+ (WebKit::ShareableBitmap::paint): >+ * WebKit.xcodeproj/project.pbxproj: >+ > 2018-07-25 Brent Fulgham <bfulgham@apple.com> > > [macOS] Update sandboxes for revised OpenCL calls and streaming media >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 49206e40216931fcd1216a9193716a4bdb4280db..70e94151f682d623f02cbdeaa134d3a798988de0 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -8386,6 +8386,7 @@ > 555B87EB1CAAF0AB00349425 /* ImageDecoderCG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageDecoderCG.h; sourceTree = "<group>"; }; > 5576A5621D88A70800CCC04C /* ImageFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageFrame.cpp; sourceTree = "<group>"; }; > 5576A5631D88A70800CCC04C /* ImageFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageFrame.h; sourceTree = "<group>"; }; >+ 5584A1AD2102DF97005B70E1 /* RenderLayerContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderLayerContext.h; sourceTree = "<group>"; }; > 5597FCCB2076C06800D35BB0 /* GlyphDisplayListCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlyphDisplayListCache.h; sourceTree = "<group>"; }; > 55A336F61D8209F40022C4C7 /* NativeImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeImage.h; sourceTree = "<group>"; }; > 55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageBackingStore.h; sourceTree = "<group>"; }; >@@ -25955,6 +25956,7 @@ > 0F580CFB0F12DE9B0051D689 /* RenderLayerBacking.h */, > 0F580CFA0F12DE9B0051D689 /* RenderLayerCompositor.cpp */, > 0F580CF90F12DE9B0051D689 /* RenderLayerCompositor.h */, >+ 5584A1AD2102DF97005B70E1 /* RenderLayerContext.h */, > 50D10D971545F5760096D288 /* RenderLayerFilterInfo.cpp */, > 50D10D981545F5760096D288 /* RenderLayerFilterInfo.h */, > 3C244FE5A375AC633F88BE6F /* RenderLayerModelObject.cpp */, >diff --git a/Source/WebCore/html/ImageBitmap.cpp b/Source/WebCore/html/ImageBitmap.cpp >index 7de346707ac84008cbc68b9b1b428769ed2d70dd..3b4e1e1300232f94b577b5d4abc6b777fc1c2ce8 100644 >--- a/Source/WebCore/html/ImageBitmap.cpp >+++ b/Source/WebCore/html/ImageBitmap.cpp >@@ -503,6 +503,7 @@ public: > > void didDraw(const Image&) override { } > >+ void addClientWaitingForAsyncDecoding(CachedImageClient&) override { } > bool canDestroyDecodedData(const Image&) override { return true; } > void imageFrameAvailable(const Image&, ImageAnimatingState, const IntRect* = nullptr, DecodingStatus = DecodingStatus::Invalid) override { } > void changedInRect(const Image&, const IntRect* = nullptr) override { } >diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp >index e9ae63c4980d53925222f41959482e98145d77e6..050953c05d4c29193157dc35df7d003d74b44d76 100644 >--- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp >+++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp >@@ -556,7 +556,7 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo > } > > GraphicsContextStateSaver stateSaver(*c); >- c->clipToImageBuffer(*maskImage, maskRect); >+ c->clipToImageBuffer(maskImage->copyNativeImage(DontCopyBackingStore), maskRect, maskImage->sizeForDestinationSize(maskRect.size())); > drawStyle.applyFillColor(*c); > c->fillRect(maskRect); > return; >diff --git a/Source/WebCore/loader/cache/CachedImage.cpp b/Source/WebCore/loader/cache/CachedImage.cpp >index 23761a603a78dc8c2c1b42c649dac30c67eaafa6..b3111cad2ac20df70128d371a2d899333e40d1fd 100644 >--- a/Source/WebCore/loader/cache/CachedImage.cpp >+++ b/Source/WebCore/loader/cache/CachedImage.cpp >@@ -383,6 +383,12 @@ void CachedImage::CachedImageObserver::didDraw(const Image& image) > cachedImage->didDraw(image); > } > >+void CachedImage::CachedImageObserver::addClientWaitingForAsyncDecoding(CachedImageClient& client) >+{ >+ for (auto cachedImage : m_cachedImages) >+ cachedImage->addClientWaitingForAsyncDecoding(client); >+} >+ > bool CachedImage::CachedImageObserver::canDestroyDecodedData(const Image& image) > { > for (auto cachedImage : m_cachedImages) { >diff --git a/Source/WebCore/loader/cache/CachedImage.h b/Source/WebCore/loader/cache/CachedImage.h >index 701851f987b8a1735fcb3d17c516c7eb6c716f84..0529f87a4038e9e0b385bacc5cd33da0e5102d27 100644 >--- a/Source/WebCore/loader/cache/CachedImage.h >+++ b/Source/WebCore/loader/cache/CachedImage.h >@@ -146,6 +146,7 @@ private: > void decodedSizeChanged(const Image&, long long delta) final; > void didDraw(const Image&) final; > >+ void addClientWaitingForAsyncDecoding(CachedImageClient&) final; > bool canDestroyDecodedData(const Image&) final; > void imageFrameAvailable(const Image&, ImageAnimatingState, const IntRect* changeRect = nullptr, DecodingStatus = DecodingStatus::Invalid) final; > void changedInRect(const Image&, const IntRect*) final; >diff --git a/Source/WebCore/platform/ControlStates.h b/Source/WebCore/platform/ControlStates.h >index 1dce8b75807f0ddf7c5ab1f19e7539bc728d6971..fe96afdcbadb4057fd610526223e95f0dbdef102 100644 >--- a/Source/WebCore/platform/ControlStates.h >+++ b/Source/WebCore/platform/ControlStates.h >@@ -28,6 +28,7 @@ > > #include <wtf/RetainPtr.h> > #include <wtf/Seconds.h> >+#include <wtf/text/TextStream.h> > > #if PLATFORM(COCOA) > #ifndef __OBJC__ >@@ -103,6 +104,12 @@ private: > #endif > }; > >+inline TextStream& operator<<(TextStream& ts, const ControlStates&) >+{ >+ // FIXME: dump the ControlStates members to the TextStream. >+ return ts; >+} >+ > } > > #endif >diff --git a/Source/WebCore/platform/Scrollbar.cpp b/Source/WebCore/platform/Scrollbar.cpp >index f9e05f55f7568aee21ca849664bc3d6e57e11bef..de28f0274d6e3b244b2873c0b9e76b7b0809a171 100644 >--- a/Source/WebCore/platform/Scrollbar.cpp >+++ b/Source/WebCore/platform/Scrollbar.cpp >@@ -163,11 +163,16 @@ void Scrollbar::paint(GraphicsContext& context, const IntRect& damageRect, Widge > return; > } > >- if (context.paintingDisabled() || !frameRect().intersects(damageRect)) >+ if (!frameRect().intersects(damageRect)) > return; > >- if (!theme().paint(*this, context, damageRect)) >- Widget::paint(context, damageRect); >+ context.drawScrollbar(*this, damageRect); >+} >+ >+void Scrollbar::platformPaint(GraphicsContext& context, const IntRect& rect) >+{ >+ if (!theme().paint(*this, context, rect)) >+ Widget::paint(context, rect); > } > > void Scrollbar::autoscrollTimerFired() >diff --git a/Source/WebCore/platform/Scrollbar.h b/Source/WebCore/platform/Scrollbar.h >index 62f5044a8393be64eebbc6475475e8b2e2d72024..c0d430ad3db3399e6e375efe8c379ec78a7e027b 100644 >--- a/Source/WebCore/platform/Scrollbar.h >+++ b/Source/WebCore/platform/Scrollbar.h >@@ -84,6 +84,7 @@ public: > void setPressedPos(int p) { m_pressedPos = p; } > > void paint(GraphicsContext&, const IntRect& damageRect, Widget::SecurityOriginPaintPolicy = SecurityOriginPaintPolicy::AnyOrigin) override; >+ void platformPaint(GraphicsContext&, const IntRect&); > > bool enabled() const { return m_enabled; } > virtual void setEnabled(bool); >@@ -182,6 +183,12 @@ private: > bool isScrollbar() const override { return true; } > }; > >+inline TextStream& operator<<(TextStream& ts, const Scrollbar&) >+{ >+ // FIXME: dump the Scrollbar members to the TextStream. >+ return ts; >+} >+ > } // namespace WebCore > > SPECIALIZE_TYPE_TRAITS_WIDGET(Scrollbar, isScrollbar()) >diff --git a/Source/WebCore/platform/Theme.cpp b/Source/WebCore/platform/Theme.cpp >index c0af192b1d1525b05ad3af5fc809487c7b2610e2..64bb4f78dbf874a01fc1b2cc218df56771908ef6 100644 >--- a/Source/WebCore/platform/Theme.cpp >+++ b/Source/WebCore/platform/Theme.cpp >@@ -57,7 +57,12 @@ bool Theme::controlRequiresPreWhiteSpace(ControlPart) const > return false; > } > >-void Theme::paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float, ScrollView*, float, float, bool, bool) >+void Theme::paint(GraphicsContext& context, ControlPart part, ControlStates& states, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance) >+{ >+ context.drawTheme(*this, part, states, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor, useSystemAppearance, useDarkAppearance); >+} >+ >+void Theme::platformPaint(GraphicsContext&, ControlPart, ControlStates&, const FloatRect&, float, void*, float, float, bool, bool) > { > } > >diff --git a/Source/WebCore/platform/Theme.h b/Source/WebCore/platform/Theme.h >index e8cec35d5916bcdeb1de3988aa369b5be244e032..d63254bcaf3846f722559eeea2e5ce793a9451e1 100644 >--- a/Source/WebCore/platform/Theme.h >+++ b/Source/WebCore/platform/Theme.h >@@ -28,6 +28,7 @@ > #include "ThemeTypes.h" > #include <wtf/Forward.h> > #include <wtf/Optional.h> >+#include <wtf/text/TextStream.h> > > namespace WebCore { > >@@ -68,7 +69,8 @@ public: > virtual bool controlRequiresPreWhiteSpace(ControlPart) const; > > // Method for painting a control. The rect is in zoomed coordinates. >- virtual void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect& zoomedRect, float zoomFactor, ScrollView*, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance); >+ void paint(GraphicsContext&, ControlPart, ControlStates&, const FloatRect& zoomedRect, float zoomFactor, ScrollView*, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance); >+ virtual void platformPaint(GraphicsContext&, ControlPart, ControlStates&, const FloatRect& zoomedRect, float zoomFactor, void*, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance); > > // Some controls may spill out of their containers (e.g., the check on an OS X checkbox). When these controls repaint, > // the theme needs to communicate this inflated rect to the engine so that it can invalidate the whole control. >@@ -88,5 +90,11 @@ private: > Theme(const Theme&) = delete; > void operator=(const Theme&) = delete; > }; >+ >+inline TextStream& operator<<(TextStream& ts, const Theme&) >+{ >+ // FIXME: dump the Theme members to the TextStream. >+ return ts; >+} > > } // namespace WebCore >diff --git a/Source/WebCore/platform/Widget.h b/Source/WebCore/platform/Widget.h >index f31f245a80bbd70acce62118549cd2d400ac21f3..99cd83bfcb063f5dd102ad44200e738b2be3bfad 100644 >--- a/Source/WebCore/platform/Widget.h >+++ b/Source/WebCore/platform/Widget.h >@@ -38,6 +38,7 @@ > #include <wtf/RefCounted.h> > #include <wtf/TypeCasts.h> > #include <wtf/WeakPtr.h> >+#include <wtf/text/TextStream.h> > > #if PLATFORM(COCOA) > #include <wtf/RetainPtr.h> >@@ -114,6 +115,7 @@ public: > enum class SecurityOriginPaintPolicy { AnyOrigin, AccessibleOriginOnly }; > > WEBCORE_EXPORT virtual void paint(GraphicsContext&, const IntRect&, SecurityOriginPaintPolicy = SecurityOriginPaintPolicy::AnyOrigin); >+ void platformPaint(GraphicsContext&, const IntRect&); > void invalidate() { invalidateRect(boundsRect()); } > virtual void invalidateRect(const IntRect&) = 0; > >@@ -244,6 +246,12 @@ inline void Widget::retainPlatformWidget() > > #endif > >+inline TextStream& operator<<(TextStream& ts, const Widget&) >+{ >+ // FIXME: dump the Widget members to the TextStream. >+ return ts; >+} >+ > } // namespace WebCore > > #define SPECIALIZE_TYPE_TRAITS_WIDGET(ToValueTypeName, predicate) \ >diff --git a/Source/WebCore/platform/graphics/Font.h b/Source/WebCore/platform/graphics/Font.h >index 52edbae94537fa720d4714b181ed26f727b6e2be..7185986b230a3517fcd6ca97856bb2e628f7bcae 100644 >--- a/Source/WebCore/platform/graphics/Font.h >+++ b/Source/WebCore/platform/graphics/Font.h >@@ -37,6 +37,7 @@ > #include <wtf/BitVector.h> > #include <wtf/Optional.h> > #include <wtf/text/StringHash.h> >+#include <wtf/text/TextStream.h> > > #if PLATFORM(COCOA) > #include <wtf/RetainPtr.h> >@@ -370,6 +371,12 @@ ALWAYS_INLINE float Font::widthForGlyph(Glyph glyph) const > return width; > } > >+inline WTF::TextStream& operator<<(WTF::TextStream& ts, const Font&) >+{ >+ // FIXME: dump the Font members to the TextStream. >+ return ts; >+} >+ > } // namespace WebCore > > #endif // Font_h >diff --git a/Source/WebCore/platform/graphics/GlyphBuffer.h b/Source/WebCore/platform/graphics/GlyphBuffer.h >index 1752dcbd08e8f6cc799be45637cccfcc52e78c3c..45f17facd7b0e1da2f5cfc9150ebb2fd5af65330 100644 >--- a/Source/WebCore/platform/graphics/GlyphBuffer.h >+++ b/Source/WebCore/platform/graphics/GlyphBuffer.h >@@ -34,6 +34,7 @@ > #include "Glyph.h" > #include <climits> > #include <wtf/Vector.h> >+#include <wtf/text/TextStream.h> > > #if USE(CG) > #include <CoreGraphics/CGGeometry.h> >@@ -228,5 +229,11 @@ private: > #endif > }; > >+inline WTF::TextStream& operator<<(WTF::TextStream& ts, const GlyphBuffer&) >+{ >+ // FIXME: dump the GlyphBuffer members to the TextStream. >+ return ts; >+} >+ > } > #endif >diff --git a/Source/WebCore/platform/graphics/Gradient.h b/Source/WebCore/platform/graphics/Gradient.h >index c7fc4c6e369380a5e9a773124f740a63fdb5100b..7bfbffa47cd240ed776a11e19236bcdc00dfcde9 100644 >--- a/Source/WebCore/platform/graphics/Gradient.h >+++ b/Source/WebCore/platform/graphics/Gradient.h >@@ -34,6 +34,7 @@ > #include <wtf/RefCounted.h> > #include <wtf/Variant.h> > #include <wtf/Vector.h> >+#include <wtf/text/TextStream.h> > > #if USE(CG) > typedef struct CGContext* CGContextRef; >@@ -156,4 +157,10 @@ private: > PlatformGradient m_gradient; > }; > >+inline WTF::TextStream& operator<<(WTF::TextStream& ts, const Gradient&) >+{ >+ // FIXME: dump the Gradient members to the TextStream. >+ return ts; >+} >+ > } >diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp >index c9731aa5194866cf3fba5e033cc18d73c58637fa..2500cdfb3e6996072670bc33fac2cd9ced8efd32 100644 >--- a/Source/WebCore/platform/graphics/GraphicsContext.cpp >+++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp >@@ -31,10 +31,14 @@ > #include "FloatRoundedRect.h" > #include "Gradient.h" > #include "GraphicsContextImpl.h" >+#include "Icon.h" > #include "ImageBuffer.h" > #include "IntRect.h" > #include "RoundedRect.h" >+#include "Scrollbar.h" > #include "TextRun.h" >+#include "Theme.h" >+#include "Widget.h" > #include <wtf/text/TextStream.h> > > namespace WebCore { >@@ -713,44 +717,70 @@ ImageDrawResult GraphicsContext::drawImage(Image& image, const FloatRect& destin > > ImageDrawResult GraphicsContext::drawImage(Image& image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& imagePaintingOptions) > { >+ ImageDrawResult result = ImageDrawResult::DidNothing; > if (paintingDisabled()) >- return ImageDrawResult::DidNothing; >+ return result; > > if (m_impl) >- return m_impl->drawImage(image, destination, source, imagePaintingOptions); >+ result = m_impl->drawImage(image, destination, source, imagePaintingOptions); >+ else { >+ InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality); >+ result = image.draw(*this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_decodingMode, imagePaintingOptions.m_orientationDescription); >+ } > >- InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality); >- return image.draw(*this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_decodingMode, imagePaintingOptions.m_orientationDescription); >+ if (result == ImageDrawResult::DidRequestDecoding && image.imageObserver()) { >+ ASSERT(imagePaintingOptions.m_client); >+ image.imageObserver()->addClientWaitingForAsyncDecoding(*imagePaintingOptions.m_client); >+ } >+ >+ return result; > } > > ImageDrawResult GraphicsContext::drawTiledImage(Image& image, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& imagePaintingOptions) > { >+ ImageDrawResult result = ImageDrawResult::DidNothing; > if (paintingDisabled()) >- return ImageDrawResult::DidNothing; >+ return result; > > if (m_impl) >- return m_impl->drawTiledImage(image, destination, source, tileSize, spacing, imagePaintingOptions); >+ result = m_impl->drawTiledImage(image, destination, source, tileSize, spacing, imagePaintingOptions); >+ else { >+ InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality); >+ result = image.drawTiled(*this, destination, source, tileSize, spacing, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_decodingMode); >+ } > >- InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality); >- return image.drawTiled(*this, destination, source, tileSize, spacing, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode, imagePaintingOptions.m_decodingMode); >+ if (result == ImageDrawResult::DidRequestDecoding && image.imageObserver()) { >+ ASSERT(imagePaintingOptions.m_client); >+ image.imageObserver()->addClientWaitingForAsyncDecoding(*imagePaintingOptions.m_client); >+ } >+ >+ return result; > } > > ImageDrawResult GraphicsContext::drawTiledImage(Image& image, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, > Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions& imagePaintingOptions) > { >+ // Just do a scale. >+ if (hRule == Image::StretchTile && vRule == Image::StretchTile) >+ return drawImage(image, destination, source, imagePaintingOptions); >+ >+ ImageDrawResult result = ImageDrawResult::DidNothing; > if (paintingDisabled()) >- return ImageDrawResult::DidNothing; >+ return result; > > if (m_impl) >- return m_impl->drawTiledImage(image, destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions); >- >- if (hRule == Image::StretchTile && vRule == Image::StretchTile) { >- // Just do a scale. >- return drawImage(image, destination, source, imagePaintingOptions); >+ result = m_impl->drawTiledImage(image, destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions); >+ else { >+ InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality); >+ result = image.drawTiled(*this, destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions.m_compositeOperator); > } >- >- InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_interpolationQuality); >- return image.drawTiled(*this, destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions.m_compositeOperator); >+ >+ if (result == ImageDrawResult::DidRequestDecoding && image.imageObserver()) { >+ ASSERT(imagePaintingOptions.m_client); >+ image.imageObserver()->addClientWaitingForAsyncDecoding(*imagePaintingOptions.m_client); >+ } >+ >+ return result; > } > > void GraphicsContext::drawImageBuffer(ImageBuffer& image, const FloatPoint& destination, const ImagePaintingOptions& imagePaintingOptions) >@@ -797,6 +827,17 @@ void GraphicsContext::drawConsumingImageBuffer(std::unique_ptr<ImageBuffer> imag > ImageBuffer::drawConsuming(WTFMove(image), *this, destination, source, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode); > } > >+void GraphicsContext::clip(const FloatRect& rect) >+{ >+ if (paintingDisabled()) >+ return; >+ >+ if (m_impl) >+ m_impl->clip(rect); >+ else >+ platformClip(rect); >+} >+ > void GraphicsContext::clipRoundedRect(const FloatRoundedRect& rect) > { > if (paintingDisabled()) >@@ -829,6 +870,50 @@ IntRect GraphicsContext::clipBounds() const > return IntRect(); > } > #endif >+ >+void GraphicsContext::clipOut(const FloatRect& rect) >+{ >+ if (paintingDisabled()) >+ return; >+ >+ if (m_impl) >+ m_impl->clipOut(rect); >+ else >+ platformClipOut(rect); >+} >+ >+void GraphicsContext::clipOut(const Path& path) >+{ >+ if (paintingDisabled()) >+ return; >+ >+ if (m_impl) >+ m_impl->clipOut(path); >+ else >+ platformClipOut(path); >+} >+ >+void GraphicsContext::clipPath(const Path& path, WindRule clipRule) >+{ >+ if (paintingDisabled()) >+ return; >+ >+ if (m_impl) >+ m_impl->clipPath(path, clipRule); >+ else >+ platformClipPath(path, clipRule); >+} >+ >+void GraphicsContext::clipToImageBuffer(const NativeImagePtr& image, const FloatRect& destRect, const FloatSize& bufferDestinationSize) >+{ >+ if (paintingDisabled()) >+ return; >+ >+ if (m_impl) >+ m_impl->clipToImageBuffer(image, destRect, bufferDestinationSize); >+ else >+ platformClipToImageBuffer(image, destRect, bufferDestinationSize); >+} > > void GraphicsContext::setTextDrawingMode(TextDrawingModeFlags mode) > { >@@ -843,6 +928,50 @@ void GraphicsContext::setTextDrawingMode(TextDrawingModeFlags mode) > setPlatformTextDrawingMode(mode); > } > >+void GraphicsContext::drawIcon(Icon& icon, const FloatRect& rect) >+{ >+ if (paintingDisabled()) >+ return; >+ >+ if (m_impl) >+ m_impl->drawIcon(icon, rect); >+ else >+ icon.platformPaint(*this, rect); >+} >+ >+void GraphicsContext::drawWidget(Widget& widget, const IntRect& rect) >+{ >+ if (paintingDisabled()) >+ return; >+ >+ if (m_impl) >+ m_impl->drawWidget(widget, rect); >+ else >+ widget.platformPaint(*this, rect); >+} >+ >+void GraphicsContext::drawScrollbar(Scrollbar& scrollbar, const IntRect& rect) >+{ >+ if (paintingDisabled()) >+ return; >+ >+ if (m_impl) >+ m_impl->drawScrollbar(scrollbar, rect); >+ else >+ scrollbar.platformPaint(*this, rect); >+} >+ >+void GraphicsContext::drawTheme(Theme& theme, ControlPart part, ControlStates& states, const FloatRect& zoomedRect, float zoomFactor, void* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance) >+{ >+ if (paintingDisabled()) >+ return; >+ >+ if (m_impl) >+ m_impl->drawTheme(theme, part, states, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor, useSystemAppearance, useDarkAppearance); >+ else >+ theme.platformPaint(*this, part, states, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor, useSystemAppearance, useDarkAppearance); >+} >+ > void GraphicsContext::fillRect(const FloatRect& rect, Gradient& gradient) > { > if (paintingDisabled()) >@@ -1129,6 +1258,11 @@ void GraphicsContext::applyState(const GraphicsContextState& state) > setPlatformShouldAntialias(state.shouldAntialias); > setPlatformShouldSmoothFonts(state.shouldSmoothFonts); > } >+ >+void GraphicsContext::applyStateChange(const GraphicsContextStateChange& state) >+{ >+ state.apply(*this); >+} > > float GraphicsContext::dashedLineCornerWidthForStrokeWidth(float strokeWidth) const > { >diff --git a/Source/WebCore/platform/graphics/GraphicsContext.h b/Source/WebCore/platform/graphics/GraphicsContext.h >index ccc2d03e7eaf1fbbec2a121f583594b69014e12c..3f1cdc4725ddd54d19471bec41ce0e5dd7f4881f 100644 >--- a/Source/WebCore/platform/graphics/GraphicsContext.h >+++ b/Source/WebCore/platform/graphics/GraphicsContext.h >@@ -26,6 +26,7 @@ > > #pragma once > >+#include "ControlStates.h" > #include "DashArray.h" > #include "FloatRect.h" > #include "FontCascade.h" >@@ -34,6 +35,7 @@ > #include "Image.h" > #include "ImageOrientation.h" > #include "Pattern.h" >+#include "ThemeTypes.h" > #include <wtf/Function.h> > #include <wtf/Noncopyable.h> > >@@ -78,18 +80,23 @@ const int cMisspellingLinePatternWidth = 4; > const int cMisspellingLinePatternGapWidth = 1; > > class AffineTransform; >+class CachedImageClient; > class FloatRoundedRect; > class Gradient; >+class GraphicsContext3D; > class GraphicsContextImpl; > class GraphicsContextPlatformPrivate; >+class Icon; > class ImageBuffer; > class IntRect; >-class RoundedRect; >-class URL; >-class GraphicsContext3D; > class Path; >+class RoundedRect; >+class Scrollbar; > class TextRun; >+class Theme; > class TransformationMatrix; >+class URL; >+class Widget; > > enum TextDrawingMode { > TextModeFill = 1 << 0, >@@ -116,6 +123,12 @@ enum class DocumentMarkerLineStyle : uint8_t { > AutocorrectionReplacement, > DictationAlternatives > }; >+ >+inline WTF::TextStream& operator<<(WTF::TextStream& ts, const DocumentMarkerLineStyle&) >+{ >+ // FIXME: dump the ImagePaintingOptions to the TextStream. >+ return ts; >+} > > namespace DisplayList { > class Recorder; >@@ -198,28 +211,31 @@ struct GraphicsContextState { > }; > > struct ImagePaintingOptions { >- ImagePaintingOptions(CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal, DecodingMode decodingMode = DecodingMode::Synchronous, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), InterpolationQuality interpolationQuality = InterpolationDefault) >+ ImagePaintingOptions(CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal, DecodingMode decodingMode = DecodingMode::Synchronous, CachedImageClient* client = nullptr, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), InterpolationQuality interpolationQuality = InterpolationDefault) > : m_compositeOperator(compositeOperator) > , m_blendMode(blendMode) > , m_decodingMode(decodingMode) >+ , m_client(client) > , m_orientationDescription(orientationDescription) > , m_interpolationQuality(interpolationQuality) > { > } > >- ImagePaintingOptions(ImageOrientationDescription orientationDescription, InterpolationQuality interpolationQuality = InterpolationDefault, CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal, DecodingMode decodingMode = DecodingMode::Synchronous) >+ ImagePaintingOptions(ImageOrientationDescription orientationDescription, InterpolationQuality interpolationQuality = InterpolationDefault, CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal, DecodingMode decodingMode = DecodingMode::Synchronous, CachedImageClient* client = nullptr) > : m_compositeOperator(compositeOperator) > , m_blendMode(blendMode) > , m_decodingMode(decodingMode) >+ , m_client(client) > , m_orientationDescription(orientationDescription) > , m_interpolationQuality(interpolationQuality) > { > } > >- ImagePaintingOptions(InterpolationQuality interpolationQuality, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal, DecodingMode decodingMode = DecodingMode::Synchronous) >+ ImagePaintingOptions(InterpolationQuality interpolationQuality, ImageOrientationDescription orientationDescription = ImageOrientationDescription(), CompositeOperator compositeOperator = CompositeSourceOver, BlendMode blendMode = BlendModeNormal, DecodingMode decodingMode = DecodingMode::Synchronous, CachedImageClient* client = nullptr) > : m_compositeOperator(compositeOperator) > , m_blendMode(blendMode) > , m_decodingMode(decodingMode) >+ , m_client(client) > , m_orientationDescription(orientationDescription) > , m_interpolationQuality(interpolationQuality) > { >@@ -230,9 +246,16 @@ struct ImagePaintingOptions { > CompositeOperator m_compositeOperator; > BlendMode m_blendMode; > DecodingMode m_decodingMode; >+ CachedImageClient* m_client; > ImageOrientationDescription m_orientationDescription; > InterpolationQuality m_interpolationQuality; > }; >+ >+inline WTF::TextStream& operator<<(WTF::TextStream& ts, const ImagePaintingOptions&) >+{ >+ // FIXME: dump the ImagePaintingOptions to the TextStream. >+ return ts; >+} > > struct GraphicsContextStateChange { > GraphicsContextStateChange() = default; >@@ -255,7 +278,6 @@ struct GraphicsContextStateChange { > > WTF::TextStream& operator<<(WTF::TextStream&, const GraphicsContextStateChange&); > >- > class GraphicsContext { > WTF_MAKE_NONCOPYABLE(GraphicsContext); WTF_MAKE_FAST_ALLOCATED; > public: >@@ -327,6 +349,7 @@ public: > > #if USE(CG) || USE(DIRECT2D) || USE(CAIRO) > WEBCORE_EXPORT void drawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, ImageOrientation = ImageOrientation()); >+ WEBCORE_EXPORT void drawNativeScaledImage(const NativeImagePtr&, float scaleFactor, const IntPoint& destination, const IntRect& source); > #endif > > #if USE(CG) || USE(DIRECT2D) >@@ -397,9 +420,10 @@ public: > void clipRoundedRect(const FloatRoundedRect&); > > void clipOut(const FloatRect&); >+ void clipOut(const Path&); > void clipOutRoundedRect(const FloatRoundedRect&); > void clipPath(const Path&, WindRule = WindRule::EvenOdd); >- void clipToImageBuffer(ImageBuffer&, const FloatRect&); >+ void clipToImageBuffer(const NativeImagePtr&, const FloatRect&, const FloatSize&); > > IntRect clipBounds() const; > >@@ -412,6 +436,7 @@ public: > void drawBidiText(const FontCascade&, const TextRun&, const FloatPoint&, FontCascade::CustomFontNotReadyAction = FontCascade::DoNotPaintIfFontNotReady); > > void applyState(const GraphicsContextState&); >+ void applyStateChange(const GraphicsContextStateChange&); > > enum RoundingMode { > RoundAllSides, >@@ -448,6 +473,11 @@ public: > void drawFocusRing(const Vector<FloatRect>&, double timeOffset, bool& needsRedraw, const Color&); > #endif > >+ void drawIcon(Icon&, const FloatRect&); >+ void drawWidget(Widget&, const IntRect&); >+ void drawScrollbar(Scrollbar&, const IntRect&); >+ void drawTheme(Theme&, ControlPart, ControlStates&, const FloatRect& zoomedRect, float zoomFactor, void*, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance); >+ > void setLineCap(LineCap); > void setLineDash(const DashArray&, float dashOffset); > void setLineJoin(LineJoin); >@@ -467,7 +497,6 @@ public: > // implementations to handle clipping on the canvas differently since > // the discipline is different. > void canvasClip(const Path&, WindRule = WindRule::EvenOdd); >- void clipOut(const Path&); > > void scale(float s) > { >@@ -628,6 +657,12 @@ private: > > void platformFillRoundedRect(const FloatRoundedRect&, const Color&); > >+ void platformClip(const FloatRect&); >+ void platformClipOut(const FloatRect&); >+ void platformClipOut(const Path&); >+ void platformClipPath(const Path&, WindRule); >+ void platformClipToImageBuffer(const NativeImagePtr&, const FloatRect&, const FloatSize&); >+ > FloatRect computeLineBoundsAndAntialiasingModeForText(const FloatPoint&, float width, bool printing, Color&); > > float dashedLineCornerWidthForStrokeWidth(float) const; >diff --git a/Source/WebCore/platform/graphics/GraphicsContextImpl.h b/Source/WebCore/platform/graphics/GraphicsContextImpl.h >index 6bcf768adfd89ee0b196a3ea62ee0680c8ad18ee..4e248a0bbb334acc803ca67266c208647f33e05e 100644 >--- a/Source/WebCore/platform/graphics/GraphicsContextImpl.h >+++ b/Source/WebCore/platform/graphics/GraphicsContextImpl.h >@@ -73,18 +73,26 @@ public: > virtual ImageDrawResult 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; >+ virtual void drawNativeScaledImage(const NativeImagePtr&, float scaleFactor, const IntPoint& destination, const IntRect& source) = 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 drawLinesForText(const FloatPoint&, const DashArray& widths, bool printing, bool doubleLines, StrokeStyle) = 0; > virtual void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarkerLineStyle) = 0; > virtual void drawEllipse(const FloatRect&) = 0; >+#if USE(CG) > virtual void drawPath(const Path&) = 0; >+#endif > > 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 drawIcon(Icon&, const FloatRect&) = 0; >+ virtual void drawWidget(Widget&, const IntRect&) = 0; >+ virtual void drawScrollbar(Scrollbar&, const IntRect&) = 0; >+ virtual void drawTheme(Theme&, ControlPart, ControlStates&, const FloatRect& zoomedRect, float zoomFactor, void* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance) = 0; > > virtual void save() = 0; > virtual void restore() = 0; >@@ -104,7 +112,7 @@ public: > virtual void clipOut(const Path&) = 0; > virtual void clipPath(const Path&, WindRule) = 0; > virtual IntRect clipBounds() = 0; >- virtual void clipToImageBuffer(ImageBuffer&, const FloatRect&) = 0; >+ virtual void clipToImageBuffer(const NativeImagePtr&, const FloatRect& destRect, const FloatSize& bufferDestinationSize) = 0; > > virtual void applyDeviceScaleFactor(float) = 0; > >diff --git a/Source/WebCore/platform/graphics/Icon.h b/Source/WebCore/platform/graphics/Icon.h >index 860ea696feb485baba34fefc041d2ec388734b83..e25ca88ec8461ac0605a6d2675aaac5cc8acffbd 100644 >--- a/Source/WebCore/platform/graphics/Icon.h >+++ b/Source/WebCore/platform/graphics/Icon.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. >+ * Copyright (C) 2006-2018 Apple Inc. All rights reserved. > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -21,10 +21,12 @@ > #ifndef Icon_h > #define Icon_h > >+#include "GraphicsContext.h" > #include <wtf/Forward.h> > #include <wtf/RefCounted.h> > #include <wtf/RefPtr.h> > #include <wtf/RetainPtr.h> >+#include <wtf/text/TextStream.h> > > #if PLATFORM(IOS) > #include "NativeImage.h" >@@ -48,7 +50,12 @@ public: > > WEBCORE_EXPORT ~Icon(); > >- void paint(GraphicsContext&, const FloatRect&); >+ void paint(GraphicsContext& context, const FloatRect& rect) >+ { >+ context.drawIcon(*this, rect); >+ } >+ >+ void platformPaint(GraphicsContext&, const FloatRect&) const; > > #if PLATFORM(WIN) > static RefPtr<Icon> create(HICON hIcon) { return adoptRef(new Icon(hIcon)); } >@@ -79,6 +86,12 @@ private: > GdkPixbuf* m_icon; > #endif > }; >+ >+inline TextStream& operator<<(TextStream& ts, const Icon&) >+{ >+ // FIXME: dump the Icon members to the TextStream. >+ return ts; >+} > > } > >diff --git a/Source/WebCore/platform/graphics/ImageBuffer.h b/Source/WebCore/platform/graphics/ImageBuffer.h >index 987580e6bdc39123770921c57e7dc7dabd74a165..c7e5b8d1b11e0ba26c3b28f816e0b74733dc49b3 100644 >--- a/Source/WebCore/platform/graphics/ImageBuffer.h >+++ b/Source/WebCore/platform/graphics/ImageBuffer.h >@@ -134,10 +134,10 @@ public: > static FloatRect clampedRect(const FloatRect&); > > private: >-#if USE(CG) > // The returned image might be larger than the internalSize(). If you want the smaller > // image, crop the result. >- RetainPtr<CGImageRef> copyNativeImage(BackingStoreCopy = CopyBackingStore) const; >+ NativeImagePtr copyNativeImage(BackingStoreCopy = CopyBackingStore) const; >+#if USE(CG) > static RetainPtr<CGImageRef> sinkIntoNativeImage(std::unique_ptr<ImageBuffer>); > void flushContext() const; > #elif USE(DIRECT2D) >@@ -156,6 +156,9 @@ private: > friend class CrossfadeGeneratedImage; > friend class NamedImageGeneratedImage; > friend class GradientImage; >+ friend class CanvasRenderingContext2D; >+ friend class ShadowBlur; >+ friend class SVGRenderingContext; > > private: > ImageBufferData m_data; >diff --git a/Source/WebCore/platform/graphics/ImageObserver.h b/Source/WebCore/platform/graphics/ImageObserver.h >index 8269cc4edc37ce5f4dc165fbd4d61c3698a427fe..a026b3394e565da32e3fc7b76965c25dc036f575 100644 >--- a/Source/WebCore/platform/graphics/ImageObserver.h >+++ b/Source/WebCore/platform/graphics/ImageObserver.h >@@ -30,6 +30,7 @@ > > namespace WebCore { > >+class CachedImageClient; > class Image; > class IntRect; > class URL; >@@ -48,6 +49,7 @@ public: > > virtual void didDraw(const Image&) = 0; > >+ virtual void addClientWaitingForAsyncDecoding(CachedImageClient&) = 0; > virtual bool canDestroyDecodedData(const Image&) = 0; > virtual void imageFrameAvailable(const Image&, ImageAnimatingState, const IntRect* changeRect = nullptr, DecodingStatus = DecodingStatus::Invalid) = 0; > virtual void changedInRect(const Image&, const IntRect* changeRect = nullptr) = 0; >diff --git a/Source/WebCore/platform/graphics/ShadowBlur.cpp b/Source/WebCore/platform/graphics/ShadowBlur.cpp >index fe049a4b8e6703d61bc1adb5006885fcc7ed3fa5..dbd4c73187b7d2ac1df369a1b923f543495c9aec 100644 >--- a/Source/WebCore/platform/graphics/ShadowBlur.cpp >+++ b/Source/WebCore/platform/graphics/ShadowBlur.cpp >@@ -457,7 +457,7 @@ void ShadowBlur::drawShadowBuffer(GraphicsContext& graphicsContext) > // but we may not have cleared it all, so clip to the filled part first. > graphicsContext.clip(FloatRect(m_layerOrigin, m_layerSize)); > } >- graphicsContext.clipToImageBuffer(*m_layerImage, FloatRect(m_layerOrigin, bufferSize)); >+ graphicsContext.clipToImageBuffer(m_layerImage->copyNativeImage(DontCopyBackingStore), FloatRect(m_layerOrigin, bufferSize), m_layerImage->sizeForDestinationSize(bufferSize)); > graphicsContext.setFillColor(m_color); > > graphicsContext.clearShadow(); >diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp >index 8cfb1e92257e43252706aea545b426394fe99fd6..fef25a657dfdec48badf4e2ee9beb8d16f03a7da 100644 >--- a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp >+++ b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp >@@ -133,6 +133,20 @@ void GraphicsContext::drawNativeImage(const NativeImagePtr& image, const FloatSi > auto& state = this->state(); > Cairo::drawNativeImage(*platformContext(), image.get(), destRect, srcRect, compositeOperator, blendMode, orientation, state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state)); > } >+ >+void GraphicsContext::drawNativeScaledImage(const NativeImagePtr& image, float scaleFactor, const IntPoint& destination, const IntRect& source) >+{ >+ if (paintingDisabled()) >+ return; >+ >+ if (m_impl) { >+ m_impl->drawNativeScaledImage(image, scaleFactor, destination, source); >+ return; >+ } >+ >+ ASSERT(hasPlatformContext()); >+ notImplemented(); >+} > > // This is only used to draw borders, so we should not draw shadows. > void GraphicsContext::drawLine(const FloatPoint& point1, const FloatPoint& point2) >@@ -228,51 +242,27 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& color) > Cairo::fillRect(*platformContext(), rect, color, Cairo::ShadowState(state())); > } > >-void GraphicsContext::clip(const FloatRect& rect) >+void GraphicsContext::platformClip(const FloatRect& rect) > { >- if (paintingDisabled()) >- return; >- >- if (m_impl) { >- m_impl->clip(rect); >- return; >- } >- >+ ASSERT(!paintingDisabled()); > ASSERT(hasPlatformContext()); > Cairo::clip(*platformContext(), rect); > } > >-void GraphicsContext::clipPath(const Path& path, WindRule clipRule) >+void GraphicsContext::platformClipPath(const Path& path, WindRule clipRule) > { >- if (paintingDisabled()) >- return; >- >- if (m_impl) { >- m_impl->clipPath(path, clipRule); >- return; >- } >- >+ ASSERT(!paintingDisabled()); > ASSERT(hasPlatformContext()); > Cairo::clipPath(*platformContext(), path, clipRule); > } > >-void GraphicsContext::clipToImageBuffer(ImageBuffer& buffer, const FloatRect& destRect) >+void GraphicsContext::platformClipToImageBuffer(const NativeImagePtr& image, const FloatRect& destRect, const FloatSize&) > { >- if (paintingDisabled()) >- return; >- >- if (m_impl) { >- m_impl->clipToImageBuffer(buffer, destRect); >- return; >- } >- >- RefPtr<Image> image = buffer.copyImage(DontCopyBackingStore); >+ ASSERT(!paintingDisabled()); >+ ASSERT(hasPlatformContext()); > if (!image) > return; >- >- ASSERT(hasPlatformContext()); >- if (auto surface = image->nativeImageForCurrentFrame()) >- Cairo::clipToImageBuffer(*platformContext(), surface.get(), destRect); >+ Cairo::clipToImageBuffer(*platformContext(), image.get(), destRect); > } > > IntRect GraphicsContext::clipBounds() const >@@ -320,7 +310,7 @@ void GraphicsContext::drawLineForText(const FloatPoint& origin, float width, boo > drawLinesForText(origin, DashArray { width, 0 }, printing, doubleUnderlines); > } > >-void GraphicsContext::drawLinesForText(const FloatPoint& point, const DashArray& widths, bool printing, bool doubleUnderlines, StrokeStyle) >+void GraphicsContext::drawLinesForText(const FloatPoint& point, const DashArray& widths, bool printing, bool doubleUnderlines, StrokeStyle strokeStyle) > { > if (paintingDisabled()) > return; >@@ -329,7 +319,7 @@ void GraphicsContext::drawLinesForText(const FloatPoint& point, const DashArray& > return; > > if (m_impl) { >- m_impl->drawLinesForText(point, widths, printing, doubleUnderlines, strokeThickness()); >+ m_impl->drawLinesForText(point, widths, printing, doubleUnderlines, strokeStyle); > return; > } > >@@ -584,16 +574,9 @@ void GraphicsContext::canvasClip(const Path& path, WindRule windRule) > clipPath(path, windRule); > } > >-void GraphicsContext::clipOut(const Path& path) >+void GraphicsContext::platformClipOut(const Path& path) > { >- if (paintingDisabled()) >- return; >- >- if (m_impl) { >- m_impl->clipOut(path); >- return; >- } >- >+ ASSERT(!paintingDisabled()); > ASSERT(hasPlatformContext()); > Cairo::clipOut(*platformContext(), path); > } >@@ -626,16 +609,9 @@ void GraphicsContext::scale(const FloatSize& size) > Cairo::scale(*platformContext(), size); > } > >-void GraphicsContext::clipOut(const FloatRect& rect) >+void GraphicsContext::platformClipOut(const FloatRect& rect) > { >- if (paintingDisabled()) >- return; >- >- if (m_impl) { >- m_impl->clipOut(rect); >- return; >- } >- >+ ASSERT(!paintingDisabled()); > ASSERT(hasPlatformContext()); > Cairo::clipOut(*platformContext(), rect); > } >diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp b/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp >index e06e4031d879d190369aac83876804984c65a7cd..25b561232769fe9c953fd9baadce96967e0f5b10 100644 >--- a/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp >+++ b/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp >@@ -276,6 +276,11 @@ void GraphicsContextImplCairo::drawNativeImage(const NativeImagePtr& image, cons > Cairo::drawNativeImage(m_platformContext, image.get(), destRect, srcRect, compositeOperator, blendMode, orientation, state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state)); > } > >+void GraphicsContextImplCairo::drawNativeScaledImage(const NativeImagePtr&, float, const IntPoint&, const IntRect&) >+{ >+ ASSERT_NOT_IMPLEMENTED_YET(); >+} >+ > void GraphicsContextImplCairo::drawPattern(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize&, CompositeOperator compositeOperator, BlendMode blendMode) > { > if (auto surface = image.nativeImageForCurrentFrame()) >@@ -294,9 +299,9 @@ void GraphicsContextImplCairo::drawLine(const FloatPoint& point1, const FloatPoi > Cairo::drawLine(m_platformContext, point1, point2, state.strokeStyle, state.strokeColor, state.strokeThickness, state.shouldAntialias); > } > >-void GraphicsContextImplCairo::drawLinesForText(const FloatPoint& point, const DashArray& widths, bool printing, bool doubleUnderlines, float strokeThickness) >+void GraphicsContextImplCairo::drawLinesForText(const FloatPoint& point, const DashArray& widths, bool printing, bool doubleUnderlines, StrokeStyle strokeStyle) > { >- UNUSED_PARAM(strokeThickness); >+ UNUSED_PARAM(strokeStyle); > auto& state = graphicsContext().state(); > Cairo::drawLinesForText(m_platformContext, point, widths, printing, doubleUnderlines, state.strokeColor, state.strokeThickness); > } >@@ -312,10 +317,6 @@ void GraphicsContextImplCairo::drawEllipse(const FloatRect& rect) > Cairo::drawEllipse(*platformContext(), rect, state.fillColor, state.strokeStyle, state.strokeColor, state.strokeThickness); > } > >-void GraphicsContextImplCairo::drawPath(const Path&) >-{ >-} >- > void GraphicsContextImplCairo::drawFocusRing(const Path& path, float width, float offset, const Color& color) > { > UNUSED_PARAM(offset); >@@ -327,6 +328,26 @@ void GraphicsContextImplCairo::drawFocusRing(const Vector<FloatRect>& rects, flo > UNUSED_PARAM(offset); > Cairo::drawFocusRing(m_platformContext, rects, width, color); > } >+ >+void GraphicsContextImplCairo::drawIcon(Icon&, const FloatRect&) >+{ >+ ASSERT_NOT_IMPLEMENTED_YET(); >+} >+ >+void GraphicsContextImplCairo::drawWidget(Widget&, const IntRect&) >+{ >+ ASSERT_NOT_IMPLEMENTED_YET(); >+} >+ >+void GraphicsContextImplCairo::drawScrollbar(Scrollbar&, const IntRect&) >+{ >+ ASSERT_NOT_IMPLEMENTED_YET(); >+} >+ >+void GraphicsContextImplCairo::drawTheme(Theme&, ControlPart, ControlStates&, const FloatRect&, float, void*, float, float, bool, bool) >+{ >+ ASSERT_NOT_IMPLEMENTED_YET(); >+} > > void GraphicsContextImplCairo::save() > { >@@ -403,14 +424,11 @@ IntRect GraphicsContextImplCairo::clipBounds() > return Cairo::State::getClipBounds(m_platformContext); > } > >-void GraphicsContextImplCairo::clipToImageBuffer(ImageBuffer& buffer, const FloatRect& destRect) >+void GraphicsContextImplCairo::clipToImageBuffer(const NativeImagePtr& image, const FloatRect& destRect, const FloatSize&) > { >- RefPtr<Image> image = buffer.copyImage(DontCopyBackingStore); > if (!image) > return; >- >- if (auto surface = image->nativeImageForCurrentFrame()) >- Cairo::clipToImageBuffer(m_platformContext, surface.get(), destRect); >+ Cairo::clipToImageBuffer(m_platformContext, image.get(), destRect); > } > > void GraphicsContextImplCairo::applyDeviceScaleFactor(float) >diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.h b/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.h >index 997cbdda51c3f1c0c52d50fccea4e58595b8a79b..3713e51f31300969d7cd24d7aadbc7486b828e13 100644 >--- a/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.h >+++ b/Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.h >@@ -75,18 +75,23 @@ public: > ImageDrawResult drawTiledImage(Image&, const FloatRect&, const FloatPoint&, const FloatSize&, const FloatSize&, const ImagePaintingOptions&) override; > ImageDrawResult drawTiledImage(Image&, const FloatRect&, const FloatRect&, const FloatSize&, Image::TileRule, Image::TileRule, const ImagePaintingOptions&) override; > void drawNativeImage(const NativeImagePtr&, const FloatSize&, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode, ImageOrientation) override; >+ void drawNativeScaledImage(const NativeImagePtr&, float, const IntPoint&, const IntRect&) override; > void drawPattern(Image&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, const FloatSize&, CompositeOperator, BlendMode = BlendModeNormal) override; > > void drawRect(const FloatRect&, float) override; > void drawLine(const FloatPoint&, const FloatPoint&) override; >- void drawLinesForText(const FloatPoint&, const DashArray&, bool, bool, float) override; >+ void drawLinesForText(const FloatPoint&, const DashArray&, bool, bool, StrokeStyle) override; > void drawLineForDocumentMarker(const FloatPoint&, float, DocumentMarkerLineStyle) override; > void drawEllipse(const FloatRect&) override; >- void drawPath(const Path&) override; > > void drawFocusRing(const Path&, float, float, const Color&) override; > void drawFocusRing(const Vector<FloatRect>&, float, float, const Color&) override; > >+ void drawIcon(Icon&, const FloatRect&) override; >+ void drawWidget(Widget&, const IntRect&) override; >+ void drawScrollbar(Scrollbar&, const IntRect&) override; >+ void drawTheme(Theme&, ControlPart, ControlStates&, const FloatRect& zoomedRect, float zoomFactor, void* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance) override; >+ > void save() override; > void restore() override; > >@@ -105,7 +110,7 @@ public: > void clipOut(const Path&) override; > void clipPath(const Path&, WindRule) override; > IntRect clipBounds() override; >- void clipToImageBuffer(ImageBuffer&, const FloatRect&) override; >+ void clipToImageBuffer(const NativeImagePtr&, const FloatRect& destRect, const FloatSize& bufferDestinationSize) override; > > void applyDeviceScaleFactor(float) override; > >diff --git a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp >index 89a41f1f578aff6b72b69de24647fb5e74ef207e..f2ea18d6cfd12f0f6ee6d9c38590e5ac179e4cbd 100644 >--- a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp >+++ b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp >@@ -324,6 +324,12 @@ BackingStoreCopy ImageBuffer::fastCopyImageMode() > return DontCopyBackingStore; > } > >+NativeImagePtr ImageBuffer::copyNativeImage(BackingStoreCopy copyBehavior) const >+{ >+ auto image = copyImage(copyBehavior); >+ return image ? image->nativeImageForCurrentFrame() : nullptr; >+} >+ > void ImageBuffer::drawConsuming(std::unique_ptr<ImageBuffer> imageBuffer, GraphicsContext& destContext, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode) > { > imageBuffer->draw(destContext, destRect, srcRect, op, blendMode); >diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp >index d29507178cb00e569df1b1c66b99fda79ad247cf..a2a18c948692b582e939d4b642ea78122b9a7f44 100644 >--- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp >+++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp >@@ -393,6 +393,34 @@ void GraphicsContext::drawNativeImage(const RetainPtr<CGImageRef>& image, const > > LOG_WITH_STREAM(Images, stream << "GraphicsContext::drawNativeImage " << image.get() << " size " << imageSize << " into " << destRect << " took " << (MonotonicTime::now() - startTime).milliseconds() << "ms"); > } >+ >+void GraphicsContext::drawNativeScaledImage(const NativeImagePtr& image, float scaleFactor, const IntPoint& destination, const IntRect& source) >+{ >+ if (paintingDisabled()) >+ return; >+ >+ if (m_impl) { >+ m_impl->drawNativeScaledImage(image, scaleFactor, destination, source); >+ return; >+ } >+ >+ CGContextRef context = platformContext(); >+ >+ CGContextSaveGState(context); >+ >+ CGContextClipToRect(context, CGRectMake(destination.x(), destination.y(), source.width(), source.height())); >+ CGContextScaleCTM(context, 1, -1); >+ >+ CGFloat imageHeight = CGImageGetHeight(image.get()) / scaleFactor; >+ CGFloat imageWidth = CGImageGetWidth(image.get()) / scaleFactor; >+ >+ CGFloat destX = destination.x() - source.x(); >+ CGFloat destY = -imageHeight - destination.y() + source.y(); >+ >+ CGContextDrawImage(context, CGRectMake(destX, destY, imageWidth, imageHeight), image.get()); >+ >+ CGContextRestoreGState(context); >+} > > static void drawPatternCallback(void* info, CGContextRef context) > { >@@ -498,14 +526,8 @@ void GraphicsContext::drawPattern(Image& image, const FloatRect& destRect, const > } > } > >-void GraphicsContext::clipToImageBuffer(ImageBuffer& buffer, const FloatRect& destRect) >+void GraphicsContext::platformClipToImageBuffer(const NativeImagePtr& image, const FloatRect& destRect, const FloatSize& bufferDestinationSize) > { >- if (paintingDisabled()) >- return; >- >- FloatSize bufferDestinationSize = buffer.sizeForDestinationSize(destRect.size()); >- RetainPtr<CGImageRef> image = buffer.copyNativeImage(DontCopyBackingStore); >- > CGContextRef context = platformContext(); > // FIXME: This image needs to be grayscale to be used as an alpha mask here. > CGContextTranslateCTM(context, destRect.x(), destRect.y() + bufferDestinationSize.height()); >@@ -1057,29 +1079,17 @@ void GraphicsContext::fillRectWithRoundedHole(const FloatRect& rect, const Float > setFillColor(oldFillColor); > } > >-void GraphicsContext::clip(const FloatRect& rect) >+void GraphicsContext::platformClip(const FloatRect& rect) > { >- if (paintingDisabled()) >- return; >- >- if (m_impl) { >- m_impl->clip(rect); >- return; >- } >+ ASSERT(!paintingDisabled()); > > CGContextClipToRect(platformContext(), rect); > m_data->clip(rect); > } > >-void GraphicsContext::clipOut(const FloatRect& rect) >+void GraphicsContext::platformClipOut(const FloatRect& rect) > { >- if (paintingDisabled()) >- return; >- >- if (m_impl) { >- m_impl->clipOut(rect); >- return; >- } >+ ASSERT(!paintingDisabled()); > > // FIXME: Using CGRectInfinite is much faster than getting the clip bounding box. However, due > // to <rdar://problem/12584492>, CGRectInfinite can't be used with an accelerated context that >@@ -1093,15 +1103,9 @@ void GraphicsContext::clipOut(const FloatRect& rect) > CGContextEOClip(platformContext()); > } > >-void GraphicsContext::clipOut(const Path& path) >+void GraphicsContext::platformClipOut(const Path& path) > { >- if (paintingDisabled()) >- return; >- >- if (m_impl) { >- m_impl->clipOut(path); >- return; >- } >+ ASSERT(!paintingDisabled()); > > CGContextBeginPath(platformContext()); > CGContextAddRect(platformContext(), CGContextGetClipBoundingBox(platformContext())); >@@ -1110,15 +1114,9 @@ void GraphicsContext::clipOut(const Path& path) > CGContextEOClip(platformContext()); > } > >-void GraphicsContext::clipPath(const Path& path, WindRule clipRule) >+void GraphicsContext::platformClipPath(const Path& path, WindRule clipRule) > { >- if (paintingDisabled()) >- return; >- >- if (m_impl) { >- m_impl->clipPath(path, clipRule); >- return; >- } >+ ASSERT(!paintingDisabled()); > > CGContextRef context = platformContext(); > if (path.isEmpty()) >@@ -1587,7 +1585,7 @@ void GraphicsContext::drawLinesForText(const FloatPoint& point, const DashArray& > return; > > if (m_impl) { >- m_impl->drawLinesForText(point, widths, printing, doubleLines, strokeThickness()); >+ m_impl->drawLinesForText(point, widths, printing, doubleLines, strokeStyle); > return; > } > >diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp >index 4216ba0b16c27225ffedaddf6fe768b1bc94cb1b..99bdfaa9df53fc1bd8dfc8b9873a15840d45c147 100644 >--- a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp >+++ b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp >@@ -308,9 +308,9 @@ RetainPtr<CGImageRef> ImageBuffer::sinkIntoNativeImage(std::unique_ptr<ImageBuff > #endif > } > >-RetainPtr<CGImageRef> ImageBuffer::copyNativeImage(BackingStoreCopy copyBehavior) const >+NativeImagePtr ImageBuffer::copyNativeImage(BackingStoreCopy copyBehavior) const > { >- RetainPtr<CGImageRef> image; >+ NativeImagePtr image; > if (!context().isAcceleratedContext()) { > switch (copyBehavior) { > case DontCopyBackingStore: >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp b/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp >index a40f89f768854e804492b0c1a5c3a0fcb6de786f..a6be1dc2e67a98dd138770fdbf1e32a225d05efd 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp >@@ -114,8 +114,8 @@ void DisplayList::dump(TextStream& ts) const > size_t DisplayList::sizeInBytes() const > { > size_t result = 0; >- for (auto& ref : m_list) >- result += Item::sizeInBytes(ref); >+ for (auto& item : m_list) >+ result += item->sizeInBytes(); > > return result; > } >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayList.h b/Source/WebCore/platform/graphics/displaylists/DisplayList.h >index d4437e3d41be122cc89065247c92226e781dc77b..f862b878b504a0d4e2ddb810ce8ffa862be04c50 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayList.h >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayList.h >@@ -41,8 +41,6 @@ class GraphicsContext; > > namespace DisplayList { > >-class Item; >- > enum AsTextFlag { > None = 0, > IncludesPlatformOperations = 1 << 0, >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp b/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp >index 1fcee8b384373036d23f09112ab63e79695ec043..7343c7de45d4b8c8c53b85b575bbfb2a6ef8be4a 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2015 Apple Inc. All rights reserved. >+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -26,1121 +26,92 @@ > #include "config.h" > #include "DisplayListItems.h" > >-#include "FontCascade.h" >-#include <wtf/text/TextStream.h> >- > namespace WebCore { > namespace DisplayList { > >-// Should match RenderTheme::platformFocusRingWidth() >-static const float platformFocusRingWidth = 3; >- >-#if !defined(NDEBUG) || !LOG_DISABLED >-WTF::CString Item::description() const >-{ >- TextStream ts; >- ts << *this; >- return ts.release().utf8(); >-} >-#endif >- >-size_t Item::sizeInBytes(const Item& item) >-{ >- switch (item.type()) { >- case ItemType::Save: >- return sizeof(downcast<Save>(item)); >- case ItemType::Restore: >- return sizeof(downcast<Restore>(item)); >- case ItemType::Translate: >- return sizeof(downcast<Translate>(item)); >- case ItemType::Rotate: >- return sizeof(downcast<Rotate>(item)); >- case ItemType::Scale: >- return sizeof(downcast<Scale>(item)); >- case ItemType::ConcatenateCTM: >- return sizeof(downcast<ConcatenateCTM>(item)); >- case ItemType::SetState: >- return sizeof(downcast<SetState>(item)); >- case ItemType::SetLineCap: >- return sizeof(downcast<SetLineCap>(item)); >- case ItemType::SetLineDash: >- return sizeof(downcast<SetLineDash>(item)); >- case ItemType::SetLineJoin: >- return sizeof(downcast<SetLineJoin>(item)); >- case ItemType::SetMiterLimit: >- return sizeof(downcast<SetMiterLimit>(item)); >- case ItemType::ClearShadow: >- return sizeof(downcast<ClearShadow>(item)); >- case ItemType::Clip: >- return sizeof(downcast<Clip>(item)); >- case ItemType::ClipOut: >- return sizeof(downcast<ClipOut>(item)); >- case ItemType::ClipOutToPath: >- return sizeof(downcast<ClipOutToPath>(item)); >- case ItemType::ClipPath: >- return sizeof(downcast<ClipPath>(item)); >- case ItemType::DrawGlyphs: >- return sizeof(downcast<DrawGlyphs>(item)); >- case ItemType::DrawImage: >- return sizeof(downcast<DrawImage>(item)); >- case ItemType::DrawTiledImage: >- return sizeof(downcast<DrawTiledImage>(item)); >- case ItemType::DrawTiledScaledImage: >- return sizeof(downcast<DrawTiledScaledImage>(item)); >-#if USE(CG) || USE(CAIRO) >- case ItemType::DrawNativeImage: >- return sizeof(downcast<DrawNativeImage>(item)); >-#endif >- case ItemType::DrawPattern: >- return sizeof(downcast<DrawPattern>(item)); >- case ItemType::DrawRect: >- return sizeof(downcast<DrawRect>(item)); >- case ItemType::DrawLine: >- return sizeof(downcast<DrawLine>(item)); >- case ItemType::DrawLinesForText: >- return sizeof(downcast<DrawLinesForText>(item)); >- case ItemType::DrawLineForDocumentMarker: >- return sizeof(downcast<DrawLineForDocumentMarker>(item)); >- case ItemType::DrawEllipse: >- return sizeof(downcast<DrawEllipse>(item)); >- case ItemType::DrawPath: >- return sizeof(downcast<DrawPath>(item)); >- case ItemType::DrawFocusRingPath: >- return sizeof(downcast<DrawFocusRingPath>(item)); >- case ItemType::DrawFocusRingRects: >- return sizeof(downcast<DrawFocusRingRects>(item)); >- case ItemType::FillRect: >- return sizeof(downcast<FillRect>(item)); >- case ItemType::FillRectWithColor: >- return sizeof(downcast<FillRectWithColor>(item)); >- case ItemType::FillRectWithGradient: >- return sizeof(downcast<FillRectWithGradient>(item)); >- case ItemType::FillCompositedRect: >- return sizeof(downcast<FillCompositedRect>(item)); >- case ItemType::FillRoundedRect: >- return sizeof(downcast<FillRoundedRect>(item)); >- case ItemType::FillRectWithRoundedHole: >- return sizeof(downcast<FillRectWithRoundedHole>(item)); >- case ItemType::FillPath: >- return sizeof(downcast<FillPath>(item)); >- case ItemType::FillEllipse: >- return sizeof(downcast<FillEllipse>(item)); >- case ItemType::StrokeRect: >- return sizeof(downcast<StrokeRect>(item)); >- case ItemType::StrokePath: >- return sizeof(downcast<StrokePath>(item)); >- case ItemType::StrokeEllipse: >- return sizeof(downcast<StrokeEllipse>(item)); >- case ItemType::ClearRect: >- return sizeof(downcast<ClearRect>(item)); >- case ItemType::BeginTransparencyLayer: >- return sizeof(downcast<BeginTransparencyLayer>(item)); >- case ItemType::EndTransparencyLayer: >- return sizeof(downcast<EndTransparencyLayer>(item)); >-#if USE(CG) >- case ItemType::ApplyStrokePattern: >- return sizeof(downcast<ApplyStrokePattern>(item)); >- case ItemType::ApplyFillPattern: >- return sizeof(downcast<ApplyFillPattern>(item)); >-#endif >- case ItemType::ApplyDeviceScaleFactor: >- return sizeof(downcast<ApplyDeviceScaleFactor>(item)); >- } >- return 0; >+using ItemDescriptor = struct { >+ String name; >+ Vector<String> argumentsNames; >+}; >+ >+static const Vector<ItemDescriptor>& itemsDescriptors() >+{ >+ static NeverDestroyed<Vector<ItemDescriptor>> itemsDescriptors = Vector<ItemDescriptor>({ >+ { "save", { } }, >+ { "restore", { } }, >+ { "set-state", { "state-change" } }, >+ { "translate", { "x", "y" } }, >+ { "rotate", { "angle" } }, >+ { "scale", { "size" } }, >+ { "concatenate-ctm", { "ctm" } }, >+ { "set-line-cap", { "line-cap" } }, >+ { "set-line-dash", { "dash-array", "dash-offset" } }, >+ { "set-line-join", { "line-join" } }, >+ { "set-miter-limit", { "mitre-limit" } }, >+ { "clear-shadow", { } }, >+ { "clip", { "rect" } }, >+ { "clip-out", { "rect" } }, >+ { "clip-out-to-path", { "path" } }, >+ { "clip-path", { "path", "wind-rule" } }, >+ { "clip-to-image-buffer", { "image", "dest-rect", "buffer-destination-size" } }, >+ { "apply-stroke-pattern", { } }, >+ { "apply-fill-pattern", { } }, >+ { "apply-device-scale-factor", { "scale-factor" } }, >+ >+ { "begin-transparency-layer", { "opacity" } }, >+ { "end-transparency-layer", { } }, >+ { "draw-glyphs", { "font", "glyph-buffer", "from", "num-glyphs", "point", "font-smoothing" } }, >+ { "draw-image", { "image", "dest-rect", "source-rect", "image-painting-options" } }, >+ { "draw-tiled-image", { "image", "dest-rect", "source-point", "tile-size", "spacing", "image-painting-options" } }, >+ { "draw-tiled-scaled-image", { "image", "dest-rect", "source-rect", "tile-scalefactor", "h-rule", "v-rule", "image-painting-options" } }, >+ { "draw-native-image", { "image", "self-size", "dest-rect", "source-rect", "composite-operator", "blend-mode", "image-orientation" } }, >+ { "draw-native-scaled-image", { "image", "scale-factor", "dest-point", "source-rect" } }, >+ { "draw-pattern", { "image", "dest-rect", "tile-rect", "pattern-transform", "phase", "spacing", "composite-operator", "blend-mode" } }, >+ { "draw-rect", { "rect", "border-thickness" } }, >+ { "draw-line", { "point-1", "point-2" } }, >+ { "draw-lines-for-text", { "point", "widths", "is-printing", "double-lines", "stroke-style" } }, >+ { "draw-line-for-document-marker", { "point", "width", "document-marker-line-style" } }, >+ { "draw-ellipse", { "rect" } }, >+ { "draw-path", { "path" } }, >+ { "draw-focus-ring-path", { "path", "width", "offset", "color" } }, >+ { "draw-focus-ring-rects", { "rects", "width", "offset", "color" } }, >+ { "draw-icon", { "icon", "rect" } }, >+ { "draw-widget", { "widget", "rect"} }, >+ { "draw-scrollbar", { "scrollbar", "rect" } }, >+ { "draw-theme", { "theme", "control-part", "control-states", "zoomed-rect", "zoom-factor", "scroll-view", "device-scale-factor", "page-scale-factor", "use-system-appearance", "use-dark-appearance" } }, >+ { "fill-rect", { "rect" } }, >+ { "fill-rect-with-color", { "rect", "color" } }, >+ { "fill-rect-with-gradient", { "rect", "gradient" } }, >+ { "fill-composited-rect", { "rect", "color", "composite-operator", "blend-mode" } }, >+ { "fill-rounded-rect", { "rect", "color", "blend-mode" } }, >+ { "fill-rect-with-rounded-hole", { "rect", "rounded-hole-rect", "color" } }, >+ { "fill-path", { "path" } }, >+ { "fill-ellipse", { "rect" } }, >+ { "stroke-rect", { "rect", "line-width" } }, >+ { "stroke-path", { "path" } }, >+ { "stroke-ellipse", { "rect" } }, >+ { "clear-rect", { "rect" } } >+ }); >+ >+ ASSERT(static_cast<size_t>(ItemType::Max) == itemsDescriptors.get().size()); >+ return itemsDescriptors; >+} >+ >+static const ItemDescriptor& itemDescriptor(ItemType itemType) >+{ >+ ASSERT(static_cast<size_t>(itemType) < itemsDescriptors().size()); >+ return itemsDescriptors()[static_cast<size_t>(itemType)]; > } >- >-static TextStream& operator<<(TextStream& ts, const DrawingItem& item) >-{ >- ts.startGroup(); >- ts << "extent "; >- if (item.extentKnown()) >- ts << item.extent(); >- else >- ts << "unknown"; > >- ts.endGroup(); >- return ts; >-} >- >-void Save::apply(GraphicsContext& context) const >-{ >- context.save(); >-} >- >-static TextStream& operator<<(TextStream& ts, const Save& item) >-{ >- ts.dumpProperty("restore-index", item.restoreIndex()); >- return ts; >-} >- >-void Restore::apply(GraphicsContext& context) const >-{ >- context.restore(); >-} >- >-void Translate::apply(GraphicsContext& context) const >-{ >- context.translate(m_x, m_y); >-} >- >-static TextStream& operator<<(TextStream& ts, const Translate& item) >-{ >- ts.dumpProperty("x", item.x()); >- ts.dumpProperty("y", item.y()); >- >- return ts; >-} >- >-void Rotate::apply(GraphicsContext& context) const >-{ >- context.rotate(m_angle); >-} >- >-static TextStream& operator<<(TextStream& ts, const Rotate& item) >-{ >- ts.dumpProperty("angle", item.angle()); >- >- return ts; >-} >- >-void Scale::apply(GraphicsContext& context) const >-{ >- context.scale(m_size); >-} >- >-static TextStream& operator<<(TextStream& ts, const Scale& item) >-{ >- ts.dumpProperty("size", item.amount()); >- >- return ts; >-} >- >-ConcatenateCTM::ConcatenateCTM(const AffineTransform& transform) >- : Item(ItemType::ConcatenateCTM) >- , m_transform(transform) >-{ >-} >- >-void ConcatenateCTM::apply(GraphicsContext& context) const >-{ >- context.concatCTM(m_transform); >-} >- >-static TextStream& operator<<(TextStream& ts, const ConcatenateCTM& item) >-{ >- ts.dumpProperty("ctm", item.transform()); >- >- return ts; >-} >- >-void SetState::apply(GraphicsContext& context) const >-{ >- m_state.apply(context); >-} >- >-void SetState::accumulate(const GraphicsContextState& state, GraphicsContextState::StateChangeFlags flags) >-{ >- m_state.accumulate(state, flags); >-} >- >-static TextStream& operator<<(TextStream& ts, const SetState& state) >-{ >- ts << state.state(); >- return ts; >-} >- >-void SetLineCap::apply(GraphicsContext& context) const >-{ >- context.setLineCap(m_lineCap); >-} >- >-static TextStream& operator<<(TextStream& ts, const SetLineCap& lineCap) >-{ >- ts.dumpProperty("line-cap", lineCap.lineCap()); >- return ts; >-} >- >-void SetLineDash::apply(GraphicsContext& context) const >-{ >- context.setLineDash(m_dashArray, m_dashOffset); >-} >- >-static TextStream& operator<<(TextStream& ts, const SetLineDash& lineDash) >-{ >- ts.dumpProperty("dash-array", lineDash.dashArray()); >- ts.dumpProperty("dash-offset", lineDash.dashOffset()); >- return ts; >-} >- >-void SetLineJoin::apply(GraphicsContext& context) const >-{ >- context.setLineJoin(m_lineJoin); >-} >- >-static TextStream& operator<<(TextStream& ts, const SetLineJoin& lineJoin) >-{ >- ts.dumpProperty("line-join", lineJoin.lineJoin()); >- return ts; >-} >- >-void SetMiterLimit::apply(GraphicsContext& context) const >-{ >- context.setMiterLimit(m_miterLimit); >-} >- >-static TextStream& operator<<(TextStream& ts, const SetMiterLimit& miterLimit) >-{ >- ts.dumpProperty("mitre-limit", miterLimit.miterLimit()); >- return ts; >-} >- >-void ClearShadow::apply(GraphicsContext& context) const >-{ >- context.clearShadow(); >-} >- >-void Clip::apply(GraphicsContext& context) const >-{ >- context.clip(m_rect); >-} >- >-static TextStream& operator<<(TextStream& ts, const Clip& item) >-{ >- ts.dumpProperty("rect", item.rect()); >- return ts; >-} >- >-void ClipOut::apply(GraphicsContext& context) const >-{ >- context.clipOut(m_rect); >-} >- >-static TextStream& operator<<(TextStream& ts, const ClipOut& item) >-{ >- ts.dumpProperty("rect", item.rect()); >- return ts; >-} >- >-void ClipOutToPath::apply(GraphicsContext& context) const >-{ >- context.clipOut(m_path); >-} >- >-static TextStream& operator<<(TextStream& ts, const ClipOutToPath& item) >-{ >- ts.dumpProperty("path", item.path()); >- return ts; >-} >- >-void ClipPath::apply(GraphicsContext& context) const >-{ >- context.clipPath(m_path, m_windRule); >-} >- >-static TextStream& operator<<(TextStream& ts, const ClipPath& item) >-{ >- ts.dumpProperty("path", item.path()); >- ts.dumpProperty("wind-rule", item.windRule()); >- return ts; >-} >- >-DrawGlyphs::DrawGlyphs(const Font& font, const GlyphBufferGlyph* glyphs, const GlyphBufferAdvance* advances, unsigned count, const FloatPoint& blockLocation, const FloatSize& localAnchor, FontSmoothingMode smoothingMode) >- : DrawingItem(ItemType::DrawGlyphs) >- , m_font(const_cast<Font&>(font)) >- , m_blockLocation(blockLocation) >- , m_localAnchor(localAnchor) >- , m_smoothingMode(smoothingMode) >-{ >- m_glyphs.reserveInitialCapacity(count); >- m_advances.reserveInitialCapacity(count); >- for (unsigned i = 0; i < count; ++i) { >- m_glyphs.uncheckedAppend(glyphs[i]); >- m_advances.uncheckedAppend(advances[i]); >- } >- computeBounds(); >-} >- >-inline GlyphBuffer DrawGlyphs::generateGlyphBuffer() const >-{ >- GlyphBuffer result; >- for (size_t i = 0; i < m_glyphs.size(); ++i) { >- result.add(m_glyphs[i], &m_font.get(), m_advances[i]); >- } >- return result; >-} >- >-void DrawGlyphs::apply(GraphicsContext& context) const >-{ >- context.drawGlyphs(m_font, generateGlyphBuffer(), 0, m_glyphs.size(), anchorPoint(), m_smoothingMode); >-} >- >-void DrawGlyphs::computeBounds() >-{ >- // FIXME: This code doesn't actually take the extents of the glyphs into consideration. It assumes that >- // the glyph lies entirely within its [(ascent + descent), advance] rect. >- float ascent = m_font->fontMetrics().floatAscent(); >- float descent = m_font->fontMetrics().floatDescent(); >- FloatPoint current = toFloatPoint(localAnchor()); >- size_t numGlyphs = m_glyphs.size(); >- for (size_t i = 0; i < numGlyphs; ++i) { >- GlyphBufferAdvance advance = m_advances[i]; >- FloatRect glyphRect = FloatRect(current.x(), current.y() - ascent, advance.width(), ascent + descent); >- m_bounds.unite(glyphRect); >- >- current.move(advance.width(), advance.height()); >- } >-} >- >-std::optional<FloatRect> DrawGlyphs::localBounds(const GraphicsContext&) const >+String Item::name() const > { >- FloatRect localBounds = m_bounds; >- localBounds.move(m_blockLocation.x(), m_blockLocation.y()); >- return localBounds; >+ return itemDescriptor(m_type).name; > } > >-static TextStream& operator<<(TextStream& ts, const DrawGlyphs& item) >+String Item::argumentName(size_t index) const > { >- ts << static_cast<const DrawingItem&>(item); >- // FIXME: dump more stuff. >- ts.dumpProperty("block-location", item.blockLocation()); >- ts.dumpProperty("local-anchor", item.localAnchor()); >- ts.dumpProperty("anchor-point", item.anchorPoint()); >- ts.dumpProperty("length", item.glyphs().size()); >- >- return ts; >-} >- >-DrawImage::DrawImage(Image& image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& imagePaintingOptions) >- : DrawingItem(ItemType::DrawImage) >- , m_image(image) >- , m_destination(destination) >- , m_source(source) >- , m_imagePaintingOptions(imagePaintingOptions) >-{ >-} >- >-void DrawImage::apply(GraphicsContext& context) const >-{ >- context.drawImage(m_image.get(), m_destination, m_source, m_imagePaintingOptions); >-} >- >-static TextStream& operator<<(TextStream& ts, const DrawImage& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("image", item.image()); >- ts.dumpProperty("source-rect", item.source()); >- ts.dumpProperty("dest-rect", item.destination()); >- return ts; >-} >- >-DrawTiledImage::DrawTiledImage(Image& image, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& imagePaintingOptions) >- : DrawingItem(ItemType::DrawTiledImage) >- , m_image(image) >- , m_destination(destination) >- , m_source(source) >- , m_tileSize(tileSize) >- , m_spacing(spacing) >- , m_imagePaintingOptions(imagePaintingOptions) >-{ >-} >- >-void DrawTiledImage::apply(GraphicsContext& context) const >-{ >- context.drawTiledImage(m_image.get(), m_destination, m_source, m_tileSize, m_spacing, m_imagePaintingOptions); >-} >- >-static TextStream& operator<<(TextStream& ts, const DrawTiledImage& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("image", item.image()); >- ts.dumpProperty("source-point", item.source()); >- ts.dumpProperty("dest-rect", item.destination()); >- ts.dumpProperty("tile-size", item.tileSize()); >- ts.dumpProperty("spacing", item.spacing()); >- return ts; >-} >- >-DrawTiledScaledImage::DrawTiledScaledImage(Image& image, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions& imagePaintingOptions) >- : DrawingItem(ItemType::DrawTiledScaledImage) >- , m_image(image) >- , m_destination(destination) >- , m_source(source) >- , m_tileScaleFactor(tileScaleFactor) >- , m_hRule(hRule) >- , m_vRule(vRule) >- , m_imagePaintingOptions(imagePaintingOptions) >-{ >-} >- >-void DrawTiledScaledImage::apply(GraphicsContext& context) const >-{ >- context.drawTiledImage(m_image.get(), m_destination, m_source, m_tileScaleFactor, m_hRule, m_vRule, m_imagePaintingOptions); >-} >- >-static TextStream& operator<<(TextStream& ts, const DrawTiledScaledImage& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("image", item.image()); >- ts.dumpProperty("source-rect", item.source()); >- ts.dumpProperty("dest-rect", item.destination()); >- return ts; >-} >- >-#if USE(CG) || USE(CAIRO) >-DrawNativeImage::DrawNativeImage(const NativeImagePtr& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode, ImageOrientation orientation) >- : DrawingItem(ItemType::DrawNativeImage) >-#if USE(CG) >- // FIXME: Need to store an image for Cairo. >- , m_image(image) >-#endif >- , m_imageSize(imageSize) >- , m_destination(destRect) >- , m_srcRect(srcRect) >-#if USE(CG) >- , m_op(op) >- , m_blendMode(blendMode) >-#endif >- , m_orientation(orientation) >-{ >-#if !USE(CG) >- UNUSED_PARAM(image); >- UNUSED_PARAM(op); >- UNUSED_PARAM(blendMode); >-#endif >-} >- >-void DrawNativeImage::apply(GraphicsContext& context) const >-{ >-#if USE(CG) >- context.drawNativeImage(m_image, m_imageSize, m_destination, m_srcRect, m_op, m_blendMode, m_orientation); >-#else >- UNUSED_PARAM(context); >-#endif >-} >- >-static TextStream& operator<<(TextStream& ts, const DrawNativeImage& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- // FIXME: dump more stuff. >- ts.dumpProperty("source-rect", item.source()); >- ts.dumpProperty("dest-rect", item.destination()); >- return ts; >-} >-#endif >- >-DrawPattern::DrawPattern(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator op, BlendMode blendMode) >- : DrawingItem(ItemType::DrawPattern) >- , m_image(image) >- , m_patternTransform(patternTransform) >- , m_tileRect(tileRect) >- , m_destination(destRect) >- , m_phase(phase) >- , m_spacing(spacing) >- , m_op(op) >- , m_blendMode(blendMode) >-{ >-} >- >-void DrawPattern::apply(GraphicsContext& context) const >-{ >- context.drawPattern(m_image.get(), m_destination, m_tileRect, m_patternTransform, m_phase, m_spacing, m_op, m_blendMode); >-} >- >-static TextStream& operator<<(TextStream& ts, const DrawPattern& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("image", item.image()); >- ts.dumpProperty("pattern-transform", item.patternTransform()); >- ts.dumpProperty("tile-rect", item.tileRect()); >- ts.dumpProperty("dest-rect", item.destRect()); >- ts.dumpProperty("phase", item.phase()); >- ts.dumpProperty("spacing", item.spacing()); >- return ts; >-} >- >-void DrawRect::apply(GraphicsContext& context) const >-{ >- context.drawRect(m_rect, m_borderThickness); >-} >- >-static TextStream& operator<<(TextStream& ts, const DrawRect& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("rect", item.rect()); >- ts.dumpProperty("border-thickness", item.borderThickness()); >- return ts; >-} >- >-std::optional<FloatRect> DrawLine::localBounds(const GraphicsContext&) const >-{ >- FloatRect bounds; >- bounds.fitToPoints(m_point1, m_point2); >- return bounds; >-} >- >-void DrawLine::apply(GraphicsContext& context) const >-{ >- context.drawLine(m_point1, m_point2); >-} >- >-static TextStream& operator<<(TextStream& ts, const DrawLine& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("point-1", item.point1()); >- ts.dumpProperty("point-2", item.point2()); >- return ts; >-} >- >-void DrawLinesForText::apply(GraphicsContext& context) const >-{ >- context.drawLinesForText(point(), m_widths, m_printing, m_doubleLines); >-} >- >-std::optional<FloatRect> DrawLinesForText::localBounds(const GraphicsContext&) const >-{ >- // This function needs to return a value equal to or enclosing what GraphicsContext::computeLineBoundsAndAntialiasingModeForText() returns. >- >- if (!m_widths.size()) >- return FloatRect(); >- >- FloatRect result(point(), FloatSize(m_widths.last(), m_strokeWidth)); >- result.inflate(1); // Account for pixel snapping. FIXME: This isn't perfect, as it doesn't take the CTM into account. >- return result; >-} >- >-static TextStream& operator<<(TextStream& ts, const DrawLinesForText& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("block-location", item.blockLocation()); >- ts.dumpProperty("local-anchor", item.localAnchor()); >- ts.dumpProperty("point", item.point()); >- ts.dumpProperty("double", item.doubleLines()); >- ts.dumpProperty("widths", item.widths()); >- ts.dumpProperty("is-printing", item.isPrinting()); >- ts.dumpProperty("double", item.doubleLines()); >- return ts; >-} >- >-void DrawLineForDocumentMarker::apply(GraphicsContext& context) const >-{ >- context.drawLineForDocumentMarker(m_point, m_width, m_style); >-} >- >-std::optional<FloatRect> DrawLineForDocumentMarker::localBounds(const GraphicsContext&) const >-{ >- // This function needs to return a value equal to or enclosing what GraphicsContext::drawLineForDocumentMarker() returns. >- >- FloatRect result(m_point, FloatSize(m_width, cMisspellingLineThickness)); >- result.inflate(cMisspellingLineThickness); // Account for "misspelling dot" snapping. >- return result; >-} >- >-static TextStream& operator<<(TextStream& ts, const DrawLineForDocumentMarker& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("point", item.point()); >- ts.dumpProperty("width", item.width()); >- return ts; >-} >- >-void DrawEllipse::apply(GraphicsContext& context) const >-{ >- context.drawEllipse(m_rect); >-} >- >-static TextStream& operator<<(TextStream& ts, const DrawEllipse& item) >-{ >- ts.dumpProperty("rect", item.rect()); >- return ts; >-} >- >-void DrawPath::apply(GraphicsContext& context) const >-{ >-#if USE(CG) >- context.drawPath(m_path); >-#else >- UNUSED_PARAM(context); >-#endif >-} >- >-static TextStream& operator<<(TextStream& ts, const DrawPath& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >-// ts.dumpProperty("path", item.path()); // FIXME: add logging for paths. >- return ts; >-} >- >-void DrawFocusRingPath::apply(GraphicsContext& context) const >-{ >- context.drawFocusRing(m_path, m_width, m_offset, m_color); >-} >- >-std::optional<FloatRect> DrawFocusRingPath::localBounds(const GraphicsContext&) const >-{ >- FloatRect result = m_path.fastBoundingRect(); >- result.inflate(platformFocusRingWidth); >- return result; >-} >- >-static TextStream& operator<<(TextStream& ts, const DrawFocusRingPath& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >-// ts.dumpProperty("path", item.path()); // FIXME: add logging for paths. >- ts.dumpProperty("width", item.width()); >- ts.dumpProperty("offset", item.offset()); >- ts.dumpProperty("color", item.color()); >- return ts; >-} >- >-void DrawFocusRingRects::apply(GraphicsContext& context) const >-{ >- context.drawFocusRing(m_rects, m_width, m_offset, m_color); >-} >- >-std::optional<FloatRect> DrawFocusRingRects::localBounds(const GraphicsContext&) const >-{ >- FloatRect result; >- for (auto& rect : m_rects) >- result.unite(rect); >- result.inflate(platformFocusRingWidth); >- return result; >-} >- >-static TextStream& operator<<(TextStream& ts, const DrawFocusRingRects& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("rects", item.rects()); >- ts.dumpProperty("width", item.width()); >- ts.dumpProperty("offset", item.offset()); >- ts.dumpProperty("color", item.color()); >- return ts; >-} >- >-void FillRect::apply(GraphicsContext& context) const >-{ >- context.fillRect(m_rect); >-} >- >-static TextStream& operator<<(TextStream& ts, const FillRect& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("rect", item.rect()); >- return ts; >-} >- >-void FillRectWithColor::apply(GraphicsContext& context) const >-{ >- context.fillRect(m_rect, m_color); >-} >- >-static TextStream& operator<<(TextStream& ts, const FillRectWithColor& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("rect", item.rect()); >- ts.dumpProperty("color", item.color()); >- return ts; >-} >- >-void FillRectWithGradient::apply(GraphicsContext& context) const >-{ >- context.fillRect(m_rect, m_gradient.get()); >-} >- >-static TextStream& operator<<(TextStream& ts, const FillRectWithGradient& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- // FIXME: log gradient. >- ts.dumpProperty("rect", item.rect()); >- return ts; >-} >- >-void FillCompositedRect::apply(GraphicsContext& context) const >-{ >- context.fillRect(m_rect, m_color, m_op, m_blendMode); >-} >- >-static TextStream& operator<<(TextStream& ts, const FillCompositedRect& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("rect", item.rect()); >- ts.dumpProperty("color", item.color()); >- ts.dumpProperty("composite-operation", item.compositeOperator()); >- ts.dumpProperty("blend-mode", item.blendMode()); >- return ts; >-} >- >-void FillRoundedRect::apply(GraphicsContext& context) const >-{ >- context.fillRoundedRect(m_rect, m_color, m_blendMode); >-} >- >-static TextStream& operator<<(TextStream& ts, const FillRoundedRect& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("rect", item.roundedRect()); >- ts.dumpProperty("color", item.color()); >- ts.dumpProperty("blend-mode", item.blendMode()); >- return ts; >-} >- >-void FillRectWithRoundedHole::apply(GraphicsContext& context) const >-{ >- context.fillRectWithRoundedHole(m_rect, m_roundedHoleRect, m_color); >-} >- >-static TextStream& operator<<(TextStream& ts, const FillRectWithRoundedHole& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("rect", item.rect()); >- ts.dumpProperty("rounded-hole-rect", item.roundedHoleRect()); >- ts.dumpProperty("color", item.color()); >- return ts; >-} >- >-void FillPath::apply(GraphicsContext& context) const >-{ >- context.fillPath(m_path); >-} >- >-static TextStream& operator<<(TextStream& ts, const FillPath& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("path", item.path()); >- return ts; >-} >- >-void FillEllipse::apply(GraphicsContext& context) const >-{ >- context.fillEllipse(m_rect); >-} >- >-static TextStream& operator<<(TextStream& ts, const FillEllipse& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("rect", item.rect()); >- return ts; >-} >- >-std::optional<FloatRect> StrokeRect::localBounds(const GraphicsContext&) const >-{ >- FloatRect bounds = m_rect; >- bounds.expand(m_lineWidth, m_lineWidth); >- return bounds; >-} >- >-void StrokeRect::apply(GraphicsContext& context) const >-{ >- context.strokeRect(m_rect, m_lineWidth); >-} >- >-static TextStream& operator<<(TextStream& ts, const StrokeRect& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("rect", item.rect()); >- ts.dumpProperty("line-width", item.lineWidth()); >- return ts; >-} >- >-std::optional<FloatRect> StrokePath::localBounds(const GraphicsContext& context) const >-{ >- // FIXME: Need to take stroke thickness into account correctly, via CGPathByStrokingPath(). >- float strokeThickness = context.strokeThickness(); >- >- FloatRect bounds = m_path.boundingRect(); >- bounds.expand(strokeThickness, strokeThickness); >- return bounds; >-} >- >-void StrokePath::apply(GraphicsContext& context) const >-{ >- context.strokePath(m_path); >-} >- >-static TextStream& operator<<(TextStream& ts, const StrokePath& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("path", item.path()); >- return ts; >-} >- >-std::optional<FloatRect> StrokeEllipse::localBounds(const GraphicsContext& context) const >-{ >- float strokeThickness = context.strokeThickness(); >- >- FloatRect bounds = m_rect; >- bounds.expand(strokeThickness, strokeThickness); >- return bounds; >-} >- >-void StrokeEllipse::apply(GraphicsContext& context) const >-{ >- context.strokeEllipse(m_rect); >-} >- >-static TextStream& operator<<(TextStream& ts, const StrokeEllipse& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("rect", item.rect()); >- return ts; >-} >- >-void ClearRect::apply(GraphicsContext& context) const >-{ >- context.clearRect(m_rect); >-} >- >-static TextStream& operator<<(TextStream& ts, const ClearRect& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("rect", item.rect()); >- return ts; >-} >- >-void BeginTransparencyLayer::apply(GraphicsContext& context) const >-{ >- context.beginTransparencyLayer(m_opacity); >-} >- >-static TextStream& operator<<(TextStream& ts, const BeginTransparencyLayer& item) >-{ >- ts << static_cast<const DrawingItem&>(item); >- ts.dumpProperty("opacity", item.opacity()); >- return ts; >-} >- >-void EndTransparencyLayer::apply(GraphicsContext& context) const >-{ >- context.endTransparencyLayer(); >-} >- >-#if USE(CG) >-void ApplyStrokePattern::apply(GraphicsContext& context) const >-{ >- context.applyStrokePattern(); >-} >- >-void ApplyFillPattern::apply(GraphicsContext& context) const >-{ >- context.applyFillPattern(); >-} >-#endif >- >-void ApplyDeviceScaleFactor::apply(GraphicsContext& context) const >-{ >- context.applyDeviceScaleFactor(m_scaleFactor); >-} >- >-static TextStream& operator<<(TextStream& ts, const ApplyDeviceScaleFactor& item) >-{ >- ts.dumpProperty("scale-factor", item.scaleFactor()); >- return ts; >-} >- >-static TextStream& operator<<(TextStream& ts, const ItemType& type) >-{ >- switch (type) { >- case ItemType::Save: ts << "save"; break; >- case ItemType::Restore: ts << "restore"; break; >- case ItemType::Translate: ts << "translate"; break; >- case ItemType::Rotate: ts << "rotate"; break; >- case ItemType::Scale: ts << "scale"; break; >- case ItemType::ConcatenateCTM: ts << "concatentate-ctm"; break; >- case ItemType::SetState: ts << "set-state"; break; >- case ItemType::SetLineCap: ts << "set-line-cap"; break; >- case ItemType::SetLineDash: ts << "set-line-dash"; break; >- case ItemType::SetLineJoin: ts << "set-line-join"; break; >- case ItemType::SetMiterLimit: ts << "set-miter-limit"; break; >- case ItemType::Clip: ts << "clip"; break; >- case ItemType::ClipOut: ts << "clip-out"; break; >- case ItemType::ClipOutToPath: ts << "clip-out-to-path"; break; >- case ItemType::ClipPath: ts << "clip-path"; break; >- case ItemType::DrawGlyphs: ts << "draw-glyphs"; break; >- case ItemType::DrawImage: ts << "draw-image"; break; >- case ItemType::DrawTiledImage: ts << "draw-tiled-image"; break; >- case ItemType::DrawTiledScaledImage: ts << "draw-tiled-scaled-image"; break; >-#if USE(CG) || USE(CAIRO) >- case ItemType::DrawNativeImage: ts << "draw-native-image"; break; >-#endif >- case ItemType::DrawPattern: ts << "draw-pattern"; break; >- case ItemType::DrawRect: ts << "draw-rect"; break; >- case ItemType::DrawLine: ts << "draw-line"; break; >- case ItemType::DrawLinesForText: ts << "draw-lines-for-text"; break; >- case ItemType::DrawLineForDocumentMarker: ts << "draw-lines-for-document-marker"; break; >- case ItemType::DrawEllipse: ts << "draw-ellipse"; break; >- case ItemType::DrawPath: ts << "draw-path"; break; >- case ItemType::DrawFocusRingPath: ts << "draw-focus-ring-path"; break; >- case ItemType::DrawFocusRingRects: ts << "draw-focus-ring-rects"; break; >- case ItemType::FillRect: ts << "fill-rect"; break; >- case ItemType::FillRectWithColor: ts << "fill-rect-with-color"; break; >- case ItemType::FillRectWithGradient: ts << "fill-rect-with-gradient"; break; >- case ItemType::FillCompositedRect: ts << "fill-composited-rect"; break; >- case ItemType::FillRoundedRect: ts << "fill-rounded-rect"; break; >- case ItemType::FillRectWithRoundedHole: ts << "fill-rect-with-rounded-hole"; break; >- case ItemType::FillPath: ts << "fill-path"; break; >- case ItemType::FillEllipse: ts << "fill-ellipse"; break; >- case ItemType::StrokeRect: ts << "stroke-rect"; break; >- case ItemType::StrokePath: ts << "stroke-path"; break; >- case ItemType::StrokeEllipse: ts << "stroke-ellipse"; break; >- case ItemType::ClearRect: ts << "clear-rect"; break; >- case ItemType::BeginTransparencyLayer: ts << "begin-transparency-layer"; break; >- case ItemType::EndTransparencyLayer: ts << "end-transparency-layer"; break; >-#if USE(CG) >- case ItemType::ApplyStrokePattern: ts << "apply-stroke-pattern"; break; >- case ItemType::ApplyFillPattern: ts << "apply-fill-pattern"; break; >-#endif >- case ItemType::ApplyDeviceScaleFactor: ts << "apply-device-scale-factor"; break; >- case ItemType::ClearShadow: ts << "clear-shadow"; break; >- } >- return ts; >-} >- >-TextStream& operator<<(TextStream& ts, const Item& item) >-{ >- TextStream::GroupScope group(ts); >- ts << item.type(); >- >- // FIXME: Make a macro which takes a macro for all these enumeration switches >- switch (item.type()) { >- case ItemType::Save: >- ts << downcast<Save>(item); >- break; >- case ItemType::Translate: >- ts << downcast<Translate>(item); >- break; >- case ItemType::Rotate: >- ts << downcast<Rotate>(item); >- break; >- case ItemType::Scale: >- ts << downcast<Scale>(item); >- break; >- case ItemType::ConcatenateCTM: >- ts << downcast<ConcatenateCTM>(item); >- break; >- case ItemType::SetState: >- ts << downcast<SetState>(item); >- break; >- case ItemType::SetLineCap: >- ts << downcast<SetLineCap>(item); >- break; >- case ItemType::SetLineDash: >- ts << downcast<SetLineDash>(item); >- break; >- case ItemType::SetLineJoin: >- ts << downcast<SetLineJoin>(item); >- break; >- case ItemType::SetMiterLimit: >- ts << downcast<SetMiterLimit>(item); >- break; >- case ItemType::Clip: >- ts << downcast<Clip>(item); >- break; >- case ItemType::ClipOut: >- ts << downcast<ClipOut>(item); >- break; >- case ItemType::ClipOutToPath: >- ts << downcast<ClipOutToPath>(item); >- break; >- case ItemType::ClipPath: >- ts << downcast<ClipPath>(item); >- break; >- case ItemType::DrawGlyphs: >- ts << downcast<DrawGlyphs>(item); >- break; >- case ItemType::DrawImage: >- ts << downcast<DrawImage>(item); >- break; >- case ItemType::DrawTiledImage: >- ts << downcast<DrawTiledImage>(item); >- break; >- case ItemType::DrawTiledScaledImage: >- ts << downcast<DrawTiledScaledImage>(item); >- break; >-#if USE(CG) || USE(CAIRO) >- case ItemType::DrawNativeImage: >- ts << downcast<DrawNativeImage>(item); >- break; >-#endif >- case ItemType::DrawPattern: >- ts << downcast<DrawPattern>(item); >- break; >- case ItemType::DrawRect: >- ts << downcast<DrawRect>(item); >- break; >- case ItemType::DrawLine: >- ts << downcast<DrawLine>(item); >- break; >- case ItemType::DrawLinesForText: >- ts << downcast<DrawLinesForText>(item); >- break; >- case ItemType::DrawLineForDocumentMarker: >- ts << downcast<DrawLineForDocumentMarker>(item); >- break; >- case ItemType::DrawEllipse: >- ts << downcast<DrawEllipse>(item); >- break; >- case ItemType::DrawPath: >- ts << downcast<DrawPath>(item); >- break; >- case ItemType::DrawFocusRingPath: >- ts << downcast<DrawFocusRingPath>(item); >- break; >- case ItemType::DrawFocusRingRects: >- ts << downcast<DrawFocusRingRects>(item); >- break; >- case ItemType::FillRect: >- ts << downcast<FillRect>(item); >- break; >- case ItemType::FillRectWithColor: >- ts << downcast<FillRectWithColor>(item); >- break; >- case ItemType::FillRectWithGradient: >- ts << downcast<FillRectWithGradient>(item); >- break; >- case ItemType::FillCompositedRect: >- ts << downcast<FillCompositedRect>(item); >- break; >- case ItemType::FillRoundedRect: >- ts << downcast<FillRoundedRect>(item); >- break; >- case ItemType::FillRectWithRoundedHole: >- ts << downcast<FillRectWithRoundedHole>(item); >- break; >- case ItemType::FillPath: >- ts << downcast<FillPath>(item); >- break; >- case ItemType::FillEllipse: >- ts << downcast<FillEllipse>(item); >- break; >- case ItemType::StrokeRect: >- ts << downcast<StrokeRect>(item); >- break; >- case ItemType::StrokePath: >- ts << downcast<StrokePath>(item); >- break; >- case ItemType::StrokeEllipse: >- ts << downcast<StrokeEllipse>(item); >- break; >- case ItemType::ClearRect: >- ts << downcast<ClearRect>(item); >- break; >- case ItemType::BeginTransparencyLayer: >- ts << downcast<BeginTransparencyLayer>(item); >- break; >- case ItemType::ApplyDeviceScaleFactor: >- ts << downcast<ApplyDeviceScaleFactor>(item); >- break; >- >- // Items with no additional data. >- case ItemType::Restore: >- case ItemType::EndTransparencyLayer: >-#if USE(CG) >- case ItemType::ApplyStrokePattern: >- case ItemType::ApplyFillPattern: >-#endif >- case ItemType::ClearShadow: >- break; >- } >- return ts; >+ ASSERT(index < itemDescriptor(m_type).argumentsNames.size()); >+ return itemDescriptor(m_type).argumentsNames[index]; > } > > } >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h b/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h >index f00ea7e85cb1cd52469be1588d011e838473c13c..4cc185442b154ec2c5f894ee992d59a65375f4d7 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2015 Apple Inc. All rights reserved. >+ * Copyright (C) 2015-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -31,32 +31,32 @@ > #include "Font.h" > #include "GlyphBuffer.h" > #include "GraphicsContext.h" >+#include "Icon.h" > #include "Image.h" >+#include "Scrollbar.h" >+#include "Theme.h" >+#include "ThemeTypes.h" >+#include "Widget.h" > #include <wtf/RefCounted.h> > #include <wtf/TypeCasts.h> >+#include <wtf/text/TextStream.h> > > #if USE(CG) > #include "GraphicsContextPlatformPrivateCG.h" > #endif > >-namespace WTF { >-class TextStream; >-} >- > namespace WebCore { >- >-struct ImagePaintingOptions; >- > namespace DisplayList { > > enum class ItemType { >- Save, >+ Min = 0, >+ Save = Min, > Restore, >+ SetState, > Translate, > Rotate, > Scale, > ConcatenateCTM, >- SetState, > SetLineCap, > SetLineDash, > SetLineJoin, >@@ -66,13 +66,19 @@ enum class ItemType { > ClipOut, > ClipOutToPath, > ClipPath, >+ ClipToImageBuffer, >+ ApplyStrokePattern, >+ ApplyFillPattern, >+ ApplyDeviceScaleFactor, >+ >+ BeginTransparencyLayer, >+ EndTransparencyLayer, > DrawGlyphs, > DrawImage, > DrawTiledImage, > DrawTiledScaledImage, >-#if USE(CG) || USE(CAIRO) > DrawNativeImage, >-#endif >+ DrawNativeScaledImage, > DrawPattern, > DrawRect, > DrawLine, >@@ -82,6 +88,10 @@ enum class ItemType { > DrawPath, > DrawFocusRingPath, > DrawFocusRingRects, >+ DrawIcon, >+ DrawWidget, >+ DrawScrollbar, >+ DrawTheme, > FillRect, > FillRectWithColor, > FillRectWithGradient, >@@ -94,1295 +104,966 @@ enum class ItemType { > StrokePath, > StrokeEllipse, > ClearRect, >- BeginTransparencyLayer, >- EndTransparencyLayer, >-#if USE(CG) >- ApplyStrokePattern, // FIXME: should not be a recorded item. >- ApplyFillPattern, // FIXME: should not be a recorded item. >-#endif >- ApplyDeviceScaleFactor, >+ Max > }; > > class Item : public RefCounted<Item> { > public: >- Item() = delete; >- >- Item(ItemType type) >- : m_type(type) >- { >- } >- > virtual ~Item() = default; > >- ItemType type() const >- { >- return m_type; >- } >- > virtual void apply(GraphicsContext&) const = 0; > >- static constexpr bool isDisplayListItem = true; >+ virtual bool isGeometryItem() const { return false; } >+ virtual size_t sizeInBytes() const = 0; > >- virtual bool isDrawingItem() const { return false; } >- >- // A state item is one preserved by Save/Restore. >- bool isStateItem() const >+ virtual void dump(WTF::TextStream& ts) const > { >- return isStateItemType(m_type); >+ ts << name(); > } > >- static bool isStateItemType(ItemType itemType) >+ ItemType type() const { return m_type; } >+ WTF::CString dump() const; >+ >+protected: >+ Item(ItemType type) >+ : m_type(type) > { >- 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: >- return true; >- default: >- return false; >- } >- return false; > } > >-#if !defined(NDEBUG) || !LOG_DISABLED >- WTF::CString description() const; >-#endif >- static size_t sizeInBytes(const Item&); >+ String name() const; >+ String argumentName(size_t index) const; > >-private: > ItemType m_type; > }; > >-class DrawingItem : public Item { >+class GeometryItem : public Item { > public: >- DrawingItem(ItemType type) >- : Item(type) >- { >- } >- >- void setExtent(const FloatRect& r) { m_extent = r; } >- const FloatRect& extent() const { return m_extent.value(); } >- > bool extentKnown() const { return static_cast<bool>(m_extent); } > >- // Return bounds of this drawing operation in local coordinates. >- // Does not include effets of transform, shadow etc in the state. >- virtual std::optional<FloatRect> localBounds(const GraphicsContext&) const { return std::nullopt; } >- >-private: >- bool isDrawingItem() const override { return true; } >- >- std::optional<FloatRect> m_extent; // In base coordinates, taking shadows and transforms into account. >-}; >- >-class Save : public Item { >-public: >- static Ref<Save> create() >+ void setExtent(const FloatRect& extent) { m_extent = extent; } >+ const FloatRect extent() const > { >- return adoptRef(*new Save); >+ return m_extent.value_or(FloatRect()); > } > >- // 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; } >- >-private: >- Save() >- : Item(ItemType::Save) >- { >- } >- >- void apply(GraphicsContext&) const override; >+ virtual const std::optional<FloatRect> localBounds(const GraphicsContext&) const { return std::nullopt; } > >- size_t m_restoreIndex { 0 }; >-}; >- >-class Restore : public Item { >-public: >- static Ref<Restore> create() >+protected: >+ GeometryItem(ItemType type) >+ : Item(type) > { >- return adoptRef(*new Restore); > } > >-private: >- Restore() >- : Item(ItemType::Restore) >+ void dump(WTF::TextStream& ts) const override > { >+ Item::dump(ts); >+ ts.startGroup(); >+ ts << "extent "; >+ if (extentKnown()) >+ ts << extent(); >+ else >+ ts << "unknown"; >+ ts.endGroup(); > } > >- void apply(GraphicsContext&) const override; >+ std::optional<FloatRect> m_extent; > }; > >-class Translate : public Item { >-public: >- static Ref<Translate> create(float x, float y) >+template <typename Applier, Applier applier, class... Arguments> >+class GraphicsItem { >+protected: >+ GraphicsItem(Arguments... arguments) >+ : m_arguments(std::forward<Arguments>(arguments)...) > { >- return adoptRef(*new Translate(x, y)); > } > >- float x() const { return m_x; } >- float y() const { return m_y; } >- >-private: >- Translate(float x, float y) >- : Item(ItemType::Translate) >- , m_x(x) >- , m_y(y) >+ template< std::size_t I> >+ const auto& argument() const > { >+ return std::get<I>(m_arguments); > } > >- void apply(GraphicsContext&) const override; >- >- float m_x; >- float m_y; >-}; >- >-class Rotate : public Item { >-public: >- static Ref<Rotate> create(float angleInRadians) >+ void apply(GraphicsContext& context) const > { >- return adoptRef(*new Rotate(angleInRadians)); >+ apply(context, std::index_sequence_for<Arguments...>()); > } > >- float angle() const { return m_angle; } >- >-private: >- Rotate(float angle) >- : Item(ItemType::Rotate) >- , m_angle(angle) >+ template <typename Functor> >+ void iterarte(Functor&& functor) const > { >+ iterarte(WTFMove(functor), std::index_sequence_for<Arguments...>()); > } > >- void apply(GraphicsContext&) const override; >- >- float m_angle; // In radians. >-}; >- >-class Scale : public Item { >-public: >- static Ref<Scale> create(const FloatSize& size) >+private: >+ template<std::size_t... Indices> >+ void apply(GraphicsContext& context, std::index_sequence<Indices...>) const > { >- return adoptRef(*new Scale(size)); >+ (context.*applier)(std::get<Indices>(m_arguments)...); > } > >- const FloatSize& amount() const { return m_size; } >- >-private: >- Scale(const FloatSize& size) >- : Item(ItemType::Scale) >- , m_size(size) >+ template<typename Functor, std::size_t... Indices> >+ void iterarte(Functor&& functor, std::index_sequence<Indices...>) const > { >+ using swallow = int[]; >+ (void)swallow { 1, (functor(Indices, std::get<Indices>(m_arguments)), int { })... }; > } > >- void apply(GraphicsContext&) const override; >- >- FloatSize m_size; >+ std::tuple<Arguments...> m_arguments; > }; > >-class ConcatenateCTM : public Item { >+template <ItemType itemType, typename Applier, Applier applier, class... Arguments> >+class SettingItem : public Item, public GraphicsItem<Applier, applier, Arguments...> { > public: >- static Ref<ConcatenateCTM> create(const AffineTransform& matrix) >+ static Ref<Item> create(Arguments... arguments) > { >- return adoptRef(*new ConcatenateCTM(matrix)); >+ return adoptRef(*new SettingItem(arguments...)); > } > >- const AffineTransform& transform() const { return m_transform; } >- >-private: >- ConcatenateCTM(const AffineTransform&); >- >- void apply(GraphicsContext&) const override; >- >- AffineTransform m_transform; >-}; >- >-class SetState : public Item { >-public: >- static Ref<SetState> create(const GraphicsContextState& state, GraphicsContextState::StateChangeFlags flags) >+ template<typename T> >+ static Ref<Item> create(Arguments... arguments) > { >- return adoptRef(*new SetState(state, flags)); >+ static_assert(std::is_base_of<Self, T>::value, "This function should create classes from SettingItem."); >+ return adoptRef(*new T(std::forward<Arguments>(arguments)...)); > } >- >- const GraphicsContextStateChange& state() const { return m_state; } >- >- void accumulate(const GraphicsContextState&, GraphicsContextState::StateChangeFlags); > >- void accumulate(GraphicsContextState&) const; >+ using GraphicsItemBase = GraphicsItem<Applier, applier, Arguments...>; > >- static void applyState(GraphicsContext&, const GraphicsContextState&, GraphicsContextState::StateChangeFlags); >- >- static void dumpStateChanges(WTF::TextStream&, const GraphicsContextState&, GraphicsContextState::StateChangeFlags); >-private: >- SetState(const GraphicsContextState& state, GraphicsContextState::StateChangeFlags flags) >- : Item(ItemType::SetState) >- , m_state(state, flags) >+ SettingItem(Arguments... arguments) >+ : Item(itemType) >+ , GraphicsItemBase(std::forward<Arguments>(arguments)...) > { > } > >- void apply(GraphicsContext&) const override; >- >- GraphicsContextStateChange m_state; >-}; >- >-class SetLineCap : public Item { >-public: >- static Ref<SetLineCap> create(LineCap lineCap) >+ void dump(WTF::TextStream& ts) const override > { >- return adoptRef(*new SetLineCap(lineCap)); >+ Item::dump(ts); >+ GraphicsItemBase::iterarte([this, &ts](size_t index, const auto& argumentValue) { >+ ts.dumpProperty(this->argumentName(index), argumentValue); >+ }); > } >- >- LineCap lineCap() const { return m_lineCap; } > > private: >- SetLineCap(LineCap lineCap) >- : Item(ItemType::SetLineCap) >- , m_lineCap(lineCap) >+ using Self = SettingItem<itemType, Applier, applier, Arguments...>; >+ >+ void apply(GraphicsContext& context) const override > { >+ GraphicsItemBase::apply(context); > } > >- void apply(GraphicsContext&) const override; >- >- LineCap m_lineCap; >+ size_t sizeInBytes() const override { return sizeof(*this); } > }; > >-class SetLineDash : public Item { >+template <ItemType itemType, typename Applier, Applier applier, class... Arguments> >+class DrawingItem : public GeometryItem, public GraphicsItem<Applier, applier, Arguments...> { > public: >- static Ref<SetLineDash> create(const DashArray& dashArray, float dashOffset) >+ static Ref<Item> create(Arguments... arguments) > { >- return adoptRef(*new SetLineDash(dashArray, dashOffset)); >+ return adoptRef(*new DrawingItem(std::forward<Arguments>(arguments)...)); > } > >- const DashArray& dashArray() const { return m_dashArray; } >- float dashOffset() const { return m_dashOffset; } >- >-private: >- SetLineDash(const DashArray& dashArray, float dashOffset) >- : Item(ItemType::SetLineDash) >- , m_dashArray(dashArray) >- , m_dashOffset(dashOffset) >+ template<typename T> >+ static Ref<Item> create(Arguments... arguments) > { >+ static_assert(std::is_base_of<Self, T>::value, "This function should create classes from DrawingItem."); >+ return adoptRef(*new T(std::forward<Arguments>(arguments)...)); > } > >- void apply(GraphicsContext&) const override; >+ using GraphicsItemBase = GraphicsItem<Applier, applier, Arguments...>; > >- DashArray m_dashArray; >- float m_dashOffset; >-}; >+ // Should match RenderTheme::platformFocusRingWidth() >+ constexpr static float const s_platformFocusRingWidth = 3; > >-class SetLineJoin : public Item { >-public: >- static Ref<SetLineJoin> create(LineJoin lineJoin) >+ DrawingItem(Arguments... arguments) >+ : GeometryItem(itemType) >+ , GraphicsItemBase(std::forward<Arguments>(arguments)...) > { >- return adoptRef(*new SetLineJoin(lineJoin)); > } >- >- LineJoin lineJoin() const { return m_lineJoin; } > > private: >- SetLineJoin(LineJoin lineJoin) >- : Item(ItemType::SetLineJoin) >- , m_lineJoin(lineJoin) >- { >- } >- >- void apply(GraphicsContext&) const override; >- >- LineJoin m_lineJoin; >-}; >+ using Self = DrawingItem<itemType, Applier, applier, Arguments...>; > >-class SetMiterLimit : public Item { >-public: >- static Ref<SetMiterLimit> create(float limit) >+ void apply(GraphicsContext& context) const override > { >- return adoptRef(*new SetMiterLimit(limit)); >+ GraphicsItemBase::apply(context); > } > >- float miterLimit() const { return m_miterLimit; } >+ bool isGeometryItem() const override { return true; } >+ size_t sizeInBytes() const override { return sizeof(*this); } > >-private: >- SetMiterLimit(float miterLimit) >- : Item(ItemType::SetMiterLimit) >- , m_miterLimit(miterLimit) >+ void dump(WTF::TextStream& ts) const override > { >+ GeometryItem::dump(ts); >+ GraphicsItemBase::iterarte([this, &ts](size_t index, const auto& argumentValue) { >+ ts.dumpProperty(this->argumentName(index), argumentValue); >+ }); > } >- >- void apply(GraphicsContext&) const override; >- >- float m_miterLimit; > }; > >-class ClearShadow : public Item { >-public: >- static Ref<ClearShadow> create() >- { >- return adoptRef(*new ClearShadow); >- } >- >-private: >- ClearShadow() >- : Item(ItemType::ClearShadow) >- { >- } >- >- void apply(GraphicsContext&) const override; >-}; >+using SaveBase = SettingItem< >+ ItemType::Save, >+ void (GraphicsContext::*)(), >+ &GraphicsContext::save >+>; > >-// FIXME: treat as DrawingItem? >-class Clip : public Item { >+class Save : public SaveBase { > public: >- static Ref<Clip> create(const FloatRect& rect) >- { >- return adoptRef(*new Clip(rect)); >- } >+ constexpr static auto create = SaveBase::create<Save>; > >- FloatRect rect() const { return m_rect; } >+ // 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; } > > private: >- Clip(const FloatRect& rect) >- : Item(ItemType::Clip) >- , m_rect(rect) >- { >- } >+ using SaveBase::SaveBase; > >- void apply(GraphicsContext&) const override; >- >- FloatRect m_rect; >-}; >- >-class ClipOut : public Item { >-public: >- static Ref<ClipOut> create(const FloatRect& rect) >+ void dump(WTF::TextStream& ts) const override > { >- return adoptRef(*new ClipOut(rect)); >+ SaveBase::dump(ts); >+ ts.dumpProperty("restore-index", m_restoreIndex); > } > >- FloatRect rect() const { return m_rect; } >- >-private: >- ClipOut(const FloatRect& rect) >- : Item(ItemType::ClipOut) >- , m_rect(rect) >- { >- } >+ size_t m_restoreIndex { 0 }; >+}; > >- void apply(GraphicsContext&) const override; >+using Restore = SettingItem< >+ ItemType::Restore, >+ void (GraphicsContext::*)(), >+ &GraphicsContext::restore >+>; > >- FloatRect m_rect; >-}; >+using SetStateBase = SettingItem< >+ ItemType::SetState, >+ void (GraphicsContext::*)(const GraphicsContextStateChange&), >+ &GraphicsContext::applyStateChange, >+ GraphicsContextStateChange >+>; > >-class ClipOutToPath : public Item { >+class SetState : public SetStateBase { > public: >- static Ref<ClipOutToPath> create(const Path& path) >- { >- return adoptRef(*new ClipOutToPath(path)); >- } >+ constexpr static auto create = SetStateBase::create<SetState>; >+ using SetStateBase::SetStateBase; >+ const GraphicsContextStateChange& state() const { return argument<0>(); } >+}; > >- const Path& path() const { return m_path; } >+using Translate = SettingItem< >+ ItemType::Translate, >+ void (GraphicsContext::*)(float, float), >+ &GraphicsContext::translate, >+ float, float >+>; >+ >+using Rotate = SettingItem< >+ ItemType::Rotate, >+ void (GraphicsContext::*)(float), >+ &GraphicsContext::rotate, >+ float >+>; >+ >+using Scale = SettingItem< >+ ItemType::Scale, >+ void (GraphicsContext::*)(const FloatSize&), >+ &GraphicsContext::scale, >+ FloatSize >+>; >+ >+using ConcatenateCTM = SettingItem< >+ ItemType::ConcatenateCTM, >+ void (GraphicsContext::*)(const AffineTransform&), >+ &GraphicsContext::concatCTM, >+ AffineTransform >+>; >+ >+using SetLineCap = SettingItem< >+ ItemType::SetLineCap, >+ void (GraphicsContext::*)(LineCap), >+ &GraphicsContext::setLineCap, >+ LineCap >+>; >+ >+using SetLineDash = SettingItem< >+ ItemType::SetLineDash, >+ void (GraphicsContext::*)(const DashArray&, float), >+ &GraphicsContext::setLineDash, >+ DashArray, float >+>; >+ >+using SetLineJoin = SettingItem< >+ ItemType::SetLineJoin, >+ void (GraphicsContext::*)(LineJoin), >+ &GraphicsContext::setLineJoin, >+ LineJoin >+>; >+ >+using SetMiterLimit = SettingItem< >+ ItemType::SetMiterLimit, >+ void (GraphicsContext::*)(float), >+ &GraphicsContext::setMiterLimit, >+ float >+>; >+ >+using ClearShadow = SettingItem< >+ ItemType::ClearShadow, >+ void (GraphicsContext::*)(), >+ &GraphicsContext::clearShadow >+>; >+ >+using Clip = SettingItem< >+ ItemType::Clip, >+ void (GraphicsContext::*)(const FloatRect&), >+ &GraphicsContext::clip, >+ FloatRect >+>; >+ >+using ClipOut = SettingItem< >+ ItemType::ClipOut, >+ void (GraphicsContext::*)(const FloatRect&), >+ &GraphicsContext::clipOut, >+ FloatRect >+>; >+ >+using ClipOutToPath = SettingItem< >+ ItemType::ClipOutToPath, >+ void (GraphicsContext::*)(const Path&), >+ &GraphicsContext::clipOut, >+ const Path >+>; >+ >+using ClipPath = SettingItem< >+ ItemType::ClipPath, >+ void (GraphicsContext::*)(const Path&, WindRule), >+ &GraphicsContext::clipPath, >+ const Path, WindRule >+>; >+ >+using ClipToImageBuffer = SettingItem< >+ ItemType::ClipToImageBuffer, >+ void (GraphicsContext::*)(const NativeImagePtr&, const FloatRect&, const FloatSize&), >+ &GraphicsContext::clipToImageBuffer, >+ NativeImagePtr, FloatRect, FloatSize >+>; > >-private: >- ClipOutToPath(const Path& path) >- : Item(ItemType::ClipOutToPath) >- , m_path(path) >- { >- } >- >- void apply(GraphicsContext&) const override; >+#if USE(CG) >+using ApplyStrokePattern = SettingItem< >+ ItemType::ApplyStrokePattern, >+ void (GraphicsContext::*)(), >+ &GraphicsContext::applyStrokePattern >+>; >+ >+using ApplyFillPattern = SettingItem< >+ ItemType::ApplyFillPattern, >+ void (GraphicsContext::*)(), >+ &GraphicsContext::applyFillPattern >+>; >+#endif > >- const Path m_path; >-}; >+using ApplyDeviceScaleFactor = SettingItem< >+ ItemType::ApplyDeviceScaleFactor, >+ void (GraphicsContext::*)(float), >+ &GraphicsContext::applyDeviceScaleFactor, >+ float >+>; > >-class ClipPath : public Item { >+// Is DrawingItem because the size of the transparency layer is implicitly the clip bounds. >+using BeginTransparencyLayer = DrawingItem< >+ ItemType::BeginTransparencyLayer, >+ void (GraphicsContext::*)(float), >+ &GraphicsContext::beginTransparencyLayer, >+ float >+>; >+ >+using EndTransparencyLayer = DrawingItem< >+ ItemType::EndTransparencyLayer, >+ void (GraphicsContext::*)(), >+ &GraphicsContext::endTransparencyLayer >+>; >+ >+using DrawGlyphsBase = DrawingItem< >+ ItemType::DrawGlyphs, >+ void (GraphicsContext::*)(const Font&, const GlyphBuffer&, unsigned, unsigned, const FloatPoint&, FontSmoothingMode), >+ &GraphicsContext::drawGlyphs, >+ Ref<const Font>, GlyphBuffer, unsigned, unsigned, FloatPoint, FontSmoothingMode >+>; >+ >+class DrawGlyphs : public DrawGlyphsBase { > public: >- static Ref<ClipPath> create(const Path& path, WindRule windRule) >+ static Ref<Item> create(Ref<const Font>&& font, const GlyphBuffer& buffer, unsigned from, unsigned numGlyphs, const FloatPoint& point, FontSmoothingMode fontSmoothing) > { >- return adoptRef(*new ClipPath(path, windRule)); >+ auto subGlyphBuffer = DrawGlyphs::subGlyphBuffer(font.ptr(), buffer, from, numGlyphs); >+ return DrawGlyphsBase::create(WTFMove(font), WTFMove(subGlyphBuffer), 0, numGlyphs, point, fontSmoothing); > } > >- const Path& path() const { return m_path; } >- WindRule windRule() const { return m_windRule; } >- > private: >- ClipPath(const Path& path, WindRule windRule) >- : Item(ItemType::ClipPath) >- , m_path(path) >- , m_windRule(windRule) >- { >- } >- >- void apply(GraphicsContext&) const override; >+ using DrawGlyphsBase::DrawGlyphsBase; > >- const Path m_path; >- WindRule m_windRule; >-}; >- >-class DrawGlyphs : public DrawingItem { >-public: >- static Ref<DrawGlyphs> create(const Font& font, const GlyphBufferGlyph* glyphs, const GlyphBufferAdvance* advances, unsigned count, const FloatPoint& blockLocation, const FloatSize& localAnchor, FontSmoothingMode smoothingMode) >+ static GlyphBuffer subGlyphBuffer(const Font* font, const GlyphBuffer& buffer, unsigned from, unsigned numGlyphs) > { >- return adoptRef(*new DrawGlyphs(font, glyphs, advances, count, blockLocation, localAnchor, smoothingMode)); >+ GlyphBuffer subBuffer; >+ const auto* glyphs = buffer.glyphs(from); >+ const auto* advances = buffer.advances(from); >+ for (size_t i = 0; i < numGlyphs; ++i) >+ subBuffer.add(glyphs[i], font, advances[i]); >+ return subBuffer; > } > >- const FloatPoint& blockLocation() const { return m_blockLocation; } >- void setBlockLocation(const FloatPoint& blockLocation) { m_blockLocation = blockLocation; } >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override >+ { >+ const auto& font = argument<0>(); >+ float ascent = font->fontMetrics().floatAscent(); >+ float descent = font->fontMetrics().floatDescent(); > >- const FloatSize& localAnchor() const { return m_localAnchor; } >+ const auto& glyphBuffer = argument<1>(); >+ size_t numGlyphs = glyphBuffer.size(); >+ auto current = argument<4>(); > >- FloatPoint anchorPoint() const { return m_blockLocation + m_localAnchor; } >+ FloatRect bounds; >+ for (size_t i = 0; i < numGlyphs; ++i) { >+ GlyphBufferAdvance advance = glyphBuffer.advanceAt(i); >+ FloatRect glyphRect = FloatRect(current.x(), current.y() - ascent, advance.width(), ascent + descent); >+ bounds.unite(glyphRect); >+ current.move(advance.width(), advance.height()); >+ } >+ return bounds; >+ } >+}; > >- const Vector<GlyphBufferGlyph, 128>& glyphs() const { return m_glyphs; } >+using DrawImageBase = DrawingItem< >+ ItemType::DrawImage, >+ ImageDrawResult (GraphicsContext::*)(Image&, const FloatRect&, const FloatRect&, const ImagePaintingOptions&), >+ &GraphicsContext::drawImage, >+ Ref<Image>, FloatRect, FloatRect, ImagePaintingOptions >+>; > >+class DrawImage : public DrawImageBase { >+public: >+ constexpr static auto create = DrawImageBase::create<DrawImage>; >+ using DrawImageBase::DrawImageBase; > private: >- DrawGlyphs(const Font&, const GlyphBufferGlyph*, const GlyphBufferAdvance*, unsigned count, const FloatPoint& blockLocation, const FloatSize& localAnchor, FontSmoothingMode); >- >- void computeBounds(); >- >- void apply(GraphicsContext&) const override; >- >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >- >- GlyphBuffer generateGlyphBuffer() const; >- >- Ref<Font> m_font; >- Vector<GlyphBufferGlyph, 128> m_glyphs; >- Vector<GlyphBufferAdvance, 128> m_advances; >- FloatRect m_bounds; >- FloatPoint m_blockLocation; >- FloatSize m_localAnchor; >- FontSmoothingMode m_smoothingMode; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<1>(); } > }; > >-class DrawImage : public DrawingItem { >-public: >- static Ref<DrawImage> create(Image& image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& imagePaintingOptions) >- { >- return adoptRef(*new DrawImage(image, destination, source, imagePaintingOptions)); >- } >- >- const Image& image() const { return m_image.get(); } >- FloatRect source() const { return m_source; } >- FloatRect destination() const { return m_destination; } >+using DrawTiledImageBase = DrawingItem< >+ ItemType::DrawTiledImage, >+ ImageDrawResult (GraphicsContext::*)(Image&, const FloatRect&, const FloatPoint&, const FloatSize&, const FloatSize&, const ImagePaintingOptions&), >+ &GraphicsContext::drawTiledImage, >+ Ref<Image>, FloatRect, FloatPoint, FloatSize, FloatSize, ImagePaintingOptions >+>; > >+class DrawTiledImage : public DrawTiledImageBase { >+public: >+ constexpr static auto create = DrawTiledImageBase::create<DrawTiledImage>; >+ using DrawTiledImageBase::DrawTiledImageBase; > private: >- DrawImage(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&); >- >- void apply(GraphicsContext&) const override; >- >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_destination; } >- >- mutable Ref<Image> m_image; // FIXME: Drawing images can cause their animations to progress. This shouldn't have to be mutable. >- FloatRect m_destination; >- FloatRect m_source; >- ImagePaintingOptions m_imagePaintingOptions; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<1>(); } > }; > >-class DrawTiledImage : public DrawingItem { >-public: >- static Ref<DrawTiledImage> create(Image& image, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& imagePaintingOptions) >- { >- return adoptRef(*new DrawTiledImage(image, destination, source, tileSize, spacing, imagePaintingOptions)); >- } >- >- const Image& image() const { return m_image.get(); } >- FloatPoint source() const { return m_source; } >- FloatRect destination() const { return m_destination; } >- >- FloatSize tileSize() const { return m_tileSize; } >- FloatSize spacing() const { return m_spacing; } >+using DrawTiledScaledImageBase = DrawingItem< >+ ItemType::DrawTiledScaledImage, >+ ImageDrawResult (GraphicsContext::*)(Image&, const FloatRect&, const FloatRect&, const FloatSize&, Image::TileRule, Image::TileRule, const ImagePaintingOptions&), >+ &GraphicsContext::drawTiledImage, >+ Ref<Image>, FloatRect, FloatRect, FloatSize, Image::TileRule, Image::TileRule, ImagePaintingOptions >+>; > >+class DrawTiledScaledImage : public DrawTiledScaledImageBase { >+public: >+ constexpr static auto create = DrawTiledScaledImageBase::create<DrawTiledScaledImage>; >+ using DrawTiledScaledImageBase::DrawTiledScaledImageBase; > private: >- DrawTiledImage(Image&, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions&); >- >- void apply(GraphicsContext&) const override; >- >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_destination; } >- >- mutable Ref<Image> m_image; // FIXME: Drawing images can cause their animations to progress. This shouldn't have to be mutable. >- FloatRect m_destination; >- FloatPoint m_source; >- FloatSize m_tileSize; >- FloatSize m_spacing; >- ImagePaintingOptions m_imagePaintingOptions; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<1>(); } > }; > >-class DrawTiledScaledImage : public DrawingItem { >-public: >- static Ref<DrawTiledScaledImage> create(Image& image, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions& imagePaintingOptions) >- { >- return adoptRef(*new DrawTiledScaledImage(image, destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions)); >- } >- >- const Image& image() const { return m_image.get(); } >- FloatRect source() const { return m_source; } >- FloatRect destination() const { return m_destination; } >+#if USE(CG) || USE(DIRECT2D) || USE(CAIRO) >+using DrawNativeImageBase = DrawingItem< >+ ItemType::DrawNativeImage, >+ void (GraphicsContext::*)(const NativeImagePtr&, const FloatSize&, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode, ImageOrientation), >+ &GraphicsContext::drawNativeImage, >+ NativeImagePtr, FloatSize, FloatRect, FloatRect, CompositeOperator, BlendMode, ImageOrientation >+>; > >+class DrawNativeImage : public DrawNativeImageBase { >+public: >+ constexpr static auto create = DrawNativeImageBase::create<DrawNativeImage>; >+ using DrawNativeImageBase::DrawNativeImageBase; > private: >- DrawTiledScaledImage(Image&, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions&); >- >- void apply(GraphicsContext&) const override; >- >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_destination; } >- >- mutable Ref<Image> m_image; // FIXME: Drawing images can cause their animations to progress. This shouldn't have to be mutable. >- FloatRect m_destination; >- FloatRect m_source; >- FloatSize m_tileScaleFactor; >- Image::TileRule m_hRule; >- Image::TileRule m_vRule; >- ImagePaintingOptions m_imagePaintingOptions; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<2>(); } > }; > >-#if USE(CG) || USE(CAIRO) >-class DrawNativeImage : public DrawingItem { >-public: >- static Ref<DrawNativeImage> create(const NativeImagePtr& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode, ImageOrientation orientation) >- { >- return adoptRef(*new DrawNativeImage(image, imageSize, destRect, srcRect, op, blendMode, orientation)); >- } >- >- FloatRect source() const { return m_srcRect; } >- FloatRect destination() const { return m_destination; } >+using DrawNativeScaledImageBase = DrawingItem< >+ ItemType::DrawNativeScaledImage, >+ void (GraphicsContext::*)(const NativeImagePtr&, float, const IntPoint&, const IntRect&), >+ &GraphicsContext::drawNativeScaledImage, >+ NativeImagePtr, float, IntPoint, IntRect >+>; > >+class DrawNativeScaledImage : public DrawNativeScaledImageBase { >+public: >+ constexpr static auto create = DrawNativeScaledImageBase::create<DrawNativeScaledImage>; >+ using DrawNativeScaledImageBase::DrawNativeScaledImageBase; > private: >- DrawNativeImage(const NativeImagePtr&, const FloatSize& selfSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator, BlendMode, ImageOrientation); >- >- void apply(GraphicsContext&) const override; >- >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_destination; } >- >-#if USE(CG) >- RetainPtr<CGImageRef> m_image; >-#endif >- FloatSize m_imageSize; >- FloatRect m_destination; >- FloatRect m_srcRect; >-#if USE(CG) >- CompositeOperator m_op; >- BlendMode m_blendMode; >-#endif >- ImageOrientation m_orientation; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return FloatRect(argument<3>()); } > }; > #endif > >-class DrawPattern : public DrawingItem { >-public: >- static Ref<DrawPattern> create(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator op, BlendMode blendMode) >- { >- return adoptRef(*new DrawPattern(image, destRect, tileRect, patternTransform, phase, spacing, op, blendMode)); >- } >- >- const Image& image() const { return m_image.get(); } >- const AffineTransform& patternTransform() const { return m_patternTransform; } >- FloatRect tileRect() const { return m_tileRect; } >- FloatRect destRect() const { return m_destination; } >- FloatPoint phase() const { return m_phase; } >- FloatSize spacing() const { return m_spacing; } >+using DrawPatternBase = DrawingItem< >+ ItemType::DrawPattern, >+ void (GraphicsContext::*)(Image&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, const FloatSize&, CompositeOperator, BlendMode), >+ &GraphicsContext::drawPattern, >+ Ref<Image>, FloatRect, FloatRect, AffineTransform, FloatPoint, FloatSize, CompositeOperator, BlendMode >+>; > >-private: >- DrawPattern(Image&, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator, BlendMode = BlendModeNormal); >- >- void apply(GraphicsContext&) const override; >- >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_destination; } >- >- mutable Ref<Image> m_image; // FIXME: Drawing images can cause their animations to progress. This shouldn't have to be mutable. >- AffineTransform m_patternTransform; >- FloatRect m_tileRect; >- FloatRect m_destination; >- FloatPoint m_phase; >- FloatSize m_spacing; >- CompositeOperator m_op; >- BlendMode m_blendMode; >-}; >- >-// Is DrawingItem because the size of the transparency layer is implicitly the clip bounds. >-class BeginTransparencyLayer : public DrawingItem { >+class DrawPattern : public DrawPatternBase { > public: >- static Ref<BeginTransparencyLayer> create(float opacity) >- { >- return adoptRef(*new BeginTransparencyLayer(opacity)); >- } >- >- float opacity() const { return m_opacity; } >- >+ constexpr static auto create = DrawPatternBase::create<DrawPattern>; >+ using DrawPatternBase::DrawPatternBase; > private: >- BeginTransparencyLayer(float opacity) >- : DrawingItem(ItemType::BeginTransparencyLayer) >- , m_opacity(opacity) >- { >- } >- >- void apply(GraphicsContext&) const override; >- >- float m_opacity; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<1>(); } > }; > >-class EndTransparencyLayer : public DrawingItem { >-public: >- static Ref<EndTransparencyLayer> create() >- { >- return adoptRef(*new EndTransparencyLayer); >- } >+using DrawRectBase = DrawingItem< >+ ItemType::DrawRect, >+ void (GraphicsContext::*)(const FloatRect&, float), >+ &GraphicsContext::drawRect, >+ FloatRect, float >+>; > >+class DrawRect : public DrawRectBase { >+public: >+ constexpr static auto create = DrawRectBase::create<DrawRect>; >+ using DrawRectBase::DrawRectBase; > private: >- EndTransparencyLayer() >- : DrawingItem(ItemType::EndTransparencyLayer) >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override > { >+ FloatRect rect = argument<0>(); >+ float borderThickness = argument<1>(); >+ rect.inflate(borderThickness / 2); >+ return rect; > } >- >- void apply(GraphicsContext&) const override; > }; > >-class DrawRect : public DrawingItem { >-public: >- static Ref<DrawRect> create(const FloatRect& rect, float borderThickness) >- { >- return adoptRef(*new DrawRect(rect, borderThickness)); >- } >- >- FloatRect rect() const { return m_rect; } >- float borderThickness() const { return m_borderThickness; } >+using DrawLineBase = DrawingItem< >+ ItemType::DrawLine, >+ void (GraphicsContext::*)(const FloatPoint&, const FloatPoint&), >+ &GraphicsContext::drawLine, >+ FloatPoint, FloatPoint >+>; > >+class DrawLine : public DrawLineBase { >+public: >+ constexpr static auto create = DrawLineBase::create<DrawLine>; >+ using DrawLineBase::DrawLineBase; > private: >- DrawRect(const FloatRect& rect, float borderThickness) >- : DrawingItem(ItemType::DrawRect) >- , m_rect(rect) >- , m_borderThickness(borderThickness) >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override > { >+ FloatRect bounds; >+ bounds.fitToPoints(argument<0>(), argument<1>()); >+ return bounds; > } >- >- void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >- >- FloatRect m_rect; >- float m_borderThickness; > }; > >-class DrawLine : public DrawingItem { >-public: >- static Ref<DrawLine> create(const FloatPoint& point1, const FloatPoint& point2) >- { >- return adoptRef(*new DrawLine(point1, point2)); >- } >- >- FloatPoint point1() const { return m_point1; } >- FloatPoint point2() const { return m_point2; } >+using DrawLinesForTextBase = DrawingItem< >+ ItemType::DrawLinesForText, >+ void (GraphicsContext::*)(const FloatPoint&, const DashArray&, bool, bool, StrokeStyle), >+ &GraphicsContext::drawLinesForText, >+ FloatPoint, DashArray, bool, bool, StrokeStyle >+>; > >+class DrawLinesForText : public DrawLinesForTextBase { >+public: >+ constexpr static auto create = DrawLinesForTextBase::create<DrawLinesForText>; >+ using DrawLinesForTextBase::DrawLinesForTextBase; > private: >- DrawLine(const FloatPoint& point1, const FloatPoint& point2) >- : DrawingItem(ItemType::DrawLine) >- , m_point1(point1) >- , m_point2(point2) >+ const std::optional<FloatRect> localBounds(const GraphicsContext& context) const override > { >+ // This function needs to return a value equal to or enclosing what GraphicsContext::computeLineBoundsAndAntialiasingModeForText() returns. >+ if (!argument<1>().size()) >+ return FloatRect(); >+ FloatRect bounds(argument<0>(), FloatSize(argument<1>().last(), context.strokeThickness())); >+ bounds.inflate(1); // Account for pixel snapping. FIXME: This isn't perfect, as it doesn't take the CTM into account. >+ return bounds; > } >- >- void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >- >- FloatPoint m_point1; >- FloatPoint m_point2; > }; > >-class DrawLinesForText : public DrawingItem { >-public: >- static Ref<DrawLinesForText> create(const FloatPoint& blockLocation, const FloatSize& localAnchor, const DashArray& widths, bool printing, bool doubleLines, float strokeWidth) >- { >- return adoptRef(*new DrawLinesForText(blockLocation, localAnchor, widths, printing, doubleLines, strokeWidth)); >- } >- >- void setBlockLocation(const FloatPoint& blockLocation) { m_blockLocation = blockLocation; } >- const FloatPoint& blockLocation() const { return m_blockLocation; } >- const FloatSize& localAnchor() const { return m_localAnchor; } >- FloatPoint point() const { return m_blockLocation + m_localAnchor; } >- const DashArray& widths() const { return m_widths; } >- bool isPrinting() const { return m_printing; } >- bool doubleLines() const { return m_doubleLines; } >+using DrawLineForDocumentMarkerBase = DrawingItem< >+ ItemType::DrawLineForDocumentMarker, >+ void (GraphicsContext::*)(const FloatPoint&, float, DocumentMarkerLineStyle), >+ &GraphicsContext::drawLineForDocumentMarker, >+ FloatPoint, float, DocumentMarkerLineStyle >+>; > >+class DrawLineForDocumentMarker : public DrawLineForDocumentMarkerBase { >+public: >+ constexpr static auto create = DrawLineForDocumentMarkerBase::create<DrawLineForDocumentMarker>; >+ using DrawLineForDocumentMarkerBase::DrawLineForDocumentMarkerBase; > private: >- DrawLinesForText(const FloatPoint& blockLocation, const FloatSize& localAnchor, const DashArray& widths, bool printing, bool doubleLines, float strokeWidth) >- : DrawingItem(ItemType::DrawLinesForText) >- , m_blockLocation(blockLocation) >- , m_localAnchor(localAnchor) >- , m_widths(widths) >- , m_strokeWidth(strokeWidth) >- , m_printing(printing) >- , m_doubleLines(doubleLines) >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override > { >+ // This function needs to return a value equal to or enclosing what GraphicsContext::drawLineForDocumentMarker() returns. >+ FloatRect bounds(argument<0>(), FloatSize(argument<1>(), cMisspellingLineThickness)); >+ bounds.inflate(cMisspellingLineThickness); // Account for "misspelling dot" snapping. >+ return bounds; > } >- >- void apply(GraphicsContext&) const override; >- >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >- >- FloatPoint m_blockLocation; >- FloatSize m_localAnchor; >- DashArray m_widths; >- float m_strokeWidth; >- bool m_printing; >- bool m_doubleLines; > }; > >-class DrawLineForDocumentMarker : public DrawingItem { >-public: >- static Ref<DrawLineForDocumentMarker> create(const FloatPoint& point, float width, DocumentMarkerLineStyle style) >- { >- return adoptRef(*new DrawLineForDocumentMarker(point, width, style)); >- } >- >- FloatPoint point() const { return m_point; } >- float width() const { return m_width; } >+using DrawEllipseBase = DrawingItem< >+ ItemType::DrawEllipse, >+ void (GraphicsContext::*)(const FloatRect&), >+ &GraphicsContext::drawEllipse, >+ FloatRect >+>; > >+class DrawEllipse : public DrawEllipseBase { >+public: >+ constexpr static auto create = DrawEllipseBase::create<DrawEllipse>; >+ using DrawEllipseBase::DrawEllipseBase; > private: >- DrawLineForDocumentMarker(const FloatPoint& point, float width, DocumentMarkerLineStyle style) >- : DrawingItem(ItemType::DrawLineForDocumentMarker) >- , m_point(point) >- , m_width(width) >- , m_style(style) >- { >- } >- >- void apply(GraphicsContext&) const override; >- >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >- >- FloatPoint m_point; >- float m_width; >- DocumentMarkerLineStyle m_style; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<0>(); } > }; > >-class DrawEllipse : public DrawingItem { >+#if USE(CG) >+using DrawPathBase = DrawingItem< >+ ItemType::DrawPath, >+ void (GraphicsContext::*)(const Path&), >+ &GraphicsContext::drawPath, >+ const Path >+>; >+ >+class DrawPath : public DrawPathBase { > public: >- static Ref<DrawEllipse> create(const FloatRect& rect) >- { >- return adoptRef(*new DrawEllipse(rect)); >- } >- >- FloatRect rect() const { return m_rect; } >- >+ constexpr static auto create = DrawPathBase::create<DrawPath>; >+ using DrawPathBase::DrawPathBase; > private: >- DrawEllipse(const FloatRect& rect) >- : DrawingItem(ItemType::DrawEllipse) >- , m_rect(rect) >- { >- } >- >- void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >- >- FloatRect m_rect; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<0>().fastBoundingRect(); } > }; >+#endif > >-class DrawPath : public DrawingItem { >-public: >- static Ref<DrawPath> create(const Path& path) >- { >- return adoptRef(*new DrawPath(path)); >- } >- >- const Path& path() const { return m_path; } >+using DrawFocusRingPathBase = DrawingItem< >+ ItemType::DrawFocusRingPath, >+ void (GraphicsContext::*)(const Path&, float, float, const Color&), >+ &GraphicsContext::drawFocusRing, >+ const Path, float, float, Color >+>; > >+class DrawFocusRingPath : public DrawFocusRingPathBase { >+public: >+ constexpr static auto create = DrawFocusRingPathBase::create<DrawFocusRingPath>; >+ using DrawFocusRingPathBase::DrawFocusRingPathBase; > private: >- DrawPath(const Path& path) >- : DrawingItem(ItemType::DrawPath) >- , m_path(path) >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override > { >+ FloatRect bounds = argument<0>().fastBoundingRect(); >+ bounds.inflate(s_platformFocusRingWidth); >+ return bounds; > } >- >- void apply(GraphicsContext&) const override; >- >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_path.fastBoundingRect(); } >- >- const Path m_path; > }; > >-class DrawFocusRingPath : public DrawingItem { >-public: >- static Ref<DrawFocusRingPath> create(const Path& path, float width, float offset, const Color& color) >- { >- return adoptRef(*new DrawFocusRingPath(path, width, offset, color)); >- } >- >- const Path& path() const { return m_path; } >- float width() const { return m_width; } >- float offset() const { return m_offset; } >- const Color& color() const { return m_color; } >+using DrawFocusRingRectsBase = DrawingItem< >+ ItemType::DrawFocusRingRects, >+ void (GraphicsContext::*)(const Vector<FloatRect>&, float, float, const Color&), >+ &GraphicsContext::drawFocusRing, >+ Vector<FloatRect>, float, float, Color >+>; > >+class DrawFocusRingRects : public DrawFocusRingRectsBase { >+public: >+ constexpr static auto create = DrawFocusRingRectsBase::create<DrawFocusRingRects>; >+ using DrawFocusRingRectsBase::DrawFocusRingRectsBase; > private: >- DrawFocusRingPath(const Path& path, float width, float offset, const Color& color) >- : DrawingItem(ItemType::DrawFocusRingPath) >- , m_path(path) >- , m_width(width) >- , m_offset(offset) >- , m_color(color) >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override > { >+ FloatRect bounds; >+ for (auto& rect : argument<0>()) >+ bounds.unite(rect); >+ bounds.inflate(s_platformFocusRingWidth); >+ return bounds; > } >- >- void apply(GraphicsContext&) const override; >- >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >- >- const Path m_path; >- float m_width; >- float m_offset; >- Color m_color; > }; > >-class DrawFocusRingRects : public DrawingItem { >+using DrawIconBase = DrawingItem< >+ ItemType::DrawIcon, >+ void (GraphicsContext::*)(Icon&, const FloatRect&), >+ &GraphicsContext::drawIcon, >+ Ref<Icon>, FloatRect >+>; >+ >+class DrawIcon : public DrawIconBase { > public: >- static Ref<DrawFocusRingRects> create(const Vector<FloatRect>& rects, float width, float offset, const Color& color) >- { >- return adoptRef(*new DrawFocusRingRects(rects, width, offset, color)); >- } >- >- const Vector<FloatRect> rects() const { return m_rects; } >- float width() const { return m_width; } >- float offset() const { return m_offset; } >- const Color& color() const { return m_color; } >- >+ constexpr static auto create = DrawIconBase::create<DrawIcon>; >+ using DrawIconBase::DrawIconBase; > private: >- DrawFocusRingRects(const Vector<FloatRect>& rects, float width, float offset, const Color& color) >- : DrawingItem(ItemType::DrawFocusRingRects) >- , m_rects(rects) >- , m_width(width) >- , m_offset(offset) >- , m_color(color) >- { >- } >- >- void apply(GraphicsContext&) const override; >- >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >- >- Vector<FloatRect> m_rects; >- float m_width; >- float m_offset; >- Color m_color; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<1>(); } > }; > >-class FillRect : public DrawingItem { >+using DrawWidgetBase = DrawingItem< >+ ItemType::DrawWidget, >+ void (GraphicsContext::*)(Widget&, const IntRect&), >+ &GraphicsContext::drawWidget, >+ Ref<Widget>, IntRect >+>; >+ >+class DrawWidget : public DrawWidgetBase { > public: >- static Ref<FillRect> create(const FloatRect& rect) >- { >- return adoptRef(*new FillRect(rect)); >- } >- >- FloatRect rect() const { return m_rect; } >- >+ constexpr static auto create = DrawWidgetBase::create<DrawWidget>; >+ using DrawWidgetBase::DrawWidgetBase; > private: >- FillRect(const FloatRect& rect) >- : DrawingItem(ItemType::FillRect) >- , m_rect(rect) >- { >- } >- >- void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >- >- FloatRect m_rect; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return FloatRect(argument<1>()); } > }; >- >-// FIXME: Make these inherit from FillRect proper. >-class FillRectWithColor : public DrawingItem { >+ >+using DrawScrollbarBase = DrawingItem< >+ ItemType::DrawScrollbar, >+ void (GraphicsContext::*)(Scrollbar&, const IntRect&), >+ &GraphicsContext::drawScrollbar, >+ Ref<Scrollbar>, IntRect >+>; >+ >+class DrawScrollbar : public DrawScrollbarBase { > public: >- static Ref<FillRectWithColor> create(const FloatRect& rect, const Color& color) >- { >- return adoptRef(*new FillRectWithColor(rect, color)); >- } >- >- FloatRect rect() const { return m_rect; } >- const Color& color() const { return m_color; } >- >+ constexpr static auto create = DrawScrollbarBase::create<DrawScrollbar>; >+ using DrawScrollbarBase::DrawScrollbarBase; > private: >- FillRectWithColor(const FloatRect& rect, const Color& color) >- : DrawingItem(ItemType::FillRectWithColor) >- , m_rect(rect) >- , m_color(color) >- { >- } >- >- void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >- >- FloatRect m_rect; >- Color m_color; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return FloatRect(argument<1>()); } > }; >- >-class FillRectWithGradient : public DrawingItem { >+ >+using DrawThemeBase = DrawingItem< >+ ItemType::DrawTheme, >+ void (GraphicsContext::*)(Theme&, ControlPart, ControlStates&, const FloatRect&, float, void*, float, float, bool, bool), >+ &GraphicsContext::drawTheme, >+ Theme&, ControlPart, ControlStates&, FloatRect, float, void*, float, float, bool, bool >+>; >+ >+class DrawTheme : public DrawThemeBase { > public: >- static Ref<FillRectWithGradient> create(const FloatRect& rect, Gradient& gradient) >- { >- return adoptRef(*new FillRectWithGradient(rect, gradient)); >- } >- >- FloatRect rect() const { return m_rect; } >- >+ constexpr static auto create = DrawThemeBase::create<DrawTheme>; >+ using DrawThemeBase::DrawThemeBase; > private: >- FillRectWithGradient(const FloatRect& rect, Gradient& gradient) >- : DrawingItem(ItemType::FillRectWithGradient) >- , m_rect(rect) >- , m_gradient(gradient) >- { >- } >- >- void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >- >- FloatRect m_rect; >- mutable Ref<Gradient> m_gradient; // FIXME: Make this not mutable >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<3>(); } > }; > >-class FillCompositedRect : public DrawingItem { >-public: >- static Ref<FillCompositedRect> create(const FloatRect& rect, const Color& color, CompositeOperator op, BlendMode blendMode) >- { >- return adoptRef(*new FillCompositedRect(rect, color, op, blendMode)); >- } >- >- 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; } >+using FillRectBase = DrawingItem< >+ ItemType::FillRect, >+ void (GraphicsContext::*)(const FloatRect&), >+ &GraphicsContext::fillRect, >+ FloatRect >+>; > >+class FillRect : public FillRectBase { >+public: >+ constexpr static auto create = FillRectBase::create<FillRect>; >+ using FillRectBase::FillRectBase; > 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) >- { >- } >- >- void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >- >- FloatRect m_rect; >- Color m_color; >- CompositeOperator m_op; >- BlendMode m_blendMode; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<0>(); } > }; > >-class FillRoundedRect : public DrawingItem { >-public: >- static Ref<FillRoundedRect> create(const FloatRoundedRect& rect, const Color& color, BlendMode blendMode) >- { >- return adoptRef(*new FillRoundedRect(rect, color, blendMode)); >- } >- >- const FloatRoundedRect& roundedRect() const { return m_rect; } >- const Color& color() const { return m_color; } >- BlendMode blendMode() const { return m_blendMode; } >+using FillRectWithColorBase = DrawingItem< >+ ItemType::FillRectWithColor, >+ void (GraphicsContext::*)(const FloatRect&, const Color&), >+ &GraphicsContext::fillRect, >+ FloatRect, Color >+>; > >+class FillRectWithColor : public FillRectWithColorBase { >+public: >+ constexpr static auto create = FillRectWithColorBase::create<FillRectWithColor>; >+ using FillRectWithColorBase::FillRectWithColorBase; > private: >- FillRoundedRect(const FloatRoundedRect& rect, const Color& color, BlendMode blendMode) >- : DrawingItem(ItemType::FillRoundedRect) >- , m_rect(rect) >- , m_color(color) >- , m_blendMode(blendMode) >- { >- } >- >- void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect.rect(); } >- >- FloatRoundedRect m_rect; >- Color m_color; >- BlendMode m_blendMode; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<0>(); } > }; > >-class FillRectWithRoundedHole : public DrawingItem { >-public: >- static Ref<FillRectWithRoundedHole> create(const FloatRect& rect, const FloatRoundedRect& roundedHoleRect, const Color& color) >- { >- return adoptRef(*new FillRectWithRoundedHole(rect, roundedHoleRect, color)); >- } >- >- const FloatRect& rect() const { return m_rect; } >- const FloatRoundedRect& roundedHoleRect() const { return m_roundedHoleRect; } >- const Color& color() const { return m_color; } >+using FillRectWithGradientBase = DrawingItem< >+ ItemType::FillRectWithGradient, >+ void (GraphicsContext::*)(const FloatRect&, Gradient&), >+ &GraphicsContext::fillRect, >+ FloatRect, Ref<Gradient> >+>; > >+class FillRectWithGradient : public FillRectWithGradientBase { >+public: >+ constexpr static auto create = FillRectWithGradientBase::create<FillRectWithGradient>; >+ using FillRectWithGradientBase::FillRectWithGradientBase; > private: >- FillRectWithRoundedHole(const FloatRect& rect, const FloatRoundedRect& roundedHoleRect, const Color& color) >- : DrawingItem(ItemType::FillRectWithRoundedHole) >- , m_rect(rect) >- , m_roundedHoleRect(roundedHoleRect) >- , m_color(color) >- { >- } >- >- void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >- >- FloatRect m_rect; >- FloatRoundedRect m_roundedHoleRect; >- Color m_color; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<0>(); } > }; > >-class FillPath : public DrawingItem { >-public: >- static Ref<FillPath> create(const Path& path) >- { >- return adoptRef(*new FillPath(path)); >- } >- >- const Path& path() const { return m_path; } >+using FillCompositedRectBase = DrawingItem< >+ ItemType::FillCompositedRect, >+ void (GraphicsContext::*)(const FloatRect&, const Color&, CompositeOperator, BlendMode), >+ &GraphicsContext::fillRect, >+ FloatRect, Color, CompositeOperator, BlendMode >+>; > >+class FillCompositedRect : public FillCompositedRectBase { >+public: >+ constexpr static auto create = FillCompositedRectBase::create<FillCompositedRect>; >+ using FillCompositedRectBase::FillCompositedRectBase; > private: >- FillPath(const Path& path) >- : DrawingItem(ItemType::FillPath) >- , m_path(path) >- { >- } >- >- void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_path.fastBoundingRect(); } >- >- const Path m_path; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<0>(); } > }; > >-class FillEllipse : public DrawingItem { >-public: >- static Ref<FillEllipse> create(const FloatRect& rect) >- { >- return adoptRef(*new FillEllipse(rect)); >- } >- >- FloatRect rect() const { return m_rect; } >+using FillRoundedRectBase = DrawingItem< >+ ItemType::FillRoundedRect, >+ void (GraphicsContext::*)(const FloatRoundedRect&, const Color&, BlendMode), >+ &GraphicsContext::fillRoundedRect, >+ FloatRoundedRect, Color, BlendMode >+>; > >+class FillRoundedRect : public FillRoundedRectBase { >+public: >+ constexpr static auto create = FillRoundedRectBase::create<FillRoundedRect>; >+ using FillRoundedRectBase::FillRoundedRectBase; > private: >- FillEllipse(const FloatRect& rect) >- : DrawingItem(ItemType::FillEllipse) >- , m_rect(rect) >- { >- } >- >- void apply(GraphicsContext&) const override; >- >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >- >- FloatRect m_rect; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<0>().rect(); } > }; > >-class StrokeRect : public DrawingItem { >-public: >- static Ref<StrokeRect> create(const FloatRect& rect, float lineWidth) >- { >- return adoptRef(*new StrokeRect(rect, lineWidth)); >- } >- >- FloatRect rect() const { return m_rect; } >- float lineWidth() const { return m_lineWidth; } >+using FillRectWithRoundedHoleBase = DrawingItem< >+ ItemType::FillRectWithRoundedHole, >+ void (GraphicsContext::*)(const FloatRect&, const FloatRoundedRect&, const Color&), >+ &GraphicsContext::fillRectWithRoundedHole, >+ FloatRect, FloatRoundedRect, Color >+>; > >+class FillRectWithRoundedHole : public FillRectWithRoundedHoleBase { >+public: >+ constexpr static auto create = FillRectWithRoundedHoleBase::create<FillRectWithRoundedHole>; >+ using FillRectWithRoundedHoleBase::FillRectWithRoundedHoleBase; > private: >- StrokeRect(const FloatRect& rect, float lineWidth) >- : DrawingItem(ItemType::StrokeRect) >- , m_rect(rect) >- , m_lineWidth(lineWidth) >- { >- } >- >- void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >- >- FloatRect m_rect; >- float m_lineWidth; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<0>(); } > }; > >-class StrokePath : public DrawingItem { >-public: >- static Ref<StrokePath> create(const Path& path) >- { >- return adoptRef(*new StrokePath(path)); >- } >- >- const Path& path() const { return m_path; } >+using FillPathBase = DrawingItem< >+ ItemType::FillPath, >+ void (GraphicsContext::*)(const Path&), >+ &GraphicsContext::fillPath, >+ const Path >+>; > >+class FillPath : public FillPathBase { >+public: >+ constexpr static auto create = FillPathBase::create<FillPath>; >+ using FillPathBase::FillPathBase; > private: >- StrokePath(const Path& path) >- : DrawingItem(ItemType::StrokePath) >- , m_path(path) >- { >- } >- >- void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >- >- const Path m_path; >- FloatPoint m_blockLocation; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<0>().fastBoundingRect(); } > }; > >-class StrokeEllipse : public DrawingItem { >-public: >- static Ref<StrokeEllipse> create(const FloatRect& rect) >- { >- return adoptRef(*new StrokeEllipse(rect)); >- } >- >- FloatRect rect() const { return m_rect; } >+using FillEllipseBase = DrawingItem< >+ ItemType::FillEllipse, >+ void (GraphicsContext::*)(const FloatRect&), >+ &GraphicsContext::fillEllipse, >+ FloatRect >+>; > >+class FillEllipse : public FillEllipseBase { >+public: >+ constexpr static auto create = FillEllipseBase::create<FillEllipse>; >+ using FillEllipseBase::FillEllipseBase; > private: >- StrokeEllipse(const FloatRect& rect) >- : DrawingItem(ItemType::StrokeEllipse) >- , m_rect(rect) >- { >- } >- >- void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override; >- >- FloatRect m_rect; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<0>(); } > }; > >-class ClearRect : public DrawingItem { >-public: >- static Ref<ClearRect> create(const FloatRect& rect) >- { >- return adoptRef(*new ClearRect(rect)); >- } >- >- FloatRect rect() const { return m_rect; } >+using StrokeRectBase = DrawingItem< >+ ItemType::StrokeRect, >+ void (GraphicsContext::*)(const FloatRect&, float), >+ &GraphicsContext::strokeRect, >+ FloatRect, float >+>; > >+class StrokeRect : public StrokeRectBase { >+public: >+ constexpr static auto create = StrokeRectBase::create<StrokeRect>; >+ using StrokeRectBase::StrokeRectBase; > private: >- ClearRect(const FloatRect& rect) >- : DrawingItem(ItemType::ClearRect) >- , m_rect(rect) >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override > { >+ FloatRect bounds = argument<0>(); >+ bounds.expand(argument<1>(), argument<1>()); >+ return bounds; > } >- >- void apply(GraphicsContext&) const override; >- std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect; } >- >- FloatRect m_rect; > }; > >-#if USE(CG) >-class ApplyStrokePattern : public Item { >-public: >- static Ref<ApplyStrokePattern> create() >- { >- return adoptRef(*new ApplyStrokePattern); >- } >+using StrokePathBase = DrawingItem< >+ ItemType::StrokePath, >+ void (GraphicsContext::*)(const Path&), >+ &GraphicsContext::strokePath, >+ const Path >+>; > >+class StrokePath : public StrokePathBase { >+public: >+ constexpr static auto create = StrokePathBase::create<StrokePath>; >+ using StrokePathBase::StrokePathBase; > private: >- ApplyStrokePattern() >- : Item(ItemType::ApplyStrokePattern) >+ const std::optional<FloatRect> localBounds(const GraphicsContext& context) const override > { >- } >+ // FIXME: Need to take stroke thickness into account correctly, via CGPathByStrokingPath(). >+ float strokeThickness = context.strokeThickness(); > >- void apply(GraphicsContext&) const override; >+ FloatRect bounds = argument<0>().boundingRect(); >+ bounds.expand(strokeThickness, strokeThickness); >+ return bounds; >+ } > }; > >-class ApplyFillPattern : public Item { >-public: >- static Ref<ApplyFillPattern> create() >- { >- return adoptRef(*new ApplyFillPattern); >- } >+using StrokeEllipseBase = DrawingItem< >+ ItemType::StrokeEllipse, >+ void (GraphicsContext::*)(const FloatRect&), >+ &GraphicsContext::strokeEllipse, >+ FloatRect >+>; > >+class StrokeEllipse : public StrokeEllipseBase { >+public: >+ constexpr static auto create = StrokeEllipseBase::create<StrokeEllipse>; >+ using StrokeEllipseBase::StrokeEllipseBase; > private: >- ApplyFillPattern() >- : Item(ItemType::ApplyFillPattern) >+ const std::optional<FloatRect> localBounds(const GraphicsContext& context) const override > { >+ float strokeThickness = context.strokeThickness(); >+ FloatRect bounds = argument<0>(); >+ bounds.expand(strokeThickness, strokeThickness); >+ return bounds; > } >- >- void apply(GraphicsContext&) const override; > }; >-#endif >- >-class ApplyDeviceScaleFactor : public Item { >-public: >- static Ref<ApplyDeviceScaleFactor> create(float scaleFactor) >- { >- return adoptRef(*new ApplyDeviceScaleFactor(scaleFactor)); >- } > >- float scaleFactor() const { return m_scaleFactor; } >+using ClearRectBase = DrawingItem< >+ ItemType::ClearRect, >+ void (GraphicsContext::*)(const FloatRect&), >+ &GraphicsContext::clearRect, >+ FloatRect >+>; > >+class ClearRect : public ClearRectBase { >+public: >+ constexpr static auto create = ClearRectBase::create<ClearRect>; >+ using ClearRectBase::ClearRectBase; > private: >- ApplyDeviceScaleFactor(float scaleFactor) >- : Item(ItemType::ApplyDeviceScaleFactor) >- , m_scaleFactor(scaleFactor) >- { >- } >- >- void apply(GraphicsContext&) const override; >- >- float m_scaleFactor; >+ const std::optional<FloatRect> localBounds(const GraphicsContext&) const override { return argument<0>(); } > }; > >-WTF::TextStream& operator<<(WTF::TextStream&, const Item&); >+inline WTF::TextStream& operator<<(WTF::TextStream& ts, const Item& item) >+{ >+ TextStream::GroupScope group(ts); >+ item.dump(ts); >+ return ts; >+} >+ >+inline WTF::CString Item::dump() const >+{ >+ TextStream ts; >+ ts << *this; >+ return ts.release().utf8(); >+} > > } // namespace DisplayList > } // namespace WebCore > >- >-#define SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_DRAWINGITEM(ToValueTypeName, predicate) \ >-SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::DisplayList::ToValueTypeName) \ >- static bool isType(const WebCore::DisplayList::Item& object) { return object.predicate; } \ >+#define SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_GEOMETRYITEM(ToValueTypeName, predicate) \ >+ SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::DisplayList::ToValueTypeName) \ >+ static bool isType(const WebCore::DisplayList::Item& item) { return item.predicate; } \ > SPECIALIZE_TYPE_TRAITS_END() > >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_DRAWINGITEM(DrawingItem, isDrawingItem()) >+SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_GEOMETRYITEM(GeometryItem, isGeometryItem()) > > #define SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(ToValueTypeName) \ >-SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::DisplayList::ToValueTypeName) \ >+ SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::DisplayList::ToValueTypeName) \ > static bool isType(const WebCore::DisplayList::Item& item) { return item.type() == WebCore::DisplayList::ItemType::ToValueTypeName; } \ > SPECIALIZE_TYPE_TRAITS_END() > > SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(Save) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(Restore) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(Translate) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(Rotate) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(Scale) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(ConcatenateCTM) > SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(SetState) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(SetLineCap) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(SetLineDash) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(SetLineJoin) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(SetMiterLimit) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(Clip) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(ClipOut) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(ClipOutToPath) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(ClipPath) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawGlyphs) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawImage) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawTiledImage) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawTiledScaledImage) >-#if USE(CG) || USE(CAIRO) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawNativeImage) >-#endif >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawPattern) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawRect) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawLine) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawLinesForText) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawLineForDocumentMarker) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawEllipse) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawPath) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawFocusRingPath) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(DrawFocusRingRects) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(FillRect) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(FillRectWithColor) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(FillRectWithGradient) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(FillCompositedRect) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(FillRoundedRect) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(FillRectWithRoundedHole) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(FillPath) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(FillEllipse) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(StrokeRect) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(StrokePath) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(StrokeEllipse) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(ClearRect) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(BeginTransparencyLayer) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(EndTransparencyLayer) >-#if USE(CG) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(ApplyStrokePattern) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(ApplyFillPattern) >-#endif >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(ApplyDeviceScaleFactor) >-SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(ClearShadow) >- >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >index ea27326b561f19de22473e3bac83f44faa092ffd..2265b37141404473645049a62dd26c76c24015a2 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2016 Apple Inc. All rights reserved. >+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -52,21 +52,22 @@ Recorder::~Recorder() > > void Recorder::willAppendItem(const Item& item) > { >- if (item.isDrawingItem() > #if USE(CG) >- || item.type() == ItemType::ApplyStrokePattern || item.type() == ItemType::ApplyStrokePattern >+ if (!is<GeometryItem>(item) && item.type() != ItemType::ApplyStrokePattern && item.type() != ItemType::ApplyFillPattern) >+#else >+ if (!is<GeometryItem>(item)) > #endif >- ) { >- GraphicsContextStateChange& stateChanges = currentState().stateChange; >- GraphicsContextState::StateChangeFlags changesFromLastState = stateChanges.changesFromState(currentState().lastDrawingState); >- 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; >- currentState().lastDrawingState = stateChanges.m_state; >- } >- currentState().wasUsedForDrawing = true; >+ return; >+ >+ GraphicsContextStateChange& stateChanges = currentState().stateChange; >+ GraphicsContextState::StateChangeFlags changesFromLastState = stateChanges.changesFromState(currentState().lastDrawingState); >+ if (changesFromLastState) { >+ LOG_WITH_STREAM(DisplayLists, stream << "pre-drawing, saving state " << GraphicsContextStateChange(stateChanges.m_state, changesFromLastState)); >+ m_displayList.append(SetState::create(GraphicsContextStateChange(stateChanges.m_state, changesFromLastState))); >+ stateChanges.m_changeFlags = 0; >+ currentState().lastDrawingState = stateChanges.m_state; > } >+ currentState().wasUsedForDrawing = true; > } > > void Recorder::updateState(const GraphicsContextState& state, GraphicsContextState::StateChangeFlags flags) >@@ -99,44 +100,50 @@ void Recorder::setMiterLimit(float miterLimit) > appendItem(SetMiterLimit::create(miterLimit)); > } > >-void Recorder::drawGlyphs(const Font& font, const GlyphBuffer& glyphBuffer, unsigned from, unsigned numGlyphs, const FloatPoint& startPoint, FontSmoothingMode smoothingMode) >+void Recorder::drawGlyphs(const Font& font, const GlyphBuffer& glyphBuffer, unsigned from, unsigned numGlyphs, const FloatPoint& startPoint, FontSmoothingMode fontSmoothing) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawGlyphs::create(font, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs, FloatPoint(), toFloatSize(startPoint), smoothingMode))); >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawGlyphs::create(makeRef(font), glyphBuffer, from, numGlyphs, startPoint, fontSmoothing))); > updateItemExtent(newItem); > } > > ImageDrawResult Recorder::drawImage(Image& image, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& imagePaintingOptions) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawImage::create(image, destination, source, imagePaintingOptions))); >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawImage::create(makeRef(image), destination, source, imagePaintingOptions))); > updateItemExtent(newItem); > return ImageDrawResult::DidRecord; > } > > ImageDrawResult Recorder::drawTiledImage(Image& image, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& imagePaintingOptions) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawTiledImage::create(image, destination, source, tileSize, spacing, imagePaintingOptions))); >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawTiledImage::create(makeRef(image), destination, source, tileSize, spacing, imagePaintingOptions))); > updateItemExtent(newItem); > return ImageDrawResult::DidRecord; > } > > ImageDrawResult Recorder::drawTiledImage(Image& image, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule hRule, Image::TileRule vRule, const ImagePaintingOptions& imagePaintingOptions) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawTiledScaledImage::create(image, destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions))); >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawTiledScaledImage::create(makeRef(image), destination, source, tileScaleFactor, hRule, vRule, imagePaintingOptions))); > updateItemExtent(newItem); > return ImageDrawResult::DidRecord; > } > >-#if USE(CG) || USE(CAIRO) >+#if USE(CG) || USE(DIRECT2D) || USE(CAIRO) > void Recorder::drawNativeImage(const NativeImagePtr& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, BlendMode blendMode, ImageOrientation orientation) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawNativeImage::create(image, imageSize, destRect, srcRect, op, blendMode, orientation))); >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawNativeImage::create(image, imageSize, destRect, srcRect, op, blendMode, orientation))); > updateItemExtent(newItem); > } >+ >+void Recorder::drawNativeScaledImage(const NativeImagePtr& image, float scaleFactor, const IntPoint& destination, const IntRect& source) >+{ >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawNativeScaledImage::create(image, scaleFactor, destination, source))); >+ updateItemExtent(newItem); >+} > #endif > > void Recorder::drawPattern(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator op, BlendMode blendMode) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawPattern::create(image, destRect, tileRect, patternTransform, phase, spacing, op, blendMode))); >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawPattern::create(makeRef(image), destRect, tileRect, patternTransform, phase, spacing, op, blendMode))); > updateItemExtent(newItem); > } > >@@ -209,7 +216,7 @@ AffineTransform Recorder::getCTM(GraphicsContext::IncludeDeviceScale) > > void Recorder::beginTransparencyLayer(float opacity) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(BeginTransparencyLayer::create(opacity))); >+ auto& newItem = downcast<GeometryItem>(appendItem(BeginTransparencyLayer::create(opacity))); > updateItemExtent(newItem); > } > >@@ -220,121 +227,147 @@ void Recorder::endTransparencyLayer() > > void Recorder::drawRect(const FloatRect& rect, float borderThickness) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawRect::create(rect, borderThickness))); >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawRect::create(rect, borderThickness))); > updateItemExtent(newItem); > } > > void Recorder::drawLine(const FloatPoint& point1, const FloatPoint& point2) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawLine::create(point1, point2))); >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawLine::create(point1, point2))); > updateItemExtent(newItem); > } > >-void Recorder::drawLinesForText(const FloatPoint& point, const DashArray& widths, bool printing, bool doubleLines, float strokeThickness) >+void Recorder::drawLinesForText(const FloatPoint& point, const DashArray& widths, bool printing, bool doubleLines, StrokeStyle strokeStyle) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawLinesForText::create(FloatPoint(), toFloatSize(point), widths, printing, doubleLines, strokeThickness))); >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawLinesForText::create(point, widths, printing, doubleLines, strokeStyle))); > updateItemExtent(newItem); > } > > void Recorder::drawLineForDocumentMarker(const FloatPoint& point, float width, DocumentMarkerLineStyle style) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawLineForDocumentMarker::create(point, width, style))); >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawLineForDocumentMarker::create(point, width, style))); > updateItemExtent(newItem); > } > > void Recorder::drawEllipse(const FloatRect& rect) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawEllipse::create(rect))); >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawEllipse::create(rect))); > updateItemExtent(newItem); > } > >+#if USE(CG) > void Recorder::drawPath(const Path& path) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawPath::create(path))); >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawPath::create(path))); > updateItemExtent(newItem); > } >+#endif > > void Recorder::drawFocusRing(const Path& path, float width, float offset, const Color& color) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawFocusRingPath::create(path, width, offset, color))); >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawFocusRingPath::create(path, width, offset, color))); > updateItemExtent(newItem); > } > > void Recorder::drawFocusRing(const Vector<FloatRect>& rects, float width, float offset, const Color& color) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawFocusRingRects::create(rects, width, offset, color))); >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawFocusRingRects::create(rects, width, offset, color))); >+ updateItemExtent(newItem); >+} >+ >+void Recorder::drawIcon(Icon& icon, const FloatRect& rect) >+{ >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawIcon::create(makeRef(icon), rect))); >+ updateItemExtent(newItem); >+} >+ >+void Recorder::drawWidget(Widget& widget, const IntRect& rect) >+{ >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawWidget::create(makeRef(widget), rect))); >+ updateItemExtent(newItem); >+} >+ >+void Recorder::drawScrollbar(Scrollbar& scrollbar, const IntRect& rect) >+{ >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawScrollbar::create(makeRef(scrollbar), rect))); >+ updateItemExtent(newItem); >+} >+ >+void Recorder::drawTheme(Theme& theme, ControlPart part, ControlStates& states, const FloatRect& zoomedRect, float zoomFactor, void* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance) >+{ >+ auto& newItem = downcast<GeometryItem>(appendItem(DrawTheme::create(theme, part, states, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor, useSystemAppearance, useDarkAppearance))); > updateItemExtent(newItem); > } > > void Recorder::fillRect(const FloatRect& rect) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(FillRect::create(rect))); >+ auto& newItem = downcast<GeometryItem>(appendItem(FillRect::create(rect))); > updateItemExtent(newItem); > } > > void Recorder::fillRect(const FloatRect& rect, const Color& color) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(FillRectWithColor::create(rect, color))); >+ auto& newItem = downcast<GeometryItem>(appendItem(FillRectWithColor::create(rect, color))); > updateItemExtent(newItem); > } > > void Recorder::fillRect(const FloatRect& rect, Gradient& gradient) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(FillRectWithGradient::create(rect, gradient))); >+ auto& newItem = downcast<GeometryItem>(appendItem(FillRectWithGradient::create(rect, gradient))); > updateItemExtent(newItem); > } > > void Recorder::fillRect(const FloatRect& rect, const Color& color, CompositeOperator op, BlendMode blendMode) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(FillCompositedRect::create(rect, color, op, blendMode))); >+ auto& newItem = downcast<GeometryItem>(appendItem(FillCompositedRect::create(rect, color, op, blendMode))); > updateItemExtent(newItem); > } > > void Recorder::fillRoundedRect(const FloatRoundedRect& rect, const Color& color, BlendMode blendMode) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(FillRoundedRect::create(rect, color, blendMode))); >+ auto& newItem = downcast<GeometryItem>(appendItem(FillRoundedRect::create(rect, color, blendMode))); > updateItemExtent(newItem); > } > > void Recorder::fillRectWithRoundedHole(const FloatRect& rect, const FloatRoundedRect& roundedHoleRect, const Color& color) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(FillRectWithRoundedHole::create(rect, roundedHoleRect, color))); >+ auto& newItem = downcast<GeometryItem>(appendItem(FillRectWithRoundedHole::create(rect, roundedHoleRect, color))); > updateItemExtent(newItem); > } > > void Recorder::fillPath(const Path& path) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(FillPath::create(path))); >+ auto& newItem = downcast<GeometryItem>(appendItem(FillPath::create(path))); > updateItemExtent(newItem); > } > > void Recorder::fillEllipse(const FloatRect& rect) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(FillEllipse::create(rect))); >+ auto& newItem = downcast<GeometryItem>(appendItem(FillEllipse::create(rect))); > updateItemExtent(newItem); > } > > void Recorder::strokeRect(const FloatRect& rect, float lineWidth) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(StrokeRect::create(rect, lineWidth))); >+ auto& newItem = downcast<GeometryItem>(appendItem(StrokeRect::create(rect, lineWidth))); > updateItemExtent(newItem); > } > > void Recorder::strokePath(const Path& path) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(StrokePath::create(path))); >+ auto& newItem = downcast<GeometryItem>(appendItem(StrokePath::create(path))); > updateItemExtent(newItem); > } > > void Recorder::strokeEllipse(const FloatRect& rect) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(StrokeEllipse::create(rect))); >+ auto& newItem = downcast<GeometryItem>(appendItem(StrokeEllipse::create(rect))); > updateItemExtent(newItem); > } > > void Recorder::clearRect(const FloatRect& rect) > { >- DrawingItem& newItem = downcast<DrawingItem>(appendItem(ClearRect::create(rect))); >+ auto& newItem = downcast<GeometryItem>(appendItem(ClearRect::create(rect))); > updateItemExtent(newItem); > } > >@@ -378,9 +411,9 @@ IntRect Recorder::clipBounds() > return IntRect(-2048, -2048, 4096, 4096); > } > >-void Recorder::clipToImageBuffer(ImageBuffer&, const FloatRect&) >+void Recorder::clipToImageBuffer(const NativeImagePtr& image, const FloatRect& destRect, const FloatSize& bufferDestinationSize) > { >- WTFLogAlways("GraphicsContext::clipToImageBuffer is not compatible with DisplayList::Recorder."); >+ appendItem(ClipToImageBuffer::create(image, destRect, bufferDestinationSize)); > } > > void Recorder::applyDeviceScaleFactor(float deviceScaleFactor) >@@ -402,7 +435,7 @@ Item& Recorder::appendItem(Ref<Item>&& item) > return m_displayList.append(WTFMove(item)); > } > >-void Recorder::updateItemExtent(DrawingItem& item) const >+void Recorder::updateItemExtent(GeometryItem& item) const > { > if (std::optional<FloatRect> rect = item.localBounds(graphicsContext())) > item.setExtent(extentFromLocalBounds(rect.value())); >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h >index c5ac7091395fa4fe83a31d2c88db1e88a7ada3e4..fe5b5598121313887a59cfa15184e34c0d30c25c 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h >@@ -45,8 +45,6 @@ struct ImagePaintingOptions; > > namespace DisplayList { > >-class DrawingItem; >- > class Recorder : public GraphicsContextImpl { > WTF_MAKE_NONCOPYABLE(Recorder); > public: >@@ -92,18 +90,26 @@ private: > ImageDrawResult 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) override; >+ void drawNativeScaledImage(const NativeImagePtr&, float scaleFactor, const IntPoint& destination, const IntRect& source) override; > #endif > 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) override; > void drawLine(const FloatPoint&, const FloatPoint&) override; >- void drawLinesForText(const FloatPoint&, const DashArray& widths, bool printing, bool doubleLines, float strokeThickness) override; >+ void drawLinesForText(const FloatPoint&, const DashArray& widths, bool printing, bool doubleLines, StrokeStyle) override; > void drawLineForDocumentMarker(const FloatPoint&, float width, DocumentMarkerLineStyle) override; > void drawEllipse(const FloatRect&) override; >+#if USE(CG) > void drawPath(const Path&) override; >+#endif > > void drawFocusRing(const Path&, float width, float offset, const Color&) override; > void drawFocusRing(const Vector<FloatRect>&, float width, float offset, const Color&) override; >+ >+ void drawIcon(Icon&, const FloatRect&) override; >+ void drawWidget(Widget&, const IntRect&) override; >+ void drawScrollbar(Scrollbar&, const IntRect&) override; >+ void drawTheme(Theme&, ControlPart, ControlStates&, const FloatRect& zoomedRect, float zoomFactor, void* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance) override; > > void save() override; > void restore() override; >@@ -123,7 +129,7 @@ private: > void clipOut(const Path&) override; > void clipPath(const Path&, WindRule) override; > IntRect clipBounds() override; >- void clipToImageBuffer(ImageBuffer&, const FloatRect&) override; >+ void clipToImageBuffer(const NativeImagePtr&, const FloatRect& destRect, const FloatSize& bufferDestinationSize) override; > > void applyDeviceScaleFactor(float) override; > >@@ -133,7 +139,7 @@ private: > void willAppendItem(const Item&); > > FloatRect extentFromLocalBounds(const FloatRect&) const; >- void updateItemExtent(DrawingItem&) const; >+ void updateItemExtent(GeometryItem&) const; > > const AffineTransform& ctm() const; > const FloatRect& clipBounds() const; >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp b/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp >index 8feaa2f5d75328e436bf9d88b8dc05bac1c2e1f3..f31c85b28ee9c53ce61ef8f3a8d33cdc2712e62f 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp >@@ -40,8 +40,6 @@ Replayer::Replayer(GraphicsContext& context, const DisplayList& displayList) > { > } > >-Replayer::~Replayer() = default; >- > std::unique_ptr<DisplayList> Replayer::replay(const FloatRect& initialClip, bool trackReplayList) > { > LOG_WITH_STREAM(DisplayLists, stream << "\nReplaying with clip " << initialClip); >@@ -51,13 +49,15 @@ std::unique_ptr<DisplayList> Replayer::replay(const FloatRect& initialClip, bool > if (UNLIKELY(trackReplayList)) > replayList = std::make_unique<DisplayList>(); > >+ GraphicsContextStateSaver stateSaver(m_context); >+ > size_t numItems = m_displayList.itemCount(); > for (size_t i = 0; i < numItems; ++i) { > auto& item = m_displayList.list()[i].get(); > >- if (!initialClip.isZero() && is<DrawingItem>(item)) { >- const DrawingItem& drawingItem = downcast<DrawingItem>(item); >- if (drawingItem.extentKnown() && !drawingItem.extent().intersects(initialClip)) { >+ if (!initialClip.isZero() && is<GeometryItem>(item)) { >+ const auto& geometryItem = downcast<GeometryItem>(item); >+ if (geometryItem.extentKnown() && !geometryItem.extent().intersects(initialClip)) { > LOG_WITH_STREAM(DisplayLists, stream << "skipping " << i << " " << item); > continue; > } >diff --git a/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h b/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h >index 4f968e846c6576ab5559af1240124116be631a6e..c0319892d5a202816af85f555a7de5c91762de1f 100644 >--- a/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h >+++ b/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h >@@ -40,8 +40,6 @@ class Replayer { > WTF_MAKE_NONCOPYABLE(Replayer); > public: > Replayer(GraphicsContext&, const DisplayList&); >- ~Replayer(); >- > std::unique_ptr<DisplayList> replay(const FloatRect& initialClip = { }, bool trackReplayList = false); > > private: >diff --git a/Source/WebCore/platform/graphics/gtk/IconGtk.cpp b/Source/WebCore/platform/graphics/gtk/IconGtk.cpp >index af185a54cdd49d2046865e693c5a73c94c58b04b..f0ae5cfca19abbfcb9400d8135b34c8f317c303d 100644 >--- a/Source/WebCore/platform/graphics/gtk/IconGtk.cpp >+++ b/Source/WebCore/platform/graphics/gtk/IconGtk.cpp >@@ -113,11 +113,8 @@ RefPtr<Icon> Icon::createIconForFiles(const Vector<String>& filenames) > return 0; > } > >-void Icon::paint(GraphicsContext& context, const FloatRect& rect) >+void Icon::platformPaint(GraphicsContext& context, const FloatRect& rect) const > { >- if (context.paintingDisabled()) >- return; >- > // TODO: Scale/clip the image if necessary. > cairo_t* cr = context.platformContext()->cr(); > cairo_save(cr); >diff --git a/Source/WebCore/platform/graphics/ios/IconIOS.mm b/Source/WebCore/platform/graphics/ios/IconIOS.mm >index cee516e1440e78eb543739ab2a038d87362f7d44..dbd83d57c0e6587af222d7c7a75dbf44ada08993 100644 >--- a/Source/WebCore/platform/graphics/ios/IconIOS.mm >+++ b/Source/WebCore/platform/graphics/ios/IconIOS.mm >@@ -55,11 +55,8 @@ RefPtr<Icon> Icon::createIconForImage(const RetainPtr<CGImageRef>& image) > return adoptRef(new Icon(image)); > } > >-void Icon::paint(GraphicsContext& context, const FloatRect& destRect) >+void Icon::platformPaint(GraphicsContext& context, const FloatRect& destRect) const > { >- if (context.paintingDisabled()) >- return; >- > GraphicsContextStateSaver stateSaver(context); > > float width = CGImageGetWidth(m_cgImage.get()); >diff --git a/Source/WebCore/platform/graphics/mac/IconMac.mm b/Source/WebCore/platform/graphics/mac/IconMac.mm >index 6143b51d43645d5ad48c395af7c4ea26433d7c4a..e850308d0bc85727b950c66c166af7d54ad942f1 100644 >--- a/Source/WebCore/platform/graphics/mac/IconMac.mm >+++ b/Source/WebCore/platform/graphics/mac/IconMac.mm >@@ -91,13 +91,9 @@ RefPtr<Icon> Icon::createIconForUTI(const String& UTI) > return adoptRef(new Icon(image)); > } > >-void Icon::paint(GraphicsContext& context, const FloatRect& rect) >+void Icon::platformPaint(GraphicsContext& context, const FloatRect& rect) const > { >- if (context.paintingDisabled()) >- return; >- > LocalCurrentGraphicsContext localCurrentGC(context); >- > [m_nsImage drawInRect:rect fromRect:NSMakeRect(0, 0, [m_nsImage size].width, [m_nsImage size].height) operation:NSCompositingOperationSourceOver fraction:1.0f]; > } > >diff --git a/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp b/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp >index 9a954e22b94bbae9cb175feafc042fffeb5afe1d..a3e017a5e6bbce027f71961d666be1d0f5ff3fa6 100644 >--- a/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp >+++ b/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp >@@ -570,6 +570,11 @@ void CairoOperationRecorder::drawNativeImage(const NativeImagePtr& image, const > append(createCommand<DrawNativeImage>(RefPtr<cairo_surface_t>(image.get()), destRect, srcRect, compositeOperator, blendMode, orientation, state.imageInterpolationQuality, state.alpha, Cairo::ShadowState(state))); > } > >+void CairoOperationRecorder::drawNativeScaledImage(const NativeImagePtr&, float, const IntPoint&, const IntRect&) >+{ >+ ASSERT_NOT_IMPLEMENTED_YET(); >+} >+ > void CairoOperationRecorder::drawPattern(Image& image, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, CompositeOperator compositeOperator, BlendMode blendMode) > { > struct DrawPattern final : PaintingOperation, OperationData<RefPtr<cairo_surface_t>, IntSize, FloatRect, FloatRect, AffineTransform, FloatPoint, CompositeOperator, BlendMode> { >@@ -631,7 +636,7 @@ void CairoOperationRecorder::drawLine(const FloatPoint& point1, const FloatPoint > append(createCommand<DrawLine>(point1, point2, state.strokeStyle, state.strokeColor, state.strokeThickness, state.shouldAntialias)); > } > >-void CairoOperationRecorder::drawLinesForText(const FloatPoint& point, const DashArray& widths, bool printing, bool doubleUnderlines, float strokeThickness) >+void CairoOperationRecorder::drawLinesForText(const FloatPoint& point, const DashArray& widths, bool printing, bool doubleUnderlines, StrokeStyle strokeStyle) > { > struct DrawLinesForText final : PaintingOperation, OperationData<FloatPoint, DashArray, bool, bool, Color, float> { > virtual ~DrawLinesForText() = default; >@@ -647,7 +652,7 @@ void CairoOperationRecorder::drawLinesForText(const FloatPoint& point, const Das > } > }; > >- UNUSED_PARAM(strokeThickness); >+ UNUSED_PARAM(strokeStyle); > auto& state = graphicsContext().state(); > append(createCommand<DrawLinesForText>(point, widths, printing, doubleUnderlines, state.strokeColor, state.strokeThickness)); > } >@@ -691,10 +696,6 @@ void CairoOperationRecorder::drawEllipse(const FloatRect& rect) > append(createCommand<DrawEllipse>(rect, state.fillColor, state.strokeStyle, state.strokeColor, state.strokeThickness)); > } > >-void CairoOperationRecorder::drawPath(const Path&) >-{ >-} >- > void CairoOperationRecorder::drawFocusRing(const Path& path, float width, float offset, const Color& color) > { > struct DrawFocusRing final : PaintingOperation, OperationData<Path, float, Color> { >@@ -735,6 +736,26 @@ void CairoOperationRecorder::drawFocusRing(const Vector<FloatRect>& rects, float > append(createCommand<DrawFocusRing>(rects, width, color)); > } > >+void CairoOperationRecorder::drawIcon(Icon&, const FloatRect&) >+{ >+ ASSERT_NOT_IMPLEMENTED_YET(); >+} >+ >+void CairoOperationRecorder::drawWidget(Widget&, const IntRect&) >+{ >+ ASSERT_NOT_IMPLEMENTED_YET(); >+} >+ >+void CairoOperationRecorder::drawScrollbar(Scrollbar&, const IntRect&) >+{ >+ ASSERT_NOT_IMPLEMENTED_YET(); >+} >+ >+void CairoOperationRecorder::drawTheme(Theme&, ControlPart, ControlStates&, const FloatRect&, float, void*, float, float, bool, bool) >+{ >+ ASSERT_NOT_IMPLEMENTED_YET(); >+} >+ > void CairoOperationRecorder::save() > { > struct Save final : PaintingOperation, OperationData<> { >@@ -1053,7 +1074,7 @@ IntRect CairoOperationRecorder::clipBounds() > return enclosingIntRect(state.ctmInverse.mapRect(state.clipBounds)); > } > >-void CairoOperationRecorder::clipToImageBuffer(ImageBuffer& buffer, const FloatRect& destRect) >+void CairoOperationRecorder::clipToImageBuffer(const NativeImagePtr& image, const FloatRect& destRect, const FloatSize&) > { > struct ClipToImageBuffer final: PaintingOperation, OperationData<RefPtr<cairo_surface_t>, FloatRect> { > virtual ~ClipToImageBuffer() = default; >@@ -1069,12 +1090,10 @@ void CairoOperationRecorder::clipToImageBuffer(ImageBuffer& buffer, const FloatR > } > }; > >- RefPtr<Image> image = buffer.copyImage(DontCopyBackingStore); > if (!image) > return; > >- if (auto surface = image->nativeImageForCurrentFrame()) >- append(createCommand<ClipToImageBuffer>(RefPtr<cairo_surface_t>(surface.get()), destRect)); >+ append(createCommand<ClipToImageBuffer>(image, destRect)); > } > > void CairoOperationRecorder::applyDeviceScaleFactor(float) >diff --git a/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h b/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h >index dc4849e5cf4a8ca92f39a265cd99c143a98cd530..a8adc753cdc10077c81853a8817f13ab87273d15 100644 >--- a/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h >+++ b/Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h >@@ -68,17 +68,22 @@ private: > WebCore::ImageDrawResult drawTiledImage(WebCore::Image&, const WebCore::FloatRect&, const WebCore::FloatPoint&, const WebCore::FloatSize&, const WebCore::FloatSize&, const WebCore::ImagePaintingOptions&) override; > WebCore::ImageDrawResult drawTiledImage(WebCore::Image&, const WebCore::FloatRect&, const WebCore::FloatRect&, const WebCore::FloatSize&, WebCore::Image::TileRule, WebCore::Image::TileRule, const WebCore::ImagePaintingOptions&) override; > void drawNativeImage(const WebCore::NativeImagePtr&, const WebCore::FloatSize&, const WebCore::FloatRect&, const WebCore::FloatRect&, WebCore::CompositeOperator, WebCore::BlendMode, WebCore::ImageOrientation) override; >+ void drawNativeScaledImage(const WebCore::NativeImagePtr&, float, const WebCore::IntPoint&, const WebCore::IntRect&) override; > void drawPattern(WebCore::Image&, const WebCore::FloatRect&, const WebCore::FloatRect&, const WebCore::AffineTransform&, const WebCore::FloatPoint&, const WebCore::FloatSize&, WebCore::CompositeOperator, WebCore::BlendMode = WebCore::BlendModeNormal) override; > > void drawRect(const WebCore::FloatRect&, float) override; > void drawLine(const WebCore::FloatPoint&, const WebCore::FloatPoint&) override; >- void drawLinesForText(const WebCore::FloatPoint&, const DashArray&, bool, bool, float) override; >+ void drawLinesForText(const WebCore::FloatPoint&, const DashArray&, bool, bool, WebCore::StrokeStyle) override; > void drawLineForDocumentMarker(const WebCore::FloatPoint&, float, WebCore::DocumentMarkerLineStyle) override; > void drawEllipse(const WebCore::FloatRect&) override; >- void drawPath(const WebCore::Path&) override; > > void drawFocusRing(const WebCore::Path&, float, float, const WebCore::Color&) override; > void drawFocusRing(const Vector<WebCore::FloatRect>&, float, float, const WebCore::Color&) override; >+ >+ void drawIcon(WebCore::Icon&, const WebCore::FloatRect&) override; >+ void drawWidget(WebCore::Widget&, const WebCore::IntRect&) override; >+ void drawScrollbar(WebCore::Scrollbar&, const WebCore::IntRect&) override; >+ void drawTheme(WebCore::Theme&, WebCore::ControlPart, WebCore::ControlStates&, const WebCore::FloatRect& zoomedRect, float zoomFactor, void* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance) override; > > void save() override; > void restore() override; >@@ -98,7 +103,7 @@ private: > void clipOut(const WebCore::Path&) override; > void clipPath(const WebCore::Path&, WebCore::WindRule) override; > WebCore::IntRect clipBounds() override; >- void clipToImageBuffer(WebCore::ImageBuffer&, const WebCore::FloatRect&) override; >+ void clipToImageBuffer(const WebCore::NativeImagePtr&, const WebCore::FloatRect&, const WebCore::FloatSize&) override; > > void applyDeviceScaleFactor(float) override; > >diff --git a/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp b/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp >index 029d079cc1c200398a7811e66f3e33e793961bac..1abf4fac13b0ada23adbdf004b11b38a82c22b5e 100644 >--- a/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp >+++ b/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp >@@ -1708,7 +1708,7 @@ void GraphicsContext::drawLinesForText(const FloatPoint& point, const DashArray& > return; > > if (isRecording()) { >- m_displayListRecorder->drawLinesForText(point, widths, printing, doubleLines, strokeThickness()); >+ m_displayListRecorder->drawLinesForText(point, widths, printing, doubleLines, strokeStyle); > return; > } > >diff --git a/Source/WebCore/platform/graphics/win/IconWin.cpp b/Source/WebCore/platform/graphics/win/IconWin.cpp >index 799e34740394063510e954b6af30998e7d25e2ad..18fe6f791275ead59c03423bad8c7d4a82d9cfbf 100644 >--- a/Source/WebCore/platform/graphics/win/IconWin.cpp >+++ b/Source/WebCore/platform/graphics/win/IconWin.cpp >@@ -74,11 +74,8 @@ RefPtr<Icon> Icon::createIconForFiles(const Vector<String>& filenames) > return adoptRef(new Icon(hIcon)); > } > >-void Icon::paint(GraphicsContext& context, const FloatRect& r) >+void Icon::platformPaint(GraphicsContext& context, const FloatRect& r) const > { >- if (context.paintingDisabled()) >- return; >- > LocalWindowsContext windowContext(context, enclosingIntRect(r)); > DrawIconEx(windowContext.hdc(), r.x(), r.y(), m_hIcon, r.width(), r.height(), 0, 0, DI_NORMAL); > } >diff --git a/Source/WebCore/platform/graphics/wpe/IconWPE.cpp b/Source/WebCore/platform/graphics/wpe/IconWPE.cpp >index 76a21da36f36ef91aa17889b8fc119b222e725be..1edb7d9f5c6d139ae8f6751c1cca325d294e2767 100644 >--- a/Source/WebCore/platform/graphics/wpe/IconWPE.cpp >+++ b/Source/WebCore/platform/graphics/wpe/IconWPE.cpp >@@ -30,7 +30,7 @@ namespace WebCore { > > Icon::~Icon() = default; > >-void Icon::paint(GraphicsContext&, const FloatRect&) >+void Icon::platformPaint(GraphicsContext&, const FloatRect&) const > { > } > >diff --git a/Source/WebCore/platform/gtk/WidgetGtk.cpp b/Source/WebCore/platform/gtk/WidgetGtk.cpp >index 874129339793ad2e6b3dad9f719fa0605b4520ad..f38a0a4e15cb19dd5c138b9c3a1c5a2e3ae9665d 100644 >--- a/Source/WebCore/platform/gtk/WidgetGtk.cpp >+++ b/Source/WebCore/platform/gtk/WidgetGtk.cpp >@@ -80,7 +80,12 @@ void Widget::hide() > gtk_widget_hide(platformWidget()); > } > >-void Widget::paint(GraphicsContext&, const IntRect&, SecurityOriginPaintPolicy) >+void Widget::paint(GraphicsContext& context, const IntRect& rect, SecurityOriginPaintPolicy) >+{ >+ context.drawWidget(*this, rect); >+} >+ >+void Widget::platformPaint(GraphicsContext&, const IntRect&) > { > } > >diff --git a/Source/WebCore/platform/ios/WidgetIOS.mm b/Source/WebCore/platform/ios/WidgetIOS.mm >index 8b1e8b54b5ce270f248daeced524f772a154e9eb..dcc6a490520994aa4570212ce4bc2ddbb71ef61f 100644 >--- a/Source/WebCore/platform/ios/WidgetIOS.mm >+++ b/Source/WebCore/platform/ios/WidgetIOS.mm >@@ -141,14 +141,16 @@ NSView* Widget::getOuterView() const > return view; > } > >-void Widget::paint(GraphicsContext& p, const IntRect& r, SecurityOriginPaintPolicy) >+void Widget::paint(GraphicsContext& context, const IntRect& rect, SecurityOriginPaintPolicy) > { >- if (p.paintingDisabled()) >- return; >+ context.drawWidget(*this, rect); >+} > >+void Widget::platformPaint(GraphicsContext& context, const IntRect& rect) >+{ > NSView *view = getOuterView(); > >- CGContextRef cgContext = p.platformContext(); >+ CGContextRef cgContext = context.platformContext(); > CGContextSaveGState(cgContext); > > NSRect viewFrame = [view frame]; >@@ -156,7 +158,7 @@ void Widget::paint(GraphicsContext& p, const IntRect& r, SecurityOriginPaintPoli > CGContextTranslateCTM(cgContext, viewFrame.origin.x - viewBounds.origin.x, viewFrame.origin.y - viewBounds.origin.y); > > BEGIN_BLOCK_OBJC_EXCEPTIONS; >- [view displayRectIgnoringOpacity:[view convertRect:r fromView:[view superview]] inContext:cgContext]; >+ [view displayRectIgnoringOpacity:[view convertRect:rect fromView:[view superview]] inContext:cgContext]; > END_BLOCK_OBJC_EXCEPTIONS; > > CGContextRestoreGState(cgContext); >diff --git a/Source/WebCore/platform/mac/ThemeMac.h b/Source/WebCore/platform/mac/ThemeMac.h >index 49028f1b43c73c35cc31370a7df4e98414fdc626..e9f303d3d1bfadf17b67d8d36e5e8b21574d6f1e 100644 >--- a/Source/WebCore/platform/mac/ThemeMac.h >+++ b/Source/WebCore/platform/mac/ThemeMac.h >@@ -53,7 +53,7 @@ private: > > bool controlRequiresPreWhiteSpace(ControlPart part) const final { return part == PushButtonPart; } > >- void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float zoomFactor, ScrollView*, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance) final; >+ void platformPaint(GraphicsContext&, ControlPart, ControlStates&, const FloatRect& zoomedRect, float zoomFactor, void* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance) final; > void inflateControlPaintRect(ControlPart, const ControlStates&, FloatRect&, float zoomFactor) const final; > > bool userPrefersReducedMotion() const final; >diff --git a/Source/WebCore/platform/mac/ThemeMac.mm b/Source/WebCore/platform/mac/ThemeMac.mm >index 4831fff4f88ace14cfd0fef3ea7b81b784377d7a..d9238560196dd369e4878fb27e26269f342f5d3f 100644 >--- a/Source/WebCore/platform/mac/ThemeMac.mm >+++ b/Source/WebCore/platform/mac/ThemeMac.mm >@@ -387,7 +387,7 @@ static bool drawCellFocusRing(NSCell *cell, NSRect cellFrame, NSView *controlVie > return false; > } > >-static void paintToggleButton(ControlPart buttonType, ControlStates& controlStates, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor) >+static void paintToggleButton(GraphicsContext& context, ControlPart buttonType, ControlStates& controlStates, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor) > { > BEGIN_BLOCK_OBJC_EXCEPTIONS > >@@ -520,7 +520,7 @@ static NSButtonCell *button(ControlPart part, const ControlStates& controlStates > return cell; > } > >-static void paintButton(ControlPart part, ControlStates& controlStates, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor) >+static void paintButton(GraphicsContext& context, ControlPart part, ControlStates& controlStates, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor) > { > BEGIN_BLOCK_OBJC_EXCEPTIONS > >@@ -596,7 +596,7 @@ static NSControlSize stepperControlSizeForFont(const FontCascade& font) > return NSControlSizeMini; > } > >-static void paintStepper(ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView*) >+static void paintStepper(GraphicsContext& context, ControlStates& states, const FloatRect& zoomedRect, float zoomFactor, ScrollView*) > { > // We don't use NSStepperCell because there are no ways to draw an > // NSStepperCell with the up button highlighted. >@@ -848,25 +848,25 @@ void ThemeMac::inflateControlPaintRect(ControlPart part, const ControlStates& st > END_BLOCK_OBJC_EXCEPTIONS > } > >-void ThemeMac::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance) >+void ThemeMac::platformPaint(GraphicsContext& context, ControlPart part, ControlStates& states, const FloatRect& zoomedRect, float zoomFactor, void* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance) > { > LocalDefaultSystemAppearance localAppearance(useSystemAppearance, useDarkAppearance); > > switch (part) { > case CheckboxPart: >- paintToggleButton(part, states, context, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor); >+ paintToggleButton(context, part, states, zoomedRect, zoomFactor, reinterpret_cast<ScrollView*>(scrollView), deviceScaleFactor, pageScaleFactor); > break; > case RadioPart: >- paintToggleButton(part, states, context, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor); >+ paintToggleButton(context, part, states, zoomedRect, zoomFactor, reinterpret_cast<ScrollView*>(scrollView), deviceScaleFactor, pageScaleFactor); > break; > case PushButtonPart: > case DefaultButtonPart: > case ButtonPart: > case SquareButtonPart: >- paintButton(part, states, context, zoomedRect, zoomFactor, scrollView, deviceScaleFactor, pageScaleFactor); >+ paintButton(context, part, states, zoomedRect, zoomFactor, reinterpret_cast<ScrollView*>(scrollView), deviceScaleFactor, pageScaleFactor); > break; > case InnerSpinButtonPart: >- paintStepper(states, context, zoomedRect, zoomFactor, scrollView); >+ paintStepper(context, states, zoomedRect, zoomFactor, reinterpret_cast<ScrollView*>(scrollView)); > break; > default: > break; >diff --git a/Source/WebCore/platform/mac/WidgetMac.mm b/Source/WebCore/platform/mac/WidgetMac.mm >index 996c19d550f9131fa02360b657f88be9f9e666bb..b8a7fc932066c8192ab2bc8ee3705978f9e085e5 100644 >--- a/Source/WebCore/platform/mac/WidgetMac.mm >+++ b/Source/WebCore/platform/mac/WidgetMac.mm >@@ -186,9 +186,9 @@ NSView *Widget::getOuterView() const > return view; > } > >-void Widget::paint(GraphicsContext& p, const IntRect& r, SecurityOriginPaintPolicy) >+void Widget::paint(GraphicsContext& context, const IntRect& rect, SecurityOriginPaintPolicy) > { >- if (p.paintingDisabled()) >+ if (context.paintingDisabled()) > return; > NSView *view = getOuterView(); > >@@ -202,11 +202,17 @@ void Widget::paint(GraphicsContext& p, const IntRect& r, SecurityOriginPaintPoli > #endif > return; > } >- >+ >+ context.drawWidget(*this, rect); >+} >+ >+void Widget::platformPaint(GraphicsContext& context, const IntRect& rect) >+{ > // Take a reference to this Widget, because sending messages to the views can invoke arbitrary > // code, which can deref it. > Ref<Widget> protectedThis(*this); > >+ NSView *view = getOuterView(); > NSGraphicsContext *currentContext = [NSGraphicsContext currentContext]; > #pragma clang diagnostic push > #pragma clang diagnostic ignored "-Wdeprecated-declarations" >@@ -214,7 +220,7 @@ void Widget::paint(GraphicsContext& p, const IntRect& r, SecurityOriginPaintPoli > #pragma clang diagnostic pop > // This is the common case of drawing into a window or an inclusive layer, or printing. > BEGIN_BLOCK_OBJC_EXCEPTIONS; >- [view displayRectIgnoringOpacity:[view convertRect:r fromView:[view superview]]]; >+ [view displayRectIgnoringOpacity:[view convertRect:rect fromView:[view superview]]]; > END_BLOCK_OBJC_EXCEPTIONS; > return; > } >@@ -237,7 +243,7 @@ void Widget::paint(GraphicsContext& p, const IntRect& r, SecurityOriginPaintPoli > scrollView = 0; > } > >- CGContextRef cgContext = p.platformContext(); >+ CGContextRef cgContext = context.platformContext(); > #pragma clang diagnostic push > #pragma clang diagnostic ignored "-Wdeprecated-declarations" > ASSERT(cgContext == [currentContext graphicsPort]); >@@ -259,7 +265,7 @@ void Widget::paint(GraphicsContext& p, const IntRect& r, SecurityOriginPaintPoli > #pragma clang diagnostic ignored "-Wdeprecated-declarations" > NSGraphicsContext *nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:cgContext flipped:NO]; > #pragma clang diagnostic pop >- [view displayRectIgnoringOpacity:[view convertRect:r fromView:[view superview]] inContext:nsContext]; >+ [view displayRectIgnoringOpacity:[view convertRect:rect fromView:[view superview]] inContext:nsContext]; > } > END_BLOCK_OBJC_EXCEPTIONS; > >diff --git a/Source/WebCore/platform/text/TextFlags.h b/Source/WebCore/platform/text/TextFlags.h >index f8cb3bd26674651e6ace0682db0af8ebd5f89f35..ecfe17bb21935fdf5ddfcf6ab268d17f6af2e9a0 100644 >--- a/Source/WebCore/platform/text/TextFlags.h >+++ b/Source/WebCore/platform/text/TextFlags.h >@@ -25,6 +25,8 @@ > > #pragma once > >+#include <wtf/text/TextStream.h> >+ > namespace WebCore { > > enum class TextRenderingMode : uint8_t { >@@ -40,6 +42,12 @@ enum class FontSmoothingMode : uint8_t { > Antialiased, > SubpixelAntialiased > }; >+ >+inline WTF::TextStream& operator<<(WTF::TextStream& ts, const FontSmoothingMode&) >+{ >+ // FIXME: dump the FontSmoothingMode to the TextStream. >+ return ts; >+} > > // This setting is used to provide ways of switching between multiple rendering modes that may have different > // metrics. It is used to switch between CG and GDI text on Windows. >diff --git a/Source/WebCore/platform/win/WidgetWin.cpp b/Source/WebCore/platform/win/WidgetWin.cpp >index 8bdc023a43766d45f3c1a9fca8ce093ef935d7b9..a51e4f175942d8bbe84e7a37e19bad682691e3c8 100644 >--- a/Source/WebCore/platform/win/WidgetWin.cpp >+++ b/Source/WebCore/platform/win/WidgetWin.cpp >@@ -75,7 +75,12 @@ void Widget::setCursor(const Cursor& cursor) > view->hostWindow()->setCursor(cursor); > } > >-void Widget::paint(GraphicsContext&, const IntRect&, SecurityOriginPaintPolicy) >+void Widget::paint(GraphicsContext& context, const IntRect& rect, SecurityOriginPaintPolicy) >+{ >+ context.drawWidget(*this, rect); >+} >+ >+void Widget::platformPaint(GraphicsContext&, const IntRect&) > { > } > >diff --git a/Source/WebCore/platform/wpe/ThemeWPE.cpp b/Source/WebCore/platform/wpe/ThemeWPE.cpp >index e22a2947ee727aaf80db706ab767a7e6a1845f92..340a0ada0b34ae5ec7cfda006cf8485dce97e1ee 100644 >--- a/Source/WebCore/platform/wpe/ThemeWPE.cpp >+++ b/Source/WebCore/platform/wpe/ThemeWPE.cpp >@@ -57,24 +57,24 @@ LengthSize ThemeWPE::controlSize(ControlPart part, const FontCascade& fontCascad > return Theme::controlSize(part, fontCascade, zoomedSize, zoomFactor); > } > >-void ThemeWPE::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView*, float, float, bool, bool) >+void ThemeWPE::platformPaint(GraphicsContext& context, ControlPart part, ControlStates& states, const FloatRect& zoomedRect, float zoomFactor, void* , float, float, bool, bool) > { > switch (part) { > case CheckboxPart: >- paintCheckbox(states, context, zoomedRect, zoomFactor); >+ paintCheckbox(context, states, zoomedRect, zoomFactor); > break; > case RadioPart: >- paintRadio(states, context, zoomedRect, zoomFactor); >+ paintRadio(context, states, zoomedRect, zoomFactor); > break; > case PushButtonPart: >- paintButton(states, context, zoomedRect, zoomFactor); >+ paintButton(context, states, zoomedRect, zoomFactor); > break; > default: > break; > } > } > >-void ThemeWPE::paintCheckbox(ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float) >+void ThemeWPE::paintCheckbox(GraphicsContext& context, ControlStates& states, const FloatRect& zoomedRect, float) > { > GraphicsContextStateSaver stateSaver(context); > >@@ -103,7 +103,7 @@ void ThemeWPE::paintCheckbox(ControlStates& states, GraphicsContext& context, co > } > } > >-void ThemeWPE::paintRadio(ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float) >+void ThemeWPE::paintRadio(GraphicsContext& context, ControlStates& states, const FloatRect& zoomedRect, float) > { > GraphicsContextStateSaver stateSaver(context); > >@@ -129,7 +129,7 @@ void ThemeWPE::paintRadio(ControlStates& states, GraphicsContext& context, const > } > } > >-void ThemeWPE::paintButton(ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float) >+void ThemeWPE::paintButton(GraphicsContext& context, ControlStates& states, const FloatRect& zoomedRect, float) > { > GraphicsContextStateSaver stateSaver(context); > >diff --git a/Source/WebCore/platform/wpe/ThemeWPE.h b/Source/WebCore/platform/wpe/ThemeWPE.h >index b176a802f2a98f4fa0c01baa67f598dc08ddc723..414ae0b210c9c6c27fcfb2d286bc56ca206d23b6 100644 >--- a/Source/WebCore/platform/wpe/ThemeWPE.h >+++ b/Source/WebCore/platform/wpe/ThemeWPE.h >@@ -33,11 +33,11 @@ class ThemeWPE final : public Theme { > private: > LengthSize controlSize(ControlPart, const FontCascade&, const LengthSize&, float) const final; > >- void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float, ScrollView*, float, float, bool, bool) final; >+ void platformPaint(GraphicsContext&, ControlPart, ControlStates&, const FloatRect&, float, void*, float, float, bool, bool) final; > >- void paintCheckbox(ControlStates&, GraphicsContext&, const FloatRect&, float); >- void paintRadio(ControlStates&, GraphicsContext&, const FloatRect&, float); >- void paintButton(ControlStates&, GraphicsContext&, const FloatRect&, float); >+ void paintCheckbox(GraphicsContext&, ControlStates&, const FloatRect&, float); >+ void paintRadio(GraphicsContext&, ControlStates&, const FloatRect&, float); >+ void paintButton(GraphicsContext&, ControlStates&, const FloatRect&, float); > }; > > } // namespace WebCore >diff --git a/Source/WebCore/platform/wpe/WidgetWPE.cpp b/Source/WebCore/platform/wpe/WidgetWPE.cpp >index 5f66330c523987a670850004b3989ccac640fb5d..9453385d87aeacd11c07a19942789c3b352b79af 100644 >--- a/Source/WebCore/platform/wpe/WidgetWPE.cpp >+++ b/Source/WebCore/platform/wpe/WidgetWPE.cpp >@@ -52,7 +52,12 @@ IntRect Widget::frameRect() const > return m_frame; > } > >-void Widget::paint(GraphicsContext&, const IntRect&, SecurityOriginPaintPolicy) >+void Widget::paint(GraphicsContext& context, const IntRect& rect, SecurityOriginPaintPolicy) >+{ >+ context.drawWidget(*this, rect); >+} >+ >+void Widget::platformPaint(GraphicsContext&, const IntRect&) > { > notImplemented(); > } >diff --git a/Source/WebCore/rendering/PaintPhase.h b/Source/WebCore/rendering/PaintPhase.h >index 37dc98c875206ddcb0320b6710c845ae8123a623..cfe35af7ff5c69854fe2fc29a6978362d3e0fa2e 100644 >--- a/Source/WebCore/rendering/PaintPhase.h >+++ b/Source/WebCore/rendering/PaintPhase.h >@@ -49,7 +49,8 @@ enum PaintPhase { > PaintPhaseCollapsedTableBorders, > PaintPhaseTextClip, > PaintPhaseMask, >- PaintPhaseClippingMask >+ PaintPhaseClippingMask, >+ PaintPhaseMax > }; > > enum PaintBehaviorFlags { >diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp >index 70c228f5b67b5d3a7d0c4c457667ef19629c1fb5..ebf2d7441f957474008bd81acf5c35b29244943d 100644 >--- a/Source/WebCore/rendering/RenderBoxModelObject.cpp >+++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp >@@ -981,11 +981,7 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co > > auto interpolation = chooseInterpolationQuality(context, *image, &bgLayer, geometry.tileSize()); > auto decodingMode = decodingModeForImageDraw(*image, paintInfo); >- auto drawResult = context.drawTiledImage(*image, geometry.destRect(), toLayoutPoint(geometry.relativePhase()), geometry.tileSize(), geometry.spaceSize(), ImagePaintingOptions(compositeOp, bgLayer.blendMode(), decodingMode, ImageOrientationDescription(), interpolation)); >- if (drawResult == ImageDrawResult::DidRequestDecoding) { >- ASSERT(bgImage->isCachedImage()); >- bgImage->cachedImage()->addClientWaitingForAsyncDecoding(*this); >- } >+ context.drawTiledImage(*image, geometry.destRect(), toLayoutPoint(geometry.relativePhase()), geometry.tileSize(), geometry.spaceSize(), ImagePaintingOptions(compositeOp, bgLayer.blendMode(), decodingMode, this, ImageOrientationDescription(), interpolation)); > } > } > >diff --git a/Source/WebCore/rendering/RenderImage.cpp b/Source/WebCore/rendering/RenderImage.cpp >index 973fa0120384030339124699ed2a8dcb4a9020d9..fdb98edf9020617e706dd84b494d615c908f8db8 100644 >--- a/Source/WebCore/rendering/RenderImage.cpp >+++ b/Source/WebCore/rendering/RenderImage.cpp >@@ -617,9 +617,7 @@ ImageDrawResult RenderImage::paintIntoRect(PaintInfo& paintInfo, const FloatRect > > ImageOrientationDescription orientationDescription(shouldRespectImageOrientation(), style().imageOrientation()); > auto decodingMode = decodingModeForImageDraw(*image, paintInfo); >- auto drawResult = paintInfo.context().drawImage(*img, rect, ImagePaintingOptions(compositeOperator, BlendModeNormal, decodingMode, orientationDescription, interpolation)); >- if (drawResult == ImageDrawResult::DidRequestDecoding) >- imageResource().cachedImage()->addClientWaitingForAsyncDecoding(*this); >+ auto drawResult = paintInfo.context().drawImage(*img, rect, ImagePaintingOptions(compositeOperator, BlendModeNormal, decodingMode, this, orientationDescription, interpolation)); > > #if USE(SYSTEM_PREVIEW) > if (imageElement && imageElement->isSystemPreviewImage() && drawResult == ImageDrawResult::DidDraw && RuntimeEnabledFeatures::sharedFeatures().systemPreviewEnabled()) >diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp >index 8291ef99c0405779e3314e4df156beed865efda4..f22283049f24724314044d14848b594d2953373d 100644 >--- a/Source/WebCore/rendering/RenderLayer.cpp >+++ b/Source/WebCore/rendering/RenderLayer.cpp >@@ -95,6 +95,7 @@ > #include "RenderIterator.h" > #include "RenderLayerBacking.h" > #include "RenderLayerCompositor.h" >+#include "RenderLayerContext.h" > #include "RenderLayerFilterInfo.h" > #include "RenderMarquee.h" > #include "RenderMultiColumnFlow.h" >@@ -280,7 +281,6 @@ RenderLayer::RenderLayer(RenderLayerModelObject& rendererLayerModelObject) > , m_hasOutOfFlowPositionedDescendantDirty(true) > , m_needsCompositedScrolling(false) > , m_descendantsAreContiguousInStackingOrder(false) >- , m_usedTransparency(false) > , m_paintingInsideReflection(false) > , m_inOverflowRelayout(false) > , m_repaintStatus(NeedsNormalRepaint) >@@ -1799,7 +1799,7 @@ static LayoutRect paintingExtent(const RenderLayer& currentLayer, const RenderLa > > void RenderLayer::beginTransparencyLayers(GraphicsContext& context, const LayerPaintingInfo& paintingInfo, const LayoutRect& dirtyRect) > { >- if (context.paintingDisabled() || (paintsWithTransparency(paintingInfo.paintBehavior) && m_usedTransparency)) >+ if (context.paintingDisabled() || (paintsWithTransparency(paintingInfo.paintBehavior) && m_contextForTransparencyLayer)) > return; > > RenderLayer* ancestor = transparentPaintingAncestor(); >@@ -1808,7 +1808,7 @@ void RenderLayer::beginTransparencyLayers(GraphicsContext& context, const LayerP > > if (paintsWithTransparency(paintingInfo.paintBehavior)) { > ASSERT(isStackingContext()); >- m_usedTransparency = true; >+ m_contextForTransparencyLayer = &context; > context.save(); > LayoutRect adjustedClipRect = paintingExtent(*this, paintingInfo.rootLayer, dirtyRect, paintingInfo.paintBehavior); > adjustedClipRect.move(paintingInfo.subpixelOffset); >@@ -1835,6 +1835,16 @@ void RenderLayer::beginTransparencyLayers(GraphicsContext& context, const LayerP > } > } > >+void RenderLayer::endTransparencyLayers() >+{ >+ if (!m_contextForTransparencyLayer) >+ return; >+ >+ m_contextForTransparencyLayer->endTransparencyLayer(); >+ m_contextForTransparencyLayer->restore(); >+ m_contextForTransparencyLayer = nullptr; >+} >+ > #if PLATFORM(IOS) > void RenderLayer::willBeDestroyed() > { >@@ -4382,40 +4392,18 @@ void RenderLayer::paintLayerContents(GraphicsContext& context, const LayerPainti > (isPaintingOverflowContents) ? IgnoreOverflowClip : RespectOverflowClip, offsetFromRoot); > updatePaintingInfoForFragments(layerFragments, localPaintingInfo, localPaintFlags, shouldPaintContent, offsetFromRoot); > } >- >- if (isPaintingCompositedBackground) { >- // Paint only the backgrounds for all of the fragments of the layer. >- if (shouldPaintContent && !selectionOnly) { >- paintBackgroundForFragments(layerFragments, currentContext, context, paintingInfo.paintDirtyRect, haveTransparency, >- localPaintingInfo, paintBehavior, subtreePaintRootForRenderer); >- } >- } > >- // Now walk the sorted list of children with negative z-indices. >- if ((isPaintingScrollingContent && isPaintingOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackground)) >- paintList(negZOrderList(), currentContext, localPaintingInfo, localPaintFlags); >- >- if (isPaintingCompositedForeground) { >- if (shouldPaintContent) { >- paintForegroundForFragments(layerFragments, currentContext, context, paintingInfo.paintDirtyRect, haveTransparency, >- localPaintingInfo, paintBehavior, subtreePaintRootForRenderer); >- } >- } >- >- if (shouldPaintOutline) >- paintOutlineForFragments(layerFragments, currentContext, localPaintingInfo, paintBehavior, subtreePaintRootForRenderer); >- >- if (isPaintingCompositedForeground) { >- // Paint any child layers that have overflow. >- paintList(m_normalFlowList.get(), currentContext, localPaintingInfo, localPaintFlags); >- >- // Now walk the sorted list of children with positive z-indices. >- paintList(posZOrderList(), currentContext, localPaintingInfo, localPaintFlags); >+ if (true) { >+ RenderLayerContext renderLayerContext(currentContext, paintingInfo.paintDirtyRect); >+ paintCompositedPhasesMultiplePasses(layerFragments, renderLayerContext, context, paintingInfo.paintDirtyRect, localPaintingInfo, localPaintFlags, >+ paintBehavior, subtreePaintRootForRenderer); >+ } else { >+ RenderLayerDisplayListContext renderLayerContext(currentContext, context, paintingInfo.paintDirtyRect); >+ paintCompositedPhasesMultiplePasses(layerFragments, renderLayerContext, context, paintingInfo.paintDirtyRect, localPaintingInfo, localPaintFlags, >+ paintBehavior, subtreePaintRootForRenderer); >+ renderLayerContext.replay(); > } > >- if (isPaintingOverlayScrollbars && hasScrollbars()) >- paintOverflowControlsForFragments(layerFragments, currentContext, localPaintingInfo); >- > if (filterContext) { > // When we called collectFragments() last time, paintDirtyRect was reset to represent the filter bounds. > // Now we need to compute the backgroundRect uncontaminated by filters, in order to clip the filtered result. >@@ -4459,11 +4447,7 @@ void RenderLayer::paintLayerContents(GraphicsContext& context, const LayerPainti > } > > // End our transparency layer >- if (haveTransparency && m_usedTransparency && !m_paintingInsideReflection) { >- context.endTransparencyLayer(); >- context.restore(); >- m_usedTransparency = false; >- } >+ endTransparencyLayers(); > > // Re-set this to whatever it was before we painted the layer. > if (needToAdjustSubpixelQuantization) >@@ -4835,6 +4819,53 @@ void RenderLayer::paintOutlineForFragments(const LayerFragments& layerFragments, > } > } > >+void RenderLayer::paintCompositedPhasesMultiplePasses(const LayerFragments& layerFragments, RenderLayerContext& renderLayerContext, GraphicsContext& context, >+ const LayoutRect& paintDirtyRect, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, PaintBehavior paintBehavior, RenderObject* subtreePaintRootForRenderer) >+{ >+ bool haveTransparency = paintFlags & PaintLayerHaveTransparency; >+ bool isSelfPaintingLayer = this->isSelfPaintingLayer(); >+ bool isPaintingCompositedBackground = paintFlags & PaintLayerPaintingCompositingBackgroundPhase; >+ bool isPaintingCompositedForeground = paintFlags & PaintLayerPaintingCompositingForegroundPhase; >+ bool isPaintingScrollingContent = paintFlags & PaintLayerPaintingCompositingScrollingPhase; >+ bool isPaintingOverlayScrollbars = paintFlags & PaintLayerPaintingOverlayScrollbars; >+ bool isPaintingOverflowContents = paintFlags & PaintLayerPaintingOverflowContents; >+ >+ bool shouldPaintOutline = isSelfPaintingLayer && !isPaintingOverlayScrollbars >+ && ((isPaintingScrollingContent && isPaintingCompositedBackground) >+ || (!isPaintingScrollingContent && isPaintingCompositedForeground)); >+ bool shouldPaintContent = m_hasVisibleContent && isSelfPaintingLayer && !isPaintingOverlayScrollbars; >+ bool selectionOnly = paintingInfo.paintBehavior & PaintBehaviorSelectionOnly; >+ >+ // Paint only the backgrounds for all of the fragments of the layer. >+ if (isPaintingCompositedBackground && shouldPaintContent && !selectionOnly) >+ paintBackgroundForFragments(layerFragments, renderLayerContext.graphicsContext(PaintPhaseBlockBackground), context, paintDirtyRect, haveTransparency, paintingInfo, paintBehavior, subtreePaintRootForRenderer); >+ >+ // Now walk the sorted list of children with negative z-indices. >+ if ((isPaintingScrollingContent && isPaintingOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackground)) >+ paintList(negZOrderList(), renderLayerContext.graphicsContext(FragmentPhaseNegZOrderList), paintingInfo, paintFlags); >+ >+ if (isPaintingCompositedForeground && shouldPaintContent) >+ paintForegroundForFragments(layerFragments, renderLayerContext.graphicsContext(PaintPhaseForeground), context, paintDirtyRect, haveTransparency, paintingInfo, paintBehavior, subtreePaintRootForRenderer); >+ >+ if (shouldPaintOutline) >+ paintOutlineForFragments(layerFragments, renderLayerContext.graphicsContext(PaintPhaseSelfOutline), paintingInfo, paintBehavior, subtreePaintRootForRenderer); >+ >+ if (isPaintingCompositedForeground) { >+ // Paint any child layers that have overflow. >+ paintList(m_normalFlowList.get(), renderLayerContext.graphicsContext(FragmentPhaseNormalFlowList), paintingInfo, paintFlags); >+ >+ // Now walk the sorted list of children with positive z-indices. >+ paintList(posZOrderList(), renderLayerContext.graphicsContext(FragmentPhasePosZOrderList), paintingInfo, paintFlags); >+ } >+ >+ if (isPaintingOverlayScrollbars && hasScrollbars()) >+ paintOverflowControlsForFragments(layerFragments, renderLayerContext.graphicsContext(FragmentPhaseOverflowControls), paintingInfo); >+ >+ // End our transparency layer if needed. >+ if (m_contextForTransparencyLayer != &context) >+ endTransparencyLayers(); >+} >+ > void RenderLayer::paintMaskForFragments(const LayerFragments& layerFragments, GraphicsContext& context, const LayerPaintingInfo& localPaintingInfo, > PaintBehavior paintBehavior, RenderObject* subtreePaintRootForRenderer) > { >diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h >index d7fd0a8c6a6295f012f807e5416f15a76fc1d69d..9fa68405772152dcd4025256b06b699e5dbc4dc3 100644 >--- a/Source/WebCore/rendering/RenderLayer.h >+++ b/Source/WebCore/rendering/RenderLayer.h >@@ -72,6 +72,7 @@ class RenderFragmentedFlow; > class RenderGeometryMap; > class RenderLayerBacking; > class RenderLayerCompositor; >+class RenderLayerContext; > class RenderMarquee; > class RenderReplica; > class RenderScrollbarPart; >@@ -847,6 +848,8 @@ private: > const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer); > void paintForegroundForFragmentsWithPhase(PaintPhase, const LayerFragments&, GraphicsContext&, const LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer); > void paintOutlineForFragments(const LayerFragments&, GraphicsContext&, const LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer); >+ void paintCompositedPhasesMultiplePasses(const LayerFragments&, RenderLayerContext&, GraphicsContext&, const LayoutRect&, const LayerPaintingInfo&, >+ PaintLayerFlags, PaintBehavior, RenderObject*); > void paintOverflowControlsForFragments(const LayerFragments&, GraphicsContext&, const LayerPaintingInfo&); > void paintMaskForFragments(const LayerFragments&, GraphicsContext&, const LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer); > void paintChildClippingMaskForFragments(const LayerFragments&, GraphicsContext&, const LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer); >@@ -854,6 +857,7 @@ private: > > RenderLayer* transparentPaintingAncestor(); > void beginTransparencyLayers(GraphicsContext&, const LayerPaintingInfo&, const LayoutRect& dirtyRect); >+ void endTransparencyLayers(); > > RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result, > const LayoutRect& hitTestRect, const HitTestLocation&, bool appliedTransform, >@@ -1057,9 +1061,6 @@ private: > // able to safely become a stacking context. > bool m_descendantsAreContiguousInStackingOrder : 1; > >- bool m_usedTransparency : 1; // Tracks whether we need to close a transparent layer, i.e., whether >- // we ended up painting this layer or any descendants (and therefore need to >- // blend). > bool m_paintingInsideReflection : 1; // A state bit tracking if we are painting inside a replica. > bool m_inOverflowRelayout : 1; > unsigned m_repaintStatus : 2; // RepaintStatus >@@ -1166,6 +1167,11 @@ private: > // Pointer to the enclosing RenderLayer that caused us to be paginated. It is 0 if we are not paginated. > WeakPtr<RenderLayer> m_enclosingPaginationLayer; > >+ >+ // Tracks whether we need to close a transparent layer, i.e., whether we ended up painting this layer or >+ // any descendants (and therefore need to blend). >+ GraphicsContext *m_contextForTransparencyLayer { nullptr }; >+ > IntRect m_blockSelectionGapsBounds; > > std::unique_ptr<RenderLayerBacking> m_backing; >diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp >index 1c625511deaf73dcfc1b371bf705b807576eab1f..5856195376fe6088d42355b9d9e71950e7f9e638 100644 >--- a/Source/WebCore/rendering/RenderLayerBacking.cpp >+++ b/Source/WebCore/rendering/RenderLayerBacking.cpp >@@ -2575,7 +2575,7 @@ void RenderLayerBacking::paintIntoLayer(const GraphicsLayer* graphicsLayer, Grap > > compositor().didPaintBacking(this); > >- ASSERT(!m_owningLayer.m_usedTransparency); >+ ASSERT(!m_owningLayer.m_contextForTransparencyLayer); > } > > // Up-call from compositing layer drawing callback. >diff --git a/Source/WebCore/rendering/RenderLayerContext.h b/Source/WebCore/rendering/RenderLayerContext.h >new file mode 100644 >index 0000000000000000000000000000000000000000..96f3b2bd93bf142070a06306a4a8dd28c2c643e2 >--- /dev/null >+++ b/Source/WebCore/rendering/RenderLayerContext.h >@@ -0,0 +1,138 @@ >+/* >+ * Copyright (C) 2018 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 "DisplayListRecorder.h" >+#include "DisplayListReplayer.h" >+ >+namespace WebCore { >+ >+class GraphicsContext; >+ >+enum FragmentPhase { >+ FragmentPhaseMin = PaintPhaseMax, >+ FragmentPhaseNegZOrderList = FragmentPhaseMin, >+ FragmentPhaseNormalFlowList, >+ FragmentPhasePosZOrderList, >+ FragmentPhaseOverflowControls, >+ FragmentPhaseMax >+}; >+ >+class RenderLayerContext { >+public: >+ RenderLayerContext(GraphicsContext& drawingContext, const FloatRect& clipRect) >+ : m_drawingContext(drawingContext) >+ , m_clipRect(clipRect) >+ { >+ } >+ >+ virtual ~RenderLayerContext() = default; >+ virtual GraphicsContext& graphicsContext(PaintPhase) { return m_drawingContext; } >+ virtual GraphicsContext& graphicsContext(FragmentPhase) { return m_drawingContext; } >+ >+protected: >+ GraphicsContext& m_drawingContext; >+ FloatRect m_clipRect; >+}; >+ >+class RenderLayerDisplayListContext : public RenderLayerContext { >+public: >+ RenderLayerDisplayListContext(GraphicsContext& drawingContext, GraphicsContext& referenceContext, const FloatRect& clipRect) >+ : RenderLayerContext(drawingContext, clipRect) >+ , m_referenceContext(referenceContext) >+ , m_displayListContexts(paintOrdersSize()) >+ , m_displayLists(paintOrdersSize()) >+ { >+ } >+ >+ GraphicsContext& graphicsContext(PaintPhase phase) override >+ { >+ return graphicsContext(paintOrderIndex(phase)); >+ } >+ >+ GraphicsContext& graphicsContext(FragmentPhase phase) override >+ { >+ return graphicsContext(paintOrderIndex(phase)); >+ } >+ >+ void replay() >+ { >+ for (auto& displayList : m_displayLists) { >+ if (!displayList || !displayList->itemCount()) >+ continue; >+ DisplayList::Replayer replayer(m_drawingContext, *displayList); >+ replayer.replay(m_clipRect); >+ } >+ } >+ >+private: >+ static const Vector<unsigned>& paintOrders() >+ { >+ static NeverDestroyed<Vector<unsigned>> paintOrders = Vector<unsigned>({ >+ PaintPhaseBlockBackground, >+ FragmentPhaseNegZOrderList, >+ PaintPhaseChildBlockBackground, >+ PaintPhaseFloat, >+ PaintPhaseForeground, >+ PaintPhaseChildOutlines, >+ PaintPhaseSelection, >+ PaintPhaseSelfOutline, >+ FragmentPhaseNormalFlowList, >+ FragmentPhasePosZOrderList, >+ FragmentPhaseOverflowControls, >+ }); >+ return paintOrders; >+ } >+ >+ static size_t paintOrdersSize() >+ { >+ return paintOrders().size(); >+ } >+ >+ static size_t paintOrderIndex(unsigned paintOrder) >+ { >+ >+ ASSERT(paintOrders().contains(paintOrder)); >+ return paintOrders().find(paintOrder); >+ } >+ >+ GraphicsContext& graphicsContext(size_t index) >+ { >+ if (!m_displayListContexts[index]) { >+ m_displayListContexts[index] = std::make_unique<GraphicsContext>([&](GraphicsContext& context) { >+ m_displayLists[index] = std::make_unique<DisplayList::DisplayList>(); >+ return std::make_unique<DisplayList::Recorder>(context, *m_displayLists[index], m_referenceContext.state(), m_clipRect, AffineTransform()); >+ }); >+ } >+ return *m_displayListContexts[index]; >+ } >+ >+ GraphicsContext& m_referenceContext; >+ Vector<std::unique_ptr<GraphicsContext>> m_displayListContexts; >+ Vector<std::unique_ptr<DisplayList::DisplayList>> m_displayLists; >+}; >+ >+} >diff --git a/Source/WebCore/rendering/RenderTheme.cpp b/Source/WebCore/rendering/RenderTheme.cpp >index 89d6fbfb17f4a35685302001df3d41df95983240..ff21250933d2c20f70a47259a7d04c51ed9e304a 100644 >--- a/Source/WebCore/rendering/RenderTheme.cpp >+++ b/Source/WebCore/rendering/RenderTheme.cpp >@@ -304,7 +304,7 @@ bool RenderTheme::paint(const RenderBox& box, ControlStates& controlStates, cons > case ButtonPart: > case InnerSpinButtonPart: > updateControlStatesForRenderer(box, controlStates); >- Theme::singleton().paint(part, controlStates, paintInfo.context(), devicePixelSnappedRect, box.style().effectiveZoom(), &box.view().frameView(), deviceScaleFactor, pageScaleFactor, box.page().useSystemAppearance(), box.page().useDarkAppearance()); >+ Theme::singleton().paint(paintInfo.context(), part, controlStates, devicePixelSnappedRect, box.style().effectiveZoom(), &box.view().frameView(), deviceScaleFactor, pageScaleFactor, box.page().useSystemAppearance(), box.page().useDarkAppearance()); > return false; > default: > break; >diff --git a/Source/WebCore/rendering/svg/SVGRenderingContext.cpp b/Source/WebCore/rendering/svg/SVGRenderingContext.cpp >index 2baa2f1bbe31ba631f21673317a12b1b414f793f..8a89b1031ed76ab3c46aa1592d7878d9f24a1e4f 100644 >--- a/Source/WebCore/rendering/svg/SVGRenderingContext.cpp >+++ b/Source/WebCore/rendering/svg/SVGRenderingContext.cpp >@@ -307,7 +307,7 @@ void SVGRenderingContext::clipToImageBuffer(GraphicsContext& context, const Affi > // The mask image has been created in the absolute coordinate space, as the image should not be scaled. > // So the actual masking process has to be done in the absolute coordinate space as well. > context.concatCTM(absoluteTransform.inverse().value_or(AffineTransform())); >- context.clipToImageBuffer(*imageBuffer, absoluteTargetRect); >+ context.clipToImageBuffer(imageBuffer->copyNativeImage(DontCopyBackingStore), absoluteTargetRect, imageBuffer->sizeForDestinationSize(absoluteTargetRect.size())); > context.concatCTM(absoluteTransform); > > // When nesting resources, with objectBoundingBox as content unit types, there's no use in caching the >diff --git a/Source/WebKit/Platform/cg/CGUtilities.cpp b/Source/WebKit/Platform/cg/CGUtilities.cpp >deleted file mode 100644 >index af08f6d5efb4aaa86b104a49c9855f20725b6808..0000000000000000000000000000000000000000 >--- a/Source/WebKit/Platform/cg/CGUtilities.cpp >+++ /dev/null >@@ -1,49 +0,0 @@ >-/* >- * Copyright (C) 2011 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. AND ITS CONTRIBUTORS ``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 ITS 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 "CGUtilities.h" >- >-namespace WebKit { >- >-void paintImage(CGContextRef context, CGImageRef image, CGFloat scaleFactor, CGPoint destination, CGRect source) >-{ >- CGContextSaveGState(context); >- >- CGContextClipToRect(context, CGRectMake(destination.x, destination.y, source.size.width, source.size.height)); >- CGContextScaleCTM(context, 1, -1); >- >- CGFloat imageHeight = CGImageGetHeight(image) / scaleFactor; >- CGFloat imageWidth = CGImageGetWidth(image) / scaleFactor; >- >- CGFloat destX = destination.x - source.origin.x; >- CGFloat destY = -imageHeight - destination.y + source.origin.y; >- >- CGContextDrawImage(context, CGRectMake(destX, destY, imageWidth, imageHeight), image); >- >- CGContextRestoreGState(context); >-} >- >-} // namespace WebKit >diff --git a/Source/WebKit/Platform/cg/CGUtilities.h b/Source/WebKit/Platform/cg/CGUtilities.h >deleted file mode 100644 >index 851d181a8fc7573c930cfc603b0f41428747b22d..0000000000000000000000000000000000000000 >--- a/Source/WebKit/Platform/cg/CGUtilities.h >+++ /dev/null >@@ -1,35 +0,0 @@ >-/* >- * Copyright (C) 2011 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. AND ITS CONTRIBUTORS ``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 ITS 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. >- */ >- >-#ifndef CGUtilities_h >-#define CGUtilities_h >- >-namespace WebKit { >- >-void paintImage(CGContextRef, CGImageRef, CGFloat scaleFactor, CGPoint destination, CGRect source); >- >-} // namespace WebKit >- >-#endif // CGUtilities_h >diff --git a/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp b/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp >index 41b2fea32b153f3bf4fef6592e29e23542e6545f..bedeeaf9a1af035bfdbe0d2a8ca6e6130cc7c3d6 100644 >--- a/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp >+++ b/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp >@@ -32,7 +32,6 @@ > #include <pal/spi/cg/CoreGraphicsSPI.h> > #include <pal/spi/cocoa/IOSurfaceSPI.h> > #include <wtf/RetainPtr.h> >-#include "CGUtilities.h" > > using namespace WebCore; > >@@ -103,12 +102,12 @@ std::unique_ptr<GraphicsContext> ShareableBitmap::createGraphicsContext() > > void ShareableBitmap::paint(WebCore::GraphicsContext& context, const IntPoint& destination, const IntRect& source) > { >- paintImage(context.platformContext(), makeCGImageCopy().get(), 1, destination, source); >+ paint(context, 1, destination, source); > } > > void ShareableBitmap::paint(WebCore::GraphicsContext& context, float scaleFactor, const IntPoint& destination, const IntRect& source) > { >- paintImage(context.platformContext(), makeCGImageCopy().get(), scaleFactor, destination, source); >+ context.drawNativeScaledImage(makeCGImageCopy().get(), scaleFactor, destination, source); > } > > RetainPtr<CGImageRef> ShareableBitmap::makeCGImageCopy() >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index 6a6f113940a7cc448c6bbb87ef4342671f0bd161..b4457a840fec77d840aba53e32ced7feb5864785 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -355,8 +355,6 @@ > 1A9FBA8D13FF04E600DEED67 /* PluginComplexTextInputState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A9FBA8C13FF04E600DEED67 /* PluginComplexTextInputState.h */; }; > 1AA13212191D5924009C1489 /* WKNavigationResponsePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA13211191D5924009C1489 /* WKNavigationResponsePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 1AA20D5118AD50E0005D1ED4 /* WKNavigationDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA20D5018AD50E0005D1ED4 /* WKNavigationDelegatePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; >- 1AA2E51D12E4C05E00BC4966 /* CGUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA2E51B12E4C05E00BC4966 /* CGUtilities.h */; }; >- 1AA2E51E12E4C05E00BC4966 /* CGUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA2E51C12E4C05E00BC4966 /* CGUtilities.cpp */; }; > 1AA2E56618D77508003814BD /* WKWebProcessBundleParameters.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AA2E56418D77508003814BD /* WKWebProcessBundleParameters.mm */; }; > 1AA2E56718D77508003814BD /* WKWebProcessBundleParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA2E56518D77508003814BD /* WKWebProcessBundleParameters.h */; }; > 1AA3D75B1651B44F008713D0 /* RemoteLayerTreeHost.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AA3D7591651B44F008713D0 /* RemoteLayerTreeHost.mm */; }; >@@ -2792,8 +2790,6 @@ > 1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; }; > 1AA1CD06100FA1BA0078DEBC /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; }; > 1AA20D5018AD50E0005D1ED4 /* WKNavigationDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationDelegatePrivate.h; sourceTree = "<group>"; }; >- 1AA2E51B12E4C05E00BC4966 /* CGUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGUtilities.h; sourceTree = "<group>"; }; >- 1AA2E51C12E4C05E00BC4966 /* CGUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CGUtilities.cpp; sourceTree = "<group>"; }; > 1AA2E56418D77508003814BD /* WKWebProcessBundleParameters.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebProcessBundleParameters.mm; sourceTree = "<group>"; }; > 1AA2E56518D77508003814BD /* WKWebProcessBundleParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessBundleParameters.h; sourceTree = "<group>"; }; > 1AA3D7591651B44F008713D0 /* RemoteLayerTreeHost.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerTreeHost.mm; sourceTree = "<group>"; }; >@@ -5303,15 +5299,6 @@ > path = mac; > sourceTree = "<group>"; > }; >- 1AA2E51A12E4C05600BC4966 /* cg */ = { >- isa = PBXGroup; >- children = ( >- 1AA2E51C12E4C05E00BC4966 /* CGUtilities.cpp */, >- 1AA2E51B12E4C05E00BC4966 /* CGUtilities.h */, >- ); >- path = cg; >- sourceTree = "<group>"; >- }; > 1AAC4DDE16B1CBF6009425E3 /* WebStorage */ = { > isa = PBXGroup; > children = ( >@@ -8014,7 +8001,6 @@ > isa = PBXGroup; > children = ( > 3709504118A88BA40087AE5D /* cf */, >- 1AA2E51A12E4C05600BC4966 /* cg */, > 6BE969C21E54D467008B7483 /* classifier */, > 4450AEBE1DC3FAAC009943F2 /* cocoa */, > 3709504218A88CDE0087AE5D /* foundation */, >@@ -9064,7 +9050,6 @@ > 41897ED81F415D8A0016FA42 /* CacheStorageEngine.h in Headers */, > 41FABD2A1F4DE001006A6C97 /* CacheStorageEngineCache.h in Headers */, > 41897EDA1F415D8A0016FA42 /* CacheStorageEngineConnection.h in Headers */, >- 1AA2E51D12E4C05E00BC4966 /* CGUtilities.h in Headers */, > 1A2D956F12848564001EB962 /* ChildProcess.h in Headers */, > 51FAEC3A1B0657630009C4E7 /* ChildProcessMessages.h in Headers */, > E1513C67166EABB200149FCB /* ChildProcessProxy.h in Headers */, >@@ -10859,7 +10844,6 @@ > 4135FBD11F4FB8090074C47B /* CacheStorageEngineCaches.cpp in Sources */, > 41897ED91F415D8A0016FA42 /* CacheStorageEngineConnection.cpp in Sources */, > 517CF0E3163A486C00C2950F /* CacheStorageEngineConnectionMessageReceiver.cpp in Sources */, >- 1AA2E51E12E4C05E00BC4966 /* CGUtilities.cpp in Sources */, > 1A2D957012848564001EB962 /* ChildProcess.cpp in Sources */, > 1A698F191E4910220064E881 /* ChildProcessCocoa.mm in Sources */, > A7E93CED1925331100A1DC48 /* ChildProcessIOS.mm in Sources */, >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 3f4320dd41f7b9c7329728a5e056b54076dafac8..a35dbb760e99e291cbf03a4f036010b78a7e0cc0 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,31 @@ >+2018-07-25 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ Enable DisplayList recording for ShareableBitmap::paint() >+ https://bugs.webkit.org/show_bug.cgi?id=187841 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Re-baseline the expected result of one of the display list tests. >+ >+ * displaylists/layer-dispay-list-expected.txt: >+ >+2018-07-17 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ Templatize DisplayListItems and use std::tuple to store the arguments >+ https://bugs.webkit.org/show_bug.cgi?id=187002 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Rebaseline existing layout tests. >+ >+ * displaylists/canvas-display-list-expected.txt: >+ * displaylists/extent-includes-shadow-expected.txt: >+ * displaylists/extent-includes-transforms-expected.txt: >+ * displaylists/layer-dispay-list-expected.txt: >+ * displaylists/replay-skip-clipped-rect-expected.txt: >+ * platform/mac-wk1/displaylists/extent-includes-shadow-expected.txt: >+ * platform/mac-wk1/displaylists/extent-includes-transforms-expected.txt: >+ > 2018-07-25 Zalan Bujtas <zalan@apple.com> > > REGRESSION(r227577) Text on TV & Movies page doesn't wrap properly in iTunes >diff --git a/LayoutTests/displaylists/canvas-display-list-expected.txt b/LayoutTests/displaylists/canvas-display-list-expected.txt >index a883e6852e1842df969fbcae256a2787cf96bfc9..7c7a894deb1d3c3063980d6b6070e03b99742acd 100644 >--- a/LayoutTests/displaylists/canvas-display-list-expected.txt >+++ b/LayoutTests/displaylists/canvas-display-list-expected.txt >@@ -1,13 +1,15 @@ > > (set-state >- (change-flags 256) >- (fill-color #C80000)) >+ (state-change >+ (change-flags 256) >+ (fill-color #C80000))) > (fill-rect > (extent at (10,10) size 55x50) > (rect at (10,10) size 55x50)) > (set-state >- (change-flags 256) >- (fill-color #0000C87F)) >+ (state-change >+ (change-flags 256) >+ (fill-color #0000C87F))) > (fill-rect > (extent at (30,30) size 55x50) > (rect at (30,30) size 55x50)) >diff --git a/LayoutTests/displaylists/extent-includes-shadow-expected.txt b/LayoutTests/displaylists/extent-includes-shadow-expected.txt >index de698ae64db62c6c49a22e0bb9efc657348ebfc8..9987bae1aa86ebe7fcba5aa7c6892d2dd0b21916 100644 >--- a/LayoutTests/displaylists/extent-includes-shadow-expected.txt >+++ b/LayoutTests/displaylists/extent-includes-shadow-expected.txt >@@ -5,14 +5,15 @@ > (save > (restore-index 4)) > (set-state >- (change-flags 1024) >- (shadow-blur 12.00) >- (shadow-offset width=10 height=20) >- (shadows-use-legacy-radius 0)) >+ (state-change >+ (change-flags 1024) >+ (shadow-blur 12.00) >+ (shadow-offset width=10 height=20) >+ (shadows-use-legacy-radius 0))) > (fill-composited-rect > (extent at (43,50) size 134x137) > (rect at (50,50) size 100x100) > (color #0000FF) >- (composite-operation source-over) >+ (composite-operator source-over) > (blend-mode normal)) > (restore) >diff --git a/LayoutTests/displaylists/extent-includes-transforms-expected.txt b/LayoutTests/displaylists/extent-includes-transforms-expected.txt >index 848b077545a7c680270eee1ba01fbbd1e8bcc3fc..054e34a4528ffae34e9b143735d7eb6352d830c2 100644 >--- a/LayoutTests/displaylists/extent-includes-transforms-expected.txt >+++ b/LayoutTests/displaylists/extent-includes-transforms-expected.txt >@@ -2,19 +2,20 @@ > (translate > (x 0.00) > (y 22.00)) >-(concatentate-ctm >+(concatenate-ctm > (ctm {m=((0.87,0.50)(-0.50,0.87)) t=(81.70,-18.30)})) > (save > (restore-index 5)) > (set-state >- (change-flags 1024) >- (shadow-blur 12.00) >- (shadow-offset width=10 height=20) >- (shadows-use-legacy-radius 0)) >+ (state-change >+ (change-flags 1024) >+ (shadow-blur 12.00) >+ (shadow-offset width=10 height=20) >+ (shadows-use-legacy-radius 0))) > (fill-composited-rect > (extent at (7.14,0.20) size 184.55x185.65) > (rect at (0,0) size 100x100) > (color #0000FF) >- (composite-operation source-over) >+ (composite-operator source-over) > (blend-mode normal)) > (restore) >diff --git a/LayoutTests/displaylists/layer-dispay-list-expected.txt b/LayoutTests/displaylists/layer-dispay-list-expected.txt >index c5f6ac6b25a987fb04eee9a11910bef61f731a33..b9f5bf9e485bc0d43912baf15fd65a88dc381eeb 100644 >--- a/LayoutTests/displaylists/layer-dispay-list-expected.txt >+++ b/LayoutTests/displaylists/layer-dispay-list-expected.txt >@@ -6,26 +6,27 @@ > (extent at (0,0) size 104x104) > (rect at (0,0) size 104x104) > (color #008000) >- (composite-operation source-over) >+ (composite-operator source-over) > (blend-mode normal)) > (set-state >- (change-flags 131456) >- (fill-color #0000FF) >- (stroke-style 0) >- (should-antialias 0)) >+ (state-change >+ (change-flags 131456) >+ (fill-color #0000FF) >+ (stroke-style 0) >+ (should-antialias 0))) > (draw-rect >- (extent at (0,0) size 104x2) >+ (extent at (0,0) size 104x2.50) > (rect at (0,0) size 104x2) > (border-thickness 1.00)) > (draw-rect >- (extent at (0,102) size 104x2) >+ (extent at (0,101.50) size 104x2.50) > (rect at (0,102) size 104x2) > (border-thickness 1.00)) > (draw-rect >- (extent at (0,0) size 2x104) >+ (extent at (0,0) size 2.50x104) > (rect at (0,0) size 2x104) > (border-thickness 1.00)) > (draw-rect >- (extent at (102,0) size 2x104) >+ (extent at (101.50,0) size 2.50x104) > (rect at (102,0) size 2x104) > (border-thickness 1.00)) >diff --git a/LayoutTests/displaylists/replay-skip-clipped-rect-expected.txt b/LayoutTests/displaylists/replay-skip-clipped-rect-expected.txt >index bf7ef275f61855a6251b6176db17dd02e9048ec3..5e1fc968b45ab7c11714cf3b75e26f7842f3d789 100644 >--- a/LayoutTests/displaylists/replay-skip-clipped-rect-expected.txt >+++ b/LayoutTests/displaylists/replay-skip-clipped-rect-expected.txt >@@ -6,7 +6,7 @@ recorded: > (extent at (412,0) size 100x100) > (rect at (412,0) size 100x100) > (color #0000FF) >- (composite-operation source-over) >+ (composite-operator source-over) > (blend-mode normal)) > > replayed: >diff --git a/LayoutTests/platform/mac-wk1/displaylists/extent-includes-shadow-expected.txt b/LayoutTests/platform/mac-wk1/displaylists/extent-includes-shadow-expected.txt >index 210e44b0877c040ca852420dd97b42c0eac176c5..11e7e01e98883b0fc36133b22c052aaf7cc9d071 100644 >--- a/LayoutTests/platform/mac-wk1/displaylists/extent-includes-shadow-expected.txt >+++ b/LayoutTests/platform/mac-wk1/displaylists/extent-includes-shadow-expected.txt >@@ -5,15 +5,16 @@ > (save > (restore-index 4)) > (set-state >- (change-flags 525312) >- (shadow-blur 12.00) >- (shadow-offset width=10 height=20) >- (shadows-use-legacy-radius 0) >- (should-subpixel-quantize-fonts 0)) >+ (state-change >+ (change-flags 525312) >+ (shadow-blur 12.00) >+ (shadow-offset width=10 height=20) >+ (shadows-use-legacy-radius 0) >+ (should-subpixel-quantize-fonts 0))) > (fill-composited-rect > (extent at (43,50) size 134x137) > (rect at (50,50) size 100x100) > (color #0000FF) >- (composite-operation source-over) >+ (composite-operator source-over) > (blend-mode normal)) > (restore) >diff --git a/LayoutTests/platform/mac-wk1/displaylists/extent-includes-transforms-expected.txt b/LayoutTests/platform/mac-wk1/displaylists/extent-includes-transforms-expected.txt >index 384e98129dc7ebcdd896d310fa8c75d3653abb7f..afcc8c4a941eb9ce135219751651e911fe07c707 100644 >--- a/LayoutTests/platform/mac-wk1/displaylists/extent-includes-transforms-expected.txt >+++ b/LayoutTests/platform/mac-wk1/displaylists/extent-includes-transforms-expected.txt >@@ -2,20 +2,21 @@ > (translate > (x 0.00) > (y 22.00)) >-(concatentate-ctm >+(concatenate-ctm > (ctm {m=((0.87,0.50)(-0.50,0.87)) t=(81.70,-18.30)})) > (save > (restore-index 5)) > (set-state >- (change-flags 525312) >- (shadow-blur 12.00) >- (shadow-offset width=10 height=20) >- (shadows-use-legacy-radius 0) >- (should-subpixel-quantize-fonts 0)) >+ (state-change >+ (change-flags 525312) >+ (shadow-blur 12.00) >+ (shadow-offset width=10 height=20) >+ (shadows-use-legacy-radius 0) >+ (should-subpixel-quantize-fonts 0))) > (fill-composited-rect > (extent at (7.14,0.20) size 184.55x185.65) > (rect at (0,0) size 100x100) > (color #0000FF) >- (composite-operation source-over) >+ (composite-operator source-over) > (blend-mode normal)) > (restore)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188116
:
345936
|
345944
|
345967
|
345990