Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 { | 95 { |
| 96 TRACE_EVENT_BEGIN0("blink,devtools.timeline", "HitTest"); | 96 TRACE_EVENT_BEGIN0("blink,devtools.timeline", "HitTest"); |
| 97 m_hitTestCount++; | 97 m_hitTestCount++; |
| 98 | 98 |
| 99 ASSERT(!result.hitTestLocation().isRectBasedTest() || result.hitTestRequest( ).listBased()); | 99 ASSERT(!result.hitTestLocation().isRectBasedTest() || result.hitTestRequest( ).listBased()); |
| 100 | 100 |
| 101 commitPendingSelection(); | 101 commitPendingSelection(); |
| 102 | 102 |
| 103 uint64_t domTreeVersion = document().domTreeVersion(); | 103 uint64_t domTreeVersion = document().domTreeVersion(); |
| 104 HitTestResult cacheResult = result; | 104 HitTestResult cacheResult = result; |
| 105 bool cacheHit = m_hitTestCache->lookupCachedResult(cacheResult, domTreeVersi on); | 105 bool hitLayer = false; |
| 106 bool hitLayer = layer()->hitTest(result); | 106 if (m_hitTestCache->lookupCachedResult(cacheResult, domTreeVersion)) { |
| 107 m_hitTestCacheHits++; | |
| 108 hitLayer = true; | |
| 109 #if ENABLE(ASSERT) | |
| 110 m_hitTestCache->verifyCachedResult(result, cacheResult); | |
| 111 #endif | |
| 112 result = cacheResult; | |
| 113 } else { | |
| 114 hitLayer = layer()->hitTest(result); | |
| 107 | 115 |
| 108 // FrameView scrollbars are not the same as Layer scrollbars tested by Layer ::hitTestOverflowControls, | 116 // FrameView scrollbars are not the same as Layer scrollbars tested by L ayer::hitTestOverflowControls, |
| 109 // so we need to test FrameView scrollbars separately here. Note that it's i mportant we do this after | 117 // so we need to test FrameView scrollbars separately here. Note that it 's important we do this after |
| 110 // the hit test above, because that may overwrite the entire HitTestResult w hen it finds a hit. | 118 // the hit test above, because that may overwrite the entire HitTestResu lt when it finds a hit. |
| 111 IntPoint framePoint = frameView()->contentsToFrame(result.hitTestLocation(). roundedPoint()); | 119 IntPoint framePoint = frameView()->contentsToFrame(result.hitTestLocatio n().roundedPoint()); |
| 112 if (Scrollbar* frameScrollbar = frameView()->scrollbarAtFramePoint(framePoin t)) | 120 if (Scrollbar* frameScrollbar = frameView()->scrollbarAtFramePoint(frame Point)) |
| 113 result.setScrollbar(frameScrollbar); | 121 result.setScrollbar(frameScrollbar); |
| 114 | 122 |
| 115 if (cacheHit) { | 123 if (hitLayer) |
| 116 m_hitTestCacheHits++; | 124 m_hitTestCache->addCachedResult(result, domTreeVersion); |
| 117 m_hitTestCache->verifyCachedResult(result, cacheResult); | |
|
dtapuska
2015/08/17 21:23:14
verifyCacheResult logs some UMA metrics. rbyers@ i
esprehn
2015/08/18 20:27:41
Please delete the code for now and add it back lat
dtapuska
2015/08/18 20:56:34
Done.
| |
| 118 } | 125 } |
| 119 | 126 |
| 120 if (hitLayer) | |
| 121 m_hitTestCache->addCachedResult(result, domTreeVersion); | |
| 122 | |
| 123 TRACE_EVENT_END1("blink,devtools.timeline", "HitTest", "endData", InspectorH itTestEvent::endData(result.hitTestRequest(), result.hitTestLocation(), result)) ; | 127 TRACE_EVENT_END1("blink,devtools.timeline", "HitTest", "endData", InspectorH itTestEvent::endData(result.hitTestRequest(), result.hitTestLocation(), result)) ; |
| 124 return hitLayer; | 128 return hitLayer; |
| 125 } | 129 } |
| 126 | 130 |
| 127 void LayoutView::clearHitTestCache() | 131 void LayoutView::clearHitTestCache() |
| 128 { | 132 { |
| 129 m_hitTestCache->clear(); | 133 m_hitTestCache->clear(); |
| 130 if (LayoutPart* frameLayoutObject = frame()->ownerLayoutObject()) | 134 if (LayoutPart* frameLayoutObject = frame()->ownerLayoutObject()) |
| 131 frameLayoutObject->view()->clearHitTestCache(); | 135 frameLayoutObject->view()->clearHitTestCache(); |
| 132 } | 136 } |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1005 return viewHeight(IncludeScrollbars) / scale; | 1009 return viewHeight(IncludeScrollbars) / scale; |
| 1006 } | 1010 } |
| 1007 | 1011 |
| 1008 void LayoutView::willBeDestroyed() | 1012 void LayoutView::willBeDestroyed() |
| 1009 { | 1013 { |
| 1010 LayoutBlockFlow::willBeDestroyed(); | 1014 LayoutBlockFlow::willBeDestroyed(); |
| 1011 m_compositor.clear(); | 1015 m_compositor.clear(); |
| 1012 } | 1016 } |
| 1013 | 1017 |
| 1014 } // namespace blink | 1018 } // namespace blink |
| OLD | NEW |