From kde-commits Sun Jan 07 16:23:16 2007 From: Allan Sandfeld Jensen Date: Sun, 07 Jan 2007 16:23:16 +0000 To: kde-commits Subject: branches/KDE/3.5/kdelibs/khtml/rendering Message-Id: <1168186996.769109.25153.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=116818702105555 SVN commit 620868 by carewolf: Fix a detail missed in last commit, and clean up the code. CCBUG: 121867 M +31 -44 bidi.cpp --- branches/KDE/3.5/kdelibs/khtml/rendering/bidi.cpp #620867:620868 @@ -1901,24 +1901,27 @@ #ifdef APPLE_CHANGES // KDE applies wordspacing differently bool applyWordSpacing = false; #endif - if ( (preserveLF && c == '\n') || (autoWrap && (isBreakable( str, pos, strlen ) || isSoftBreakable)) ) { - if (ignoringSpaces) { - if (!currentCharacterIsSpace) { - // Stop ignoring spaces and begin at this - // new point. - ignoringSpaces = false; - lastSpace = pos; // e.g., "Foo goo", don't add in any of the ignored spaces. - BidiIterator startMid ( 0, o, pos ); - addMidpoint(startMid); - } - else { - // Just keep ignoring these spaces. - pos++; - len--; - continue; - } + if (ignoringSpaces) { + // We need to stop ignoring spaces, if we encounter a non-space or + // a run that doesn't collapse spaces + if (!currentCharacterIsSpace || preserveWS) { + // Stop ignoring spaces and begin at this + // new point. + ignoringSpaces = false; + lastSpace = pos; // e.g., "Foo goo", don't add in any of the ignored spaces. + BidiIterator startMid ( 0, o, pos ); + addMidpoint(startMid); } + else { + // Just keep ignoring these spaces. + pos++; + len--; + continue; + } + } + if ( (preserveLF && c == '\n') || (autoWrap && (isBreakable( str, pos, strlen ) || isSoftBreakable)) ) { + tmpW += t->width(lastSpace, pos - lastSpace, f); if (!appliedStartWidth) { tmpW += inlineWidth(o, true, false); @@ -1982,37 +1985,21 @@ if (applyWordSpacing) w += wordSpacing; #endif - if (!ignoringSpaces && !preserveWS) { - // If we encounter a newline, or if we encounter a - // second space, we need to go ahead and break up this - // run and enter a mode where we start collapsing spaces. - if (currentCharacterIsSpace && previousCharacterIsSpace) { - ignoringSpaces = true; + } - // We just entered a mode where we are ignoring - // spaces. Create a midpoint to terminate the run - // before the second space. - addMidpoint(ignoreStart); - lastSpace = pos; - } + if (!ignoringSpaces && !preserveWS) { + // If we encounter a second space, we need to go ahead and break up this run + // and enter a mode where we start collapsing spaces. + if (currentCharacterIsSpace && previousCharacterIsSpace) { + ignoringSpaces = true; + + // We just entered a mode where we are ignoring + // spaces. Create a midpoint to terminate the run + // before the second space. + addMidpoint(ignoreStart); + lastSpace = pos; } } - else if (ignoringSpaces) { - if (!currentCharacterIsSpace || preserveWS) { - // Stop ignoring spaces and begin at this - // new point. - ignoringSpaces = false; - lastSpace = pos; // e.g., "Foo goo", don't add in any of the ignored spaces. - BidiIterator startMid ( 0, o, pos ); - addMidpoint(startMid); - } - else { - // Just keep ignoring these spaces. - pos++; - len--; - continue; - } - } if (currentCharacterIsSpace && !previousCharacterIsSpace) { ignoreStart.obj = o;