aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devdoc/dw-grows.doc3
-rw-r--r--devdoc/dw-miscellaneous.doc36
-rw-r--r--devdoc/dw-size-request-pos.doc3
-rw-r--r--devdoc/dw-widget-sizes.doc3
-rw-r--r--dw/oofawarewidget.hh3
-rw-r--r--dw/textblock.cc12
6 files changed, 53 insertions, 7 deletions
diff --git a/devdoc/dw-grows.doc b/devdoc/dw-grows.doc
index c255419f..11b6f5fc 100644
--- a/devdoc/dw-grows.doc
+++ b/devdoc/dw-grows.doc
@@ -4,7 +4,8 @@
padding: 0.5em 1em; background-color: #ffffe0">The complex "widget
sizes" is currently divided into three documents: \ref
dw-widget-sizes, **Grand Redesign Of Widget Sizes** (this document),
- and \ref dw-size-request-pos. </div>
+ and \ref dw-size-request-pos. Furthermore, there are some notes in
+ \ref dw-miscellaneous.</div>
This paper describes (will describe) some design changes to
calculating widget sizes. Goals are:
diff --git a/devdoc/dw-miscellaneous.doc b/devdoc/dw-miscellaneous.doc
index 97e944d7..dc282354 100644
--- a/devdoc/dw-miscellaneous.doc
+++ b/devdoc/dw-miscellaneous.doc
@@ -13,8 +13,7 @@ A widget allocation outside of the allocation of the parent is
allowed, but the part outside is not visible.
Which widgets may be drawn?
--------------------
-
+---------------------------
All drawing starts with the toplevel widget
(cf. dw::core::Widget::queueDrawArea, dw::core::Layout::queueDraw, and
dw::core::Layout::expose), and a widget has to draw its children, in a
@@ -46,4 +45,37 @@ Extra space
Should dw::core::Widget::calcExtraSpace be called from
dw::core::Widget::getExtremes?
+
+Widget sizes
+============
+
+Relation between dw::core::Widget::markSizeChange and dw::core::Widget::queueResize
+------------------------------------------------------------------------------------
+dw::oof::OOFFloatsMgr::markSizeChange (called from
+dw::Textblock::markSizeChange) calls dw::oof::OOFAwareWidget::updateReference,
+whose implementation dw::Textblock::updateReference calls
+dw::core::Widget::queueResize. This may result in a recursion,
+
+- for which it is not clear whether it ends in all cases (although endless cases
+ are not known yet), and
+- which nevertheless may take much time in cases where the number of calls
+ increases exponentially with the depth of the widget tree.
+
+The recent change in dw::Textblock::updateReference (`if (lines->size () > 0)`)
+seems to fix the performance problem, but the issue should be examined further,
+albeit with lower priority. Especially, it has to be determined, under which
+conditions it is allowed to (directly or indirectly) call
+dw::core::Widget::queueResize within an implementation of
+dw::core::Widget::markSizeChange.
+
+Here is the orginal test case (slow, when `if (lines->size () > 0)` is removed
+again):
+
+ (for i in $(seq 1 20); do echo '<div style="float:left"><div></div>'; done) > tmp.html; src/dillo tmp.html
+
+You may change the numner (20), or examine smaller cases with
+<a href="http://home.gna.org/rtfl/">RTFL</a>:
+
+ (for i in $(seq 1 3); do echo '<div style="float:left"><div></div>'; done) > tmp.html; src/dillo tmp.html | rtfl-objview -OM -A "*" -a resize -a resize.oofm
+
*/
diff --git a/devdoc/dw-size-request-pos.doc b/devdoc/dw-size-request-pos.doc
index 8780bde8..5a8a4d80 100644
--- a/devdoc/dw-size-request-pos.doc
+++ b/devdoc/dw-size-request-pos.doc
@@ -4,7 +4,8 @@
padding: 0.5em 1em; background-color: #ffffe0">The complex "widget
sizes" is currently divided into three documents: \ref
dw-widget-sizes, \ref dw-grows, and **Size requisitions depending on
- positions** (this document).</div>
+ positions** (this document). Furthermore, there are some notes in
+ \ref dw-miscellaneous.</div>
Motivation
diff --git a/devdoc/dw-widget-sizes.doc b/devdoc/dw-widget-sizes.doc
index ffc7fb5d..a6fcac4c 100644
--- a/devdoc/dw-widget-sizes.doc
+++ b/devdoc/dw-widget-sizes.doc
@@ -4,7 +4,8 @@
padding: 0.5em 1em; background-color: #ffffe0">The complex "widget
sizes" is currently divided into three documents: **Sizes of Dillo
Widgets** (this document), \ref dw-grows, and \ref
- dw-size-request-pos. </div>
+ dw-size-request-pos. Furthermore, there are some notes in
+ \ref dw-miscellaneous.</div>
<div style="border: 2px solid #ff4040; margin: 1em 0;
padding: 0.5em 1em; background-color: #fff0f0"><b>Info:</b>
diff --git a/dw/oofawarewidget.hh b/dw/oofawarewidget.hh
index e49cce14..8d18675e 100644
--- a/dw/oofawarewidget.hh
+++ b/dw/oofawarewidget.hh
@@ -249,7 +249,8 @@ public:
core::DrawingContext *context);
/**
- * ...
+ * Update content in flow, down from `ref`. Uses e. g. when floats sizes have
+ * changed.
*/
virtual void updateReference (int ref);
diff --git a/dw/textblock.cc b/dw/textblock.cc
index 124e6a80..52eda3e1 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -3034,8 +3034,18 @@ void Textblock::queueDrawRange (int index1, int index2)
void Textblock::updateReference (int ref)
{
- if (words->size () > 0)
+ // The condition "(lines->size () > 0)" prevents CPU hogging in some cases,
+ // see devdoc/dw-miscellaneous.doc, "Relation between
+ // dw::core::Widget::markSizeChange and dw::core::Widget::queueResize".
+ //
+ // This condition is safe, since an implementation of
+ // dw::oof::OOFAwareWidget::updateReference should only affect content in
+ // flow, not widgets out of flow, like floats.
+
+ if (lines->size () > 0)
queueResize (ref, false);
+
+ // TODO: "if (words->size () > 0)" has to be considered.
}
void Textblock::widgetRefSizeChanged (int externalIndex)