Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(701)

Unified Diff: Source/core/layout/LayoutView.cpp

Issue 1294913004: Enable HitTestCache by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix layout test Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/HitTestResult.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « Source/core/layout/HitTestResult.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698