summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/layout.cc2
-rw-r--r--dw/textblock.cc20
-rw-r--r--dw/widget.cc24
3 files changed, 37 insertions, 9 deletions
diff --git a/dw/layout.cc b/dw/layout.cc
index c89b2868..d82595d8 100644
--- a/dw/layout.cc
+++ b/dw/layout.cc
@@ -372,6 +372,8 @@ void Layout::addWidget (Widget *widget)
topLevel = widget;
widget->layout = this;
widget->container = NULL;
+ DBG_OBJ_SET_PTR_O (widget, "container", widget->container);
+
queueResizeList->clear ();
widget->notifySetAsTopLevel ();
diff --git a/dw/textblock.cc b/dw/textblock.cc
index 93fd64a7..7ef6ad27 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -333,6 +333,8 @@ void Textblock::sizeRequestImpl (core::Requisition *requisition)
DBG_OBJ_MSG ("resize", 0, "<b>sizeRequestImpl</b> ()");
DBG_OBJ_MSG_START ();
+ lineBreakWidth = getAvailWidth ();
+
rewrap ();
showMissingLines ();
@@ -780,16 +782,26 @@ int Textblock::getAvailWidthOfChild (Widget *child)
// TODO Implement also for ListItem.
// TODO Correct by extremes?
+ DBG_OBJ_MSGF ("resize", 0, "<b>getAvailWidthOfChild</b> (%p)", child);
+ DBG_OBJ_MSG_START ();
+
+ int width;
+
if (core::style::isAbsLength (child->getStyle()->width))
- return core::style::absLengthVal (child->getStyle()->width);
+ width = core::style::absLengthVal (child->getStyle()->width);
else {
int containerWidth = getAvailWidth ();
if (core::style::isPerLength (child->getStyle()->width))
- return core::style::multiplyWithPerLength (containerWidth,
- child->getStyle()->width);
+ width = core::style::multiplyWithPerLength (containerWidth,
+ child->getStyle()->width);
else
- return containerWidth;
+ width = containerWidth;
}
+
+ DBG_OBJ_MSGF ("resize", 1, "=> %d", width);
+ DBG_OBJ_MSG_END ();
+
+ return width;
}
bool Textblock::buttonPressImpl (core::EventButton *event)
diff --git a/dw/widget.cc b/dw/widget.cc
index e7562875..79b94120 100644
--- a/dw/widget.cc
+++ b/dw/widget.cc
@@ -71,6 +71,8 @@ Widget::Widget ()
flags = (Flags)(NEEDS_RESIZE | EXTREMES_CHANGED | HAS_CONTENTS);
parent = generator = container = NULL;
+ DBG_OBJ_SET_PTR ("container", container);
+
layout = NULL;
allocation.x = -1;
@@ -157,7 +159,7 @@ void Widget::setParent (Widget *parent)
// more complicated when absolute and fixed positions are
// supported.
container = NULL;
- for (Widget *widget = this; widget != NULL && container == NULL;
+ for (Widget *widget = getParent (); widget != NULL && container == NULL;
widget = widget->getParent())
if (widget->isPossibleContainer ())
container = widget;
@@ -165,6 +167,7 @@ void Widget::setParent (Widget *parent)
// (surprisingly!) also no container (i. e. the viewport is
// used). Does not occur in dillo, where the toplevel widget is a
// Textblock.
+ DBG_OBJ_SET_PTR ("container", container);
notifySetParent();
}
@@ -340,19 +343,30 @@ int Widget::getAvailWidth ()
// TODO Correct by extremes?
// TODO Border, padding etc.? (Relevant here?)
+ DBG_OBJ_MSG ("resize", 0, "<b>getAvailWidth</b> ()");
+ DBG_OBJ_MSG_START ();
+
+ int width;
+
if (container == NULL) {
// TODO Consider nested layouts (e. g. <button>).
int viewportWidth =
layout->viewportWidth - (layout->canvasHeightGreater ?
layout->vScrollbarThickness : 0);
if (style::isAbsLength (getStyle()->width))
- return style::absLengthVal (getStyle()->width);
+ width = style::absLengthVal (getStyle()->width);
else if (style::isPerLength (getStyle()->width))
- return style::multiplyWithPerLength (viewportWidth, getStyle()->width);
+ width = style::multiplyWithPerLength (viewportWidth,
+ getStyle()->width);
else
- return viewportWidth;
+ width = viewportWidth;
} else
- return container->getAvailWidthOfChild (this);
+ width = container->getAvailWidthOfChild (this);
+
+ DBG_OBJ_MSGF ("resize", 1, "=> %d", width);
+ DBG_OBJ_MSG_END ();
+
+ return width;
}
/**