Commit 142488d3 authored by Edgar Chen's avatar Edgar Chen
Browse files

Bug 1677334 - Part 2: Remove Mac-specific check for click event on xul frame; r=NeilDeakin

Now we won't dispatch click event at all when ctrl key is pressed on Mac, so we
don't need those Mac-specific checks.

This patch reverts part of https://hg.mozilla.org/mozilla-central/rev/d8726d18021e
and revise the tests accordingly.

Differential Revision: https://phabricator.services.mozilla.com/D110608
parent 20e4184d
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -4,15 +4,6 @@
"use strict";

add_task(async function test_character_encoding_menu() {
  // On macOS, ctrl-click shouldn't open the panel because this normally opens
  // the context menu. This happens via the `contextmenu` event which is created
  // by widget code, so our simulated clicks do not do so, so we can't test
  // anything on macOS.
  if (AppConstants.platform == "macosx") {
    ok(true, "The test is ignored on Mac");
    return;
  }

  CustomizableUI.addWidgetToArea(
    "characterencoding-button",
    CustomizableUI.AREA_NAVBAR,
+0 −10
Original line number Diff line number Diff line
@@ -59,16 +59,6 @@ add_task(async function test_clickData() {

    for (let modifier of Object.keys(map)) {
      for (let i = 0; i < 2; i++) {
        // On Mac, ctrl-click will send a context menu event from the widget,
        // we won't send xul command event and won't have onClick message, either.
        if (
          AppConstants.platform == "macosx" &&
          i == 0 &&
          modifier == "ctrlKey"
        ) {
          continue;
        }

        let clickEventData = { button: i };
        clickEventData[modifier] = true;
        await clickBrowserAction(extension, window, clickEventData);
+1 −9
Original line number Diff line number Diff line
@@ -155,15 +155,7 @@ nsresult nsButtonBoxFrame::HandleEvent(nsPresContext* aPresContext,

    case eMouseClick: {
      WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();

      if (mouseEvent->IsLeftClickEvent()
#ifdef XP_MACOSX
          // On Mac, ctrl-click will send a context menu event from the widget,
          // so we don't want to dispatch widget command if it is redispatched
          // from the mouse event with ctrl key is pressed.
          && !mouseEvent->IsControl()
#endif
      ) {
      if (mouseEvent->IsLeftClickEvent()) {
        MouseClicked(mouseEvent);
      }
      break;
+1 −8
Original line number Diff line number Diff line
@@ -286,14 +286,7 @@ nsresult nsResizerFrame::HandleEvent(nsPresContext* aPresContext,

    case eMouseClick: {
      WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
      if (mouseEvent->IsLeftClickEvent()
#ifdef XP_MACOSX
          // On Mac, ctrl-click will send a context menu event from the widget,
          // so we don't want to dispatch widget command if it is redispatched
          // from the mouse event with ctrl key is pressed.
          && !mouseEvent->IsControl()
#endif
      ) {
      if (mouseEvent->IsLeftClickEvent()) {
        MouseClicked(mouseEvent);
      }
      break;
+1 −8
Original line number Diff line number Diff line
@@ -134,14 +134,7 @@ nsresult nsTitleBarFrame::HandleEvent(nsPresContext* aPresContext,

    case eMouseClick: {
      WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
      if (mouseEvent->IsLeftClickEvent()
#ifdef XP_MACOSX
          // On Mac, ctrl-click will send a context menu event from the widget,
          // so we don't want to dispatch widget command if it is redispatched
          // from the mouse event with ctrl key is pressed.
          && !mouseEvent->IsControl()
#endif
      ) {
      if (mouseEvent->IsLeftClickEvent()) {
        MouseClicked(mouseEvent);
      }
      break;
Loading