Diff
Modified: trunk/Source/WebCore/ChangeLog (253248 => 253249)
--- trunk/Source/WebCore/ChangeLog 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/ChangeLog 2019-12-07 13:30:16 UTC (rev 253249)
@@ -1,5 +1,74 @@
2019-12-07 Tim Horton <[email protected]>
+ Implement encoding for DrawImage and DrawRoundedRect display list items
+ https://bugs.webkit.org/show_bug.cgi?id=204881
+
+ Reviewed by Simon Fraser.
+
+ Make InterpolationQuality an enum class.
+ Make ImagePaintingOptions and all of its children encodable.
+ Make DrawImage and DrawRoundedRect encodable.
+ Add ImageHandle, which right now just wraps WebCore::Image, but
+ later could carry identifiers. This allows us to implement image encoding
+ in WebKit code, which can then use ShareableBitmap to A) decode the image
+ in the Web Content process and B) use shared memory to transmit the
+ decoded image data to the GPU process.
+
+ * html/CanvasBase.cpp:
+ * html/ImageBitmap.cpp:
+ (WebCore::interpolationQualityForResizeQuality):
+ * html/canvas/CanvasRenderingContext2DBase.cpp:
+ (WebCore::smoothingToInterpolationQuality):
+ (WebCore::CanvasRenderingContext2DBase::setImageSmoothingEnabled):
+ * platform/graphics/DecodingOptions.h:
+ * platform/graphics/GraphicsContext.h:
+ (WebCore::InterpolationQualityMaintainer::InterpolationQualityMaintainer):
+ * platform/graphics/GraphicsTypes.h:
+ * platform/graphics/ImageOrientation.h:
+ * platform/graphics/ImagePaintingOptions.h:
+ (WebCore::ImagePaintingOptions::ImagePaintingOptions):
+ (WebCore::ImagePaintingOptions::encode const):
+ (WebCore::ImagePaintingOptions::decode):
+ * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
+ (WebCore::MediaPlayerPrivateAVFoundationCF::paint):
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithImageGenerator):
+ * platform/graphics/cairo/CairoOperations.cpp:
+ (WebCore::Cairo::drawSurface):
+ * platform/graphics/cg/GraphicsContext3DCG.cpp:
+ (WebCore::GraphicsContext3D::paintToCanvas):
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::convertInterpolationQuality):
+ (WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
+ * platform/graphics/displaylists/DisplayListItems.cpp:
+ (WebCore::DisplayList::FillRoundedRect::FillRoundedRect):
+ * platform/graphics/displaylists/DisplayListItems.h:
+ (WebCore::DisplayList::DrawImage::encode const):
+ (WebCore::DisplayList::DrawImage::decode):
+ (WebCore::DisplayList::FillRoundedRect::create):
+ (WebCore::DisplayList::FillRoundedRect::encode const):
+ (WebCore::DisplayList::FillRoundedRect::decode):
+ (WebCore::DisplayList::Item::encode const):
+ (WebCore::DisplayList::Item::decode):
+ (WebCore::DisplayList::FillRoundedRect::FillRoundedRect): Deleted.
+ * platform/graphics/ios/IconIOS.mm:
+ (WebCore::Icon::paint):
+ * platform/graphics/texmap/BitmapTexture.cpp:
+ (WebCore::BitmapTexture::updateContents):
+ * platform/graphics/win/GraphicsContextDirect2D.cpp:
+ (WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
+ * platform/ios/wak/WAKView.mm:
+ (toCGInterpolationQuality):
+ * platform/mock/MockRealtimeVideoSource.cpp:
+ (WebCore::MockRealtimeVideoSource::imageBuffer const):
+ * rendering/ImageQualityController.cpp:
+ (WebCore::ImageQualityController::interpolationQualityFromStyle):
+ (WebCore::ImageQualityController::chooseInterpolationQuality):
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::paintIntoRect):
+
+2019-12-07 Tim Horton <[email protected]>
+
macCatalyst: REGRESSION (r251320): WebKit-native media controls do not respond to hover or click
https://bugs.webkit.org/show_bug.cgi?id=204543
<rdar://problem/57208621>
Modified: trunk/Source/WebCore/Headers.cmake (253248 => 253249)
--- trunk/Source/WebCore/Headers.cmake 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/Headers.cmake 2019-12-07 13:30:16 UTC (rev 253249)
@@ -1121,6 +1121,8 @@
platform/graphics/angle/Extensions3DANGLE.h
+ platform/graphics/displaylists/DisplayListItems.h
+
platform/graphics/cv/ImageTransferSessionVT.h
platform/graphics/filters/FilterOperation.h
Modified: trunk/Source/WebCore/html/CanvasBase.cpp (253248 => 253249)
--- trunk/Source/WebCore/html/CanvasBase.cpp 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/html/CanvasBase.cpp 2019-12-07 13:30:16 UTC (rev 253249)
@@ -43,9 +43,9 @@
#if USE(CG)
// FIXME: It seems strange that the default quality is not the one that is literally named "default".
// Should fix names to make this easier to understand, or write an excellent comment here explaining why not.
-const InterpolationQuality defaultInterpolationQuality = InterpolationLow;
+const InterpolationQuality defaultInterpolationQuality = InterpolationQuality::Low;
#else
-const InterpolationQuality defaultInterpolationQuality = InterpolationDefault;
+const InterpolationQuality defaultInterpolationQuality = InterpolationQuality::Default;
#endif
CanvasBase::CanvasBase(IntSize size)
Modified: trunk/Source/WebCore/html/ImageBitmap.cpp (253248 => 253249)
--- trunk/Source/WebCore/html/ImageBitmap.cpp 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/html/ImageBitmap.cpp 2019-12-07 13:30:16 UTC (rev 253249)
@@ -206,16 +206,16 @@
{
switch (resizeQuality) {
case ImageBitmapOptions::ResizeQuality::Pixelated:
- return InterpolationNone;
+ return InterpolationQuality::DoNotInterpolate;
case ImageBitmapOptions::ResizeQuality::Low:
- return InterpolationDefault; // Low is the default.
+ return InterpolationQuality::Default; // Low is the default.
case ImageBitmapOptions::ResizeQuality::Medium:
- return InterpolationMedium;
+ return InterpolationQuality::Medium;
case ImageBitmapOptions::ResizeQuality::High:
- return InterpolationHigh;
+ return InterpolationQuality::High;
}
ASSERT_NOT_REACHED();
- return InterpolationDefault;
+ return InterpolationQuality::Default;
}
// FIXME: More steps from https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#cropped-to-the-source-rectangle-with-formatting
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp (253248 => 253249)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp 2019-12-07 13:30:16 UTC (rev 253249)
@@ -2288,15 +2288,15 @@
{
switch (quality) {
case ImageSmoothingQuality::Low:
- return InterpolationLow;
+ return InterpolationQuality::Low;
case ImageSmoothingQuality::Medium:
- return InterpolationMedium;
+ return InterpolationQuality::Medium;
case ImageSmoothingQuality::High:
- return InterpolationHigh;
+ return InterpolationQuality::High;
}
ASSERT_NOT_REACHED();
- return InterpolationLow;
+ return InterpolationQuality::Low;
};
auto CanvasRenderingContext2DBase::imageSmoothingQuality() const -> ImageSmoothingQuality
@@ -2333,7 +2333,7 @@
modifiableState().imageSmoothingEnabled = enabled;
auto* c = drawingContext();
if (c)
- c->setImageInterpolationQuality(enabled ? smoothingToInterpolationQuality(state().imageSmoothingQuality) : InterpolationNone);
+ c->setImageInterpolationQuality(enabled ? smoothingToInterpolationQuality(state().imageSmoothingQuality) : InterpolationQuality::DoNotInterpolate);
}
void CanvasRenderingContext2DBase::setPath(Path2D& path)
Modified: trunk/Source/WebCore/platform/graphics/DecodingOptions.h (253248 => 253249)
--- trunk/Source/WebCore/platform/graphics/DecodingOptions.h 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/platform/graphics/DecodingOptions.h 2019-12-07 13:30:16 UTC (rev 253249)
@@ -26,12 +26,13 @@
#pragma once
#include "IntSize.h"
+#include <wtf/EnumTraits.h>
#include <wtf/Optional.h>
#include <wtf/Variant.h>
namespace WebCore {
-enum class DecodingMode {
+enum class DecodingMode : uint8_t {
Auto,
Synchronous,
Asynchronous
@@ -144,4 +145,17 @@
DecodingModeOrSize m_decodingModeOrSize;
};
-}
+} // namespace WebCore
+
+namespace WTF {
+
+template<> struct EnumTraits<WebCore::DecodingMode> {
+ using values = EnumValues<
+ WebCore::DecodingMode,
+ WebCore::DecodingMode::Auto,
+ WebCore::DecodingMode::Synchronous,
+ WebCore::DecodingMode::Asynchronous
+ >;
+};
+
+} // namespace WTF
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (253248 => 253249)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2019-12-07 13:30:16 UTC (rev 253249)
@@ -196,7 +196,7 @@
float alpha { 1 };
CompositeOperator compositeOperator { CompositeOperator::SourceOver };
BlendMode blendMode { BlendMode::Normal };
- InterpolationQuality imageInterpolationQuality { InterpolationDefault };
+ InterpolationQuality imageInterpolationQuality { InterpolationQuality::Default };
bool shouldAntialias : 1;
bool shouldSmoothFonts : 1;
@@ -699,7 +699,7 @@
explicit InterpolationQualityMaintainer(GraphicsContext& graphicsContext, InterpolationQuality interpolationQualityToUse)
: m_graphicsContext(graphicsContext)
, m_currentInterpolationQuality(graphicsContext.imageInterpolationQuality())
- , m_interpolationQualityChanged(interpolationQualityToUse != InterpolationDefault && m_currentInterpolationQuality != interpolationQualityToUse)
+ , m_interpolationQualityChanged(interpolationQualityToUse != InterpolationQuality::Default && m_currentInterpolationQuality != interpolationQualityToUse)
{
if (m_interpolationQualityChanged)
m_graphicsContext.setImageInterpolationQuality(interpolationQualityToUse);
Modified: trunk/Source/WebCore/platform/graphics/GraphicsTypes.h (253248 => 253249)
--- trunk/Source/WebCore/platform/graphics/GraphicsTypes.h 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/platform/graphics/GraphicsTypes.h 2019-12-07 13:30:16 UTC (rev 253249)
@@ -79,12 +79,12 @@
SpreadMethodRepeat
};
-enum InterpolationQuality {
- InterpolationDefault,
- InterpolationNone,
- InterpolationLow,
- InterpolationMedium,
- InterpolationHigh
+enum class InterpolationQuality : uint8_t {
+ Default,
+ DoNotInterpolate,
+ Low,
+ Medium,
+ High
};
enum LineCap {
@@ -133,13 +133,13 @@
Unpremultiplied
};
-String compositeOperatorName(CompositeOperator, BlendMode);
-String blendModeName(BlendMode);
-bool parseBlendMode(const String&, BlendMode&);
-bool parseCompositeAndBlendOperator(const String&, CompositeOperator&, BlendMode&);
+String compositeOperatorName(WebCore::CompositeOperator, WebCore::BlendMode);
+String blendModeName(WebCore::BlendMode);
+bool parseBlendMode(const String&, WebCore::BlendMode&);
+bool parseCompositeAndBlendOperator(const String&, WebCore::CompositeOperator&, WebCore::BlendMode&);
-WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, BlendMode);
-WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, CompositeOperator);
+WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, WebCore::BlendMode);
+WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, WebCore::CompositeOperator);
WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, WindRule);
WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, LineCap);
WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, LineJoin);
@@ -193,4 +193,15 @@
>;
};
+template<> struct EnumTraits<WebCore::InterpolationQuality> {
+ using values = EnumValues<
+ WebCore::InterpolationQuality,
+ WebCore::InterpolationQuality::Default,
+ WebCore::InterpolationQuality::DoNotInterpolate,
+ WebCore::InterpolationQuality::Low,
+ WebCore::InterpolationQuality::Medium,
+ WebCore::InterpolationQuality::High
+ >;
+};
+
} // namespace WTF
Modified: trunk/Source/WebCore/platform/graphics/ImageOrientation.h (253248 => 253249)
--- trunk/Source/WebCore/platform/graphics/ImageOrientation.h 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/platform/graphics/ImageOrientation.h 2019-12-07 13:30:16 UTC (rev 253249)
@@ -28,6 +28,7 @@
#include "AffineTransform.h"
#include "FloatSize.h"
+#include <wtf/EnumTraits.h>
namespace WebCore {
@@ -121,3 +122,22 @@
};
} // namespace WebCore
+
+namespace WTF {
+
+template<> struct EnumTraits<WebCore::ImageOrientation::Orientation> {
+ using values = EnumValues<
+ WebCore::ImageOrientation::Orientation,
+ WebCore::ImageOrientation::Orientation::FromImage,
+ WebCore::ImageOrientation::Orientation::OriginTopLeft,
+ WebCore::ImageOrientation::Orientation::OriginTopRight,
+ WebCore::ImageOrientation::Orientation::OriginBottomRight,
+ WebCore::ImageOrientation::Orientation::OriginBottomLeft,
+ WebCore::ImageOrientation::Orientation::OriginLeftTop,
+ WebCore::ImageOrientation::Orientation::OriginRightTop,
+ WebCore::ImageOrientation::Orientation::OriginRightBottom,
+ WebCore::ImageOrientation::Orientation::OriginLeftBottom
+ >;
+};
+
+} // namespace WTF
Modified: trunk/Source/WebCore/platform/graphics/ImagePaintingOptions.h (253248 => 253249)
--- trunk/Source/WebCore/platform/graphics/ImagePaintingOptions.h 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/platform/graphics/ImagePaintingOptions.h 2019-12-07 13:30:16 UTC (rev 253249)
@@ -38,11 +38,11 @@
setOption(options...);
}
- template<typename... Overrrides>
- ImagePaintingOptions(const ImagePaintingOptions& other, Overrrides... overrrides)
+ template<typename... Overrides>
+ ImagePaintingOptions(const ImagePaintingOptions& other, Overrides... overrides)
: ImagePaintingOptions(other)
{
- setOption(overrrides...);
+ setOption(overrides...);
}
ImagePaintingOptions() = default;
@@ -54,6 +54,9 @@
ImageOrientation orientation() const { return m_orientation; }
InterpolationQuality interpolationQuality() const { return m_interpolationQuality; }
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<ImagePaintingOptions> decode(Decoder&);
+
private:
template <typename First, typename... Rest>
void setOption(First first, Rest... rest)
@@ -73,7 +76,48 @@
BlendMode m_blendMode { BlendMode::Normal };
DecodingMode m_decodingMode { DecodingMode::Synchronous };
ImageOrientation m_orientation { ImageOrientation::None };
- InterpolationQuality m_interpolationQuality { InterpolationDefault };
+ InterpolationQuality m_interpolationQuality { InterpolationQuality::Default };
};
+template<class Encoder>
+void ImagePaintingOptions::encode(Encoder& encoder) const
+{
+ encoder << m_compositeOperator;
+ encoder << m_blendMode;
+ encoder << m_decodingMode;
+ encoder << ImageOrientation::Orientation(m_orientation);
+ encoder << m_interpolationQuality;
}
+
+template<class Decoder>
+Optional<ImagePaintingOptions> ImagePaintingOptions::decode(Decoder& decoder)
+{
+ Optional<CompositeOperator> compositeOperator;
+ decoder >> compositeOperator;
+ if (!compositeOperator)
+ return WTF::nullopt;
+
+ Optional<BlendMode> blendMode;
+ decoder >> blendMode;
+ if (!blendMode)
+ return WTF::nullopt;
+
+ Optional<DecodingMode> decodingMode;
+ decoder >> decodingMode;
+ if (!decodingMode)
+ return WTF::nullopt;
+
+ Optional<ImageOrientation::Orientation> orientation;
+ decoder >> orientation;
+ if (!orientation)
+ return WTF::nullopt;
+
+ Optional<InterpolationQuality> interpolationQuality;
+ decoder >> interpolationQuality;
+ if (!interpolationQuality)
+ return WTF::nullopt;
+
+ return ImagePaintingOptions { *compositeOperator, *blendMode, *decodingMode, *orientation, *interpolationQuality };
+}
+
+}
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp (253248 => 253249)
--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp 2019-12-07 13:30:16 UTC (rev 253249)
@@ -859,7 +859,7 @@
context.save();
context.translate(rect.x(), rect.y() + rect.height());
context.scale(FloatSize(1.0f, -1.0f));
- context.setImageInterpolationQuality(InterpolationLow);
+ context.setImageInterpolationQuality(InterpolationQuality::Low);
FloatRect paintRect(FloatPoint(), rect.size());
#if USE(DIRECT2D)
notImplemented();
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (253248 => 253249)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2019-12-07 13:30:16 UTC (rev 253249)
@@ -1547,7 +1547,7 @@
GraphicsContextStateSaver stateSaver(context);
context.translate(rect.x(), rect.y() + rect.height());
context.scale(FloatSize(1.0f, -1.0f));
- context.setImageInterpolationQuality(InterpolationLow);
+ context.setImageInterpolationQuality(InterpolationQuality::Low);
IntRect paintRect(IntPoint(0, 0), IntSize(rect.width(), rect.height()));
CGContextDrawImage(context.platformContext(), CGRectMake(0, 0, paintRect.width(), paintRect.height()), image.get());
}
Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp (253248 => 253249)
--- trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp 2019-12-07 13:30:16 UTC (rev 253249)
@@ -936,15 +936,15 @@
RefPtr<cairo_pattern_t> pattern = adoptRef(cairo_pattern_create_for_surface(patternSurface.get()));
switch (imageInterpolationQuality) {
- case InterpolationNone:
- case InterpolationLow:
+ case InterpolationQuality::DoNotInterpolate:
+ case InterpolationQuality::Low:
cairo_pattern_set_filter(pattern.get(), CAIRO_FILTER_FAST);
break;
- case InterpolationMedium:
- case InterpolationDefault:
+ case InterpolationQuality::Medium:
+ case InterpolationQuality::Default:
cairo_pattern_set_filter(pattern.get(), CAIRO_FILTER_GOOD);
break;
- case InterpolationHigh:
+ case InterpolationQuality::High:
cairo_pattern_set_filter(pattern.get(), CAIRO_FILTER_BEST);
break;
}
Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp (253248 => 253249)
--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp 2019-12-07 13:30:16 UTC (rev 253249)
@@ -538,7 +538,7 @@
GraphicsContextStateSaver stateSaver(context);
context.scale(FloatSize(1, -1));
context.translate(0, -imageSize.height());
- context.setImageInterpolationQuality(InterpolationNone);
+ context.setImageInterpolationQuality(InterpolationQuality::DoNotInterpolate);
context.drawNativeImage(cgImage, imageSize, canvasRect, FloatRect(FloatPoint(), imageSize), { CompositeOperator::Copy });
}
Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (253248 => 253249)
--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2019-12-07 13:30:16 UTC (rev 253249)
@@ -143,17 +143,17 @@
{
switch (quality) {
case kCGInterpolationDefault:
- return InterpolationDefault;
+ return InterpolationQuality::Default;
case kCGInterpolationNone:
- return InterpolationNone;
+ return InterpolationQuality::DoNotInterpolate;
case kCGInterpolationLow:
- return InterpolationLow;
+ return InterpolationQuality::Low;
case kCGInterpolationMedium:
- return InterpolationMedium;
+ return InterpolationQuality::Medium;
case kCGInterpolationHigh:
- return InterpolationHigh;
+ return InterpolationQuality::High;
}
- return InterpolationDefault;
+ return InterpolationQuality::Default;
}
static CGBlendMode selectCGBlendMode(CompositeOperator compositeOperator, BlendMode blendMode)
@@ -1667,19 +1667,19 @@
CGInterpolationQuality quality = kCGInterpolationDefault;
switch (mode) {
- case InterpolationDefault:
+ case InterpolationQuality::Default:
quality = kCGInterpolationDefault;
break;
- case InterpolationNone:
+ case InterpolationQuality::DoNotInterpolate:
quality = kCGInterpolationNone;
break;
- case InterpolationLow:
+ case InterpolationQuality::Low:
quality = kCGInterpolationLow;
break;
- case InterpolationMedium:
+ case InterpolationQuality::Medium:
quality = kCGInterpolationMedium;
break;
- case InterpolationHigh:
+ case InterpolationQuality::High:
quality = kCGInterpolationHigh;
break;
}
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp (253248 => 253249)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp 2019-12-07 13:30:16 UTC (rev 253249)
@@ -492,6 +492,8 @@
{
}
+DrawImage::~DrawImage() = default;
+
void DrawImage::apply(GraphicsContext& context) const
{
context.drawImage(m_image.get(), m_destination, m_source, m_imagePaintingOptions);
@@ -876,6 +878,16 @@
return ts;
}
+FillRoundedRect::FillRoundedRect(const FloatRoundedRect& rect, const Color& color, BlendMode blendMode)
+ : DrawingItem(ItemType::FillRoundedRect)
+ , m_rect(rect)
+ , m_color(color)
+ , m_blendMode(blendMode)
+{
+}
+
+FillRoundedRect::~FillRoundedRect() = default;
+
void FillRoundedRect::apply(GraphicsContext& context) const
{
context.fillRoundedRect(m_rect, m_color, m_blendMode);
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h (253248 => 253249)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h 2019-12-07 13:30:16 UTC (rev 253249)
@@ -741,12 +741,17 @@
return adoptRef(*new DrawImage(image, destination, source, imagePaintingOptions));
}
+ WEBCORE_EXPORT virtual ~DrawImage();
+
const Image& image() const { return m_image.get(); }
FloatRect source() const { return m_source; }
FloatRect destination() const { return m_destination; }
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<Ref<DrawImage>> decode(Decoder&);
+
private:
- DrawImage(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&);
+ WEBCORE_EXPORT DrawImage(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&);
void apply(GraphicsContext&) const override;
@@ -758,6 +763,49 @@
ImagePaintingOptions m_imagePaintingOptions;
};
+class ImageHandle {
+public:
+ RefPtr<Image> image;
+};
+
+template<class Encoder>
+void DrawImage::encode(Encoder& encoder) const
+{
+ ImageHandle imageHandle;
+ imageHandle.image = m_image.ptr();
+
+ encoder << imageHandle;
+ encoder << m_destination;
+ encoder << m_source;
+ encoder << m_imagePaintingOptions;
+}
+
+template<class Decoder>
+Optional<Ref<DrawImage>> DrawImage::decode(Decoder& decoder)
+{
+ Optional<ImageHandle> imageHandle;
+ decoder >> imageHandle;
+ if (!imageHandle)
+ return WTF::nullopt;
+
+ Optional<FloatRect> destination;
+ decoder >> destination;
+ if (!destination)
+ return WTF::nullopt;
+
+ Optional<FloatRect> source;
+ decoder >> source;
+ if (!source)
+ return WTF::nullopt;
+
+ Optional<ImagePaintingOptions> imagePaintingOptions;
+ decoder >> imagePaintingOptions;
+ if (!imagePaintingOptions)
+ return WTF::nullopt;
+
+ return DrawImage::create(*imageHandle->image, *destination, *source, *imagePaintingOptions);
+}
+
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)
@@ -1359,18 +1407,17 @@
return adoptRef(*new FillRoundedRect(rect, color, blendMode));
}
+ WEBCORE_EXPORT virtual ~FillRoundedRect();
+
const FloatRoundedRect& roundedRect() const { return m_rect; }
const Color& color() const { return m_color; }
BlendMode blendMode() const { return m_blendMode; }
+ template<class Encoder> void encode(Encoder&) const;
+ template<class Decoder> static Optional<Ref<FillRoundedRect>> decode(Decoder&);
+
private:
- FillRoundedRect(const FloatRoundedRect& rect, const Color& color, BlendMode blendMode)
- : DrawingItem(ItemType::FillRoundedRect)
- , m_rect(rect)
- , m_color(color)
- , m_blendMode(blendMode)
- {
- }
+ WEBCORE_EXPORT FillRoundedRect(const FloatRoundedRect&, const Color&, BlendMode);
void apply(GraphicsContext&) const override;
Optional<FloatRect> localBounds(const GraphicsContext&) const override { return m_rect.rect(); }
@@ -1380,6 +1427,35 @@
BlendMode m_blendMode;
};
+template<class Encoder>
+void FillRoundedRect::encode(Encoder& encoder) const
+{
+ encoder << m_rect;
+ encoder << m_color;
+ encoder << m_blendMode;
+}
+
+template<class Decoder>
+Optional<Ref<FillRoundedRect>> FillRoundedRect::decode(Decoder& decoder)
+{
+ Optional<FloatRoundedRect> rect;
+ decoder >> rect;
+ if (!rect)
+ return WTF::nullopt;
+
+ Optional<Color> color;
+ decoder >> color;
+ if (!color)
+ return WTF::nullopt;
+
+ Optional<BlendMode> blendMode;
+ decoder >> blendMode;
+ if (!blendMode)
+ return WTF::nullopt;
+
+ return FillRoundedRect::create(*rect, *color, *blendMode);
+}
+
class FillRectWithRoundedHole : public DrawingItem {
public:
static Ref<FillRectWithRoundedHole> create(const FloatRect& rect, const FloatRoundedRect& roundedHoleRect, const Color& color)
@@ -1696,7 +1772,7 @@
WTFLogAlways("DisplayList::Item::encode cannot yet encode DrawGlyphs");
break;
case ItemType::DrawImage:
- WTFLogAlways("DisplayList::Item::encode cannot yet encode DrawImage");
+ encoder << downcast<DrawImage>(*this);
break;
case ItemType::DrawTiledImage:
WTFLogAlways("DisplayList::Item::encode cannot yet encode DrawTiledImage");
@@ -1749,7 +1825,7 @@
encoder << downcast<FillCompositedRect>(*this);
break;
case ItemType::FillRoundedRect:
- WTFLogAlways("DisplayList::Item::encode cannot yet encode FillRoundedRect");
+ encoder << downcast<FillRoundedRect>(*this);
break;
case ItemType::FillRectWithRoundedHole:
WTFLogAlways("DisplayList::Item::encode cannot yet encode FillRectWithRoundedHole");
@@ -1860,7 +1936,8 @@
WTFLogAlways("DisplayList::Item::decode cannot yet decode DrawGlyphs");
break;
case ItemType::DrawImage:
- WTFLogAlways("DisplayList::Item::decode cannot yet decode DrawImage");
+ if (auto item = DrawImage::decode(decoder))
+ return static_reference_cast<Item>(WTFMove(*item));
break;
case ItemType::DrawTiledImage:
WTFLogAlways("DisplayList::Item::decode cannot yet decode DrawTiledImage");
@@ -1918,7 +1995,8 @@
return static_reference_cast<Item>(WTFMove(*item));
break;
case ItemType::FillRoundedRect:
- WTFLogAlways("DisplayList::Item::decode cannot yet decode FillRoundedRect");
+ if (auto item = FillRoundedRect::decode(decoder))
+ return static_reference_cast<Item>(WTFMove(*item));
break;
case ItemType::FillRectWithRoundedHole:
WTFLogAlways("DisplayList::Item::decode cannot yet decode FillRectWithRoundedHole");
Modified: trunk/Source/WebCore/platform/graphics/ios/IconIOS.mm (253248 => 253249)
--- trunk/Source/WebCore/platform/graphics/ios/IconIOS.mm 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/platform/graphics/ios/IconIOS.mm 2019-12-07 13:30:16 UTC (rev 253249)
@@ -67,7 +67,7 @@
FloatSize size(width, height);
FloatRect srcRect(FloatPoint(), size);
- context.setImageInterpolationQuality(InterpolationHigh);
+ context.setImageInterpolationQuality(InterpolationQuality::High);
context.drawNativeImage(m_cgImage.get(), size, destRect, srcRect);
}
Modified: trunk/Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp (253248 => 253249)
--- trunk/Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp 2019-12-07 13:30:16 UTC (rev 253249)
@@ -44,7 +44,7 @@
return;
GraphicsContext& context = imageBuffer->context();
- context.setImageInterpolationQuality(InterpolationDefault);
+ context.setImageInterpolationQuality(InterpolationQuality::Default);
context.setTextDrawingMode(TextModeFill);
IntRect sourceRect(targetRect);
Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp (253248 => 253249)
--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp 2019-12-07 13:30:16 UTC (rev 253249)
@@ -1062,19 +1062,19 @@
D2D1_INTERPOLATION_MODE quality = D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR;
switch (mode) {
- case InterpolationDefault:
+ case InterpolationQuality::Default:
quality = D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR;
break;
- case InterpolationNone:
+ case InterpolationQuality::DoNotInterpolate:
quality = D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR;
break;
- case InterpolationLow:
+ case InterpolationQuality::Low:
quality = D2D1_INTERPOLATION_MODE_LINEAR;
break;
- case InterpolationMedium:
+ case InterpolationQuality::Medium:
quality = D2D1_INTERPOLATION_MODE_CUBIC;
break;
- case InterpolationHigh:
+ case InterpolationQuality::High:
quality = D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC;
break;
}
Modified: trunk/Source/WebCore/platform/ios/wak/WAKView.mm (253248 => 253249)
--- trunk/Source/WebCore/platform/ios/wak/WAKView.mm 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/platform/ios/wak/WAKView.mm 2019-12-07 13:30:16 UTC (rev 253249)
@@ -471,15 +471,15 @@
static CGInterpolationQuality toCGInterpolationQuality(WebCore::InterpolationQuality quality)
{
switch (quality) {
- case WebCore::InterpolationDefault:
+ case WebCore::InterpolationQuality::Default:
return kCGInterpolationDefault;
- case WebCore::InterpolationNone:
+ case WebCore::InterpolationQuality::DoNotInterpolate:
return kCGInterpolationNone;
- case WebCore::InterpolationLow:
+ case WebCore::InterpolationQuality::Low:
return kCGInterpolationLow;
- case WebCore::InterpolationMedium:
+ case WebCore::InterpolationQuality::Medium:
return kCGInterpolationMedium;
- case WebCore::InterpolationHigh:
+ case WebCore::InterpolationQuality::High:
return kCGInterpolationHigh;
default:
ASSERT_NOT_REACHED();
Modified: trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp (253248 => 253249)
--- trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp 2019-12-07 13:30:16 UTC (rev 253249)
@@ -462,7 +462,7 @@
if (!m_imageBuffer)
return nullptr;
- m_imageBuffer->context().setImageInterpolationQuality(InterpolationDefault);
+ m_imageBuffer->context().setImageInterpolationQuality(InterpolationQuality::Default);
m_imageBuffer->context().setStrokeThickness(1);
return m_imageBuffer.get();
Modified: trunk/Source/WebCore/rendering/ImageQualityController.cpp (253248 => 253249)
--- trunk/Source/WebCore/rendering/ImageQualityController.cpp 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/rendering/ImageQualityController.cpp 2019-12-07 13:30:16 UTC (rev 253249)
@@ -102,12 +102,12 @@
{
switch (style.imageRendering()) {
case ImageRendering::OptimizeSpeed:
- return InterpolationLow;
+ return InterpolationQuality::Low;
case ImageRendering::CrispEdges:
case ImageRendering::Pixelated:
- return InterpolationNone;
+ return InterpolationQuality::DoNotInterpolate;
case ImageRendering::OptimizeQuality:
- return InterpolationDefault; // FIXME: CSS 3 Images says that optimizeQuality should behave like 'auto', but that prevents authors from overriding this low quality rendering behavior.
+ return InterpolationQuality::Default; // FIXME: CSS 3 Images says that optimizeQuality should behave like 'auto', but that prevents authors from overriding this low quality rendering behavior.
case ImageRendering::Auto:
break;
}
@@ -118,7 +118,7 @@
{
// If the image is not a bitmap image, then none of this is relevant and we just paint at high quality.
if (!(image.isBitmapImage() || image.isPDFDocumentImage()) || context.paintingDisabled())
- return InterpolationDefault;
+ return InterpolationQuality::Default;
if (Optional<InterpolationQuality> styleInterpolation = interpolationQualityFromStyle(object->style()))
return styleInterpolation.value();
@@ -147,10 +147,10 @@
set(object, innerMap, layer, size);
restartTimer();
m_liveResizeOptimizationIsActive = true;
- return InterpolationLow;
+ return InterpolationQuality::Low;
}
if (m_liveResizeOptimizationIsActive)
- return InterpolationDefault;
+ return InterpolationQuality::Default;
}
const AffineTransform& currentTransform = context.getCTM();
@@ -158,7 +158,7 @@
if (!contextIsScaled && size == imageSize) {
// There is no scale in effect. If we had a scale in effect before, we can just remove this object from the list.
removeLayer(object, innerMap, layer);
- return InterpolationDefault;
+ return InterpolationQuality::Default;
}
// There is no need to hash scaled images that always use low quality mode when the page demands it. This is the iChat case.
@@ -165,7 +165,7 @@
if (m_renderView.page().inLowQualityImageInterpolationMode()) {
double totalPixels = static_cast<double>(image.width()) * static_cast<double>(image.height());
if (totalPixels > cInterpolationCutoff)
- return InterpolationLow;
+ return InterpolationQuality::Low;
}
// If an animated resize is active, paint in low quality and kick the timer ahead.
@@ -172,7 +172,7 @@
if (m_animatedResizeIsActive) {
set(object, innerMap, layer, size);
restartTimer();
- return InterpolationLow;
+ return InterpolationQuality::Low;
}
// If this is the first time resizing this image, or its size is the
// same as the last resize, draw at high res, but record the paint
@@ -180,13 +180,13 @@
if (isFirstResize || oldSize == size) {
restartTimer();
set(object, innerMap, layer, size);
- return InterpolationDefault;
+ return InterpolationQuality::Default;
}
// If the timer is no longer active, draw at high quality and don't
// set the timer.
if (!m_timer.isActive()) {
removeLayer(object, innerMap, layer);
- return InterpolationDefault;
+ return InterpolationQuality::Default;
}
// This object has been resized to two different sizes while the timer
// is active, so draw at low quality, set the flag for animated resizes and
@@ -194,7 +194,7 @@
set(object, innerMap, layer, size);
m_animatedResizeIsActive = true;
restartTimer();
- return InterpolationLow;
+ return InterpolationQuality::Low;
}
}
Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (253248 => 253249)
--- trunk/Source/WebCore/rendering/RenderImage.cpp 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp 2019-12-07 13:30:16 UTC (rev 253249)
@@ -648,7 +648,7 @@
imageElement ? imageElement->compositeOperator() : CompositeOperator::SourceOver,
decodingModeForImageDraw(*image, paintInfo),
imageOrientation(),
- image ? chooseInterpolationQuality(paintInfo.context(), *image, image, LayoutSize(rect.size())) : InterpolationDefault
+ image ? chooseInterpolationQuality(paintInfo.context(), *image, image, LayoutSize(rect.size())) : InterpolationQuality::Default
};
auto drawResult = paintInfo.context().drawImage(*img, rect, options);
Modified: trunk/Source/WebKit/ChangeLog (253248 => 253249)
--- trunk/Source/WebKit/ChangeLog 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebKit/ChangeLog 2019-12-07 13:30:16 UTC (rev 253249)
@@ -1,3 +1,15 @@
+2019-12-07 Tim Horton <[email protected]>
+
+ Implement encoding for DrawImage and DrawRoundedRect display list items
+ https://bugs.webkit.org/show_bug.cgi?id=204881
+
+ Reviewed by Simon Fraser.
+
+ * Shared/WebCoreArgumentCoders.cpp:
+ (IPC::ArgumentCoder<DisplayList::ImageHandle>::encode):
+ (IPC::ArgumentCoder<DisplayList::ImageHandle>::decode):
+ * Shared/WebCoreArgumentCoders.h:
+
2019-12-06 Commit Queue <[email protected]>
Unreviewed, rolling out r253218.
Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp (253248 => 253249)
--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp 2019-12-07 13:30:16 UTC (rev 253249)
@@ -41,6 +41,7 @@
#include <WebCore/DatabaseDetails.h>
#include <WebCore/DictationAlternative.h>
#include <WebCore/DictionaryPopupInfo.h>
+#include <WebCore/DisplayListItems.h>
#include <WebCore/DragData.h>
#include <WebCore/EventTrackingRegions.h>
#include <WebCore/FetchOptions.h>
@@ -1143,6 +1144,18 @@
return decodeImage(decoder, image);
}
+void ArgumentCoder<DisplayList::ImageHandle>::encode(Encoder& encoder, const DisplayList::ImageHandle& imageHandle)
+{
+ encodeOptionalImage(encoder, imageHandle.image.get());
+}
+
+bool ArgumentCoder<DisplayList::ImageHandle>::decode(Decoder& decoder, DisplayList::ImageHandle& imageHandle)
+{
+ if (!decodeOptionalImage(decoder, imageHandle.image))
+ return false;
+ return true;
+}
+
#if !PLATFORM(IOS_FAMILY)
void ArgumentCoder<Cursor>::encode(Encoder& encoder, const Cursor& cursor)
{
Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h (253248 => 253249)
--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h 2019-12-07 13:30:16 UTC (rev 253249)
@@ -189,8 +189,13 @@
struct CacheInfo;
struct Record;
}
+
+namespace DisplayList {
+class ImageHandle;
}
+} // namespace WebCore
+
namespace IPC {
template<> struct ArgumentCoder<WebCore::AffineTransform> {
@@ -383,6 +388,11 @@
static bool decode(Decoder&, WebCore::Cursor&);
};
+template<> struct ArgumentCoder<WebCore::DisplayList::ImageHandle> {
+ static void encode(Encoder&, const WebCore::DisplayList::ImageHandle&);
+ static bool decode(Decoder&, WebCore::DisplayList::ImageHandle&);
+};
+
template<> struct ArgumentCoder<WebCore::ResourceRequest> {
static void encode(Encoder&, const WebCore::ResourceRequest&);
static bool decode(Decoder&, WebCore::ResourceRequest&);
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (253248 => 253249)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2019-12-07 13:30:16 UTC (rev 253249)
@@ -1,3 +1,13 @@
+2019-12-07 Tim Horton <[email protected]>
+
+ Implement encoding for DrawImage and DrawRoundedRect display list items
+ https://bugs.webkit.org/show_bug.cgi?id=204881
+
+ Reviewed by Simon Fraser.
+
+ * WebView/WebPreferences.mm:
+ (+[WebPreferences initialize]):
+
2019-12-06 Commit Queue <[email protected]>
Unreviewed, rolling out r253218.
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm (253248 => 253249)
--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm 2019-12-07 11:22:08 UTC (rev 253248)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm 2019-12-07 13:30:16 UTC (rev 253249)
@@ -579,7 +579,7 @@
[NSNumber numberWithFloat:-1.0f], WebKitMaxParseDurationPreferenceKey,
@NO, WebKitAllowMultiElementImplicitFormSubmissionPreferenceKey,
@NO, WebKitAlwaysRequestGeolocationPermissionPreferenceKey,
- [NSNumber numberWithInt:InterpolationLow], WebKitInterpolationQualityPreferenceKey,
+ [NSNumber numberWithInt:static_cast<int>(InterpolationQuality::Low)], WebKitInterpolationQualityPreferenceKey,
@YES, WebKitPasswordEchoEnabledPreferenceKey,
[NSNumber numberWithFloat:2.0f], WebKitPasswordEchoDurationPreferenceKey,
@NO, WebKitNetworkDataUsageTrackingEnabledPreferenceKey,