Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 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 20 matching lines...) Expand all Loading... | |
| 31 #include "platform/graphics/paint/DisplayItem.h" | 31 #include "platform/graphics/paint/DisplayItem.h" |
| 32 #include "platform/scroll/ScrollTypes.h" | 32 #include "platform/scroll/ScrollTypes.h" |
| 33 #include "public/platform/mac/MacScrollTypes.h" | 33 #include "public/platform/mac/MacScrollTypes.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 class CullRect; | 37 class CullRect; |
| 38 class GraphicsContext; | 38 class GraphicsContext; |
| 39 class PlatformMouseEvent; | 39 class PlatformMouseEvent; |
| 40 class ScrollbarThemeClient; | 40 class ScrollbarThemeClient; |
| 41 class ScrollbarThemePaintParams; | |
| 41 | 42 |
| 42 class PLATFORM_EXPORT ScrollbarTheme { | 43 class PLATFORM_EXPORT ScrollbarTheme { |
| 43 WTF_MAKE_NONCOPYABLE(ScrollbarTheme); USING_FAST_MALLOC(ScrollbarTheme); | 44 WTF_MAKE_NONCOPYABLE(ScrollbarTheme); USING_FAST_MALLOC(ScrollbarTheme); |
| 44 public: | 45 public: |
| 45 ScrollbarTheme() { } | 46 ScrollbarTheme() { } |
| 46 virtual ~ScrollbarTheme() { } | 47 virtual ~ScrollbarTheme() { } |
| 47 | 48 |
| 49 // If true, then scrollbars with this theme will be painted every time | |
| 50 // Scrollbar::setNeedsPaintInvalidation is called. If false, then scrollbar | |
| 51 // thumb and track part painting results will be cached and not repainted | |
| 52 // unless requested by Scrollbar::setNeedsPaintThumb or | |
| 53 // Scrollbar::setNeedsPaintTrack. | |
| 54 virtual bool shouldRepaintAllPartsOnInvalidation() const { return true; } | |
| 55 | |
| 48 virtual void updateEnabledState(const ScrollbarThemeClient*) { } | 56 virtual void updateEnabledState(const ScrollbarThemeClient*) { } |
| 49 | 57 |
| 50 virtual bool paint(const ScrollbarThemeClient*, GraphicsContext*, const Cull Rect&); | 58 virtual bool paint(const ScrollbarThemeClient*, GraphicsContext*, const Cull Rect&); |
| 51 | 59 |
| 52 virtual ScrollbarPart hitTest(const ScrollbarThemeClient*, const IntPoint&); | 60 virtual ScrollbarPart hitTest(const ScrollbarThemeClient*, const IntPoint&); |
| 53 | 61 |
| 54 virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar) { re turn 0; } | 62 virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar) { re turn 0; } |
| 55 virtual int scrollbarMargin() const { return 0; } | 63 virtual int scrollbarMargin() const { return 0; } |
| 56 | 64 |
| 57 virtual ScrollbarButtonsPlacement buttonsPlacement() const { return Scrollba rButtonsPlacementSingle; } | 65 virtual ScrollbarButtonsPlacement buttonsPlacement() const { return Scrollba rButtonsPlacementSingle; } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 70 virtual bool shouldDragDocumentInsteadOfThumb(const ScrollbarThemeClient*, c onst PlatformMouseEvent&) { return false; } | 78 virtual bool shouldDragDocumentInsteadOfThumb(const ScrollbarThemeClient*, c onst PlatformMouseEvent&) { return false; } |
| 71 | 79 |
| 72 // The position of the thumb relative to the track. | 80 // The position of the thumb relative to the track. |
| 73 virtual int thumbPosition(const ScrollbarThemeClient*); | 81 virtual int thumbPosition(const ScrollbarThemeClient*); |
| 74 // The length of the thumb along the axis of the scrollbar. | 82 // The length of the thumb along the axis of the scrollbar. |
| 75 virtual int thumbLength(const ScrollbarThemeClient*); | 83 virtual int thumbLength(const ScrollbarThemeClient*); |
| 76 // The position of the track relative to the scrollbar. | 84 // The position of the track relative to the scrollbar. |
| 77 virtual int trackPosition(const ScrollbarThemeClient*); | 85 virtual int trackPosition(const ScrollbarThemeClient*); |
| 78 // The length of the track along the axis of the scrollbar. | 86 // The length of the track along the axis of the scrollbar. |
| 79 virtual int trackLength(const ScrollbarThemeClient*); | 87 virtual int trackLength(const ScrollbarThemeClient*); |
| 88 // The opacity of the thumb (only non-opaque for Mac overlay scrollbars). | |
|
chrishtr
2015/11/23 18:59:42
Don't specify Mac-specific semantics.
ccameron
2015/11/24 01:12:05
Removed (I'd prefer to say specify the use, at lea
| |
| 89 virtual float thumbOpacity(const ScrollbarThemeClient*) const { return 1.0f; } | |
|
chrishtr
2015/11/23 18:59:42
How is the client supposed to know whether the opa
ccameron
2015/11/24 01:12:05
Opacity is always taken into account when re-drawi
chrishtr
2015/11/24 19:02:07
What I mean is: what is the correct way to interpr
| |
| 90 // The opacity of the track (only non-opaque for Mac overlay scrollbars). | |
| 91 virtual float trackOpacity(const ScrollbarThemeClient*) const { return 1.0f; } | |
| 80 | 92 |
| 81 virtual bool hasButtons(const ScrollbarThemeClient*) = 0; | 93 virtual bool hasButtons(const ScrollbarThemeClient*) = 0; |
| 82 virtual bool hasThumb(const ScrollbarThemeClient*) = 0; | 94 virtual bool hasThumb(const ScrollbarThemeClient*) = 0; |
| 83 | 95 |
| 84 virtual IntRect backButtonRect(const ScrollbarThemeClient*, ScrollbarPart, b ool painting = false) = 0; | 96 virtual IntRect backButtonRect(const ScrollbarThemeClient*, ScrollbarPart, b ool painting = false) = 0; |
| 85 virtual IntRect forwardButtonRect(const ScrollbarThemeClient*, ScrollbarPart , bool painting = false) = 0; | 97 virtual IntRect forwardButtonRect(const ScrollbarThemeClient*, ScrollbarPart , bool painting = false) = 0; |
| 86 virtual IntRect trackRect(const ScrollbarThemeClient*, bool painting = false ) = 0; | 98 virtual IntRect trackRect(const ScrollbarThemeClient*, bool painting = false ) = 0; |
| 87 virtual IntRect thumbRect(const ScrollbarThemeClient*); | 99 virtual IntRect thumbRect(const ScrollbarThemeClient*); |
| 88 virtual int thumbThickness(const ScrollbarThemeClient*); | 100 virtual int thumbThickness(const ScrollbarThemeClient*); |
| 89 | 101 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 118 static DisplayItem::Type buttonPartToDisplayItemType(ScrollbarPart); | 130 static DisplayItem::Type buttonPartToDisplayItemType(ScrollbarPart); |
| 119 static DisplayItem::Type trackPiecePartToDisplayItemType(ScrollbarPart); | 131 static DisplayItem::Type trackPiecePartToDisplayItemType(ScrollbarPart); |
| 120 | 132 |
| 121 private: | 133 private: |
| 122 static ScrollbarTheme* nativeTheme(); // Must be implemented to return the c orrect theme subclass. | 134 static ScrollbarTheme* nativeTheme(); // Must be implemented to return the c orrect theme subclass. |
| 123 static bool gMockScrollbarsEnabled; | 135 static bool gMockScrollbarsEnabled; |
| 124 }; | 136 }; |
| 125 | 137 |
| 126 } | 138 } |
| 127 #endif | 139 #endif |
| OLD | NEW |