mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 590819 Click event isn't fired when mouse button down on border of <input> and mouse button up on padding box of it r=smaug, a2.0=jst
This commit is contained in:
parent
f849918830
commit
ce5c3032a2
@ -3945,16 +3945,17 @@ nsEventStateManager::SetClickCount(nsPresContext* aPresContext,
|
||||
{
|
||||
nsCOMPtr<nsIContent> mouseContent;
|
||||
mCurrentTarget->GetContentForEvent(aPresContext, aEvent, getter_AddRefs(mouseContent));
|
||||
nsIContent* mouseContentParent = GetParentContentForMouseTarget(mouseContent);
|
||||
|
||||
switch (aEvent->button) {
|
||||
case nsMouseEvent::eLeftButton:
|
||||
if (aEvent->message == NS_MOUSE_BUTTON_DOWN) {
|
||||
mLastLeftMouseDownContent = mouseContent;
|
||||
mLastLeftMouseDownContentParent =
|
||||
GetParentContentForMouseTarget(mouseContent);
|
||||
mLastLeftMouseDownContentParent = mouseContentParent;
|
||||
} else if (aEvent->message == NS_MOUSE_BUTTON_UP) {
|
||||
if (mLastLeftMouseDownContent == mouseContent ||
|
||||
mLastLeftMouseDownContentParent == mouseContent) {
|
||||
mLastLeftMouseDownContentParent == mouseContent ||
|
||||
mLastLeftMouseDownContent == mouseContentParent) {
|
||||
aEvent->clickCount = mLClickCount;
|
||||
mLClickCount = 0;
|
||||
} else {
|
||||
@ -3968,11 +3969,11 @@ nsEventStateManager::SetClickCount(nsPresContext* aPresContext,
|
||||
case nsMouseEvent::eMiddleButton:
|
||||
if (aEvent->message == NS_MOUSE_BUTTON_DOWN) {
|
||||
mLastMiddleMouseDownContent = mouseContent;
|
||||
mLastMiddleMouseDownContentParent =
|
||||
GetParentContentForMouseTarget(mouseContent);
|
||||
mLastMiddleMouseDownContentParent = mouseContentParent;
|
||||
} else if (aEvent->message == NS_MOUSE_BUTTON_UP) {
|
||||
if (mLastMiddleMouseDownContent == mouseContent ||
|
||||
mLastMiddleMouseDownContentParent == mouseContent) {
|
||||
mLastMiddleMouseDownContentParent == mouseContent ||
|
||||
mLastLeftMouseDownContent == mouseContentParent) {
|
||||
aEvent->clickCount = mMClickCount;
|
||||
mMClickCount = 0;
|
||||
} else {
|
||||
@ -3986,11 +3987,11 @@ nsEventStateManager::SetClickCount(nsPresContext* aPresContext,
|
||||
case nsMouseEvent::eRightButton:
|
||||
if (aEvent->message == NS_MOUSE_BUTTON_DOWN) {
|
||||
mLastRightMouseDownContent = mouseContent;
|
||||
mLastRightMouseDownContentParent =
|
||||
GetParentContentForMouseTarget(mouseContent);
|
||||
mLastRightMouseDownContentParent = mouseContentParent;
|
||||
} else if (aEvent->message == NS_MOUSE_BUTTON_UP) {
|
||||
if (mLastRightMouseDownContent == mouseContent ||
|
||||
mLastRightMouseDownContentParent == mouseContent) {
|
||||
mLastRightMouseDownContentParent == mouseContent ||
|
||||
mLastLeftMouseDownContent == mouseContentParent) {
|
||||
aEvent->clickCount = mRClickCount;
|
||||
mRClickCount = 0;
|
||||
} else {
|
||||
|
@ -91,6 +91,7 @@ _TEST_FILES = \
|
||||
test_bug547996-2.xhtml \
|
||||
test_bug556493.html \
|
||||
test_bug586961.xul \
|
||||
test_clickevent_on_input.html \
|
||||
$(NULL)
|
||||
|
||||
#bug 585630
|
||||
|
56
content/events/test/test_clickevent_on_input.html
Normal file
56
content/events/test/test_clickevent_on_input.html
Normal file
@ -0,0 +1,56 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test click event on input</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/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>
|
||||
<p id="display">
|
||||
<input id="input"
|
||||
style="position: absolute; top: 5px; left: 5px; border: solid 15px blue; width: 100px; height: 20px;"
|
||||
onclick="gClickCount++;">
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
var gClickCount = 0;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(runTests);
|
||||
|
||||
function runTests()
|
||||
{
|
||||
var input = document.getElementById("input");
|
||||
// click on border of input
|
||||
synthesizeMouse(input, 5, 5, { });
|
||||
is(gClickCount, 1, "click event doesn't fired on input element");
|
||||
|
||||
gClickCount = 0;
|
||||
// down on border
|
||||
synthesizeMouse(input, 5, 5, { type: "mousedown" });
|
||||
// up on anonymous div of input
|
||||
synthesizeMouse(input, 20, 20, { type: "mouseup" });
|
||||
is(gClickCount, 1, "click event doesn't fired on input element");
|
||||
|
||||
gClickCount = 0;
|
||||
// down on anonymous div of input
|
||||
synthesizeMouse(input, 20, 20, { type: "mousedown" });
|
||||
// up on border
|
||||
synthesizeMouse(input, 5, 5, { type: "mouseup" });
|
||||
is(gClickCount, 1, "click event doesn't fired on input element");
|
||||
|
||||
input.style.display = "none";
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user