| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #include "web/PageOverlay.h" | 29 #include "web/PageOverlay.h" |
| 30 | 30 |
| 31 #include "core/frame/FrameHost.h" | 31 #include "core/frame/FrameHost.h" |
| 32 #include "core/frame/Settings.h" | 32 #include "core/frame/Settings.h" |
| 33 #include "core/page/Page.h" | 33 #include "core/page/Page.h" |
| 34 #include "core/page/scrolling/ScrollingCoordinator.h" | 34 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 35 #include "platform/graphics/GraphicsContext.h" | 35 #include "platform/graphics/GraphicsContext.h" |
| 36 #include "platform/graphics/GraphicsLayer.h" | 36 #include "platform/graphics/GraphicsLayer.h" |
| 37 #include "platform/graphics/GraphicsLayerClient.h" | 37 #include "platform/graphics/GraphicsLayerClient.h" |
| 38 #include "platform/scroll/MainThreadScrollingReason.h" |
| 38 #include "public/platform/WebLayer.h" | 39 #include "public/platform/WebLayer.h" |
| 39 #include "public/web/WebViewClient.h" | 40 #include "public/web/WebViewClient.h" |
| 40 #include "web/WebDevToolsAgentImpl.h" | 41 #include "web/WebDevToolsAgentImpl.h" |
| 41 #include "web/WebViewImpl.h" | 42 #include "web/WebViewImpl.h" |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| 45 PassOwnPtr<PageOverlay> PageOverlay::create(WebViewImpl* viewImpl, PageOverlay::
Delegate* delegate) | 46 PassOwnPtr<PageOverlay> PageOverlay::create(WebViewImpl* viewImpl, PageOverlay::
Delegate* delegate) |
| 46 { | 47 { |
| 47 return adoptPtr(new PageOverlay(viewImpl, delegate)); | 48 return adoptPtr(new PageOverlay(viewImpl, delegate)); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 78 | 79 |
| 79 if (!m_layer) { | 80 if (!m_layer) { |
| 80 m_layer = GraphicsLayer::create(m_viewImpl->graphicsLayerFactory(), this
); | 81 m_layer = GraphicsLayer::create(m_viewImpl->graphicsLayerFactory(), this
); |
| 81 m_layer->setDrawsContent(true); | 82 m_layer->setDrawsContent(true); |
| 82 | 83 |
| 83 if (WebDevToolsAgentImpl* devTools = m_viewImpl->mainFrameDevToolsAgentI
mpl()) | 84 if (WebDevToolsAgentImpl* devTools = m_viewImpl->mainFrameDevToolsAgentI
mpl()) |
| 84 devTools->willAddPageOverlay(m_layer.get()); | 85 devTools->willAddPageOverlay(m_layer.get()); |
| 85 | 86 |
| 86 // 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. |
| 87 WebLayer* platformLayer = m_layer->platformLayer(); | 88 WebLayer* platformLayer = m_layer->platformLayer(); |
| 88 platformLayer->addMainThreadScrollingReasons(WebMainThreadScrollingReaso
n::PageOverlay); | 89 platformLayer->addMainThreadScrollingReasons(MainThreadScrollingReason::
kPageOverlay); |
| 89 page->frameHost().visualViewport().containerLayer()->addChild(m_layer.ge
t()); | 90 page->frameHost().visualViewport().containerLayer()->addChild(m_layer.ge
t()); |
| 90 } | 91 } |
| 91 | 92 |
| 92 FloatSize size(page->frameHost().visualViewport().size()); | 93 FloatSize size(page->frameHost().visualViewport().size()); |
| 93 if (size != m_layer->size()) | 94 if (size != m_layer->size()) |
| 94 m_layer->setSize(size); | 95 m_layer->setSize(size); |
| 95 | 96 |
| 96 m_layer->setNeedsDisplay(); | 97 m_layer->setNeedsDisplay(); |
| 97 } | 98 } |
| 98 | 99 |
| 99 IntRect PageOverlay::computeInterestRect(const GraphicsLayer* graphicsLayer, con
st IntRect&) const | 100 IntRect PageOverlay::computeInterestRect(const GraphicsLayer* graphicsLayer, con
st IntRect&) const |
| 100 { | 101 { |
| 101 return IntRect(IntPoint(), expandedIntSize(m_layer->size())); | 102 return IntRect(IntPoint(), expandedIntSize(m_layer->size())); |
| 102 } | 103 } |
| 103 | 104 |
| 104 void PageOverlay::paintContents(const GraphicsLayer* graphicsLayer, GraphicsCont
ext& gc, GraphicsLayerPaintingPhase phase, const IntRect& interestRect) const | 105 void PageOverlay::paintContents(const GraphicsLayer* graphicsLayer, GraphicsCont
ext& gc, GraphicsLayerPaintingPhase phase, const IntRect& interestRect) const |
| 105 { | 106 { |
| 106 ASSERT(m_layer); | 107 ASSERT(m_layer); |
| 107 m_delegate->paintPageOverlay(*this, gc, interestRect.size()); | 108 m_delegate->paintPageOverlay(*this, gc, interestRect.size()); |
| 108 } | 109 } |
| 109 | 110 |
| 110 String PageOverlay::debugName(const GraphicsLayer*) const | 111 String PageOverlay::debugName(const GraphicsLayer*) const |
| 111 { | 112 { |
| 112 return "WebViewImpl Page Overlay Content Layer"; | 113 return "WebViewImpl Page Overlay Content Layer"; |
| 113 } | 114 } |
| 114 | 115 |
| 115 } // namespace blink | 116 } // namespace blink |
| OLD | NEW |