Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(581)

Side by Side Diff: WebCore/platform/ScrollView.cpp

Issue 3552012: Merge 69257 - 2010-10-06 Peter Kasting <pkasting@google.com>... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/517/
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « WebCore/ChangeLog ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 { 664 {
665 // We don't allow mouse wheeling to happen in a ScrollView that has had its scrollbars explicitly disabled. 665 // We don't allow mouse wheeling to happen in a ScrollView that has had its scrollbars explicitly disabled.
666 #if PLATFORM(WX) 666 #if PLATFORM(WX)
667 if (!canHaveScrollbars()) { 667 if (!canHaveScrollbars()) {
668 #else 668 #else
669 if (!canHaveScrollbars() || platformWidget()) { 669 if (!canHaveScrollbars() || platformWidget()) {
670 #endif 670 #endif
671 return; 671 return;
672 } 672 }
673 673
674 // Determine how much we want to scroll. If we can move at all, we will acc ept the event. 674 // Accept the event if we have a scrollbar in that direction and can still
675 // scroll any further.
676 float deltaX = m_horizontalScrollbar ? e.deltaX() : 0;
677 float deltaY = m_verticalScrollbar ? e.deltaY() : 0;
675 IntSize maxScrollDelta = maximumScrollPosition() - scrollPosition(); 678 IntSize maxScrollDelta = maximumScrollPosition() - scrollPosition();
676 if ((e.deltaX() < 0 && maxScrollDelta.width() > 0) || 679 if ((deltaX < 0 && maxScrollDelta.width() > 0)
677 (e.deltaX() > 0 && scrollOffset().width() > 0) || 680 || (deltaX > 0 && scrollOffset().width() > 0)
678 (e.deltaY() < 0 && maxScrollDelta.height() > 0) || 681 || (deltaY < 0 && maxScrollDelta.height() > 0)
679 (e.deltaY() > 0 && scrollOffset().height() > 0)) { 682 || (deltaY > 0 && scrollOffset().height() > 0)) {
680 e.accept(); 683 e.accept();
681 float deltaX = e.deltaX();
682 float deltaY = e.deltaY();
683 if (e.granularity() == ScrollByPageWheelEvent) { 684 if (e.granularity() == ScrollByPageWheelEvent) {
684 ASSERT(deltaX == 0); 685 ASSERT(!e.deltaX());
685 bool negative = deltaY < 0; 686 bool negative = deltaY < 0;
686 deltaY = max(max(static_cast<float>(visibleHeight()) * Scrollbar::mi nFractionToStepWhenPaging(), static_cast<float>(visibleHeight() - Scrollbar::max OverlapBetweenPages())), 1.0f); 687 deltaY = max(max(static_cast<float>(visibleHeight()) * Scrollbar::mi nFractionToStepWhenPaging(), static_cast<float>(visibleHeight() - Scrollbar::max OverlapBetweenPages())), 1.0f);
687 if (negative) 688 if (negative)
688 deltaY = -deltaY; 689 deltaY = -deltaY;
689 } 690 }
690 691
691 // Should we fall back on scrollBy() if there is no scrollbar for a non- zero delta? 692 if (deltaY)
692 if (deltaY && m_verticalScrollbar)
693 m_verticalScrollbar->scroll(ScrollUp, ScrollByPixel, deltaY); 693 m_verticalScrollbar->scroll(ScrollUp, ScrollByPixel, deltaY);
694 if (deltaX && m_horizontalScrollbar) 694 if (deltaX)
695 m_horizontalScrollbar->scroll(ScrollLeft, ScrollByPixel, deltaX); 695 m_horizontalScrollbar->scroll(ScrollLeft, ScrollByPixel, deltaX);
696 } 696 }
697 } 697 }
698 698
699 void ScrollView::setFrameRect(const IntRect& newRect) 699 void ScrollView::setFrameRect(const IntRect& newRect)
700 { 700 {
701 IntRect oldRect = frameRect(); 701 IntRect oldRect = frameRect();
702 702
703 if (newRect == oldRect) 703 if (newRect == oldRect)
704 return; 704 return;
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 1062
1063 bool ScrollView::platformIsOffscreen() const 1063 bool ScrollView::platformIsOffscreen() const
1064 { 1064 {
1065 return false; 1065 return false;
1066 } 1066 }
1067 1067
1068 #endif 1068 #endif
1069 1069
1070 } 1070 }
1071 1071
OLDNEW
« no previous file with comments | « WebCore/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698