OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 kScrollAlignmentClosestEdge}; | 52 kScrollAlignmentClosestEdge}; |
53 const ScrollAlignment ScrollAlignment::kAlignToEdgeIfNeeded = { | 53 const ScrollAlignment ScrollAlignment::kAlignToEdgeIfNeeded = { |
54 kScrollAlignmentNoScroll, kScrollAlignmentClosestEdge, | 54 kScrollAlignmentNoScroll, kScrollAlignmentClosestEdge, |
55 kScrollAlignmentClosestEdge}; | 55 kScrollAlignmentClosestEdge}; |
56 const ScrollAlignment ScrollAlignment::kAlignCenterAlways = { | 56 const ScrollAlignment ScrollAlignment::kAlignCenterAlways = { |
57 kScrollAlignmentCenter, kScrollAlignmentCenter, kScrollAlignmentCenter}; | 57 kScrollAlignmentCenter, kScrollAlignmentCenter, kScrollAlignmentCenter}; |
58 const ScrollAlignment ScrollAlignment::kAlignTopAlways = { | 58 const ScrollAlignment ScrollAlignment::kAlignTopAlways = { |
59 kScrollAlignmentTop, kScrollAlignmentTop, kScrollAlignmentTop}; | 59 kScrollAlignmentTop, kScrollAlignmentTop, kScrollAlignmentTop}; |
60 const ScrollAlignment ScrollAlignment::kAlignBottomAlways = { | 60 const ScrollAlignment ScrollAlignment::kAlignBottomAlways = { |
61 kScrollAlignmentBottom, kScrollAlignmentBottom, kScrollAlignmentBottom}; | 61 kScrollAlignmentBottom, kScrollAlignmentBottom, kScrollAlignmentBottom}; |
62 const ScrollAlignment ScrollAlignment::kAlignLeftAlways = { | |
63 kScrollAlignmentLeft, kScrollAlignmentLeft, kScrollAlignmentLeft}; | |
64 const ScrollAlignment ScrollAlignment::kAlignRightAlways = { | |
65 kScrollAlignmentRight, kScrollAlignmentRight, kScrollAlignmentRight}; | |
66 | 62 |
67 #define MIN_INTERSECT_FOR_REVEAL 32 | 63 #define MIN_INTERSECT_FOR_REVEAL 32 |
68 | 64 |
69 LayoutRect ScrollAlignment::GetRectToExpose(const LayoutRect& visible_rect, | 65 LayoutRect ScrollAlignment::GetRectToExpose(const LayoutRect& visible_rect, |
70 const LayoutRect& expose_rect, | 66 const LayoutRect& expose_rect, |
71 const ScrollAlignment& align_x, | 67 const ScrollAlignment& align_x, |
72 const ScrollAlignment& align_y) { | 68 const ScrollAlignment& align_y) { |
73 // Prevent degenerate cases by giving the visible rect a minimum non-0 size. | 69 // Prevent degenerate cases by giving the visible rect a minimum non-0 size. |
74 LayoutRect non_zero_visible_rect(visible_rect); | 70 LayoutRect non_zero_visible_rect(visible_rect); |
75 LayoutUnit minimum_layout_unit; | 71 LayoutUnit minimum_layout_unit; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 else if (scroll_y == kScrollAlignmentCenter) | 168 else if (scroll_y == kScrollAlignmentCenter) |
173 y = expose_rect.Y() + | 169 y = expose_rect.Y() + |
174 (expose_rect.Height() - non_zero_visible_rect.Height()) / 2; | 170 (expose_rect.Height() - non_zero_visible_rect.Height()) / 2; |
175 else | 171 else |
176 y = expose_rect.Y(); | 172 y = expose_rect.Y(); |
177 | 173 |
178 return LayoutRect(LayoutPoint(x, y), non_zero_visible_rect.Size()); | 174 return LayoutRect(LayoutPoint(x, y), non_zero_visible_rect.Size()); |
179 } | 175 } |
180 | 176 |
181 } // namespace blink | 177 } // namespace blink |
OLD | NEW |