Skip to content

Commit

Permalink
Add vertical align
Browse files Browse the repository at this point in the history
  • Loading branch information
goanpeca committed Apr 27, 2020
1 parent abebfff commit 9d2f0f6
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 21 deletions.
22 changes: 22 additions & 0 deletions colosseum/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,29 @@ def value(self, context):
# 10.8 Leading and half-leading
######################################################################
# line_height

# vertical_align
BASELINE = 'baseline'
SUB = 'sub'
SUPER = 'super'
TOP = 'top'
TEXT_TOP = 'text-top'
MIDDLE = 'middle'
BOTTOM = 'bottom'
TEXT_BOTTOM = 'text-bottom'

VERTICAL_ALIGN_CHOICES = Choices(
BASELINE,
SUB,
SUPER,
TOP,
TEXT_TOP,
MIDDLE,
BOTTOM,
TEXT_BOTTOM,
validators=[is_percentage, is_length],
explicit_defaulting_constants=[INHERIT],
)

######################################################################
# 11.1.1 Overflow
Expand Down
44 changes: 23 additions & 21 deletions colosseum/declaration.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
from . import engine as css_engine
from . import parser
from . import engine as css_engine, parser
from .constants import ( # noqa
ALIGN_CONTENT_CHOICES, ALIGN_ITEMS_CHOICES, ALIGN_SELF_CHOICES, AUTO,
BACKGROUND_COLOR_CHOICES, BORDER_COLLAPSE_CHOICES, BORDER_COLOR_CHOICES,
BORDER_SPACING_CHOICES, BORDER_STYLE_CHOICES, BORDER_WIDTH_CHOICES,
BOX_OFFSET_CHOICES, CAPTION_SIDE_CHOICES, CLEAR_CHOICES, CLIP_CHOICES,
COLOR_CHOICES, DIRECTION_CHOICES, DISPLAY_CHOICES, EMPTY_CELLS_CHOICES,
FLEX_BASIS_CHOICES, FLEX_DIRECTION_CHOICES, FLEX_GROW_CHOICES,
FLEX_SHRINK_CHOICES, FLEX_START, FLEX_WRAP_CHOICES, FLOAT_CHOICES,
GRID_AUTO_CHOICES, GRID_AUTO_FLOW_CHOICES, GRID_GAP_CHOICES,
GRID_PLACEMENT_CHOICES, GRID_TEMPLATE_AREA_CHOICES, GRID_TEMPLATE_CHOICES,
INITIAL, INLINE, INVERT, JUSTIFY_CONTENT_CHOICES, LETTER_SPACING_CHOICES,
LTR, MARGIN_CHOICES, MAX_SIZE_CHOICES, MEDIUM, MIN_SIZE_CHOICES, NORMAL,
NOWRAP, ORDER_CHOICES, ORPHANS_CHOICES, OUTLINE_COLOR_CHOICES,
OUTLINE_STYLE_CHOICES, OUTLINE_WIDTH_CHOICES, OVERFLOW_CHOICES,
PADDING_CHOICES, PAGE_BREAK_AFTER_CHOICES, PAGE_BREAK_BEFORE_CHOICES,
PAGE_BREAK_INSIDE_CHOICES, POSITION_CHOICES, QUOTES_CHOICES, ROW,
SEPARATE, SHOW, SIZE_CHOICES, STATIC, STRETCH, TABLE_LAYOUT_CHOICES,
BACKGROUND_COLOR_CHOICES, BASELINE, BORDER_COLLAPSE_CHOICES,
BORDER_COLOR_CHOICES, BORDER_SPACING_CHOICES, BORDER_STYLE_CHOICES,
BORDER_WIDTH_CHOICES, BOX_OFFSET_CHOICES, CAPTION_SIDE_CHOICES,
CLEAR_CHOICES, CLIP_CHOICES, COLOR_CHOICES, DIRECTION_CHOICES,
DISPLAY_CHOICES, EMPTY_CELLS_CHOICES, FLEX_BASIS_CHOICES,
FLEX_DIRECTION_CHOICES, FLEX_GROW_CHOICES, FLEX_SHRINK_CHOICES, FLEX_START,
FLEX_WRAP_CHOICES, FLOAT_CHOICES, GRID_AUTO_CHOICES,
GRID_AUTO_FLOW_CHOICES, GRID_GAP_CHOICES, GRID_PLACEMENT_CHOICES,
GRID_TEMPLATE_AREA_CHOICES, GRID_TEMPLATE_CHOICES, INITIAL, INLINE, INVERT,
JUSTIFY_CONTENT_CHOICES, LETTER_SPACING_CHOICES, LTR, MARGIN_CHOICES,
MAX_SIZE_CHOICES, MEDIUM, MIN_SIZE_CHOICES, NORMAL, NOWRAP, ORDER_CHOICES,
ORPHANS_CHOICES, OUTLINE_COLOR_CHOICES, OUTLINE_STYLE_CHOICES,
OUTLINE_WIDTH_CHOICES, OVERFLOW_CHOICES, PADDING_CHOICES,
PAGE_BREAK_AFTER_CHOICES, PAGE_BREAK_BEFORE_CHOICES,
PAGE_BREAK_INSIDE_CHOICES, POSITION_CHOICES, QUOTES_CHOICES, ROW, SEPARATE,
SHOW, SIZE_CHOICES, STATIC, STRETCH, TABLE_LAYOUT_CHOICES,
TEXT_ALIGN_CHOICES, TEXT_DECORATION_CHOICES, TEXT_INDENT_CHOICES,
TEXT_TRANSFORM_CHOICES, TOP, TRANSPARENT, UNICODE_BIDI_CHOICES,
VISIBILITY_CHOICES, VISIBLE, WHITE_SPACE_CHOICES, WIDOWS_CHOICES,
WORD_SPACING_CHOICES, Z_INDEX_CHOICES, OtherProperty,
VERTICAL_ALIGN_CHOICES, VISIBILITY_CHOICES, VISIBLE, WHITE_SPACE_CHOICES,
WIDOWS_CHOICES, WORD_SPACING_CHOICES, Z_INDEX_CHOICES, OtherProperty,
TextAlignInitialValue, default,
)
from .exceptions import ValidationError
from .wrappers import Border, BorderBottom, BorderLeft, BorderRight, BorderTop, Outline
from .wrappers import (
Border, BorderBottom, BorderLeft, BorderRight, BorderTop, Outline,
)

_CSS_PROPERTIES = set()

Expand Down Expand Up @@ -305,7 +307,7 @@ def __init__(self, **style):

# 10.8 Leading and half-leading
# line_height
# vertical_align
vertical_align = validated_property('vertical_align', choices=VERTICAL_ALIGN_CHOICES, initial=BASELINE)

# 11. Visual effects #################################################
# 11.1.1 Overflow
Expand Down

0 comments on commit 9d2f0f6

Please sign in to comment.