OLD | NEW |
(Empty) | |
| 1 # `Source/core/layout` |
| 2 |
| 3 ## Overflow rects and scroll offsets |
| 4 |
| 5 PaintLayerScrollableArea uses a "scroll origin" to conceptually represent the di
stance between |
| 6 the top-left corner of the box'es content rect and the top-left corner of its ov
erflow rect |
| 7 when the box is scrolled to the logical beginning of its content (.e.g. all the
way to the left for |
| 8 LTR, all the way to the right for RTL). For left-to-right and top-to-bottom flo
ws, the scroll |
| 9 origin is zero, i.e., the top/left of the overflow rect is at the same position
as the top/left of |
| 10 the box'es content rect when scrolled to the beginning of flow. For right-to-le
ft and bottom-to-top |
| 11 flows, the overflow rect extends to the top/left of the client rect. |
| 12 |
| 13 The default calculation for scroll origin is the distance between the top-left c
orner of the content |
| 14 rect and the top-left corner of the overflow rect. To illustrate, here is a box
with left overflow and |
| 15 no vertical scrollbar: |
| 16 |
| 17 content |
| 18 rect |
| 19 |<-------->| |
| 20 scroll |
| 21 origin |
| 22 |<-------->| |
| 23 _____________________ |
| 24 | | | |
| 25 | | | |
| 26 | | | |
| 27 direction:rtl | | box | |
| 28 | | | |
| 29 | | | |
| 30 |__________|__________| |
| 31 |
| 32 overflow rect |
| 33 |<--------------------->| |
| 34 |
| 35 |
| 36 However, if the box has a scrollbar for the orthogonal direction (e.g., a vertic
al scrollbar |
| 37 in a direction:rtl block), the size of the scrollbar must be added to the scroll
origin calculation. |
| 38 Here are two examples -- note that it doesn't matter whether the vertical scroll
bar is placed on |
| 39 the right or left of the box (the vertical scrollbar is the |/| part): |
| 40 |
| 41 content |
| 42 rect |
| 43 |<-------->| |
| 44 scroll |
| 45 origin |
| 46 |<---------->| |
| 47 _______________________ |
| 48 | |/| | |
| 49 | |/| | |
| 50 | |/| | |
| 51 direction:rtl | |/| box | |
| 52 | |/| | |
| 53 | |/| | |
| 54 |__________|/|__________| |
| 55 |
| 56 overflow rect |
| 57 |<--------------------->| |
| 58 |
| 59 |
| 60 |
| 61 content |
| 62 rect |
| 63 |<-------->| |
| 64 scroll |
| 65 origin |
| 66 |<---------->| |
| 67 _______________________ |
| 68 | | |/| |
| 69 | | |/| |
| 70 | | |/| |
| 71 writing-mode: | | |/| |
| 72 vertical-rl | | |/| |
| 73 | | |/| |
| 74 | | |/| |
| 75 | | |/| |
| 76 |__________|__________|/| |
| 77 |
| 78 overflow rect |
| 79 |<--------------------->| |
OLD | NEW |