Skip to content

Commit

Permalink
micro-op
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Jan 7, 2025
1 parent 51905de commit d1b1242
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/textual/css/styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,16 +543,16 @@ def auto_dimensions(self) -> bool:
)

@property
def is_relative_width(self) -> bool:
def is_relative_width(self, _relative_units={Unit.FRACTION, Unit.PERCENT}) -> bool:
"""Does the node have a relative width?"""
width = self.width
return width is not None and width.unit in (Unit.FRACTION, Unit.PERCENT)
return width is not None and width.unit in _relative_units

@property
def is_relative_height(self) -> bool:
def is_relative_height(self, _relative_units={Unit.FRACTION, Unit.PERCENT}) -> bool:
"""Does the node have a relative width?"""
height = self.height
return height is not None and height.unit in (Unit.FRACTION, Unit.PERCENT)
return height is not None and height.unit in _relative_units

@property
def is_auto_width(self) -> bool:
Expand All @@ -566,6 +566,14 @@ def is_auto_height(self) -> bool:
height = self.height
return height is not None and height.unit == Unit.AUTO

@property
def is_dynamic_height(
self, _dynamic_units={Unit.AUTO, Unit.FRACTION, Unit.PERCENT}
) -> bool:
"""Does the node have a dynamic (not fixed) height?"""
height = self.height
return height is not None and height.unit in _dynamic_units

@property
def is_docked(self) -> bool:
"""Is the node docked?"""
Expand Down

0 comments on commit d1b1242

Please sign in to comment.