changeset 1759:d247a3e0d41a

merge
author Jorge Arellano Cid <jcid@dillo.org>
date Tue, 09 Nov 2010 10:20:43 -0300
parents ed0b2be9c06d (current diff) 71f7877a5d37 (diff)
children 433a380f83a1
files dw/style.cc dw/style.hh src/cssparser.cc src/styleengine.cc
diffstat 5 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/dw/style.cc	Sun Oct 24 15:00:36 2010 -0300
+++ b/dw/style.cc	Tue Nov 09 10:20:43 2010 -0300
@@ -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);
@@ -122,6 +123,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) &&
@@ -159,6 +161,7 @@
       width +
       height +
       lineHeight +
+      textIndent +
       margin.hashValue () +
       borderWidth.hashValue () +
       padding.hashValue () +
@@ -249,6 +252,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	Sun Oct 24 15:00:36 2010 -0300
+++ b/dw/style.hh	Tue Nov 09 10:20:43 2010 -0300
@@ -437,7 +437,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;
    BorderCollapse borderCollapse;
--- a/dw/textblock.cc	Sun Oct 24 15:00:36 2010 -0300
+++ b/dw/textblock.cc	Tue Nov 09 10:20:43 2010 -0300
@@ -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	Sun Oct 24 15:00:36 2010 -0300
+++ b/src/cssparser.cc	Tue Nov 09 10:20:43 2010 -0300
@@ -218,7 +218,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	Sun Oct 24 15:00:36 2010 -0300
+++ b/src/styleengine.cc	Tue Nov 09 10:20:43 2010 -0300
@@ -547,6 +547,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;