[webkit-changes] cvs commit: WebCore/khtml/rendering render_text.cpp

David harrison at opensource.apple.com
Fri Nov 4 13:02:50 PST 2005


harrison    05/11/04 13:02:48

  Modified:    .        ChangeLog
               khtml/rendering render_text.cpp
  Added:       manual-tests whitespace-pre-affinity.html
  Log:
          Reviewed by John Sullivan.
  
          Test case added:
          * manual-tests/whitespace-pre-affinity.html
  
          http://bugzilla.opendarwin.org/show_bug.cgi?id=3739
  
          This patch addresses the root cause of the problem by making
          RenderText::inlineBox() cope with the fact that in white-space:pre text the
          newline characters are not part of any InlineTextBox... they lie "between"
          them.	Now DOWNSTREAM affinity selects the next text box only if the offset
          that is past the current box is actually _in_ the next box.
  
          * khtml/rendering/render_text.cpp:
          (RenderText::inlineBox):
  
  Revision  Changes    Path
  1.337     +18 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.336
  retrieving revision 1.337
  diff -u -r1.336 -r1.337
  --- ChangeLog	4 Nov 2005 20:39:58 -0000	1.336
  +++ ChangeLog	4 Nov 2005 21:02:38 -0000	1.337
  @@ -1,3 +1,21 @@
  +2005-11-04  David Harrison  <harrison at apple.com>
  +
  +        Reviewed by John Sullivan.
  +
  +        Test case added:
  +        * manual-tests/whitespace-pre-affinity.html
  +
  +        http://bugzilla.opendarwin.org/show_bug.cgi?id=3739
  +
  +        This patch addresses the root cause of the problem by making
  +        RenderText::inlineBox() cope with the fact that in white-space:pre text the
  +        newline characters are not part of any InlineTextBox... they lie "between"
  +        them.	Now DOWNSTREAM affinity selects the next text box only if the offset
  +        that is past the current box is actually _in_ the next box.
  +        
  +        * khtml/rendering/render_text.cpp:
  +        (RenderText::inlineBox):
  +
   2005-11-04  Darin Adler  <darin at apple.com>
   
           - removed unused duplicate copy of hash table code
  
  
  
  1.1                  WebCore/manual-tests/whitespace-pre-affinity.html
  
  Index: whitespace-pre-affinity.html
  ===================================================================
  <html>
  <body>
  <p>This test checks for a regression against http://bugzilla.opendarwin.org/show_bug.cgi?id=3739.</p>
  NOTES:<ol>
  <li>this MUST be checked in a build because the symptom is an assert</li>
  <li>double-click a few times on the blanks lines below</li>
  <li>if you hit the isEqualIgnoringAffinity() assert, the bug is back</li>
  </ol>
  <hr>
  <pre>One
  
  Two
  
  Three</pre>
  </body>
  </html>
  
  
  
  1.206     +12 -2     WebCore/khtml/rendering/render_text.cpp
  
  Index: render_text.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_text.cpp,v
  retrieving revision 1.205
  retrieving revision 1.206
  diff -u -r1.205 -r1.206
  --- render_text.cpp	2 Nov 2005 08:52:46 -0000	1.205
  +++ render_text.cpp	4 Nov 2005 21:02:46 -0000	1.206
  @@ -1812,8 +1812,18 @@
   {
       for (InlineTextBox *box = firstTextBox(); box; box = box->nextTextBox()) {
           if (offset >= box->m_start && offset <= box->m_start + box->m_len) {
  -            if (affinity == DOWNSTREAM && box->nextTextBox() && offset == box->m_start + box->m_len)
  -                return box->nextTextBox();
  +            if (affinity == DOWNSTREAM) {
  +                // Take special care because in white-space:pre, the newline
  +                // characters are in between the text boxes (i.e. not in any
  +                // box's m_start thru m_start+m_len-1).  So, check that the
  +                // offset really is in the next text box, vs checking that it
  +                // is simply "past" the current box.
  +                InlineTextBox *nextBox = box->nextTextBox();
  +                if (nextBox && offset >= nextBox->m_start) {
  +                    assert(offset < nextBox->m_start + nextBox->m_len);
  +                    return box->nextTextBox();
  +                }
  +            }
               return box;
           }
           else if (offset < box->m_start) {
  
  
  



More information about the webkit-changes mailing list