dom/xul/nsXULPopupListener.h
author Ted Mielczarek <ted@mielczarek.org>
Thu, 14 Dec 2017 10:20:33 -0600
changeset 448896 b5c9bb05168d5ce9c92f500d25516b19d0a3062a
parent 416428 6a629adbb62a299d7208373d1c6f375149d2afdb
child 449186 e43f568b3e9a9e7a83bc7d15b28d23dc55960819
permissions -rw-r--r--
bug 1401647 - use a 64-bit Rust toolchain for win32 builds. r=rillian We currently use a 32-bit Rust toolchain for win32 builds, but this can lead to OOM situations. This patch makes win32 builds use a 64-bit Rust toolchain, which requires a little bit of extra configuration because rustc needs to be able to find a link.exe that produces 64-bit binaries for building things like build scripts, which are host binaries. We will now generate a batch file that sets LIB to the paths to 64-bit libraries and invokes the x64-targeting link.exe, and add a section to the .cargo/config file to instruct cargo to use that batch file as the linker when producing 64-bit binaries. MozReview-Commit-ID: 9vKBbm7Gvra

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/**
 * This is the popup listener implementation for popup menus and context menus.
 */

#ifndef nsXULPopupListener_h___
#define nsXULPopupListener_h___

#include "nsCOMPtr.h"

#include "mozilla/dom/Element.h"
#include "nsIDOMElement.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMEventListener.h"
#include "nsCycleCollectionParticipant.h"

class nsXULPopupListener : public nsIDOMEventListener
{
public:
    // aElement is the element that the popup is attached to. If aIsContext is
    // false, the popup opens on left click on aElement or a descendant. If
    // aIsContext is true, the popup is a context menu which opens on a
    // context menu event.
    nsXULPopupListener(mozilla::dom::Element* aElement, bool aIsContext);

    // nsISupports
    NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    NS_DECL_CYCLE_COLLECTION_SKIPPABLE_CLASS(nsXULPopupListener)
    NS_DECL_NSIDOMEVENTLISTENER

protected:
    virtual ~nsXULPopupListener(void);

    // open the popup. aEvent is the event that triggered the popup such as
    // a mouse click and aTargetContent is the target of this event.
    virtual nsresult LaunchPopup(nsIDOMEvent* aEvent, nsIContent* aTargetContent);

    // close the popup when the listener goes away
    virtual void ClosePopup();

private:
#ifndef NS_CONTEXT_MENU_IS_MOUSEUP
    // When a context menu is opened, focus the target of the contextmenu event.
    nsresult FireFocusOnTargetContent(nsIDOMNode* aTargetNode, bool aIsTouch);
#endif

    // |mElement| is the node to which this listener is attached.
    nsCOMPtr<mozilla::dom::Element> mElement;

    // The popup that is getting shown on top of mElement.
    nsCOMPtr<nsIContent> mPopupContent;

    // true if a context popup
    bool mIsContext;
};

#endif // nsXULPopupListener_h___