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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 FrameView* view = m_overlay.overlayMainFrame()->view(); | 103 FrameView* view = m_overlay.overlayMainFrame()->view(); |
104 ASSERT(!view->needsLayout()); | 104 ASSERT(!view->needsLayout()); |
105 view->paint(&graphicsContext, IntRect(0, 0, view->width(), view->height( ))); | 105 view->paint(&graphicsContext, IntRect(0, 0, view->width(), view->height( ))); |
106 } | 106 } |
107 | 107 |
108 private: | 108 private: |
109 InspectorOverlayImpl& m_overlay; | 109 InspectorOverlayImpl& m_overlay; |
110 }; | 110 }; |
111 | 111 |
112 | 112 |
113 class InspectorOverlayImpl::InspectorOverlayChromeClient final: public EmptyChro meClient { | 113 class InspectorOverlayImpl::InspectorOverlayChromeClient final : public EmptyChr omeClient { |
114 public: | 114 public: |
115 InspectorOverlayChromeClient(ChromeClient& client, InspectorOverlayImpl& ove rlay) | 115 static PassOwnPtrWillBeRawPtr<InspectorOverlayChromeClient> create(ChromeCli ent& client, InspectorOverlayImpl& overlay) |
116 : m_client(client) | 116 { |
117 , m_overlay(overlay) | 117 return adoptPtrWillBeNoop(new InspectorOverlayChromeClient(client, overl ay)); |
118 { } | 118 } |
119 | |
120 DEFINE_INLINE_VIRTUAL_TRACE() | |
121 { | |
122 visitor->trace(m_overlay); | |
123 EmptyChromeClient::trace(visitor); | |
124 } | |
119 | 125 |
120 void setCursor(const Cursor& cursor) override | 126 void setCursor(const Cursor& cursor) override |
121 { | 127 { |
122 m_client.setCursor(cursor); | 128 m_client.setCursor(cursor); |
123 } | 129 } |
124 | 130 |
125 void setToolTip(const String& tooltip, TextDirection direction) override | 131 void setToolTip(const String& tooltip, TextDirection direction) override |
126 { | 132 { |
127 m_client.setToolTip(tooltip, direction); | 133 m_client.setToolTip(tooltip, direction); |
128 } | 134 } |
129 | 135 |
130 void invalidateRect(const IntRect&) override | 136 void invalidateRect(const IntRect&) override |
131 { | 137 { |
132 m_overlay.invalidate(); | 138 m_overlay->invalidate(); |
133 } | 139 } |
134 | 140 |
135 void scheduleAnimation() override | 141 void scheduleAnimation() override |
136 { | 142 { |
137 if (m_overlay.m_inLayout) | 143 if (m_overlay->m_inLayout) |
138 return; | 144 return; |
139 | 145 |
140 m_client.scheduleAnimation(); | 146 m_client.scheduleAnimation(); |
141 } | 147 } |
142 | 148 |
143 private: | 149 private: |
150 InspectorOverlayChromeClient(ChromeClient& client, InspectorOverlayImpl& ove rlay) | |
151 : m_client(client) | |
152 , m_overlay(&overlay) | |
153 { } | |
154 | |
144 ChromeClient& m_client; | 155 ChromeClient& m_client; |
haraken
2015/08/14 14:38:41
This needs to be a RawPtrWillBeMember. It is dange
Yuta Kitamura
2015/08/17 08:03:21
Ouch, this was the one I intended to fix, but has
| |
145 InspectorOverlayImpl& m_overlay; | 156 RawPtrWillBeMember<InspectorOverlayImpl> m_overlay; |
146 }; | 157 }; |
147 | 158 |
148 | 159 |
149 // static | 160 // static |
150 PassOwnPtrWillBeRawPtr<InspectorOverlay> InspectorOverlayImpl::createEmpty() | 161 PassOwnPtrWillBeRawPtr<InspectorOverlay> InspectorOverlayImpl::createEmpty() |
151 { | 162 { |
152 return adoptPtrWillBeNoop(new InspectorOverlayStub()); | 163 return adoptPtrWillBeNoop(new InspectorOverlayStub()); |
153 } | 164 } |
154 | 165 |
155 InspectorOverlayImpl::InspectorOverlayImpl(WebViewImpl* webViewImpl) | 166 InspectorOverlayImpl::InspectorOverlayImpl(WebViewImpl* webViewImpl) |
(...skipping 14 matching lines...) Expand all Loading... | |
170 InspectorOverlayImpl::~InspectorOverlayImpl() | 181 InspectorOverlayImpl::~InspectorOverlayImpl() |
171 { | 182 { |
172 ASSERT(!m_overlayPage); | 183 ASSERT(!m_overlayPage); |
173 } | 184 } |
174 | 185 |
175 DEFINE_TRACE(InspectorOverlayImpl) | 186 DEFINE_TRACE(InspectorOverlayImpl) |
176 { | 187 { |
177 visitor->trace(m_highlightNode); | 188 visitor->trace(m_highlightNode); |
178 visitor->trace(m_eventTargetNode); | 189 visitor->trace(m_eventTargetNode); |
179 visitor->trace(m_overlayPage); | 190 visitor->trace(m_overlayPage); |
191 visitor->trace(m_overlayChromeClient); | |
180 visitor->trace(m_overlayHost); | 192 visitor->trace(m_overlayHost); |
181 visitor->trace(m_listener); | 193 visitor->trace(m_listener); |
182 visitor->trace(m_layoutEditor); | 194 visitor->trace(m_layoutEditor); |
183 InspectorOverlay::trace(visitor); | 195 InspectorOverlay::trace(visitor); |
184 } | 196 } |
185 | 197 |
186 void InspectorOverlayImpl::invalidate() | 198 void InspectorOverlayImpl::invalidate() |
187 { | 199 { |
188 if (!m_pageOverlay) | 200 if (!m_pageOverlay) |
189 m_pageOverlay = PageOverlay::create(m_webViewImpl, adoptPtr(new Inspecto rPageOverlayDelegate(*this))); | 201 m_pageOverlay = PageOverlay::create(m_webViewImpl, adoptPtr(new Inspecto rPageOverlayDelegate(*this))); |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
377 { | 389 { |
378 if (m_overlayPage) | 390 if (m_overlayPage) |
379 return m_overlayPage.get(); | 391 return m_overlayPage.get(); |
380 | 392 |
381 ScriptForbiddenScope::AllowUserAgentScript allowScript; | 393 ScriptForbiddenScope::AllowUserAgentScript allowScript; |
382 | 394 |
383 static FrameLoaderClient* dummyFrameLoaderClient = new EmptyFrameLoaderClie nt; | 395 static FrameLoaderClient* dummyFrameLoaderClient = new EmptyFrameLoaderClie nt; |
384 Page::PageClients pageClients; | 396 Page::PageClients pageClients; |
385 fillWithEmptyClients(pageClients); | 397 fillWithEmptyClients(pageClients); |
386 ASSERT(!m_overlayChromeClient); | 398 ASSERT(!m_overlayChromeClient); |
387 m_overlayChromeClient = adoptPtr(new InspectorOverlayChromeClient(m_webViewI mpl->page()->chromeClient(), *this)); | 399 m_overlayChromeClient = InspectorOverlayChromeClient::create(m_webViewImpl-> page()->chromeClient(), *this); |
388 pageClients.chromeClient = m_overlayChromeClient.get(); | 400 pageClients.chromeClient = m_overlayChromeClient.get(); |
389 m_overlayPage = adoptPtrWillBeNoop(new Page(pageClients)); | 401 m_overlayPage = adoptPtrWillBeNoop(new Page(pageClients)); |
390 | 402 |
391 Settings& settings = m_webViewImpl->page()->settings(); | 403 Settings& settings = m_webViewImpl->page()->settings(); |
392 Settings& overlaySettings = m_overlayPage->settings(); | 404 Settings& overlaySettings = m_overlayPage->settings(); |
393 | 405 |
394 overlaySettings.genericFontFamilySettings().updateStandard(settings.genericF ontFamilySettings().standard()); | 406 overlaySettings.genericFontFamilySettings().updateStandard(settings.genericF ontFamilySettings().standard()); |
395 overlaySettings.genericFontFamilySettings().updateSerif(settings.genericFont FamilySettings().serif()); | 407 overlaySettings.genericFontFamilySettings().updateSerif(settings.genericFont FamilySettings().serif()); |
396 overlaySettings.genericFontFamilySettings().updateSansSerif(settings.generic FontFamilySettings().sansSerif()); | 408 overlaySettings.genericFontFamilySettings().updateSansSerif(settings.generic FontFamilySettings().sansSerif()); |
397 overlaySettings.genericFontFamilySettings().updateCursive(settings.genericFo ntFamilySettings().cursive()); | 409 overlaySettings.genericFontFamilySettings().updateCursive(settings.genericFo ntFamilySettings().cursive()); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
514 --m_suspendCount; | 526 --m_suspendCount; |
515 } | 527 } |
516 | 528 |
517 void InspectorOverlayImpl::setLayoutEditor(PassOwnPtrWillBeRawPtr<LayoutEditor> layoutEditor) | 529 void InspectorOverlayImpl::setLayoutEditor(PassOwnPtrWillBeRawPtr<LayoutEditor> layoutEditor) |
518 { | 530 { |
519 m_layoutEditor = layoutEditor; | 531 m_layoutEditor = layoutEditor; |
520 m_overlayHost->setLayoutEditorListener(m_layoutEditor.get()); | 532 m_overlayHost->setLayoutEditorListener(m_layoutEditor.get()); |
521 } | 533 } |
522 | 534 |
523 } // namespace blink | 535 } // namespace blink |
OLD | NEW |