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

Unified Diff: third_party/WebKit/Source/core/input/EventHandlerTest.cpp

Issue 2308333002: Call SelectionController().sendContextMenuEvent() with up-to-date layout tree (Closed)
Patch Set: Created 4 years, 3 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 | « third_party/WebKit/Source/core/input/EventHandler.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/input/EventHandlerTest.cpp
diff --git a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
index ceef2be019e2cb1bdf7a2614319767e08b243576..eab65dce046b50f1852b9018bd032071cb2d3974 100644
--- a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
@@ -10,6 +10,7 @@
#include "core/editing/FrameSelection.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
+#include "core/frame/Settings.h"
#include "core/page/AutoscrollController.h"
#include "core/page/Page.h"
#include "core/testing/DummyPageHolder.h"
@@ -240,4 +241,31 @@ TEST_F(EventHandlerTest, draggedSVGImagePositionTest)
EXPECT_EQ(IntPoint(45, 44), document().frame()->eventHandler().dragDataTransferLocationForTesting());
}
+// Regression test for http://crbug.com/641403 to verify we use up-to-date
+// layout tree for dispatching "contextmenu" event.
+TEST_F(EventHandlerTest, sendContextMenuEventWithHover)
+{
+ setHtmlInnerHTML(
+ "<style>*:hover { color: red; }</style>"
+ "<div>foo</div>");
+ document().settings()->setScriptEnabled(true);
+ Element* script = document().createElement("script", ASSERT_NO_EXCEPTION);
+ script->setInnerHTML(
+ "document.addEventListener('contextmenu', event => event.preventDefault());",
+ ASSERT_NO_EXCEPTION);
+ document().body()->appendChild(script);
+ document().frame()->selection().setSelection(
+ VisibleSelection(Position(document().body(), 0)));
+ PlatformMouseEvent mouseDownEvent(
+ IntPoint(0, 0),
+ IntPoint(100, 200),
+ WebPointerProperties::Button::Right,
+ PlatformEvent::MousePressed,
+ 1,
+ PlatformEvent::Modifiers::RightButtonDown,
+ WTF::monotonicallyIncreasingTime());
+ EXPECT_EQ(WebInputEventResult::HandledApplication,
+ document().frame()->eventHandler().sendContextMenuEvent(mouseDownEvent));
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698