layout/xul/nsResizerFrame.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef nsResizerFrame_h___
     6 #define nsResizerFrame_h___
     8 #include "mozilla/Attributes.h"
     9 #include "mozilla/EventForwards.h"
    10 #include "nsTitleBarFrame.h"
    12 class nsIBaseWindow;
    13 class nsMenuPopupFrame;
    15 class nsResizerFrame : public nsTitleBarFrame 
    16 {
    17 protected:
    18   struct Direction {
    19     int8_t mHorizontal;
    20     int8_t mVertical;
    21   };
    23 public:
    24   NS_DECL_FRAMEARENA_HELPERS
    26   friend nsIFrame* NS_NewResizerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);  
    28   nsResizerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
    30   virtual nsresult HandleEvent(nsPresContext* aPresContext,
    31                                mozilla::WidgetGUIEvent* aEvent,
    32                                nsEventStatus* aEventStatus) MOZ_OVERRIDE;
    34   virtual void MouseClicked(nsPresContext* aPresContext,
    35                             mozilla::WidgetMouseEvent* aEvent) MOZ_OVERRIDE;
    37 protected:
    38   nsIContent* GetContentToResize(nsIPresShell* aPresShell, nsIBaseWindow** aWindow);
    40   Direction GetDirection();
    42   /**
    43    * Adjust the window position and size in a direction according to the mouse
    44    * movement and the resizer direction. The minimum and maximum size is used
    45    * to constrain the size.
    46    *
    47    * @param aPos left or top position
    48    * @param aSize width or height
    49    * @param aMinSize minimum width or height
    50    * @param aMacSize maximum width or height
    51    * @param aMovement the amount the mouse was moved
    52    * @param aResizerDirection resizer direction returned by GetDirection
    53    */
    54   static void AdjustDimensions(int32_t* aPos, int32_t* aSize,
    55                                int32_t aMinSize, int32_t aMaxSize,
    56                                int32_t aMovement, int8_t aResizerDirection);
    58   struct SizeInfo {
    59     nsString width, height;
    60   };
    61   static void SizeInfoDtorFunc(void *aObject, nsIAtom *aPropertyName,
    62                                void *aPropertyValue, void *aData);
    63   static void ResizeContent(nsIContent* aContent, const Direction& aDirection,
    64                             const SizeInfo& aSizeInfo, SizeInfo* aOriginalSizeInfo);
    65   static void MaybePersistOriginalSize(nsIContent* aContent, const SizeInfo& aSizeInfo);
    66   static void RestoreOriginalSize(nsIContent* aContent);
    68 protected:
    69 	nsIntRect mMouseDownRect;
    70 	nsIntPoint mMouseDownPoint;
    71 }; // class nsResizerFrame
    73 #endif /* nsResizerFrame_h___ */

mercurial