OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/layout/HitTestCache.h" | 5 #include "core/layout/HitTestCache.h" |
6 | 6 |
7 #include "platform/Histogram.h" | 7 #include "platform/Histogram.h" |
8 #include "public/platform/Platform.h" | 8 #include "public/platform/Platform.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 29 matching lines...) Expand all Loading... |
40 return result; | 40 return result; |
41 } | 41 } |
42 | 42 |
43 void HitTestCache::addCachedResult(const HitTestResult& result, | 43 void HitTestCache::addCachedResult(const HitTestResult& result, |
44 uint64_t domTreeVersion) { | 44 uint64_t domTreeVersion) { |
45 if (!result.isCacheable()) | 45 if (!result.isCacheable()) |
46 return; | 46 return; |
47 | 47 |
48 // If the result was a hit test on an LayoutPart and the request allowed | 48 // If the result was a hit test on an LayoutPart and the request allowed |
49 // querying of the layout part; then the part hasn't been loaded yet. | 49 // querying of the layout part; then the part hasn't been loaded yet. |
50 if (result.isOverWidget() && | 50 if (result.isOverFrameViewBase() && |
51 result.hitTestRequest().allowsChildFrameContent()) | 51 result.hitTestRequest().allowsChildFrameContent()) |
52 return; | 52 return; |
53 | 53 |
54 // For now don't support rect based or list based requests. | 54 // For now don't support rect based or list based requests. |
55 if (result.hitTestLocation().isRectBasedTest() || | 55 if (result.hitTestLocation().isRectBasedTest() || |
56 result.hitTestRequest().listBased()) | 56 result.hitTestRequest().listBased()) |
57 return; | 57 return; |
58 if (domTreeVersion != m_domTreeVersion) | 58 if (domTreeVersion != m_domTreeVersion) |
59 clear(); | 59 clear(); |
60 if (m_items.size() < HIT_TEST_CACHE_SIZE) | 60 if (m_items.size() < HIT_TEST_CACHE_SIZE) |
(...skipping 10 matching lines...) Expand all Loading... |
71 void HitTestCache::clear() { | 71 void HitTestCache::clear() { |
72 m_updateIndex = 0; | 72 m_updateIndex = 0; |
73 m_items.clear(); | 73 m_items.clear(); |
74 } | 74 } |
75 | 75 |
76 DEFINE_TRACE(HitTestCache) { | 76 DEFINE_TRACE(HitTestCache) { |
77 visitor->trace(m_items); | 77 visitor->trace(m_items); |
78 } | 78 } |
79 | 79 |
80 } // namespace blink | 80 } // namespace blink |
OLD | NEW |