OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 { | 494 { |
495 ASSERT(!m_page); | 495 ASSERT(!m_page); |
496 } | 496 } |
497 | 497 |
498 WebDevToolsAgentImpl* WebViewImpl::mainFrameDevToolsAgentImpl() | 498 WebDevToolsAgentImpl* WebViewImpl::mainFrameDevToolsAgentImpl() |
499 { | 499 { |
500 WebLocalFrameImpl* mainFrame = mainFrameImpl(); | 500 WebLocalFrameImpl* mainFrame = mainFrameImpl(); |
501 return mainFrame ? mainFrame->devToolsAgentImpl() : nullptr; | 501 return mainFrame ? mainFrame->devToolsAgentImpl() : nullptr; |
502 } | 502 } |
503 | 503 |
504 InspectorOverlay* WebViewImpl::inspectorOverlay() | 504 InspectorOverlayImpl* WebViewImpl::inspectorOverlay() |
505 { | 505 { |
506 if (!m_inspectorOverlay) | 506 if (WebDevToolsAgentImpl* devtools = mainFrameDevToolsAgentImpl()) |
507 m_inspectorOverlay = InspectorOverlayImpl::create(this); | 507 return static_cast<InspectorOverlayImpl*>(devtools->overlay()); |
508 return m_inspectorOverlay.get(); | 508 return nullptr; |
509 } | 509 } |
510 | 510 |
511 WebLocalFrameImpl* WebViewImpl::mainFrameImpl() | 511 WebLocalFrameImpl* WebViewImpl::mainFrameImpl() |
512 { | 512 { |
513 return m_page && m_page->mainFrame() && m_page->mainFrame()->isLocalFrame()
? WebLocalFrameImpl::fromFrame(m_page->deprecatedLocalMainFrame()) : 0; | 513 return m_page && m_page->mainFrame() && m_page->mainFrame()->isLocalFrame()
? WebLocalFrameImpl::fromFrame(m_page->deprecatedLocalMainFrame()) : 0; |
514 } | 514 } |
515 | 515 |
516 bool WebViewImpl::tabKeyCyclesThroughElements() const | 516 bool WebViewImpl::tabKeyCyclesThroughElements() const |
517 { | 517 { |
518 ASSERT(m_page); | 518 ASSERT(m_page); |
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1887 } | 1887 } |
1888 | 1888 |
1889 void WebViewImpl::layout() | 1889 void WebViewImpl::layout() |
1890 { | 1890 { |
1891 TRACE_EVENT0("blink", "WebViewImpl::layout"); | 1891 TRACE_EVENT0("blink", "WebViewImpl::layout"); |
1892 if (!mainFrameImpl()) | 1892 if (!mainFrameImpl()) |
1893 return; | 1893 return; |
1894 | 1894 |
1895 PageWidgetDelegate::layout(*m_page, *mainFrameImpl()->frame()); | 1895 PageWidgetDelegate::layout(*m_page, *mainFrameImpl()->frame()); |
1896 updateLayerTreeBackgroundColor(); | 1896 updateLayerTreeBackgroundColor(); |
1897 if (m_inspectorOverlay) | 1897 if (InspectorOverlayImpl* overlay = inspectorOverlay()) |
1898 m_inspectorOverlay->layout(); | 1898 overlay->layout(); |
1899 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 1899 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
1900 m_linkHighlights[i]->updateGeometry(); | 1900 m_linkHighlights[i]->updateGeometry(); |
1901 | 1901 |
1902 if (FrameView* view = mainFrameImpl()->frameView()) { | 1902 if (FrameView* view = mainFrameImpl()->frameView()) { |
1903 LocalFrame* frame = mainFrameImpl()->frame(); | 1903 LocalFrame* frame = mainFrameImpl()->frame(); |
1904 | 1904 |
1905 if (m_shouldDispatchFirstVisuallyNonEmptyLayout && view->isVisuallyNonEm
pty()) { | 1905 if (m_shouldDispatchFirstVisuallyNonEmptyLayout && view->isVisuallyNonEm
pty()) { |
1906 m_shouldDispatchFirstVisuallyNonEmptyLayout = false; | 1906 m_shouldDispatchFirstVisuallyNonEmptyLayout = false; |
1907 // TODO(esprehn): Move users of this callback to something | 1907 // TODO(esprehn): Move users of this callback to something |
1908 // better, the heuristic for "visually non-empty" is bad. | 1908 // better, the heuristic for "visually non-empty" is bad. |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2080 if (m_doingDragAndDrop) | 2080 if (m_doingDragAndDrop) |
2081 return true; | 2081 return true; |
2082 | 2082 |
2083 if (m_devToolsEmulator->handleInputEvent(inputEvent)) | 2083 if (m_devToolsEmulator->handleInputEvent(inputEvent)) |
2084 return true; | 2084 return true; |
2085 | 2085 |
2086 WebDevToolsAgentImpl* devTools = mainFrameDevToolsAgentImpl(); | 2086 WebDevToolsAgentImpl* devTools = mainFrameDevToolsAgentImpl(); |
2087 if (devTools && devTools->handleInputEvent(inputEvent)) | 2087 if (devTools && devTools->handleInputEvent(inputEvent)) |
2088 return true; | 2088 return true; |
2089 | 2089 |
2090 if (m_inspectorOverlay && m_inspectorOverlay->handleInputEvent(inputEvent)) | 2090 if (InspectorOverlayImpl* overlay = inspectorOverlay()) { |
2091 return true; | 2091 if (overlay->handleInputEvent(inputEvent)) |
| 2092 return true; |
| 2093 } |
2092 | 2094 |
2093 // Report the event to be NOT processed by WebKit, so that the browser can h
andle it appropriately. | 2095 // Report the event to be NOT processed by WebKit, so that the browser can h
andle it appropriately. |
2094 if (m_ignoreInputEvents) | 2096 if (m_ignoreInputEvents) |
2095 return false; | 2097 return false; |
2096 | 2098 |
2097 TemporaryChange<const WebInputEvent*> currentEventChange(m_currentInputEvent
, &inputEvent); | 2099 TemporaryChange<const WebInputEvent*> currentEventChange(m_currentInputEvent
, &inputEvent); |
2098 UIEventWithKeyState::clearNewTabModifierSetFromIsolatedWorld(); | 2100 UIEventWithKeyState::clearNewTabModifierSetFromIsolatedWorld(); |
2099 | 2101 |
2100 if (isPointerLocked() && WebInputEvent::isMouseEventType(inputEvent.type)) { | 2102 if (isPointerLocked() && WebInputEvent::isMouseEventType(inputEvent.type)) { |
2101 pointerLockMouseEvent(inputEvent); | 2103 pointerLockMouseEvent(inputEvent); |
(...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3961 | 3963 |
3962 void WebViewImpl::didChangeContentsSize() | 3964 void WebViewImpl::didChangeContentsSize() |
3963 { | 3965 { |
3964 pageScaleConstraintsSet().didChangeContentsSize(contentsSize(), pageScaleFac
tor()); | 3966 pageScaleConstraintsSet().didChangeContentsSize(contentsSize(), pageScaleFac
tor()); |
3965 } | 3967 } |
3966 | 3968 |
3967 void WebViewImpl::pageScaleFactorChanged() | 3969 void WebViewImpl::pageScaleFactorChanged() |
3968 { | 3970 { |
3969 pageScaleConstraintsSet().setNeedsReset(false); | 3971 pageScaleConstraintsSet().setNeedsReset(false); |
3970 updateLayerTreeViewport(); | 3972 updateLayerTreeViewport(); |
3971 if (m_inspectorOverlay) | 3973 if (InspectorOverlayImpl* overlay = inspectorOverlay()) |
3972 m_inspectorOverlay->update(); | 3974 overlay->update(); |
3973 m_devToolsEmulator->viewportChanged(); | 3975 m_devToolsEmulator->viewportChanged(); |
3974 m_client->pageScaleFactorChanged(); | 3976 m_client->pageScaleFactorChanged(); |
3975 } | 3977 } |
3976 | 3978 |
3977 bool WebViewImpl::useExternalPopupMenus() | 3979 bool WebViewImpl::useExternalPopupMenus() |
3978 { | 3980 { |
3979 return shouldUseExternalPopupMenus; | 3981 return shouldUseExternalPopupMenus; |
3980 } | 3982 } |
3981 | 3983 |
3982 void WebViewImpl::startDragging(LocalFrame* frame, | 3984 void WebViewImpl::startDragging(LocalFrame* frame, |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4423 | 4425 |
4424 void WebViewImpl::forceNextDrawingBufferCreationToFail() | 4426 void WebViewImpl::forceNextDrawingBufferCreationToFail() |
4425 { | 4427 { |
4426 DrawingBuffer::forceNextDrawingBufferCreationToFail(); | 4428 DrawingBuffer::forceNextDrawingBufferCreationToFail(); |
4427 } | 4429 } |
4428 | 4430 |
4429 void WebViewImpl::updatePageOverlays() | 4431 void WebViewImpl::updatePageOverlays() |
4430 { | 4432 { |
4431 if (m_pageColorOverlay) | 4433 if (m_pageColorOverlay) |
4432 m_pageColorOverlay->update(); | 4434 m_pageColorOverlay->update(); |
4433 if (m_inspectorOverlay) { | 4435 if (InspectorOverlayImpl* overlay = inspectorOverlay()) { |
4434 PageOverlay* inspectorPageOverlay = m_inspectorOverlay->pageOverlay(); | 4436 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); |
4435 if (inspectorPageOverlay) | 4437 if (inspectorPageOverlay) |
4436 inspectorPageOverlay->update(); | 4438 inspectorPageOverlay->update(); |
4437 } | 4439 } |
4438 } | 4440 } |
4439 | 4441 |
4440 } // namespace blink | 4442 } // namespace blink |
OLD | NEW |