OLD | NEW |
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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 | 606 |
607 // Determine how much we want to scroll. If we can move at all, we will acc
ept the event. | 607 // Determine how much we want to scroll. If we can move at all, we will acc
ept the event. |
608 IntSize maxScrollDelta = maximumScrollPosition() - scrollPosition(); | 608 IntSize maxScrollDelta = maximumScrollPosition() - scrollPosition(); |
609 if ((e.deltaX() < 0 && maxScrollDelta.width() > 0) || | 609 if ((e.deltaX() < 0 && maxScrollDelta.width() > 0) || |
610 (e.deltaX() > 0 && scrollOffset().width() > 0) || | 610 (e.deltaX() > 0 && scrollOffset().width() > 0) || |
611 (e.deltaY() < 0 && maxScrollDelta.height() > 0) || | 611 (e.deltaY() < 0 && maxScrollDelta.height() > 0) || |
612 (e.deltaY() > 0 && scrollOffset().height() > 0)) { | 612 (e.deltaY() > 0 && scrollOffset().height() > 0)) { |
613 e.accept(); | 613 e.accept(); |
614 float deltaX = e.deltaX(); | 614 float deltaX = e.deltaX(); |
615 float deltaY = e.deltaY(); | 615 float deltaY = e.deltaY(); |
616 if (e.granularity() == ScrollByLineWheelEvent) { | 616 if (e.granularity() == ScrollByPageWheelEvent) { |
617 deltaX *= cMouseWheelPixelsPerLineStep; | |
618 deltaY *= cMouseWheelPixelsPerLineStep; | |
619 } else if (e.granularity() == ScrollByPageWheelEvent) { | |
620 ASSERT(deltaX == 0); | 617 ASSERT(deltaX == 0); |
621 bool negative = deltaY < 0; | 618 bool negative = deltaY < 0; |
622 deltaY = max(0, visibleHeight() - cAmountToKeepWhenPaging); | 619 deltaY = max(0, visibleHeight() - cAmountToKeepWhenPaging); |
623 if (negative) | 620 if (negative) |
624 deltaY = -deltaY; | 621 deltaY = -deltaY; |
625 } | 622 } |
626 scrollBy(IntSize(-deltaX, -deltaY)); | 623 scrollBy(IntSize(-deltaX, -deltaY)); |
627 } | 624 } |
628 } | 625 } |
629 | 626 |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 bool ScrollView::platformHasVerticalAdjustment() const | 917 bool ScrollView::platformHasVerticalAdjustment() const |
921 { | 918 { |
922 return false; | 919 return false; |
923 } | 920 } |
924 | 921 |
925 #endif | 922 #endif |
926 | 923 |
927 } | 924 } |
928 | 925 |
929 | 926 |
OLD | NEW |