OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/paint/FilterPainter.h" | 5 #include "core/paint/FilterPainter.h" |
6 | 6 |
7 #include "core/paint/FilterEffectBuilder.h" | 7 #include "core/paint/FilterEffectBuilder.h" |
8 #include "core/paint/LayerClipRecorder.h" | 8 #include "core/paint/LayerClipRecorder.h" |
9 #include "core/paint/PaintLayer.h" | 9 #include "core/paint/PaintLayer.h" |
10 #include "platform/RuntimeEnabledFeatures.h" | 10 #include "platform/RuntimeEnabledFeatures.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 if (!context.paintController().displayItemConstructionIsDisabled()) { | 62 if (!context.paintController().displayItemConstructionIsDisabled()) { |
63 FilterOperations filterOperations(layer.computeFilterOperations(m_layout
Object->styleRef())); | 63 FilterOperations filterOperations(layer.computeFilterOperations(m_layout
Object->styleRef())); |
64 OwnPtr<WebFilterOperations> webFilterOperations = adoptPtr(Platform::cur
rent()->compositorSupport()->createFilterOperations()); | 64 OwnPtr<WebFilterOperations> webFilterOperations = adoptPtr(Platform::cur
rent()->compositorSupport()->createFilterOperations()); |
65 builder.buildFilterOperations(filterOperations, webFilterOperations.get(
)); | 65 builder.buildFilterOperations(filterOperations, webFilterOperations.get(
)); |
66 // FIXME: It's possible to have empty WebFilterOperations here even | 66 // FIXME: It's possible to have empty WebFilterOperations here even |
67 // though the SkImageFilter produced above is non-null, since the | 67 // though the SkImageFilter produced above is non-null, since the |
68 // layer's FilterEffectBuilder can have a stale representation of | 68 // layer's FilterEffectBuilder can have a stale representation of |
69 // the layer's filter. See crbug.com/502026. | 69 // the layer's filter. See crbug.com/502026. |
70 if (webFilterOperations->isEmpty()) | 70 if (webFilterOperations->isEmpty()) |
71 return; | 71 return; |
72 context.paintController().createAndAppend<BeginFilterDisplayItem>(*m_lay
outObject, imageFilter, FloatRect(rootRelativeBounds), webFilterOperations.relea
se()); | 72 LayoutRect visualBounds(rootRelativeBounds); |
| 73 if (layer.enclosingPaginationLayer()) { |
| 74 // Filters are set up before pagination, so we need to make the boun
ding box visual on our own. |
| 75 visualBounds.moveBy(-offsetFromRoot); |
| 76 layer.convertFromFlowThreadToVisualBoundingBoxInAncestor(paintingInf
o.rootLayer, visualBounds); |
| 77 } |
| 78 context.paintController().createAndAppend<BeginFilterDisplayItem>(*m_lay
outObject, imageFilter, FloatRect(visualBounds), webFilterOperations.release()); |
73 } | 79 } |
74 | 80 |
75 m_filterInProgress = true; | 81 m_filterInProgress = true; |
76 } | 82 } |
77 | 83 |
78 FilterPainter::~FilterPainter() | 84 FilterPainter::~FilterPainter() |
79 { | 85 { |
80 if (!m_filterInProgress) | 86 if (!m_filterInProgress) |
81 return; | 87 return; |
82 | 88 |
83 m_context.paintController().endItem<EndFilterDisplayItem>(*m_layoutObject); | 89 m_context.paintController().endItem<EndFilterDisplayItem>(*m_layoutObject); |
84 } | 90 } |
85 | 91 |
86 } // namespace blink | 92 } // namespace blink |
OLD | NEW |