Skip to content

Commit

Permalink
Remove WIP overflow:scroll and overflow:auto support
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoburns committed Apr 10, 2023
1 parent 8f58b1a commit dc8f39f
Show file tree
Hide file tree
Showing 29 changed files with 27 additions and 567 deletions.
3 changes: 1 addition & 2 deletions scripts/gentest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ fn generate_node(ident: &str, node: &Value) -> TokenStream {
}
let overflow_x = quote_overflow(&style["overflowX"]);
let overflow_y = quote_overflow(&style["overflowY"]);
let (overflow, scrollbar_width) = if overflow_x.is_some() || overflow_y.is_some() {
let (overflow, _scrollbar_width) = if overflow_x.is_some() || overflow_y.is_some() {
let overflow_x = overflow_x.unwrap_or(quote!(taffy::style::Overflow::Visible));
let overflow_y = overflow_y.unwrap_or(quote!(taffy::style::Overflow::Visible));
let overflow = quote!(overflow: taffy::geometry::Point { x: #overflow_x, y: #overflow_y },);
Expand Down Expand Up @@ -578,7 +578,6 @@ fn generate_node(ident: &str, node: &Value) -> TokenStream {
#flex_direction
#flex_wrap
#overflow
#scrollbar_width
#align_items
#align_self
#justify_items
Expand Down
17 changes: 1 addition & 16 deletions src/style/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,8 @@ impl Default for Position {
/// the main ones being:
///
/// - The automatic minimum size Flexbox/CSS Grid items with non-`Visible` overflow is `0` rather than being content based
/// - `Overflow::Scroll` nodes have space in the layout reserved for a scrollbar (width controlled by the `scrollbar_width` property)
/// - `Overflow::Auto` nodes also have space in the layout reserved for a scrollbar, *but only if their contents actually overflow*.
///
/// In Taffy, we only implement the layout related secondary effects as we are not concerned with drawing/painting. The amount of space reserved for
/// a scrollbar is controlled by the `scrollbar_width` property. If this is `0` then `Auto` and `Scroll` behave identically to `Hidden`.
/// In Taffy, we only implement the layout related secondary effects as we are not concerned with drawing/painting.
///
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/overflow>
#[derive(Copy, Clone, PartialEq, Eq, Debug, Default)]
Expand All @@ -116,14 +113,6 @@ pub enum Overflow {
Visible,
/// The automatic minimum size of this node as a flexbox/grid item should be `0`.
Hidden,
/// The automatic minimum size of this node as a flexbox/grid item should be `0`. Additionally, space should be reserved
/// for a scrollbar. The amount of space reserved is controlled by the `scrollbar_width` property.
Scroll,
/// The automatic minimum size of this node as a flexbox/grid item should be 0. Additionall, while this node should initially be laid out
/// without reserving space for a scrollbar, *if* the contents of this node overflow during this initial layout then space should be reserved
/// for a scrollbar and the node's relayout recomputed on that basis. The amount of space reserved is controlled by the `scrollbar_width` property.
/// If this is set to `0` then no relayout will occur.
Auto,
}

impl Overflow {
Expand Down Expand Up @@ -169,8 +158,6 @@ pub struct Style {
// Overflow properties
/// How children overflowing their container should affect layout
pub overflow: Point<Overflow>,
/// How much space (in points) should be reserved for the scrollbars of `Overflow::Scroll` and `Overflow::Auto` nodes.
pub scrollbar_width: u8,

// Position properties
/// What should the `position` value of this struct use as a base offset?
Expand Down Expand Up @@ -283,7 +270,6 @@ impl Style {
pub const DEFAULT: Style = Style {
display: Display::DEFAULT,
overflow: Point { x: Overflow::Visible, y: Overflow::Visible },
scrollbar_width: 0,
position: Position::Relative,
inset: Rect::auto(),
margin: Rect::zero(),
Expand Down Expand Up @@ -356,7 +342,6 @@ mod tests {
let old_defaults = Style {
display: Default::default(),
overflow: Default::default(),
scrollbar_width: 0,
position: Default::default(),
#[cfg(feature = "flexbox")]
flex_direction: Default::default(),
Expand Down
17 changes: 0 additions & 17 deletions test_fixtures/grid_overflow_inline_axis_auto.html

This file was deleted.

17 changes: 0 additions & 17 deletions test_fixtures/grid_overflow_inline_axis_scroll.html

This file was deleted.

17 changes: 0 additions & 17 deletions test_fixtures/overflow_main_axis_shrink_auto.html

This file was deleted.

17 changes: 0 additions & 17 deletions test_fixtures/overflow_main_axis_shrink_scroll.html

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions tests/generated/grid_fit_content_points_min_content_hidden.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 0 additions & 53 deletions tests/generated/grid_overflow_inline_axis_auto.rs

This file was deleted.

1 change: 0 additions & 1 deletion tests/generated/grid_overflow_inline_axis_hidden.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 0 additions & 56 deletions tests/generated/grid_overflow_inline_axis_scroll.rs

This file was deleted.

4 changes: 2 additions & 2 deletions tests/generated/grid_percent_items_nested_moderate.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit dc8f39f

Please sign in to comment.