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

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

Issue 2454913003: MainFrame scrollbars should work with RFV instead of FV (Closed)
Patch Set: add test + rebase 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 void Scrollbar::moveThumb(int pos, bool draggingDocument) { 245 void Scrollbar::moveThumb(int pos, bool draggingDocument) {
246 if (!m_scrollableArea) 246 if (!m_scrollableArea)
247 return; 247 return;
248 248
249 int delta = pos - m_pressedPos; 249 int delta = pos - m_pressedPos;
250 250
251 if (draggingDocument) { 251 if (draggingDocument) {
252 if (m_draggingDocument) 252 if (m_draggingDocument)
253 delta = pos - m_documentDragPos; 253 delta = pos - m_documentDragPos;
254 m_draggingDocument = true; 254 m_draggingDocument = true;
255 ScrollOffset currentPosition = 255 ScrollOffset currentPosition = m_scrollableArea->scrollOffset();
256 m_scrollableArea->scrollAnimator().currentOffset();
257 float destinationPosition = 256 float destinationPosition =
258 (m_orientation == HorizontalScrollbar ? currentPosition.width() 257 (m_orientation == HorizontalScrollbar ? currentPosition.width()
259 : currentPosition.height()) + 258 : currentPosition.height()) +
260 delta; 259 delta;
261 destinationPosition = 260 destinationPosition =
262 m_scrollableArea->clampScrollOffset(m_orientation, destinationPosition); 261 m_scrollableArea->clampScrollOffset(m_orientation, destinationPosition);
263 m_scrollableArea->setScrollOffsetSingleAxis( 262 m_scrollableArea->setScrollOffsetSingleAxis(
264 m_orientation, destinationPosition, UserScroll); 263 m_orientation, destinationPosition, UserScroll);
265 m_documentDragPos = pos; 264 m_documentDragPos = pos;
266 return; 265 return;
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 591
593 return m_scrollableArea->scrollOffset().height() - 592 return m_scrollableArea->scrollOffset().height() -
594 m_scrollableArea->minimumScrollOffset().height(); 593 m_scrollableArea->minimumScrollOffset().height();
595 } 594 }
596 595
597 float Scrollbar::scrollableAreaTargetPos() const { 596 float Scrollbar::scrollableAreaTargetPos() const {
598 if (!m_scrollableArea) 597 if (!m_scrollableArea)
599 return 0; 598 return 0;
600 599
601 if (m_orientation == HorizontalScrollbar) { 600 if (m_orientation == HorizontalScrollbar) {
602 return m_scrollableArea->scrollAnimator().desiredTargetOffset().width() - 601 return m_scrollableArea->scrollAnimatorDesiredTargetOffset().width() -
603 m_scrollableArea->minimumScrollOffset().width(); 602 m_scrollableArea->minimumScrollOffset().width();
604 } 603 }
605 604
606 return m_scrollableArea->scrollAnimator().desiredTargetOffset().height() - 605 return m_scrollableArea->scrollAnimatorDesiredTargetOffset().height() -
607 m_scrollableArea->minimumScrollOffset().height(); 606 m_scrollableArea->minimumScrollOffset().height();
608 } 607 }
609 608
610 LayoutRect Scrollbar::visualRect() const { 609 LayoutRect Scrollbar::visualRect() const {
611 return m_scrollableArea ? m_scrollableArea->visualRectForScrollbarParts() 610 return m_scrollableArea ? m_scrollableArea->visualRectForScrollbarParts()
612 : LayoutRect(); 611 : LayoutRect();
613 } 612 }
614 613
615 void Scrollbar::setNeedsPaintInvalidation(ScrollbarPart invalidParts) { 614 void Scrollbar::setNeedsPaintInvalidation(ScrollbarPart invalidParts) {
616 if (m_theme.shouldRepaintAllPartsOnInvalidation()) 615 if (m_theme.shouldRepaintAllPartsOnInvalidation())
617 invalidParts = AllParts; 616 invalidParts = AllParts;
618 if (invalidParts & ~ThumbPart) 617 if (invalidParts & ~ThumbPart)
619 m_trackNeedsRepaint = true; 618 m_trackNeedsRepaint = true;
620 if (invalidParts & ThumbPart) 619 if (invalidParts & ThumbPart)
621 m_thumbNeedsRepaint = true; 620 m_thumbNeedsRepaint = true;
622 if (m_scrollableArea) 621 if (m_scrollableArea)
623 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation()); 622 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation());
624 } 623 }
625 624
626 } // namespace blink 625 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698