diff options
author | Sebastian Geerken <devnull@localhost> | 2014-10-03 12:49:03 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2014-10-03 12:49:03 +0200 |
commit | 4d154339cf13216d97a460cfbc6bfa7f3fac040e (patch) | |
tree | 2fc8fdeecb92574154c64420329c61664e7a70ab | |
parent | fa01703ead5b5c92badfd3f381314ebcb16d5c42 (diff) |
Added (not implemented) CSS attribute 'overflow'.
-rw-r--r-- | dw/style.cc | 5 | ||||
-rw-r--r-- | dw/style.hh | 9 | ||||
-rw-r--r-- | src/cssparser.cc | 6 | ||||
-rw-r--r-- | src/styleengine.cc | 3 |
4 files changed, 22 insertions, 1 deletions
diff --git a/dw/style.cc b/dw/style.cc index d548d209..53d2cbb7 100644 --- a/dw/style.cc +++ b/dw/style.cc @@ -76,6 +76,7 @@ void StyleAttrs::initValues () minWidth = maxWidth = minHeight = maxHeight = LENGTH_AUTO; vloat = FLOAT_NONE; clear = CLEAR_NONE; + overflow = OVERFLOW_VISIBLE; position = POSITION_STATIC; top = bottom = left = right = LENGTH_AUTO; textIndent = 0; @@ -106,6 +107,7 @@ void StyleAttrs::resetValues () textAlignChar = '.'; vloat = FLOAT_NONE; /** \todo Correct? Check specification. */ clear = CLEAR_NONE; /** \todo Correct? Check specification. */ + overflow = OVERFLOW_VISIBLE; position = POSITION_STATIC; /** \todo Correct? Check specification. */ top = bottom = left = right = LENGTH_AUTO; /** \todo Correct? Check specification. */ @@ -167,6 +169,7 @@ bool StyleAttrs::equals (object::Object *other) { textTransform == otherAttrs->textTransform && vloat == otherAttrs->vloat && clear == otherAttrs->clear && + overflow == otherAttrs->overflow && position == otherAttrs->position && top == otherAttrs->top && bottom == otherAttrs->bottom && @@ -223,6 +226,7 @@ int StyleAttrs::hashValue () { textTransform + vloat + clear + + overflow + position + top + bottom + @@ -349,6 +353,7 @@ void Style::copyAttrs (StyleAttrs *attrs) textTransform = attrs->textTransform; vloat = attrs->vloat; clear = attrs->clear; + overflow = attrs->overflow; position = attrs->position; top = attrs->top; bottom = attrs->bottom; diff --git a/dw/style.hh b/dw/style.hh index bda567ce..948a6457 100644 --- a/dw/style.hh +++ b/dw/style.hh @@ -331,6 +331,13 @@ enum FontVariant { FONT_VARIANT_SMALL_CAPS }; +enum Overflow { + OVERFLOW_VISIBLE, + OVERFLOW_HIDDEN, + OVERFLOW_SCROLL, + OVERFLOW_AUTO +}; + enum Position { POSITION_STATIC, POSITION_RELATIVE, @@ -527,6 +534,8 @@ public: FloatType vloat; /* "float" is a keyword. */ ClearType clear; + Overflow overflow; + Position position; Length top, bottom, left, right; diff --git a/src/cssparser.cc b/src/cssparser.cc index a8de027a..1487a605 100644 --- a/src/cssparser.cc +++ b/src/cssparser.cc @@ -129,6 +129,10 @@ static const char *const Css_list_style_type_enum_vals[] = { "katakana-iroha", "none", NULL }; +static const char *const Css_overflow_enum_vals[] = { + "visible", "hidden", "scroll", "auto", NULL +}; + static const char *const Css_position_enum_vals[] = { "static", "relative", "absolute", "fixed", NULL }; @@ -250,7 +254,7 @@ const CssPropertyInfo Css_property_info[CSS_PROPERTY_LAST] = { {"outline-color", {CSS_TYPE_UNUSED}, NULL}, {"outline-style", {CSS_TYPE_UNUSED}, NULL}, {"outline-width", {CSS_TYPE_UNUSED}, NULL}, - {"overflow", {CSS_TYPE_UNUSED}, NULL}, + {"overflow", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED}, Css_overflow_enum_vals}, {"padding-bottom", {CSS_TYPE_LENGTH, CSS_TYPE_UNUSED}, NULL}, {"padding-left", {CSS_TYPE_LENGTH, CSS_TYPE_UNUSED}, NULL}, {"padding-right", {CSS_TYPE_LENGTH, CSS_TYPE_UNUSED}, NULL}, diff --git a/src/styleengine.cc b/src/styleengine.cc index 1c90b7b7..918e7460 100644 --- a/src/styleengine.cc +++ b/src/styleengine.cc @@ -653,6 +653,9 @@ void StyleEngine::apply (int i, StyleAttrs *attrs, CssPropertyList *props, if (attrs->margin.top < 0) // \todo fix negative margins in dw/* attrs->margin.top = 0; break; + case CSS_PROPERTY_OVERFLOW: + attrs->overflow = (Overflow) p->value.intVal; + break; case CSS_PROPERTY_PADDING_TOP: computeValue (&attrs->padding.top, p->value.intVal, attrs->font); break; |