Changeset 106690 in webkit
- Timestamp:
- Feb 3, 2012 1:25:44 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r106685 r106690 1 2012-02-03 Anders Carlsson <andersca@apple.com> 2 3 Update the tree state after layout and add a way to commit it 4 https://bugs.webkit.org/show_bug.cgi?id=77767 5 6 Reviewed by Andreas Kling. 7 8 * page/FrameView.cpp: 9 (WebCore::FrameView::performPostLayoutTasks): 10 Call ScrollingCoordinator::frameViewLayoutUpdated if we have a scrolling coordinator. 11 12 * page/scrolling/ScrollingCoordinator.cpp: 13 (WebCore::ScrollingCoordinator::ScrollingCoordinator): 14 Initialize m_scrollingTreeStateCommitterTimer. 15 16 (WebCore::ScrollingCoordinator::frameViewLayoutUpdated): 17 Update the viewport rect and contents size of the frame view. 18 19 (WebCore::ScrollingCoordinator::scheduleTreeStateCommit): 20 Schedule a tree state commit unless we've already scheduled one or there are no changed properties. 21 22 (WebCore::ScrollingCoordinator::scrollingTreeStateCommitterTimerFired): 23 Call commitTreeState(). 24 25 (WebCore::ScrollingCoordinator::commitTreeStateIfNeeded): 26 Commit the tree state unless there are no changed properties. 27 28 (WebCore::ScrollingCoordinator::commitTreeState): 29 Commit the tree state. We currently don't do anything with the committed state yet. 30 31 * page/scrolling/ScrollingCoordinator.h: 32 Add new member functions and the timer member variable. 33 34 * page/scrolling/ScrollingTreeState.cpp: 35 (WebCore::ScrollingTreeState::commit): 36 Copy the current tree state and restore the changed properties on the original. 37 38 * page/scrolling/ScrollingTreeState.h: 39 (WebCore::ScrollingTreeState::hasChangedProperties): 40 Return whether there are any changed properties in the tree state. 41 1 42 2012-02-03 Andreas Kling <awesomekling@apple.com> 2 43 -
trunk/Source/WebCore/page/FrameView.cpp
r106492 r106690 2306 2306 } 2307 2307 2308 #if ENABLE(THREADED_SCROLLING) 2309 if (Page* page = m_frame->page()) { 2310 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) 2311 scrollingCoordinator->frameViewLayoutUpdated(this); 2312 } 2313 #endif 2314 2308 2315 scrollToAnchor(); 2309 2316 -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp
r106679 r106690 54 54 , m_scrollingTree(ScrollingTree::create(this)) 55 55 , m_scrollingTreeState(ScrollingTreeState::create()) 56 , m_scrollingTreeStateCommitterTimer(this, &ScrollingCoordinator::scrollingTreeStateCommitterTimerFired) 56 57 , m_didDispatchDidUpdateMainFrameScrollPosition(false) 57 58 { … … 83 84 84 85 return true; 86 } 87 88 void ScrollingCoordinator::frameViewLayoutUpdated(FrameView* frameView) 89 { 90 ASSERT(isMainThread()); 91 ASSERT(m_page); 92 93 if (!coordinatesScrollingForFrameView(frameView)) 94 return; 95 96 m_scrollingTreeState->setViewportRect(IntRect(IntPoint(), frameView->visibleContentRect().size())); 97 m_scrollingTreeState->setContentsSize(frameView->contentsSize()); 98 scheduleTreeStateCommit(); 85 99 } 86 100 … … 159 173 } 160 174 175 void ScrollingCoordinator::scheduleTreeStateCommit() 176 { 177 if (m_scrollingTreeStateCommitterTimer.isActive()) 178 return; 179 180 if (!m_scrollingTreeState->hasChangedProperties()) 181 return; 182 183 m_scrollingTreeStateCommitterTimer.startOneShot(0); 184 } 185 186 void ScrollingCoordinator::scrollingTreeStateCommitterTimerFired(Timer<ScrollingCoordinator>*) 187 { 188 commitTreeState(); 189 } 190 191 void ScrollingCoordinator::commitTreeStateIfNeeded() 192 { 193 if (!m_scrollingTreeState->hasChangedProperties()) 194 return; 195 196 commitTreeState(); 197 m_scrollingTreeStateCommitterTimer.stop(); 198 } 199 200 void ScrollingCoordinator::commitTreeState() 201 { 202 printf("committing!\n"); 203 ASSERT(m_scrollingTreeState->hasChangedProperties()); 204 205 OwnPtr<ScrollingTreeState> treeState = m_scrollingTreeState->commit(); 206 207 // FIXME: Commit the tree state. 208 } 209 161 210 } // namespace WebCore 162 211 -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h
r106679 r106690 31 31 #include "GraphicsLayer.h" 32 32 #include "IntRect.h" 33 #include "Timer.h" 33 34 #include <wtf/Forward.h> 34 35 #include <wtf/ThreadSafeRefCounted.h> … … 61 62 // Return whether this scrolling coordinator handles scrolling for the given frame view. 62 63 bool coordinatesScrollingForFrameView(FrameView*) const; 64 65 // Should be called whenever the given frame view has been laid out. 66 void frameViewLayoutUpdated(FrameView*); 63 67 64 68 // Should be called whenever the scroll layer for the given frame view changes. … … 98 102 99 103 private: 104 void scheduleTreeStateCommit(); 105 void scrollingTreeStateCommitterTimerFired(Timer<ScrollingCoordinator>*); 106 void commitTreeStateIfNeeded(); 107 void commitTreeState(); 108 100 109 Page* m_page; 101 110 RefPtr<ScrollingTree> m_scrollingTree; 102 111 103 112 OwnPtr<ScrollingTreeState> m_scrollingTreeState; 113 Timer<ScrollingCoordinator> m_scrollingTreeStateCommitterTimer; 104 114 105 115 Mutex m_mainFrameGeometryMutex; -
trunk/Source/WebCore/page/scrolling/ScrollingTreeState.cpp
r106679 r106690 63 63 } 64 64 65 PassOwnPtr<ScrollingTreeState> ScrollingTreeState::commit() 66 { 67 OwnPtr<ScrollingTreeState> treeState = adoptPtr(new ScrollingTreeState(*this)); 68 m_changedProperties = 0; 69 70 return treeState.release(); 71 } 72 65 73 } // namespace WebCore 66 74 -
trunk/Source/WebCore/page/scrolling/ScrollingTreeState.h
r106683 r106690 54 54 }; 55 55 56 bool hasChangedProperties() const { return m_changedProperties; } 57 56 58 const IntRect& viewportRect() const { return m_viewportRect; } 57 59 void setViewportRect(const IntRect&); … … 62 64 PlatformLayer* platformScrollLayer() const; 63 65 void setScrollLayer(const GraphicsLayer*); 66 67 // Copies the current tree state and clears the changed properties mask in the original. 68 PassOwnPtr<ScrollingTreeState> commit(); 64 69 65 70 private:
Note: See TracChangeset
for help on using the changeset viewer.