diff options
-rw-r--r-- | dw/textblock.cc | 35 | ||||
-rw-r--r-- | dw/textblock.hh | 5 | ||||
-rw-r--r-- | src/form.cc | 2 |
3 files changed, 27 insertions, 15 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc index 52eda3e1..700c748b 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -202,7 +202,7 @@ void Textblock::setStretchabilityFactor (int stretchabilityFactor) Textblock::stretchabilityFactor = stretchabilityFactor; } -Textblock::Textblock (bool limitTextWidth) +Textblock::Textblock (bool limitTextWidth, bool treatAsInline) { DBG_OBJ_CREATE ("dw::Textblock"); registerName ("dw::Textblock", &CLASS_ID); @@ -252,6 +252,7 @@ Textblock::Textblock (bool limitTextWidth) DBG_OBJ_SET_NUM ("lineBreakWidth", lineBreakWidth); this->limitTextWidth = limitTextWidth; + this->treatAsInline = treatAsInline; for (int layer = 0; layer < core::HIGHLIGHT_NUM_LAYERS; layer++) { /* hlStart[layer].index > hlEnd[layer].index means no highlighting */ @@ -3169,18 +3170,28 @@ int Textblock::getMaxGeneratorWidth () bool Textblock::usesMaxGeneratorWidth () { DBG_OBJ_ENTER0 ("resize", 0, "usesMaxGeneratorWidth"); - bool toplevel = getParent () == NULL, - block = getStyle()->display == core::style::DISPLAY_BLOCK, - vloat = testWidgetFloat (this), - abspos = testWidgetAbsolutelyPositioned (this), - fixpos = testWidgetFixedlyPositioned (this), - // In detail, this depends on what the respective OOFM does - // with the child widget: + + bool result; + if (treatAsInline) { + DBG_OBJ_MSG ("resize", 1, "treatAsInline set"); + result = false; + } else { + bool toplevel = getParent () == NULL, + block = getStyle()->display == core::style::DISPLAY_BLOCK, + vloat = testWidgetFloat (this), + abspos = testWidgetAbsolutelyPositioned (this), + fixpos = testWidgetFixedlyPositioned (this); + DBG_OBJ_MSGF("resize", 1, + "toplevel: %s, block: %s, float: %s, abspos: %s, fixpos: %s", + boolToStr(toplevel), boolToStr(block), boolToStr(vloat), + boolToStr(abspos), boolToStr(fixpos)); + + // In detail, this depends on what the respective OOFM does with the + // child widget: result = toplevel || (block && !(vloat || abspos || fixpos)); - DBG_OBJ_LEAVE_VAL ("%s (toplevel: %s, block: %s, float: %s, abspos: %s, " - "fixpos: %s)", - boolToStr(result), boolToStr(toplevel), boolToStr(block), - boolToStr(vloat), boolToStr(abspos), boolToStr(fixpos)); + } + + DBG_OBJ_LEAVE_VAL ("%s", boolToStr(result)); return result; } diff --git a/dw/textblock.hh b/dw/textblock.hh index fd92b636..dc4805e1 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -570,7 +570,8 @@ protected: static int stretchabilityFactor; bool limitTextWidth; /* from preferences */ - + bool treatAsInline; + int redrawY; int lastWordDrawn; @@ -876,7 +877,7 @@ public: { return !testStyleOutOfFlow (style) || testStyleRelativelyPositioned (style); } - Textblock (bool limitTextWidth); + Textblock (bool limitTextWidth, bool treatAsInline = false); ~Textblock (); core::Iterator *iterator (core::Content::Type mask, bool atEnd); diff --git a/src/form.cc b/src/form.cc index af219000..61dc01d2 100644 --- a/src/form.cc +++ b/src/form.cc @@ -944,7 +944,7 @@ void Html_tag_open_button(DilloHtml *html, const char *tag, int tagsize) /* We used to have Textblock (prefs.limit_text_width, ...) here, * but it caused 100% CPU usage. */ - page = new Textblock (false); + page = new Textblock (false, true); page->setStyle (html->backgroundStyle ()); ResourceFactory *factory = HT2LT(html)->getResourceFactory(); |