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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 172 } |
173 | 173 |
174 FrameTree* tree = frame->tree(); | 174 FrameTree* tree = frame->tree(); |
175 for (Frame* subFrame = tree->firstChild(); subFrame; subFrame = subFrame->tr
ee()->nextSibling()) | 175 for (Frame* subFrame = tree->firstChild(); subFrame; subFrame = subFrame->tr
ee()->nextSibling()) |
176 nonFastScrollableRegion.unite(computeNonFastScrollableRegion(subFrame, o
ffset)); | 176 nonFastScrollableRegion.unite(computeNonFastScrollableRegion(subFrame, o
ffset)); |
177 | 177 |
178 return nonFastScrollableRegion; | 178 return nonFastScrollableRegion; |
179 } | 179 } |
180 | 180 |
181 #if ENABLE(TOUCH_EVENT_TRACKING) | 181 #if ENABLE(TOUCH_EVENT_TRACKING) |
182 static void accumulateRendererTouchEventTargetRects(Vector<IntRect>& rects, cons
t RenderObject* renderer) | 182 static void accumulateRendererTouchEventTargetRects(Vector<IntRect>& rects, cons
t RenderObject* renderer, const IntRect& parentRect = IntRect()) |
183 { | 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. | 184 IntRect adjustedParentRect = parentRect; |
185 rects.append(enclosingIntRect(renderer->clippedOverflowRectForRepaint(0))); | 185 if (parentRect.isEmpty() || renderer->isFloating() || renderer->isPositioned
() || renderer->hasTransform()) { |
186 if (renderer->isRenderBlock()) { | 186 // FIXME: This method is O(N^2) as it walks the tree to the root for eve
ry renderer. RenderGeometryMap would fix this. |
187 const RenderBlock* block = toRenderBlock(renderer); | 187 IntRect r = enclosingIntRect(renderer->clippedOverflowRectForRepaint(0))
; |
188 for (RenderObject* child = block->firstChild(); child; child = child->ne
xtSibling()) | 188 if (!r.isEmpty() && !parentRect.contains(r)) { |
189 accumulateRendererTouchEventTargetRects(rects, child); | 189 rects.append(r); |
| 190 adjustedParentRect = r; |
| 191 } |
190 } | 192 } |
| 193 |
| 194 for (RenderObject* child = renderer->firstChild(); child; child = child->nex
tSibling()) |
| 195 accumulateRendererTouchEventTargetRects(rects, child, adjustedParentRect
); |
191 } | 196 } |
192 | 197 |
193 static void accumulateDocumentEventTargetRects(Vector<IntRect>& rects, const Doc
ument* document) | 198 static void accumulateDocumentEventTargetRects(Vector<IntRect>& rects, const Doc
ument* document) |
194 { | 199 { |
195 ASSERT(document); | 200 ASSERT(document); |
196 if (!document->touchEventTargets()) | 201 if (!document->touchEventTargets()) |
197 return; | 202 return; |
198 | 203 |
199 const TouchEventTargetSet* targets = document->touchEventTargets(); | 204 const TouchEventTargetSet* targets = document->touchEventTargets(); |
200 for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter != ta
rgets->end(); ++iter) { | 205 for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter != ta
rgets->end(); ++iter) { |
201 const Node* touchTarget = iter->key; | 206 const Node* touchTarget = iter->key; |
202 if (!touchTarget->inDocument()) | 207 if (!touchTarget->inDocument()) |
203 continue; | 208 continue; |
204 | 209 |
205 if (touchTarget == document) { | 210 if (touchTarget == document) { |
206 if (RenderView* view = document->renderView()) | 211 if (RenderView* view = document->renderView()) { |
207 rects.append(enclosingIntRect(view->clippedOverflowRectForRepain
t(0))); | 212 IntRect r = enclosingIntRect(view->clippedOverflowRectForRepaint
(0)); |
| 213 if (!r.isEmpty()) |
| 214 rects.append(r); |
| 215 } |
208 return; | 216 return; |
209 } | 217 } |
210 | 218 |
211 if (touchTarget->isDocumentNode() && touchTarget != document) { | 219 if (touchTarget->isDocumentNode() && touchTarget != document) { |
212 accumulateDocumentEventTargetRects(rects, static_cast<const Document
*>(touchTarget)); | 220 accumulateDocumentEventTargetRects(rects, static_cast<const Document
*>(touchTarget)); |
213 continue; | 221 continue; |
214 } | 222 } |
215 | 223 |
216 if (RenderObject* renderer = touchTarget->renderer()) | 224 if (RenderObject* renderer = touchTarget->renderer()) |
217 accumulateRendererTouchEventTargetRects(rects, renderer); | 225 accumulateRendererTouchEventTargetRects(rects, renderer); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 stringBuilder.resize(stringBuilder.length() - 2); | 474 stringBuilder.resize(stringBuilder.length() - 2); |
467 return stringBuilder.toString(); | 475 return stringBuilder.toString(); |
468 } | 476 } |
469 | 477 |
470 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const | 478 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const |
471 { | 479 { |
472 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons()); | 480 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons()); |
473 } | 481 } |
474 | 482 |
475 } // namespace WebCore | 483 } // namespace WebCore |
OLD | NEW |