[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/khtml/rendering
From: Allan Sandfeld Jensen <kde () carewolf ! com>
Date: 2005-02-21 23:14:52
Message-ID: 20050221231452.0D0612226 () office ! kde ! org
[Download RAW message or body]
CVS commit by carewolf:
Tying some loose ends after the white-space implementation
M +12 -26 render_text.cpp 1.266
--- kdelibs/khtml/rendering/render_text.cpp #1.265:1.266
@@ -1040,7 +1040,5 @@ void RenderText::calcMinMaxWidth()
int wordSpacing = style()->wordSpacing();
int len = str->l;
- bool ignoringSpaces = false;
bool isSpace = false;
- bool isPre = style()->whiteSpace() == PRE;
bool firstWord = true;
bool firstLine = true;
@@ -1048,15 +1046,11 @@ void RenderText::calcMinMaxWidth()
{
unsigned short c = str->s[i].unicode();
- bool previousCharacterIsSpace = isSpace;
bool isNewline = false;
+ // If line-breaks survive to here they are preserved
if ( c == '\n' ) {
- if ( isPre ) {
m_hasBreak = true;
isNewline = true;
isSpace = false;
- }
- else
- isSpace = true;
} else
isSpace = c == ' ';
@@ -1067,13 +1061,4 @@ void RenderText::calcMinMaxWidth()
m_hasEndWS = true;
- if (!ignoringSpaces && !isPre && previousCharacterIsSpace && isSpace)
- ignoringSpaces = true;
-
- if (ignoringSpaces && !isSpace)
- ignoringSpaces = false;
-
- if (ignoringSpaces)
- continue;
-
int wordlen = 0;
while( i+wordlen < len && !(isBreakable( str->s, i+wordlen, str->l )) )
@@ -1108,5 +1093,5 @@ void RenderText::calcMinMaxWidth()
// Nowrap can never be broken, so don't bother setting the
// breakable character boolean. Pre can only be broken if we encounter a newline.
- if (style()->whiteSpace() == NORMAL || isNewline)
+ if (style()->autoWrap() || isNewline)
m_hasBreakableChar = true;
@@ -1134,12 +1119,12 @@ void RenderText::calcMinMaxWidth()
if(currMaxWidth > m_maxWidth) m_maxWidth = currMaxWidth;
- if (style()->whiteSpace() != NORMAL)
+ if (!style()->autoWrap()) {
m_minWidth = m_maxWidth;
-
- if (isPre) {
+ if (style()->preserveLF()) {
if (firstLine)
m_beginMinWidth = m_maxWidth;
m_endMinWidth = currMaxWidth;
}
+ }
setMinMaxKnown();
@@ -1195,4 +1180,5 @@ static DOMStringImpl* cleanString (DOMSt
if (ch == ' ')
continue;
+ // We act on \r as we would on \n because CSS uses it to indicate new-line
if (ch == '\n' || ch == '\r') {
collapsingLF = true;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic