| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 return; | 78 return; |
| 79 | 79 |
| 80 if (!m_layer) { | 80 if (!m_layer) { |
| 81 m_layer = GraphicsLayer::create(m_viewImpl->graphicsLayerFactory(), this
); | 81 m_layer = GraphicsLayer::create(m_viewImpl->graphicsLayerFactory(), this
); |
| 82 m_layer->setDrawsContent(true); | 82 m_layer->setDrawsContent(true); |
| 83 | 83 |
| 84 if (WebDevToolsAgentImpl* devTools = m_viewImpl->mainFrameDevToolsAgentI
mpl()) | 84 if (WebDevToolsAgentImpl* devTools = m_viewImpl->mainFrameDevToolsAgentI
mpl()) |
| 85 devTools->willAddPageOverlay(m_layer.get()); | 85 devTools->willAddPageOverlay(m_layer.get()); |
| 86 | 86 |
| 87 // This is required for contents of overlay to stay in sync with the pag
e while scrolling. | 87 // This is required for contents of overlay to stay in sync with the pag
e while scrolling. |
| 88 WebLayer* platformLayer = m_layer->platformLayer(); | 88 m_layer->setMainThreadScrollingReasons(MainThreadScrollingReason::kPageO
verlay); |
| 89 platformLayer->addMainThreadScrollingReasons(MainThreadScrollingReason::
kPageOverlay); | |
| 90 page->frameHost().visualViewport().containerLayer()->addChild(m_layer.ge
t()); | 89 page->frameHost().visualViewport().containerLayer()->addChild(m_layer.ge
t()); |
| 91 } | 90 } |
| 92 | 91 |
| 93 FloatSize size(page->frameHost().visualViewport().size()); | 92 FloatSize size(page->frameHost().visualViewport().size()); |
| 94 if (size != m_layer->size()) | 93 if (size != m_layer->size()) |
| 95 m_layer->setSize(size); | 94 m_layer->setSize(size); |
| 96 | 95 |
| 97 m_layer->setNeedsDisplay(); | 96 m_layer->setNeedsDisplay(); |
| 98 } | 97 } |
| 99 | 98 |
| 100 IntRect PageOverlay::computeInterestRect(const GraphicsLayer* graphicsLayer, con
st IntRect&) const | 99 IntRect PageOverlay::computeInterestRect(const GraphicsLayer* graphicsLayer, con
st IntRect&) const |
| 101 { | 100 { |
| 102 return IntRect(IntPoint(), expandedIntSize(m_layer->size())); | 101 return IntRect(IntPoint(), expandedIntSize(m_layer->size())); |
| 103 } | 102 } |
| 104 | 103 |
| 105 void PageOverlay::paintContents(const GraphicsLayer* graphicsLayer, GraphicsCont
ext& gc, GraphicsLayerPaintingPhase phase, const IntRect& interestRect) const | 104 void PageOverlay::paintContents(const GraphicsLayer* graphicsLayer, GraphicsCont
ext& gc, GraphicsLayerPaintingPhase phase, const IntRect& interestRect) const |
| 106 { | 105 { |
| 107 ASSERT(m_layer); | 106 ASSERT(m_layer); |
| 108 m_delegate->paintPageOverlay(*this, gc, interestRect.size()); | 107 m_delegate->paintPageOverlay(*this, gc, interestRect.size()); |
| 109 } | 108 } |
| 110 | 109 |
| 111 String PageOverlay::debugName(const GraphicsLayer*) const | 110 String PageOverlay::debugName(const GraphicsLayer*) const |
| 112 { | 111 { |
| 113 return "WebViewImpl Page Overlay Content Layer"; | 112 return "WebViewImpl Page Overlay Content Layer"; |
| 114 } | 113 } |
| 115 | 114 |
| 116 } // namespace blink | 115 } // namespace blink |
| OLD | NEW |