aboutsummaryrefslogtreecommitdiff
path: root/dw
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2016-06-04 19:33:27 -0400
committerJorge Arellano Cid <jcid@dillo.org>2016-06-04 19:33:27 -0400
commit49fed8fae7ae99e4af9cb878c0a4558c54064861 (patch)
treef3630a18c6caa041e2a9a7fdc6332a1ed7a0c21c /dw
parentbff442ac673109f2ea5c0c3fcdbd66f30dfe5eb8 (diff)
imported patch pos-adjustments
Diffstat (limited to 'dw')
-rw-r--r--dw/ooffloatsmgr.cc4
-rw-r--r--dw/textblock.cc20
-rw-r--r--dw/textblock_linebreaking.cc36
3 files changed, 52 insertions, 8 deletions
diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc
index 38a1bb4b..cadf980e 100644
--- a/dw/ooffloatsmgr.cc
+++ b/dw/ooffloatsmgr.cc
@@ -475,6 +475,7 @@ int OOFFloatsMgr::calcFloatX (Float *vloat)
// (ii) If there is more than one line, the line break will already be
// exceeded, and so be smaller that GB width + float width.
effGeneratorWidth =
+ //min (vloat->generator->getGeneratorWidth (0, 0),
min (vloat->generator->getGeneratorWidth (0, 0) + vloat->size.width,
vloat->generator->getMaxGeneratorWidth ());
MSG("UsesMaxGenW=%d gen->MaxGenW()=%d genW00=%d effGenW=%d ",
@@ -485,9 +486,12 @@ int OOFFloatsMgr::calcFloatX (Float *vloat)
x = max (generator->getC0RelX (oofmIndex) + effGeneratorWidth
- vloat->size.width - generator->getStyle()->boxRestWidth(),
+ //- generator->getStyle()->boxRestWidth(),
// Do not exceed container allocation:
0);
+ //if (x == 356) x -= 34;
+
MSG("vloatW=%d gen->getC0RelX()=%d g->boxRestWidth()=%d x=%d",
vloat->size.width,
generator->getC0RelX (oofmIndex),
diff --git a/dw/textblock.cc b/dw/textblock.cc
index b70376a6..ce93fd36 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -3119,7 +3119,7 @@ int Textblock::getGeneratorRest (int oofmIndex)
int width = getGeneratorWidth (0, 0);
rest = container->getGeneratorWidth (xRef, width) - (xRef + width);
} else {
- // Only callend for floats, so this should not happen:
+ // Only called for floats, so this should not happen:
assertNotReached ();
rest = 0;
}
@@ -3132,15 +3132,31 @@ int Textblock::getGeneratorWidth (int callerX, int callerWidth)
{
DBG_OBJ_ENTER ("resize", 0, "Textblock::getGeneratorWidth", "%d, %d",
callerX, callerWidth);
-
+
+ if (0 && lines->size () > 0) {
+ Word *lastWordOfLine, *lwol0;
+ lwol0 = words->getRef(lines->getRef(0)->lastWord);
+ lastWordOfLine = words->getRef(lines->getLastRef()->lastWord);
+ MSG("lww=%d lwol0=%d ", lastWordOfLine->totalWidth, lwol0->totalWidth);
+ MSG("lbw0=%d lbwl=%d\n",
+ calcLineBreakWidth(0),
+ calcLineBreakWidth(lines->size() - 1));
+ }
// Cf. sizeRequestImpl.
if (usesMaxGeneratorWidth ()) {
DBG_OBJ_LEAVE_VAL ("%d", lineBreakWidth);
return lineBreakWidth;
} else {
+#if 0
+ int w0 = max (lines->size () > 0 ? lines->getLastRef()->maxLineWidth : 0,
+ callerX + callerWidth);
+ ...
+ w = min (w0 + leftInnerPadding + boxDiffWidth (), lineBreakWidth);
+#else
int w0 = max (lines->size () > 0 ? lines->getLastRef()->maxLineWidth : 0,
callerX + callerWidth),
w = min (w0 + leftInnerPadding + boxDiffWidth (), lineBreakWidth);
+#endif
DBG_OBJ_LEAVE_VAL ("min (%d + %d + %d, %d) = %d",
w0, leftInnerPadding, boxDiffWidth (), lineBreakWidth,
w);
diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc
index 5e921961..e48c9a6e 100644
--- a/dw/textblock_linebreaking.cc
+++ b/dw/textblock_linebreaking.cc
@@ -575,7 +575,7 @@ int Textblock::wordWrap (int wordIndex, bool wrapAll)
n = wrapWordOofRef (wordIndex, wrapAll);
else
n = wrapWordInFlow (wordIndex, wrapAll);
-
+ _MSG("wordWrap word[%d] wtW=%d\n", wordIndex, word->totalWidth);
DBG_OBJ_MSGF ("construct.word", 1, "=> %d", n);
DBG_OBJ_LEAVE ();
@@ -758,7 +758,6 @@ int Textblock::wrapWordInFlow (int wordIndex, bool wrapAll)
// (currently?).
lastFloatPos = newFloatPos;
-
Widget *widget =
words->getRef(lastFloatPos)->content.widgetReference->widget;
int oofmIndex = getWidgetOOFIndex (widget);
@@ -813,7 +812,6 @@ int Textblock::wrapWordInFlow (int wordIndex, bool wrapAll)
}
addLine (firstIndex, breakPos, lastFloatPos, tempNewLine, minHeight);
-
DBG_OBJ_MSGF ("construct.word", 1,
"accumulating again from %d to %d",
breakPos + 1, wordIndexEnd);
@@ -823,7 +821,12 @@ int Textblock::wrapWordInFlow (int wordIndex, bool wrapAll)
// update word pointer as hyphenateWord() can trigger a
// reorganization of the words structure
word = words->getRef (wordIndex);
-
+ MSG("wrapWordInFlow brkPos=%d, wIdxEnd=%d, word[%d].totalWidth=%d\n",
+ breakPos, wordIndexEnd,
+ wordIndex, words->getRef(wordIndex)->totalWidth);
+ if (words->getRef(wordIndex)->totalWidth == 36) {
+ MSG("*");
+ }
penaltyIndex = calcPenaltyIndexForNewLine ();
}
} while (newLine);
@@ -1654,7 +1657,6 @@ void Textblock::accumulateWordData (int wordIndex)
word->maxDescent = word->size.descent;
word->totalSpaceStretchability = 0;
word->totalSpaceShrinkability = 0;
-
DBG_OBJ_MSGF ("construct.word.accum", 1,
"first word of line: words[%d].totalWidth = %d + %d = %d; "
"maxAscent = %d, maxDescent = %d",
@@ -1666,6 +1668,7 @@ void Textblock::accumulateWordData (int wordIndex)
word->totalWidth = prevWord->totalWidth
+ prevWord->origSpace - prevWord->hyphenWidth
+ word->size.width + word->hyphenWidth;
+ _MSG("wtW=%d ", word->totalWidth);
word->maxAscent = max (prevWord->maxAscent, word->size.ascent);
word->maxDescent = max (prevWord->maxDescent, word->size.descent);
word->totalSpaceStretchability =
@@ -1965,6 +1968,21 @@ void Textblock::rewrap ()
// So this is necessary: word = words->getRef (i);
}
+ MSG("rewrap tb=%p: totalWidth { ", this);
+ for (int i = firstWord; i < words->size (); i++) {
+ Word *word = words->getRef (i);
+ MSG("w%d=%d ", i, word->totalWidth);
+ }
+ MSG("}");
+
+ MSG(", Lines MaxW{ ");
+ for (int i = 0; i < lines->size (); ++i) {
+ Line *line = lines->getRef(i);
+ MSG("l%d=%d ", i, line->maxLineWidth);
+ //Line *lastLine = lines->getLastRef();
+ }
+ MSG("}\n");
+
// Next time, the page will not have to be rewrapped.
wrapRefLines = -1;
DBG_OBJ_SET_NUM ("wrapRefLines", wrapRefLines);
@@ -2053,7 +2071,7 @@ void Textblock::calcBorders (int lastOofRef, int height)
{
DBG_OBJ_ENTER ("construct.line", 0, "calcBorders", "%d, %d",
lastOofRef, height);
-
+ MSG("calcBorders tb=%p ", this);
newLineHasFloatLeft = newLineHasFloatRight = false;
newLineLeftBorder = newLineRightBorder = 0;
newLineLeftFloatHeight = newLineRightFloatHeight = 0;
@@ -2112,6 +2130,7 @@ void Textblock::calcBorders (int lastOofRef, int height)
newLineHasFloatLeft = newLineHasFloatLeft || thisHasLeft;
thisHasRight = oofm->hasFloatRight (y, height, this, effOofRef);
newLineHasFloatRight = newLineHasFloatRight || thisHasRight;
+ MSG("nlhFR=%d thR=%d ", newLineHasFloatRight, thisHasRight);
// TODO "max" is not really correct for the heights. (Does
// not matter, since only one, the float manager, returns
@@ -2129,8 +2148,12 @@ void Textblock::calcBorders (int lastOofRef, int height)
if (thisHasRight) {
newLineRightBorder =
max (newLineRightBorder,
+#if 0
+ oofm->getRightBorder (y, height, this, effOofRef));
+#else
oofm->getRightBorder (y, height, this, effOofRef)
- getGeneratorRest (i));
+#endif
newLineRightFloatHeight =
max (newLineRightFloatHeight,
oofm->getRightFloatHeight (y, height, this, effOofRef));
@@ -2147,6 +2170,7 @@ void Textblock::calcBorders (int lastOofRef, int height)
}
}
}
+ MSG("\n");
DBG_OBJ_SET_BOOL ("newLineHasFloatLeft", newLineHasFloatLeft);
DBG_OBJ_SET_BOOL ("newLineHasFloatRight", newLineHasFloatRight);