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: 4; 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_XULListboxAccessible_h__ |
michael@0 | 7 | #define mozilla_a11y_XULListboxAccessible_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "BaseAccessibles.h" |
michael@0 | 10 | #include "nsIAccessibleTable.h" |
michael@0 | 11 | #include "TableAccessible.h" |
michael@0 | 12 | #include "TableCellAccessible.h" |
michael@0 | 13 | #include "xpcAccessibleTable.h" |
michael@0 | 14 | #include "xpcAccessibleTableCell.h" |
michael@0 | 15 | #include "XULMenuAccessible.h" |
michael@0 | 16 | #include "XULSelectControlAccessible.h" |
michael@0 | 17 | |
michael@0 | 18 | class nsIWeakReference; |
michael@0 | 19 | |
michael@0 | 20 | namespace mozilla { |
michael@0 | 21 | namespace a11y { |
michael@0 | 22 | |
michael@0 | 23 | /** |
michael@0 | 24 | * XULColumAccessible are accessible for list and tree columns elements |
michael@0 | 25 | * (xul:treecols and xul:listcols). |
michael@0 | 26 | */ |
michael@0 | 27 | class XULColumAccessible : public AccessibleWrap |
michael@0 | 28 | { |
michael@0 | 29 | public: |
michael@0 | 30 | XULColumAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 31 | |
michael@0 | 32 | // Accessible |
michael@0 | 33 | virtual a11y::role NativeRole(); |
michael@0 | 34 | virtual uint64_t NativeState(); |
michael@0 | 35 | }; |
michael@0 | 36 | |
michael@0 | 37 | /** |
michael@0 | 38 | * XULColumnItemAccessible are accessibles for list and tree column elements |
michael@0 | 39 | * (xul:listcol and xul:treecol). |
michael@0 | 40 | */ |
michael@0 | 41 | class XULColumnItemAccessible : public LeafAccessible |
michael@0 | 42 | { |
michael@0 | 43 | public: |
michael@0 | 44 | XULColumnItemAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 45 | |
michael@0 | 46 | // nsIAccessible |
michael@0 | 47 | NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName); |
michael@0 | 48 | NS_IMETHOD DoAction(uint8_t aIndex); |
michael@0 | 49 | |
michael@0 | 50 | // Accessible |
michael@0 | 51 | virtual a11y::role NativeRole(); |
michael@0 | 52 | virtual uint64_t NativeState(); |
michael@0 | 53 | |
michael@0 | 54 | // ActionAccessible |
michael@0 | 55 | virtual uint8_t ActionCount(); |
michael@0 | 56 | |
michael@0 | 57 | enum { eAction_Click = 0 }; |
michael@0 | 58 | }; |
michael@0 | 59 | |
michael@0 | 60 | /* |
michael@0 | 61 | * A class the represents the XUL Listbox widget. |
michael@0 | 62 | */ |
michael@0 | 63 | class XULListboxAccessible : public XULSelectControlAccessible, |
michael@0 | 64 | public xpcAccessibleTable, |
michael@0 | 65 | public nsIAccessibleTable, |
michael@0 | 66 | public TableAccessible |
michael@0 | 67 | { |
michael@0 | 68 | public: |
michael@0 | 69 | XULListboxAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 70 | virtual ~XULListboxAccessible() {} |
michael@0 | 71 | |
michael@0 | 72 | NS_DECL_ISUPPORTS_INHERITED |
michael@0 | 73 | |
michael@0 | 74 | // nsIAccessibleTable |
michael@0 | 75 | NS_FORWARD_NSIACCESSIBLETABLE(xpcAccessibleTable::) |
michael@0 | 76 | |
michael@0 | 77 | // TableAccessible |
michael@0 | 78 | virtual uint32_t ColCount(); |
michael@0 | 79 | virtual uint32_t RowCount(); |
michael@0 | 80 | virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex); |
michael@0 | 81 | virtual bool IsColSelected(uint32_t aColIdx); |
michael@0 | 82 | virtual bool IsRowSelected(uint32_t aRowIdx); |
michael@0 | 83 | virtual bool IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx); |
michael@0 | 84 | virtual uint32_t SelectedCellCount(); |
michael@0 | 85 | virtual uint32_t SelectedColCount(); |
michael@0 | 86 | virtual uint32_t SelectedRowCount(); |
michael@0 | 87 | virtual void SelectedCells(nsTArray<Accessible*>* aCells); |
michael@0 | 88 | virtual void SelectedCellIndices(nsTArray<uint32_t>* aCells); |
michael@0 | 89 | virtual void SelectedColIndices(nsTArray<uint32_t>* aCols); |
michael@0 | 90 | virtual void SelectedRowIndices(nsTArray<uint32_t>* aRows); |
michael@0 | 91 | virtual void SelectRow(uint32_t aRowIdx); |
michael@0 | 92 | virtual void UnselectRow(uint32_t aRowIdx); |
michael@0 | 93 | virtual Accessible* AsAccessible() { return this; } |
michael@0 | 94 | |
michael@0 | 95 | // Accessible |
michael@0 | 96 | virtual void Shutdown(); |
michael@0 | 97 | virtual void Value(nsString& aValue); |
michael@0 | 98 | virtual TableAccessible* AsTable() { return this; } |
michael@0 | 99 | virtual a11y::role NativeRole(); |
michael@0 | 100 | virtual uint64_t NativeState(); |
michael@0 | 101 | |
michael@0 | 102 | // Widgets |
michael@0 | 103 | virtual bool IsWidget() const; |
michael@0 | 104 | virtual bool IsActiveWidget() const; |
michael@0 | 105 | virtual bool AreItemsOperable() const; |
michael@0 | 106 | |
michael@0 | 107 | virtual Accessible* ContainerWidget() const; |
michael@0 | 108 | |
michael@0 | 109 | protected: |
michael@0 | 110 | bool IsMulticolumn(); |
michael@0 | 111 | }; |
michael@0 | 112 | |
michael@0 | 113 | /** |
michael@0 | 114 | * Listitems -- used in listboxes |
michael@0 | 115 | */ |
michael@0 | 116 | class XULListitemAccessible : public XULMenuitemAccessible |
michael@0 | 117 | { |
michael@0 | 118 | public: |
michael@0 | 119 | enum { eAction_Click = 0 }; |
michael@0 | 120 | |
michael@0 | 121 | NS_DECL_ISUPPORTS_INHERITED |
michael@0 | 122 | |
michael@0 | 123 | XULListitemAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 124 | virtual ~XULListitemAccessible() {} |
michael@0 | 125 | |
michael@0 | 126 | // nsIAccessible |
michael@0 | 127 | NS_IMETHOD GetActionName(uint8_t index, nsAString& aName); |
michael@0 | 128 | // Don't use XUL menuitems's description attribute |
michael@0 | 129 | |
michael@0 | 130 | // Accessible |
michael@0 | 131 | virtual void Description(nsString& aDesc); |
michael@0 | 132 | virtual a11y::role NativeRole(); |
michael@0 | 133 | virtual uint64_t NativeState(); |
michael@0 | 134 | virtual uint64_t NativeInteractiveState() const; |
michael@0 | 135 | virtual bool CanHaveAnonChildren(); |
michael@0 | 136 | |
michael@0 | 137 | // Widgets |
michael@0 | 138 | virtual Accessible* ContainerWidget() const; |
michael@0 | 139 | |
michael@0 | 140 | protected: |
michael@0 | 141 | // Accessible |
michael@0 | 142 | virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE; |
michael@0 | 143 | |
michael@0 | 144 | // XULListitemAccessible |
michael@0 | 145 | |
michael@0 | 146 | /** |
michael@0 | 147 | * Return listbox accessible for the listitem. |
michael@0 | 148 | */ |
michael@0 | 149 | Accessible* GetListAccessible(); |
michael@0 | 150 | |
michael@0 | 151 | private: |
michael@0 | 152 | bool mIsCheckbox; |
michael@0 | 153 | }; |
michael@0 | 154 | |
michael@0 | 155 | /** |
michael@0 | 156 | * Class represents xul:listcell. |
michael@0 | 157 | */ |
michael@0 | 158 | class XULListCellAccessible : public HyperTextAccessibleWrap, |
michael@0 | 159 | public nsIAccessibleTableCell, |
michael@0 | 160 | public TableCellAccessible, |
michael@0 | 161 | public xpcAccessibleTableCell |
michael@0 | 162 | { |
michael@0 | 163 | public: |
michael@0 | 164 | XULListCellAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 165 | |
michael@0 | 166 | // nsISupports |
michael@0 | 167 | NS_DECL_ISUPPORTS_INHERITED |
michael@0 | 168 | |
michael@0 | 169 | // nsIAccessibleTableCell |
michael@0 | 170 | NS_FORWARD_NSIACCESSIBLETABLECELL(xpcAccessibleTableCell::) |
michael@0 | 171 | |
michael@0 | 172 | // Accessible |
michael@0 | 173 | virtual TableCellAccessible* AsTableCell() { return this; } |
michael@0 | 174 | virtual void Shutdown(); |
michael@0 | 175 | virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE; |
michael@0 | 176 | virtual a11y::role NativeRole(); |
michael@0 | 177 | |
michael@0 | 178 | // TableCellAccessible |
michael@0 | 179 | virtual TableAccessible* Table() const MOZ_OVERRIDE; |
michael@0 | 180 | virtual uint32_t ColIdx() const MOZ_OVERRIDE; |
michael@0 | 181 | virtual uint32_t RowIdx() const MOZ_OVERRIDE; |
michael@0 | 182 | virtual void ColHeaderCells(nsTArray<Accessible*>* aHeaderCells) MOZ_OVERRIDE; |
michael@0 | 183 | virtual bool Selected() MOZ_OVERRIDE; |
michael@0 | 184 | }; |
michael@0 | 185 | |
michael@0 | 186 | } // namespace a11y |
michael@0 | 187 | } // namespace mozilla |
michael@0 | 188 | |
michael@0 | 189 | #endif |