2 * Copyright (C) 2003, 2009 Apple Inc. All rights reserved.
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com>
11 * Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
12 * Josh Soref <timeless@mac.com>
13 * Boris Zbarsky <bzbarsky@mit.edu>
15 * This library is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 2.1 of the License, or (at your option) any later version.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 * Alternatively, the contents of this file may be used under the terms
30 * of either the Mozilla Public License Version 1.1, found at
31 * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
32 * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
33 * (the "GPL"), in which case the provisions of the MPL or the GPL are
34 * applicable instead of those above. If you wish to allow use of your
35 * version of this file only under the terms of one of those two
36 * licenses (the MPL or the GPL) and not to allow others to use your
37 * version of this file under the LGPL, indicate your decision by
38 * deletingthe provisions above and replace them with the notice and
39 * other provisions required by the MPL or the GPL, as the case may be.
40 * If you do not delete the provisions above, a recipient may use your
41 * version of this file under any of the LGPL, the MPL or the GPL.
44 #ifndef ScrollAlignment_h
45 #define ScrollAlignment_h
47 #include "core/CoreExport.h"
48 #include "wtf/Allocator.h"
52 enum ScrollAlignmentBehavior
{
53 ScrollAlignmentNoScroll
,
54 ScrollAlignmentCenter
,
56 ScrollAlignmentBottom
,
59 ScrollAlignmentClosestEdge
64 struct CORE_EXPORT ScrollAlignment
{
66 static ScrollAlignmentBehavior
getVisibleBehavior(const ScrollAlignment
& s
) { return s
.m_rectVisible
; }
67 static ScrollAlignmentBehavior
getPartialBehavior(const ScrollAlignment
& s
) { return s
.m_rectPartial
; }
68 static ScrollAlignmentBehavior
getHiddenBehavior(const ScrollAlignment
& s
) { return s
.m_rectHidden
; }
70 // FIXME: This function should probably go somewhere else but where?
71 static LayoutRect
getRectToExpose(const LayoutRect
& visibleRect
, const LayoutRect
& exposeRect
, const ScrollAlignment
& alignX
, const ScrollAlignment
& alignY
);
73 static const ScrollAlignment alignCenterIfNeeded
;
74 static const ScrollAlignment alignToEdgeIfNeeded
;
75 static const ScrollAlignment alignCenterAlways
;
76 static const ScrollAlignment alignTopAlways
;
77 static const ScrollAlignment alignBottomAlways
;
79 ScrollAlignmentBehavior m_rectVisible
;
80 ScrollAlignmentBehavior m_rectHidden
;
81 ScrollAlignmentBehavior m_rectPartial
;
87 #endif // ScrollAlignment_h