From kde-commits Wed Aug 03 11:59:11 2005 From: Allan Sandfeld Jensen Date: Wed, 03 Aug 2005 11:59:11 +0000 To: kde-commits Subject: branches/KDE/3.5/kdelibs/khtml/rendering Message-Id: <1123070351.088734.18995.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=112307036610893 SVN commit 442628 by carewolf: Backport of pre-line pre-wrap clean-up M +1 -1 render_line.cpp M +7 -5 render_text.cpp --- branches/KDE/3.5/kdelibs/khtml/rendering/render_line.cpp #442627:442628 @@ -580,7 +580,7 @@ shouldDraw = true; break; } - else if (curr->isText() && !curr->isBR() && (curr->style()->whiteSpace() == PRE || + else if (curr->isText() && !curr->isBR() && (curr->style()->preserveWS() || !curr->element() || !curr->element()->containsOnlyWhitespace())) { shouldDraw = true; break; --- branches/KDE/3.5/kdelibs/khtml/rendering/render_text.cpp #442627:442628 @@ -1357,8 +1357,10 @@ short& beginMaxW, short& endMaxW, short& minW, short& maxW, bool& stripFrontSpaces) { - bool isPre = style()->whiteSpace() == PRE; - if (isPre) + bool preserveWS = style()->preserveWS(); + bool preserveLF = style()->preserveLF(); + bool autoWrap = style()->autoWrap(); + if (preserveWS) stripFrontSpaces = false; int len = str->l; @@ -1379,16 +1381,16 @@ hasBreakableChar = m_hasBreakableChar; hasBreak = m_hasBreak; - if (stripFrontSpaces && (str->s[0].direction() == QChar::DirWS || (!isPre && str->s[0] == '\n'))) { + if (stripFrontSpaces && (str->s[0].direction() == QChar::DirWS || (!preserveLF && str->s[0] == '\n'))) { const Font *f = htmlFont( false ); QChar space[1]; space[0] = ' '; int spaceWidth = f->width(space, 1, 0); maxW -= spaceWidth; } - stripFrontSpaces = !isPre && m_hasEndWS; + stripFrontSpaces = !preserveWS && m_hasEndWS; - if (style()->whiteSpace() == NOWRAP) + if (!autoWrap) minW = maxW; else if (minW > maxW) minW = maxW;