| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 10 matching lines...) Expand all Loading... |
| 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "platform/scroll/ScrollbarThemeOverlay.h" | 26 #include "platform/scroll/ScrollbarThemeOverlay.h" |
| 27 | 27 |
| 28 #include "platform/PlatformMouseEvent.h" | 28 #include "platform/PlatformMouseEvent.h" |
| 29 #include "platform/graphics/GraphicsContext.h" | 29 #include "platform/graphics/GraphicsContext.h" |
| 30 #include "platform/graphics/paint/DrawingRecorder.h" | 30 #include "platform/graphics/paint/DrawingRecorder.h" |
| 31 #include "platform/scroll/ScrollbarThemeClient.h" | 31 #include "platform/scroll/Scrollbar.h" |
| 32 #include "platform/transforms/TransformationMatrix.h" | 32 #include "platform/transforms/TransformationMatrix.h" |
| 33 #include "public/platform/Platform.h" | 33 #include "public/platform/Platform.h" |
| 34 #include "public/platform/WebRect.h" | 34 #include "public/platform/WebRect.h" |
| 35 #include "public/platform/WebThemeEngine.h" | 35 #include "public/platform/WebThemeEngine.h" |
| 36 #include "wtf/MathExtras.h" | 36 #include "wtf/MathExtras.h" |
| 37 | 37 |
| 38 #include <algorithm> | 38 #include <algorithm> |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 else | 120 else |
| 121 rect.inflateY(-m_scrollbarMargin); | 121 rect.inflateY(-m_scrollbarMargin); |
| 122 return rect; | 122 return rect; |
| 123 } | 123 } |
| 124 | 124 |
| 125 int ScrollbarThemeOverlay::thumbThickness(const ScrollbarThemeClient&) | 125 int ScrollbarThemeOverlay::thumbThickness(const ScrollbarThemeClient&) |
| 126 { | 126 { |
| 127 return m_thumbThickness; | 127 return m_thumbThickness; |
| 128 } | 128 } |
| 129 | 129 |
| 130 void ScrollbarThemeOverlay::paintThumb(GraphicsContext& context, const Scrollbar
ThemeClient& scrollbar, const IntRect& rect) | 130 void ScrollbarThemeOverlay::paintThumb(GraphicsContext& context, const Scrollbar
& scrollbar, const IntRect& rect) |
| 131 { | 131 { |
| 132 if (DrawingRecorder::useCachedDrawingIfPossible(context, scrollbar, DisplayI
tem::ScrollbarThumb)) | 132 if (DrawingRecorder::useCachedDrawingIfPossible(context, scrollbar, DisplayI
tem::ScrollbarThumb)) |
| 133 return; | 133 return; |
| 134 | 134 |
| 135 DrawingRecorder recorder(context, scrollbar, DisplayItem::ScrollbarThumb, re
ct); | 135 DrawingRecorder recorder(context, scrollbar, DisplayItem::ScrollbarThumb, re
ct); |
| 136 | 136 |
| 137 IntRect thumbRect = rect; | 137 IntRect thumbRect = rect; |
| 138 if (scrollbar.orientation() == HorizontalScrollbar) { | 138 if (scrollbar.orientation() == HorizontalScrollbar) { |
| 139 thumbRect.setHeight(thumbRect.height() - m_scrollbarMargin); | 139 thumbRect.setHeight(thumbRect.height() - m_scrollbarMargin); |
| 140 } else { | 140 } else { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 WebThemeEngine::ScrollbarStyle style = { 3, 3, 0x80808080 }; // default
style | 178 WebThemeEngine::ScrollbarStyle style = { 3, 3, 0x80808080 }; // default
style |
| 179 if (Platform::current()->themeEngine()) { | 179 if (Platform::current()->themeEngine()) { |
| 180 Platform::current()->themeEngine()->getOverlayScrollbarStyle(&style)
; | 180 Platform::current()->themeEngine()->getOverlayScrollbarStyle(&style)
; |
| 181 } | 181 } |
| 182 theme = new ScrollbarThemeOverlay(style.thumbThickness, style.scrollbarM
argin, ScrollbarThemeOverlay::DisallowHitTest, Color(style.color)); | 182 theme = new ScrollbarThemeOverlay(style.thumbThickness, style.scrollbarM
argin, ScrollbarThemeOverlay::DisallowHitTest, Color(style.color)); |
| 183 } | 183 } |
| 184 return *theme; | 184 return *theme; |
| 185 } | 185 } |
| 186 | 186 |
| 187 } // namespace blink | 187 } // namespace blink |
| OLD | NEW |