summaryrefslogtreecommitdiffstats
path: root/tdehtml
diff options
context:
space:
mode:
Diffstat (limited to 'tdehtml')
-rw-r--r--tdehtml/html/html_imageimpl.cpp4
-rw-r--r--tdehtml/html/htmltokenizer.cpp13
-rw-r--r--tdehtml/rendering/bidi.cpp28
-rw-r--r--tdehtml/rendering/render_block.cpp16
-rw-r--r--tdehtml/rendering/render_canvas.cpp2
-rw-r--r--tdehtml/rendering/render_flow.cpp3
-rw-r--r--tdehtml/rendering/render_line.h10
-rw-r--r--tdehtml/rendering/render_object.h2
-rw-r--r--tdehtml/rendering/render_text.cpp21
-rw-r--r--tdehtml/rendering/render_text.h10
-rw-r--r--tdehtml/xml/dom_docimpl.cpp2
-rw-r--r--tdehtml/xml/dom_docimpl.h4
12 files changed, 80 insertions, 35 deletions
diff --git a/tdehtml/html/html_imageimpl.cpp b/tdehtml/html/html_imageimpl.cpp
index a006b3bd0..e356d1e51 100644
--- a/tdehtml/html/html_imageimpl.cpp
+++ b/tdehtml/html/html_imageimpl.cpp
@@ -539,12 +539,12 @@ TQRegion HTMLAreaElementImpl::getRegion(int width_, int height_) const
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 292d1773d..edf44d84f 100644
--- a/tdehtml/html/htmltokenizer.cpp
+++ b/tdehtml/html/htmltokenizer.cpp
@@ -1385,11 +1385,11 @@ void HTMLTokenizer::write( const TokenizerString &str, bool appendData )
else if ( startTag )
{
startTag = false;
- bool endTag = false;
+ // bool endTag = false;
switch(cc) {
case '/':
- endTag = true;
+ // endTag = true;
break;
case '!':
{
@@ -1440,11 +1440,14 @@ void HTMLTokenizer::write( const TokenizerString &str, bool appendData )
// 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 7916a9c4f..c8abf52d0 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 @@ void RenderBlock::computeHorizontalPositionsForLine(InlineFlowBox* lineBox, Bidi
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 @@ void RenderBlock::computeHorizontalPositionsForLine(InlineFlowBox* lineBox, Bidi
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 @@ bool RenderBlock::clearLineOfPageBreaks(InlineFlowBox* lineBox)
}
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 @@ void RenderBlock::bidiReorderLine(const BidiIterator &start, const BidiIterator
}
#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 @@ void RenderBlock::bidiReorderLine(const BidiIterator &start, const BidiIterator
#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 @@ void RenderBlock::bidiReorderLine(const BidiIterator &start, const BidiIterator
#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 82d99cf41..053e51b95 100644
--- a/tdehtml/rendering/render_block.cpp
+++ b/tdehtml/rendering/render_block.cpp
@@ -230,11 +230,9 @@ void RenderBlock::updateFirstLetter()
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 @@ void RenderBlock::layoutBlockChildren( bool relayoutChildren )
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 @@ int RenderBlock::rightmostPosition(bool includeOverflowInterior, bool includeSel
}
}
+#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 RenderBlock::rightmostAbsolutePosition() const
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 862f374b2..ab634d760 100644
--- a/tdehtml/rendering/render_canvas.cpp
+++ b/tdehtml/rendering/render_canvas.cpp
@@ -319,7 +319,7 @@ void RenderCanvas::paint(PaintInfo& paintInfo, int _tx, int _ty)
_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 a535b218e..1a1812c75 100644
--- a/tdehtml/rendering/render_flow.cpp
+++ b/tdehtml/rendering/render_flow.cpp
@@ -358,6 +358,9 @@ int RenderFlow::rightmostPosition(bool includeOverflowInterior, bool includeSelf
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 3dc066e10..8d4c8a256 100644
--- a/tdehtml/rendering/render_line.h
+++ b/tdehtml/rendering/render_line.h
@@ -84,7 +84,15 @@ public:
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 bf120ff84..325a24024 100644
--- a/tdehtml/rendering/render_object.h
+++ b/tdehtml/rendering/render_object.h
@@ -334,10 +334,8 @@ public:
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
index 411f3f221..cd9fc554f 100644
--- a/tdehtml/rendering/render_text.cpp
+++ b/tdehtml/rendering/render_text.cpp
@@ -23,8 +23,8 @@
*
*/
-//#define DEBUG_LAYOUT
-//#define BIDI_DEBUG
+// #define DEBUG_LAYOUT
+// #define BIDI_DEBUG
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -295,7 +295,7 @@ void InlineTextBox::paintDecoration( TQPainter *pt, const Font *f, int _tx, int
pt->setPen(linethrough);
f->drawDecoration(pt, _tx, _ty, baseline(), width, height(), Font::LINE_THROUGH);
}
- // NO! Do NOT add BLINK! It is the most annouing feature of Netscape, and IE has a reason not to
+ // NO! Do NOT add BLINK! It is the most annoying feature of Netscape, and IE has a reason not to
// support it. Lars
}
@@ -1305,7 +1305,9 @@ unsigned int RenderText::width(unsigned int from, unsigned int len, const Font *
int w = f->width(str->s, str->l, from, len );
- //kdDebug( 6040 ) << "RenderText::width(" << from << ", " << len << ") = " << w << endl;
+#ifdef DEBUG_LAYOUT
+ kdDebug( 6040 ) << "RenderText::width(" << from << ", " << len << ") = " << w << endl;
+#endif
return w;
}
@@ -1315,16 +1317,19 @@ short RenderText::width() const
int minx = 100000000;
int maxx = 0;
// slooow
- for(unsigned int si = 0; si < m_lines.count(); si++) {
+ for (unsigned int si = 0; si < m_lines.count(); si++) {
InlineTextBox* s = m_lines[si];
- if(s->m_x < minx)
+ if (s->m_x < minx)
minx = s->m_x;
- if(s->m_x + s->m_width > maxx)
+ if (s->m_x + s->m_width > maxx)
maxx = s->m_x + s->m_width;
}
w = kMax(0, maxx-minx);
+#ifdef DEBUG_LAYOUT
+ kdDebug( 6040 ) << "RenderText::width() = " << w << endl;
+#endif
return w;
}
@@ -1486,7 +1491,7 @@ static TQString quoteAndEscapeNonPrintables(const TQString &s)
static void writeTextRun(TQTextStream &ts, const RenderText &o, const InlineTextBox &run)
{
- ts << "text run at (" << run.m_x << "," << run.m_y << ") width " << run.m_width << ": "
+ ts << "text run at (" << run.m_x << "," << run.m_y << ") width " << run.width() << ": "
<< quoteAndEscapeNonPrintables(o.data().string().mid(run.m_start, run.m_len));
}
diff --git a/tdehtml/rendering/render_text.h b/tdehtml/rendering/render_text.h
index acce98350..a05d65daa 100644
--- a/tdehtml/rendering/render_text.h
+++ b/tdehtml/rendering/render_text.h
@@ -74,7 +74,15 @@ private:
void* operator new(size_t sz) throw();
public:
- void setSpaceAdd(int add) { m_width -= m_toAdd; m_toAdd = add; m_width += m_toAdd; }
+ void setSpaceAdd(int add) {
+ if (add < 0) {
+ m_toAdd = 0;
+ kdDebug( 6040 ) << " InlineTextBox::setSpaceAdd() invalid negative value " << add << " specified!" << endl;
+ }
+ else {
+ m_width -= m_toAdd; m_toAdd = add; m_width += m_toAdd;
+ }
+ }
int spaceAdd() { return m_toAdd; }
virtual bool isInlineTextBox() const { return true; }
diff --git a/tdehtml/xml/dom_docimpl.cpp b/tdehtml/xml/dom_docimpl.cpp
index 423a2a51e..b896d05a3 100644
--- a/tdehtml/xml/dom_docimpl.cpp
+++ b/tdehtml/xml/dom_docimpl.cpp
@@ -2345,7 +2345,7 @@ bool DocumentImpl::isURLAllowed(const TQString& url) const
return false;
// Prohibit non-file URLs if we are asked to.
- if (!thisPart || thisPart->onlyLocalReferences() && newURL.protocol() != "file" && newURL.protocol() != "data")
+ if (!thisPart || (thisPart->onlyLocalReferences() && (newURL.protocol() != "file") && (newURL.protocol() != "data")))
return false;
// do we allow this suburl ?
diff --git a/tdehtml/xml/dom_docimpl.h b/tdehtml/xml/dom_docimpl.h
index 9cacfd9f5..bcdc9500c 100644
--- a/tdehtml/xml/dom_docimpl.h
+++ b/tdehtml/xml/dom_docimpl.h
@@ -27,6 +27,8 @@
#ifndef _DOM_DocumentImpl_h_
#define _DOM_DocumentImpl_h_
+#include <stdint.h>
+
#include "xml/dom_elementimpl.h"
#include "xml/dom_textimpl.h"
#include "xml/dom2_traversalimpl.h"
@@ -617,7 +619,7 @@ protected:
TQString name = cs ? n.string() : n.string().upper();
TQString qn("aliases: " + (cs ? px.string() : px.string().upper()) + ":" + name);
if (!ids.find( qn )) {
- ids.insert( qn, (void*)id );
+ ids.insert( qn, (void*)(intptr_t)id );
}
}
expandIfNeeded();