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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
755 | 755 |
756 webview()->setDeviceScaleFactor(device_scale_factor_); | 756 webview()->setDeviceScaleFactor(device_scale_factor_); |
757 webview()->setDisplayMode(display_mode_); | 757 webview()->setDisplayMode(display_mode_); |
758 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 758 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
759 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 759 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
760 webview()->settings()->setThreadedScrollingEnabled( | 760 webview()->settings()->setThreadedScrollingEnabled( |
761 !command_line.HasSwitch(switches::kDisableThreadedScrolling)); | 761 !command_line.HasSwitch(switches::kDisableThreadedScrolling)); |
762 webview()->settings()->setRootLayerScrolls( | 762 webview()->settings()->setRootLayerScrolls( |
763 command_line.HasSwitch(switches::kRootLayerScrolls)); | 763 command_line.HasSwitch(switches::kRootLayerScrolls)); |
764 | 764 |
765 ApplyWebPreferences(webkit_preferences_, webview()); | 765 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_); |
766 | 766 |
767 if (switches::IsTouchDragDropEnabled()) | 767 if (switches::IsTouchDragDropEnabled()) |
768 webview()->settings()->setTouchDragDropEnabled(true); | 768 webview()->settings()->setTouchDragDropEnabled(true); |
769 | 769 |
770 if (switches::IsTouchEditingEnabled()) | 770 if (switches::IsTouchEditingEnabled()) |
771 webview()->settings()->setTouchEditingEnabled(true); | 771 webview()->settings()->setTouchEditingEnabled(true); |
772 | 772 |
773 WebSettings::SelectionStrategyType selection_strategy = | 773 WebSettings::SelectionStrategyType selection_strategy = |
774 WebSettings::SelectionStrategyType::Character; | 774 WebSettings::SelectionStrategyType::Character; |
775 const std::string selection_strategy_str = | 775 const std::string selection_strategy_str = |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1496 return; | 1496 return; |
1497 | 1497 |
1498 // Don't send state updates for kSwappedOutURL. | 1498 // Don't send state updates for kSwappedOutURL. |
1499 if (entry->root().urlString() == WebString::fromUTF8(kSwappedOutURL)) | 1499 if (entry->root().urlString() == WebString::fromUTF8(kSwappedOutURL)) |
1500 return; | 1500 return; |
1501 | 1501 |
1502 Send(new ViewHostMsg_UpdateState( | 1502 Send(new ViewHostMsg_UpdateState( |
1503 routing_id_, page_id_, HistoryEntryToPageState(entry))); | 1503 routing_id_, page_id_, HistoryEntryToPageState(entry))); |
1504 } | 1504 } |
1505 | 1505 |
1506 void RenderViewImpl::ApplyWebPreferencesInternal( | |
1507 const WebPreferences& prefs, | |
1508 WebView* web_view, | |
1509 CompositorDependencies* compositor_deps) { | |
1510 ApplyWebPreferences(prefs, web_view); | |
1511 #if defined(OS_MACOSX) && !defined(OS_IOS) | |
1512 bool is_elastic_overscroll_enabled = | |
1513 compositor_deps ? compositor_deps->IsElasticOverscrollEnabled() : false; | |
piman
2015/07/01 20:30:46
DCHECK(compositor_deps) instead. When called from
MuVen
2015/07/02 13:52:47
Done.
| |
1514 web_view->settings()->setReportWheelOverscroll(is_elastic_overscroll_enabled); | |
1515 #endif | |
1516 } | |
1517 | |
1506 bool RenderViewImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { | 1518 bool RenderViewImpl::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) { |
1507 // Before WebKit asks us to show an alert (etc.), it takes care of doing the | 1519 // Before WebKit asks us to show an alert (etc.), it takes care of doing the |
1508 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog | 1520 // equivalent of WebView::willEnterModalLoop. In the case of showModalDialog |
1509 // it is particularly important that we do not call willEnterModalLoop as | 1521 // it is particularly important that we do not call willEnterModalLoop as |
1510 // that would defer resource loads for the dialog itself. | 1522 // that would defer resource loads for the dialog itself. |
1511 if (RenderThreadImpl::current()) // Will be NULL during unit tests. | 1523 if (RenderThreadImpl::current()) // Will be NULL during unit tests. |
1512 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); | 1524 RenderThreadImpl::current()->DoNotNotifyWebKitOfModalLoop(); |
1513 | 1525 |
1514 message->EnableMessagePumping(); // Runs a nested message loop. | 1526 message->EnableMessagePumping(); // Runs a nested message loop. |
1515 return Send(message); | 1527 return Send(message); |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2639 WebDragOperation op) { | 2651 WebDragOperation op) { |
2640 webview()->dragSourceEndedAt(client_point, screen_point, op); | 2652 webview()->dragSourceEndedAt(client_point, screen_point, op); |
2641 } | 2653 } |
2642 | 2654 |
2643 void RenderViewImpl::OnDragSourceSystemDragEnded() { | 2655 void RenderViewImpl::OnDragSourceSystemDragEnded() { |
2644 webview()->dragSourceSystemDragEnded(); | 2656 webview()->dragSourceSystemDragEnded(); |
2645 } | 2657 } |
2646 | 2658 |
2647 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { | 2659 void RenderViewImpl::OnUpdateWebPreferences(const WebPreferences& prefs) { |
2648 webkit_preferences_ = prefs; | 2660 webkit_preferences_ = prefs; |
2649 ApplyWebPreferences(webkit_preferences_, webview()); | 2661 ApplyWebPreferencesInternal(webkit_preferences_, webview(), NULL); |
piman
2015/07/01 20:30:46
compositor_deps_ instead of NULL.
MuVen
2015/07/02 13:52:47
Done.
MuVen
2015/07/02 18:11:20
Missed in the patch 11. Addressed this comment in
| |
2650 } | 2662 } |
2651 | 2663 |
2652 void RenderViewImpl::OnEnumerateDirectoryResponse( | 2664 void RenderViewImpl::OnEnumerateDirectoryResponse( |
2653 int id, | 2665 int id, |
2654 const std::vector<base::FilePath>& paths) { | 2666 const std::vector<base::FilePath>& paths) { |
2655 if (!enumeration_completions_[id]) | 2667 if (!enumeration_completions_[id]) |
2656 return; | 2668 return; |
2657 | 2669 |
2658 WebVector<WebString> ws_file_names(paths.size()); | 2670 WebVector<WebString> ws_file_names(paths.size()); |
2659 for (size_t i = 0; i < paths.size(); ++i) | 2671 for (size_t i = 0; i < paths.size(); ++i) |
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3796 std::vector<gfx::Size> sizes; | 3808 std::vector<gfx::Size> sizes; |
3797 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3809 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
3798 if (!url.isEmpty()) | 3810 if (!url.isEmpty()) |
3799 urls.push_back( | 3811 urls.push_back( |
3800 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3812 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
3801 } | 3813 } |
3802 SendUpdateFaviconURL(urls); | 3814 SendUpdateFaviconURL(urls); |
3803 } | 3815 } |
3804 | 3816 |
3805 } // namespace content | 3817 } // namespace content |
OLD | NEW |