| Index: third_party/WebKit/Source/core/paint/SVGPaintContext.h
|
| diff --git a/third_party/WebKit/Source/core/paint/SVGPaintContext.h b/third_party/WebKit/Source/core/paint/SVGPaintContext.h
|
| index b493dde83d2fca7ac3e595d0b44747a15d0f7f9d..f3c84dd5e6b4dcfa6d3a5ceb4edfb17ea8edc88e 100644
|
| --- a/third_party/WebKit/Source/core/paint/SVGPaintContext.h
|
| +++ b/third_party/WebKit/Source/core/paint/SVGPaintContext.h
|
| @@ -27,11 +27,14 @@
|
|
|
| #include "core/layout/svg/LayoutSVGResourceClipper.h"
|
| #include "core/layout/svg/LayoutSVGResourcePaintServer.h"
|
| +#include "core/paint/ObjectPaintProperties.h"
|
| #include "core/paint/PaintInfo.h"
|
| #include "core/paint/SVGClipPainter.h"
|
| #include "core/paint/SVGFilterPainter.h"
|
| +#include "core/paint/TransformRecorder.h"
|
| #include "platform/graphics/paint/ClipPathRecorder.h"
|
| #include "platform/graphics/paint/CompositingRecorder.h"
|
| +#include "platform/graphics/paint/ScopedPaintChunkProperties.h"
|
| #include "platform/transforms/AffineTransform.h"
|
| #include <memory>
|
|
|
| @@ -42,6 +45,49 @@ class LayoutSVGResourceFilter;
|
| class LayoutSVGResourceMasker;
|
| class SVGResources;
|
|
|
| +// This class hooks up the correct paint property transform node when spv2 is enabled, and otherwise
|
| +// works like a TransformRecorder which emits Transform display items for spv1.
|
| +class SVGTransformContext : public TransformRecorder {
|
| + STACK_ALLOCATED();
|
| +public:
|
| + SVGTransformContext(GraphicsContext& context, const LayoutObject& object, const AffineTransform& transform)
|
| + : TransformRecorder(context, object, transform)
|
| + {
|
| + if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
|
| + const auto* objectProperties = object.objectPaintProperties();
|
| + if (!objectProperties)
|
| + return;
|
| + if (object.isSVGRoot()) {
|
| + // If a transform exists, we can rely on a layer existing to apply it.
|
| + DCHECK(!objectProperties || !objectProperties->transform() || object.hasLayer());
|
| + if (objectProperties->svgLocalToBorderBoxTransform()) {
|
| + // FIXME(pdr): Enable the following DCHECK once the pixel snapping logic has
|
| + // been included in svgLocalToBorderBox.
|
| + // DCHECK(objectProperties->svgLocalToBorderBoxTransform()->matrix() == transform.toTransformationMatrix());
|
| + auto& paintController = context.getPaintController();
|
| + PaintChunkProperties properties(paintController.currentPaintChunkProperties());
|
| + properties.transform = objectProperties->svgLocalToBorderBoxTransform();
|
| + m_transformPropertyScope.emplace(paintController, properties);
|
| + }
|
| + } else {
|
| + DCHECK(object.isSVG());
|
| + // Should only be used by LayoutSVGRoot.
|
| + DCHECK(!objectProperties->svgLocalToBorderBoxTransform());
|
| +
|
| + if (objectProperties->transform()) {
|
| + DCHECK(objectProperties->transform()->matrix() == transform.toTransformationMatrix());
|
| + auto& paintController = context.getPaintController();
|
| + PaintChunkProperties properties(paintController.currentPaintChunkProperties());
|
| + properties.transform = objectProperties->transform();
|
| + m_transformPropertyScope.emplace(paintController, properties);
|
| + }
|
| + }
|
| + }
|
| + }
|
| +private:
|
| + Optional<ScopedPaintChunkProperties> m_transformPropertyScope;
|
| +};
|
| +
|
| class SVGPaintContext {
|
| STACK_ALLOCATED();
|
| public:
|
|
|