OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * | 4 * |
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
6 * | 6 * |
7 * Other contributors: | 7 * Other contributors: |
8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
10 * Christian Biesinger <cbiesinger@gmail.com> | 10 * Christian Biesinger <cbiesinger@gmail.com> |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 visitor->Trace(scroll_anchor_); | 202 visitor->Trace(scroll_anchor_); |
203 ScrollableArea::Trace(visitor); | 203 ScrollableArea::Trace(visitor); |
204 } | 204 } |
205 | 205 |
206 PlatformChromeClient* PaintLayerScrollableArea::GetChromeClient() const { | 206 PlatformChromeClient* PaintLayerScrollableArea::GetChromeClient() const { |
207 if (Page* page = Box().GetFrame()->GetPage()) | 207 if (Page* page = Box().GetFrame()->GetPage()) |
208 return &page->GetChromeClient(); | 208 return &page->GetChromeClient(); |
209 return nullptr; | 209 return nullptr; |
210 } | 210 } |
211 | 211 |
| 212 SmoothScrollSequencer* PaintLayerScrollableArea::GetSmoothScrollSequencer() |
| 213 const { |
| 214 if (Page* page = Box().GetFrame()->GetPage()) |
| 215 return page->GetSmoothScrollSequencer(); |
| 216 return nullptr; |
| 217 } |
| 218 |
212 GraphicsLayer* PaintLayerScrollableArea::LayerForScrolling() const { | 219 GraphicsLayer* PaintLayerScrollableArea::LayerForScrolling() const { |
213 return Layer()->HasCompositedLayerMapping() | 220 return Layer()->HasCompositedLayerMapping() |
214 ? Layer()->GetCompositedLayerMapping()->ScrollingContentsLayer() | 221 ? Layer()->GetCompositedLayerMapping()->ScrollingContentsLayer() |
215 : 0; | 222 : 0; |
216 } | 223 } |
217 | 224 |
218 GraphicsLayer* PaintLayerScrollableArea::LayerForHorizontalScrollbar() const { | 225 GraphicsLayer* PaintLayerScrollableArea::LayerForHorizontalScrollbar() const { |
219 // See crbug.com/343132. | 226 // See crbug.com/343132. |
220 DisableCompositingQueryAsserts disabler; | 227 DisableCompositingQueryAsserts disabler; |
221 | 228 |
(...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1724 document.UpdateStyleAndLayout(); | 1731 document.UpdateStyleAndLayout(); |
1725 | 1732 |
1726 // FIXME (Radar 4118564): We should also autoscroll the window as necessary to | 1733 // FIXME (Radar 4118564): We should also autoscroll the window as necessary to |
1727 // keep the point under the cursor in view. | 1734 // keep the point under the cursor in view. |
1728 } | 1735 } |
1729 | 1736 |
1730 LayoutRect PaintLayerScrollableArea::ScrollIntoView( | 1737 LayoutRect PaintLayerScrollableArea::ScrollIntoView( |
1731 const LayoutRect& rect, | 1738 const LayoutRect& rect, |
1732 const ScrollAlignment& align_x, | 1739 const ScrollAlignment& align_x, |
1733 const ScrollAlignment& align_y, | 1740 const ScrollAlignment& align_y, |
| 1741 bool is_smooth, |
1734 ScrollType scroll_type) { | 1742 ScrollType scroll_type) { |
1735 LayoutRect local_expose_rect( | 1743 LayoutRect local_expose_rect( |
1736 Box() | 1744 Box() |
1737 .AbsoluteToLocalQuad(FloatQuad(FloatRect(rect)), kUseTransforms) | 1745 .AbsoluteToLocalQuad(FloatQuad(FloatRect(rect)), kUseTransforms) |
1738 .BoundingBox()); | 1746 .BoundingBox()); |
1739 local_expose_rect.Move(-Box().BorderLeft(), -Box().BorderTop()); | 1747 local_expose_rect.Move(-Box().BorderLeft(), -Box().BorderTop()); |
1740 LayoutRect visible_rect(LayoutPoint(), ClientSize()); | 1748 LayoutRect visible_rect(LayoutPoint(), ClientSize()); |
1741 LayoutRect r = ScrollAlignment::GetRectToExpose( | 1749 LayoutRect r = ScrollAlignment::GetRectToExpose( |
1742 visible_rect, local_expose_rect, align_x, align_y); | 1750 visible_rect, local_expose_rect, align_x, align_y); |
1743 | 1751 |
1744 ScrollOffset old_scroll_offset = GetScrollOffset(); | 1752 ScrollOffset old_scroll_offset = GetScrollOffset(); |
1745 ScrollOffset new_scroll_offset(ClampScrollOffset(RoundedIntSize( | 1753 ScrollOffset new_scroll_offset(ClampScrollOffset(RoundedIntSize( |
1746 ToScrollOffset(FloatPoint(r.Location()) + old_scroll_offset)))); | 1754 ToScrollOffset(FloatPoint(r.Location()) + old_scroll_offset)))); |
1747 SetScrollOffset(new_scroll_offset, scroll_type, kScrollBehaviorInstant); | 1755 if (is_smooth) { |
1748 ScrollOffset scroll_offset_difference = GetScrollOffset() - old_scroll_offset; | 1756 DCHECK(scroll_type == kProgrammaticScroll); |
| 1757 GetSmoothScrollSequencer()->QueueAnimation(this, new_scroll_offset); |
| 1758 } else { |
| 1759 SetScrollOffset(new_scroll_offset, scroll_type, kScrollBehaviorInstant); |
| 1760 } |
| 1761 ScrollOffset scroll_offset_difference = |
| 1762 ClampScrollOffset(new_scroll_offset) - old_scroll_offset; |
1749 local_expose_rect.Move(-LayoutSize(scroll_offset_difference)); | 1763 local_expose_rect.Move(-LayoutSize(scroll_offset_difference)); |
1750 | 1764 |
1751 LayoutRect intersect = | 1765 LayoutRect intersect = |
1752 LocalToAbsolute(Box(), Intersection(visible_rect, local_expose_rect)); | 1766 LocalToAbsolute(Box(), Intersection(visible_rect, local_expose_rect)); |
1753 if (intersect.IsEmpty() && !visible_rect.IsEmpty() && | 1767 if (intersect.IsEmpty() && !visible_rect.IsEmpty() && |
1754 !local_expose_rect.IsEmpty()) { | 1768 !local_expose_rect.IsEmpty()) { |
1755 return LocalToAbsolute(Box(), local_expose_rect); | 1769 return LocalToAbsolute(Box(), local_expose_rect); |
1756 } | 1770 } |
1757 return intersect; | 1771 return intersect; |
1758 } | 1772 } |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2185 | 2199 |
2186 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2200 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
2187 ClampScrollableAreas() { | 2201 ClampScrollableAreas() { |
2188 for (auto& scrollable_area : *needs_clamp_) | 2202 for (auto& scrollable_area : *needs_clamp_) |
2189 scrollable_area->ClampScrollOffsetAfterOverflowChange(); | 2203 scrollable_area->ClampScrollOffsetAfterOverflowChange(); |
2190 delete needs_clamp_; | 2204 delete needs_clamp_; |
2191 needs_clamp_ = nullptr; | 2205 needs_clamp_ = nullptr; |
2192 } | 2206 } |
2193 | 2207 |
2194 } // namespace blink | 2208 } // namespace blink |
OLD | NEW |