Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: Source/WebCore/page/scrolling/ScrollingCoordinator.cpp

Issue 11635024: Merge 137939 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE. 23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 27
28 #include "ScrollingCoordinator.h" 28 #include "ScrollingCoordinator.h"
29 29
30 #include "Document.h"
30 #include "Frame.h" 31 #include "Frame.h"
31 #include "FrameView.h" 32 #include "FrameView.h"
32 #include "GraphicsLayer.h" 33 #include "GraphicsLayer.h"
33 #include "IntRect.h" 34 #include "IntRect.h"
34 #include "Page.h" 35 #include "Page.h"
35 #include "PlatformWheelEvent.h" 36 #include "PlatformWheelEvent.h"
36 #include "PluginViewBase.h" 37 #include "PluginViewBase.h"
37 #include "Region.h" 38 #include "Region.h"
38 #include "RenderView.h" 39 #include "RenderView.h"
39 #include "ScrollAnimator.h" 40 #include "ScrollAnimator.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 171 }
171 } 172 }
172 173
173 FrameTree* tree = frame->tree(); 174 FrameTree* tree = frame->tree();
174 for (Frame* subFrame = tree->firstChild(); subFrame; subFrame = subFrame->tr ee()->nextSibling()) 175 for (Frame* subFrame = tree->firstChild(); subFrame; subFrame = subFrame->tr ee()->nextSibling())
175 nonFastScrollableRegion.unite(computeNonFastScrollableRegion(subFrame, o ffset)); 176 nonFastScrollableRegion.unite(computeNonFastScrollableRegion(subFrame, o ffset));
176 177
177 return nonFastScrollableRegion; 178 return nonFastScrollableRegion;
178 } 179 }
179 180
181 #if ENABLE(TOUCH_EVENT_TRACKING)
182 static void accumulateRendererTouchEventTargetRects(Vector<IntRect>& rects, cons t RenderObject* renderer)
183 {
184 // FIXME: This method is O(N^2) as it walks the tree to the root for every r enderer. RenderGeometryMap would fix this.
185 rects.append(enclosingIntRect(renderer->clippedOverflowRectForRepaint(0)));
186 if (renderer->isRenderBlock()) {
187 const RenderBlock* block = toRenderBlock(renderer);
188 for (RenderObject* child = block->firstChild(); child; child = child->ne xtSibling())
189 accumulateRendererTouchEventTargetRects(rects, child);
190 }
191 }
192
193 static void accumulateDocumentEventTargetRects(Vector<IntRect>& rects, const Doc ument* document)
194 {
195 ASSERT(document);
196 if (!document->touchEventTargets())
197 return;
198
199 const TouchEventTargetSet* targets = document->touchEventTargets();
200 for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter != ta rgets->end(); ++iter) {
201 const Node* touchTarget = iter->key;
202 if (!touchTarget->inDocument())
203 continue;
204
205 if (touchTarget == document) {
206 if (RenderView* view = document->renderView())
207 rects.append(enclosingIntRect(view->clippedOverflowRectForRepain t(0)));
208 return;
209 }
210
211 if (touchTarget->isDocumentNode() && touchTarget != document) {
212 accumulateDocumentEventTargetRects(rects, static_cast<const Document *>(touchTarget));
213 continue;
214 }
215
216 if (RenderObject* renderer = touchTarget->renderer())
217 accumulateRendererTouchEventTargetRects(rects, renderer);
218 }
219 }
220
221 void ScrollingCoordinator::computeAbsoluteTouchEventTargetRects(const Document* document, Vector<IntRect>& rects)
222 {
223 ASSERT(document);
224 if (!document->view())
225 return;
226
227 // FIXME: These rects won't be properly updated if the renderers are in a su b-tree that scrolls.
228 accumulateDocumentEventTargetRects(rects, document);
229 }
230 #endif
231
180 unsigned ScrollingCoordinator::computeCurrentWheelEventHandlerCount() 232 unsigned ScrollingCoordinator::computeCurrentWheelEventHandlerCount()
181 { 233 {
182 unsigned wheelEventHandlerCount = 0; 234 unsigned wheelEventHandlerCount = 0;
183 235
184 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->trave rseNext()) { 236 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->trave rseNext()) {
185 if (frame->document()) 237 if (frame->document())
186 wheelEventHandlerCount += frame->document()->wheelEventHandlerCount( ); 238 wheelEventHandlerCount += frame->document()->wheelEventHandlerCount( );
187 } 239 }
188 240
189 return wheelEventHandlerCount; 241 return wheelEventHandlerCount;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 stringBuilder.resize(stringBuilder.length() - 2); 466 stringBuilder.resize(stringBuilder.length() - 2);
415 return stringBuilder.toString(); 467 return stringBuilder.toString();
416 } 468 }
417 469
418 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const 470 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const
419 { 471 {
420 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons()); 472 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons());
421 } 473 }
422 474
423 } // namespace WebCore 475 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698