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

Side by Side Diff: Source/platform/scroll/ScrollableArea.cpp

Issue 1298973004: Remove special wheel handling path from ScrollableArea (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed TODO Created 5 years, 4 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 | « Source/platform/scroll/ScrollableArea.h ('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) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google Inc. All rights reserved.
3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. 3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 else if (behaviorString == "instant") 297 else if (behaviorString == "instant")
298 behavior = ScrollBehaviorInstant; 298 behavior = ScrollBehaviorInstant;
299 else if (behaviorString == "smooth") 299 else if (behaviorString == "smooth")
300 behavior = ScrollBehaviorSmooth; 300 behavior = ScrollBehaviorSmooth;
301 else 301 else
302 return false; 302 return false;
303 303
304 return true; 304 return true;
305 } 305 }
306 306
307 ScrollResult ScrollableArea::handleWheel(const PlatformWheelEvent& wheelEvent)
308 {
309 // Wheel events which do not scroll are used to trigger zooming.
310 if (!wheelEvent.canScroll())
311 return ScrollResult();
312
313 cancelProgrammaticScrollAnimation();
314 return scrollAnimator()->handleWheelEvent(wheelEvent);
315 }
316
317 // NOTE: Only called from Internals for testing. 307 // NOTE: Only called from Internals for testing.
318 void ScrollableArea::setScrollOffsetFromInternals(const IntPoint& offset) 308 void ScrollableArea::setScrollOffsetFromInternals(const IntPoint& offset)
319 { 309 {
320 scrollPositionChanged(DoublePoint(offset), ProgrammaticScroll); 310 scrollPositionChanged(DoublePoint(offset), ProgrammaticScroll);
321 } 311 }
322 312
323 void ScrollableArea::willStartLiveResize() 313 void ScrollableArea::willStartLiveResize()
324 { 314 {
325 if (m_inLiveResize) 315 if (m_inLiveResize)
326 return; 316 return;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 IntPoint ScrollableArea::clampScrollPosition(const IntPoint& scrollPosition) con st 559 IntPoint ScrollableArea::clampScrollPosition(const IntPoint& scrollPosition) con st
570 { 560 {
571 return scrollPosition.shrunkTo(maximumScrollPosition()).expandedTo(minimumSc rollPosition()); 561 return scrollPosition.shrunkTo(maximumScrollPosition()).expandedTo(minimumSc rollPosition());
572 } 562 }
573 563
574 DoublePoint ScrollableArea::clampScrollPosition(const DoublePoint& scrollPositio n) const 564 DoublePoint ScrollableArea::clampScrollPosition(const DoublePoint& scrollPositio n) const
575 { 565 {
576 return scrollPosition.shrunkTo(maximumScrollPositionDouble()).expandedTo(min imumScrollPositionDouble()); 566 return scrollPosition.shrunkTo(maximumScrollPositionDouble()).expandedTo(min imumScrollPositionDouble());
577 } 567 }
578 568
579
580 int ScrollableArea::lineStep(ScrollbarOrientation) const 569 int ScrollableArea::lineStep(ScrollbarOrientation) const
581 { 570 {
582 return pixelsPerLineStep(); 571 return pixelsPerLineStep();
583 } 572 }
584 573
585 int ScrollableArea::pageStep(ScrollbarOrientation orientation) const 574 int ScrollableArea::pageStep(ScrollbarOrientation orientation) const
586 { 575 {
587 int length = (orientation == HorizontalScrollbar) ? visibleWidth() : visible Height(); 576 IntRect visibleRect = visibleContentRect(IncludeScrollbars);
577 int length = (orientation == HorizontalScrollbar) ? visibleRect.width() : vi sibleRect.height();
588 int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging() ; 578 int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging() ;
589 int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages()); 579 int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages());
590 580
591 return std::max(pageStep, 1); 581 return std::max(pageStep, 1);
592 } 582 }
593 583
594 int ScrollableArea::documentStep(ScrollbarOrientation orientation) const 584 int ScrollableArea::documentStep(ScrollbarOrientation orientation) const
595 { 585 {
596 return scrollSize(orientation); 586 return scrollSize(orientation);
597 } 587 }
(...skipping 12 matching lines...) Expand all
610 verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBa r->width() : 0; 600 verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBa r->width() : 0;
611 if (Scrollbar* horizontalBar = horizontalScrollbar()) 601 if (Scrollbar* horizontalBar = horizontalScrollbar())
612 horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horiz ontalBar->height() : 0; 602 horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horiz ontalBar->height() : 0;
613 603
614 return IntSize(std::max(0, size.width() - verticalScrollbarWidth), 604 return IntSize(std::max(0, size.width() - verticalScrollbarWidth),
615 std::max(0, size.height() - horizontalScrollbarHeight)); 605 std::max(0, size.height() - horizontalScrollbarHeight));
616 606
617 } 607 }
618 608
619 } // namespace blink 609 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/scroll/ScrollableArea.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698