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

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


The following commit has been merged in the debian/unstable branch:
commit 3aff2336814b5886170fbb8368e6bdd65ff2dc9f
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 23 01:15:28 2003 +0000

    	Fix word-spacing bugs in text measurement calculations.  This
    	fixes our issues on the CSS1 test suite.  Regression tests have
    	been added for both positive and negative word-spacing.
    
            Reviewed by rjw
    
            * khtml/rendering/bidi.cpp:
            (RenderFlow::findNextLineBreak):
            * khtml/rendering/render_text.cpp:
            (RenderText::calcMinMaxWidth):
            (RenderText::containsOnlyWhitespace):
            * khtml/rendering/render_text.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3409 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index f02b578..fe2ec04 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,18 @@
+2003-01-22  David Hyatt  <hyatt at apple.com>
+
+	Fix word-spacing bugs in text measurement calculations.  This
+	fixes our issues on the CSS1 test suite.  Regression tests have
+	been added for both positive and negative word-spacing.
+	
+        Reviewed by rjw
+
+        * khtml/rendering/bidi.cpp:
+        (RenderFlow::findNextLineBreak):
+        * khtml/rendering/render_text.cpp:
+        (RenderText::calcMinMaxWidth):
+        (RenderText::containsOnlyWhitespace):
+        * khtml/rendering/render_text.h:
+
 2003-01-22  Chris Blumenberg  <cblu at apple.com>
 
 	Fixed: 3153969 - Should not be able drag text while double or triple-click selecting it
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index f02b578..fe2ec04 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,18 @@
+2003-01-22  David Hyatt  <hyatt at apple.com>
+
+	Fix word-spacing bugs in text measurement calculations.  This
+	fixes our issues on the CSS1 test suite.  Regression tests have
+	been added for both positive and negative word-spacing.
+	
+        Reviewed by rjw
+
+        * khtml/rendering/bidi.cpp:
+        (RenderFlow::findNextLineBreak):
+        * khtml/rendering/render_text.cpp:
+        (RenderText::calcMinMaxWidth):
+        (RenderText::containsOnlyWhitespace):
+        * khtml/rendering/render_text.h:
+
 2003-01-22  Chris Blumenberg  <cblu at apple.com>
 
 	Fixed: 3153969 - Should not be able drag text while double or triple-click selecting it
diff --git a/WebCore/khtml/rendering/bidi.cpp b/WebCore/khtml/rendering/bidi.cpp
index 112615d..05351a4 100644
--- a/WebCore/khtml/rendering/bidi.cpp
+++ b/WebCore/khtml/rendering/bidi.cpp
@@ -1275,6 +1275,7 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
             // proportional font, needs a bit more work.
             int lastSpace = pos;
             bool isPre = o->style()->whiteSpace() == PRE;
+            int wordSpacing = o->style()->wordSpacing();
             
             //QChar space[1]; space[0] = ' ';
             //int spaceWidth = f->width(space, 1, 0);
@@ -1289,7 +1290,8 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
                     
                 if (isPre || !sawSpace)
                     isLineEmpty = false;
-                    
+                
+                bool applyWordSpacing = false;
                 if( (isPre && str[pos] == '\n') ||
                     (!isPre && isBreakable( str, pos, strlen ) ) ) {
                     
@@ -1313,8 +1315,10 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
                         if (sawSpace && !oldSawSpace)
                             lastSpacePos = pos;
                         tmpW += t->width(lastSpace, pos - lastSpace, f);
+                        applyWordSpacing = (wordSpacing && sawSpace && !oldSawSpace &&
+                            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;
 #endif
@@ -1347,6 +1351,9 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start, QPtrList<BidiIte
                     tmpW = 0;
                     lastSpace = pos;
                     
+                    if (applyWordSpacing)
+                        w += wordSpacing;
+                        
                     if (!ignoringSpaces && !isPre) {
                         // If we encounter a newline, or if we encounter a
                         // second space, we need to go ahead and break up this
diff --git a/WebCore/khtml/rendering/render_text.cpp b/WebCore/khtml/rendering/render_text.cpp
index 57b91a1..ed370c1 100644
--- a/WebCore/khtml/rendering/render_text.cpp
+++ b/WebCore/khtml/rendering/render_text.cpp
@@ -946,6 +946,7 @@ void RenderText::calcMinMaxWidth()
     
     // ### not 100% correct for first-line
     const Font *f = htmlFont( false );
+    int wordSpacing = style()->wordSpacing();
     int len = str->l;
     bool ignoringSpaces = false;
     bool isSpace = false;
@@ -995,6 +996,12 @@ void RenderText::calcMinMaxWidth()
 #endif
             currMinWidth += w;
             currMaxWidth += w;
+            
+            // Add in wordspacing to our maxwidth, but not if this is the last word, or if we hit
+            // a breakable character that is not a space.
+            if (wordSpacing && containsOnlyWhitespace(i+wordlen, len-(i+wordlen)))
+                currMaxWidth += wordSpacing;
+
             if (firstWord) {
                 firstWord = false;
                 m_beginMinWidth = w;
@@ -1037,6 +1044,15 @@ void RenderText::calcMinMaxWidth()
     //kdDebug( 6040 ) << "Text::calcMinMaxWidth(): min = " << m_minWidth << " max = " << m_maxWidth << endl;
 }
 
+bool RenderText::containsOnlyWhitespace(unsigned int from, unsigned int len) const
+{
+    unsigned int currPos;
+    for (currPos = from; 
+         currPos < from+len && (str->s[currPos] == '\n' || str->s[currPos].direction() == QChar::DirWS); 
+         currPos++);
+    return currPos < (from+len);
+}
+
 int RenderText::minXPos() const
 {
     if (!m_lines.count())
diff --git a/WebCore/khtml/rendering/render_text.h b/WebCore/khtml/rendering/render_text.h
index 2af0f70..0cf0cf6 100644
--- a/WebCore/khtml/rendering/render_text.h
+++ b/WebCore/khtml/rendering/render_text.h
@@ -181,6 +181,8 @@ public:
                                     short& beginMaxW, short& endMaxW,
                                     short& minW, short& maxW, bool& stripFrontSpaces);
     
+    bool containsOnlyWhitespace(unsigned int from, unsigned int len) const;
+    
     // returns the minimum x position of all slaves relative to the parent.
     // defaults to 0.
     int minXPos() const;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list