From 45b8ba7af289b7ba3c5b043d8db7cec3c73e67df Mon Sep 17 00:00:00 2001 From: Sebastian Geerken Date: Fri, 1 Jan 2016 23:32:21 +0100 Subject: SRDOP: Consider references and positions in Textblock::sizeRequestImpl. --- dw/textblock.cc | 23 ++++++++++++++++++++++- dw/textblock.hh | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) (limited to 'dw') diff --git a/dw/textblock.cc b/dw/textblock.cc index 37eaa7e5..b6db1763 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -236,11 +236,14 @@ Textblock::Textblock (bool limitTextWidth) anchors = new misc::SimpleVector (1); wrapRefLines = wrapRefParagraphs = -1; + wrapRefLinesFCX = wrapRefLinesFCY = -1; DBG_OBJ_SET_NUM ("lines.size", lines->size ()); DBG_OBJ_SET_NUM ("words.size", words->size ()); DBG_OBJ_SET_NUM ("wrapRefLines", wrapRefLines); DBG_OBJ_SET_NUM ("wrapRefParagraphs", wrapRefParagraphs); + DBG_OBJ_SET_NUM ("wrapRefLinesFCX",wrapRefLinesFCX); + DBG_OBJ_SET_NUM ("wrapRefLinesFCY", wrapRefLinesFCY); hoverLink = -1; @@ -305,13 +308,31 @@ void Textblock::sizeRequestImpl (core::Requisition *requisition, int numPos, DBG_OBJ_ENTER ("resize", 0, "sizeRequestImpl", "%d, ...", numPos); sizeRequestParams.fill (numPos, references, x, y); + + // We have to rewrap the whole textblock, if (i) the available width (which + // is the line break width) has changed, or (ii) if the position within the + // float container, and so possibly borders relative to this textblock, have + // changed. + // + // (The latter is a simplification: an over-correct implementation would test + // all OOFMs on whether affectsLeftBorder() or affectsRightBorder() returns + // true.) int newLineBreakWidth = getAvailWidth (true); - if (newLineBreakWidth != lineBreakWidth) { + int newFCX = getGeneratorX (OOFM_FLOATS); + int newFCY = getGeneratorY (OOFM_FLOATS); + + if (newLineBreakWidth != lineBreakWidth || + newFCX != wrapRefLinesFCX || newFCY != wrapRefLinesFCY) { lineBreakWidth = newLineBreakWidth; wrapRefLines = 0; + wrapRefLinesFCX = newFCX; + wrapRefLinesFCY = newFCY; + DBG_OBJ_SET_NUM ("lineBreakWidth", lineBreakWidth); DBG_OBJ_SET_NUM ("wrapRefLines", wrapRefLines); + DBG_OBJ_SET_NUM ("wrapRefLinesFCX",wrapRefLinesFCX); + DBG_OBJ_SET_NUM ("wrapRefLinesFCY", wrapRefLinesFCY); } rewrap (); diff --git a/dw/textblock.hh b/dw/textblock.hh index 439942de..c5e790ba 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -582,6 +582,7 @@ protected: are the line numbers, not the value stored in parentRef. */ + int wrapRefLinesFCX, wrapRefLinesFCY; // These four values are calculated by containingBlock->outOfFlowMgr // (when defined; otherwise, they are false, or 0, respectively), for -- cgit v1.2.3