2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include "wtf/Assertions.h"
33 enum ScrollDirection {
39 ScrollBlockDirectionBackward,
40 ScrollBlockDirectionForward,
41 ScrollInlineDirectionBackward,
42 ScrollInlineDirectionForward
45 inline bool isLogical(ScrollDirection direction)
47 return direction >= ScrollBlockDirectionBackward;
50 // Convert logical scroll direction to physical. Physical scroll directions are unaffected.
51 inline ScrollDirection toPhysicalDirection(ScrollDirection direction, bool isVertical, bool isFlipped)
54 case ScrollBlockDirectionBackward: {
64 case ScrollBlockDirectionForward: {
74 case ScrollInlineDirectionBackward: {
84 case ScrollInlineDirectionForward: {
94 // Direction is already physical
101 ASSERT_NOT_REACHED();
107 enum ScrollGranularity {
115 enum ScrollElasticity {
116 ScrollElasticityAutomatic,
117 ScrollElasticityNone,
118 ScrollElasticityAllowed
121 enum ScrollbarOrientation { HorizontalScrollbar, VerticalScrollbar };
123 enum ScrollbarMode { ScrollbarAuto, ScrollbarAlwaysOff, ScrollbarAlwaysOn };
125 enum ScrollbarControlSize { RegularScrollbar, SmallScrollbar };
127 typedef unsigned ScrollbarControlState;
129 enum ScrollbarControlStateMask {
130 ActiveScrollbarState = 1,
131 EnabledScrollbarState = 1 << 1,
132 PressedScrollbarState = 1 << 2
137 BackButtonStartPart = 1,
138 ForwardButtonStartPart = 1 << 1,
139 BackTrackPart = 1 << 2,
141 ForwardTrackPart = 1 << 4,
142 BackButtonEndPart = 1 << 5,
143 ForwardButtonEndPart = 1 << 6,
144 ScrollbarBGPart = 1 << 7,
145 TrackBGPart = 1 << 8,
146 AllParts = 0xffffffff
149 enum ScrollbarButtonsPlacement {
150 ScrollbarButtonsNone,
151 ScrollbarButtonsSingle,
152 ScrollbarButtonsDoubleStart,
153 ScrollbarButtonsDoubleEnd,
154 ScrollbarButtonsDoubleBoth
157 enum ScrollbarOverlayStyle {
158 ScrollbarOverlayStyleDefault,
159 ScrollbarOverlayStyleDark,
160 ScrollbarOverlayStyleLight
163 typedef unsigned ScrollbarControlPartMask;