edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBfbc29d1Tahinli2 months ago972 commits
| 1 | //! What the window looks like this frame: the one `render` the whole |
| 2 | //! interface hangs off, root to overlays. |
| 3 | |
| 4 | use crate::*; |
| 5 | |
| 6 | /// The frame `image`, letterboxed/pillarboxed into whatever box it is given, |
| 7 | /// filling that box on its own axis and leaving the other bare -- the bare |
| 8 | /// strip is the box's own background (`BG_CANVAS`), never painted here, which |
| 9 | /// is why every caller sits this on a div already carrying that colour. |
| 10 | /// |
| 11 | /// `Img::object_fit(Contain)` reads right (verified by hand against |
| 12 | /// `ObjectFit::Contain::get_bounds`) but only when taffy has already given the |
| 13 | /// element a real size to fit *into* -- and for a plain `img()` with both axes |
| 14 | /// `Auto` (`size_full()`/`max_w_full().max_h_full()` both resolve that way in |
| 15 | /// this pin), it resolves to the image's own native size first and object-fit |
| 16 | /// never gets a box smaller than the frame to shrink into, so the frame reads |
| 17 | /// through un-fitted. A `canvas()` element carries no such precompute -- its |
| 18 | /// `request_layout` is a plain `Style` read, so it is sized by its parent |
| 19 | /// exactly as a `div()` would be -- and its `paint` callback is handed the |
| 20 | /// real resolved `bounds`, which is all `Contain::get_bounds` needs. |
| 21 | /// |
| 22 | /// `.absolute()` with all four insets zero, not `.size_full()` in flex flow: |
| 23 | /// a flex item under `justify_center()`/`items_center()` (see `picture_area` |
| 24 | /// below) never resolves a percentage cross-axis size for a plain-`Style` |
| 25 | /// element like `canvas()`, which is a taffy circularity and not this |
| 26 | /// element's own bug (confirmed live: bounds handed to `paint` came back |
| 27 | /// `944px x 0px`, main axis right, cross axis collapsed). An absolutely |
| 28 | /// positioned box is sized against its containing block directly instead -- |
| 29 | /// the nearest `.relative()` ancestor, which every caller here already sits |
| 30 | /// this on -- so it never asks taffy's flex algorithm for a cross-axis size |
| 31 | /// at all. |
| 32 | /// |
| 33 | /// That containing block still has to have a real size of its own, though: |
| 34 | /// gpui's default `display` is `Block` (`Style::default()`), not `Flex`, and |
| 35 | /// a `Block` box with height `auto` is sized by its *normal-flow* children -- |
| 36 | /// an `.absolute()` one, this, takes no part in that (confirmed live: with |
| 37 | /// the box lacking its own `.flex()`, this canvas's own bounds came back |
| 38 | /// `944px x 0px` even though its containing block, measured independently, |
| 39 | /// was a real `944px x 335px`). Every `.relative()` ancestor this sits on |
| 40 | /// must also be `.flex()` (see `ui::stance::screen`'s `stance-picture`) for |
| 41 | /// exactly this reason. |
| 42 | pub + Styled |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | |
| 209 | |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 | |
| 218 | |
| 219 | |
| 220 | |
| 221 | |
| 222 | |
| 223 | |
| 224 | |
| 225 | |
| 226 | |
| 227 | |
| 228 | |
| 229 | |
| 230 | |
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | |
| 240 | |
| 241 | |
| 242 | |
| 243 | |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | |
| 250 | |
| 251 | |
| 252 | |
| 253 | |
| 254 | |
| 255 | |
| 256 | |
| 257 | |
| 258 | |
| 259 | |
| 260 | |
| 261 | |
| 262 | |
| 263 | |
| 264 | |
| 265 | |
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | |
| 272 | |
| 273 | |
| 274 | |
| 275 | |
| 276 | |
| 277 | |
| 278 | |
| 279 | |
| 280 | |
| 281 | |
| 282 | |
| 283 | |
| 284 | |
| 285 | |
| 286 | |
| 287 |