aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/oofawarewidget.cc15
-rw-r--r--dw/style.cc5
-rw-r--r--dw/style.hh9
-rw-r--r--dw/table.cc14
-rw-r--r--dw/table.hh2
-rw-r--r--dw/widget.cc6
-rw-r--r--src/cssparser.cc6
-rw-r--r--src/styleengine.cc3
8 files changed, 37 insertions, 23 deletions
diff --git a/dw/oofawarewidget.cc b/dw/oofawarewidget.cc
index 99f297ff..7017ebfa 100644
--- a/dw/oofawarewidget.cc
+++ b/dw/oofawarewidget.cc
@@ -91,6 +91,9 @@ bool OOFAwareWidget::isOOFContainer (Widget *widget, int oofmIndex)
->isPossibleContainerParent (OOFM_FLOATS)) ||
// Inline blocks are containing blocks, too.
widget->getStyle()->display == core::style::DISPLAY_INLINE_BLOCK ||
+ // Same for blocks with 'overview' set to another value than
+ // (the default value) 'visible'.
+ widget->getStyle()->overflow != core::style::OVERFLOW_VISIBLE ||
// Finally, "out of flow" in a narrower sense: floats;
// absolutely and fixedly positioned elements; furthermore,
// relatively positioned elements must already be
@@ -102,16 +105,8 @@ bool OOFAwareWidget::isOOFContainer (Widget *widget, int oofmIndex)
// Only the toplevel widget (as for all) as well as absolutely,
// relatively, and fixedly positioned elements constitute the
// containing block for absolutely positioned elements, but
- // neither floats nor other elements like table cells.
- //
- // (Notice that relative positions are not yet supported, but
- // only tested to get the correct containing block. Furthermore,
- // it seems that this test would be incorrect for floats.)
- //
- // We also test whether this widget is a textblock: is this
- // necessary? (What about other absolutely widgets containing
- // children, like tables? TODO: Check CSS spec.)
-
+ // neither floats nor other elements like table cells, or
+ // elements with 'overview' set to another value than 'visible'.
return widget->instanceOf (OOFAwareWidget::CLASS_ID) &&
(widget->getParent() == NULL || testWidgetPositioned (widget));
diff --git a/dw/style.cc b/dw/style.cc
index 1c2978b4..830613fa 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;
@@ -107,6 +108,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. */
@@ -168,6 +170,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 &&
@@ -225,6 +228,7 @@ int StyleAttrs::hashValue () {
textTransform +
vloat +
clear +
+ overflow +
position +
top +
bottom +
@@ -352,6 +356,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 9c6bedf1..43fff0a1 100644
--- a/dw/style.hh
+++ b/dw/style.hh
@@ -333,6 +333,13 @@ enum FontVariant {
FONT_VARIANT_SMALL_CAPS
};
+enum Overflow {
+ OVERFLOW_VISIBLE,
+ OVERFLOW_HIDDEN,
+ OVERFLOW_SCROLL,
+ OVERFLOW_AUTO
+};
+
enum Position {
POSITION_STATIC,
POSITION_RELATIVE,
@@ -540,6 +547,8 @@ public:
FloatType vloat; /* "float" is a keyword. */
ClearType clear;
+ Overflow overflow;
+
Position position;
Length top, bottom, left, right;
diff --git a/dw/table.cc b/dw/table.cc
index 4259111a..ce45b7ad 100644
--- a/dw/table.cc
+++ b/dw/table.cc
@@ -753,12 +753,16 @@ void Table::forceCalcCellSizes (bool calcHeights)
getExtremes (&extremes);
int availWidth = getAvailWidth (true);
- int totalWidth = availWidth -
- ((numCols + 1) * getStyle()->hBorderSpacing + boxDiffWidth ());
-
+ // When adjust_table_min_width is set, use the minimal (intrinsic)
+ // width for correction.
+ int corrWidth =
+ Table::getAdjustTableMinWidth () ? extremes.minWidthIntrinsic : 0;
+ int totalWidth = misc::max (availWidth, corrWidth)
+ - ((numCols + 1) * getStyle()->hBorderSpacing + boxDiffWidth ());
+
DBG_OBJ_MSGF ("resize", 1,
- "totalWidth = %d - ((%d - 1) * %d + %d) = <b>%d</b>",
- availWidth, numCols, getStyle()->hBorderSpacing,
+ "totalWidth = max (%d, %d) - ((%d - 1) * %d + %d) = <b>%d</b>",
+ availWidth, corrWidth, numCols, getStyle()->hBorderSpacing,
boxDiffWidth (), totalWidth);
colWidths->setSize (numCols, 0);
diff --git a/dw/table.hh b/dw/table.hh
index c47ff465..560a2cb7 100644
--- a/dw/table.hh
+++ b/dw/table.hh
@@ -485,7 +485,7 @@ public:
inline static void setAdjustTableMinWidth (bool adjustTableMinWidth)
{ Table::adjustTableMinWidth = adjustTableMinWidth; }
- inline static int getAdjustTableMinWidth ()
+ inline static bool getAdjustTableMinWidth ()
{ return Table::adjustTableMinWidth; }
Table(bool limitTextWidth);
diff --git a/dw/widget.cc b/dw/widget.cc
index 19083f61..553439ff 100644
--- a/dw/widget.cc
+++ b/dw/widget.cc
@@ -608,9 +608,6 @@ int Widget::getAvailWidth (bool forceValue)
DBG_OBJ_MSG_END ();
}
- if (width != -1)
- width = misc::max (width, getMinWidth (NULL, forceValue));
-
DBG_OBJ_MSGF ("resize", 1, "=> %d", width);
DBG_OBJ_LEAVE ();
@@ -1553,9 +1550,6 @@ int Widget::getAvailWidthOfChild (Widget *child, bool forceValue)
}
}
- if (width != -1)
- width = misc::max (width, child->getMinWidth (NULL, forceValue));
-
DBG_OBJ_MSGF ("resize", 1, "=> %d", width);
DBG_OBJ_LEAVE ();
diff --git a/src/cssparser.cc b/src/cssparser.cc
index c400a8e6..57661ff1 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 8a90751e..a660b175 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;