Chromium Code Reviews| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 | 74 |
| 75 virtual void notifyAnimationStarted(const GraphicsLayer*, double time) { } | 75 virtual void notifyAnimationStarted(const GraphicsLayer*, double time) { } |
| 76 | 76 |
| 77 virtual void paintContents(const GraphicsLayer*, GraphicsContext& gc, Graphi csLayerPaintingPhase, const IntRect& inClip) | 77 virtual void paintContents(const GraphicsLayer*, GraphicsContext& gc, Graphi csLayerPaintingPhase, const IntRect& inClip) |
| 78 { | 78 { |
| 79 gc.save(); | 79 gc.save(); |
| 80 m_overlay->paintPageOverlay(ToWebCanvas(&gc)); | 80 m_overlay->paintPageOverlay(ToWebCanvas(&gc)); |
| 81 gc.restore(); | 81 gc.restore(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 virtual String debugName(const GraphicsLayer*) OVERRIDE | |
| 85 { | |
| 86 return String("WebViewImpl Page Overlay Content Layer"); | |
|
enne (OOO)
2013/07/30 17:31:05
Can you ASSERT that layer here is m_layer?
qiankun
2013/07/31 11:16:28
Done.
1. There is no m_layer member in OverlayGra
| |
| 87 } | |
| 88 | |
| 84 private: | 89 private: |
| 85 explicit OverlayGraphicsLayerClientImpl(WebPageOverlay* overlay) | 90 explicit OverlayGraphicsLayerClientImpl(WebPageOverlay* overlay) |
| 86 : m_overlay(overlay) | 91 : m_overlay(overlay) |
| 87 { | 92 { |
| 88 } | 93 } |
| 89 | 94 |
| 90 WebPageOverlay* m_overlay; | 95 WebPageOverlay* m_overlay; |
| 91 }; | 96 }; |
| 92 | 97 |
| 93 void PageOverlay::clear() | 98 void PageOverlay::clear() |
| 94 { | 99 { |
| 95 invalidateWebFrame(); | 100 invalidateWebFrame(); |
| 96 | 101 |
| 97 if (m_layer) { | 102 if (m_layer) { |
| 98 m_layer->removeFromParent(); | 103 m_layer->removeFromParent(); |
| 99 m_layer = nullptr; | 104 m_layer = nullptr; |
| 100 m_layerClient = nullptr; | 105 m_layerClient = nullptr; |
| 101 } | 106 } |
| 102 } | 107 } |
| 103 | 108 |
| 104 void PageOverlay::update() | 109 void PageOverlay::update() |
| 105 { | 110 { |
| 106 invalidateWebFrame(); | 111 invalidateWebFrame(); |
| 107 | 112 |
| 108 if (!m_layer) { | 113 if (!m_layer) { |
| 109 m_layerClient = OverlayGraphicsLayerClientImpl::create(m_overlay); | 114 m_layerClient = OverlayGraphicsLayerClientImpl::create(m_overlay); |
| 110 m_layer = GraphicsLayer::create(m_viewImpl->graphicsLayerFactory(), m_la yerClient.get()); | 115 m_layer = GraphicsLayer::create(m_viewImpl->graphicsLayerFactory(), m_la yerClient.get()); |
| 111 m_layer->setName("WebViewImpl page overlay content"); | |
| 112 m_layer->setDrawsContent(true); | 116 m_layer->setDrawsContent(true); |
| 113 } | 117 } |
| 114 | 118 |
| 115 FloatSize size(m_viewImpl->size()); | 119 FloatSize size(m_viewImpl->size()); |
| 116 if (size != m_layer->size()) { | 120 if (size != m_layer->size()) { |
| 117 // Triggers re-adding to root layer to ensure that we are on top of | 121 // Triggers re-adding to root layer to ensure that we are on top of |
| 118 // scrollbars. | 122 // scrollbars. |
| 119 m_layer->removeFromParent(); | 123 m_layer->removeFromParent(); |
| 120 m_layer->setSize(size); | 124 m_layer->setSize(size); |
| 121 } | 125 } |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 146 // this is not on a critical codepath? In order to do so, we'd | 150 // this is not on a critical codepath? In order to do so, we'd |
| 147 // have to take scrolling into account. | 151 // have to take scrolling into account. |
| 148 const WebSize& size = m_viewImpl->size(); | 152 const WebSize& size = m_viewImpl->size(); |
| 149 WebRect damagedRect(0, 0, size.width, size.height); | 153 WebRect damagedRect(0, 0, size.width, size.height); |
| 150 if (m_viewImpl->client()) | 154 if (m_viewImpl->client()) |
| 151 m_viewImpl->client()->didInvalidateRect(damagedRect); | 155 m_viewImpl->client()->didInvalidateRect(damagedRect); |
| 152 } | 156 } |
| 153 } | 157 } |
| 154 | 158 |
| 155 } // namespace WebKit | 159 } // namespace WebKit |
| OLD | NEW |