| 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 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 .boundingBox()); | 1605 .boundingBox()); |
| 1600 localExposeRect.move(-box().borderLeft(), -box().borderTop()); | 1606 localExposeRect.move(-box().borderLeft(), -box().borderTop()); |
| 1601 LayoutRect layerBounds(LayoutPoint(), | 1607 LayoutRect layerBounds(LayoutPoint(), |
| 1602 LayoutSize(box().clientWidth(), box().clientHeight())); | 1608 LayoutSize(box().clientWidth(), box().clientHeight())); |
| 1603 LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect, | 1609 LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect, |
| 1604 alignX, alignY); | 1610 alignX, alignY); |
| 1605 | 1611 |
| 1606 ScrollOffset oldScrollOffset = scrollOffset(); | 1612 ScrollOffset oldScrollOffset = scrollOffset(); |
| 1607 ScrollOffset newScrollOffset(clampScrollOffset(roundedIntSize( | 1613 ScrollOffset newScrollOffset(clampScrollOffset(roundedIntSize( |
| 1608 toScrollOffset(FloatPoint(r.location()) + oldScrollOffset)))); | 1614 toScrollOffset(FloatPoint(r.location()) + oldScrollOffset)))); |
| 1609 | |
| 1610 if (newScrollOffset == oldScrollOffset) { | |
| 1611 return LayoutRect( | |
| 1612 box() | |
| 1613 .localToAbsoluteQuad(FloatQuad(FloatRect(intersection( | |
| 1614 layerBounds, localExposeRect))), | |
| 1615 UseTransforms) | |
| 1616 .boundingBox()); | |
| 1617 } | |
| 1618 | |
| 1619 setScrollOffset(newScrollOffset, scrollType, ScrollBehaviorInstant); | 1615 setScrollOffset(newScrollOffset, scrollType, ScrollBehaviorInstant); |
| 1620 ScrollOffset scrollOffsetDifference = scrollOffset() - oldScrollOffset; | 1616 ScrollOffset scrollOffsetDifference = scrollOffset() - oldScrollOffset; |
| 1621 localExposeRect.move(-LayoutSize(scrollOffsetDifference)); | 1617 localExposeRect.move(-LayoutSize(scrollOffsetDifference)); |
| 1622 return LayoutRect( | 1618 |
| 1623 box() | 1619 LayoutRect intersect = |
| 1624 .localToAbsoluteQuad( | 1620 localToAbsolute(box(), intersection(layerBounds, localExposeRect)); |
| 1625 FloatQuad(FloatRect(intersection(layerBounds, localExposeRect))), | 1621 if (intersect.isEmpty() && !layerBounds.isEmpty() && |
| 1626 UseTransforms) | 1622 !localExposeRect.isEmpty()) { |
| 1627 .boundingBox()); | 1623 return localToAbsolute(box(), localExposeRect); |
| 1624 } |
| 1625 return intersect; |
| 1628 } | 1626 } |
| 1629 | 1627 |
| 1630 void PaintLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow) { | 1628 void PaintLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow) { |
| 1631 LocalFrame* frame = box().frame(); | 1629 LocalFrame* frame = box().frame(); |
| 1632 if (!frame) | 1630 if (!frame) |
| 1633 return; | 1631 return; |
| 1634 | 1632 |
| 1635 FrameView* frameView = frame->view(); | 1633 FrameView* frameView = frame->view(); |
| 1636 if (!frameView) | 1634 if (!frameView) |
| 1637 return; | 1635 return; |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1994 | 1992 |
| 1995 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 1993 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
| 1996 clampScrollableAreas() { | 1994 clampScrollableAreas() { |
| 1997 for (auto& scrollableArea : *s_needsClamp) | 1995 for (auto& scrollableArea : *s_needsClamp) |
| 1998 scrollableArea->clampScrollOffsetsAfterLayout(); | 1996 scrollableArea->clampScrollOffsetsAfterLayout(); |
| 1999 delete s_needsClamp; | 1997 delete s_needsClamp; |
| 2000 s_needsClamp = nullptr; | 1998 s_needsClamp = nullptr; |
| 2001 } | 1999 } |
| 2002 | 2000 |
| 2003 } // namespace blink | 2001 } // namespace blink |
| OLD | NEW |