Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /** | 1 /** |
| 2 * Copyright (C) 2007 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007 Rob Buis <buis@kde.org> |
| 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
| 5 * Copyright (C) 2009 Google, Inc. All rights reserved. | 5 * Copyright (C) 2009 Google, Inc. All rights reserved. |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 7 * Copyright (C) 2012 Zoltan Herczeg <zherczeg@webkit.org>. | 7 * Copyright (C) 2012 Zoltan Herczeg <zherczeg@webkit.org>. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| 11 * License as published by the Free Software Foundation; either | 11 * License as published by the Free Software Foundation; either |
| 12 * version 2 of the License, or (at your option) any later version. | 12 * version 2 of the License, or (at your option) any later version. |
| 13 * | 13 * |
| 14 * This library is distributed in the hope that it will be useful, | 14 * This library is distributed in the hope that it will be useful, |
| 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 * Library General Public License for more details. | 17 * Library General Public License for more details. |
| 18 * | 18 * |
| 19 * You should have received a copy of the GNU Library General Public License | 19 * You should have received a copy of the GNU Library General Public License |
| 20 * along with this library; see the file COPYING.LIB. If not, write to | 20 * along with this library; see the file COPYING.LIB. If not, write to |
| 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 22 * Boston, MA 02110-1301, USA. | 22 * Boston, MA 02110-1301, USA. |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #ifndef SVGPaintContext_h | 25 #ifndef SVGPaintContext_h |
| 26 #define SVGPaintContext_h | 26 #define SVGPaintContext_h |
| 27 | 27 |
| 28 #include "core/layout/svg/LayoutSVGResourceClipper.h" | 28 #include "core/layout/svg/LayoutSVGResourceClipper.h" |
| 29 #include "core/layout/svg/LayoutSVGResourcePaintServer.h" | 29 #include "core/layout/svg/LayoutSVGResourcePaintServer.h" |
| 30 #include "core/paint/ObjectPaintProperties.h" | |
| 30 #include "core/paint/PaintInfo.h" | 31 #include "core/paint/PaintInfo.h" |
| 31 #include "core/paint/SVGClipPainter.h" | 32 #include "core/paint/SVGClipPainter.h" |
| 32 #include "core/paint/SVGFilterPainter.h" | 33 #include "core/paint/SVGFilterPainter.h" |
| 34 #include "core/paint/TransformRecorder.h" | |
| 33 #include "platform/graphics/paint/ClipPathRecorder.h" | 35 #include "platform/graphics/paint/ClipPathRecorder.h" |
| 34 #include "platform/graphics/paint/CompositingRecorder.h" | 36 #include "platform/graphics/paint/CompositingRecorder.h" |
| 37 #include "platform/graphics/paint/ScopedPaintChunkProperties.h" | |
| 35 #include "platform/transforms/AffineTransform.h" | 38 #include "platform/transforms/AffineTransform.h" |
| 36 | 39 |
| 37 namespace blink { | 40 namespace blink { |
| 38 | 41 |
| 39 class LayoutObject; | 42 class LayoutObject; |
| 40 class LayoutSVGResourceFilter; | 43 class LayoutSVGResourceFilter; |
| 41 class LayoutSVGResourceMasker; | 44 class LayoutSVGResourceMasker; |
| 42 class SVGResources; | 45 class SVGResources; |
| 43 | 46 |
| 47 // This class hooks up the correct paint property transform node when spv2 is en abled, and otherwise | |
| 48 // works like a TransformRecorder which emits Transform display items for spv1. | |
| 49 class SVGTransformContext : public TransformRecorder { | |
| 50 STACK_ALLOCATED(); | |
| 51 public: | |
| 52 SVGTransformContext(GraphicsContext& context, const LayoutObject& object, co nst AffineTransform& transform) | |
| 53 : TransformRecorder(context, object, transform) | |
| 54 { | |
| 55 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | |
| 56 const auto* objectProperties = object.objectPaintProperties(); | |
| 57 if (!objectProperties) | |
| 58 return; | |
| 59 if (object.isSVGRoot()) { | |
| 60 // If a transform exists, we can rely on a layer existing to app ly it. | |
| 61 DCHECK(!objectProperties || !objectProperties->transform() || ob ject.hasLayer()); | |
| 62 if (objectProperties->svgLocalToBorderBoxTransform()) { | |
|
trchen
2016/06/13 22:45:18
Is it possible to add a DCHECK here to verify the
pdr.
2016/06/13 23:03:19
These will actually be different because the svg r
trchen
2016/06/13 23:26:52
At this point we are in the border box space of th
pdr.
2016/06/21 22:26:21
Ahh, I misunderstood what you meant. Excellent poi
| |
| 63 auto& paintController = context.getPaintController(); | |
| 64 PaintChunkProperties properties(paintController.currentPaint ChunkProperties()); | |
| 65 properties.transform = objectProperties->svgLocalToBorderBox Transform(); | |
| 66 m_transformPropertyScope.emplace(paintController, properties ); | |
| 67 } | |
| 68 } else { | |
| 69 DCHECK(object.isSVG()); | |
| 70 // Should only be used by LayoutSVGRoot. | |
| 71 DCHECK(!objectProperties->svgLocalToBorderBoxTransform()); | |
| 72 | |
| 73 if (objectProperties->transform()) { | |
|
trchen
2016/06/13 22:45:19
Ditto.
pdr.
2016/06/13 23:03:19
svgLocalToBorderBoxTransform will only be set on t
trchen
2016/06/13 23:26:52
I mean something similar like
DCHECK_EQ(objectProp
pdr.
2016/06/21 22:26:21
Done. This actually caught a bug in PaintPropertyT
| |
| 74 auto& paintController = context.getPaintController(); | |
| 75 PaintChunkProperties properties(paintController.currentPaint ChunkProperties()); | |
| 76 properties.transform = objectProperties->transform(); | |
| 77 m_transformPropertyScope.emplace(paintController, properties ); | |
| 78 } | |
| 79 } | |
| 80 } | |
| 81 } | |
| 82 private: | |
| 83 Optional<ScopedPaintChunkProperties> m_transformPropertyScope; | |
| 84 }; | |
| 85 | |
| 44 class SVGPaintContext { | 86 class SVGPaintContext { |
| 45 STACK_ALLOCATED(); | 87 STACK_ALLOCATED(); |
| 46 public: | 88 public: |
| 47 SVGPaintContext(const LayoutObject& object, const PaintInfo& paintInfo) | 89 SVGPaintContext(const LayoutObject& object, const PaintInfo& paintInfo) |
| 48 : m_object(object) | 90 : m_object(object) |
| 49 , m_paintInfo(paintInfo) | 91 , m_paintInfo(paintInfo) |
| 50 , m_filter(nullptr) | 92 , m_filter(nullptr) |
| 51 , m_clipper(nullptr) | 93 , m_clipper(nullptr) |
| 52 , m_clipperState(SVGClipPainter::ClipperNotApplied) | 94 , m_clipperState(SVGClipPainter::ClipperNotApplied) |
| 53 , m_masker(nullptr) | 95 , m_masker(nullptr) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 OwnPtr<ClipPathRecorder> m_clipPathRecorder; | 136 OwnPtr<ClipPathRecorder> m_clipPathRecorder; |
| 95 OwnPtr<SVGFilterRecordingContext> m_filterRecordingContext; | 137 OwnPtr<SVGFilterRecordingContext> m_filterRecordingContext; |
| 96 #if ENABLE(ASSERT) | 138 #if ENABLE(ASSERT) |
| 97 bool m_applyClipMaskAndFilterIfNecessaryCalled; | 139 bool m_applyClipMaskAndFilterIfNecessaryCalled; |
| 98 #endif | 140 #endif |
| 99 }; | 141 }; |
| 100 | 142 |
| 101 } // namespace blink | 143 } // namespace blink |
| 102 | 144 |
| 103 #endif // SVGPaintContext_h | 145 #endif // SVGPaintContext_h |
| OLD | NEW |