layout/xul/nsMenuPopupFrame.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/xul/nsMenuPopupFrame.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,492 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +//
    1.10 +// nsMenuPopupFrame
    1.11 +//
    1.12 +
    1.13 +#ifndef nsMenuPopupFrame_h__
    1.14 +#define nsMenuPopupFrame_h__
    1.15 +
    1.16 +#include "mozilla/Attributes.h"
    1.17 +#include "nsIAtom.h"
    1.18 +#include "nsGkAtoms.h"
    1.19 +#include "nsCOMPtr.h"
    1.20 +#include "nsMenuFrame.h"
    1.21 +
    1.22 +#include "nsBoxFrame.h"
    1.23 +#include "nsMenuParent.h"
    1.24 +
    1.25 +#include "nsITimer.h"
    1.26 +
    1.27 +class nsIWidget;
    1.28 +
    1.29 +// XUL popups can be in several different states. When opening a popup, the
    1.30 +// state changes as follows:
    1.31 +//   ePopupClosed - initial state
    1.32 +//   ePopupShowing - during the period when the popupshowing event fires
    1.33 +//   ePopupOpen - between the popupshowing event and being visible. Creation
    1.34 +//                of the child frames, layout and reflow occurs in this state.
    1.35 +//   ePopupOpenAndVisible - layout is done and the popup's view and widget are
    1.36 +//                          made visible. The popupshown event fires.
    1.37 +// When closing a popup:
    1.38 +//   ePopupHidden - during the period when the popuphiding event fires and
    1.39 +//                  the popup is removed.
    1.40 +//   ePopupClosed - the popup's widget is made invisible.
    1.41 +enum nsPopupState {
    1.42 +  // state when a popup is not open
    1.43 +  ePopupClosed,
    1.44 +  // state from when a popup is requested to be shown to after the
    1.45 +  // popupshowing event has been fired.
    1.46 +  ePopupShowing,
    1.47 +  // state while a popup is open but the widget is not yet visible
    1.48 +  ePopupOpen,
    1.49 +  // state while a popup is open and visible on screen
    1.50 +  ePopupOpenAndVisible,
    1.51 +  // state from when a popup is requested to be hidden to when it is closed.
    1.52 +  ePopupHiding,
    1.53 +  // state which indicates that the popup was hidden without firing the
    1.54 +  // popuphiding or popuphidden events. It is used when executing a menu
    1.55 +  // command because the menu needs to be hidden before the command event
    1.56 +  // fires, yet the popuphiding and popuphidden events are fired after. This
    1.57 +  // state can also occur when the popup is removed because the document is
    1.58 +  // unloaded.
    1.59 +  ePopupInvisible
    1.60 +};
    1.61 +
    1.62 +// How a popup may be flipped. Flipping to the outside edge is like how
    1.63 +// a submenu would work. The entire popup is flipped to the opposite side
    1.64 +// of the anchor.
    1.65 +enum FlipStyle {
    1.66 +  FlipStyle_None = 0,
    1.67 +  FlipStyle_Outside = 1,
    1.68 +  FlipStyle_Inside = 2
    1.69 +};
    1.70 +
    1.71 +// Values for the flip attribute
    1.72 +enum FlipType {
    1.73 +  FlipType_Default = 0,
    1.74 +  FlipType_None = 1,    // don't try to flip or translate to stay onscreen
    1.75 +  FlipType_Both = 2,    // flip in both directions
    1.76 +  FlipType_Slide = 3    // allow the arrow to "slide" instead of resizing
    1.77 +};
    1.78 +
    1.79 +// values are selected so that the direction can be flipped just by
    1.80 +// changing the sign
    1.81 +#define POPUPALIGNMENT_NONE 0
    1.82 +#define POPUPALIGNMENT_TOPLEFT 1
    1.83 +#define POPUPALIGNMENT_TOPRIGHT -1
    1.84 +#define POPUPALIGNMENT_BOTTOMLEFT 2
    1.85 +#define POPUPALIGNMENT_BOTTOMRIGHT -2
    1.86 +
    1.87 +#define POPUPALIGNMENT_LEFTCENTER 16
    1.88 +#define POPUPALIGNMENT_RIGHTCENTER -16
    1.89 +#define POPUPALIGNMENT_TOPCENTER 17
    1.90 +#define POPUPALIGNMENT_BOTTOMCENTER 18
    1.91 +
    1.92 +// The constants here are selected so that horizontally and vertically flipping
    1.93 +// can be easily handled using the two flip macros below.
    1.94 +#define POPUPPOSITION_UNKNOWN -1
    1.95 +#define POPUPPOSITION_BEFORESTART 0
    1.96 +#define POPUPPOSITION_BEFOREEND 1
    1.97 +#define POPUPPOSITION_AFTERSTART 2
    1.98 +#define POPUPPOSITION_AFTEREND 3
    1.99 +#define POPUPPOSITION_STARTBEFORE 4
   1.100 +#define POPUPPOSITION_ENDBEFORE 5
   1.101 +#define POPUPPOSITION_STARTAFTER 6
   1.102 +#define POPUPPOSITION_ENDAFTER 7
   1.103 +#define POPUPPOSITION_OVERLAP 8
   1.104 +#define POPUPPOSITION_AFTERPOINTER 9
   1.105 +
   1.106 +#define POPUPPOSITION_HFLIP(v) (v ^ 1)
   1.107 +#define POPUPPOSITION_VFLIP(v) (v ^ 2)
   1.108 +
   1.109 +#define INC_TYP_INTERVAL  1000  // 1s. If the interval between two keypresses is shorter than this, 
   1.110 +                                //   treat as a continue typing
   1.111 +// XXX, kyle.yuan@sun.com, there are 4 definitions for the same purpose:
   1.112 +//  nsMenuPopupFrame.h, nsListControlFrame.cpp, listbox.xml, tree.xml
   1.113 +//  need to find a good place to put them together.
   1.114 +//  if someone changes one, please also change the other.
   1.115 +
   1.116 +#define CONTEXT_MENU_OFFSET_PIXELS 2
   1.117 +
   1.118 +nsIFrame* NS_NewMenuPopupFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
   1.119 +
   1.120 +class nsViewManager;
   1.121 +class nsView;
   1.122 +class nsMenuPopupFrame;
   1.123 +
   1.124 +class nsMenuPopupFrame : public nsBoxFrame, public nsMenuParent
   1.125 +{
   1.126 +public:
   1.127 +  NS_DECL_QUERYFRAME_TARGET(nsMenuPopupFrame)
   1.128 +  NS_DECL_QUERYFRAME
   1.129 +  NS_DECL_FRAMEARENA_HELPERS
   1.130 +
   1.131 +  nsMenuPopupFrame(nsIPresShell* aShell, nsStyleContext* aContext);
   1.132 +
   1.133 +  // nsMenuParent interface
   1.134 +  virtual nsMenuFrame* GetCurrentMenuItem() MOZ_OVERRIDE;
   1.135 +  NS_IMETHOD SetCurrentMenuItem(nsMenuFrame* aMenuItem) MOZ_OVERRIDE;
   1.136 +  virtual void CurrentMenuIsBeingDestroyed() MOZ_OVERRIDE;
   1.137 +  NS_IMETHOD ChangeMenuItem(nsMenuFrame* aMenuItem, bool aSelectFirstItem) MOZ_OVERRIDE;
   1.138 +
   1.139 +  // as popups are opened asynchronously, the popup pending state is used to
   1.140 +  // prevent multiple requests from attempting to open the same popup twice
   1.141 +  nsPopupState PopupState() { return mPopupState; }
   1.142 +  void SetPopupState(nsPopupState aPopupState) { mPopupState = aPopupState; }
   1.143 +
   1.144 +  NS_IMETHOD SetActive(bool aActiveFlag) MOZ_OVERRIDE { return NS_OK; } // We don't care.
   1.145 +  virtual bool IsActive() MOZ_OVERRIDE { return false; }
   1.146 +  virtual bool IsMenuBar() MOZ_OVERRIDE { return false; }
   1.147 +
   1.148 +  /*
   1.149 +   * When this popup is open, should clicks outside of it be consumed?
   1.150 +   * Return true if the popup should rollup on an outside click, 
   1.151 +   * but consume that click so it can't be used for anything else.
   1.152 +   * Return false to allow clicks outside the popup to activate content 
   1.153 +   * even when the popup is open.
   1.154 +   * ---------------------------------------------------------------------
   1.155 +   * 
   1.156 +   * Should clicks outside of a popup be eaten?
   1.157 +   *
   1.158 +   *       Menus     Autocomplete     Comboboxes
   1.159 +   * Mac     Eat           No              Eat
   1.160 +   * Win     No            No              Eat     
   1.161 +   * Unix    Eat           No              Eat
   1.162 +   *
   1.163 +   */
   1.164 +  bool ConsumeOutsideClicks();
   1.165 +
   1.166 +  virtual bool IsContextMenu() MOZ_OVERRIDE { return mIsContextMenu; }
   1.167 +
   1.168 +  virtual bool MenuClosed() MOZ_OVERRIDE { return true; }
   1.169 +
   1.170 +  virtual void LockMenuUntilClosed(bool aLock) MOZ_OVERRIDE;
   1.171 +  virtual bool IsMenuLocked() MOZ_OVERRIDE { return mIsMenuLocked; }
   1.172 +
   1.173 +  nsIWidget* GetWidget();
   1.174 +
   1.175 +  // The dismissal listener gets created and attached to the window.
   1.176 +  void AttachedDismissalListener();
   1.177 +
   1.178 +  // Overridden methods
   1.179 +  virtual void Init(nsIContent*      aContent,
   1.180 +                    nsIFrame*        aParent,
   1.181 +                    nsIFrame*        aPrevInFlow) MOZ_OVERRIDE;
   1.182 +
   1.183 +  virtual nsresult AttributeChanged(int32_t aNameSpaceID,
   1.184 +                                    nsIAtom* aAttribute,
   1.185 +                                    int32_t aModType) MOZ_OVERRIDE;
   1.186 +
   1.187 +  virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
   1.188 +
   1.189 +  // returns true if the popup is a panel with the noautohide attribute set to
   1.190 +  // true. These panels do not roll up automatically.
   1.191 +  bool IsNoAutoHide() const;
   1.192 +
   1.193 +  nsPopupLevel PopupLevel() const
   1.194 +  {
   1.195 +    return PopupLevel(IsNoAutoHide()); 
   1.196 +  }
   1.197 +
   1.198 +  void EnsureWidget();
   1.199 +
   1.200 +  nsresult CreateWidgetForView(nsView* aView);
   1.201 +  uint8_t GetShadowStyle();
   1.202 +
   1.203 +  virtual nsresult SetInitialChildList(ChildListID  aListID,
   1.204 +                                       nsFrameList& aChildList) MOZ_OVERRIDE;
   1.205 +
   1.206 +  virtual bool IsLeaf() const MOZ_OVERRIDE;
   1.207 +
   1.208 +  // layout, position and display the popup as needed
   1.209 +  void LayoutPopup(nsBoxLayoutState& aState, nsIFrame* aParentMenu,
   1.210 +                   nsIFrame* aAnchor, bool aSizedToPopup);
   1.211 +
   1.212 +  nsView* GetRootViewForPopup(nsIFrame* aStartFrame);
   1.213 +
   1.214 +  // set the position of the popup either relative to the anchor aAnchorFrame
   1.215 +  // (or the frame for mAnchorContent if aAnchorFrame is null) or at a specific
   1.216 +  // point if a screen position (mScreenXPos and mScreenYPos) are set. The popup
   1.217 +  // will be adjusted so that it is on screen. If aIsMove is true, then the popup
   1.218 +  // is being moved, and should not be flipped.
   1.219 +  nsresult SetPopupPosition(nsIFrame* aAnchorFrame, bool aIsMove, bool aSizedToPopup);
   1.220 +
   1.221 +  bool HasGeneratedChildren() { return mGeneratedChildren; }
   1.222 +  void SetGeneratedChildren() { mGeneratedChildren = true; }
   1.223 +
   1.224 +  // called when the Enter key is pressed while the popup is open. This will
   1.225 +  // just pass the call down to the current menu, if any. If a current menu
   1.226 +  // should be opened as a result, this method should return the frame for
   1.227 +  // that menu, or null if no menu should be opened. Also, calling Enter will
   1.228 +  // reset the current incremental search string, calculated in
   1.229 +  // FindMenuWithShortcut.
   1.230 +  nsMenuFrame* Enter(mozilla::WidgetGUIEvent* aEvent);
   1.231 +
   1.232 +  nsPopupType PopupType() const { return mPopupType; }
   1.233 +  bool IsMenu() MOZ_OVERRIDE { return mPopupType == ePopupTypeMenu; }
   1.234 +  bool IsOpen() MOZ_OVERRIDE { return mPopupState == ePopupOpen || mPopupState == ePopupOpenAndVisible; }
   1.235 +
   1.236 +  bool IsMouseTransparent() { return mMouseTransparent; }
   1.237 +
   1.238 +  static nsIContent* GetTriggerContent(nsMenuPopupFrame* aMenuPopupFrame);
   1.239 +  void ClearTriggerContent() { mTriggerContent = nullptr; }
   1.240 +
   1.241 +  // returns true if the popup is in a content shell, or false for a popup in
   1.242 +  // a chrome shell
   1.243 +  bool IsInContentShell() { return mInContentShell; }
   1.244 +
   1.245 +  // the Initialize methods are used to set the anchor position for
   1.246 +  // each way of opening a popup.
   1.247 +  void InitializePopup(nsIContent* aAnchorContent,
   1.248 +                       nsIContent* aTriggerContent,
   1.249 +                       const nsAString& aPosition,
   1.250 +                       int32_t aXPos, int32_t aYPos,
   1.251 +                       bool aAttributesOverride);
   1.252 +
   1.253 +  /**
   1.254 +   * @param aIsContextMenu if true, then the popup is
   1.255 +   * positioned at a slight offset from aXPos/aYPos to ensure the
   1.256 +   * (presumed) mouse position is not over the menu.
   1.257 +   */
   1.258 +  void InitializePopupAtScreen(nsIContent* aTriggerContent,
   1.259 +                               int32_t aXPos, int32_t aYPos,
   1.260 +                               bool aIsContextMenu);
   1.261 +
   1.262 +  void InitializePopupWithAnchorAlign(nsIContent* aAnchorContent,
   1.263 +                                      nsAString& aAnchor,
   1.264 +                                      nsAString& aAlign,
   1.265 +                                      int32_t aXPos, int32_t aYPos);
   1.266 +
   1.267 +  // indicate that the popup should be opened
   1.268 +  void ShowPopup(bool aIsContextMenu, bool aSelectFirstItem);
   1.269 +  // indicate that the popup should be hidden. The new state should either be
   1.270 +  // ePopupClosed or ePopupInvisible.
   1.271 +  void HidePopup(bool aDeselectMenu, nsPopupState aNewState);
   1.272 +
   1.273 +  // locate and return the menu frame that should be activated for the
   1.274 +  // supplied key event. If doAction is set to true by this method,
   1.275 +  // then the menu's action should be carried out, as if the user had pressed
   1.276 +  // the Enter key. If doAction is false, the menu should just be highlighted.
   1.277 +  // This method also handles incremental searching in menus so the user can
   1.278 +  // type the first few letters of an item/s name to select it.
   1.279 +  nsMenuFrame* FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent, bool& doAction);
   1.280 +
   1.281 +  void ClearIncrementalString() { mIncrementalString.Truncate(); }
   1.282 +
   1.283 +  virtual nsIAtom* GetType() const MOZ_OVERRIDE { return nsGkAtoms::menuPopupFrame; }
   1.284 +
   1.285 +#ifdef DEBUG_FRAME_DUMP
   1.286 +  virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE
   1.287 +  {
   1.288 +      return MakeFrameName(NS_LITERAL_STRING("MenuPopup"), aResult);
   1.289 +  }
   1.290 +#endif
   1.291 +
   1.292 +  void EnsureMenuItemIsVisible(nsMenuFrame* aMenuFrame);
   1.293 +
   1.294 +  // Move the popup to the screen coordinate (aLeft, aTop) in CSS pixels.
   1.295 +  // If aUpdateAttrs is true, and the popup already has left or top attributes,
   1.296 +  // then those attributes are updated to the new location.
   1.297 +  // The frame may be destroyed by this method.
   1.298 +  void MoveTo(int32_t aLeft, int32_t aTop, bool aUpdateAttrs);
   1.299 +
   1.300 +  void MoveToAnchor(nsIContent* aAnchorContent,
   1.301 +                    const nsAString& aPosition,
   1.302 +                    int32_t aXPos, int32_t aYPos,
   1.303 +                    bool aAttributesOverride);
   1.304 +
   1.305 +  bool GetAutoPosition();
   1.306 +  void SetAutoPosition(bool aShouldAutoPosition);
   1.307 +  void SetConsumeRollupEvent(uint32_t aConsumeMode);
   1.308 +
   1.309 +  nsIScrollableFrame* GetScrollFrame(nsIFrame* aStart);
   1.310 +
   1.311 +  // For a popup that should appear anchored at the given rect, determine
   1.312 +  // the screen area that it is constrained by. This will be the available
   1.313 +  // area of the screen the popup should be displayed on. Content popups,
   1.314 +  // however, will also be constrained by the content area, given by
   1.315 +  // aRootScreenRect. All coordinates are in app units.
   1.316 +  // For non-toplevel popups (which will always be panels), we will also
   1.317 +  // constrain them to the available screen rect, ie they will not fall
   1.318 +  // underneath the taskbar, dock or other fixed OS elements.
   1.319 +  nsRect GetConstraintRect(const nsRect& aAnchorRect, const nsRect& aRootScreenRect,
   1.320 +                           nsPopupLevel aPopupLevel);
   1.321 +
   1.322 +  // Determines whether the given edges of the popup may be moved, where
   1.323 +  // aHorizontalSide and aVerticalSide are one of the NS_SIDE_* constants, or
   1.324 +  // 0 for no movement in that direction. aChange is the distance to move on
   1.325 +  // those sides. If will be reset to 0 if the side cannot be adjusted at all
   1.326 +  // in that direction. For example, a popup cannot be moved if it is anchored
   1.327 +  // on a particular side.
   1.328 +  //
   1.329 +  // Later, when bug 357725 is implemented, we can make this adjust aChange by
   1.330 +  // the amount that the side can be resized, so that minimums and maximums
   1.331 +  // can be taken into account.
   1.332 +  void CanAdjustEdges(int8_t aHorizontalSide, int8_t aVerticalSide, nsIntPoint& aChange);
   1.333 +
   1.334 +  // Return true if the popup is positioned relative to an anchor.
   1.335 +  bool IsAnchored() const { return mScreenXPos == -1 && mScreenYPos == -1; }
   1.336 +
   1.337 +  // Return the anchor if there is one.
   1.338 +  nsIContent* GetAnchor() const { return mAnchorContent; }
   1.339 +
   1.340 +  // Return the screen coordinates of the popup, or (-1, -1) if anchored.
   1.341 +  // This position is in CSS pixels.
   1.342 +  nsIntPoint ScreenPosition() const { return nsIntPoint(mScreenXPos, mScreenYPos); }
   1.343 +
   1.344 +  nsIntPoint GetLastClientOffset() const { return mLastClientOffset; }
   1.345 +
   1.346 +  // Return the alignment of the popup
   1.347 +  int8_t GetAlignmentPosition() const;
   1.348 +
   1.349 +  // Return the offset applied to the alignment of the popup
   1.350 +  nscoord GetAlignmentOffset() const { return mAlignmentOffset; }
   1.351 +protected:
   1.352 +
   1.353 +  // returns the popup's level.
   1.354 +  nsPopupLevel PopupLevel(bool aIsNoAutoHide) const;
   1.355 +
   1.356 +  // redefine to tell the box system not to move the views.
   1.357 +  virtual void GetLayoutFlags(uint32_t& aFlags) MOZ_OVERRIDE;
   1.358 +
   1.359 +  void InitPositionFromAnchorAlign(const nsAString& aAnchor,
   1.360 +                                   const nsAString& aAlign);
   1.361 +
   1.362 +  // return the position where the popup should be, when it should be
   1.363 +  // anchored at anchorRect. aHFlip and aVFlip will be set if the popup may be
   1.364 +  // flipped in that direction if there is not enough space available.
   1.365 +  nsPoint AdjustPositionForAnchorAlign(nsRect& anchorRect,
   1.366 +                                       FlipStyle& aHFlip, FlipStyle& aVFlip);
   1.367 +
   1.368 +  // check if the popup will fit into the available space and resize it. This
   1.369 +  // method handles only one axis at a time so is called twice, once for
   1.370 +  // horizontal and once for vertical. All arguments are specified for this
   1.371 +  // one axis. All coordinates are in app units relative to the screen.
   1.372 +  //   aScreenPoint - the point where the popup should appear
   1.373 +  //   aSize - the size of the popup
   1.374 +  //   aScreenBegin - the left or top edge of the screen
   1.375 +  //   aScreenEnd - the right or bottom edge of the screen
   1.376 +  //   aAnchorBegin - the left or top edge of the anchor rectangle
   1.377 +  //   aAnchorEnd - the right or bottom edge of the anchor rectangle
   1.378 +  //   aMarginBegin - the left or top margin of the popup
   1.379 +  //   aMarginEnd - the right or bottom margin of the popup
   1.380 +  //   aOffsetForContextMenu - the additional offset to add for context menus
   1.381 +  //   aFlip - how to flip or resize the popup when there isn't space
   1.382 +  //   aFlipSide - pointer to where current flip mode is stored
   1.383 +  nscoord FlipOrResize(nscoord& aScreenPoint, nscoord aSize, 
   1.384 +                       nscoord aScreenBegin, nscoord aScreenEnd,
   1.385 +                       nscoord aAnchorBegin, nscoord aAnchorEnd,
   1.386 +                       nscoord aMarginBegin, nscoord aMarginEnd,
   1.387 +                       nscoord aOffsetForContextMenu, FlipStyle aFlip,
   1.388 +                       bool* aFlipSide);
   1.389 +
   1.390 +  // check if the popup can fit into the available space by "sliding" (i.e.,
   1.391 +  // by having the anchor arrow slide along one axis and only resizing if that
   1.392 +  // can't provide the requested size). Only one axis can be slid - the other
   1.393 +  // axis is "flipped" as normal. This method can handle either axis, but is
   1.394 +  // only called for the sliding axis. All coordinates are in app units
   1.395 +  // relative to the screen.
   1.396 +  //   aScreenPoint - the point where the popup should appear
   1.397 +  //   aSize - the size of the popup
   1.398 +  //   aScreenBegin - the left or top edge of the screen
   1.399 +  //   aScreenEnd - the right or bottom edge of the screen
   1.400 +  //   aOffset - the amount by which the arrow must be slid such that it is
   1.401 +  //             still aligned with the anchor.
   1.402 +  // Result is the new size of the popup, which will typically be the same
   1.403 +  // as aSize, unless aSize is greater than the screen width/height.
   1.404 +  nscoord SlideOrResize(nscoord& aScreenPoint, nscoord aSize,
   1.405 +                        nscoord aScreenBegin, nscoord aScreenEnd,
   1.406 +                        nscoord *aOffset);
   1.407 +
   1.408 +  // Move the popup to the position specified in its |left| and |top| attributes.
   1.409 +  void MoveToAttributePosition();
   1.410 +
   1.411 +  /**
   1.412 +   * Return whether the popup direction should be RTL.
   1.413 +   * If the popup has an anchor, its direction is the anchor direction.
   1.414 +   * Otherwise, its the general direction of the UI.
   1.415 +   *
   1.416 +   * Return whether the popup direction should be RTL.
   1.417 +   */
   1.418 +  bool IsDirectionRTL() const {
   1.419 +    return mAnchorContent && mAnchorContent->GetPrimaryFrame()
   1.420 +      ? mAnchorContent->GetPrimaryFrame()->StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL
   1.421 +      : StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
   1.422 +  }
   1.423 +
   1.424 +  // Create a popup view for this frame. The view is added a child of the root
   1.425 +  // view, and is initially hidden.
   1.426 +  void CreatePopupView();
   1.427 +
   1.428 +  nsString     mIncrementalString;  // for incremental typing navigation
   1.429 +
   1.430 +  // the content that the popup is anchored to, if any, which may be in a
   1.431 +  // different document than the popup.
   1.432 +  nsCOMPtr<nsIContent> mAnchorContent;
   1.433 +
   1.434 +  // the content that triggered the popup, typically the node where the mouse
   1.435 +  // was clicked. It will be cleared when the popup is hidden.
   1.436 +  nsCOMPtr<nsIContent> mTriggerContent;
   1.437 +
   1.438 +  nsMenuFrame* mCurrentMenu; // The current menu that is active.
   1.439 +
   1.440 +  // A popup's preferred size may be different than its actual size stored in
   1.441 +  // mRect in the case where the popup was resized because it was too large
   1.442 +  // for the screen. The preferred size mPrefSize holds the full size the popup
   1.443 +  // would be before resizing. Computations are performed using this size.
   1.444 +  nsSize mPrefSize;
   1.445 +
   1.446 +  // The position of the popup, in CSS pixels.
   1.447 +  // The screen coordinates, if set to values other than -1,
   1.448 +  // override mXPos and mYPos.
   1.449 +  int32_t mXPos;
   1.450 +  int32_t mYPos;
   1.451 +  int32_t mScreenXPos;
   1.452 +  int32_t mScreenYPos;
   1.453 +
   1.454 +  // If the panel prefers to "slide" rather than resize, then the arrow gets
   1.455 +  // positioned at this offset (along either the x or y axis, depending on
   1.456 +  // mPosition)
   1.457 +  nscoord mAlignmentOffset;
   1.458 +
   1.459 +  // The value of the client offset of our widget the last time we positioned
   1.460 +  // ourselves. We store this so that we can detect when it changes but the
   1.461 +  // position of our widget didn't change.
   1.462 +  nsIntPoint mLastClientOffset;
   1.463 +
   1.464 +  nsPopupType mPopupType; // type of popup
   1.465 +  nsPopupState mPopupState; // open state of the popup
   1.466 +
   1.467 +  // popup alignment relative to the anchor node
   1.468 +  int8_t mPopupAlignment;
   1.469 +  int8_t mPopupAnchor;
   1.470 +  int8_t mPosition;
   1.471 +
   1.472 +  // One of nsIPopupBoxObject::ROLLUP_DEFAULT/ROLLUP_CONSUME/ROLLUP_NO_CONSUME
   1.473 +  int8_t mConsumeRollupEvent;
   1.474 +  FlipType mFlip; // Whether to flip
   1.475 +
   1.476 +  bool mIsOpenChanged; // true if the open state changed since the last layout
   1.477 +  bool mIsContextMenu; // true for context menus
   1.478 +  // true if we need to offset the popup to ensure it's not under the mouse
   1.479 +  bool mAdjustOffsetForContextMenu;
   1.480 +  bool mGeneratedChildren; // true if the contents have been created
   1.481 +
   1.482 +  bool mMenuCanOverlapOSBar;    // can we appear over the taskbar/menubar?
   1.483 +  bool mShouldAutoPosition; // Should SetPopupPosition be allowed to auto position popup?
   1.484 +  bool mInContentShell; // True if the popup is in a content shell
   1.485 +  bool mIsMenuLocked; // Should events inside this menu be ignored?
   1.486 +  bool mMouseTransparent; // True if this is a popup is transparent to mouse events
   1.487 +
   1.488 +  // the flip modes that were used when the popup was opened
   1.489 +  bool mHFlip;
   1.490 +  bool mVFlip;
   1.491 +
   1.492 +  static int8_t sDefaultLevelIsTop;
   1.493 +}; // class nsMenuPopupFrame
   1.494 +
   1.495 +#endif

mercurial