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

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

Issue 1560403002: Scale scrollbar in use-zoom-for-dsf mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2008, 2009 Google Inc. 3 * Copyright (C) 2008, 2009 Google Inc.
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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 12 matching lines...) Expand all
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #include "platform/scroll/ScrollbarThemeNonMacCommon.h" 27 #include "platform/scroll/ScrollbarThemeNonMacCommon.h"
28 28
29 #include "platform/PlatformMouseEvent.h" 29 #include "platform/PlatformMouseEvent.h"
30 #include "platform/graphics/GraphicsContextStateSaver.h" 30 #include "platform/graphics/GraphicsContextStateSaver.h"
31 #include "platform/graphics/paint/DrawingRecorder.h" 31 #include "platform/graphics/paint/DrawingRecorder.h"
32 #include "platform/scroll/ScrollableArea.h" 32 #include "platform/scroll/ScrollableArea.h"
33 #include "platform/scroll/ScrollbarThemeClient.h"
34 33
35 namespace blink { 34 namespace blink {
36 35
37 bool ScrollbarThemeNonMacCommon::hasThumb(const ScrollbarThemeClient& scrollbar) 36 bool ScrollbarThemeNonMacCommon::hasThumb(const ScrollbarThemeClient& scrollbar)
38 { 37 {
39 // This method is just called as a paint-time optimization to see if 38 // This method is just called as a paint-time optimization to see if
40 // painting the thumb can be skipped. We don't have to be exact here. 39 // painting the thumb can be skipped. We don't have to be exact here.
41 return thumbLength(scrollbar) > 0; 40 return thumbLength(scrollbar) > 0;
42 } 41 }
43 42
(...skipping 22 matching lines...) Expand all
66 x = scrollbar.x(); 65 x = scrollbar.x();
67 y = scrollbar.y() + scrollbar.height() - size.height(); 66 y = scrollbar.y() + scrollbar.height() - size.height();
68 } 67 }
69 return IntRect(x, y, size.width(), size.height()); 68 return IntRect(x, y, size.width(), size.height());
70 } 69 }
71 70
72 IntRect ScrollbarThemeNonMacCommon::trackRect(const ScrollbarThemeClient& scroll bar, bool) 71 IntRect ScrollbarThemeNonMacCommon::trackRect(const ScrollbarThemeClient& scroll bar, bool)
73 { 72 {
74 // The track occupies all space between the two buttons. 73 // The track occupies all space between the two buttons.
75 IntSize bs = buttonSize(scrollbar); 74 IntSize bs = buttonSize(scrollbar);
76 int thickness = scrollbarThickness(scrollbar.controlSize()); 75 int thickness;
skobes 2016/01/07 21:49:10 The other caller of ScrollbarThemeClient::controlS
oshima 2016/01/09 00:58:39 Other uses seems to be for custom scrollbars, whic
77 if (scrollbar.orientation() == HorizontalScrollbar) { 76 if (scrollbar.orientation() == HorizontalScrollbar) {
77 thickness = scrollbar.height();
78 if (scrollbar.width() <= 2 * bs.width()) 78 if (scrollbar.width() <= 2 * bs.width())
79 return IntRect(); 79 return IntRect();
80 return IntRect(scrollbar.x() + bs.width(), scrollbar.y(), scrollbar.widt h() - 2 * bs.width(), thickness); 80 return IntRect(scrollbar.x() + bs.width(), scrollbar.y(), scrollbar.widt h() - 2 * bs.width(), thickness);
81 } else {
skobes 2016/01/07 21:49:10 Remove the "else" since we return in the if block.
oshima 2016/01/09 00:58:39 Done.
82 thickness = scrollbar.width();
81 } 83 }
82 if (scrollbar.height() <= 2 * bs.height()) 84 if (scrollbar.height() <= 2 * bs.height())
83 return IntRect(); 85 return IntRect();
84 return IntRect(scrollbar.x(), scrollbar.y() + bs.height(), thickness, scroll bar.height() - 2 * bs.height()); 86 return IntRect(scrollbar.x(), scrollbar.y() + bs.height(), thickness, scroll bar.height() - 2 * bs.height());
85 } 87 }
86 88
87 void ScrollbarThemeNonMacCommon::paintTrackBackground(GraphicsContext& context, const ScrollbarThemeClient& scrollbar, const IntRect& rect) 89 void ScrollbarThemeNonMacCommon::paintTrackBackground(GraphicsContext& context, const ScrollbarThemeClient& scrollbar, const IntRect& rect)
88 { 90 {
89 // Just assume a forward track part. We only paint the track as a single pie ce when there is no thumb. 91 // Just assume a forward track part. We only paint the track as a single pie ce when there is no thumb.
90 if (!hasThumb(scrollbar)) 92 if (!hasThumb(scrollbar))
(...skipping 30 matching lines...) Expand all
121 123
122 FloatRect tickRect(rect.x(), yPos, rect.width(), 3); 124 FloatRect tickRect(rect.x(), yPos, rect.width(), 3);
123 context.fillRect(tickRect, Color(0xCC, 0xAA, 0x00, 0xFF)); 125 context.fillRect(tickRect, Color(0xCC, 0xAA, 0x00, 0xFF));
124 126
125 FloatRect tickStroke(rect.x(), yPos + 1, rect.width(), 1); 127 FloatRect tickStroke(rect.x(), yPos + 1, rect.width(), 1);
126 context.fillRect(tickStroke, Color(0xFF, 0xDD, 0x00, 0xFF)); 128 context.fillRect(tickStroke, Color(0xFF, 0xDD, 0x00, 0xFF));
127 } 129 }
128 } 130 }
129 131
130 } // namespace blink 132 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698