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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 #include "platform/PlatformMouseEvent.h" | 79 #include "platform/PlatformMouseEvent.h" |
80 #include "platform/graphics/CompositorMutableProperties.h" | 80 #include "platform/graphics/CompositorMutableProperties.h" |
81 #include "platform/graphics/GraphicsLayer.h" | 81 #include "platform/graphics/GraphicsLayer.h" |
82 #include "platform/graphics/paint/DrawingRecorder.h" | 82 #include "platform/graphics/paint/DrawingRecorder.h" |
83 #include "platform/scroll/ScrollAnimatorBase.h" | 83 #include "platform/scroll/ScrollAnimatorBase.h" |
84 #include "platform/scroll/ScrollbarTheme.h" | 84 #include "platform/scroll/ScrollbarTheme.h" |
85 #include "public/platform/Platform.h" | 85 #include "public/platform/Platform.h" |
86 | 86 |
87 namespace blink { | 87 namespace blink { |
88 | 88 |
89 static LayoutRect localToAbsolute(LayoutBox& offset, LayoutRect rect) { | |
90 return LayoutRect( | |
91 offset.localToAbsoluteQuad(FloatQuad(FloatRect(rect)), UseTransforms) | |
92 .boundingBox()); | |
93 } | |
94 | |
89 PaintLayerScrollableAreaRareData::PaintLayerScrollableAreaRareData() {} | 95 PaintLayerScrollableAreaRareData::PaintLayerScrollableAreaRareData() {} |
90 | 96 |
91 const int ResizerControlExpandRatioForTouch = 2; | 97 const int ResizerControlExpandRatioForTouch = 2; |
92 | 98 |
93 PaintLayerScrollableArea::PaintLayerScrollableArea(PaintLayer& layer) | 99 PaintLayerScrollableArea::PaintLayerScrollableArea(PaintLayer& layer) |
94 : m_layer(layer), | 100 : m_layer(layer), |
95 m_nextTopmostScrollChild(0), | 101 m_nextTopmostScrollChild(0), |
96 m_topmostScrollChild(0), | 102 m_topmostScrollChild(0), |
97 m_inResizeMode(false), | 103 m_inResizeMode(false), |
98 m_scrollsOverflow(false), | 104 m_scrollsOverflow(false), |
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1638 LayoutRect layerBounds(LayoutPoint(), | 1644 LayoutRect layerBounds(LayoutPoint(), |
1639 LayoutSize(box().clientWidth(), box().clientHeight())); | 1645 LayoutSize(box().clientWidth(), box().clientHeight())); |
1640 LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect, | 1646 LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect, |
1641 alignX, alignY); | 1647 alignX, alignY); |
1642 | 1648 |
1643 ScrollOffset oldScrollOffset = getScrollOffset(); | 1649 ScrollOffset oldScrollOffset = getScrollOffset(); |
1644 ScrollOffset newScrollOffset(clampScrollOffset(roundedIntSize( | 1650 ScrollOffset newScrollOffset(clampScrollOffset(roundedIntSize( |
1645 toScrollOffset(FloatPoint(r.location()) + oldScrollOffset)))); | 1651 toScrollOffset(FloatPoint(r.location()) + oldScrollOffset)))); |
1646 | 1652 |
1647 if (newScrollOffset == oldScrollOffset) { | 1653 if (newScrollOffset == oldScrollOffset) { |
1648 return LayoutRect( | 1654 LayoutRect intersect = |
bokan
2016/12/20 15:43:56
This part is duplicated below. I think the three l
sunyunjia
2017/01/04 19:32:37
Done.
| |
1649 box() | 1655 localToAbsolute(box(), intersection(layerBounds, localExposeRect)); |
1650 .localToAbsoluteQuad(FloatQuad(FloatRect(intersection( | 1656 if (intersect.isEmpty() && !layerBounds.isEmpty() && |
1651 layerBounds, localExposeRect))), | 1657 !localExposeRect.isEmpty()) { |
1652 UseTransforms) | 1658 return localToAbsolute(box(), localExposeRect); |
1653 .boundingBox()); | 1659 } |
1660 return intersect; | |
1654 } | 1661 } |
1655 | 1662 |
1656 setScrollOffset(newScrollOffset, scrollType, ScrollBehaviorInstant); | 1663 setScrollOffset(newScrollOffset, scrollType, ScrollBehaviorInstant); |
1657 ScrollOffset scrollOffsetDifference = getScrollOffset() - oldScrollOffset; | 1664 ScrollOffset scrollOffsetDifference = getScrollOffset() - oldScrollOffset; |
1658 localExposeRect.move(-LayoutSize(scrollOffsetDifference)); | 1665 localExposeRect.move(-LayoutSize(scrollOffsetDifference)); |
1659 return LayoutRect( | 1666 LayoutRect intersect = |
1660 box() | 1667 localToAbsolute(box(), intersection(layerBounds, localExposeRect)); |
1661 .localToAbsoluteQuad( | 1668 if (intersect.isEmpty() && !layerBounds.isEmpty() && |
1662 FloatQuad(FloatRect(intersection(layerBounds, localExposeRect))), | 1669 !localExposeRect.isEmpty()) { |
1663 UseTransforms) | 1670 return localToAbsolute(box(), localExposeRect); |
1664 .boundingBox()); | 1671 } |
1672 return intersect; | |
1665 } | 1673 } |
1666 | 1674 |
1667 void PaintLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow) { | 1675 void PaintLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow) { |
1668 LocalFrame* frame = box().frame(); | 1676 LocalFrame* frame = box().frame(); |
1669 if (!frame) | 1677 if (!frame) |
1670 return; | 1678 return; |
1671 | 1679 |
1672 FrameView* frameView = frame->view(); | 1680 FrameView* frameView = frame->view(); |
1673 if (!frameView) | 1681 if (!frameView) |
1674 return; | 1682 return; |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2034 | 2042 |
2035 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2043 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
2036 clampScrollableAreas() { | 2044 clampScrollableAreas() { |
2037 for (auto& scrollableArea : *s_needsClamp) | 2045 for (auto& scrollableArea : *s_needsClamp) |
2038 scrollableArea->clampScrollOffsetAfterOverflowChange(); | 2046 scrollableArea->clampScrollOffsetAfterOverflowChange(); |
2039 delete s_needsClamp; | 2047 delete s_needsClamp; |
2040 s_needsClamp = nullptr; | 2048 s_needsClamp = nullptr; |
2041 } | 2049 } |
2042 | 2050 |
2043 } // namespace blink | 2051 } // namespace blink |
OLD | NEW |