OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007, 2008 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) 2009 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
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 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 ->masker() == m_masker); | 54 ->masker() == m_masker); |
55 SVGMaskPainter(*m_masker).finishEffect(m_object, paintInfo().context); | 55 SVGMaskPainter(*m_masker).finishEffect(m_object, paintInfo().context); |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 bool SVGPaintContext::applyClipMaskAndFilterIfNecessary() { | 59 bool SVGPaintContext::applyClipMaskAndFilterIfNecessary() { |
60 #if ENABLE(ASSERT) | 60 #if ENABLE(ASSERT) |
61 DCHECK(!m_applyClipMaskAndFilterIfNecessaryCalled); | 61 DCHECK(!m_applyClipMaskAndFilterIfNecessaryCalled); |
62 m_applyClipMaskAndFilterIfNecessaryCalled = true; | 62 m_applyClipMaskAndFilterIfNecessaryCalled = true; |
63 #endif | 63 #endif |
| 64 // In SPv2 we should early exit once the paint property state has been |
| 65 // applied, because all meta (non-drawing) display items are ignored in |
| 66 // SPv2. However we can't simply omit them because there are still |
| 67 // non-composited painting (e.g. SVG filters in particular) that rely on |
| 68 // these meta display items. |
| 69 applyPaintPropertyState(); |
64 | 70 |
65 // When rendering clip paths as masks, only geometric operations should be | 71 // When rendering clip paths as masks, only geometric operations should be |
66 // included so skip non-geometric operations such as compositing, masking, and | 72 // included so skip non-geometric operations such as compositing, masking, and |
67 // filtering. | 73 // filtering. |
68 if (paintInfo().isRenderingClipPathAsMaskImage()) { | 74 if (paintInfo().isRenderingClipPathAsMaskImage()) { |
69 DCHECK(!m_object.isSVGRoot()); | 75 DCHECK(!m_object.isSVGRoot()); |
70 applyClipIfNecessary(); | 76 applyClipIfNecessary(); |
71 return true; | 77 return true; |
72 } | 78 } |
73 | 79 |
(...skipping 27 matching lines...) Expand all Loading... |
101 | 107 |
102 if (!isIsolationInstalled() && | 108 if (!isIsolationInstalled() && |
103 SVGLayoutSupport::isIsolationRequired(&m_object)) { | 109 SVGLayoutSupport::isIsolationRequired(&m_object)) { |
104 m_compositingRecorder = WTF::wrapUnique(new CompositingRecorder( | 110 m_compositingRecorder = WTF::wrapUnique(new CompositingRecorder( |
105 paintInfo().context, m_object, SkBlendMode::kSrcOver, 1)); | 111 paintInfo().context, m_object, SkBlendMode::kSrcOver, 1)); |
106 } | 112 } |
107 | 113 |
108 return true; | 114 return true; |
109 } | 115 } |
110 | 116 |
| 117 void SVGPaintContext::applyPaintPropertyState() { |
| 118 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 119 return; |
| 120 |
| 121 // SVGRoot works like normal CSS replaced element and its effects are |
| 122 // applied as stacking context effect by PaintLayerPainter. |
| 123 if (m_object.isSVGRoot()) |
| 124 return; |
| 125 |
| 126 const auto* paintProperties = m_object.paintProperties(); |
| 127 const EffectPaintPropertyNode* effect = |
| 128 paintProperties ? paintProperties->effect() : nullptr; |
| 129 if (!effect) |
| 130 return; |
| 131 |
| 132 auto& paintController = paintInfo().context.getPaintController(); |
| 133 PaintChunkProperties properties( |
| 134 paintController.currentPaintChunkProperties()); |
| 135 properties.propertyTreeState.setEffect(effect); |
| 136 m_scopedPaintChunkProperties.emplace(paintController, m_object, properties); |
| 137 } |
| 138 |
111 void SVGPaintContext::applyCompositingIfNecessary() { | 139 void SVGPaintContext::applyCompositingIfNecessary() { |
112 DCHECK(!paintInfo().isRenderingClipPathAsMaskImage()); | 140 DCHECK(!paintInfo().isRenderingClipPathAsMaskImage()); |
113 | 141 |
114 const ComputedStyle& style = m_object.styleRef(); | 142 const ComputedStyle& style = m_object.styleRef(); |
115 float opacity = style.opacity(); | 143 float opacity = style.opacity(); |
116 WebBlendMode blendMode = style.hasBlendMode() && m_object.isBlendingAllowed() | 144 WebBlendMode blendMode = style.hasBlendMode() && m_object.isBlendingAllowed() |
117 ? style.blendMode() | 145 ? style.blendMode() |
118 : WebBlendModeNormal; | 146 : WebBlendModeNormal; |
119 if (opacity < 1 || blendMode != WebBlendModeNormal) { | 147 if (opacity < 1 || blendMode != WebBlendModeNormal) { |
120 const FloatRect compositingBounds = | 148 const FloatRect compositingBounds = |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // though. | 269 // though. |
242 // Additionally, it's not really safe/guaranteed to be correct, as | 270 // Additionally, it's not really safe/guaranteed to be correct, as |
243 // something down the paint pipe may want to farther tweak the color | 271 // something down the paint pipe may want to farther tweak the color |
244 // filter, which could yield incorrect results. (Consider just using | 272 // filter, which could yield incorrect results. (Consider just using |
245 // saveLayer() w/ this color filter explicitly instead.) | 273 // saveLayer() w/ this color filter explicitly instead.) |
246 paint.setColorFilter(sk_ref_sp(paintInfo.context.getColorFilter())); | 274 paint.setColorFilter(sk_ref_sp(paintInfo.context.getColorFilter())); |
247 return true; | 275 return true; |
248 } | 276 } |
249 | 277 |
250 } // namespace blink | 278 } // namespace blink |
OLD | NEW |