changeset 1464:2ed2df2dfaad

add support for CSS property list-style-position
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Tue, 08 Dec 2009 18:41:23 +0100
parents ee19ce246de5
children 76b8dcb8126c
files ChangeLog dw/listitem.cc dw/style.cc dw/style.hh src/cssparser.cc src/styleengine.cc
diffstat 6 files changed, 23 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Dec 07 21:04:38 2009 +0100
+++ b/ChangeLog	Tue Dec 08 18:41:23 2009 +0100
@@ -13,6 +13,7 @@
  - Ignore XML comment markers in CSS.
  - Split up long lines in plain.cc to avoid X11 coordinate overflows.
  - Fix user agent style for nested <ul>.
+ - Add support for CSS property list-style-position.
    Patch: Johannes Hofmann
 +- Cleaned up system includes in dpid directory.
  - Fixed CustProgressBox() for systems without weak symbols.
--- a/dw/listitem.cc	Mon Dec 07 21:04:38 2009 +0100
+++ b/dw/listitem.cc	Tue Dec 08 18:41:23 2009 +0100
@@ -43,7 +43,8 @@
    hasListitemValue = true;
    addWidget (widget, style);
    addSpace (style);
-   updateValue ();
+   if (style->listStylePosition == core::style::LIST_STYLE_POSITION_OUTSIDE)
+      updateValue ();
 }
 
 void ListItem::initWithText (const char *text, core::style::Style *style)
@@ -51,7 +52,8 @@
    hasListitemValue = true;
    addText (text, style);
    addSpace (style);
-   updateValue ();
+   if (style->listStylePosition == core::style::LIST_STYLE_POSITION_OUTSIDE)
+      updateValue ();
 }
 
 int ListItem::getValue ()
--- a/dw/style.cc	Mon Dec 07 21:04:38 2009 +0100
+++ b/dw/style.cc	Tue Dec 08 18:41:23 2009 +0100
@@ -41,6 +41,7 @@
    textDecoration = TEXT_DECORATION_NONE;
    textAlign = TEXT_ALIGN_LEFT;
    textAlignChar = '.';
+   listStylePosition = LIST_STYLE_POSITION_OUTSIDE;
    listStyleType = LIST_STYLE_TYPE_DISC;
    valign = VALIGN_BASELINE;
    backgroundColor = NULL;
@@ -131,6 +132,7 @@
        borderStyle.left == otherAttrs->borderStyle.left &&
        display == otherAttrs->display &&
        whiteSpace == otherAttrs->whiteSpace &&
+       listStylePosition == otherAttrs->listStylePosition &&
        listStyleType == otherAttrs->listStyleType &&
        x_link == otherAttrs->x_link &&
        x_img == otherAttrs->x_img &&
@@ -162,6 +164,7 @@
       borderStyle.left +
       display +
       whiteSpace +
+      listStylePosition +
       listStyleType +
       x_link +
       x_img +
@@ -240,6 +243,7 @@
    borderStyle = attrs->borderStyle;
    display = attrs->display;
    whiteSpace = attrs->whiteSpace;
+   listStylePosition = attrs->listStylePosition;
    listStyleType = attrs->listStyleType;
    cursor = attrs->cursor;
    x_link = attrs->x_link;
--- a/dw/style.hh	Mon Dec 07 21:04:38 2009 +0100
+++ b/dw/style.hh	Tue Dec 08 18:41:23 2009 +0100
@@ -256,6 +256,10 @@
    DISPLAY_LAST
 };
 
+enum ListStylePosition {
+   LIST_STYLE_POSITION_INSIDE,
+   LIST_STYLE_POSITION_OUTSIDE
+};
 
 enum ListStyleType {
    LIST_STYLE_TYPE_DISC,
@@ -427,6 +431,7 @@
 
    DisplayType display;
    WhiteSpace whiteSpace;
+   ListStylePosition listStylePosition;
    ListStyleType listStyleType;
    Cursor cursor;
 
--- a/src/cssparser.cc	Mon Dec 07 21:04:38 2009 +0100
+++ b/src/cssparser.cc	Tue Dec 08 18:41:23 2009 +0100
@@ -81,6 +81,10 @@
    "normal", NULL
 };
 
+static const char *const Css_list_style_position_enum_vals[] = {
+   "inside", "outside", NULL
+};
+
 static const char *const Css_list_style_type_enum_vals[] = {
    "disc", "circle", "square", "decimal", "decimal-leading-zero",
    "lower-roman", "upper-roman", "lower-greek", "lower-alpha",
@@ -157,7 +161,8 @@
     Css_letter_spacing_enum_vals},
    {"line-height", {CSS_TYPE_UNUSED}, NULL},
    {"list-style-image", {CSS_TYPE_UNUSED}, NULL},
-   {"list-style-position", {CSS_TYPE_UNUSED}, NULL},
+   {"list-style-position", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED},
+    Css_list_style_position_enum_vals},
    {"list-style-type", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED},
     Css_list_style_type_enum_vals},
    {"margin-bottom", {CSS_TYPE_SIGNED_LENGTH, CSS_TYPE_UNUSED}, NULL},
--- a/src/styleengine.cc	Mon Dec 07 21:04:38 2009 +0100
+++ b/src/styleengine.cc	Tue Dec 08 18:41:23 2009 +0100
@@ -414,6 +414,9 @@
          case CSS_PROPERTY_DISPLAY:
             attrs->display = (DisplayType) p->value.intVal;
             break;
+         case CSS_PROPERTY_LIST_STYLE_POSITION:
+            attrs->listStylePosition = (ListStylePosition) p->value.intVal;
+            break;
          case CSS_PROPERTY_LIST_STYLE_TYPE:
             attrs->listStyleType = (ListStyleType) p->value.intVal;
             break;