Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Side by Side Diff: third_party/WebKit/Source/core/layout/ScrollAlignment.cpp

Issue 2650343008: Implement Element.scrollIntoView for scroll-behavior: smooth. (Closed)
Patch Set: Change the default setting. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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};
62 66
63 #define MIN_INTERSECT_FOR_REVEAL 32 67 #define MIN_INTERSECT_FOR_REVEAL 32
64 68
65 LayoutRect ScrollAlignment::GetRectToExpose(const LayoutRect& visible_rect, 69 LayoutRect ScrollAlignment::GetRectToExpose(const LayoutRect& visible_rect,
66 const LayoutRect& expose_rect, 70 const LayoutRect& expose_rect,
67 const ScrollAlignment& align_x, 71 const ScrollAlignment& align_x,
68 const ScrollAlignment& align_y) { 72 const ScrollAlignment& align_y) {
69 // Prevent degenerate cases by giving the visible rect a minimum non-0 size. 73 // Prevent degenerate cases by giving the visible rect a minimum non-0 size.
70 LayoutRect non_zero_visible_rect(visible_rect); 74 LayoutRect non_zero_visible_rect(visible_rect);
71 LayoutUnit minimum_layout_unit; 75 LayoutUnit minimum_layout_unit;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 else if (scroll_y == kScrollAlignmentCenter) 172 else if (scroll_y == kScrollAlignmentCenter)
169 y = expose_rect.Y() + 173 y = expose_rect.Y() +
170 (expose_rect.Height() - non_zero_visible_rect.Height()) / 2; 174 (expose_rect.Height() - non_zero_visible_rect.Height()) / 2;
171 else 175 else
172 y = expose_rect.Y(); 176 y = expose_rect.Y();
173 177
174 return LayoutRect(LayoutPoint(x, y), non_zero_visible_rect.Size()); 178 return LayoutRect(LayoutPoint(x, y), non_zero_visible_rect.Size());
175 } 179 }
176 180
177 } // namespace blink 181 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/ScrollAlignment.h ('k') | third_party/WebKit/Source/core/page/Page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698