| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 ScrollAlignmentNoScroll, ScrollAlignmentCenter, ScrollAlignmentClosestEdge}; | 51 ScrollAlignmentNoScroll, ScrollAlignmentCenter, ScrollAlignmentClosestEdge}; |
| 52 const ScrollAlignment ScrollAlignment::alignToEdgeIfNeeded = { | 52 const ScrollAlignment ScrollAlignment::alignToEdgeIfNeeded = { |
| 53 ScrollAlignmentNoScroll, ScrollAlignmentClosestEdge, | 53 ScrollAlignmentNoScroll, ScrollAlignmentClosestEdge, |
| 54 ScrollAlignmentClosestEdge}; | 54 ScrollAlignmentClosestEdge}; |
| 55 const ScrollAlignment ScrollAlignment::alignCenterAlways = { | 55 const ScrollAlignment ScrollAlignment::alignCenterAlways = { |
| 56 ScrollAlignmentCenter, ScrollAlignmentCenter, ScrollAlignmentCenter}; | 56 ScrollAlignmentCenter, ScrollAlignmentCenter, ScrollAlignmentCenter}; |
| 57 const ScrollAlignment ScrollAlignment::alignTopAlways = { | 57 const ScrollAlignment ScrollAlignment::alignTopAlways = { |
| 58 ScrollAlignmentTop, ScrollAlignmentTop, ScrollAlignmentTop}; | 58 ScrollAlignmentTop, ScrollAlignmentTop, ScrollAlignmentTop}; |
| 59 const ScrollAlignment ScrollAlignment::alignBottomAlways = { | 59 const ScrollAlignment ScrollAlignment::alignBottomAlways = { |
| 60 ScrollAlignmentBottom, ScrollAlignmentBottom, ScrollAlignmentBottom}; | 60 ScrollAlignmentBottom, ScrollAlignmentBottom, ScrollAlignmentBottom}; |
| 61 const ScrollAlignment ScrollAlignment::alignLeftAlways = { |
| 62 ScrollAlignmentLeft, ScrollAlignmentLeft, ScrollAlignmentLeft}; |
| 63 const ScrollAlignment ScrollAlignment::alignRightAlways = { |
| 64 ScrollAlignmentRight, ScrollAlignmentRight, ScrollAlignmentRight}; |
| 61 | 65 |
| 62 #define MIN_INTERSECT_FOR_REVEAL 32 | 66 #define MIN_INTERSECT_FOR_REVEAL 32 |
| 63 | 67 |
| 64 LayoutRect ScrollAlignment::getRectToExpose(const LayoutRect& visibleRect, | 68 LayoutRect ScrollAlignment::getRectToExpose(const LayoutRect& visibleRect, |
| 65 const LayoutRect& exposeRect, | 69 const LayoutRect& exposeRect, |
| 66 const ScrollAlignment& alignX, | 70 const ScrollAlignment& alignX, |
| 67 const ScrollAlignment& alignY) { | 71 const ScrollAlignment& alignY) { |
| 68 // Prevent degenerate cases by giving the visible rect a minimum non-0 size. | 72 // Prevent degenerate cases by giving the visible rect a minimum non-0 size. |
| 69 LayoutRect nonZeroVisibleRect(visibleRect); | 73 LayoutRect nonZeroVisibleRect(visibleRect); |
| 70 LayoutUnit minimumLayoutUnit; | 74 LayoutUnit minimumLayoutUnit; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 else if (scrollY == ScrollAlignmentCenter) | 170 else if (scrollY == ScrollAlignmentCenter) |
| 167 y = exposeRect.y() + | 171 y = exposeRect.y() + |
| 168 (exposeRect.height() - nonZeroVisibleRect.height()) / 2; | 172 (exposeRect.height() - nonZeroVisibleRect.height()) / 2; |
| 169 else | 173 else |
| 170 y = exposeRect.y(); | 174 y = exposeRect.y(); |
| 171 | 175 |
| 172 return LayoutRect(LayoutPoint(x, y), nonZeroVisibleRect.size()); | 176 return LayoutRect(LayoutPoint(x, y), nonZeroVisibleRect.size()); |
| 173 } | 177 } |
| 174 | 178 |
| 175 } // namespace blink | 179 } // namespace blink |
| OLD | NEW |