Bug 885


Subject: Bug 885
From: Jesper Skov (jskov@redhat.com)
Date: Sun Jun 11 2000 - 16:30:13 CDT


I tried to add the below to Bug 885, but it doesn't seem to work.

Jesper

This is due to the first line on the new page not having any Runs which can
contain the point. Sound familiar? But adding something like the below
only partly fixes the problem - other code starts to fail when I really
exercise the page/line brake handling.

What's currently in the tree is still way better than what was there before -
so I guess this bug, while critical, doesn't argue for removing my other
changes.

As for a proper fix, I want to spend time getting rid of the N-Z-L
dependencies/assumptions of the BlockLayout class instead. It should
fix this problem as well, anyway.

Index: fl_BlockLayout.cpp
===================================================================
RCS file: /cvsroot/abi/src/text/fmt/xp/fl_BlockLayout.cpp,v
retrieving revision 1.157
diff -u -5 -r1.157 fl_BlockLayout.cpp
--- fl_BlockLayout.cpp 2000/06/11 11:27:11 1.157
+++ fl_BlockLayout.cpp 2000/06/11 21:23:12
@@ -2897,12 +2897,27 @@
         PT_BlockOffset blockOffset = (pcrx->getPosition() - getPosition());
 
         fp_Run* pFirstNewRun = NULL;
         fp_Run* pLastRun = NULL;
         fp_Run* pRun;
+
         for (pRun=m_pFirstRun; (pRun && !pFirstNewRun); pLastRun=pRun,
pRun=pRun->getNext())
         {
+#if 1
+ if (pRun->getBlockOffset() + pRun->getLength() == blockOffset) {
+ pFirstNewRun = pRun->getNext();
+ break;
+ }
+ if (pRun->getBlockOffset() <= blockOffset
+ && pRun->getBlockOffset() + pRun->getLength() > blockOffset)
+ {
+ pFirstNewRun = pRun;
+ break;
+ }
+
+
+#else
                 switch (pRun->containsOffset(blockOffset))
                 {
                 case FP_RUN_INSIDE:
                         if (blockOffset > pRun->getBlockOffset())
                         {
@@ -2924,11 +2939,13 @@
 
                 default:
                         UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
                         break;
                 }
+#endif
         }
+#endif
 
         if (pFirstNewRun && (pFirstNewRun->getType() == FPRUN_FMTMARK))
         {
                 // since a FmtMark has length zero, both it and the next
                 // run have the same blockOffset. we always want to be
@@ -2976,10 +2993,30 @@
                 // TODO char widths data between the two clocks. see [1].
                 pRun->fetchCharWidths(&pNewBL->m_gbCharWidths);
                 pRun->recalcWidth();
         }
 
+#if 1
+ // Check if the new block needs a empty Run inserted
+ UT_Bool bCanContainPoint = UT_FALSE;
+ for (pRun=pFirstNewRun;
+ (pRun) && !bCanContainPoint && pRun->letPointPass();
+ pRun=pRun->getNext())
+ {
+ bCanContainPoint = pRun->canContainPoint();
+ }
+ if (pFirstNewRun && !bCanContainPoint)
+ {
+ // Add a new zero-length Run at the start of the new Run.
+ GR_Graphics* pG = m_pLayout->getGraphics();
+ fp_TextRun* pNewRun = new fp_TextRun(this, pG,
pFirstNewRun->getBlockOffset(), 0);
+ pNewRun->recalcWidth();
+ pFirstNewRun->insertIntoRunListBeforeThis(*pNewRun);
+ pNewBL->m_pFirstRun = pNewRun;
+ }
+#endif
+
         // explicitly truncate rest of this block's layout
         truncateLayout(pFirstNewRun);
         if (m_pFirstRun)
                 coalesceRuns();
         else



This archive was generated by hypermail 2b25 : Sun Jun 11 2000 - 16:30:20 CDT