| 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(m_scrollAnchor); | 202 visitor->trace(m_scrollAnchor); |
| 203 ScrollableArea::trace(visitor); | 203 ScrollableArea::trace(visitor); |
| 204 } | 204 } |
| 205 | 205 |
| 206 HostWindow* PaintLayerScrollableArea::getHostWindow() const { | 206 HostWindow* PaintLayerScrollableArea::getHostWindow() const { |
| 207 if (Page* page = box().frame()->page()) | 207 if (Page* page = box().frame()->page()) |
| 208 return &page->chromeClient(); | 208 return &page->chromeClient(); |
| 209 return nullptr; | 209 return nullptr; |
| 210 } | 210 } |
| 211 | 211 |
| 212 SmoothScrollSequencer* PaintLayerScrollableArea::getSmoothScrollSequencer() |
| 213 const { |
| 214 if (Page* page = box().frame()->page()) |
| 215 return page->smoothScrollSequencer(); |
| 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()->compositedLayerMapping()->scrollingContentsLayer() | 221 ? layer()->compositedLayerMapping()->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 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1663 document.updateStyleAndLayout(); | 1670 document.updateStyleAndLayout(); |
| 1664 | 1671 |
| 1665 // FIXME (Radar 4118564): We should also autoscroll the window as necessary to | 1672 // FIXME (Radar 4118564): We should also autoscroll the window as necessary to |
| 1666 // keep the point under the cursor in view. | 1673 // keep the point under the cursor in view. |
| 1667 } | 1674 } |
| 1668 | 1675 |
| 1669 LayoutRect PaintLayerScrollableArea::scrollIntoView( | 1676 LayoutRect PaintLayerScrollableArea::scrollIntoView( |
| 1670 const LayoutRect& rect, | 1677 const LayoutRect& rect, |
| 1671 const ScrollAlignment& alignX, | 1678 const ScrollAlignment& alignX, |
| 1672 const ScrollAlignment& alignY, | 1679 const ScrollAlignment& alignY, |
| 1673 ScrollType scrollType) { | 1680 ScrollType scrollType, |
| 1681 bool isSmooth) { |
| 1674 LayoutRect localExposeRect( | 1682 LayoutRect localExposeRect( |
| 1675 box() | 1683 box() |
| 1676 .absoluteToLocalQuad(FloatQuad(FloatRect(rect)), UseTransforms) | 1684 .absoluteToLocalQuad(FloatQuad(FloatRect(rect)), UseTransforms) |
| 1677 .boundingBox()); | 1685 .boundingBox()); |
| 1678 localExposeRect.move(-box().borderLeft(), -box().borderTop()); | 1686 localExposeRect.move(-box().borderLeft(), -box().borderTop()); |
| 1679 LayoutRect layerBounds(LayoutPoint(), | 1687 LayoutRect layerBounds(LayoutPoint(), |
| 1680 LayoutSize(box().clientWidth(), box().clientHeight())); | 1688 LayoutSize(box().clientWidth(), box().clientHeight())); |
| 1681 LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect, | 1689 LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect, |
| 1682 alignX, alignY); | 1690 alignX, alignY); |
| 1683 | 1691 |
| 1684 ScrollOffset oldScrollOffset = getScrollOffset(); | 1692 ScrollOffset oldScrollOffset = getScrollOffset(); |
| 1685 ScrollOffset newScrollOffset(clampScrollOffset(roundedIntSize( | 1693 ScrollOffset newScrollOffset(clampScrollOffset(roundedIntSize( |
| 1686 toScrollOffset(FloatPoint(r.location()) + oldScrollOffset)))); | 1694 toScrollOffset(FloatPoint(r.location()) + oldScrollOffset)))); |
| 1687 setScrollOffset(newScrollOffset, scrollType, ScrollBehaviorInstant); | 1695 if (isSmooth) { |
| 1696 DCHECK(scrollType != UserScroll); |
| 1697 getSmoothScrollSequencer()->queueAnimation(this, newScrollOffset); |
| 1698 } else { |
| 1699 setScrollOffset(newScrollOffset, scrollType, ScrollBehaviorInstant); |
| 1700 } |
| 1688 ScrollOffset scrollOffsetDifference = getScrollOffset() - oldScrollOffset; | 1701 ScrollOffset scrollOffsetDifference = getScrollOffset() - oldScrollOffset; |
| 1689 localExposeRect.move(-LayoutSize(scrollOffsetDifference)); | 1702 localExposeRect.move(-LayoutSize(scrollOffsetDifference)); |
| 1690 | 1703 |
| 1691 LayoutRect intersect = | 1704 LayoutRect intersect = |
| 1692 localToAbsolute(box(), intersection(layerBounds, localExposeRect)); | 1705 localToAbsolute(box(), intersection(layerBounds, localExposeRect)); |
| 1693 if (intersect.isEmpty() && !layerBounds.isEmpty() && | 1706 if (intersect.isEmpty() && !layerBounds.isEmpty() && |
| 1694 !localExposeRect.isEmpty()) { | 1707 !localExposeRect.isEmpty()) { |
| 1695 return localToAbsolute(box(), localExposeRect); | 1708 return localToAbsolute(box(), localExposeRect); |
| 1696 } | 1709 } |
| 1697 return intersect; | 1710 return intersect; |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2150 | 2163 |
| 2151 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2164 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
| 2152 clampScrollableAreas() { | 2165 clampScrollableAreas() { |
| 2153 for (auto& scrollableArea : *s_needsClamp) | 2166 for (auto& scrollableArea : *s_needsClamp) |
| 2154 scrollableArea->clampScrollOffsetAfterOverflowChange(); | 2167 scrollableArea->clampScrollOffsetAfterOverflowChange(); |
| 2155 delete s_needsClamp; | 2168 delete s_needsClamp; |
| 2156 s_needsClamp = nullptr; | 2169 s_needsClamp = nullptr; |
| 2157 } | 2170 } |
| 2158 | 2171 |
| 2159 } // namespace blink | 2172 } // namespace blink |
| OLD | NEW |