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

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:59:48 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit a3c4828d7e05951f83b34b5c26cf954d58628ff4
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 7 15:49:30 2003 +0000

            Reviewed by Dave.
    
            - removed code that mutates \n into a space so we can pass more W3C DOM Level 1 Core tests
    
            * khtml/rendering/bidi.cpp:
            (khtml::addRun): Treat \n as a space.
            (khtml::RenderBlock::computeHorizontalPositionsForLine): Treat \n as a space.
            (khtml::RenderBlock::findNextLineBreak): Treat \n outside <pre> as a space.
            Removed code that mutates the \n into a space.
    
            * khtml/rendering/render_text.cpp:
            (RenderText::trimmedMinMaxWidth): Treat \n outside <pre> as a space.
            (RenderText::calcMinMaxWidth): Treat \n outside <pre> as a space.
            Removed code that mutates the \n into a space.
            (RenderText::position): Detect a <br> with isBR instead of assuming a 1-character
            string with a \n in it is a <br>.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5142 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 0b058c0..b95d686 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,22 @@
+2003-10-07  Darin Adler  <darin at apple.com>
+
+        Reviewed by Dave.
+
+        - removed code that mutates \n into a space so we can pass more W3C DOM Level 1 Core tests
+
+        * khtml/rendering/bidi.cpp:
+        (khtml::addRun): Treat \n as a space.
+        (khtml::RenderBlock::computeHorizontalPositionsForLine): Treat \n as a space.
+        (khtml::RenderBlock::findNextLineBreak): Treat \n outside <pre> as a space.
+        Removed code that mutates the \n into a space.
+
+        * khtml/rendering/render_text.cpp:
+        (RenderText::trimmedMinMaxWidth): Treat \n outside <pre> as a space.
+        (RenderText::calcMinMaxWidth): Treat \n outside <pre> as a space.
+        Removed code that mutates the \n into a space.
+        (RenderText::position): Detect a <br> with isBR instead of assuming a 1-character
+        string with a \n in it is a <br>.
+
 2003-10-06  David Hyatt  <hyatt at apple.com>
 
 	Several fixes preparing for the incremental repainting patch to be enabled.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 0b058c0..b95d686 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,22 @@
+2003-10-07  Darin Adler  <darin at apple.com>
+
+        Reviewed by Dave.
+
+        - removed code that mutates \n into a space so we can pass more W3C DOM Level 1 Core tests
+
+        * khtml/rendering/bidi.cpp:
+        (khtml::addRun): Treat \n as a space.
+        (khtml::RenderBlock::computeHorizontalPositionsForLine): Treat \n as a space.
+        (khtml::RenderBlock::findNextLineBreak): Treat \n outside <pre> as a space.
+        Removed code that mutates the \n into a space.
+
+        * khtml/rendering/render_text.cpp:
+        (RenderText::trimmedMinMaxWidth): Treat \n outside <pre> as a space.
+        (RenderText::calcMinMaxWidth): Treat \n outside <pre> as a space.
+        Removed code that mutates the \n into a space.
+        (RenderText::position): Detect a <br> with isBR instead of assuming a 1-character
+        string with a \n in it is a <br>.
+
 2003-10-06  David Hyatt  <hyatt at apple.com>
 
 	Several fixes preparing for the incremental repainting patch to be enabled.
diff --git a/WebCore/khtml/rendering/bidi.cpp b/WebCore/khtml/rendering/bidi.cpp
index cb00da7..807bc62 100644
--- a/WebCore/khtml/rendering/bidi.cpp
+++ b/WebCore/khtml/rendering/bidi.cpp
@@ -369,9 +369,11 @@ static void addRun(BidiRun* bidiRun)
     // Compute the number of spaces in this run,
     if (bidiRun->obj && bidiRun->obj->isText()) {
         RenderText* text = static_cast<RenderText*>(bidiRun->obj);
-        for (int i = bidiRun->start; i < bidiRun->stop; i++)
-            if (text->text()[i].unicode() == ' ')
+        for (int i = bidiRun->start; i < bidiRun->stop; i++) {
+            const QChar c = text->text()[i];
+            if (c == ' ' || c == '\n')
                 numSpaces++;
+        }
     }
 }
 
@@ -736,9 +738,11 @@ void RenderBlock::computeHorizontalPositionsForLine(InlineFlowBox* lineBox, Bidi
             if (numSpaces > 0 && r->obj->isText() && !r->compact) {
                 // get the number of spaces in the run
                 int spaces = 0;
-                for ( int i = r->start; i < r->stop; i++ )
-                    if ( static_cast<RenderText *>(r->obj)->text()[i].unicode() == ' ' )
+                for ( int i = r->start; i < r->stop; i++ ) {
+                    const QChar c = static_cast<RenderText *>(r->obj)->text()[i];
+                    if (c == ' ' || c == '\n')
                         spaces++;
+                }
 
                 KHTMLAssert(spaces <= numSpaces);
 
@@ -1443,8 +1447,8 @@ BidiIterator RenderBlock::findNextLineBreak(BidiIterator &start, BidiState &bidi
     // eliminate spaces at beginning of line
     // remove leading spaces.  Any inline flows we encounter will be empty and should also
     // be skipped.
-    while (!start.atEnd() && (start.obj->isInlineFlow() || (start.obj->style()->whiteSpace() != PRE &&
-          (start.current() == ' ' || start.obj->isFloatingOrPositioned())))) {
+    while (!start.atEnd() && (start.obj->isInlineFlow() || (start.obj->style()->whiteSpace() != PRE && !start.obj->isBR() &&
+          (start.current() == ' ' || start.current() == '\n' || start.obj->isFloatingOrPositioned())))) {
         if( start.obj->isFloatingOrPositioned() ) {
             RenderObject *o = start.obj;
             // add to special objects...
@@ -1625,20 +1629,15 @@ BidiIterator RenderBlock::findNextLineBreak(BidiIterator &start, BidiState &bidi
             bool appliedEndWidth = false;
 
             while(len) {
-                //XXXdwh This is wrong. Still mutating the DOM
-                // string for newlines... will fix in second stage.
-                if (!isPre && str[pos] == '\n'){
-                    str[pos] = ' ';
-                }
-                    
                 bool previousCharacterIsSpace = currentCharacterIsSpace;
-                currentCharacterIsSpace = (str[pos].unicode() == ' ');
-                    
+                const QChar c = str[pos];
+                currentCharacterIsSpace = c == ' ' || (!isPre && c == '\n');
+                
                 if (isPre || !currentCharacterIsSpace)
                     isLineEmpty = false;
                 
                 bool applyWordSpacing = false;
-                if( (isPre && str[pos] == '\n') || (!isPre && isBreakable( str, pos, strlen )) ) {
+                if ( (isPre && c == '\n') || (!isPre && isBreakable( str, pos, strlen )) ) {
                     if (ignoringSpaces) {
                         if (!currentCharacterIsSpace) {
                             // Stop ignoring spaces and begin at this
diff --git a/WebCore/khtml/rendering/render_text.cpp b/WebCore/khtml/rendering/render_text.cpp
index f083da7..e4e9f8b 100644
--- a/WebCore/khtml/rendering/render_text.cpp
+++ b/WebCore/khtml/rendering/render_text.cpp
@@ -945,7 +945,7 @@ void RenderText::trimmedMinMaxWidth(short& beginMinW, bool& beginWS,
     hasBreakableChar = m_hasBreakableChar;
     hasBreak = m_hasBreak;
 
-    if (stripFrontSpaces && str->s[0].unicode() == ' ') {
+    if (stripFrontSpaces && (str->s[0] == ' ' || (!isPre && str->s[0] == '\n'))) {
         const Font *f = htmlFont( false );
         QChar space[1]; space[0] = ' ';
         int spaceWidth = f->width(space, 1, 0);
@@ -1021,21 +1021,23 @@ void RenderText::calcMinMaxWidth()
     bool firstWord = true;
     for(int i = 0; i < len; i++)
     {
+        const QChar c = str->s[i];
+        
+        bool previousCharacterIsSpace = isSpace;
+        
         bool isNewline = false;
-        // XXXdwh Wrong in the first stage.  Will stop mutating newlines
-        // in a second stage.
-        if (str->s[i] == '\n') {
+        if (c == '\n') {
             if (isPre) {
                 m_hasBreak = true;
                 isNewline = true;
+                isSpace = false;
             }
             else
-                str->s[i] = ' ';
+                isSpace = true;
+        } else {
+            isSpace = c == ' ';
         }
         
-        bool previousCharacterIsSpace = isSpace;
-        isSpace = str->s[i].unicode() == ' ';
-        
         if ((isSpace || isNewline) && i == 0)
             m_hasBeginWS = true;
         if ((isSpace || isNewline) && i == len-1)
@@ -1230,7 +1232,7 @@ void RenderText::position(InlineBox* box, int from, int len, bool reverse)
     InlineTextBox *s = static_cast<InlineTextBox*>(box);
     
     // ### should not be needed!!!
-    if (len == 0 || (str->l && len == 1 && *(str->s+from) == '\n')) {
+    if (len == 0 || isBR()) {
         // We want the box to be destroyed.  This is a <br>, and we don't
         // need <br>s to be included.
         s->detach(renderArena());

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list