Closed Bug 395426 Opened 15 years ago Closed 15 years ago

Contextmenu opened using keyboard should have .button == 0

Categories

(Core :: DOM: Events, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: smaug, Assigned: smaug)

References

Details

(Keywords: regression)

Attachments

(2 files)

Attached file testcase
This is a regression from Bug 354694.
Because 1.8 reports .button == 0, I think we should keep that functionality.
Blocks: 387109
Attached patch proposed patchSplinter Review
Neil, could you test this on Windows.
Attachment #280100 - Flags: review?(enndeakin)
Flags: blocking1.9?
Automated tests
http://www.mozilla.pettay.fi/moztests/context_for_local_testing.xhtml
though, that is just testing windowutils.
Comment on attachment 280100 [details] [diff] [review]
proposed patch

>-      button = eRightButton;
>+      button = (context == eNormal) ? eRightButton : eLeftButton;
>     }
>   }
> #ifdef NS_DEBUG
>   ~nsMouseEvent() {
>-    NS_WARN_IF_FALSE(message != NS_CONTEXTMENU || button == eRightButton,
>+    NS_WARN_IF_FALSE(message != NS_CONTEXTMENU ||
>+                     button ==
>+                       ((context == eNormal) ? eRightButton : eLeftButton),

I think these checks would be easier to understand if there were written as:

(context == eContextMenuKey) ? eLeftButton : eRightButton
Attachment #280100 - Flags: review?(enndeakin) → review+
Attachment #280100 - Flags: superreview?(jst)
Attachment #280100 - Flags: superreview?(jst) → superreview+
Attachment #280100 - Flags: approval1.9?
Attachment #280100 - Flags: approval1.9? → approval1.9+
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Flags: blocking1.9?
You need to log in before you can comment on or make changes to this bug.