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

Unified Diff: Source/core/dom/Document.cpp

Issue 15425005: Don't force layout for mouse event hit tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 37f883c06ca96dcc9d15e46a6924442caa9d388e..c87b5a5f3f9aa4b373e81bcd83a4529b8ead2ea9 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -2800,7 +2800,13 @@ MouseEventWithHitTestResults Document::prepareMouseEvent(const HitTestRequest& r
{
ASSERT(!renderer() || renderer()->isRenderView());
- if (!renderer())
+ // RenderView::hitTest causes a layout, and we don't want to hit that until the first
+ // layout because until then, there is nothing shown on the screen - the user can't
+ // have intentionally clicked on something belonging to this page. Furthermore,
+ // mousemove events before the first layout should not lead to a premature layout()
+ // happening, which could show a flash of white.
+ // See also the similar code in EventHandler::hitTestResultAtPoint.
+ if (!renderer() || !view() || !view()->didFirstLayout())
return MouseEventWithHitTestResults(event, HitTestResult(LayoutPoint()));
HitTestResult result(documentPoint);

Powered by Google App Engine
This is Rietveld 408576698