| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "sky/engine/core/rendering/ScrollAlignment.h" | 45 #include "sky/engine/core/rendering/ScrollAlignment.h" |
| 46 | 46 |
| 47 #include "sky/engine/platform/geometry/LayoutRect.h" | 47 #include "sky/engine/platform/geometry/LayoutRect.h" |
| 48 | 48 |
| 49 namespace blink { | 49 namespace blink { |
| 50 | 50 |
| 51 const ScrollAlignment ScrollAlignment::alignCenterIfNeeded = { ScrollAlignmentNo
Scroll, ScrollAlignmentCenter, ScrollAlignmentClosestEdge }; | 51 const ScrollAlignment ScrollAlignment::alignCenterIfNeeded = { ScrollAlignmentNo
Scroll, ScrollAlignmentCenter, ScrollAlignmentClosestEdge }; |
| 52 const ScrollAlignment ScrollAlignment::alignToEdgeIfNeeded = { ScrollAlignmentNo
Scroll, ScrollAlignmentClosestEdge, ScrollAlignmentClosestEdge }; | 52 const ScrollAlignment ScrollAlignment::alignToEdgeIfNeeded = { ScrollAlignmentNo
Scroll, ScrollAlignmentClosestEdge, ScrollAlignmentClosestEdge }; |
| 53 const ScrollAlignment ScrollAlignment::alignCenterAlways = { ScrollAlignmentCent
er, ScrollAlignmentCenter, ScrollAlignmentCenter }; | 53 const ScrollAlignment ScrollAlignment::alignCenterAlways = { ScrollAlignmentCent
er, ScrollAlignmentCenter, ScrollAlignmentCenter }; |
| 54 const ScrollAlignment ScrollAlignment::alignTopAlways = { ScrollAlignmentTop, Sc
rollAlignmentTop, ScrollAlignmentTop }; | 54 const ScrollAlignment ScrollAlignment::alignTopAlways = { ScrollAlignmentTop, Sc
rollAlignmentTop, ScrollAlignmentTop }; |
| 55 const ScrollAlignment ScrollAlignment::alignBottomAlways = { ScrollAlignmentBott
om, ScrollAlignmentBottom, ScrollAlignmentBottom }; | |
| 56 | 55 |
| 57 #define MIN_INTERSECT_FOR_REVEAL 32 | 56 #define MIN_INTERSECT_FOR_REVEAL 32 |
| 58 | 57 |
| 59 LayoutRect ScrollAlignment::getRectToExpose(const LayoutRect& visibleRect, const
LayoutRect& exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& a
lignY) | 58 LayoutRect ScrollAlignment::getRectToExpose(const LayoutRect& visibleRect, const
LayoutRect& exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& a
lignY) |
| 60 { | 59 { |
| 61 // Determine the appropriate X behavior. | 60 // Determine the appropriate X behavior. |
| 62 ScrollAlignmentBehavior scrollX; | 61 ScrollAlignmentBehavior scrollX; |
| 63 LayoutRect exposeRectX(exposeRect.x(), visibleRect.y(), exposeRect.width(),
visibleRect.height()); | 62 LayoutRect exposeRectX(exposeRect.x(), visibleRect.y(), exposeRect.width(),
visibleRect.height()); |
| 64 LayoutUnit intersectWidth = intersection(visibleRect, exposeRectX).width(); | 63 LayoutUnit intersectWidth = intersection(visibleRect, exposeRectX).width(); |
| 65 if (intersectWidth == exposeRect.width() || intersectWidth >= MIN_INTERSECT_
FOR_REVEAL) { | 64 if (intersectWidth == exposeRect.width() || intersectWidth >= MIN_INTERSECT_
FOR_REVEAL) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 y = exposeRect.maxY() - visibleRect.height(); | 136 y = exposeRect.maxY() - visibleRect.height(); |
| 138 else if (scrollY == ScrollAlignmentCenter) | 137 else if (scrollY == ScrollAlignmentCenter) |
| 139 y = exposeRect.y() + (exposeRect.height() - visibleRect.height()) / 2; | 138 y = exposeRect.y() + (exposeRect.height() - visibleRect.height()) / 2; |
| 140 else | 139 else |
| 141 y = exposeRect.y(); | 140 y = exposeRect.y(); |
| 142 | 141 |
| 143 return LayoutRect(LayoutPoint(x, y), visibleRect.size()); | 142 return LayoutRect(LayoutPoint(x, y), visibleRect.size()); |
| 144 } | 143 } |
| 145 | 144 |
| 146 }; // namespace blink | 145 }; // namespace blink |
| OLD | NEW |