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: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include "nsISupports.idl" |
michael@0 | 8 | |
michael@0 | 9 | %{C++ |
michael@0 | 10 | class nsIntRegion; |
michael@0 | 11 | %} |
michael@0 | 12 | |
michael@0 | 13 | native nsIntRegion(nsIntRegion); |
michael@0 | 14 | |
michael@0 | 15 | |
michael@0 | 16 | [scriptable, uuid(a5f44cc7-2820-489b-b817-ae8a08506ff6)] |
michael@0 | 17 | interface nsIScriptableRegion : nsISupports |
michael@0 | 18 | { |
michael@0 | 19 | void init ( ) ; |
michael@0 | 20 | |
michael@0 | 21 | /** |
michael@0 | 22 | * copy operator equivalent that takes another region |
michael@0 | 23 | * |
michael@0 | 24 | * @param region to copy |
michael@0 | 25 | * @return void |
michael@0 | 26 | * |
michael@0 | 27 | **/ |
michael@0 | 28 | |
michael@0 | 29 | void setToRegion ( in nsIScriptableRegion aRegion ); |
michael@0 | 30 | |
michael@0 | 31 | /** |
michael@0 | 32 | * copy operator equivalent that takes a rect |
michael@0 | 33 | * |
michael@0 | 34 | * @param aX xoffset of rect to set region to |
michael@0 | 35 | * @param aY yoffset of rect to set region to |
michael@0 | 36 | * @param aWidth width of rect to set region to |
michael@0 | 37 | * @param aHeight height of rect to set region to |
michael@0 | 38 | * @return void |
michael@0 | 39 | * |
michael@0 | 40 | **/ |
michael@0 | 41 | |
michael@0 | 42 | void setToRect ( in long aX, in long aY, in long aWidth, in long aHeight ); |
michael@0 | 43 | |
michael@0 | 44 | /** |
michael@0 | 45 | * destructively intersect another region with this one |
michael@0 | 46 | * |
michael@0 | 47 | * @param region to intersect |
michael@0 | 48 | * @return void |
michael@0 | 49 | * |
michael@0 | 50 | **/ |
michael@0 | 51 | |
michael@0 | 52 | void intersectRegion ( in nsIScriptableRegion aRegion ) ; |
michael@0 | 53 | |
michael@0 | 54 | /** |
michael@0 | 55 | * destructively intersect a rect with this region |
michael@0 | 56 | * |
michael@0 | 57 | * @param aX xoffset of rect to intersect with region |
michael@0 | 58 | * @param aY yoffset of rect to intersect with region |
michael@0 | 59 | * @param aWidth width of rect to intersect with region |
michael@0 | 60 | * @param aHeight height of rect to intersect with region |
michael@0 | 61 | * @return void |
michael@0 | 62 | * |
michael@0 | 63 | **/ |
michael@0 | 64 | |
michael@0 | 65 | void intersectRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ; |
michael@0 | 66 | |
michael@0 | 67 | /** |
michael@0 | 68 | * destructively union another region with this one |
michael@0 | 69 | * |
michael@0 | 70 | * @param region to union |
michael@0 | 71 | * @return void |
michael@0 | 72 | * |
michael@0 | 73 | **/ |
michael@0 | 74 | |
michael@0 | 75 | void unionRegion ( in nsIScriptableRegion aRegion ) ; |
michael@0 | 76 | |
michael@0 | 77 | /** |
michael@0 | 78 | * destructively union a rect with this region |
michael@0 | 79 | * |
michael@0 | 80 | * @param aX xoffset of rect to union with region |
michael@0 | 81 | * @param aY yoffset of rect to union with region |
michael@0 | 82 | * @param aWidth width of rect to union with region |
michael@0 | 83 | * @param aHeight height of rect to union with region |
michael@0 | 84 | * @return void |
michael@0 | 85 | * |
michael@0 | 86 | **/ |
michael@0 | 87 | |
michael@0 | 88 | void unionRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ; |
michael@0 | 89 | |
michael@0 | 90 | /** |
michael@0 | 91 | * destructively subtract another region with this one |
michael@0 | 92 | * |
michael@0 | 93 | * @param region to subtract |
michael@0 | 94 | * @return void |
michael@0 | 95 | * |
michael@0 | 96 | **/ |
michael@0 | 97 | |
michael@0 | 98 | void subtractRegion ( in nsIScriptableRegion aRegion ) ; |
michael@0 | 99 | |
michael@0 | 100 | /** |
michael@0 | 101 | * destructively subtract a rect from this region |
michael@0 | 102 | * |
michael@0 | 103 | * @param aX xoffset of rect to subtract with region |
michael@0 | 104 | * @param aY yoffset of rect to subtract with region |
michael@0 | 105 | * @param aWidth width of rect to subtract with region |
michael@0 | 106 | * @param aHeight height of rect to subtract with region |
michael@0 | 107 | * @return void |
michael@0 | 108 | * |
michael@0 | 109 | **/ |
michael@0 | 110 | |
michael@0 | 111 | void subtractRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ; |
michael@0 | 112 | |
michael@0 | 113 | /** |
michael@0 | 114 | * is this region empty? i.e. does it contain any pixels |
michael@0 | 115 | * |
michael@0 | 116 | * @param none |
michael@0 | 117 | * @return returns whether the region is empty |
michael@0 | 118 | * |
michael@0 | 119 | **/ |
michael@0 | 120 | |
michael@0 | 121 | boolean isEmpty ( ) ; |
michael@0 | 122 | |
michael@0 | 123 | /** |
michael@0 | 124 | * == operator equivalent i.e. do the regions contain exactly |
michael@0 | 125 | * the same pixels |
michael@0 | 126 | * |
michael@0 | 127 | * @param region to compare |
michael@0 | 128 | * @return whether the regions are identical |
michael@0 | 129 | * |
michael@0 | 130 | **/ |
michael@0 | 131 | |
michael@0 | 132 | boolean isEqualRegion ( in nsIScriptableRegion aRegion ) ; |
michael@0 | 133 | |
michael@0 | 134 | /** |
michael@0 | 135 | * returns the bounding box of the region i.e. the smallest |
michael@0 | 136 | * rectangle that completely contains the region. |
michael@0 | 137 | * |
michael@0 | 138 | * @param aX out parameter for xoffset of bounding rect for region |
michael@0 | 139 | * @param aY out parameter for yoffset of bounding rect for region |
michael@0 | 140 | * @param aWidth out parameter for width of bounding rect for region |
michael@0 | 141 | * @param aHeight out parameter for height of bounding rect for region |
michael@0 | 142 | * @return void |
michael@0 | 143 | * |
michael@0 | 144 | **/ |
michael@0 | 145 | void getBoundingBox ( out long aX, out long aY, out long aWidth, out long aHeight ) ; |
michael@0 | 146 | |
michael@0 | 147 | /** |
michael@0 | 148 | * offsets the region in x and y |
michael@0 | 149 | * |
michael@0 | 150 | * @param xoffset pixel offset in x |
michael@0 | 151 | * @param yoffset pixel offset in y |
michael@0 | 152 | * @return void |
michael@0 | 153 | * |
michael@0 | 154 | **/ |
michael@0 | 155 | void offset ( in long aXOffset, in long aYOffset ) ; |
michael@0 | 156 | |
michael@0 | 157 | /** |
michael@0 | 158 | * @return null if there are no rects, |
michael@0 | 159 | * @return flat array of rects,ie [x1,y1,width1,height1,x2...]. |
michael@0 | 160 | * The result will contain bogus data if values don't fit in 31 bit |
michael@0 | 161 | **/ |
michael@0 | 162 | [implicit_jscontext] jsval getRects(); |
michael@0 | 163 | |
michael@0 | 164 | /** |
michael@0 | 165 | * does the region intersect the rectangle? |
michael@0 | 166 | * |
michael@0 | 167 | * @param rect to check for containment |
michael@0 | 168 | * @return true if the region intersects the rect |
michael@0 | 169 | * |
michael@0 | 170 | **/ |
michael@0 | 171 | |
michael@0 | 172 | boolean containsRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ; |
michael@0 | 173 | |
michael@0 | 174 | [noscript] readonly attribute nsIntRegion region; |
michael@0 | 175 | |
michael@0 | 176 | }; |