aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dillorc6
-rw-r--r--dw/image.hh4
-rw-r--r--dw/ooffloatsmgr.cc39
-rw-r--r--dw/oofpositionedmgr.cc2
-rw-r--r--dw/textblock.hh13
-rw-r--r--dw/widget.cc31
-rw-r--r--dw/widget.hh2
-rw-r--r--src/prefs.c2
8 files changed, 66 insertions, 33 deletions
diff --git a/dillorc b/dillorc
index d3ef98b8..bb5d4f99 100644
--- a/dillorc
+++ b/dillorc
@@ -81,12 +81,12 @@
# If this is set to YES, all CSS size specifications are adjusted so that
# all contents can be displayed. (Except for tables, see below.)
-#adjust_min_width=NO
+#adjust_min_width=YES
# If this is set to YES, all CSS size specifications for tables are
# adjusted so that all contents can be displayed. This is seperated
-# from "adjust_min_width" (with another standard value) to mimic
-# Firefox, which differenciates between tables and, say, textblocks.
+# from "adjust_min_width" so that it is able to mimic Firefox, which
+# differenciates between tables and, say, textblocks (in some cases).
#adjust_table_min_width=YES
#-------------------------------------------------------------------------
diff --git a/dw/image.hh b/dw/image.hh
index 85776db5..9831c7b6 100644
--- a/dw/image.hh
+++ b/dw/image.hh
@@ -155,6 +155,10 @@ public:
Image(const char *altText);
~Image();
+ // For images, the minimal width is not well defined, and
+ // correction of the size makes not much sense.
+ virtual bool getAdjustMinWidth () { return false; }
+
core::Iterator *iterator (core::Content::Type mask, bool atEnd);
inline core::Imgbuf *getBuffer () { return buffer; }
diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc
index 0553e25d..4025ab77 100644
--- a/dw/ooffloatsmgr.cc
+++ b/dw/ooffloatsmgr.cc
@@ -1930,27 +1930,42 @@ void OOFFloatsMgr::getFloatsExtremes (Extremes *cbExtr, Side side,
DBG_OBJ_MSGF ("resize.oofm", 1,
"float %p has generator %p (container is %p)",
vloat->getWidget (), vloat->generatingBlock,
- containingBlock);
-
+ container);
+
if (vloat->generatingBlock == container ||
wasAllocated (vloat->generatingBlock)) {
Extremes extr;
vloat->getWidget()->getExtremes (&extr);
- int x;
+
+ // The calculation of extremes must be kept consistent with
+ // getSize(). Especially this means for the *minimal* width:
+ //
+ // - The right border (difference between float and
+ // container) does not have to be considered (see
+ // getSize()).
+ //
+ // - This is also the case for the left border, as seen in
+ // calcFloatX() ("... but when the float exceeds the line
+ // break width" ...).
+
+ *minWidth = max (*minWidth, extr.minWidth);
+ // For the maximal width, borders must be considered.
+
if (vloat->generatingBlock == container)
- x = side == LEFT ?
- vloat->generatingBlock->getStyle()->boxOffsetX() : 0;
+ *maxWidth =
+ max (*maxWidth,
+ extr.maxWidth
+ + vloat->generatingBlock->getStyle()->boxDiffWidth());
else {
- Allocation *gba = getAllocation(vloat->generatingBlock);
- x = calcFloatX (vloat, side,
- gba->x - containerAllocation.x, gba->width,
- vloat->generatingBlock->getLineBreakWidth ());
+ Allocation *gba = getAllocation (vloat->generatingBlock);
+ *maxWidth =
+ max (*maxWidth,
+ extr.maxWidth
+ + vloat->generatingBlock->getStyle()->boxDiffWidth()
+ + max (containerAllocation.width - gba->width, 0));
}
- *minWidth = max (*minWidth, x + extr.minWidth);
- *maxWidth = max (*maxWidth, x + extr.maxWidth);
-
DBG_OBJ_MSGF ("resize.oofm", 1, "%d + %d / %d => %d * %d",
x, extr.minWidth, extr.maxWidth, *minWidth, *maxWidth);
} else
diff --git a/dw/oofpositionedmgr.cc b/dw/oofpositionedmgr.cc
index 1e753bda..c46c1e2c 100644
--- a/dw/oofpositionedmgr.cc
+++ b/dw/oofpositionedmgr.cc
@@ -529,7 +529,7 @@ int OOFPositionedMgr::getAvailWidthOfChild (Widget *child, bool forceValue)
}
if (width != -1)
- width = max (width, child->getMinWidth (NULL, forceValue));
+ width = max (width, child->getMinWidth (NULL, true, forceValue));
DBG_OBJ_MSGF ("resize.oofm", 1, "=> %d", width);
DBG_OBJ_LEAVE ();
diff --git a/dw/textblock.hh b/dw/textblock.hh
index 4a8290a8..0834e183 100644
--- a/dw/textblock.hh
+++ b/dw/textblock.hh
@@ -854,18 +854,21 @@ protected:
DBG_OBJ_ENTER0 ("resize", 0, "mustBeWidenedToAvailWidth");
bool toplevel = getParent () == NULL,
block = getStyle()->display == core::style::DISPLAY_BLOCK,
+ listitem = getStyle()->display == core::style::DISPLAY_LIST_ITEM,
vloat = testWidgetFloat (this),
abspos = testWidgetAbsolutelyPositioned (this),
fixpos = testWidgetFixedlyPositioned (this),
// In detail, this depends on what the respective OOFM does
// with the child widget:
- result = toplevel || (block && !(vloat || abspos || fixpos));
+ result =
+ toplevel || ((block || listitem) && !(vloat || abspos || fixpos));
DBG_OBJ_MSGF ("resize", 0,
- "=> %s (toplevel: %s, block: %s, float: %s, abspos: %s, "
- "fixpos: %s)",
+ "=> %s (toplevel: %s, block: %s, listitem: %s, float: %s, "
+ "abspos: %s, fixpos: %s)",
result ? "true" : "false", toplevel ? "true" : "false",
- block ? "true" : "false", vloat ? "true" : "false",
- abspos ? "true" : "false", fixpos ? "true" : "false");
+ block ? "true" : "false", listitem ? "true" : "false",
+ vloat ? "true" : "false", abspos ? "true" : "false",
+ fixpos ? "true" : "false");
DBG_OBJ_LEAVE ();
return result;
}
diff --git a/dw/widget.cc b/dw/widget.cc
index 757452a4..d5c856d2 100644
--- a/dw/widget.cc
+++ b/dw/widget.cc
@@ -60,7 +60,7 @@ void Widget::WidgetImgRenderer::draw (int x, int y, int width, int height)
// ----------------------------------------------------------------------
-bool Widget::adjustMinWidth = false;
+bool Widget::adjustMinWidth = true;
int Widget::CLASS_ID = -1;
Widget::Widget ()
@@ -730,17 +730,21 @@ void Widget::sizeRequest (Requisition *requisition)
*
* If extremes == NULL, getExtremes is called. ForceValue is the same
* value passed to getAvailWidth etc.; if false, getExtremes is not
- * called.
+ * called. A value of "false" is passed for "useCorrected" in the
+ * context of correctExtemes etc., to avoid cyclic dependencies.
+ *
*/
-int Widget::getMinWidth (Extremes *extremes, bool forceValue)
+int Widget::getMinWidth (Extremes *extremes, bool useCorrected, bool forceValue)
{
if (extremes)
- DBG_OBJ_ENTER ("resize", 0, "getMinWidth", "[%d (%d) / %d (%d), %s",
+ DBG_OBJ_ENTER ("resize", 0, "getMinWidth", "[%d (%d) / %d (%d), %s, %s",
extremes->minWidth, extremes->minWidthIntrinsic,
extremes->maxWidth, extremes->maxWidthIntrinsic,
+ useCorrected ? "true" : "false",
forceValue ? "true" : "false");
else
- DBG_OBJ_ENTER ("resize", 0, "getMinWidth", "(nil), %s",
+ DBG_OBJ_ENTER ("resize", 0, "getMinWidth", "(nil), %s, %s",
+ useCorrected ? "true" : "false",
forceValue ? "true" : "false");
int minWidth;
@@ -757,7 +761,14 @@ int Widget::getMinWidth (Extremes *extremes, bool forceValue)
// TODO Not completely clear whether this is feasable: Within
// the context of getAvailWidth(false) etc., getExtremes may not
// be called. We ignore the minimal width then.
- minWidth = extremes ? extremes->minWidthIntrinsic : 0;
+ if (extremes) {
+ if (useCorrected)
+ minWidth =
+ misc::max (extremes->minWidth, extremes->minWidthIntrinsic);
+ else
+ minWidth = extremes->minWidthIntrinsic;
+ } else
+ minWidth = 0;
} else
minWidth = 0;
@@ -883,7 +894,7 @@ void Widget::correctRequisition (Requisition *requisition,
DBG_OBJ_MSG ("resize", 1, "no parent, regarding viewport");
DBG_OBJ_MSG_START ();
- int limitMinWidth = getMinWidth (NULL, true);
+ int limitMinWidth = getMinWidth (NULL, true, true);
int viewportWidth =
layout->viewportWidth - (layout->canvasHeightGreater ?
layout->vScrollbarThickness : 0);
@@ -940,7 +951,7 @@ void Widget::correctExtremes (Extremes *extremes)
DBG_OBJ_MSG ("resize", 1, "no parent, regarding viewport");
DBG_OBJ_MSG_START ();
- int limitMinWidth = getMinWidth (extremes, false);
+ int limitMinWidth = getMinWidth (extremes, false, false);
int viewportWidth =
layout->viewportWidth - (layout->canvasHeightGreater ?
layout->vScrollbarThickness : 0);
@@ -1824,7 +1835,7 @@ void Widget::correctReqWidthOfChild (Widget *child, Requisition *requisition)
assert (this == child->quasiParent || this == child->container);
- int limitMinWidth = child->getMinWidth (NULL, true);
+ int limitMinWidth = child->getMinWidth (NULL, true, true);
child->calcFinalWidth (child->getStyle(), -1, this, limitMinWidth, false,
&requisition->width);
@@ -1884,7 +1895,7 @@ void Widget::correctExtremesOfChild (Widget *child, Extremes *extremes)
(child->container ? child->container : child->parent);
if (effContainer == this) {
- int limitMinWidth = child->getMinWidth (extremes, false);
+ int limitMinWidth = child->getMinWidth (extremes, false, false);
int width = child->calcWidth (child->getStyle()->width, -1, this,
limitMinWidth, false);
int minWidth = child->calcWidth (child->getStyle()->minWidth, -1, this,
diff --git a/dw/widget.hh b/dw/widget.hh
index 1a1bf41e..a14cd55b 100644
--- a/dw/widget.hh
+++ b/dw/widget.hh
@@ -459,7 +459,7 @@ public:
virtual int applyPerWidth (int containerWidth, style::Length perWidth);
virtual int applyPerHeight (int containerHeight, style::Length perHeight);
- int getMinWidth (Extremes *extremes, bool forceValue);
+ int getMinWidth (Extremes *extremes, bool useCorrected, bool forceValue);
virtual bool isBlockLevel ();
virtual bool isPossibleContainer ();
diff --git a/src/prefs.c b/src/prefs.c
index abcbfcd0..65ebcdae 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -68,7 +68,7 @@ void a_Prefs_init(void)
prefs.http_referer = dStrdup(PREFS_HTTP_REFERER);
prefs.http_user_agent = dStrdup(PREFS_HTTP_USER_AGENT);
prefs.limit_text_width = FALSE;
- prefs.adjust_min_width = FALSE;
+ prefs.adjust_min_width = TRUE;
prefs.adjust_table_min_width = TRUE;
prefs.load_images=TRUE;
prefs.load_background_images=FALSE;