| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright (C) 2014 Google Inc. All rights reserved. | 2  * Copyright (C) 2014 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 29 matching lines...) Expand all  Loading... | 
| 40 #include "core/frame/Settings.h" | 40 #include "core/frame/Settings.h" | 
| 41 #include "core/layout/LayoutView.h" | 41 #include "core/layout/LayoutView.h" | 
| 42 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" | 42 #include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" | 
| 43 #include "core/page/EventHandler.h" | 43 #include "core/page/EventHandler.h" | 
| 44 #include "core/page/FocusController.h" | 44 #include "core/page/FocusController.h" | 
| 45 #include "core/page/Page.h" | 45 #include "core/page/Page.h" | 
| 46 #include "platform/KeyboardCodes.h" | 46 #include "platform/KeyboardCodes.h" | 
| 47 #include "platform/NotImplemented.h" | 47 #include "platform/NotImplemented.h" | 
| 48 #include "public/web/WebBeginFrameArgs.h" | 48 #include "public/web/WebBeginFrameArgs.h" | 
| 49 #include "public/web/WebWidgetClient.h" | 49 #include "public/web/WebWidgetClient.h" | 
|  | 50 #include "web/WebDevToolsAgentImpl.h" | 
| 50 #include "web/WebInputEventConversion.h" | 51 #include "web/WebInputEventConversion.h" | 
| 51 #include "web/WebLocalFrameImpl.h" | 52 #include "web/WebLocalFrameImpl.h" | 
| 52 #include "web/WebPluginContainerImpl.h" | 53 #include "web/WebPluginContainerImpl.h" | 
| 53 #include "web/WebRemoteFrameImpl.h" | 54 #include "web/WebRemoteFrameImpl.h" | 
| 54 #include "web/WebViewImpl.h" | 55 #include "web/WebViewImpl.h" | 
| 55 | 56 | 
| 56 namespace blink { | 57 namespace blink { | 
| 57 | 58 | 
| 58 // WebFrameWidget --------------------------------------------------------------
      -- | 59 // WebFrameWidget --------------------------------------------------------------
      -- | 
| 59 | 60 | 
| 60 WebFrameWidget* WebFrameWidget::create(WebWidgetClient* client, WebLocalFrame* l
      ocalRoot) | 61 WebFrameWidget* WebFrameWidget::create(WebWidgetClient* client, WebLocalFrame* l
      ocalRoot) | 
| 61 { | 62 { | 
| 62     // Pass the WebFrameWidget's self-reference to the caller. | 63     // Pass the WebFrameWidget's self-reference to the caller. | 
| 63     return WebFrameWidgetImpl::create(client, localRoot); | 64     return WebFrameWidgetImpl::create(client, localRoot); | 
| 64 } | 65 } | 
| 65 | 66 | 
| 66 WebFrameWidgetImpl* WebFrameWidgetImpl::create(WebWidgetClient* client, WebLocal
      Frame* localRoot) | 67 WebFrameWidgetImpl* WebFrameWidgetImpl::create(WebWidgetClient* client, WebLocal
      Frame* localRoot) | 
| 67 { | 68 { | 
| 68     // Pass the WebFrameWidgetImpl's self-reference to the caller. | 69     // Pass the WebFrameWidgetImpl's self-reference to the caller. | 
| 69     return adoptRef(new WebFrameWidgetImpl(client, localRoot)).leakRef(); | 70     return adoptRef(new WebFrameWidgetImpl(client, localRoot)).leakRef(); | 
| 70 } | 71 } | 
| 71 | 72 | 
|  | 73 // static | 
|  | 74 HashSet<WebFrameWidgetImpl*>& WebFrameWidgetImpl::allInstances() | 
|  | 75 { | 
|  | 76     DEFINE_STATIC_LOCAL(HashSet<WebFrameWidgetImpl*>, allInstances, ()); | 
|  | 77     return allInstances; | 
|  | 78 } | 
|  | 79 | 
| 72 WebFrameWidgetImpl::WebFrameWidgetImpl(WebWidgetClient* client, WebLocalFrame* l
      ocalRoot) | 80 WebFrameWidgetImpl::WebFrameWidgetImpl(WebWidgetClient* client, WebLocalFrame* l
      ocalRoot) | 
| 73     : m_client(client) | 81     : m_client(client) | 
| 74     , m_localRoot(toWebLocalFrameImpl(localRoot)) | 82     , m_localRoot(toWebLocalFrameImpl(localRoot)) | 
| 75     , m_layerTreeView(nullptr) | 83     , m_layerTreeView(nullptr) | 
| 76     , m_rootLayer(nullptr) | 84     , m_rootLayer(nullptr) | 
| 77     , m_rootGraphicsLayer(nullptr) | 85     , m_rootGraphicsLayer(nullptr) | 
| 78     , m_isAcceleratedCompositingActive(false) | 86     , m_isAcceleratedCompositingActive(false) | 
| 79     , m_layerTreeViewClosed(false) | 87     , m_layerTreeViewClosed(false) | 
| 80     , m_webView(m_localRoot->viewImpl()) | 88     , m_webView(m_localRoot->viewImpl()) | 
| 81     , m_page(m_webView->page()) | 89     , m_page(m_webView->page()) | 
| 82     , m_suppressNextKeypressEvent(false) | 90     , m_suppressNextKeypressEvent(false) | 
| 83     , m_ignoreInputEvents(false) | 91     , m_ignoreInputEvents(false) | 
| 84 { | 92 { | 
| 85     ASSERT(m_localRoot->frame()->isLocalRoot()); | 93     ASSERT(m_localRoot->frame()->isLocalRoot()); | 
| 86     initializeLayerTreeView(); | 94     initializeLayerTreeView(); | 
| 87     m_localRoot->setFrameWidget(this); | 95     m_localRoot->setFrameWidget(this); | 
|  | 96     allInstances().add(this); | 
| 88 } | 97 } | 
| 89 | 98 | 
| 90 WebFrameWidgetImpl::~WebFrameWidgetImpl() | 99 WebFrameWidgetImpl::~WebFrameWidgetImpl() | 
| 91 { | 100 { | 
| 92 } | 101 } | 
| 93 | 102 | 
| 94 // WebWidget ------------------------------------------------------------------ | 103 // WebWidget ------------------------------------------------------------------ | 
| 95 | 104 | 
| 96 void WebFrameWidgetImpl::close() | 105 void WebFrameWidgetImpl::close() | 
| 97 { | 106 { | 
|  | 107     WebDevToolsAgentImpl::webFrameWidgetImplClosed(this); | 
|  | 108     ASSERT(allInstances().contains(this)); | 
|  | 109     allInstances().remove(this); | 
|  | 110 | 
| 98     // Reset the delegate to prevent notifications being sent as we're being | 111     // Reset the delegate to prevent notifications being sent as we're being | 
| 99     // deleted. | 112     // deleted. | 
| 100     m_client = nullptr; | 113     m_client = nullptr; | 
| 101 | 114 | 
| 102     deref(); // Balances ref() acquired in WebFrameWidget::create | 115     deref(); // Balances ref() acquired in WebFrameWidget::create | 
| 103 } | 116 } | 
| 104 | 117 | 
| 105 WebSize WebFrameWidgetImpl::size() | 118 WebSize WebFrameWidgetImpl::size() | 
| 106 { | 119 { | 
| 107     return m_size; | 120     return m_size; | 
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 175 | 188 | 
| 176     RefPtrWillBeRawPtr<FrameView> view = m_localRoot->frameView(); | 189     RefPtrWillBeRawPtr<FrameView> view = m_localRoot->frameView(); | 
| 177     if (!view) | 190     if (!view) | 
| 178         return; | 191         return; | 
| 179 | 192 | 
| 180     WebSize layoutSize = m_size; | 193     WebSize layoutSize = m_size; | 
| 181 | 194 | 
| 182     view->setLayoutSize(layoutSize); | 195     view->setLayoutSize(layoutSize); | 
| 183 } | 196 } | 
| 184 | 197 | 
|  | 198 void WebFrameWidgetImpl::setIgnoreInputEvents(bool newValue) | 
|  | 199 { | 
|  | 200     ASSERT(m_ignoreInputEvents != newValue); | 
|  | 201     m_ignoreInputEvents = newValue; | 
|  | 202 } | 
|  | 203 | 
| 185 void WebFrameWidgetImpl::willEndLiveResize() | 204 void WebFrameWidgetImpl::willEndLiveResize() | 
| 186 { | 205 { | 
| 187     if (m_localRoot->frameView()) | 206     if (m_localRoot->frameView()) | 
| 188         m_localRoot->frameView()->willEndLiveResize(); | 207         m_localRoot->frameView()->willEndLiveResize(); | 
| 189 | 208 | 
| 190     LocalFrame* frame = m_localRoot->frame(); | 209     LocalFrame* frame = m_localRoot->frame(); | 
| 191     WebPluginContainerImpl* pluginContainer = WebLocalFrameImpl::pluginContainer
      FromFrame(frame); | 210     WebPluginContainerImpl* pluginContainer = WebLocalFrameImpl::pluginContainer
      FromFrame(frame); | 
| 192     if (pluginContainer) | 211     if (pluginContainer) | 
| 193         pluginContainer->willEndLiveResize(); | 212         pluginContainer->willEndLiveResize(); | 
| 194 } | 213 } | 
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 345 | 364 | 
| 346 bool WebFrameWidgetImpl::handleInputEvent(const WebInputEvent& inputEvent) | 365 bool WebFrameWidgetImpl::handleInputEvent(const WebInputEvent& inputEvent) | 
| 347 { | 366 { | 
| 348 | 367 | 
| 349     TRACE_EVENT1("input", "WebFrameWidgetImpl::handleInputEvent", "type", inputT
      ypeToName(inputEvent.type).ascii()); | 368     TRACE_EVENT1("input", "WebFrameWidgetImpl::handleInputEvent", "type", inputT
      ypeToName(inputEvent.type).ascii()); | 
| 350 | 369 | 
| 351     // Report the event to be NOT processed by WebKit, so that the browser can h
      andle it appropriately. | 370     // Report the event to be NOT processed by WebKit, so that the browser can h
      andle it appropriately. | 
| 352     if (m_ignoreInputEvents) | 371     if (m_ignoreInputEvents) | 
| 353         return false; | 372         return false; | 
| 354 | 373 | 
|  | 374     // FIXME: pass event to m_localRoot's WebDevToolsAgentImpl once available. | 
|  | 375 | 
| 355     TemporaryChange<const WebInputEvent*> currentEventChange(m_currentInputEvent
      , &inputEvent); | 376     TemporaryChange<const WebInputEvent*> currentEventChange(m_currentInputEvent
      , &inputEvent); | 
| 356 | 377 | 
| 357     if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type)) 
      { | 378     if (m_mouseCaptureNode && WebInputEvent::isMouseEventType(inputEvent.type)) 
      { | 
| 358         TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type); | 379         TRACE_EVENT1("input", "captured mouse event", "type", inputEvent.type); | 
| 359         // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. | 380         // Save m_mouseCaptureNode since mouseCaptureLost() will clear it. | 
| 360         RefPtrWillBeRawPtr<Node> node = m_mouseCaptureNode; | 381         RefPtrWillBeRawPtr<Node> node = m_mouseCaptureNode; | 
| 361 | 382 | 
| 362         // Not all platforms call mouseCaptureLost() directly. | 383         // Not all platforms call mouseCaptureLost() directly. | 
| 363         if (inputEvent.type == WebInputEvent::MouseUp) | 384         if (inputEvent.type == WebInputEvent::MouseUp) | 
| 364             mouseCaptureLost(); | 385             mouseCaptureLost(); | 
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1023     // correspond to Page visibility, but is necessary until we properly sort ou
      t OOPIF visibility. | 1044     // correspond to Page visibility, but is necessary until we properly sort ou
      t OOPIF visibility. | 
| 1024     m_page->setVisibilityState(static_cast<PageVisibilityState>(visibilityState)
      , isInitialState); | 1045     m_page->setVisibilityState(static_cast<PageVisibilityState>(visibilityState)
      , isInitialState); | 
| 1025 | 1046 | 
| 1026     if (m_layerTreeView) { | 1047     if (m_layerTreeView) { | 
| 1027         bool visible = visibilityState == WebPageVisibilityStateVisible; | 1048         bool visible = visibilityState == WebPageVisibilityStateVisible; | 
| 1028         m_layerTreeView->setVisible(visible); | 1049         m_layerTreeView->setVisible(visible); | 
| 1029     } | 1050     } | 
| 1030 } | 1051 } | 
| 1031 | 1052 | 
| 1032 } // namespace blink | 1053 } // namespace blink | 
| OLD | NEW | 
|---|