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

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

Issue 2763373002: Overlay scrollbars flush with window edge (Closed)
Patch Set: Created 3 years, 9 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
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 m_pressedPos(0), 56 m_pressedPos(0),
57 m_scrollPos(0), 57 m_scrollPos(0),
58 m_draggingDocument(false), 58 m_draggingDocument(false),
59 m_documentDragPos(0), 59 m_documentDragPos(0),
60 m_enabled(true), 60 m_enabled(true),
61 m_scrollTimer(scrollableArea->getTimerTaskRunner(), 61 m_scrollTimer(scrollableArea->getTimerTaskRunner(),
62 this, 62 this,
63 &Scrollbar::autoscrollTimerFired), 63 &Scrollbar::autoscrollTimerFired),
64 m_elasticOverscroll(0), 64 m_elasticOverscroll(0),
65 m_trackNeedsRepaint(true), 65 m_trackNeedsRepaint(true),
66 m_thumbNeedsRepaint(true) { 66 m_thumbNeedsRepaint(true),
67 m_hitBeginOrEnd(true) {
67 m_theme.registerScrollbar(*this); 68 m_theme.registerScrollbar(*this);
68 69
69 // FIXME: This is ugly and would not be necessary if we fix cross-platform 70 // FIXME: This is ugly and would not be necessary if we fix cross-platform
70 // code to actually query for scrollbar thickness and use it when sizing 71 // code to actually query for scrollbar thickness and use it when sizing
71 // scrollbars (rather than leaving one dimension of the scrollbar alone when 72 // scrollbars (rather than leaving one dimension of the scrollbar alone when
72 // sizing). 73 // sizing).
73 int thickness = m_theme.scrollbarThickness(controlSize); 74 int thickness = m_theme.scrollbarThickness(controlSize);
74 m_themeScrollbarThickness = thickness; 75 m_themeScrollbarThickness = thickness;
75 if (m_hostWindow) 76 if (m_hostWindow)
76 thickness = m_hostWindow->windowToViewportScalar(thickness); 77 thickness = m_hostWindow->windowToViewportScalar(thickness);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 ASSERT(m_scrollableArea); 124 ASSERT(m_scrollableArea);
124 125
125 float position = scrollableAreaCurrentPos(); 126 float position = scrollableAreaCurrentPos();
126 if (position == m_currentPos) 127 if (position == m_currentPos)
127 return; 128 return;
128 129
129 float oldPosition = m_currentPos; 130 float oldPosition = m_currentPos;
130 int oldThumbPosition = theme().thumbPosition(*this); 131 int oldThumbPosition = theme().thumbPosition(*this);
131 m_currentPos = position; 132 m_currentPos = position;
132 133
133 ScrollbarPart invalidParts = 134 bool oldHitBeginOrEnd = m_hitBeginOrEnd;
134 theme().invalidateOnThumbPositionChange(*this, oldPosition, position); 135 int thumbPosition = theme().thumbPosition(*this);
136 m_hitBeginOrEnd =
137 thumbPosition == 0 ||
138 thumbPosition + theme().thumbLength(*this) == theme().trackLength(*this);
139
140 ScrollbarPart invalidParts = theme().invalidateOnThumbPositionChange(
141 *this, oldPosition, position, oldHitBeginOrEnd != m_hitBeginOrEnd);
135 setNeedsPaintInvalidation(invalidParts); 142 setNeedsPaintInvalidation(invalidParts);
136 143
137 if (m_pressedPart == ThumbPart) 144 if (m_pressedPart == ThumbPart)
138 setPressedPos(m_pressedPos + theme().thumbPosition(*this) - 145 setPressedPos(m_pressedPos + theme().thumbPosition(*this) -
139 oldThumbPosition); 146 oldThumbPosition);
140 } 147 }
141 148
142 void Scrollbar::disconnectFromScrollableArea() { 149 void Scrollbar::disconnectFromScrollableArea() {
143 m_scrollableArea = nullptr; 150 m_scrollableArea = nullptr;
144 } 151 }
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 if (m_theme.shouldRepaintAllPartsOnInvalidation()) 647 if (m_theme.shouldRepaintAllPartsOnInvalidation())
641 invalidParts = AllParts; 648 invalidParts = AllParts;
642 if (invalidParts & ~ThumbPart) 649 if (invalidParts & ~ThumbPart)
643 m_trackNeedsRepaint = true; 650 m_trackNeedsRepaint = true;
644 if (invalidParts & ThumbPart) 651 if (invalidParts & ThumbPart)
645 m_thumbNeedsRepaint = true; 652 m_thumbNeedsRepaint = true;
646 if (m_scrollableArea) 653 if (m_scrollableArea)
647 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation()); 654 m_scrollableArea->setScrollbarNeedsPaintInvalidation(orientation());
648 } 655 }
649 656
657 bool Scrollbar::hasScrollCorner() const {
658 return m_scrollableArea->hasLayerForScrollCorner();
659 }
660
650 } // namespace blink 661 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698