| Index: Source/core/layout/LayoutView.cpp
|
| diff --git a/Source/core/layout/LayoutView.cpp b/Source/core/layout/LayoutView.cpp
|
| index 72da1bc1a320550cbf9401be221cc8dd4a2d5d42..ead1a72bd8ad37997767b150530e9dbe55d0e8d1 100644
|
| --- a/Source/core/layout/LayoutView.cpp
|
| +++ b/Source/core/layout/LayoutView.cpp
|
| @@ -102,24 +102,25 @@ bool LayoutView::hitTestNoLifecycleUpdate(HitTestResult& result)
|
|
|
| uint64_t domTreeVersion = document().domTreeVersion();
|
| HitTestResult cacheResult = result;
|
| - bool cacheHit = m_hitTestCache->lookupCachedResult(cacheResult, domTreeVersion);
|
| - bool hitLayer = layer()->hitTest(result);
|
| + bool hitLayer = false;
|
| + if (m_hitTestCache->lookupCachedResult(cacheResult, domTreeVersion)) {
|
| + m_hitTestCacheHits++;
|
| + hitLayer = true;
|
| + result = cacheResult;
|
| + } else {
|
| + hitLayer = layer()->hitTest(result);
|
|
|
| - // FrameView scrollbars are not the same as Layer scrollbars tested by Layer::hitTestOverflowControls,
|
| - // so we need to test FrameView scrollbars separately here. Note that it's important we do this after
|
| - // the hit test above, because that may overwrite the entire HitTestResult when it finds a hit.
|
| - IntPoint framePoint = frameView()->contentsToFrame(result.hitTestLocation().roundedPoint());
|
| - if (Scrollbar* frameScrollbar = frameView()->scrollbarAtFramePoint(framePoint))
|
| - result.setScrollbar(frameScrollbar);
|
| + // FrameView scrollbars are not the same as Layer scrollbars tested by Layer::hitTestOverflowControls,
|
| + // so we need to test FrameView scrollbars separately here. Note that it's important we do this after
|
| + // the hit test above, because that may overwrite the entire HitTestResult when it finds a hit.
|
| + IntPoint framePoint = frameView()->contentsToFrame(result.hitTestLocation().roundedPoint());
|
| + if (Scrollbar* frameScrollbar = frameView()->scrollbarAtFramePoint(framePoint))
|
| + result.setScrollbar(frameScrollbar);
|
|
|
| - if (cacheHit) {
|
| - m_hitTestCacheHits++;
|
| - m_hitTestCache->verifyCachedResult(result, cacheResult);
|
| + if (hitLayer)
|
| + m_hitTestCache->addCachedResult(result, domTreeVersion);
|
| }
|
|
|
| - if (hitLayer)
|
| - m_hitTestCache->addCachedResult(result, domTreeVersion);
|
| -
|
| TRACE_EVENT_END1("blink,devtools.timeline", "HitTest", "endData", InspectorHitTestEvent::endData(result.hitTestRequest(), result.hitTestLocation(), result));
|
| return hitLayer;
|
| }
|
|
|