| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #include "core/frame/FrameView.h" | 57 #include "core/frame/FrameView.h" |
| 58 #include "core/frame/LocalFrame.h" | 58 #include "core/frame/LocalFrame.h" |
| 59 #include "core/frame/LocalFrameClient.h" | 59 #include "core/frame/LocalFrameClient.h" |
| 60 #include "core/frame/PageScaleConstraintsSet.h" | 60 #include "core/frame/PageScaleConstraintsSet.h" |
| 61 #include "core/frame/RemoteFrame.h" | 61 #include "core/frame/RemoteFrame.h" |
| 62 #include "core/frame/ResizeViewportAnchor.h" | 62 #include "core/frame/ResizeViewportAnchor.h" |
| 63 #include "core/frame/RotationViewportAnchor.h" | 63 #include "core/frame/RotationViewportAnchor.h" |
| 64 #include "core/frame/Settings.h" | 64 #include "core/frame/Settings.h" |
| 65 #include "core/frame/UseCounter.h" | 65 #include "core/frame/UseCounter.h" |
| 66 #include "core/frame/VisualViewport.h" | 66 #include "core/frame/VisualViewport.h" |
| 67 #include "core/frame/WebLocalFrameBase.h" |
| 67 #include "core/html/HTMLMediaElement.h" | 68 #include "core/html/HTMLMediaElement.h" |
| 68 #include "core/html/HTMLPlugInElement.h" | 69 #include "core/html/HTMLPlugInElement.h" |
| 69 #include "core/html/HTMLTextAreaElement.h" | 70 #include "core/html/HTMLTextAreaElement.h" |
| 70 #include "core/input/EventHandler.h" | 71 #include "core/input/EventHandler.h" |
| 71 #include "core/input/TouchActionUtil.h" | 72 #include "core/input/TouchActionUtil.h" |
| 72 #include "core/layout/LayoutPart.h" | 73 #include "core/layout/LayoutPart.h" |
| 73 #include "core/layout/TextAutosizer.h" | 74 #include "core/layout/TextAutosizer.h" |
| 74 #include "core/layout/api/LayoutViewItem.h" | 75 #include "core/layout/api/LayoutViewItem.h" |
| 75 #include "core/layout/compositing/PaintLayerCompositor.h" | 76 #include "core/layout/compositing/PaintLayerCompositor.h" |
| 76 #include "core/loader/FrameLoadRequest.h" | 77 #include "core/loader/FrameLoadRequest.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 #include "web/ContextMenuAllowedScope.h" | 164 #include "web/ContextMenuAllowedScope.h" |
| 164 #include "web/DedicatedWorkerMessagingProxyProviderImpl.h" | 165 #include "web/DedicatedWorkerMessagingProxyProviderImpl.h" |
| 165 #include "web/DevToolsEmulator.h" | 166 #include "web/DevToolsEmulator.h" |
| 166 #include "web/FullscreenController.h" | 167 #include "web/FullscreenController.h" |
| 167 #include "web/LinkHighlightImpl.h" | 168 #include "web/LinkHighlightImpl.h" |
| 168 #include "web/PageOverlay.h" | 169 #include "web/PageOverlay.h" |
| 169 #include "web/PrerendererClientImpl.h" | 170 #include "web/PrerendererClientImpl.h" |
| 170 #include "web/StorageQuotaClientImpl.h" | 171 #include "web/StorageQuotaClientImpl.h" |
| 171 #include "web/WebDevToolsAgentImpl.h" | 172 #include "web/WebDevToolsAgentImpl.h" |
| 172 #include "web/WebInputMethodControllerImpl.h" | 173 #include "web/WebInputMethodControllerImpl.h" |
| 173 #include "web/WebLocalFrameImpl.h" | |
| 174 #include "web/WebRemoteFrameImpl.h" | 174 #include "web/WebRemoteFrameImpl.h" |
| 175 #include "web/WebSettingsImpl.h" | 175 #include "web/WebSettingsImpl.h" |
| 176 | 176 |
| 177 #if USE(DEFAULT_RENDER_THEME) | 177 #if USE(DEFAULT_RENDER_THEME) |
| 178 #include "core/layout/LayoutThemeDefault.h" | 178 #include "core/layout/LayoutThemeDefault.h" |
| 179 #endif | 179 #endif |
| 180 | 180 |
| 181 // Get rid of WTF's pow define so we can use std::pow. | 181 // Get rid of WTF's pow define so we can use std::pow. |
| 182 #undef pow | 182 #undef pow |
| 183 #include <cmath> // for std::pow | 183 #include <cmath> // for std::pow |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 WebViewImpl::~WebViewImpl() { | 421 WebViewImpl::~WebViewImpl() { |
| 422 DCHECK(!page_); | 422 DCHECK(!page_); |
| 423 | 423 |
| 424 // Each highlight uses m_owningWebViewImpl->m_linkHighlightsTimeline | 424 // Each highlight uses m_owningWebViewImpl->m_linkHighlightsTimeline |
| 425 // in destructor. m_linkHighlightsTimeline might be destroyed earlier | 425 // in destructor. m_linkHighlightsTimeline might be destroyed earlier |
| 426 // than m_linkHighlights. | 426 // than m_linkHighlights. |
| 427 DCHECK(link_highlights_.IsEmpty()); | 427 DCHECK(link_highlights_.IsEmpty()); |
| 428 } | 428 } |
| 429 | 429 |
| 430 WebDevToolsAgentImpl* WebViewImpl::MainFrameDevToolsAgentImpl() { | 430 WebDevToolsAgentImpl* WebViewImpl::MainFrameDevToolsAgentImpl() { |
| 431 WebLocalFrameImpl* main_frame = MainFrameImpl(); | 431 WebLocalFrameBase* main_frame = MainFrameImpl(); |
| 432 return main_frame ? main_frame->DevToolsAgentImpl() : nullptr; | 432 return main_frame ? main_frame->DevToolsAgentImpl() : nullptr; |
| 433 } | 433 } |
| 434 | 434 |
| 435 WebLocalFrameImpl* WebViewImpl::MainFrameImpl() const { | 435 WebLocalFrameBase* WebViewImpl::MainFrameImpl() const { |
| 436 return page_ && page_->MainFrame() && page_->MainFrame()->IsLocalFrame() | 436 return page_ && page_->MainFrame() && page_->MainFrame()->IsLocalFrame() |
| 437 ? WebLocalFrameImpl::FromFrame(page_->DeprecatedLocalMainFrame()) | 437 ? WebLocalFrameBase::FromFrame(page_->DeprecatedLocalMainFrame()) |
| 438 : nullptr; | 438 : nullptr; |
| 439 } | 439 } |
| 440 | 440 |
| 441 bool WebViewImpl::TabKeyCyclesThroughElements() const { | 441 bool WebViewImpl::TabKeyCyclesThroughElements() const { |
| 442 DCHECK(page_); | 442 DCHECK(page_); |
| 443 return page_->TabKeyCyclesThroughElements(); | 443 return page_->TabKeyCyclesThroughElements(); |
| 444 } | 444 } |
| 445 | 445 |
| 446 void WebViewImpl::SetTabKeyCyclesThroughElements(bool value) { | 446 void WebViewImpl::SetTabKeyCyclesThroughElements(bool value) { |
| 447 if (page_) | 447 if (page_) |
| (...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1694 | 1694 |
| 1695 WebWidget* popup_widget = client_->CreatePopupMenu(kWebPopupTypePage); | 1695 WebWidget* popup_widget = client_->CreatePopupMenu(kWebPopupTypePage); |
| 1696 // createPopupMenu returns nullptr if this renderer process is about to die. | 1696 // createPopupMenu returns nullptr if this renderer process is about to die. |
| 1697 if (!popup_widget) | 1697 if (!popup_widget) |
| 1698 return nullptr; | 1698 return nullptr; |
| 1699 page_popup_ = ToWebPagePopupImpl(popup_widget); | 1699 page_popup_ = ToWebPagePopupImpl(popup_widget); |
| 1700 if (!page_popup_->Initialize(this, client)) { | 1700 if (!page_popup_->Initialize(this, client)) { |
| 1701 page_popup_->ClosePopup(); | 1701 page_popup_->ClosePopup(); |
| 1702 page_popup_ = nullptr; | 1702 page_popup_ = nullptr; |
| 1703 } | 1703 } |
| 1704 EnablePopupMouseWheelEventListener(WebLocalFrameImpl::FromFrame( | 1704 EnablePopupMouseWheelEventListener(WebLocalFrameBase::FromFrame( |
| 1705 client->OwnerElement().GetDocument().GetFrame()->LocalFrameRoot())); | 1705 client->OwnerElement().GetDocument().GetFrame()->LocalFrameRoot())); |
| 1706 return page_popup_.Get(); | 1706 return page_popup_.Get(); |
| 1707 } | 1707 } |
| 1708 | 1708 |
| 1709 void WebViewImpl::ClosePagePopup(PagePopup* popup) { | 1709 void WebViewImpl::ClosePagePopup(PagePopup* popup) { |
| 1710 DCHECK(popup); | 1710 DCHECK(popup); |
| 1711 WebPagePopupImpl* popup_impl = ToWebPagePopupImpl(popup); | 1711 WebPagePopupImpl* popup_impl = ToWebPagePopupImpl(popup); |
| 1712 DCHECK_EQ(page_popup_.Get(), popup_impl); | 1712 DCHECK_EQ(page_popup_.Get(), popup_impl); |
| 1713 if (page_popup_.Get() != popup_impl) | 1713 if (page_popup_.Get() != popup_impl) |
| 1714 return; | 1714 return; |
| 1715 page_popup_->ClosePopup(); | 1715 page_popup_->ClosePopup(); |
| 1716 } | 1716 } |
| 1717 | 1717 |
| 1718 void WebViewImpl::CleanupPagePopup() { | 1718 void WebViewImpl::CleanupPagePopup() { |
| 1719 page_popup_ = nullptr; | 1719 page_popup_ = nullptr; |
| 1720 DisablePopupMouseWheelEventListener(); | 1720 DisablePopupMouseWheelEventListener(); |
| 1721 } | 1721 } |
| 1722 | 1722 |
| 1723 void WebViewImpl::CancelPagePopup() { | 1723 void WebViewImpl::CancelPagePopup() { |
| 1724 if (page_popup_) | 1724 if (page_popup_) |
| 1725 page_popup_->Cancel(); | 1725 page_popup_->Cancel(); |
| 1726 } | 1726 } |
| 1727 | 1727 |
| 1728 void WebViewImpl::EnablePopupMouseWheelEventListener( | 1728 void WebViewImpl::EnablePopupMouseWheelEventListener( |
| 1729 WebLocalFrameImpl* local_root) { | 1729 WebLocalFrameBase* local_root) { |
| 1730 DCHECK(!popup_mouse_wheel_event_listener_); | 1730 DCHECK(!popup_mouse_wheel_event_listener_); |
| 1731 Document* document = local_root->GetDocument(); | 1731 Document* document = local_root->GetDocument(); |
| 1732 DCHECK(document); | 1732 DCHECK(document); |
| 1733 // We register an empty event listener, EmptyEventListener, so that mouse | 1733 // We register an empty event listener, EmptyEventListener, so that mouse |
| 1734 // wheel events get sent to the WebView. | 1734 // wheel events get sent to the WebView. |
| 1735 popup_mouse_wheel_event_listener_ = EmptyEventListener::Create(); | 1735 popup_mouse_wheel_event_listener_ = EmptyEventListener::Create(); |
| 1736 document->addEventListener(EventTypeNames::mousewheel, | 1736 document->addEventListener(EventTypeNames::mousewheel, |
| 1737 popup_mouse_wheel_event_listener_, false); | 1737 popup_mouse_wheel_event_listener_, false); |
| 1738 local_root_with_empty_mouse_wheel_listener_ = local_root; | 1738 local_root_with_empty_mouse_wheel_listener_ = local_root; |
| 1739 } | 1739 } |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1848 } | 1848 } |
| 1849 | 1849 |
| 1850 void WebViewImpl::DidUpdateBrowserControls() { | 1850 void WebViewImpl::DidUpdateBrowserControls() { |
| 1851 if (layer_tree_view_) { | 1851 if (layer_tree_view_) { |
| 1852 layer_tree_view_->SetBrowserControlsShownRatio( | 1852 layer_tree_view_->SetBrowserControlsShownRatio( |
| 1853 GetBrowserControls().ShownRatio()); | 1853 GetBrowserControls().ShownRatio()); |
| 1854 layer_tree_view_->SetBrowserControlsHeight( | 1854 layer_tree_view_->SetBrowserControlsHeight( |
| 1855 GetBrowserControls().Height(), GetBrowserControls().ShrinkViewport()); | 1855 GetBrowserControls().Height(), GetBrowserControls().ShrinkViewport()); |
| 1856 } | 1856 } |
| 1857 | 1857 |
| 1858 WebLocalFrameImpl* main_frame = MainFrameImpl(); | 1858 WebLocalFrameBase* main_frame = MainFrameImpl(); |
| 1859 if (!main_frame) | 1859 if (!main_frame) |
| 1860 return; | 1860 return; |
| 1861 | 1861 |
| 1862 FrameView* view = main_frame->GetFrameView(); | 1862 FrameView* view = main_frame->GetFrameView(); |
| 1863 if (!view) | 1863 if (!view) |
| 1864 return; | 1864 return; |
| 1865 | 1865 |
| 1866 VisualViewport& visual_viewport = GetPage()->GetVisualViewport(); | 1866 VisualViewport& visual_viewport = GetPage()->GetVisualViewport(); |
| 1867 | 1867 |
| 1868 { | 1868 { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1929 // Viewport resize for a remote main frame does not require any | 1929 // Viewport resize for a remote main frame does not require any |
| 1930 // particular action, but the state needs to reflect the correct size | 1930 // particular action, but the state needs to reflect the correct size |
| 1931 // so that it can be used for initalization if the main frame gets | 1931 // so that it can be used for initalization if the main frame gets |
| 1932 // swapped to a LocalFrame at a later time. | 1932 // swapped to a LocalFrame at a later time. |
| 1933 size_ = new_size; | 1933 size_ = new_size; |
| 1934 GetPageScaleConstraintsSet().DidChangeInitialContainingBlockSize(size_); | 1934 GetPageScaleConstraintsSet().DidChangeInitialContainingBlockSize(size_); |
| 1935 GetPage()->GetVisualViewport().SetSize(size_); | 1935 GetPage()->GetVisualViewport().SetSize(size_); |
| 1936 return; | 1936 return; |
| 1937 } | 1937 } |
| 1938 | 1938 |
| 1939 WebLocalFrameImpl* main_frame = MainFrameImpl(); | 1939 WebLocalFrameBase* main_frame = MainFrameImpl(); |
| 1940 if (!main_frame) | 1940 if (!main_frame) |
| 1941 return; | 1941 return; |
| 1942 | 1942 |
| 1943 FrameView* view = main_frame->GetFrameView(); | 1943 FrameView* view = main_frame->GetFrameView(); |
| 1944 if (!view) | 1944 if (!view) |
| 1945 return; | 1945 return; |
| 1946 | 1946 |
| 1947 VisualViewport& visual_viewport = GetPage()->GetVisualViewport(); | 1947 VisualViewport& visual_viewport = GetPage()->GetVisualViewport(); |
| 1948 | 1948 |
| 1949 bool is_rotation = | 1949 bool is_rotation = |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2041 page_color_overlay_->GetGraphicsLayer()->Paint(nullptr); | 2041 page_color_overlay_->GetGraphicsLayer()->Paint(nullptr); |
| 2042 | 2042 |
| 2043 // TODO(chrishtr): link highlights don't currently paint themselves, it's | 2043 // TODO(chrishtr): link highlights don't currently paint themselves, it's |
| 2044 // still driven by cc. Fix this. | 2044 // still driven by cc. Fix this. |
| 2045 for (size_t i = 0; i < link_highlights_.size(); ++i) | 2045 for (size_t i = 0; i < link_highlights_.size(); ++i) |
| 2046 link_highlights_[i]->UpdateGeometry(); | 2046 link_highlights_[i]->UpdateGeometry(); |
| 2047 | 2047 |
| 2048 if (FrameView* view = MainFrameImpl()->GetFrameView()) { | 2048 if (FrameView* view = MainFrameImpl()->GetFrameView()) { |
| 2049 LocalFrame* frame = MainFrameImpl()->GetFrame(); | 2049 LocalFrame* frame = MainFrameImpl()->GetFrame(); |
| 2050 WebWidgetClient* client = | 2050 WebWidgetClient* client = |
| 2051 WebLocalFrameImpl::FromFrame(frame)->FrameWidget()->Client(); | 2051 WebLocalFrameBase::FromFrame(frame)->FrameWidget()->Client(); |
| 2052 | 2052 |
| 2053 if (should_dispatch_first_visually_non_empty_layout_ && | 2053 if (should_dispatch_first_visually_non_empty_layout_ && |
| 2054 view->IsVisuallyNonEmpty()) { | 2054 view->IsVisuallyNonEmpty()) { |
| 2055 should_dispatch_first_visually_non_empty_layout_ = false; | 2055 should_dispatch_first_visually_non_empty_layout_ = false; |
| 2056 // TODO(esprehn): Move users of this callback to something | 2056 // TODO(esprehn): Move users of this callback to something |
| 2057 // better, the heuristic for "visually non-empty" is bad. | 2057 // better, the heuristic for "visually non-empty" is bad. |
| 2058 client->DidMeaningfulLayout(WebMeaningfulLayout::kVisuallyNonEmpty); | 2058 client->DidMeaningfulLayout(WebMeaningfulLayout::kVisuallyNonEmpty); |
| 2059 } | 2059 } |
| 2060 | 2060 |
| 2061 if (should_dispatch_first_layout_after_finished_parsing_ && | 2061 if (should_dispatch_first_layout_after_finished_parsing_ && |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2632 WebFrame* WebViewImpl::MainFrame() { | 2632 WebFrame* WebViewImpl::MainFrame() { |
| 2633 return WebFrame::FromFrame(page_ ? page_->MainFrame() : nullptr); | 2633 return WebFrame::FromFrame(page_ ? page_->MainFrame() : nullptr); |
| 2634 } | 2634 } |
| 2635 | 2635 |
| 2636 WebFrame* WebViewImpl::FindFrameByName(const WebString& name, | 2636 WebFrame* WebViewImpl::FindFrameByName(const WebString& name, |
| 2637 WebFrame* relative_to_frame) { | 2637 WebFrame* relative_to_frame) { |
| 2638 // FIXME: Either this should only deal with WebLocalFrames or it should move | 2638 // FIXME: Either this should only deal with WebLocalFrames or it should move |
| 2639 // to WebFrame. | 2639 // to WebFrame. |
| 2640 if (!relative_to_frame) | 2640 if (!relative_to_frame) |
| 2641 relative_to_frame = MainFrame(); | 2641 relative_to_frame = MainFrame(); |
| 2642 Frame* frame = ToWebLocalFrameImpl(relative_to_frame)->GetFrame(); | 2642 Frame* frame = ToWebLocalFrameBase(relative_to_frame)->GetFrame(); |
| 2643 frame = frame->Tree().Find(name); | 2643 frame = frame->Tree().Find(name); |
| 2644 if (!frame || !frame->IsLocalFrame()) | 2644 if (!frame || !frame->IsLocalFrame()) |
| 2645 return nullptr; | 2645 return nullptr; |
| 2646 return WebLocalFrameImpl::FromFrame(ToLocalFrame(frame)); | 2646 return WebLocalFrameBase::FromFrame(ToLocalFrame(frame)); |
| 2647 } | 2647 } |
| 2648 | 2648 |
| 2649 WebLocalFrame* WebViewImpl::FocusedFrame() { | 2649 WebLocalFrame* WebViewImpl::FocusedFrame() { |
| 2650 Frame* frame = FocusedCoreFrame(); | 2650 Frame* frame = FocusedCoreFrame(); |
| 2651 // TODO(yabinh): focusedCoreFrame() should always return a local frame, and | 2651 // TODO(yabinh): focusedCoreFrame() should always return a local frame, and |
| 2652 // the following check should be unnecessary. | 2652 // the following check should be unnecessary. |
| 2653 // See crbug.com/625068 | 2653 // See crbug.com/625068 |
| 2654 if (!frame || !frame->IsLocalFrame()) | 2654 if (!frame || !frame->IsLocalFrame()) |
| 2655 return nullptr; | 2655 return nullptr; |
| 2656 return WebLocalFrameImpl::FromFrame(ToLocalFrame(frame)); | 2656 return WebLocalFrameBase::FromFrame(ToLocalFrame(frame)); |
| 2657 } | 2657 } |
| 2658 | 2658 |
| 2659 void WebViewImpl::SetFocusedFrame(WebFrame* frame) { | 2659 void WebViewImpl::SetFocusedFrame(WebFrame* frame) { |
| 2660 if (!frame) { | 2660 if (!frame) { |
| 2661 // Clears the focused frame if any. | 2661 // Clears the focused frame if any. |
| 2662 Frame* focused_frame = FocusedCoreFrame(); | 2662 Frame* focused_frame = FocusedCoreFrame(); |
| 2663 if (focused_frame && focused_frame->IsLocalFrame()) | 2663 if (focused_frame && focused_frame->IsLocalFrame()) |
| 2664 ToLocalFrame(focused_frame)->Selection().SetFrameIsFocused(false); | 2664 ToLocalFrame(focused_frame)->Selection().SetFrameIsFocused(false); |
| 2665 return; | 2665 return; |
| 2666 } | 2666 } |
| 2667 LocalFrame* core_frame = ToWebLocalFrameImpl(frame)->GetFrame(); | 2667 LocalFrame* core_frame = ToWebLocalFrameBase(frame)->GetFrame(); |
| 2668 core_frame->GetPage()->GetFocusController().SetFocusedFrame(core_frame); | 2668 core_frame->GetPage()->GetFocusController().SetFocusedFrame(core_frame); |
| 2669 } | 2669 } |
| 2670 | 2670 |
| 2671 void WebViewImpl::FocusDocumentView(WebFrame* frame) { | 2671 void WebViewImpl::FocusDocumentView(WebFrame* frame) { |
| 2672 // This is currently only used when replicating focus changes for | 2672 // This is currently only used when replicating focus changes for |
| 2673 // cross-process frames, and |notifyEmbedder| is disabled to avoid sending | 2673 // cross-process frames, and |notifyEmbedder| is disabled to avoid sending |
| 2674 // duplicate frameFocused updates from FocusController to the browser | 2674 // duplicate frameFocused updates from FocusController to the browser |
| 2675 // process, which already knows the latest focused frame. | 2675 // process, which already knows the latest focused frame. |
| 2676 GetPage()->GetFocusController().FocusDocumentView( | 2676 GetPage()->GetFocusController().FocusDocumentView( |
| 2677 WebFrame::ToCoreFrame(*frame), false /* notifyEmbedder */); | 2677 WebFrame::ToCoreFrame(*frame), false /* notifyEmbedder */); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2880 GetPage()->GetFocusController().AdvanceFocus(reverse ? kWebFocusTypeBackward | 2880 GetPage()->GetFocusController().AdvanceFocus(reverse ? kWebFocusTypeBackward |
| 2881 : kWebFocusTypeForward); | 2881 : kWebFocusTypeForward); |
| 2882 } | 2882 } |
| 2883 | 2883 |
| 2884 void WebViewImpl::AdvanceFocusAcrossFrames(WebFocusType type, | 2884 void WebViewImpl::AdvanceFocusAcrossFrames(WebFocusType type, |
| 2885 WebRemoteFrame* from, | 2885 WebRemoteFrame* from, |
| 2886 WebLocalFrame* to) { | 2886 WebLocalFrame* to) { |
| 2887 // TODO(alexmos): Pass in proper with sourceCapabilities. | 2887 // TODO(alexmos): Pass in proper with sourceCapabilities. |
| 2888 GetPage()->GetFocusController().AdvanceFocusAcrossFrames( | 2888 GetPage()->GetFocusController().AdvanceFocusAcrossFrames( |
| 2889 type, ToWebRemoteFrameImpl(from)->GetFrame(), | 2889 type, ToWebRemoteFrameImpl(from)->GetFrame(), |
| 2890 ToWebLocalFrameImpl(to)->GetFrame()); | 2890 ToWebLocalFrameBase(to)->GetFrame()); |
| 2891 } | 2891 } |
| 2892 | 2892 |
| 2893 double WebViewImpl::ZoomLevel() { | 2893 double WebViewImpl::ZoomLevel() { |
| 2894 return zoom_level_; | 2894 return zoom_level_; |
| 2895 } | 2895 } |
| 2896 | 2896 |
| 2897 void WebViewImpl::PropagateZoomFactorToLocalFrameRoots(Frame* frame, | 2897 void WebViewImpl::PropagateZoomFactorToLocalFrameRoots(Frame* frame, |
| 2898 float zoom_factor) { | 2898 float zoom_factor) { |
| 2899 if (frame->IsLocalRoot()) { | 2899 if (frame->IsLocalRoot()) { |
| 2900 LocalFrame* local_frame = ToLocalFrame(frame); | 2900 LocalFrame* local_frame = ToLocalFrame(frame); |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3630 } | 3630 } |
| 3631 | 3631 |
| 3632 // Give the visual viewport's scroll layer its initial size. | 3632 // Give the visual viewport's scroll layer its initial size. |
| 3633 GetPage()->GetVisualViewport().MainFrameDidChangeSize(); | 3633 GetPage()->GetVisualViewport().MainFrameDidChangeSize(); |
| 3634 | 3634 |
| 3635 // Make sure link highlight from previous page is cleared. | 3635 // Make sure link highlight from previous page is cleared. |
| 3636 link_highlights_.clear(); | 3636 link_highlights_.clear(); |
| 3637 EndActiveFlingAnimation(); | 3637 EndActiveFlingAnimation(); |
| 3638 } | 3638 } |
| 3639 | 3639 |
| 3640 void WebViewImpl::ResizeAfterLayout(WebLocalFrameImpl* webframe) { | 3640 void WebViewImpl::ResizeAfterLayout(WebLocalFrameBase* webframe) { |
| 3641 LocalFrame* frame = webframe->GetFrame(); | 3641 LocalFrame* frame = webframe->GetFrame(); |
| 3642 if (!client_ || !client_->CanUpdateLayout() || !frame->IsMainFrame()) | 3642 if (!client_ || !client_->CanUpdateLayout() || !frame->IsMainFrame()) |
| 3643 return; | 3643 return; |
| 3644 | 3644 |
| 3645 if (should_auto_resize_) { | 3645 if (should_auto_resize_) { |
| 3646 WebSize frame_size = frame->View()->FrameRect().Size(); | 3646 WebSize frame_size = frame->View()->FrameRect().Size(); |
| 3647 if (frame_size != size_) { | 3647 if (frame_size != size_) { |
| 3648 size_ = frame_size; | 3648 size_ = frame_size; |
| 3649 | 3649 |
| 3650 GetPage()->GetVisualViewport().SetSize(size_); | 3650 GetPage()->GetVisualViewport().SetSize(size_); |
| 3651 GetPageScaleConstraintsSet().DidChangeInitialContainingBlockSize(size_); | 3651 GetPageScaleConstraintsSet().DidChangeInitialContainingBlockSize(size_); |
| 3652 frame->View()->SetInitialViewportSize(size_); | 3652 frame->View()->SetInitialViewportSize(size_); |
| 3653 | 3653 |
| 3654 client_->DidAutoResize(size_); | 3654 client_->DidAutoResize(size_); |
| 3655 SendResizeEventAndRepaint(); | 3655 SendResizeEventAndRepaint(); |
| 3656 } | 3656 } |
| 3657 } | 3657 } |
| 3658 | 3658 |
| 3659 if (GetPageScaleConstraintsSet().ConstraintsDirty()) | 3659 if (GetPageScaleConstraintsSet().ConstraintsDirty()) |
| 3660 RefreshPageScaleFactorAfterLayout(); | 3660 RefreshPageScaleFactorAfterLayout(); |
| 3661 | 3661 |
| 3662 resize_viewport_anchor_->ResizeFrameView(MainFrameSize()); | 3662 resize_viewport_anchor_->ResizeFrameView(MainFrameSize()); |
| 3663 } | 3663 } |
| 3664 | 3664 |
| 3665 void WebViewImpl::LayoutUpdated(WebLocalFrameImpl* webframe) { | 3665 void WebViewImpl::LayoutUpdated(WebLocalFrameBase* webframe) { |
| 3666 LocalFrame* frame = webframe->GetFrame(); | 3666 LocalFrame* frame = webframe->GetFrame(); |
| 3667 if (!client_ || !frame->IsMainFrame()) | 3667 if (!client_ || !frame->IsMainFrame()) |
| 3668 return; | 3668 return; |
| 3669 | 3669 |
| 3670 UpdatePageOverlays(); | 3670 UpdatePageOverlays(); |
| 3671 | 3671 |
| 3672 fullscreen_controller_->DidUpdateLayout(); | 3672 fullscreen_controller_->DidUpdateLayout(); |
| 3673 client_->DidUpdateLayout(); | 3673 client_->DidUpdateLayout(); |
| 3674 } | 3674 } |
| 3675 | 3675 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3911 void WebViewImpl::InvalidateRect(const IntRect& rect) { | 3911 void WebViewImpl::InvalidateRect(const IntRect& rect) { |
| 3912 if (layer_tree_view_) { | 3912 if (layer_tree_view_) { |
| 3913 UpdateLayerTreeViewport(); | 3913 UpdateLayerTreeViewport(); |
| 3914 } else if (client_) { | 3914 } else if (client_) { |
| 3915 // This is only for WebViewPlugin. | 3915 // This is only for WebViewPlugin. |
| 3916 client_->WidgetClient()->DidInvalidateRect(rect); | 3916 client_->WidgetClient()->DidInvalidateRect(rect); |
| 3917 } | 3917 } |
| 3918 } | 3918 } |
| 3919 | 3919 |
| 3920 PaintLayerCompositor* WebViewImpl::Compositor() const { | 3920 PaintLayerCompositor* WebViewImpl::Compositor() const { |
| 3921 WebLocalFrameImpl* frame = MainFrameImpl(); | 3921 WebLocalFrameBase* frame = MainFrameImpl(); |
| 3922 if (!frame) | 3922 if (!frame) |
| 3923 return nullptr; | 3923 return nullptr; |
| 3924 | 3924 |
| 3925 Document* document = frame->GetFrame()->GetDocument(); | 3925 Document* document = frame->GetFrame()->GetDocument(); |
| 3926 if (!document || document->GetLayoutViewItem().IsNull()) | 3926 if (!document || document->GetLayoutViewItem().IsNull()) |
| 3927 return nullptr; | 3927 return nullptr; |
| 3928 | 3928 |
| 3929 return document->GetLayoutViewItem().Compositor(); | 3929 return document->GetLayoutViewItem().Compositor(); |
| 3930 } | 3930 } |
| 3931 | 3931 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4151 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) | 4151 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) |
| 4152 return nullptr; | 4152 return nullptr; |
| 4153 return focused_frame; | 4153 return focused_frame; |
| 4154 } | 4154 } |
| 4155 | 4155 |
| 4156 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { | 4156 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { |
| 4157 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; | 4157 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; |
| 4158 } | 4158 } |
| 4159 | 4159 |
| 4160 } // namespace blink | 4160 } // namespace blink |
| OLD | NEW |