OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * | 10 * |
(...skipping 12 matching lines...) Expand all Loading... |
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #include "config.h" | 29 #include "config.h" |
30 #include "PageOverlay.h" | 30 #include "PageOverlay.h" |
31 | 31 |
32 #include "GraphicsLayer.h" | 32 #include "GraphicsLayer.h" |
| 33 #include "GraphicsLayerChromium.h" |
33 #include "GraphicsLayerClient.h" | 34 #include "GraphicsLayerClient.h" |
34 #include "Page.h" | 35 #include "Page.h" |
35 #include "PlatformContextSkia.h" | 36 #include "PlatformContextSkia.h" |
36 #include "Settings.h" | 37 #include "Settings.h" |
37 #include "WebPageOverlay.h" | 38 #include "WebPageOverlay.h" |
38 #include "WebViewClient.h" | 39 #include "WebViewClient.h" |
39 #include "WebViewImpl.h" | 40 #include "WebViewImpl.h" |
| 41 #include <public/WebLayer.h> |
40 | 42 |
41 using namespace WebCore; | 43 using namespace WebCore; |
42 | 44 |
43 namespace WebKit { | 45 namespace WebKit { |
44 | 46 |
45 namespace { | 47 namespace { |
46 | 48 |
47 WebCanvas* ToWebCanvas(GraphicsContext* gc) | 49 WebCanvas* ToWebCanvas(GraphicsContext* gc) |
48 { | 50 { |
49 return gc->platformContext()->canvas(); | 51 return gc->platformContext()->canvas(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 FloatSize size(m_viewImpl->size()); | 136 FloatSize size(m_viewImpl->size()); |
135 if (size != m_layer->size()) { | 137 if (size != m_layer->size()) { |
136 // Triggers re-adding to root layer to ensure that we are on top of | 138 // Triggers re-adding to root layer to ensure that we are on top of |
137 // scrollbars. | 139 // scrollbars. |
138 m_layer->removeFromParent(); | 140 m_layer->removeFromParent(); |
139 m_layer->setSize(size); | 141 m_layer->setSize(size); |
140 } | 142 } |
141 | 143 |
142 m_viewImpl->setOverlayLayer(m_layer.get()); | 144 m_viewImpl->setOverlayLayer(m_layer.get()); |
143 m_layer->setNeedsDisplay(); | 145 m_layer->setNeedsDisplay(); |
| 146 |
| 147 WebLayer* platformLayer = static_cast<GraphicsLayerChromium*>(m_layer.get())
->platformLayer(); |
| 148 platformLayer->setShouldScrollOnMainThread(true); |
144 #endif | 149 #endif |
145 } | 150 } |
146 | 151 |
147 void PageOverlay::paintWebFrame(GraphicsContext& gc) | 152 void PageOverlay::paintWebFrame(GraphicsContext& gc) |
148 { | 153 { |
149 if (!m_viewImpl->isAcceleratedCompositingActive()) { | 154 if (!m_viewImpl->isAcceleratedCompositingActive()) { |
150 gc.save(); | 155 gc.save(); |
151 m_overlay->paintPageOverlay(ToWebCanvas(&gc)); | 156 m_overlay->paintPageOverlay(ToWebCanvas(&gc)); |
152 gc.restore(); | 157 gc.restore(); |
153 } | 158 } |
154 } | 159 } |
155 | 160 |
156 void PageOverlay::invalidateWebFrame() | 161 void PageOverlay::invalidateWebFrame() |
157 { | 162 { |
158 // WebPageOverlay does the actual painting of the overlay. | 163 // WebPageOverlay does the actual painting of the overlay. |
159 // Here we just make sure to invalidate. | 164 // Here we just make sure to invalidate. |
160 if (!m_viewImpl->isAcceleratedCompositingActive()) { | 165 if (!m_viewImpl->isAcceleratedCompositingActive()) { |
161 // FIXME: able to invalidate a smaller rect. | 166 // FIXME: able to invalidate a smaller rect. |
162 // FIXME: Is it important to just invalidate a smaller rect given that | 167 // FIXME: Is it important to just invalidate a smaller rect given that |
163 // this is not on a critical codepath? In order to do so, we'd | 168 // this is not on a critical codepath? In order to do so, we'd |
164 // have to take scrolling into account. | 169 // have to take scrolling into account. |
165 const WebSize& size = m_viewImpl->size(); | 170 const WebSize& size = m_viewImpl->size(); |
166 WebRect damagedRect(0, 0, size.width, size.height); | 171 WebRect damagedRect(0, 0, size.width, size.height); |
167 if (m_viewImpl->client()) | 172 if (m_viewImpl->client()) |
168 m_viewImpl->client()->didInvalidateRect(damagedRect); | 173 m_viewImpl->client()->didInvalidateRect(damagedRect); |
169 } | 174 } |
170 } | 175 } |
171 | 176 |
172 } // namespace WebKit | 177 } // namespace WebKit |
OLD | NEW |