Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index 8950dc3b2d2647704a6ae4ac86380e3a8e6bbe47..cdb404ac9b852a2683b7b0f2ec7dcf9eef814575 100644 |
--- a/Source/core/dom/Document.cpp |
+++ b/Source/core/dom/Document.cpp |
@@ -2796,7 +2796,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); |