| 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 1721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1732 bool WebContentsImpl::HandleWheelEvent( | 1732 bool WebContentsImpl::HandleWheelEvent( |
| 1733 const blink::WebMouseWheelEvent& event) { | 1733 const blink::WebMouseWheelEvent& event) { |
| 1734 #if !defined(OS_MACOSX) | 1734 #if !defined(OS_MACOSX) |
| 1735 // On platforms other than Mac, control+mousewheel may change zoom. On Mac, | 1735 // On platforms other than Mac, control+mousewheel may change zoom. On Mac, |
| 1736 // this isn't done for two reasons: | 1736 // this isn't done for two reasons: |
| 1737 // -the OS already has a gesture to do this through pinch-zoom | 1737 // -the OS already has a gesture to do this through pinch-zoom |
| 1738 // -if a user starts an inertial scroll, let's go, and presses control | 1738 // -if a user starts an inertial scroll, let's go, and presses control |
| 1739 // (i.e. control+tab) then the OS's buffered scroll events will come in | 1739 // (i.e. control+tab) then the OS's buffered scroll events will come in |
| 1740 // with control key set which isn't what the user wants | 1740 // with control key set which isn't what the user wants |
| 1741 if (delegate_ && event.wheelTicksY && | 1741 if (delegate_ && event.wheelTicksY && |
| 1742 (event.modifiers & blink::WebInputEvent::ControlKey) && | 1742 !WebInputEventTraits::CanCauseScroll(event)) { |
| 1743 !event.canScroll) { | |
| 1744 // Count only integer cumulative scrolls as zoom events; this handles | 1743 // Count only integer cumulative scrolls as zoom events; this handles |
| 1745 // smooth scroll and regular scroll device behavior. | 1744 // smooth scroll and regular scroll device behavior. |
| 1746 zoom_scroll_remainder_ += event.wheelTicksY; | 1745 zoom_scroll_remainder_ += event.wheelTicksY; |
| 1747 int whole_zoom_scroll_remainder_ = std::lround(zoom_scroll_remainder_); | 1746 int whole_zoom_scroll_remainder_ = std::lround(zoom_scroll_remainder_); |
| 1748 zoom_scroll_remainder_ -= whole_zoom_scroll_remainder_; | 1747 zoom_scroll_remainder_ -= whole_zoom_scroll_remainder_; |
| 1749 if (whole_zoom_scroll_remainder_ != 0) { | 1748 if (whole_zoom_scroll_remainder_ != 0) { |
| 1750 delegate_->ContentsZoomChange(whole_zoom_scroll_remainder_ > 0); | 1749 delegate_->ContentsZoomChange(whole_zoom_scroll_remainder_ > 0); |
| 1751 } | 1750 } |
| 1752 return true; | 1751 return true; |
| 1753 } | 1752 } |
| (...skipping 3373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5127 for (RenderViewHost* render_view_host : render_view_host_set) | 5126 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5128 render_view_host->OnWebkitPreferencesChanged(); | 5127 render_view_host->OnWebkitPreferencesChanged(); |
| 5129 } | 5128 } |
| 5130 | 5129 |
| 5131 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 5130 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 5132 JavaScriptDialogManager* dialog_manager) { | 5131 JavaScriptDialogManager* dialog_manager) { |
| 5133 dialog_manager_ = dialog_manager; | 5132 dialog_manager_ = dialog_manager; |
| 5134 } | 5133 } |
| 5135 | 5134 |
| 5136 } // namespace content | 5135 } // namespace content |
| OLD | NEW |