зеркало из https://github.com/mozilla/gecko-dev.git
Bug 761572. Allow click and dblclick events to be sent to an element even if it's made display:none during the mouseup event. r=smaug
This commit is contained in:
Родитель
9b9514fae9
Коммит
2670c30a0b
|
@ -3175,10 +3175,10 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
|||
if (!mCurrentTarget) {
|
||||
GetEventTarget();
|
||||
}
|
||||
if (mCurrentTarget) {
|
||||
ret = CheckForAndDispatchClick(presContext, (nsMouseEvent*)aEvent,
|
||||
aStatus);
|
||||
}
|
||||
// Make sure to dispatch the click even if there is no frame for
|
||||
// the current target element. This is required for Web compatibility.
|
||||
ret = CheckForAndDispatchClick(presContext, (nsMouseEvent*)aEvent,
|
||||
aStatus);
|
||||
}
|
||||
|
||||
nsIPresShell *shell = presContext->GetPresShell();
|
||||
|
|
|
@ -595,6 +595,10 @@ private:
|
|||
static void operator delete(void* /*memory*/) {}
|
||||
};
|
||||
|
||||
#define NS_EVENT_NEEDS_FRAME(event) (!NS_IS_ACTIVATION_EVENT(event))
|
||||
// Click and double-click events need to be handled even for content that
|
||||
// has no frame. This is required for Web compatibility.
|
||||
#define NS_EVENT_NEEDS_FRAME(event) \
|
||||
(!NS_IS_ACTIVATION_EVENT(event) && (event)->message != NS_MOUSE_CLICK && \
|
||||
(event)->message != NS_MOUSE_DOUBLECLICK)
|
||||
|
||||
#endif // nsEventStateManager_h__
|
||||
|
|
|
@ -6383,7 +6383,7 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus)
|
|||
rv = manager->PreHandleEvent(mPresContext, aEvent, mCurrentEventFrame, aStatus);
|
||||
|
||||
// 2. Give event to the DOM for third party and JS use.
|
||||
if (GetCurrentEventFrame() && NS_SUCCEEDED(rv)) {
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
bool wasHandlingKeyBoardEvent =
|
||||
nsContentUtils::IsHandlingKeyBoardEvent();
|
||||
if (aEvent->eventStructType == NS_KEY_EVENT) {
|
||||
|
|
|
@ -154,6 +154,7 @@ _TEST_FILES = \
|
|||
test_bug718809.html \
|
||||
test_bug725426.html \
|
||||
test_bug731777.html \
|
||||
test_bug761572.html \
|
||||
$(NULL)
|
||||
|
||||
# Tests for bugs 441782, 467672 and 570378 don't pass reliably on Windows, because of bug 469208
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=761572
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 761572</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=761572">Mozilla Bug 761572</a>
|
||||
<div id="content">
|
||||
<div id="d" style="background:lime; width:50px; height:50px" onmouseup="doUp()" onclick="doClick()"></div>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var d = document.getElementById("d");
|
||||
|
||||
function doUp() {
|
||||
d.style.display = "none";
|
||||
}
|
||||
function doClick() {
|
||||
ok(true, "Check click received");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function doTest() {
|
||||
// synthesizes a mousedown/mouseup pair
|
||||
synthesizeMouse(d, 10, 10, {});
|
||||
}
|
||||
|
||||
SimpleTest.waitForFocus(doTest);
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче