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 2388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2399 LayoutRect newContainerRect; | 2399 LayoutRect newContainerRect; |
2400 computeSelfHitTestRects(ownRects, layerOffset); | 2400 computeSelfHitTestRects(ownRects, layerOffset); |
2401 | 2401 |
2402 // When we get to have a lot of rects on a layer, the performance cost of tr
acking those | 2402 // When we get to have a lot of rects on a layer, the performance cost of tr
acking those |
2403 // rects outweighs the benefit of doing compositor thread hit testing. | 2403 // rects outweighs the benefit of doing compositor thread hit testing. |
2404 // FIXME: This limit needs to be low due to the O(n^2) algorithm in | 2404 // FIXME: This limit needs to be low due to the O(n^2) algorithm in |
2405 // WebLayer::setTouchEventHandlerRegion - crbug.com/300282. | 2405 // WebLayer::setTouchEventHandlerRegion - crbug.com/300282. |
2406 const size_t maxRectsPerLayer = 100; | 2406 const size_t maxRectsPerLayer = 100; |
2407 | 2407 |
2408 LayerHitTestRects::iterator iter = layerRects.find(currentLayer); | 2408 LayerHitTestRects::iterator iter = layerRects.find(currentLayer); |
| 2409 Vector<WebCore::LayoutRect>* iterValue; |
2409 if (iter == layerRects.end()) | 2410 if (iter == layerRects.end()) |
2410 iter = layerRects.add(currentLayer, Vector<LayoutRect>()).iterator; | 2411 iterValue = &layerRects.add(currentLayer, Vector<LayoutRect>()).iterator
->value; |
| 2412 else |
| 2413 iterValue = &iter->value; |
2411 for (size_t i = 0; i < ownRects.size(); i++) { | 2414 for (size_t i = 0; i < ownRects.size(); i++) { |
2412 if (!containerRect.contains(ownRects[i])) { | 2415 if (!containerRect.contains(ownRects[i])) { |
2413 iter->value.append(ownRects[i]); | 2416 iterValue->append(ownRects[i]); |
2414 if (iter->value.size() > maxRectsPerLayer) { | 2417 if (iterValue->size() > maxRectsPerLayer) { |
2415 // Just mark the entire layer instead, and switch to walking the
layer | 2418 // Just mark the entire layer instead, and switch to walking the
layer |
2416 // tree instead of the render tree. | 2419 // tree instead of the render tree. |
2417 layerRects.remove(currentLayer); | 2420 layerRects.remove(currentLayer); |
2418 currentLayer->addLayerHitTestRects(layerRects); | 2421 currentLayer->addLayerHitTestRects(layerRects); |
2419 return; | 2422 return; |
2420 } | 2423 } |
2421 if (newContainerRect.isEmpty()) | 2424 if (newContainerRect.isEmpty()) |
2422 newContainerRect = ownRects[i]; | 2425 newContainerRect = ownRects[i]; |
2423 } | 2426 } |
2424 } | 2427 } |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3385 { | 3388 { |
3386 if (object1) { | 3389 if (object1) { |
3387 const WebCore::RenderObject* root = object1; | 3390 const WebCore::RenderObject* root = object1; |
3388 while (root->parent()) | 3391 while (root->parent()) |
3389 root = root->parent(); | 3392 root = root->parent(); |
3390 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3393 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3391 } | 3394 } |
3392 } | 3395 } |
3393 | 3396 |
3394 #endif | 3397 #endif |
OLD | NEW |