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.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef mozilla_a11y_XULElementAccessibles_h__ |
michael@0 | 7 | #define mozilla_a11y_XULElementAccessibles_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "HyperTextAccessibleWrap.h" |
michael@0 | 10 | #include "TextLeafAccessibleWrap.h" |
michael@0 | 11 | |
michael@0 | 12 | namespace mozilla { |
michael@0 | 13 | namespace a11y { |
michael@0 | 14 | |
michael@0 | 15 | class XULLabelTextLeafAccessible; |
michael@0 | 16 | |
michael@0 | 17 | /** |
michael@0 | 18 | * Used for XUL description and label elements. |
michael@0 | 19 | */ |
michael@0 | 20 | class XULLabelAccessible : public HyperTextAccessibleWrap |
michael@0 | 21 | { |
michael@0 | 22 | public: |
michael@0 | 23 | XULLabelAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 24 | |
michael@0 | 25 | // Accessible |
michael@0 | 26 | virtual void Shutdown(); |
michael@0 | 27 | virtual a11y::role NativeRole(); |
michael@0 | 28 | virtual uint64_t NativeState(); |
michael@0 | 29 | virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; |
michael@0 | 30 | |
michael@0 | 31 | void UpdateLabelValue(const nsString& aValue); |
michael@0 | 32 | |
michael@0 | 33 | protected: |
michael@0 | 34 | // Accessible |
michael@0 | 35 | virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE; |
michael@0 | 36 | virtual void CacheChildren() MOZ_OVERRIDE; |
michael@0 | 37 | |
michael@0 | 38 | private: |
michael@0 | 39 | nsRefPtr<XULLabelTextLeafAccessible> mValueTextLeaf; |
michael@0 | 40 | }; |
michael@0 | 41 | |
michael@0 | 42 | inline XULLabelAccessible* |
michael@0 | 43 | Accessible::AsXULLabel() |
michael@0 | 44 | { |
michael@0 | 45 | return IsXULLabel() ? static_cast<XULLabelAccessible*>(this) : nullptr; |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | |
michael@0 | 49 | /** |
michael@0 | 50 | * Used to implement text interface on XUL label accessible in case when text |
michael@0 | 51 | * is provided by @value attribute (no underlying text frame). |
michael@0 | 52 | */ |
michael@0 | 53 | class XULLabelTextLeafAccessible MOZ_FINAL : public TextLeafAccessibleWrap |
michael@0 | 54 | { |
michael@0 | 55 | public: |
michael@0 | 56 | XULLabelTextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc) : |
michael@0 | 57 | TextLeafAccessibleWrap(aContent, aDoc) |
michael@0 | 58 | { mStateFlags |= eSharedNode; } |
michael@0 | 59 | |
michael@0 | 60 | virtual ~XULLabelTextLeafAccessible() { } |
michael@0 | 61 | |
michael@0 | 62 | // Accessible |
michael@0 | 63 | virtual a11y::role NativeRole() MOZ_OVERRIDE; |
michael@0 | 64 | virtual uint64_t NativeState() MOZ_OVERRIDE; |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | |
michael@0 | 68 | /** |
michael@0 | 69 | * Used for XUL tooltip element. |
michael@0 | 70 | */ |
michael@0 | 71 | class XULTooltipAccessible : public LeafAccessible |
michael@0 | 72 | { |
michael@0 | 73 | |
michael@0 | 74 | public: |
michael@0 | 75 | XULTooltipAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 76 | |
michael@0 | 77 | // Accessible |
michael@0 | 78 | virtual a11y::role NativeRole(); |
michael@0 | 79 | virtual uint64_t NativeState(); |
michael@0 | 80 | }; |
michael@0 | 81 | |
michael@0 | 82 | class XULLinkAccessible : public XULLabelAccessible |
michael@0 | 83 | { |
michael@0 | 84 | |
michael@0 | 85 | public: |
michael@0 | 86 | XULLinkAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 87 | |
michael@0 | 88 | NS_DECL_ISUPPORTS_INHERITED |
michael@0 | 89 | |
michael@0 | 90 | // nsIAccessible |
michael@0 | 91 | NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName); |
michael@0 | 92 | NS_IMETHOD DoAction(uint8_t aIndex); |
michael@0 | 93 | |
michael@0 | 94 | // Accessible |
michael@0 | 95 | virtual void Value(nsString& aValue); |
michael@0 | 96 | virtual a11y::role NativeRole(); |
michael@0 | 97 | virtual uint64_t NativeLinkState() const; |
michael@0 | 98 | |
michael@0 | 99 | // ActionAccessible |
michael@0 | 100 | virtual uint8_t ActionCount(); |
michael@0 | 101 | |
michael@0 | 102 | // HyperLinkAccessible |
michael@0 | 103 | virtual bool IsLink(); |
michael@0 | 104 | virtual uint32_t StartOffset(); |
michael@0 | 105 | virtual uint32_t EndOffset(); |
michael@0 | 106 | virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex); |
michael@0 | 107 | |
michael@0 | 108 | protected: |
michael@0 | 109 | // Accessible |
michael@0 | 110 | virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE; |
michael@0 | 111 | |
michael@0 | 112 | enum { eAction_Jump = 0 }; |
michael@0 | 113 | |
michael@0 | 114 | }; |
michael@0 | 115 | |
michael@0 | 116 | } // namespace a11y |
michael@0 | 117 | } // namespace mozilla |
michael@0 | 118 | |
michael@0 | 119 | #endif |