summaryrefslogtreecommitdiff
path: root/dw
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2016-06-18 14:29:21 +0200
committerSebastian Geerken <devnull@localhost>2016-06-18 14:29:21 +0200
commit0f477f0eb575b5d060e8c2e2dbcbcded5703ad94 (patch)
tree34ff43a68b28b59a71548314c9effdc686c783a1 /dw
parentf26132d1a2e3850e155706b02b4df5d7c5251f68 (diff)
Fix <button> size (treat as inline).
Diffstat (limited to 'dw')
-rw-r--r--dw/textblock.cc35
-rw-r--r--dw/textblock.hh5
2 files changed, 26 insertions, 14 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);