summaryrefslogtreecommitdiff
path: root/src/styleengine.cc
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-12-18 22:23:30 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-12-18 22:23:30 +0100
commited284d8d579e2ac580d81e1977cd8aa9bea5b1e4 (patch)
treefc1776fa844019c31518267352d42772994d319d /src/styleengine.cc
parent83c0cf6af8df3d6603d05dca469ff86102349f48 (diff)
support border-width: thin | medium | thick
Diffstat (limited to 'src/styleengine.cc')
-rw-r--r--src/styleengine.cc33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/styleengine.cc b/src/styleengine.cc
index c5d44906..cf61044b 100644
--- a/src/styleengine.cc
+++ b/src/styleengine.cc
@@ -386,20 +386,16 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) {
attrs->borderStyle.top = (BorderStyle) p->value.intVal;
break;
case CSS_PROPERTY_BORDER_BOTTOM_WIDTH:
- computeValue (&attrs->borderWidth.bottom, p->value.intVal,
- attrs->font);
+ computeBorderWidth (&attrs->borderWidth.bottom, p, attrs->font);
break;
case CSS_PROPERTY_BORDER_LEFT_WIDTH:
- computeValue (&attrs->borderWidth.left, p->value.intVal,
- attrs->font);
+ computeBorderWidth (&attrs->borderWidth.left, p, attrs->font);
break;
case CSS_PROPERTY_BORDER_RIGHT_WIDTH:
- computeValue (&attrs->borderWidth.right, p->value.intVal,
- attrs->font);
+ computeBorderWidth (&attrs->borderWidth.right, p, attrs->font);
break;
case CSS_PROPERTY_BORDER_TOP_WIDTH:
- computeValue (&attrs->borderWidth.top, p->value.intVal,
- attrs->font);
+ computeBorderWidth (&attrs->borderWidth.top, p, attrs->font);
break;
case CSS_PROPERTY_BORDER_SPACING:
computeValue (&attrs->hBorderSpacing, p->value.intVal,attrs->font);
@@ -552,6 +548,27 @@ bool StyleEngine::computeLength (dw::core::style::Length *dest,
return false;
}
+void StyleEngine::computeBorderWidth (int *dest, CssProperty *p,
+ dw::core::style::Font *font) {
+ if (p->type == CSS_TYPE_ENUM) {
+ switch (p->value.intVal) {
+ case CSS_BORDER_WIDTH_THIN:
+ *dest = 1;
+ break;
+ case CSS_BORDER_WIDTH_MEDIUM:
+ *dest = 2;
+ break;
+ case CSS_BORDER_WIDTH_THICK:
+ *dest = 3;
+ break;
+ default:
+ assert(false);
+ }
+ } else {
+ computeValue (dest, p->value.intVal, font);
+ }
+}
+
/**
* \brief Similar to StyleEngine::style(), but with backgroundColor set.
* A normal style might have backgroundColor == NULL to indicate a transparent