| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 #include "platform/PlatformMouseEvent.h" | 78 #include "platform/PlatformMouseEvent.h" |
| 79 #include "platform/graphics/CompositorMutableProperties.h" | 79 #include "platform/graphics/CompositorMutableProperties.h" |
| 80 #include "platform/graphics/GraphicsLayer.h" | 80 #include "platform/graphics/GraphicsLayer.h" |
| 81 #include "platform/graphics/paint/DrawingRecorder.h" | 81 #include "platform/graphics/paint/DrawingRecorder.h" |
| 82 #include "platform/scroll/ScrollAnimatorBase.h" | 82 #include "platform/scroll/ScrollAnimatorBase.h" |
| 83 #include "platform/scroll/ScrollbarTheme.h" | 83 #include "platform/scroll/ScrollbarTheme.h" |
| 84 #include "public/platform/Platform.h" | 84 #include "public/platform/Platform.h" |
| 85 | 85 |
| 86 namespace blink { | 86 namespace blink { |
| 87 | 87 |
| 88 static LayoutRect localToAbsolute(LayoutBox& offset, LayoutRect rect) { |
| 89 return LayoutRect( |
| 90 offset.localToAbsoluteQuad(FloatQuad(FloatRect(rect)), UseTransforms) |
| 91 .boundingBox()); |
| 92 } |
| 93 |
| 88 PaintLayerScrollableAreaRareData::PaintLayerScrollableAreaRareData() {} | 94 PaintLayerScrollableAreaRareData::PaintLayerScrollableAreaRareData() {} |
| 89 | 95 |
| 90 const int ResizerControlExpandRatioForTouch = 2; | 96 const int ResizerControlExpandRatioForTouch = 2; |
| 91 | 97 |
| 92 PaintLayerScrollableArea::PaintLayerScrollableArea(PaintLayer& layer) | 98 PaintLayerScrollableArea::PaintLayerScrollableArea(PaintLayer& layer) |
| 93 : m_layer(layer), | 99 : m_layer(layer), |
| 94 m_nextTopmostScrollChild(0), | 100 m_nextTopmostScrollChild(0), |
| 95 m_topmostScrollChild(0), | 101 m_topmostScrollChild(0), |
| 96 m_inResizeMode(false), | 102 m_inResizeMode(false), |
| 97 m_scrollsOverflow(false), | 103 m_scrollsOverflow(false), |
| (...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1615 .boundingBox()); | 1621 .boundingBox()); |
| 1616 localExposeRect.move(-box().borderLeft(), -box().borderTop()); | 1622 localExposeRect.move(-box().borderLeft(), -box().borderTop()); |
| 1617 LayoutRect layerBounds(LayoutPoint(), | 1623 LayoutRect layerBounds(LayoutPoint(), |
| 1618 LayoutSize(box().clientWidth(), box().clientHeight())); | 1624 LayoutSize(box().clientWidth(), box().clientHeight())); |
| 1619 LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect, | 1625 LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect, |
| 1620 alignX, alignY); | 1626 alignX, alignY); |
| 1621 | 1627 |
| 1622 ScrollOffset oldScrollOffset = getScrollOffset(); | 1628 ScrollOffset oldScrollOffset = getScrollOffset(); |
| 1623 ScrollOffset newScrollOffset(clampScrollOffset(roundedIntSize( | 1629 ScrollOffset newScrollOffset(clampScrollOffset(roundedIntSize( |
| 1624 toScrollOffset(FloatPoint(r.location()) + oldScrollOffset)))); | 1630 toScrollOffset(FloatPoint(r.location()) + oldScrollOffset)))); |
| 1625 | |
| 1626 if (newScrollOffset == oldScrollOffset) { | |
| 1627 return LayoutRect( | |
| 1628 box() | |
| 1629 .localToAbsoluteQuad(FloatQuad(FloatRect(intersection( | |
| 1630 layerBounds, localExposeRect))), | |
| 1631 UseTransforms) | |
| 1632 .boundingBox()); | |
| 1633 } | |
| 1634 | |
| 1635 setScrollOffset(newScrollOffset, scrollType, ScrollBehaviorInstant); | 1631 setScrollOffset(newScrollOffset, scrollType, ScrollBehaviorInstant); |
| 1636 ScrollOffset scrollOffsetDifference = getScrollOffset() - oldScrollOffset; | 1632 ScrollOffset scrollOffsetDifference = getScrollOffset() - oldScrollOffset; |
| 1637 localExposeRect.move(-LayoutSize(scrollOffsetDifference)); | 1633 localExposeRect.move(-LayoutSize(scrollOffsetDifference)); |
| 1638 return LayoutRect( | 1634 |
| 1639 box() | 1635 LayoutRect intersect = |
| 1640 .localToAbsoluteQuad( | 1636 localToAbsolute(box(), intersection(layerBounds, localExposeRect)); |
| 1641 FloatQuad(FloatRect(intersection(layerBounds, localExposeRect))), | 1637 if (intersect.isEmpty() && !layerBounds.isEmpty() && |
| 1642 UseTransforms) | 1638 !localExposeRect.isEmpty()) { |
| 1643 .boundingBox()); | 1639 return localToAbsolute(box(), localExposeRect); |
| 1640 } |
| 1641 return intersect; |
| 1644 } | 1642 } |
| 1645 | 1643 |
| 1646 void PaintLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow) { | 1644 void PaintLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow) { |
| 1647 LocalFrame* frame = box().frame(); | 1645 LocalFrame* frame = box().frame(); |
| 1648 if (!frame) | 1646 if (!frame) |
| 1649 return; | 1647 return; |
| 1650 | 1648 |
| 1651 FrameView* frameView = frame->view(); | 1649 FrameView* frameView = frame->view(); |
| 1652 if (!frameView) | 1650 if (!frameView) |
| 1653 return; | 1651 return; |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2081 | 2079 |
| 2082 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2080 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
| 2083 clampScrollableAreas() { | 2081 clampScrollableAreas() { |
| 2084 for (auto& scrollableArea : *s_needsClamp) | 2082 for (auto& scrollableArea : *s_needsClamp) |
| 2085 scrollableArea->clampScrollOffsetAfterOverflowChange(); | 2083 scrollableArea->clampScrollOffsetAfterOverflowChange(); |
| 2086 delete s_needsClamp; | 2084 delete s_needsClamp; |
| 2087 s_needsClamp = nullptr; | 2085 s_needsClamp = nullptr; |
| 2088 } | 2086 } |
| 2089 | 2087 |
| 2090 } // namespace blink | 2088 } // namespace blink |
| OLD | NEW |