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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 2804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2815 new ContentsZoomChangedDelegate()); | 2815 new ContentsZoomChangedDelegate()); |
| 2816 contents()->SetDelegate(delegate.get()); | 2816 contents()->SetDelegate(delegate.get()); |
| 2817 | 2817 |
| 2818 int modifiers = 0; | 2818 int modifiers = 0; |
| 2819 // Verify that normal mouse wheel events do nothing to change the zoom level. | 2819 // Verify that normal mouse wheel events do nothing to change the zoom level. |
| 2820 blink::WebMouseWheelEvent event = | 2820 blink::WebMouseWheelEvent event = |
| 2821 SyntheticWebMouseWheelEventBuilder::Build(0, 0, 0, 1, modifiers, false); | 2821 SyntheticWebMouseWheelEventBuilder::Build(0, 0, 0, 1, modifiers, false); |
| 2822 EXPECT_FALSE(contents()->HandleWheelEvent(event)); | 2822 EXPECT_FALSE(contents()->HandleWheelEvent(event)); |
| 2823 EXPECT_EQ(0, delegate->GetAndResetContentsZoomChangedCallCount()); | 2823 EXPECT_EQ(0, delegate->GetAndResetContentsZoomChangedCallCount()); |
| 2824 | 2824 |
| 2825 modifiers = WebInputEvent::ShiftKey | WebInputEvent::AltKey | | |
| 2826 WebInputEvent::ControlKey; | |
| 2827 event = | |
| 2828 SyntheticWebMouseWheelEventBuilder::Build(0, 0, 0, 1, modifiers, false); | |
| 2829 EXPECT_FALSE(contents()->HandleWheelEvent(event)); | |
| 2830 EXPECT_EQ(0, delegate->GetAndResetContentsZoomChangedCallCount()); | |
| 2831 | |
| 2832 // But whenever the ctrl modifier is applied with canScroll=false, they can | 2825 // But whenever the ctrl modifier is applied with canScroll=false, they can |
|
tdresser
2016/06/10 18:06:46
Update comment.
dtapuska
2016/06/10 19:11:17
Done.
| |
| 2833 // increase/decrease zoom. Except on MacOS where we never want to adjust zoom | 2826 // increase/decrease zoom. Except on MacOS where we never want to adjust zoom |
| 2834 // with mousewheel. | 2827 // with mousewheel. |
| 2835 modifiers = WebInputEvent::ControlKey; | 2828 modifiers = WebInputEvent::ControlKey; |
| 2836 event = | 2829 event = |
| 2837 SyntheticWebMouseWheelEventBuilder::Build(0, 0, 0, 1, modifiers, false); | 2830 SyntheticWebMouseWheelEventBuilder::Build(0, 0, 0, 1, modifiers, false); |
| 2838 event.canScroll = false; | |
| 2839 bool handled = contents()->HandleWheelEvent(event); | 2831 bool handled = contents()->HandleWheelEvent(event); |
| 2840 #if defined(OS_MACOSX) | 2832 #if defined(OS_MACOSX) |
| 2841 EXPECT_FALSE(handled); | 2833 EXPECT_FALSE(handled); |
| 2842 EXPECT_EQ(0, delegate->GetAndResetContentsZoomChangedCallCount()); | 2834 EXPECT_EQ(0, delegate->GetAndResetContentsZoomChangedCallCount()); |
| 2843 #else | 2835 #else |
| 2844 EXPECT_TRUE(handled); | 2836 EXPECT_TRUE(handled); |
| 2845 EXPECT_EQ(1, delegate->GetAndResetContentsZoomChangedCallCount()); | 2837 EXPECT_EQ(1, delegate->GetAndResetContentsZoomChangedCallCount()); |
| 2846 EXPECT_TRUE(delegate->last_zoom_in()); | 2838 EXPECT_TRUE(delegate->last_zoom_in()); |
| 2847 #endif | 2839 #endif |
| 2848 | 2840 |
| 2849 modifiers = WebInputEvent::ControlKey | WebInputEvent::ShiftKey | | 2841 modifiers = WebInputEvent::ControlKey | WebInputEvent::ShiftKey | |
| 2850 WebInputEvent::AltKey; | 2842 WebInputEvent::AltKey; |
| 2851 event = | 2843 event = |
| 2852 SyntheticWebMouseWheelEventBuilder::Build(0, 0, 2, -5, modifiers, false); | 2844 SyntheticWebMouseWheelEventBuilder::Build(0, 0, 2, -5, modifiers, false); |
| 2853 event.canScroll = false; | |
| 2854 handled = contents()->HandleWheelEvent(event); | 2845 handled = contents()->HandleWheelEvent(event); |
| 2855 #if defined(OS_MACOSX) | 2846 #if defined(OS_MACOSX) |
| 2856 EXPECT_FALSE(handled); | 2847 EXPECT_FALSE(handled); |
| 2857 EXPECT_EQ(0, delegate->GetAndResetContentsZoomChangedCallCount()); | 2848 EXPECT_EQ(0, delegate->GetAndResetContentsZoomChangedCallCount()); |
| 2858 #else | 2849 #else |
| 2859 EXPECT_TRUE(handled); | 2850 EXPECT_TRUE(handled); |
| 2860 EXPECT_EQ(1, delegate->GetAndResetContentsZoomChangedCallCount()); | 2851 EXPECT_EQ(1, delegate->GetAndResetContentsZoomChangedCallCount()); |
| 2861 EXPECT_FALSE(delegate->last_zoom_in()); | 2852 EXPECT_FALSE(delegate->last_zoom_in()); |
| 2862 #endif | 2853 #endif |
| 2863 | 2854 |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3470 // An automatic navigation. | 3461 // An automatic navigation. |
| 3471 contents()->GetMainFrame()->SendNavigateWithModificationCallback( | 3462 contents()->GetMainFrame()->SendNavigateWithModificationCallback( |
| 3472 2, 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); | 3463 2, 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); |
| 3473 | 3464 |
| 3474 EXPECT_EQ(1u, dialog_manager.reset_count()); | 3465 EXPECT_EQ(1u, dialog_manager.reset_count()); |
| 3475 | 3466 |
| 3476 contents()->SetJavaScriptDialogManagerForTesting(nullptr); | 3467 contents()->SetJavaScriptDialogManagerForTesting(nullptr); |
| 3477 } | 3468 } |
| 3478 | 3469 |
| 3479 } // namespace content | 3470 } // namespace content |
| OLD | NEW |