cc5fd88b | 2014-10-02 18:40:04 | Timothy Pearson |
Don't use insane (negative) layout values if layout engine does not allocate sufficient space for a text string This resolves Bug 1950 Make most debugging statements work again Add new debugging statements Fix several annoying build warnings |
||
M tdehtml/html/html_imageimpl.cpp M tdehtml/html/htmltokenizer.cpp M tdehtml/rendering/bidi.cpp M tdehtml/rendering/render_block.cpp M tdehtml/rendering/render_canvas.cpp M tdehtml/rendering/render_flow.cpp M tdehtml/rendering/render_line.h M tdehtml/rendering/render_object.h M tdehtml/rendering/render_text.cpp M tdehtml/rendering/render_text.h M tdehtml/xml/dom_docimpl.cpp M tdehtml/xml/dom_docimpl.h |
||
diff --git a/tdehtml/html/html_imageimpl.cpp b/tdehtml/html/html_imageimpl.cpp index a006b3b..e356d1e 100644 --- a/tdehtml/html/html_imageimpl.cpp +++ b/tdehtml/html/html_imageimpl.cpp @@ -539,12 +539,12 @@ m_coords[(i<<1)+1].minWidth(height_)); region = TQRegion(points); } - else if (shape==Circle && m_coordsLen>=3 || shape==Unknown && m_coordsLen == 3) { + else if ((shape==Circle && m_coordsLen>=3) || (shape==Unknown && m_coordsLen == 3)) { int r = kMin(m_coords[2].minWidth(width_), m_coords[2].minWidth(height_)); region = TQRegion(m_coords[0].minWidth(width_)-r, m_coords[1].minWidth(height_)-r, 2*r, 2*r,TQRegion::Ellipse); } - else if (shape==Rect && m_coordsLen>=4 || shape==Unknown && m_coordsLen == 4) { + else if ((shape==Rect && m_coordsLen>=4) || (shape==Unknown && m_coordsLen == 4)) { int x0 = m_coords[0].minWidth(width_); int y0 = m_coords[1].minWidth(height_); int x1 = m_coords[2].minWidth(width_); diff --git a/tdehtml/html/htmltokenizer.cpp b/tdehtml/html/htmltokenizer.cpp index 292d177..edf44d8 100644 --- a/tdehtml/html/htmltokenizer.cpp +++ b/tdehtml/html/htmltokenizer.cpp @@ -1385,11 +1385,11 @@ else if ( startTag ) { startTag = false; - bool endTag = false; + // bool endTag = false; switch(cc) { case '/': - endTag = true; + // endTag = true; break; case '!': { @@ -1440,11 +1440,14 @@ // immediately before an endtag should be ignored. // ### Gecko and MSIE though only ignores LF immediately after // starttags and only for PRE elements -- asj (28/06-2005) - if ( pending ) - if (!select) + if ( pending ) { + if (!select) { addPending(); - else + } + else { pending = NonePending; + } + } // Cancel unused discards discard = NoneDiscard; diff --git a/tdehtml/rendering/bidi.cpp b/tdehtml/rendering/bidi.cpp index 7916a9c..c8abf52 100644 --- a/tdehtml/rendering/bidi.cpp +++ b/tdehtml/rendering/bidi.cpp @@ -35,8 +35,9 @@ #include "tqfontmetrics.h" #define BIDI_DEBUG 0 -//#define DEBUG_LINEBREAKS -//#define PAGE_DEBUG +// #define DEBUG_LINEBREAKS +// #define DEBUG_LAYOUT +// #define PAGE_DEBUG namespace tdehtml { @@ -701,8 +702,12 @@ if (r->obj->isPositioned()) continue; // Positioned objects are only participating to figure out their // correct static x position. They have no effect on the width. - if (r->obj->isText()) + if (r->obj->isText()) { r->box->setWidth(static_cast<RenderText *>(r->obj)->width(r->start, r->stop-r->start, m_firstLine)); +#ifdef DEBUG_LAYOUT + kdDebug( 6040 ) << renderName() << " computeHorizontalPositionsForLine() set text box width: " << r->box->width() << endl; +#endif + } else if (!r->obj->isInlineFlow()) { r->obj->calcWidth(); r->box->setWidth(r->obj->width()); @@ -776,6 +781,10 @@ m_overflowWidth = rightPos; // FIXME: Work for rtl overflow also. if (x < 0) m_overflowLeft = kMin(m_overflowLeft, x); + +#ifdef DEBUG_LAYOUT + kdDebug( 6040 ) << renderName() << " computeHorizontalPositionsForLine() m_overflowWidth: " << m_overflowWidth << " m_overflowLeft: " << m_overflowLeft << endl; +#endif } void RenderBlock::computeVerticalPositionsForLine(InlineFlowBox* lineBox) @@ -865,6 +874,9 @@ } if (doPageBreak) { int pTop = pageTopAfter(lineBox->yPos()); +#ifdef PAGE_DEBUG + int oldYPos = lineBox->yPos(); +#endif m_height = pTop; lineBox->setAfterPageBreak(true); @@ -1254,8 +1266,8 @@ } #if BIDI_DEBUG > 0 - kdDebug(6041) << "reached end of line current=" << current.obj << "/" << current.pos - << ", eor=" << eor.obj << "/" << eor.pos << endl; + kdDebug(6041) << "reached end of line current=" << bidi.current.obj << "/" << bidi.current.pos + << ", eor=" << bidi.eor.obj << "/" << bidi.eor.pos << endl; #endif if ( !emptyRun && bidi.sor != bidi.current ) { bidi.eor = bidi.last; @@ -1286,9 +1298,7 @@ #if BIDI_DEBUG > 0 kdDebug(6041) << "lineLow = " << (uint)levelLow << ", lineHigh = " << (uint)levelHigh << endl; kdDebug(6041) << "logical order is:" << endl; - TQPtrListIterator<BidiRun> it2(runs); - BidiRun *r2; - for ( ; (r2 = it2.current()); ++it2 ) + for (BidiRun* r2 = sFirstBidiRun; r2; r2 = r2->nextRun) kdDebug(6041) << " " << r2 << " start=" << r2->start << " stop=" << r2->stop << " level=" << (uint)r2->level << endl; #endif @@ -1318,7 +1328,7 @@ #if BIDI_DEBUG > 0 kdDebug(6041) << "visual order is:" << endl; - for (BidiRun* curr = sFirstRun; curr; curr = curr->nextRun) + for (BidiRun* curr = sFirstBidiRun; curr; curr = curr->nextRun) kdDebug(6041) << " " << curr << endl; #endif } diff --git a/tdehtml/rendering/render_block.cpp b/tdehtml/rendering/render_block.cpp index 82d99cf..053e51b 100644 --- a/tdehtml/rendering/render_block.cpp +++ b/tdehtml/rendering/render_block.cpp @@ -230,11 +230,9 @@ while ( length < oldText->l && (oldText->s+length)->isSpace() ) length++; begin = length; - while ( length < oldText->l && - ( (oldText->s+length)->isPunct()) || (oldText->s+length)->isSpace() ) + while ( (length < oldText->l && ( (oldText->s+length)->isPunct())) || (oldText->s+length)->isSpace() ) length++; - if ( length < oldText->l && - !( (oldText->s+length)->isSpace() || (oldText->s+length)->isPunct() )) + if ( length < oldText->l && !( (oldText->s+length)->isSpace() || (oldText->s+length)->isPunct() )) length++; while ( length < oldText->l && (oldText->s+length)->isMark() ) length++; @@ -1466,6 +1464,10 @@ m_overflowHeight = kMax(effY + child->effectiveHeight(), m_overflowHeight); m_overflowTop = kMin(effY, m_overflowTop); +#ifdef PAGE_DEBUG + kdDebug(6040) << renderName() << "(RenderBlock)::layoutBlockChildren(" << relayoutChildren << ") effX: " << effX << " effY: " << effY << " child: " << child << " child->effectiveWidth(): " << child->effectiveWidth() << " child->effectiveHeight(): " << child->effectiveHeight() << endl; +#endif + // Insert our compact into the block margin if we have one. insertCompactIfNeeded(child, compactInfo); @@ -2168,6 +2170,9 @@ } } +#ifdef PAGE_DEBUG + kdDebug(6040) << renderName() << "(RenderBlock)::rightmostPosition(" << includeOverflowInterior << "," << includeSelf << ") Rightmost position: " << right << " overflow width: " << m_overflowWidth << endl; +#endif return right; } @@ -2184,6 +2189,9 @@ int rp = r->xPos() + r->rightmostPosition(false); right = kMax(right, rp); } +#ifdef PAGE_DEBUG + kdDebug(6040) << renderName() << " Rightmost absolute position: " << right << endl; +#endif return right; } diff --git a/tdehtml/rendering/render_canvas.cpp b/tdehtml/rendering/render_canvas.cpp index 862f374..ab634d7 100644 --- a/tdehtml/rendering/render_canvas.cpp +++ b/tdehtml/rendering/render_canvas.cpp @@ -319,7 +319,7 @@ _ty += m_view->contentsY(); } - outlineBox(p, _tx, _ty); + outlineBox(paintInfo.p, _tx, _ty); #endif } diff --git a/tdehtml/rendering/render_flow.cpp b/tdehtml/rendering/render_flow.cpp index a535b21..1a1812c 100644 --- a/tdehtml/rendering/render_flow.cpp +++ b/tdehtml/rendering/render_flow.cpp @@ -358,6 +358,9 @@ relativePositionOffset(right, y); } +#ifdef DEBUG_LAYOUT + kdDebug(6040) << renderName() << "(RenderFlow)::rightmostPosition(" << includeOverflowInterior << "," << includeSelf << ") Rightmost position: " << right << endl; +#endif return right; } diff --git a/tdehtml/rendering/render_line.h b/tdehtml/rendering/render_line.h index 3dc066e..8d4c8a2 100644 --- a/tdehtml/rendering/render_line.h +++ b/tdehtml/rendering/render_line.h @@ -84,7 +84,15 @@ RootInlineBox* root(); - void setWidth(short w) { m_width = w; } + void setWidth(short w) { + if (w < 0) { + m_width = SHRT_MAX; + kdDebug( 6040 ) << " InlineBox::setWidth() invalid negative width " << w << " specified!" << endl; + } + else { + m_width = w; + } + } short width() const { return m_width; } void setXPos(short x) { m_x = x; } diff --git a/tdehtml/rendering/render_object.h b/tdehtml/rendering/render_object.h index bf120ff..325a240 100644 --- a/tdehtml/rendering/render_object.h +++ b/tdehtml/rendering/render_object.h @@ -334,10 +334,8 @@ m_minMaxKnown = b; if ( !b ) { RenderObject *o = this; - RenderObject *root = this; while( o ) { // ### && !o->m_recalcMinMax ) { o->m_recalcMinMax = true; - root = o; o = o->m_parent; } } diff --git a/tdehtml/rendering/render_text.cpp b/tdehtml/rendering/render_text.cpp ** Diff limit reached (max: 250 lines) ** |