| 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/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1756 bool WebContentsImpl::HandleWheelEvent( | 1756 bool WebContentsImpl::HandleWheelEvent( |
| 1757 const blink::WebMouseWheelEvent& event) { | 1757 const blink::WebMouseWheelEvent& event) { |
| 1758 #if !defined(OS_MACOSX) | 1758 #if !defined(OS_MACOSX) |
| 1759 // On platforms other than Mac, control+mousewheel may change zoom. On Mac, | 1759 // On platforms other than Mac, control+mousewheel may change zoom. On Mac, |
| 1760 // this isn't done for two reasons: | 1760 // this isn't done for two reasons: |
| 1761 // -the OS already has a gesture to do this through pinch-zoom | 1761 // -the OS already has a gesture to do this through pinch-zoom |
| 1762 // -if a user starts an inertial scroll, let's go, and presses control | 1762 // -if a user starts an inertial scroll, let's go, and presses control |
| 1763 // (i.e. control+tab) then the OS's buffered scroll events will come in | 1763 // (i.e. control+tab) then the OS's buffered scroll events will come in |
| 1764 // with control key set which isn't what the user wants | 1764 // with control key set which isn't what the user wants |
| 1765 if (delegate_ && event.wheelTicksY && | 1765 if (delegate_ && event.wheelTicksY && |
| 1766 (event.modifiers & blink::WebInputEvent::ControlKey) && | 1766 !WebInputEventTraits::ShouldCauseScroll(event)) { |
| 1767 !event.canScroll) { | |
| 1768 // Count only integer cumulative scrolls as zoom events; this handles | 1767 // Count only integer cumulative scrolls as zoom events; this handles |
| 1769 // smooth scroll and regular scroll device behavior. | 1768 // smooth scroll and regular scroll device behavior. |
| 1770 zoom_scroll_remainder_ += event.wheelTicksY; | 1769 zoom_scroll_remainder_ += event.wheelTicksY; |
| 1771 int whole_zoom_scroll_remainder_ = std::lround(zoom_scroll_remainder_); | 1770 int whole_zoom_scroll_remainder_ = std::lround(zoom_scroll_remainder_); |
| 1772 zoom_scroll_remainder_ -= whole_zoom_scroll_remainder_; | 1771 zoom_scroll_remainder_ -= whole_zoom_scroll_remainder_; |
| 1773 if (whole_zoom_scroll_remainder_ != 0) { | 1772 if (whole_zoom_scroll_remainder_ != 0) { |
| 1774 delegate_->ContentsZoomChange(whole_zoom_scroll_remainder_ > 0); | 1773 delegate_->ContentsZoomChange(whole_zoom_scroll_remainder_ > 0); |
| 1775 } | 1774 } |
| 1776 return true; | 1775 return true; |
| 1777 } | 1776 } |
| (...skipping 3342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5120 for (RenderViewHost* render_view_host : render_view_host_set) | 5119 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5121 render_view_host->OnWebkitPreferencesChanged(); | 5120 render_view_host->OnWebkitPreferencesChanged(); |
| 5122 } | 5121 } |
| 5123 | 5122 |
| 5124 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 5123 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 5125 JavaScriptDialogManager* dialog_manager) { | 5124 JavaScriptDialogManager* dialog_manager) { |
| 5126 dialog_manager_ = dialog_manager; | 5125 dialog_manager_ = dialog_manager; |
| 5127 } | 5126 } |
| 5128 | 5127 |
| 5129 } // namespace content | 5128 } // namespace content |
| OLD | NEW |