[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:01:53 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 80296ca20ab80ecd7d1a83a61071a2b019fadcea
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Nov 17 03:30:24 2002 +0000

    	Rewrite the calculation of min and max width for <pre>s.  This
    	is the second stage of the whitespace rewrite (third stage
    	will be to stop morphing newlines).
    
    	This should fix a bunch of bugs, e.g., especially if you ever
    	did the following:
    	<td><pre><span>foo</span>
    	   more text after the newline</pre></td>
    
    	The new code now properly handles building up the correct min/max
    	width for the <pre>.
    
    	If anyone recalls seeing any bugs like this, let me know and
    	I can close them.
    
            * khtml/rendering/render_flow.cpp:
            (RenderFlow::calcInlineMinMaxWidth):
            * khtml/rendering/render_text.cpp:
            (RenderText::trimmedMinMaxWidth):
            (RenderText::calcMinMaxWidth):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2712 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index b35b464..58fe9ee 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,5 +1,28 @@
 2002-11-16  David Hyatt  <hyatt at apple.com>
 
+	Rewrite the calculation of min and max width for <pre>s.  This
+	is the second stage of the whitespace rewrite (third stage
+	will be to stop morphing newlines).
+
+	This should fix a bunch of bugs, e.g., especially if you ever
+	did the following: 
+	<td><pre><span>foo</span>
+	   more text after the newline</pre></td>
+
+	The new code now properly handles building up the correct min/max
+	width for the <pre>.
+
+	If anyone recalls seeing any bugs like this, let me know and
+	I can close them.
+	
+        * khtml/rendering/render_flow.cpp:
+        (RenderFlow::calcInlineMinMaxWidth):
+        * khtml/rendering/render_text.cpp:
+        (RenderText::trimmedMinMaxWidth):
+        (RenderText::calcMinMaxWidth):
+
+2002-11-16  David Hyatt  <hyatt at apple.com>
+
 	Fix more edge cases with whitespace handling that caused some
 	lines to be too long (and unselectable).
 	
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index b35b464..58fe9ee 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,28 @@
 2002-11-16  David Hyatt  <hyatt at apple.com>
 
+	Rewrite the calculation of min and max width for <pre>s.  This
+	is the second stage of the whitespace rewrite (third stage
+	will be to stop morphing newlines).
+
+	This should fix a bunch of bugs, e.g., especially if you ever
+	did the following: 
+	<td><pre><span>foo</span>
+	   more text after the newline</pre></td>
+
+	The new code now properly handles building up the correct min/max
+	width for the <pre>.
+
+	If anyone recalls seeing any bugs like this, let me know and
+	I can close them.
+	
+        * khtml/rendering/render_flow.cpp:
+        (RenderFlow::calcInlineMinMaxWidth):
+        * khtml/rendering/render_text.cpp:
+        (RenderText::trimmedMinMaxWidth):
+        (RenderText::calcMinMaxWidth):
+
+2002-11-16  David Hyatt  <hyatt at apple.com>
+
 	Fix more edge cases with whitespace handling that caused some
 	lines to be too long (and unselectable).
 	
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index b35b464..58fe9ee 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,28 @@
 2002-11-16  David Hyatt  <hyatt at apple.com>
 
+	Rewrite the calculation of min and max width for <pre>s.  This
+	is the second stage of the whitespace rewrite (third stage
+	will be to stop morphing newlines).
+
+	This should fix a bunch of bugs, e.g., especially if you ever
+	did the following: 
+	<td><pre><span>foo</span>
+	   more text after the newline</pre></td>
+
+	The new code now properly handles building up the correct min/max
+	width for the <pre>.
+
+	If anyone recalls seeing any bugs like this, let me know and
+	I can close them.
+	
+        * khtml/rendering/render_flow.cpp:
+        (RenderFlow::calcInlineMinMaxWidth):
+        * khtml/rendering/render_text.cpp:
+        (RenderText::trimmedMinMaxWidth):
+        (RenderText::calcMinMaxWidth):
+
+2002-11-16  David Hyatt  <hyatt at apple.com>
+
 	Fix more edge cases with whitespace handling that caused some
 	lines to be too long (and unselectable).
 	
diff --git a/WebCore/khtml/rendering/render_flow.cpp b/WebCore/khtml/rendering/render_flow.cpp
index a716a32..b646f3d 100644
--- a/WebCore/khtml/rendering/render_flow.cpp
+++ b/WebCore/khtml/rendering/render_flow.cpp
@@ -1451,7 +1451,6 @@ void RenderFlow::calcInlineMinMaxWidth()
                 // min and max and continue.
                 if (!hasBreakableChar) {
                     inlineMin += childMin;
-                    inlineMax += childMax;
                 }
                 else {
                     // We have a breakable character.  Now we need to know if
@@ -1478,9 +1477,16 @@ void RenderFlow::calcInlineMinMaxWidth()
                         if(m_minWidth < inlineMin) m_minWidth = inlineMin;
                         inlineMin = endMin;
                     }
-                        
-                    inlineMax += childMax;
                 }
+                
+                if (hasBreak) {
+                    inlineMax += beginMax;
+                    if (m_maxWidth < inlineMax) m_maxWidth = inlineMax;
+                    if (m_maxWidth < childMax) m_maxWidth = childMax;
+                    inlineMax = endMax;
+                }
+                else
+                    inlineMax += childMax;
             }
         }
         else
diff --git a/WebCore/khtml/rendering/render_text.cpp b/WebCore/khtml/rendering/render_text.cpp
index a62172c..3efb83f 100644
--- a/WebCore/khtml/rendering/render_text.cpp
+++ b/WebCore/khtml/rendering/render_text.cpp
@@ -758,8 +758,7 @@ void RenderText::trimmedMinMaxWidth(short& beginMinW, bool& beginWS,
     endMinW = m_endMinWidth;
     
     hasBreakableChar = m_hasBreakableChar;
-    hasBreak = false; // XXXdwh will need to make this work eventually.
-                      // m_hasBreak;
+    hasBreak = m_hasBreak;
     
     if (len == 0)
         return;
@@ -780,8 +779,31 @@ void RenderText::trimmedMinMaxWidth(short& beginMinW, bool& beginWS,
 
     // Compute our max widths by scanning the string for newlines.
     if (hasBreak) {
-        // XXXdwh this will only be an issue for white-space: pre inlines and
-        // not for the <pre> element itself.
+        const Font *f = htmlFont( false );
+        bool firstLine = true;
+        beginMaxW = endMaxW = maxW;
+        for(int i = 0; i < len; i++)
+        {
+            int linelen = 0;
+            while( i+linelen < len && str->s[i+linelen] != '\n')
+                linelen++;
+                
+            if (linelen)
+            {
+                endMaxW = f->width(str->s, str->l, i, linelen);
+                if (firstLine) {
+                    firstLine = false;
+                    beginMaxW = endMaxW;
+                }
+                i += linelen;
+                if (i == len-1)
+                    endMaxW = 0;
+            }
+            else if (firstLine) {
+                beginMaxW = 0;
+                firstLine = false;
+            }
+        }
     }
 }
 
@@ -809,11 +831,14 @@ void RenderText::calcMinMaxWidth()
     bool firstWord = true;
     for(int i = 0; i < len; i++)
     {
+        bool isNewline = false;
         // XXXdwh Wrong in the first stage.  Will stop mutating newlines
         // in a second stage.
         if (str->s[i] == '\n') {
-            if (isPre)
+            if (isPre) {
                 m_hasBreak = true;
+                isNewline = true;
+            }
             else
                 str->s[i] = ' ';
         }
@@ -821,9 +846,9 @@ void RenderText::calcMinMaxWidth()
         bool oldSpace = isSpace;
         isSpace = str->s[i].direction() == QChar::DirWS;
         
-        if (isSpace && i == 0)
+        if ((isSpace || isNewline) && i == 0)
             m_hasBeginWS = true;
-        if (isSpace && i == len-1)
+        if ((isSpace || isNewline) && i == len-1)
             m_hasEndWS = true;
             
         if (!ignoringSpaces && !isPre && oldSpace && isSpace)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list