Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: Source/web/PageOverlay.cpp

Issue 398673003: Rename WebCore namespace to blink in bindings and web (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/PageOverlay.h ('k') | Source/web/PageOverlayList.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
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 "platform/graphics/GraphicsContext.h" 34 #include "platform/graphics/GraphicsContext.h"
35 #include "platform/graphics/GraphicsLayer.h" 35 #include "platform/graphics/GraphicsLayer.h"
36 #include "platform/graphics/GraphicsLayerClient.h" 36 #include "platform/graphics/GraphicsLayerClient.h"
37 #include "public/platform/WebLayer.h" 37 #include "public/platform/WebLayer.h"
38 #include "public/web/WebPageOverlay.h" 38 #include "public/web/WebPageOverlay.h"
39 #include "public/web/WebViewClient.h" 39 #include "public/web/WebViewClient.h"
40 #include "web/WebViewImpl.h" 40 #include "web/WebViewImpl.h"
41 41
42 using namespace WebCore; 42 using namespace blink;
43 43
44 namespace blink { 44 namespace blink {
45 45
46 namespace { 46 namespace {
47 47
48 WebCanvas* ToWebCanvas(GraphicsContext* gc) 48 WebCanvas* ToWebCanvas(GraphicsContext* gc)
49 { 49 {
50 return gc->canvas(); 50 return gc->canvas();
51 } 51 }
52 52
53 } // namespace 53 } // namespace
54 54
55 PassOwnPtr<PageOverlay> PageOverlay::create(WebViewImpl* viewImpl, WebPageOverla y* overlay) 55 PassOwnPtr<PageOverlay> PageOverlay::create(WebViewImpl* viewImpl, WebPageOverla y* overlay)
56 { 56 {
57 return adoptPtr(new PageOverlay(viewImpl, overlay)); 57 return adoptPtr(new PageOverlay(viewImpl, overlay));
58 } 58 }
59 59
60 PageOverlay::PageOverlay(WebViewImpl* viewImpl, WebPageOverlay* overlay) 60 PageOverlay::PageOverlay(WebViewImpl* viewImpl, WebPageOverlay* overlay)
61 : m_viewImpl(viewImpl) 61 : m_viewImpl(viewImpl)
62 , m_overlay(overlay) 62 , m_overlay(overlay)
63 , m_zOrder(0) 63 , m_zOrder(0)
64 { 64 {
65 } 65 }
66 66
67 class OverlayGraphicsLayerClientImpl : public WebCore::GraphicsLayerClient { 67 class OverlayGraphicsLayerClientImpl : public blink::GraphicsLayerClient {
68 public: 68 public:
69 static PassOwnPtr<OverlayGraphicsLayerClientImpl> create(WebPageOverlay* ove rlay) 69 static PassOwnPtr<OverlayGraphicsLayerClientImpl> create(WebPageOverlay* ove rlay)
70 { 70 {
71 return adoptPtr(new OverlayGraphicsLayerClientImpl(overlay)); 71 return adoptPtr(new OverlayGraphicsLayerClientImpl(overlay));
72 } 72 }
73 73
74 virtual ~OverlayGraphicsLayerClientImpl() { } 74 virtual ~OverlayGraphicsLayerClientImpl() { }
75 75
76 virtual void notifyAnimationStarted(const GraphicsLayer*, double monotonicTi me) OVERRIDE { } 76 virtual void notifyAnimationStarted(const GraphicsLayer*, double monotonicTi me) OVERRIDE { }
77 77
(...skipping 19 matching lines...) Expand all
97 97
98 WebPageOverlay* m_overlay; 98 WebPageOverlay* m_overlay;
99 }; 99 };
100 100
101 void PageOverlay::clear() 101 void PageOverlay::clear()
102 { 102 {
103 invalidateWebFrame(); 103 invalidateWebFrame();
104 104
105 if (m_layer) { 105 if (m_layer) {
106 m_layer->removeFromParent(); 106 m_layer->removeFromParent();
107 if (WebCore::Page* page = m_viewImpl->page()) 107 if (blink::Page* page = m_viewImpl->page())
108 page->inspectorController().didRemovePageOverlay(m_layer.get()); 108 page->inspectorController().didRemovePageOverlay(m_layer.get());
109 m_layer = nullptr; 109 m_layer = nullptr;
110 m_layerClient = nullptr; 110 m_layerClient = nullptr;
111 } 111 }
112 } 112 }
113 113
114 void PageOverlay::update() 114 void PageOverlay::update()
115 { 115 {
116 invalidateWebFrame(); 116 invalidateWebFrame();
117 117
118 if (!m_layer) { 118 if (!m_layer) {
119 m_layerClient = OverlayGraphicsLayerClientImpl::create(m_overlay); 119 m_layerClient = OverlayGraphicsLayerClientImpl::create(m_overlay);
120 m_layer = GraphicsLayer::create(m_viewImpl->graphicsLayerFactory(), m_la yerClient.get()); 120 m_layer = GraphicsLayer::create(m_viewImpl->graphicsLayerFactory(), m_la yerClient.get());
121 m_layer->setDrawsContent(true); 121 m_layer->setDrawsContent(true);
122 122
123 if (WebCore::Page* page = m_viewImpl->page()) 123 if (blink::Page* page = m_viewImpl->page())
124 page->inspectorController().willAddPageOverlay(m_layer.get()); 124 page->inspectorController().willAddPageOverlay(m_layer.get());
125 125
126 // This is required for contents of overlay to stay in sync with the pag e while scrolling. 126 // This is required for contents of overlay to stay in sync with the pag e while scrolling.
127 WebLayer* platformLayer = m_layer->platformLayer(); 127 WebLayer* platformLayer = m_layer->platformLayer();
128 platformLayer->setShouldScrollOnMainThread(true); 128 platformLayer->setShouldScrollOnMainThread(true);
129 } 129 }
130 130
131 FloatSize size(m_viewImpl->size()); 131 FloatSize size(m_viewImpl->size());
132 if (size != m_layer->size()) { 132 if (size != m_layer->size()) {
133 // Triggers re-adding to root layer to ensure that we are on top of 133 // Triggers re-adding to root layer to ensure that we are on top of
(...skipping 25 matching lines...) Expand all
159 // this is not on a critical codepath? In order to do so, we'd 159 // this is not on a critical codepath? In order to do so, we'd
160 // have to take scrolling into account. 160 // have to take scrolling into account.
161 const WebSize& size = m_viewImpl->size(); 161 const WebSize& size = m_viewImpl->size();
162 WebRect damagedRect(0, 0, size.width, size.height); 162 WebRect damagedRect(0, 0, size.width, size.height);
163 if (m_viewImpl->client()) 163 if (m_viewImpl->client())
164 m_viewImpl->client()->didInvalidateRect(damagedRect); 164 m_viewImpl->client()->didInvalidateRect(damagedRect);
165 } 165 }
166 } 166 }
167 167
168 } // namespace blink 168 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/PageOverlay.h ('k') | Source/web/PageOverlayList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698