OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. |
7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 2371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2382 LayoutRect newContainerRect; | 2382 LayoutRect newContainerRect; |
2383 computeSelfHitTestRects(ownRects, layerOffset); | 2383 computeSelfHitTestRects(ownRects, layerOffset); |
2384 | 2384 |
2385 // When we get to have a lot of rects on a layer, the performance cost of tr
acking those | 2385 // When we get to have a lot of rects on a layer, the performance cost of tr
acking those |
2386 // rects outweighs the benefit of doing compositor thread hit testing. | 2386 // rects outweighs the benefit of doing compositor thread hit testing. |
2387 // FIXME: This limit needs to be low due to the O(n^2) algorithm in | 2387 // FIXME: This limit needs to be low due to the O(n^2) algorithm in |
2388 // WebLayer::setTouchEventHandlerRegion - crbug.com/300282. | 2388 // WebLayer::setTouchEventHandlerRegion - crbug.com/300282. |
2389 const size_t maxRectsPerLayer = 100; | 2389 const size_t maxRectsPerLayer = 100; |
2390 | 2390 |
2391 LayerHitTestRects::iterator iter = layerRects.find(currentLayer); | 2391 LayerHitTestRects::iterator iter = layerRects.find(currentLayer); |
| 2392 Vector<WebCore::LayoutRect>* iterValue; |
2392 if (iter == layerRects.end()) | 2393 if (iter == layerRects.end()) |
2393 iter = layerRects.add(currentLayer, Vector<LayoutRect>()).iterator; | 2394 iterValue = &layerRects.add(currentLayer, Vector<LayoutRect>()).storedVa
lue->value; |
| 2395 else |
| 2396 iterValue = &iter->value; |
2394 for (size_t i = 0; i < ownRects.size(); i++) { | 2397 for (size_t i = 0; i < ownRects.size(); i++) { |
2395 if (!containerRect.contains(ownRects[i])) { | 2398 if (!containerRect.contains(ownRects[i])) { |
2396 iter->value.append(ownRects[i]); | 2399 iterValue->append(ownRects[i]); |
2397 if (iter->value.size() > maxRectsPerLayer) { | 2400 if (iterValue->size() > maxRectsPerLayer) { |
2398 // Just mark the entire layer instead, and switch to walking the
layer | 2401 // Just mark the entire layer instead, and switch to walking the
layer |
2399 // tree instead of the render tree. | 2402 // tree instead of the render tree. |
2400 layerRects.remove(currentLayer); | 2403 layerRects.remove(currentLayer); |
2401 currentLayer->addLayerHitTestRects(layerRects); | 2404 currentLayer->addLayerHitTestRects(layerRects); |
2402 return; | 2405 return; |
2403 } | 2406 } |
2404 if (newContainerRect.isEmpty()) | 2407 if (newContainerRect.isEmpty()) |
2405 newContainerRect = ownRects[i]; | 2408 newContainerRect = ownRects[i]; |
2406 } | 2409 } |
2407 } | 2410 } |
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3366 { | 3369 { |
3367 if (object1) { | 3370 if (object1) { |
3368 const WebCore::RenderObject* root = object1; | 3371 const WebCore::RenderObject* root = object1; |
3369 while (root->parent()) | 3372 while (root->parent()) |
3370 root = root->parent(); | 3373 root = root->parent(); |
3371 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3374 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3372 } | 3375 } |
3373 } | 3376 } |
3374 | 3377 |
3375 #endif | 3378 #endif |
OLD | NEW |