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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/Scrollbar.cpp

Issue 2514003002: [DO NOT SUBMIT] Testing a reverted CL to see if changes catch regression. (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 void Scrollbar::moveThumb(int pos, bool draggingDocument) { 246 void Scrollbar::moveThumb(int pos, bool draggingDocument) {
247 if (!m_scrollableArea) 247 if (!m_scrollableArea)
248 return; 248 return;
249 249
250 int delta = pos - m_pressedPos; 250 int delta = pos - m_pressedPos;
251 251
252 if (draggingDocument) { 252 if (draggingDocument) {
253 if (m_draggingDocument) 253 if (m_draggingDocument)
254 delta = pos - m_documentDragPos; 254 delta = pos - m_documentDragPos;
255 m_draggingDocument = true; 255 m_draggingDocument = true;
256 ScrollOffset currentPosition = 256 ScrollOffset currentPosition = m_scrollableArea->scrollOffset();
257 m_scrollableArea->scrollAnimator().currentOffset();
258 float destinationPosition = 257 float destinationPosition =
259 (m_orientation == HorizontalScrollbar ? currentPosition.width() 258 (m_orientation == HorizontalScrollbar ? currentPosition.width()
260 : currentPosition.height()) + 259 : currentPosition.height()) +
261 delta; 260 delta;
262 destinationPosition = 261 destinationPosition =
263 m_scrollableArea->clampScrollOffset(m_orientation, destinationPosition); 262 m_scrollableArea->clampScrollOffset(m_orientation, destinationPosition);
264 m_scrollableArea->setScrollOffsetSingleAxis( 263 m_scrollableArea->setScrollOffsetSingleAxis(
265 m_orientation, destinationPosition, UserScroll); 264 m_orientation, destinationPosition, UserScroll);
266 m_documentDragPos = pos; 265 m_documentDragPos = pos;
267 return; 266 return;
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 597
599 return m_scrollableArea->scrollOffset().height() - 598 return m_scrollableArea->scrollOffset().height() -
600 m_scrollableArea->minimumScrollOffset().height(); 599 m_scrollableArea->minimumScrollOffset().height();
601 } 600 }
602 601
603 float Scrollbar::scrollableAreaTargetPos() const { 602 float Scrollbar::scrollableAreaTargetPos() const {
604 if (!m_scrollableArea) 603 if (!m_scrollableArea)
605 return 0; 604 return 0;
606 605
607 if (m_orientation == HorizontalScrollbar) { 606 if (m_orientation == HorizontalScrollbar) {
608 return m_scrollableArea->scrollAnimator().desiredTargetOffset().width() - 607 return m_scrollableArea->scrollAnimatorDesiredTargetOffset().width() -
609 m_scrollableArea->minimumScrollOffset().width(); 608 m_scrollableArea->minimumScrollOffset().width();
610 } 609 }
611 610
612 return m_scrollableArea->scrollAnimator().desiredTargetOffset().height() - 611 return m_scrollableArea->scrollAnimatorDesiredTargetOffset().height() -
613 m_scrollableArea->minimumScrollOffset().height(); 612 m_scrollableArea->minimumScrollOffset().height();
614 } 613 }
615 614
616 LayoutRect Scrollbar::visualRect() const { 615 LayoutRect Scrollbar::visualRect() const {
617 return m_scrollableArea ? m_scrollableArea->visualRectForScrollbarParts() 616 return m_scrollableArea ? m_scrollableArea->visualRectForScrollbarParts()
618 : LayoutRect(); 617 : LayoutRect();
619 } 618 }
620 619
621 void Scrollbar::setNeedsPaintInvalidation(ScrollbarPart invalidParts) { 620 void Scrollbar::setNeedsPaintInvalidation(ScrollbarPart invalidParts) {
622 if (m_theme.shouldRepaintAllPartsOnInvalidation()) 621 if (m_theme.shouldRepaintAllPartsOnInvalidation())
623 invalidParts = AllParts; 622 invalidParts = AllParts;
624 if (invalidParts & ~ThumbPart) 623 if (invalidParts & ~ThumbPart)
625 m_trackNeedsRepaint = true; 624 m_trackNeedsRepaint = true;
626 if (invalidParts & ThumbPart) 625 if (invalidParts & ThumbPart)
627 m_thumbNeedsRepaint = true; 626 m_thumbNeedsRepaint = true;
628 if (m_scrollableArea) 627 if (m_scrollableArea)
629 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation()); 628 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation());
630 } 629 }
631 630
632 } // namespace blink 631 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698