@@ -1559,20 +1559,32 @@ impl Interactivity {
1559
1559
) -> Point < Pixels > {
1560
1560
if let Some ( scroll_offset) = self . scroll_offset . as_ref ( ) {
1561
1561
let mut scroll_to_bottom = false ;
1562
- let mut tracked_scroll_handle = self
1563
- . tracked_scroll_handle
1564
- . as_ref ( )
1565
- . map ( |handle| handle. 0 . borrow_mut ( ) ) ;
1566
- if let Some ( mut scroll_handle_state) = tracked_scroll_handle. as_deref_mut ( ) {
1567
- scroll_handle_state. overflow = style. overflow ;
1568
- scroll_to_bottom = mem:: take ( & mut scroll_handle_state. scroll_to_bottom ) ;
1562
+ if let Some ( scroll_handle) = & self . tracked_scroll_handle {
1563
+ let mut state = scroll_handle. 0 . borrow_mut ( ) ;
1564
+ state. overflow = style. overflow ;
1565
+ scroll_to_bottom = mem:: take ( & mut state. scroll_to_bottom ) ;
1569
1566
}
1570
1567
1571
1568
let rem_size = window. rem_size ( ) ;
1572
- let padding = style. padding . to_pixels ( bounds. size . into ( ) , rem_size) ;
1573
- let padding_size = size ( padding. left + padding. right , padding. top + padding. bottom ) ;
1574
- let padded_content_size = self . content_size + padding_size;
1575
- let scroll_max = ( padded_content_size - bounds. size ) . max ( & Size :: default ( ) ) ;
1569
+ let padding_size = size (
1570
+ style
1571
+ . padding
1572
+ . left
1573
+ . to_pixels ( bounds. size . width . into ( ) , rem_size)
1574
+ + style
1575
+ . padding
1576
+ . right
1577
+ . to_pixels ( bounds. size . width . into ( ) , rem_size) ,
1578
+ style
1579
+ . padding
1580
+ . top
1581
+ . to_pixels ( bounds. size . height . into ( ) , rem_size)
1582
+ + style
1583
+ . padding
1584
+ . bottom
1585
+ . to_pixels ( bounds. size . height . into ( ) , rem_size) ,
1586
+ ) ;
1587
+ let scroll_max = ( self . content_size + padding_size - bounds. size ) . max ( & Size :: default ( ) ) ;
1576
1588
// Clamp scroll offset in case scroll max is smaller now (e.g., if children
1577
1589
// were removed or the bounds became larger).
1578
1590
let mut scroll_offset = scroll_offset. borrow_mut ( ) ;
@@ -1584,10 +1596,6 @@ impl Interactivity {
1584
1596
scroll_offset. y = scroll_offset. y . clamp ( -scroll_max. height , px ( 0. ) ) ;
1585
1597
}
1586
1598
1587
- if let Some ( mut scroll_handle_state) = tracked_scroll_handle {
1588
- scroll_handle_state. padded_content_size = padded_content_size;
1589
- }
1590
-
1591
1599
* scroll_offset
1592
1600
} else {
1593
1601
Point :: default ( )
@@ -2905,7 +2913,6 @@ impl ScrollAnchor {
2905
2913
struct ScrollHandleState {
2906
2914
offset : Rc < RefCell < Point < Pixels > > > ,
2907
2915
bounds : Bounds < Pixels > ,
2908
- padded_content_size : Size < Pixels > ,
2909
2916
child_bounds : Vec < Bounds < Pixels > > ,
2910
2917
scroll_to_bottom : bool ,
2911
2918
overflow : Point < Overflow > ,
@@ -2968,11 +2975,6 @@ impl ScrollHandle {
2968
2975
self . 0 . borrow ( ) . child_bounds . get ( ix) . cloned ( )
2969
2976
}
2970
2977
2971
- /// Get the size of the content with padding of the container.
2972
- pub fn padded_content_size ( & self ) -> Size < Pixels > {
2973
- self . 0 . borrow ( ) . padded_content_size
2974
- }
2975
-
2976
2978
/// scroll_to_item scrolls the minimal amount to ensure that the child is
2977
2979
/// fully visible
2978
2980
pub fn scroll_to_item ( & self , ix : usize ) {
0 commit comments