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 | |
219 GraphicsLayer* PaintLayerScrollableArea::LayerForScrolling() const { | 212 GraphicsLayer* PaintLayerScrollableArea::LayerForScrolling() const { |
220 return Layer()->HasCompositedLayerMapping() | 213 return Layer()->HasCompositedLayerMapping() |
221 ? Layer()->GetCompositedLayerMapping()->ScrollingContentsLayer() | 214 ? Layer()->GetCompositedLayerMapping()->ScrollingContentsLayer() |
222 : 0; | 215 : 0; |
223 } | 216 } |
224 | 217 |
225 GraphicsLayer* PaintLayerScrollableArea::LayerForHorizontalScrollbar() const { | 218 GraphicsLayer* PaintLayerScrollableArea::LayerForHorizontalScrollbar() const { |
226 // See crbug.com/343132. | 219 // See crbug.com/343132. |
227 DisableCompositingQueryAsserts disabler; | 220 DisableCompositingQueryAsserts disabler; |
228 | 221 |
(...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 document.UpdateStyleAndLayout(); | 1724 document.UpdateStyleAndLayout(); |
1732 | 1725 |
1733 // FIXME (Radar 4118564): We should also autoscroll the window as necessary to | 1726 // FIXME (Radar 4118564): We should also autoscroll the window as necessary to |
1734 // keep the point under the cursor in view. | 1727 // keep the point under the cursor in view. |
1735 } | 1728 } |
1736 | 1729 |
1737 LayoutRect PaintLayerScrollableArea::ScrollIntoView( | 1730 LayoutRect PaintLayerScrollableArea::ScrollIntoView( |
1738 const LayoutRect& rect, | 1731 const LayoutRect& rect, |
1739 const ScrollAlignment& align_x, | 1732 const ScrollAlignment& align_x, |
1740 const ScrollAlignment& align_y, | 1733 const ScrollAlignment& align_y, |
1741 bool is_smooth, | |
1742 ScrollType scroll_type) { | 1734 ScrollType scroll_type) { |
1743 LayoutRect local_expose_rect( | 1735 LayoutRect local_expose_rect( |
1744 Box() | 1736 Box() |
1745 .AbsoluteToLocalQuad(FloatQuad(FloatRect(rect)), kUseTransforms) | 1737 .AbsoluteToLocalQuad(FloatQuad(FloatRect(rect)), kUseTransforms) |
1746 .BoundingBox()); | 1738 .BoundingBox()); |
1747 local_expose_rect.Move(-Box().BorderLeft(), -Box().BorderTop()); | 1739 local_expose_rect.Move(-Box().BorderLeft(), -Box().BorderTop()); |
1748 LayoutRect visible_rect(LayoutPoint(), ClientSize()); | 1740 LayoutRect visible_rect(LayoutPoint(), ClientSize()); |
1749 LayoutRect r = ScrollAlignment::GetRectToExpose( | 1741 LayoutRect r = ScrollAlignment::GetRectToExpose( |
1750 visible_rect, local_expose_rect, align_x, align_y); | 1742 visible_rect, local_expose_rect, align_x, align_y); |
1751 | 1743 |
1752 ScrollOffset old_scroll_offset = GetScrollOffset(); | 1744 ScrollOffset old_scroll_offset = GetScrollOffset(); |
1753 ScrollOffset new_scroll_offset(ClampScrollOffset(RoundedIntSize( | 1745 ScrollOffset new_scroll_offset(ClampScrollOffset(RoundedIntSize( |
1754 ToScrollOffset(FloatPoint(r.Location()) + old_scroll_offset)))); | 1746 ToScrollOffset(FloatPoint(r.Location()) + old_scroll_offset)))); |
1755 if (is_smooth) { | 1747 SetScrollOffset(new_scroll_offset, scroll_type, kScrollBehaviorInstant); |
1756 DCHECK(scroll_type == kProgrammaticScroll); | 1748 ScrollOffset scroll_offset_difference = GetScrollOffset() - old_scroll_offset; |
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; | |
1763 local_expose_rect.Move(-LayoutSize(scroll_offset_difference)); | 1749 local_expose_rect.Move(-LayoutSize(scroll_offset_difference)); |
1764 | 1750 |
1765 LayoutRect intersect = | 1751 LayoutRect intersect = |
1766 LocalToAbsolute(Box(), Intersection(visible_rect, local_expose_rect)); | 1752 LocalToAbsolute(Box(), Intersection(visible_rect, local_expose_rect)); |
1767 if (intersect.IsEmpty() && !visible_rect.IsEmpty() && | 1753 if (intersect.IsEmpty() && !visible_rect.IsEmpty() && |
1768 !local_expose_rect.IsEmpty()) { | 1754 !local_expose_rect.IsEmpty()) { |
1769 return LocalToAbsolute(Box(), local_expose_rect); | 1755 return LocalToAbsolute(Box(), local_expose_rect); |
1770 } | 1756 } |
1771 return intersect; | 1757 return intersect; |
1772 } | 1758 } |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2199 | 2185 |
2200 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2186 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
2201 ClampScrollableAreas() { | 2187 ClampScrollableAreas() { |
2202 for (auto& scrollable_area : *needs_clamp_) | 2188 for (auto& scrollable_area : *needs_clamp_) |
2203 scrollable_area->ClampScrollOffsetAfterOverflowChange(); | 2189 scrollable_area->ClampScrollOffsetAfterOverflowChange(); |
2204 delete needs_clamp_; | 2190 delete needs_clamp_; |
2205 needs_clamp_ = nullptr; | 2191 needs_clamp_ = nullptr; |
2206 } | 2192 } |
2207 | 2193 |
2208 } // namespace blink | 2194 } // namespace blink |
OLD | NEW |