dom/events/ScrollAreaEvent.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/. */
     6 #ifndef mozilla_dom_ScrollAreaEvent_h_
     7 #define mozilla_dom_ScrollAreaEvent_h_
     9 #include "mozilla/dom/DOMRect.h"
    10 #include "mozilla/dom/ScrollAreaEventBinding.h"
    11 #include "mozilla/dom/UIEvent.h"
    12 #include "mozilla/Attributes.h"
    13 #include "mozilla/EventForwards.h"
    14 #include "nsIDOMScrollAreaEvent.h"
    16 namespace mozilla {
    17 namespace dom {
    19 class ScrollAreaEvent : public UIEvent,
    20                         public nsIDOMScrollAreaEvent
    21 {
    22 public:
    23   ScrollAreaEvent(EventTarget* aOwner,
    24                   nsPresContext* aPresContext,
    25                   InternalScrollAreaEvent* aEvent);
    27   NS_DECL_ISUPPORTS_INHERITED
    29   NS_DECL_NSIDOMSCROLLAREAEVENT
    31   NS_FORWARD_NSIDOMUIEVENT(UIEvent::)
    33   NS_FORWARD_TO_EVENT_NO_SERIALIZATION_NO_DUPLICATION
    34   NS_IMETHOD DuplicatePrivateData()
    35   {
    36     return Event::DuplicatePrivateData();
    37   }
    38   NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) MOZ_OVERRIDE;
    39   NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, void** aIter) MOZ_OVERRIDE;
    41   virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE
    42   {
    43     return ScrollAreaEventBinding::Wrap(aCx, this);
    44   }
    46   float X() const
    47   {
    48     return mClientArea.Left();
    49   }
    51   float Y() const
    52   {
    53     return mClientArea.Top();
    54   }
    56   float Width() const
    57   {
    58     return mClientArea.Width();
    59   }
    61   float Height() const
    62   {
    63     return mClientArea.Height();
    64   }
    66   void InitScrollAreaEvent(const nsAString& aType,
    67                            bool aCanBubble,
    68                            bool aCancelable,
    69                            nsIDOMWindow* aView,
    70                            int32_t aDetail,
    71                            float aX, float aY,
    72                            float aWidth, float aHeight,
    73                            ErrorResult& aRv)
    74   {
    75     aRv = InitScrollAreaEvent(aType, aCanBubble, aCancelable, aView,
    76                               aDetail, aX, aY, aWidth, aHeight);
    77   }
    79 protected:
    80   DOMRect mClientArea;
    81 };
    83 } // namespace dom
    84 } // namespace mozilla
    86 #endif // mozilla_dom_ScrollAreaEvent_h_

mercurial