OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google 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 * | 7 * |
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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 | 27 |
28 #include "public/platform/WebScrollbarThemePainter.h" | 28 #include "public/platform/WebScrollbarThemePainter.h" |
29 | 29 |
30 #include "platform/graphics/GraphicsContext.h" | 30 #include "platform/graphics/GraphicsContext.h" |
31 #include "platform/scroll/Scrollbar.h" | 31 #include "platform/scroll/Scrollbar.h" |
32 #include "platform/scroll/ScrollbarTheme.h" | 32 #include "platform/scroll/ScrollbarTheme.h" |
33 #include "public/platform/WebRect.h" | 33 #include "public/platform/WebRect.h" |
34 | 34 |
35 using namespace blink; | |
36 | |
37 namespace blink { | 35 namespace blink { |
38 | 36 |
39 void WebScrollbarThemePainter::assign(const WebScrollbarThemePainter& painter) | 37 void WebScrollbarThemePainter::assign(const WebScrollbarThemePainter& painter) |
40 { | 38 { |
41 // This is a pointer to a static object, so no ownership transferral. | 39 // This is a pointer to a static object, so no ownership transferral. |
42 m_theme = painter.m_theme; | 40 m_theme = painter.m_theme; |
43 m_scrollbar = painter.m_scrollbar; | 41 m_scrollbar = painter.m_scrollbar; |
44 } | 42 } |
45 | 43 |
46 void WebScrollbarThemePainter::paintScrollbarBackground(WebCanvas* canvas, const
WebRect& rect) | 44 void WebScrollbarThemePainter::paintScrollbarBackground(WebCanvas* canvas, const
WebRect& rect) |
(...skipping 10 matching lines...) Expand all Loading... |
57 { | 55 { |
58 GraphicsContext context(canvas); | 56 GraphicsContext context(canvas); |
59 context.setCertainlyOpaque(false); | 57 context.setCertainlyOpaque(false); |
60 m_theme->paintTrackBackground(&context, m_scrollbar, IntRect(rect)); | 58 m_theme->paintTrackBackground(&context, m_scrollbar, IntRect(rect)); |
61 } | 59 } |
62 | 60 |
63 void WebScrollbarThemePainter::paintBackTrackPart(WebCanvas* canvas, const WebRe
ct& rect) | 61 void WebScrollbarThemePainter::paintBackTrackPart(WebCanvas* canvas, const WebRe
ct& rect) |
64 { | 62 { |
65 GraphicsContext context(canvas); | 63 GraphicsContext context(canvas); |
66 context.setCertainlyOpaque(false); | 64 context.setCertainlyOpaque(false); |
67 m_theme->paintTrackPiece(&context, m_scrollbar, IntRect(rect), blink::BackTr
ackPart); | 65 m_theme->paintTrackPiece(&context, m_scrollbar, IntRect(rect), BackTrackPart
); |
68 } | 66 } |
69 | 67 |
70 void WebScrollbarThemePainter::paintForwardTrackPart(WebCanvas* canvas, const We
bRect& rect) | 68 void WebScrollbarThemePainter::paintForwardTrackPart(WebCanvas* canvas, const We
bRect& rect) |
71 { | 69 { |
72 GraphicsContext context(canvas); | 70 GraphicsContext context(canvas); |
73 context.setCertainlyOpaque(false); | 71 context.setCertainlyOpaque(false); |
74 m_theme->paintTrackPiece(&context, m_scrollbar, IntRect(rect), blink::Forwar
dTrackPart); | 72 m_theme->paintTrackPiece(&context, m_scrollbar, IntRect(rect), ForwardTrackP
art); |
75 } | 73 } |
76 | 74 |
77 void WebScrollbarThemePainter::paintBackButtonStart(WebCanvas* canvas, const Web
Rect& rect) | 75 void WebScrollbarThemePainter::paintBackButtonStart(WebCanvas* canvas, const Web
Rect& rect) |
78 { | 76 { |
79 GraphicsContext context(canvas); | 77 GraphicsContext context(canvas); |
80 context.setCertainlyOpaque(false); | 78 context.setCertainlyOpaque(false); |
81 m_theme->paintButton(&context, m_scrollbar, IntRect(rect), blink::BackButton
StartPart); | 79 m_theme->paintButton(&context, m_scrollbar, IntRect(rect), BackButtonStartPa
rt); |
82 } | 80 } |
83 | 81 |
84 void WebScrollbarThemePainter::paintBackButtonEnd(WebCanvas* canvas, const WebRe
ct& rect) | 82 void WebScrollbarThemePainter::paintBackButtonEnd(WebCanvas* canvas, const WebRe
ct& rect) |
85 { | 83 { |
86 GraphicsContext context(canvas); | 84 GraphicsContext context(canvas); |
87 context.setCertainlyOpaque(false); | 85 context.setCertainlyOpaque(false); |
88 m_theme->paintButton(&context, m_scrollbar, IntRect(rect), blink::BackButton
EndPart); | 86 m_theme->paintButton(&context, m_scrollbar, IntRect(rect), BackButtonEndPart
); |
89 } | 87 } |
90 | 88 |
91 void WebScrollbarThemePainter::paintForwardButtonStart(WebCanvas* canvas, const
WebRect& rect) | 89 void WebScrollbarThemePainter::paintForwardButtonStart(WebCanvas* canvas, const
WebRect& rect) |
92 { | 90 { |
93 GraphicsContext context(canvas); | 91 GraphicsContext context(canvas); |
94 context.setCertainlyOpaque(false); | 92 context.setCertainlyOpaque(false); |
95 m_theme->paintButton(&context, m_scrollbar, IntRect(rect), blink::ForwardBut
tonStartPart); | 93 m_theme->paintButton(&context, m_scrollbar, IntRect(rect), ForwardButtonStar
tPart); |
96 } | 94 } |
97 | 95 |
98 void WebScrollbarThemePainter::paintForwardButtonEnd(WebCanvas* canvas, const We
bRect& rect) | 96 void WebScrollbarThemePainter::paintForwardButtonEnd(WebCanvas* canvas, const We
bRect& rect) |
99 { | 97 { |
100 GraphicsContext context(canvas); | 98 GraphicsContext context(canvas); |
101 context.setCertainlyOpaque(false); | 99 context.setCertainlyOpaque(false); |
102 m_theme->paintButton(&context, m_scrollbar, IntRect(rect), blink::ForwardBut
tonEndPart); | 100 m_theme->paintButton(&context, m_scrollbar, IntRect(rect), ForwardButtonEndP
art); |
103 } | 101 } |
104 | 102 |
105 void WebScrollbarThemePainter::paintTickmarks(WebCanvas* canvas, const WebRect&
rect) | 103 void WebScrollbarThemePainter::paintTickmarks(WebCanvas* canvas, const WebRect&
rect) |
106 { | 104 { |
107 GraphicsContext context(canvas); | 105 GraphicsContext context(canvas); |
108 context.setCertainlyOpaque(false); | 106 context.setCertainlyOpaque(false); |
109 m_theme->paintTickmarks(&context, m_scrollbar, IntRect(rect)); | 107 m_theme->paintTickmarks(&context, m_scrollbar, IntRect(rect)); |
110 } | 108 } |
111 | 109 |
112 void WebScrollbarThemePainter::paintThumb(WebCanvas* canvas, const WebRect& rect
) | 110 void WebScrollbarThemePainter::paintThumb(WebCanvas* canvas, const WebRect& rect
) |
113 { | 111 { |
114 GraphicsContext context(canvas); | 112 GraphicsContext context(canvas); |
115 context.setCertainlyOpaque(false); | 113 context.setCertainlyOpaque(false); |
116 m_theme->paintThumb(&context, m_scrollbar, IntRect(rect)); | 114 m_theme->paintThumb(&context, m_scrollbar, IntRect(rect)); |
117 } | 115 } |
118 | 116 |
119 WebScrollbarThemePainter::WebScrollbarThemePainter(blink::ScrollbarTheme* theme,
blink::Scrollbar* scrollbar) | 117 WebScrollbarThemePainter::WebScrollbarThemePainter(ScrollbarTheme* theme, Scroll
bar* scrollbar) |
120 : m_theme(theme) | 118 : m_theme(theme) |
121 , m_scrollbar(scrollbar) | 119 , m_scrollbar(scrollbar) |
122 { | 120 { |
123 } | 121 } |
124 | 122 |
125 } // namespace blink | 123 } // namespace blink |
OLD | NEW |