| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 class ScrollingCoordinator : public RefCounted<ScrollingCoordinator> { | 53 class ScrollingCoordinator : public RefCounted<ScrollingCoordinator> { |
| 54 public: | 54 public: |
| 55 static PassRefPtr<ScrollingCoordinator> create(Page*); | 55 static PassRefPtr<ScrollingCoordinator> create(Page*); |
| 56 ~ScrollingCoordinator(); | 56 ~ScrollingCoordinator(); |
| 57 | 57 |
| 58 void pageDestroyed(); | 58 void pageDestroyed(); |
| 59 | 59 |
| 60 // Return whether this scrolling coordinator handles scrolling for the given
frame view. | 60 // Return whether this scrolling coordinator handles scrolling for the given
frame view. |
| 61 bool coordinatesScrollingForFrameView(FrameView*) const; | 61 bool coordinatesScrollingForFrameView(FrameView*) const; |
| 62 | 62 |
| 63 // Called when any frame has done its layout. | 63 // Should be called whenever the given frame view has been laid out. |
| 64 void notifyLayoutUpdated(); | 64 void frameViewLayoutUpdated(FrameView*); |
| 65 | |
| 66 // Should be called after compositing has been updated. | |
| 67 void updateAfterCompositingChange(); | |
| 68 | |
| 69 bool needsToUpdateAfterCompositingChange() const { return m_scrollGestureReg
ionIsDirty || m_touchEventTargetRectsAreDirty; } | |
| 70 | 65 |
| 71 // Should be called whenever a wheel event handler is added or removed in th
e | 66 // Should be called whenever a wheel event handler is added or removed in th
e |
| 72 // frame view's underlying document. | 67 // frame view's underlying document. |
| 73 void frameViewWheelEventHandlerCountChanged(FrameView*); | 68 void frameViewWheelEventHandlerCountChanged(FrameView*); |
| 74 | 69 |
| 75 // Should be called whenever the slow repaint objects counter changes betwee
n zero and one. | 70 // Should be called whenever the slow repaint objects counter changes betwee
n zero and one. |
| 76 void frameViewHasSlowRepaintObjectsDidChange(FrameView*); | 71 void frameViewHasSlowRepaintObjectsDidChange(FrameView*); |
| 77 | 72 |
| 78 // Should be called whenever the set of fixed objects changes. | 73 // Should be called whenever the set of fixed objects changes. |
| 79 void frameViewFixedObjectsDidChange(FrameView*); | 74 void frameViewFixedObjectsDidChange(FrameView*); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 106 void touchEventTargetRectsDidChange(const Document*); | 101 void touchEventTargetRectsDidChange(const Document*); |
| 107 void willDestroyRenderLayer(RenderLayer*); | 102 void willDestroyRenderLayer(RenderLayer*); |
| 108 | 103 |
| 109 void updateScrollParentForGraphicsLayer(GraphicsLayer* child, RenderLayer* p
arent); | 104 void updateScrollParentForGraphicsLayer(GraphicsLayer* child, RenderLayer* p
arent); |
| 110 void updateClipParentForGraphicsLayer(GraphicsLayer* child, RenderLayer* par
ent); | 105 void updateClipParentForGraphicsLayer(GraphicsLayer* child, RenderLayer* par
ent); |
| 111 | 106 |
| 112 static String mainThreadScrollingReasonsAsText(MainThreadScrollingReasons); | 107 static String mainThreadScrollingReasonsAsText(MainThreadScrollingReasons); |
| 113 String mainThreadScrollingReasonsAsText() const; | 108 String mainThreadScrollingReasonsAsText() const; |
| 114 Region computeShouldHandleScrollGestureOnMainThreadRegion(const Frame*, cons
t IntPoint& frameLocation) const; | 109 Region computeShouldHandleScrollGestureOnMainThreadRegion(const Frame*, cons
t IntPoint& frameLocation) const; |
| 115 | 110 |
| 116 void updateTouchEventTargetRectsIfNeeded(); | |
| 117 | |
| 118 protected: | 111 protected: |
| 119 explicit ScrollingCoordinator(Page*); | 112 explicit ScrollingCoordinator(Page*); |
| 120 | 113 |
| 121 static GraphicsLayer* scrollLayerForScrollableArea(ScrollableArea*); | 114 static GraphicsLayer* scrollLayerForScrollableArea(ScrollableArea*); |
| 122 static GraphicsLayer* horizontalScrollbarLayerForScrollableArea(ScrollableAr
ea*); | 115 static GraphicsLayer* horizontalScrollbarLayerForScrollableArea(ScrollableAr
ea*); |
| 123 static GraphicsLayer* verticalScrollbarLayerForScrollableArea(ScrollableArea
*); | 116 static GraphicsLayer* verticalScrollbarLayerForScrollableArea(ScrollableArea
*); |
| 124 bool isForMainFrame(ScrollableArea*) const; | 117 bool isForMainFrame(ScrollableArea*) const; |
| 125 | 118 |
| 126 unsigned computeCurrentWheelEventHandlerCount(); | 119 unsigned computeCurrentWheelEventHandlerCount(); |
| 127 GraphicsLayer* scrollLayerForFrameView(FrameView*); | 120 GraphicsLayer* scrollLayerForFrameView(FrameView*); |
| 128 GraphicsLayer* counterScrollingLayerForFrameView(FrameView*); | 121 GraphicsLayer* counterScrollingLayerForFrameView(FrameView*); |
| 129 | 122 |
| 130 Page* m_page; | 123 Page* m_page; |
| 131 | 124 |
| 132 // Dirty flags used to idenfity what really needs to be computed after compo
siting is updated. | |
| 133 bool m_scrollGestureRegionIsDirty; | |
| 134 bool m_touchEventTargetRectsAreDirty; | |
| 135 | |
| 136 private: | 125 private: |
| 137 void recomputeWheelEventHandlerCountForFrameView(FrameView*); | 126 void recomputeWheelEventHandlerCountForFrameView(FrameView*); |
| 138 void setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReaso
ns); | 127 void setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReaso
ns); |
| 139 | 128 |
| 140 bool hasVisibleSlowRepaintViewportConstrainedObjects(FrameView*) const; | 129 bool hasVisibleSlowRepaintViewportConstrainedObjects(FrameView*) const; |
| 141 void updateShouldUpdateScrollLayerPositionOnMainThread(); | 130 void updateShouldUpdateScrollLayerPositionOnMainThread(); |
| 142 | 131 |
| 143 static WebKit::WebLayer* scrollingWebLayerForScrollableArea(ScrollableArea*)
; | 132 static WebKit::WebLayer* scrollingWebLayerForScrollableArea(ScrollableArea*)
; |
| 144 | 133 |
| 145 bool touchHitTestingEnabled() const; | 134 bool touchHitTestingEnabled() const; |
| 146 void setShouldHandleScrollGestureOnMainThreadRegion(const Region&); | 135 void setShouldHandleScrollGestureOnMainThreadRegion(const Region&); |
| 147 void setTouchEventTargetRects(const LayerHitTestRects&); | 136 void setTouchEventTargetRects(const LayerHitTestRects&); |
| 148 void computeTouchEventTargetRects(LayerHitTestRects&); | 137 void computeTouchEventTargetRects(LayerHitTestRects&); |
| 149 void setWheelEventHandlerCount(unsigned); | 138 void setWheelEventHandlerCount(unsigned); |
| 150 | 139 |
| 151 WebKit::WebScrollbarLayer* addWebScrollbarLayer(ScrollableArea*, ScrollbarOr
ientation, PassOwnPtr<WebKit::WebScrollbarLayer>); | 140 WebKit::WebScrollbarLayer* addWebScrollbarLayer(ScrollableArea*, ScrollbarOr
ientation, PassOwnPtr<WebKit::WebScrollbarLayer>); |
| 152 WebKit::WebScrollbarLayer* getWebScrollbarLayer(ScrollableArea*, ScrollbarOr
ientation); | 141 WebKit::WebScrollbarLayer* getWebScrollbarLayer(ScrollableArea*, ScrollbarOr
ientation); |
| 153 void removeWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation); | 142 void removeWebScrollbarLayer(ScrollableArea*, ScrollbarOrientation); |
| 154 | 143 |
| 155 | 144 |
| 156 typedef HashMap<ScrollableArea*, OwnPtr<WebKit::WebScrollbarLayer> > Scrollb
arMap; | 145 typedef HashMap<ScrollableArea*, OwnPtr<WebKit::WebScrollbarLayer> > Scrollb
arMap; |
| 157 ScrollbarMap m_horizontalScrollbars; | 146 ScrollbarMap m_horizontalScrollbars; |
| 158 ScrollbarMap m_verticalScrollbars; | 147 ScrollbarMap m_verticalScrollbars; |
| 159 HashSet<const RenderLayer*> m_layersWithTouchRects; | 148 HashSet<const RenderLayer*> m_layersWithTouchRects; |
| 160 }; | 149 }; |
| 161 | 150 |
| 162 } // namespace WebCore | 151 } // namespace WebCore |
| 163 | 152 |
| 164 #endif // ScrollingCoordinator_h | 153 #endif // ScrollingCoordinator_h |
| OLD | NEW |