Tue, 06 Jan 2015 21:39:09 +0100
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_a11y_HTMLImageMapAccessible_h__
7 #define mozilla_a11y_HTMLImageMapAccessible_h__
9 #include "HTMLLinkAccessible.h"
10 #include "ImageAccessibleWrap.h"
11 #include "nsIDOMHTMLMapElement.h"
13 namespace mozilla {
14 namespace a11y {
16 /**
17 * Used for HTML image maps.
18 */
19 class HTMLImageMapAccessible : public ImageAccessibleWrap
20 {
21 public:
22 HTMLImageMapAccessible(nsIContent* aContent, DocAccessible* aDoc);
23 virtual ~HTMLImageMapAccessible() { }
25 // nsISupports and cycle collector
26 NS_DECL_ISUPPORTS_INHERITED
28 // Accessible
29 virtual a11y::role NativeRole();
31 // HyperLinkAccessible
32 virtual uint32_t AnchorCount();
33 virtual Accessible* AnchorAt(uint32_t aAnchorIndex);
34 virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex);
36 /**
37 * Update area children of the image map.
38 */
39 void UpdateChildAreas(bool aDoFireEvents = true);
41 /**
42 * Return accessible of child node.
43 */
44 Accessible* GetChildAccessibleFor(const nsINode* aNode) const;
46 protected:
48 // Accessible
49 virtual void CacheChildren();
50 };
52 /**
53 * Accessible for image map areas - must be child of image.
54 */
55 class HTMLAreaAccessible : public HTMLLinkAccessible
56 {
57 public:
59 HTMLAreaAccessible(nsIContent* aContent, DocAccessible* aDoc);
61 // Accessible
62 virtual void Description(nsString& aDescription);
63 virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
64 EWhichChildAtPoint aWhichChild);
65 virtual void GetBoundsRect(nsRect& aBounds, nsIFrame** aBoundingFrame);
67 // HyperLinkAccessible
68 virtual uint32_t StartOffset();
69 virtual uint32_t EndOffset();
71 protected:
72 // Accessible
73 virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
74 virtual void CacheChildren();
75 };
78 ////////////////////////////////////////////////////////////////////////////////
79 // Accessible downcasting method
81 inline HTMLImageMapAccessible*
82 Accessible::AsImageMap()
83 {
84 return IsImageMap() ? static_cast<HTMLImageMapAccessible*>(this) : nullptr;
85 }
87 } // namespace a11y
88 } // namespace mozilla
90 #endif