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

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: Fix VisualViewportTest 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 324 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