changeset 1755:71f7877a5d37

css text-indent property thread: http://lists.auriga.wearlab.de/pipermail/dillo-dev/2010-November/007801.html
author corvid <corvid@lavabit.com>
date Tue, 09 Nov 2010 00:18:56 +0000
parents 7874398eb633
children d247a3e0d41a
files dw/style.cc dw/style.hh dw/textblock.cc src/cssparser.cc src/styleengine.cc
diffstat 5 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/dw/style.cc	Thu Oct 21 21:03:47 2010 +0200
+++ b/dw/style.cc	Tue Nov 09 00:18:56 2010 +0000
@@ -46,6 +46,7 @@
    valign = VALIGN_BASELINE;
    backgroundColor = NULL;
    width = height = lineHeight = LENGTH_AUTO;
+   textIndent = 0;
    margin.setVal (0);
    borderWidth.setVal (0);
    padding.setVal (0);
@@ -120,6 +121,7 @@
        width == otherAttrs->width &&
        height == otherAttrs->height &&
        lineHeight == otherAttrs->lineHeight &&
+       textIndent == otherAttrs->textIndent &&
        margin.equals (&otherAttrs->margin) &&
        borderWidth.equals (&otherAttrs->borderWidth) &&
        padding.equals (&otherAttrs->padding) &&
@@ -155,6 +157,7 @@
       width +
       height +
       lineHeight +
+      textIndent +
       margin.hashValue () +
       borderWidth.hashValue () +
       padding.hashValue () +
@@ -243,6 +246,7 @@
    width = attrs->width;
    height = attrs->height;
    lineHeight = attrs->lineHeight;
+   textIndent = attrs->textIndent;
    margin = attrs->margin;
    borderWidth = attrs->borderWidth;
    padding = attrs->padding;
--- a/dw/style.hh	Thu Oct 21 21:03:47 2010 +0200
+++ b/dw/style.hh	Tue Nov 09 00:18:56 2010 +0000
@@ -432,7 +432,7 @@
    char textAlignChar; /* In future, strings will be supported. */
 
    int hBorderSpacing, vBorderSpacing, wordSpacing;
-   Length width, height, lineHeight;
+   Length width, height, lineHeight, textIndent;
 
    Box margin, borderWidth, padding;
    struct { Color *top, *right, *bottom, *left; } borderColor;
--- a/dw/textblock.cc	Thu Oct 21 21:03:47 2010 +0200
+++ b/dw/textblock.cc	Tue Nov 09 00:18:56 2010 +0000
@@ -890,7 +890,15 @@
           line1Offset + word->size.width > availWidth) {
          line1OffsetEff = 0;
       } else {
-         line1OffsetEff = line1Offset;
+         int indent = 0;
+
+         if (core::style::isPerLength(getStyle()->textIndent)) {
+            indent = misc::roundInt(this->availWidth *
+                     core::style::perLengthVal (getStyle()->textIndent));
+         } else {
+            indent = core::style::absLengthVal (getStyle()->textIndent);
+         }
+         line1OffsetEff = line1Offset + indent;
       }
    }
 
--- a/src/cssparser.cc	Thu Oct 21 21:03:47 2010 +0200
+++ b/src/cssparser.cc	Tue Nov 09 00:18:56 2010 +0000
@@ -213,7 +213,7 @@
    {"text-align", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED}, Css_text_align_enum_vals},
    {"text-decoration", {CSS_TYPE_MULTI_ENUM, CSS_TYPE_UNUSED},
     Css_text_decoration_enum_vals},
-   {"text-indent", {CSS_TYPE_UNUSED}, NULL},
+   {"text-indent", {CSS_TYPE_LENGTH_PERCENTAGE, CSS_TYPE_UNUSED}, NULL},
    {"text-shadow", {CSS_TYPE_UNUSED}, NULL},
    {"text-transform", {CSS_TYPE_UNUSED}, NULL},
    {"top", {CSS_TYPE_UNUSED}, NULL},
--- a/src/styleengine.cc	Thu Oct 21 21:03:47 2010 +0200
+++ b/src/styleengine.cc	Tue Nov 09 00:18:56 2010 +0000
@@ -544,6 +544,9 @@
          case CSS_PROPERTY_TEXT_DECORATION:
             attrs->textDecoration |= p->value.intVal;
             break;
+         case CSS_PROPERTY_TEXT_INDENT:
+            computeLength (&attrs->textIndent, p->value.intVal, attrs->font);
+            break;
          case CSS_PROPERTY_VERTICAL_ALIGN:
             attrs->valign = (VAlignType) p->value.intVal;
             break;