[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:21:40 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit c9c257deaad4b49bb30f3c029876b2c72e276006
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 24 03:46:17 2003 +0000

    WebCore:
            Fixed whitespace exclusion code.  Fixes many sites
            that have problems that were exposed after
            fixing 3119777.
    
            Reviewed by hyatt.
    
            * khtml/rendering/bidi.cpp:
            (RenderFlow::bidiReorderLine):
            (RenderFlow::findNextLineBreak):
            * khtml/rendering/break_lines.cpp:
            * khtml/rendering/render_text.cpp:
            (RenderText::calcMinMaxWidth):
    
    Test:
    	Tests for the fix above.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3438 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 10673db..be411db 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,18 @@
+2003-01-23  Richard Williamson   <rjw at apple.com>
+
+        Fixed whitespace exclusion code.  Fixes many sites
+        that have problems that were exposed after
+        fixing 3119777.
+        
+        Reviewed by hyatt.
+
+        * khtml/rendering/bidi.cpp:
+        (RenderFlow::bidiReorderLine):
+        (RenderFlow::findNextLineBreak):
+        * khtml/rendering/break_lines.cpp:
+        * khtml/rendering/render_text.cpp:
+        (RenderText::calcMinMaxWidth):
+
 2003-01-23  David Hyatt  <hyatt at apple.com>
 
 	Dump textslaves in the regression tests.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 10673db..be411db 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,18 @@
+2003-01-23  Richard Williamson   <rjw at apple.com>
+
+        Fixed whitespace exclusion code.  Fixes many sites
+        that have problems that were exposed after
+        fixing 3119777.
+        
+        Reviewed by hyatt.
+
+        * khtml/rendering/bidi.cpp:
+        (RenderFlow::bidiReorderLine):
+        (RenderFlow::findNextLineBreak):
+        * khtml/rendering/break_lines.cpp:
+        * khtml/rendering/render_text.cpp:
+        (RenderText::calcMinMaxWidth):
+
 2003-01-23  David Hyatt  <hyatt at apple.com>
 
 	Dump textslaves in the regression tests.
diff --git a/WebCore/khtml/rendering/bidi.cpp b/WebCore/khtml/rendering/bidi.cpp
index 1110230..725995a 100644
--- a/WebCore/khtml/rendering/bidi.cpp
+++ b/WebCore/khtml/rendering/bidi.cpp
@@ -792,7 +792,6 @@ void RenderFlow::bidiReorderLine(const BidiIterator &start, const BidiIterator &
     BidiRun *r = runs.first();
 
     while ( r ) {
-        //printf("level = %d\n", r->level);
         if ( r->level > levelHigh )
             levelHigh = r->level;
         if ( r->level < levelLow )
@@ -1165,8 +1164,9 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
             adjustEmbeddding = false;
         }
     }
-    if ( start.atEnd() )
+    if ( start.atEnd() ){
         return start;
+    }
 
     // This variable is used only if whitespace isn't set to PRE, and it tells us whether
     // or not we are currently ignoring whitespace.
@@ -1175,7 +1175,7 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
     // This variable tracks whether the very last character we saw was a space.  We use
     // this to detect when we encounter a second space so we know we have to terminate
     // a run.
-    bool sawSpace = false;
+    bool currentCharacterIsSpace = false;
     RenderObject* trailingSpaceObject = 0;
     
     // The pos of the last whitespace char we saw, not to be confused with the lastSpace
@@ -1242,7 +1242,7 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
             }
             isLineEmpty = false;
             ignoringSpaces = false;
-            sawSpace = false;
+            currentCharacterIsSpace = false;
             lastSpacePos = 0;
             trailingSpaceObject = 0;
             
@@ -1257,7 +1257,7 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
                 if (!m_pre && next && next->isText() && static_cast<RenderText*>(next)->stringLength() > 0 &&
                       (static_cast<RenderText*>(next)->text()[0].direction() == QChar::DirWS ||
                       static_cast<RenderText*>(next)->text()[0] == '\n')) {
-                    sawSpace = true;
+                    currentCharacterIsSpace = true;
                     ignoringSpaces = true;
                     BidiIterator* endMid = new (o->renderArena()) BidiIterator();
                     endMid->obj = o;
@@ -1282,27 +1282,27 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
             while(len) {
                 //XXXdwh This is wrong. Still mutating the DOM
                 // string for newlines... will fix in second stage.
-                if (!isPre && str[pos] == '\n')
+                if (!isPre && str[pos] == '\n'){
                     str[pos] = ' ';
+                }
                     
-                bool oldSawSpace = sawSpace;
-                sawSpace = (str[pos].direction() == QChar::DirWS);
+                bool previousCharacterIsSpace = currentCharacterIsSpace;
+                currentCharacterIsSpace = (str[pos].direction() == QChar::DirWS);
                     
-                if (isPre || !sawSpace)
+                if (isPre || !currentCharacterIsSpace)
                     isLineEmpty = false;
                 
                 bool applyWordSpacing = false;
-                if( (isPre && str[pos] == '\n') ||
-                    (!isPre && isBreakable( str, pos, strlen ) ) ) {
-                    
+                if( (isPre && str[pos] == '\n') || (!isPre && isBreakable( str, pos, strlen )) ) {
                     if (ignoringSpaces) {
-                        if (!sawSpace) {
+                        if (!currentCharacterIsSpace) {
                             // Stop ignoring spaces and begin at this
                             // new point.
                             BidiIterator* startMid = new (o->renderArena()) BidiIterator();
                             startMid->obj = o;
                             startMid->pos = pos;
                             midpoints.append(startMid);
+                            ignoringSpaces = false;
                         }
                         else {
                             // Just keep ignoring these spaces.
@@ -1311,13 +1311,12 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
                             continue;
                         }
                     }
-                    else {
-                        if (sawSpace && !oldSawSpace)
-                            lastSpacePos = pos;
-                        tmpW += t->width(lastSpace, pos - lastSpace, f);
-                        applyWordSpacing = (wordSpacing && sawSpace && !oldSawSpace &&
-                            t->containsOnlyWhitespace(pos+1, strlen-(pos+1)));
-                    }
+
+                    if (currentCharacterIsSpace && !previousCharacterIsSpace)
+                        lastSpacePos = pos;
+                    tmpW += t->width(lastSpace, pos - lastSpace, f);
+                    applyWordSpacing = (wordSpacing && currentCharacterIsSpace && !previousCharacterIsSpace &&
+                        t->containsOnlyWhitespace(pos+1, strlen-(pos+1)));
 
 #ifdef DEBUG_LINEBREAKS
                     kdDebug(6041) << "found space at " << pos << " in string '" << QString( str, strlen ).latin1() << "' adding " << tmpW << " new width = " << w << endl;
@@ -1334,8 +1333,9 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
                         }
                     }
         
-                    if (w + tmpW > width && o->style()->whiteSpace() == NORMAL)
+                    if (w + tmpW > width && o->style()->whiteSpace() == NORMAL){
                         goto end;
+                    }
 
                     lBreak.obj = o;
                     lBreak.pos = pos;
@@ -1358,8 +1358,9 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
                         // 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 (sawSpace && oldSawSpace)
+                        if (currentCharacterIsSpace && previousCharacterIsSpace){
                             ignoringSpaces = true;
+                        }
                         
                         if (ignoringSpaces) {
                             // We just entered a mode where we are ignoring
@@ -1389,9 +1390,9 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
                     midpoints.append(startMid);
                 }
                 
-                if (!isPre && sawSpace && !ignoringSpaces)
+                if (!isPre && currentCharacterIsSpace && !ignoringSpaces)
                     trailingSpaceObject = o;
-                else if (isPre || !sawSpace)
+                else if (isPre || !currentCharacterIsSpace)
                     trailingSpaceObject = 0;
                     
                 pos++;
@@ -1408,7 +1409,7 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
             //kdDebug() << " too wide w=" << w << " tmpW = " << tmpW << " width = " << width << endl;
             //kdDebug() << "start=" << start.obj << " current=" << o << endl;
             // if we have floats, try to get below them.
-            if (sawSpace && !ignoringSpaces && o->style()->whiteSpace() != PRE)
+            if (currentCharacterIsSpace && !ignoringSpaces && o->style()->whiteSpace() != PRE)
                 trailingSpaceObject = 0;
             
             int fb = nearestFloatBottom(m_height);
@@ -1468,6 +1469,7 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
     }
 
  end:
+
     int determinedWidth = w + tmpW;
     if( lBreak == start && !lBreak.obj->isBR() ) {
         // we just add as much as possible
@@ -1527,7 +1529,7 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
             midpoints.append(endMid);
         }
     }
-    
+
     return lBreak;
 }
 
diff --git a/WebCore/khtml/rendering/break_lines.cpp b/WebCore/khtml/rendering/break_lines.cpp
index 2a77da7..650c742 100644
--- a/WebCore/khtml/rendering/break_lines.cpp
+++ b/WebCore/khtml/rendering/break_lines.cpp
@@ -88,18 +88,22 @@ bool isBreakable( const QChar *s, int pos, int len)
     const QChar *c = s+pos;
     unsigned short ch = c->unicode();
     
+    if (ch == '\n'){
+        return true;
+    }
+
     if (ch > 0x7f){
         status = UCCreateTextBreakLocator (NULL, 0, kUCTextBreakLineMask, &breakLocator);
         if (status == 0){
             findStatus = UCFindTextBreak (breakLocator, kUCTextBreakLineMask, NULL, (const UniChar *)s, len, pos, &end);
         }
         // If carbon fails, fail back on simple white space detection.
-        if (findStatus == 0)
+        if (findStatus == 0){
             return ((int)end == pos) ? true : false;
+        }    
     }
-    // What about hypenation?  We will correctly handle japanese hyphenation above, but
-    // not here.
-    return c->direction() == QChar::DirWS || ch == '\n';
+    // What about hypenation?
+    return c->direction() == QChar::DirWS;
 #endif    
 }
 
diff --git a/WebCore/khtml/rendering/render_text.cpp b/WebCore/khtml/rendering/render_text.cpp
index 0d1f310..036e03e 100644
--- a/WebCore/khtml/rendering/render_text.cpp
+++ b/WebCore/khtml/rendering/render_text.cpp
@@ -966,7 +966,7 @@ void RenderText::calcMinMaxWidth()
                 str->s[i] = ' ';
         }
         
-        bool oldSpace = isSpace;
+        bool previousCharacterIsSpace = isSpace;
         isSpace = str->s[i].direction() == QChar::DirWS;
         
         if ((isSpace || isNewline) && i == 0)
@@ -974,7 +974,7 @@ void RenderText::calcMinMaxWidth()
         if ((isSpace || isNewline) && i == len-1)
             m_hasEndWS = true;
             
-        if (!ignoringSpaces && !isPre && oldSpace && isSpace)
+        if (!ignoringSpaces && !isPre && previousCharacterIsSpace && isSpace)
             ignoringSpaces = true;
         
         if (ignoringSpaces && !isSpace)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list