Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 680 stats_collection_observer_.reset(new StatsCollectionObserver(this)); | 680 stats_collection_observer_.reset(new StatsCollectionObserver(this)); |
| 681 | 681 |
| 682 // Debug cases of https://crbug.com/575245. | 682 // Debug cases of https://crbug.com/575245. |
| 683 base::debug::SetCrashKeyValue("rvinit_view_id", | 683 base::debug::SetCrashKeyValue("rvinit_view_id", |
| 684 base::IntToString(routing_id())); | 684 base::IntToString(routing_id())); |
| 685 base::debug::SetCrashKeyValue("rvinit_proxy_id", | 685 base::debug::SetCrashKeyValue("rvinit_proxy_id", |
| 686 base::IntToString(params.proxy_routing_id)); | 686 base::IntToString(params.proxy_routing_id)); |
| 687 base::debug::SetCrashKeyValue( | 687 base::debug::SetCrashKeyValue( |
| 688 "rvinit_main_frame_id", base::IntToString(params.main_frame_routing_id)); | 688 "rvinit_main_frame_id", base::IntToString(params.main_frame_routing_id)); |
| 689 | 689 |
| 690 webview()->setDisplayMode(display_mode_); | |
| 691 webview()->settings()->setPreferCompositingToLCDTextEnabled( | |
| 692 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | |
| 693 webview()->settings()->setThreadedScrollingEnabled( | |
| 694 !command_line.HasSwitch(switches::kDisableThreadedScrolling)); | |
| 695 webview()->settings()->setRootLayerScrolls( | |
| 696 command_line.HasSwitch(switches::kRootLayerScrolls)); | |
| 697 webview()->setShowFPSCounter( | |
| 698 command_line.HasSwitch(cc::switches::kShowFPSCounter)); | |
| 699 | |
| 700 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_); | |
| 701 | |
| 702 if (switches::IsTouchDragDropEnabled()) | |
| 703 webview()->settings()->setTouchDragDropEnabled(true); | |
| 704 | |
| 705 WebSettings::SelectionStrategyType selection_strategy = | |
| 706 WebSettings::SelectionStrategyType::Character; | |
| 707 const std::string selection_strategy_str = | |
| 708 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
| 709 switches::kTouchTextSelectionStrategy); | |
| 710 if (selection_strategy_str == "direction") | |
| 711 selection_strategy = WebSettings::SelectionStrategyType::Direction; | |
| 712 webview()->settings()->setSelectionStrategy(selection_strategy); | |
| 713 | |
| 714 ApplyBlinkSettings(command_line, webview()->settings()); | |
| 715 | |
| 690 if (params.main_frame_routing_id != MSG_ROUTING_NONE) { | 716 if (params.main_frame_routing_id != MSG_ROUTING_NONE) { |
| 691 main_render_frame_ = RenderFrameImpl::CreateMainFrame( | 717 main_render_frame_ = RenderFrameImpl::CreateMainFrame( |
| 692 this, params.main_frame_routing_id, params.main_frame_widget_routing_id, | 718 this, params.main_frame_routing_id, params.main_frame_widget_routing_id, |
| 693 params.hidden, screen_info(), compositor_deps_, opener_frame); | 719 params.hidden, screen_info(), compositor_deps_, opener_frame); |
| 694 } | 720 } |
| 695 | 721 |
| 696 if (params.proxy_routing_id != MSG_ROUTING_NONE) { | 722 if (params.proxy_routing_id != MSG_ROUTING_NONE) { |
| 697 CHECK(params.swapped_out); | 723 CHECK(params.swapped_out); |
| 698 RenderFrameProxy::CreateFrameProxy( | 724 RenderFrameProxy::CreateFrameProxy( |
| 699 params.proxy_routing_id, routing_id(), params.opener_frame_route_id, | 725 params.proxy_routing_id, routing_id(), params.opener_frame_route_id, |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 722 if (RenderThreadImpl::current()) { | 748 if (RenderThreadImpl::current()) { |
| 723 RenderThreadImpl::current()->WidgetCreated(); | 749 RenderThreadImpl::current()->WidgetCreated(); |
| 724 if (is_hidden_) | 750 if (is_hidden_) |
| 725 RenderThreadImpl::current()->WidgetHidden(); | 751 RenderThreadImpl::current()->WidgetHidden(); |
| 726 } | 752 } |
| 727 | 753 |
| 728 // If this is a popup, we must wait for the CreatingNew_ACK message before | 754 // If this is a popup, we must wait for the CreatingNew_ACK message before |
| 729 // completing initialization. Otherwise, we can finish it now. | 755 // completing initialization. Otherwise, we can finish it now. |
| 730 if (opener_id_ == MSG_ROUTING_NONE) | 756 if (opener_id_ == MSG_ROUTING_NONE) |
| 731 did_show_ = true; | 757 did_show_ = true; |
| 732 UpdateWebViewWithDeviceScaleFactor(); | |
| 733 webview()->setDisplayMode(display_mode_); | |
| 734 webview()->settings()->setPreferCompositingToLCDTextEnabled( | |
| 735 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | |
| 736 webview()->settings()->setThreadedScrollingEnabled( | |
| 737 !command_line.HasSwitch(switches::kDisableThreadedScrolling)); | |
| 738 webview()->settings()->setRootLayerScrolls( | |
| 739 command_line.HasSwitch(switches::kRootLayerScrolls)); | |
| 740 webview()->setShowFPSCounter( | |
| 741 command_line.HasSwitch(cc::switches::kShowFPSCounter)); | |
| 742 | |
| 743 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_); | |
| 744 | |
| 745 if (switches::IsTouchDragDropEnabled()) | |
| 746 webview()->settings()->setTouchDragDropEnabled(true); | |
| 747 | |
| 748 WebSettings::SelectionStrategyType selection_strategy = | |
| 749 WebSettings::SelectionStrategyType::Character; | |
| 750 const std::string selection_strategy_str = | |
| 751 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
| 752 switches::kTouchTextSelectionStrategy); | |
| 753 if (selection_strategy_str == "direction") | |
| 754 selection_strategy = WebSettings::SelectionStrategyType::Direction; | |
| 755 webview()->settings()->setSelectionStrategy(selection_strategy); | |
| 756 | 758 |
| 757 // Set the main frame's name. Only needs to be done for WebLocalFrames, | 759 // Set the main frame's name. Only needs to be done for WebLocalFrames, |
| 758 // since the remote case was handled as part of SetReplicatedState on the | 760 // since the remote case was handled as part of SetReplicatedState on the |
| 759 // proxy above. | 761 // proxy above. |
| 760 if (!params.replicated_frame_state.name.empty() && | 762 if (!params.replicated_frame_state.name.empty() && |
| 761 webview()->mainFrame()->isWebLocalFrame()) { | 763 webview()->mainFrame()->isWebLocalFrame()) { |
| 762 webview()->mainFrame()->setName( | 764 webview()->mainFrame()->setName( |
| 763 blink::WebString::fromUTF8(params.replicated_frame_state.name)); | 765 blink::WebString::fromUTF8(params.replicated_frame_state.name)); |
| 764 } | 766 } |
| 765 | 767 |
| 766 // TODO(davidben): Move this state from Blink into content. | 768 // TODO(davidben): Move this state from Blink into content. |
| 767 if (params.window_was_created_with_opener) | 769 if (params.window_was_created_with_opener) |
| 768 webview()->setOpenedByDOM(); | 770 webview()->setOpenedByDOM(); |
| 769 | 771 |
| 772 UpdateWebViewWithDeviceScaleFactor(); | |
|
dcheng
2016/03/15 08:33:54
One might wonder: why are these here?
Answer: this
| |
| 770 OnSetRendererPrefs(params.renderer_preferences); | 773 OnSetRendererPrefs(params.renderer_preferences); |
| 771 | 774 |
| 772 ApplyBlinkSettings(command_line, webview()->settings()); | |
| 773 | |
| 774 if (!params.enable_auto_resize) { | 775 if (!params.enable_auto_resize) { |
| 775 OnResize(params.initial_size); | 776 OnResize(params.initial_size); |
| 776 } else { | 777 } else { |
| 777 OnEnableAutoResize(params.min_size, params.max_size); | 778 OnEnableAutoResize(params.min_size, params.max_size); |
| 778 } | 779 } |
| 779 | 780 |
| 780 #if defined(OS_MACOSX) | 781 #if defined(OS_MACOSX) |
| 781 new TextInputClientObserver(this); | 782 new TextInputClientObserver(this); |
| 782 #endif // defined(OS_MACOSX) | 783 #endif // defined(OS_MACOSX) |
| 783 | 784 |
| (...skipping 2742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3526 if (IsUseZoomForDSFEnabled()) { | 3527 if (IsUseZoomForDSFEnabled()) { |
| 3527 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); | 3528 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
| 3528 } else { | 3529 } else { |
| 3529 webview()->setDeviceScaleFactor(device_scale_factor_); | 3530 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 3530 } | 3531 } |
| 3531 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3532 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 3532 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 3533 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
| 3533 } | 3534 } |
| 3534 | 3535 |
| 3535 } // namespace content | 3536 } // namespace content |
| OLD | NEW |