CVS commit by coles: OK, so now it's back to where I started: the invalid behaviour in toLengthArray was a red herring brought about by the single % character special case in parseLength. M +8 -11 dom_stringimpl.cpp 1.54 --- kdelibs/khtml/xml/dom_stringimpl.cpp #1.53:1.54 @@ -204,5 +204,6 @@ khtml::Length* DOMStringImpl::toLengthAr { QString str(s, l); - + int pos = 0; + int pos2; // web authors are so stupid. This is a workaround @@ -219,16 +219,13 @@ khtml::Length* DOMStringImpl::toLengthAr str = str.simplifyWhiteSpace(); - QStringList segments = QStringList::split(QString(" "), str); - - len = segments.size(); + len = str.contains(' ') + 1; khtml::Length* r = new khtml::Length[len]; - int i = 0; - - for ( QStringList::Iterator it = segments.begin(); it != segments.end(); ++it, ++i ) { - const QChar* const startPtr = (*it).unicode(); - const unsigned int l = (*it).length(); - r[i] = parseLength(startPtr, l); + while((pos2 = str.find(' ', pos)) != -1) + { + r[i++] = parseLength((QChar *) str.unicode()+pos, pos2-pos); + pos = pos2+1; } + r[i] = parseLength((QChar *) str.unicode()+pos, str.length()-pos); return r;