[webkit-changes] cvs commit: WebCore/layout-tests/fast/tokenizer script_extra_close-expected.txt

David harrison at opensource.apple.com
Fri Jul 29 16:43:00 PDT 2005


harrison    05/07/29 16:42:59

  Modified:    .        ChangeLog
               khtml/editing apply_style_command.cpp
                        delete_selection_command.cpp edit_command.cpp
                        html_interchange.h htmlediting.cpp htmlediting.h
                        insert_text_command.cpp insert_text_command.h
                        markup.cpp replace_selection_command.cpp
               khtml/html htmltokenizer.cpp htmltokenizer.h
               khtml/rendering bidi.cpp break_lines.cpp font.cpp font.h
                        render_block.cpp render_block.h render_br.h
                        render_flexbox.cpp render_image.cpp render_line.cpp
                        render_line.h render_list.cpp render_object.cpp
                        render_object.h render_replaced.cpp render_text.cpp
                        render_text.h
               kwq      KWQFontMetrics.h KWQFontMetrics.mm KWQPainter.h
                        KWQPainter.mm WebCoreTextRenderer.h
                        WebCoreTextRendererFactory.mm
               layout-tests/editing/deleting delete-tab-001-expected.txt
                        delete-tab-001.html delete-tab-002-expected.txt
                        delete-tab-002.html delete-tab-003-expected.txt
                        delete-tab-003.html delete-tab-004-expected.txt
                        delete-tab-004.html
               layout-tests/editing/inserting insert-tab-001-expected.txt
                        insert-tab-002-expected.txt
                        insert-tab-003-expected.txt
                        insert-tab-004-expected.txt
               layout-tests/fast/js string-replace-2-expected.txt
               layout-tests/fast/table 039-expected.txt
               layout-tests/fast/table/border-collapsing 004-expected.txt
               layout-tests/fast/tokenizer script_extra_close-expected.txt
  Log:
          Reviewed by Dave Hyatt (rendering) and Maciej (editing and performance improvements).
  
          Test cases added: Existing tab-related basic editing tests were updated.  More complex tests are coming soon.
  
          <rdar://problem/3792529> REGRESSION (Mail): Tabs do not work the way they did in Panther (especially useful in plain text mail)
  
          Basic strategy is to put tabs into spans with white-space:pre style, and
          render them with tabs stops every 8th space, where the space width and
          the left margin are those of the enclosing block.
  
          * khtml/editing/apply_style_command.cpp:
          (khtml::ApplyStyleCommand::removeCSSStyle):
          (khtml::ApplyStyleCommand::addInlineStyleIfNeeded):
          * khtml/editing/delete_selection_command.cpp:
          (khtml::DeleteSelectionCommand::saveTypingStyleState):
          * khtml/editing/edit_command.cpp:
          (khtml::EditCommand::styleAtPosition):
          * khtml/editing/html_interchange.h:
          * khtml/editing/htmlediting.cpp:
          (khtml::isSpecialElement):
          (khtml::isTabSpanNode):
          (khtml::isTabSpanTextNode):
          (khtml::positionBeforeTabSpan):
          (khtml::createTabSpanElement):
          * khtml/editing/htmlediting.h:
          * khtml/editing/insert_text_command.cpp:
          (khtml::InsertTextCommand::prepareForTextInsertion):
          (khtml::InsertTextCommand::input):
          (khtml::InsertTextCommand::insertTab):
          * khtml/editing/insert_text_command.h:
          * khtml/editing/markup.cpp:
          (khtml::createParagraphContentsFromString):
          (khtml::createFragmentFromText):
          * khtml/editing/replace_selection_command.cpp:
          (khtml::ReplacementFragment::removeStyleNodes):
          * khtml/html/htmltokenizer.cpp:
          (khtml::HTMLTokenizer::begin):
          (khtml::HTMLTokenizer::processListing):
          (khtml::HTMLTokenizer::parseSpecial):
          (khtml::HTMLTokenizer::parseText):
          (khtml::HTMLTokenizer::parseEntity):
          (khtml::HTMLTokenizer::parseTag):
          (khtml::HTMLTokenizer::addPending):
          (khtml::HTMLTokenizer::write):
          * khtml/html/htmltokenizer.h:
          (khtml::HTMLTokenizer::):
          * khtml/rendering/bidi.cpp:
          (khtml::addRun):
          (khtml::RenderBlock::tabWidth):
          (khtml::RenderBlock::computeHorizontalPositionsForLine):
          (khtml::RenderBlock::layoutInlineChildren):
          (khtml::RenderBlock::skipWhitespace):
          (khtml::RenderBlock::findNextLineBreak):
          (khtml::RenderBlock::checkLinesForTextOverflow):
          * khtml/rendering/break_lines.cpp:
          (khtml::isBreakable):
          * khtml/rendering/font.cpp:
          (Font::drawHighlightForText):
          (Font::drawText):
          (Font::floatWidth):
          (Font::floatCharacterWidths):
          (Font::checkSelectionPoint):
          (Font::width):
          * khtml/rendering/font.h:
          * khtml/rendering/render_block.cpp:
          (khtml:::RenderFlow):
          (khtml::RenderBlock::setStyle):
          (khtml::stripTrailingSpace):
          (khtml::RenderBlock::calcInlineMinMaxWidth):
          * khtml/rendering/render_block.h:
          * khtml/rendering/render_br.h:
          (khtml::RenderBR::width):
          * khtml/rendering/render_flexbox.cpp:
          (khtml::RenderFlexibleBox::layoutVerticalBox):
          * khtml/rendering/render_image.cpp:
          (RenderImage::setPixmap):
          (RenderImage::paint):
          * khtml/rendering/render_line.cpp:
          (khtml::EllipsisBox::paint):
          * khtml/rendering/render_line.h:
          (khtml::InlineBox::width):
          (khtml::InlineBox::xPos):
          (khtml::InlineBox::yPos):
          (khtml::InlineBox::height):
          (khtml::InlineBox::baseline):
          * khtml/rendering/render_list.cpp:
          (RenderListMarker::paint):
          (RenderListMarker::calcMinMaxWidth):
          * khtml/rendering/render_object.cpp:
          (RenderObject::tabWidth):
          (RenderObject::recalcMinMaxWidths):
          * khtml/rendering/render_object.h:
          * khtml/rendering/render_replaced.cpp:
          * khtml/rendering/render_text.cpp:
          (InlineTextBox::selectionRect):
          (InlineTextBox::paint):
          (InlineTextBox::paintSelection):
          (InlineTextBox::paintMarkedTextBackground):
          (InlineTextBox::textPos):
          (InlineTextBox::offsetForPosition):
          (InlineTextBox::positionForOffset):
          (RenderText::cacheWidths):
          (RenderText::widthFromCache):
          (RenderText::trimmedMinMaxWidth):
          (RenderText::calcMinMaxWidth):
          (RenderText::containsOnlyWhitespace):
          (RenderText::width):
          * khtml/rendering/render_text.h:
          * kwq/KWQFontMetrics.h:
          * kwq/KWQFontMetrics.mm:
          (QFontMetrics::width):
          (QFontMetrics::charWidth):
          (QFontMetrics::floatWidth):
          (QFontMetrics::floatCharacterWidths):
          (QFontMetrics::checkSelectionPoint):
          (QFontMetrics::boundingRect):
          (QFontMetrics::size):
          * kwq/KWQPainter.h:
          * kwq/KWQPainter.mm:
          (QPainter::drawRect):
          (QPainter::drawLine):
          (QPainter::drawText):
          (QPainter::drawHighlightForText):
          (_fillRectXX):
          (QPainter::fillRect):
          * kwq/WebCoreTextRenderer.h:
          * kwq/WebCoreTextRendererFactory.mm:
          (WebCoreInitializeEmptyTextStyle):
          * layout-tests/editing/deleting/delete-tab-001-expected.txt:
          * layout-tests/editing/deleting/delete-tab-001.html:
          * layout-tests/editing/deleting/delete-tab-002-expected.txt:
          * layout-tests/editing/deleting/delete-tab-002.html:
          * layout-tests/editing/deleting/delete-tab-003-expected.txt:
          * layout-tests/editing/deleting/delete-tab-003.html:
          * layout-tests/editing/deleting/delete-tab-004-expected.txt:
          * layout-tests/editing/deleting/delete-tab-004.html:
          * layout-tests/editing/inserting/insert-tab-001-expected.txt:
          * layout-tests/editing/inserting/insert-tab-002-expected.txt:
          * layout-tests/editing/inserting/insert-tab-003-expected.txt:
          * layout-tests/editing/inserting/insert-tab-004-expected.txt:
          * layout-tests/fast/js/string-replace-2-expected.txt:
          * layout-tests/fast/table/039-expected.txt:
          * layout-tests/fast/table/border-collapsing/004-expected.txt:
          * layout-tests/fast/tokenizer/script_extra_close-expected.txt:
  
  Revision  Changes    Path
  1.4499    +147 -0    WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.4498
  retrieving revision 1.4499
  diff -u -r1.4498 -r1.4499
  --- ChangeLog	29 Jul 2005 23:05:40 -0000	1.4498
  +++ ChangeLog	29 Jul 2005 23:42:40 -0000	1.4499
  @@ -1,3 +1,150 @@
  +2005-07-29  David Harrison  <harrison at apple.com>
  +
  +        Reviewed by Dave Hyatt (rendering) and Maciej (editing and performance improvements).
  +
  +        Test cases added: Existing tab-related basic editing tests were updated.  More complex tests are coming soon.
  +
  +        <rdar://problem/3792529> REGRESSION (Mail): Tabs do not work the way they did in Panther (especially useful in plain text mail)
  +        
  +        Basic strategy is to put tabs into spans with white-space:pre style, and
  +        render them with tabs stops every 8th space, where the space width and
  +        the left margin are those of the enclosing block.
  +
  +        * khtml/editing/apply_style_command.cpp:
  +        (khtml::ApplyStyleCommand::removeCSSStyle):
  +        (khtml::ApplyStyleCommand::addInlineStyleIfNeeded):
  +        * khtml/editing/delete_selection_command.cpp:
  +        (khtml::DeleteSelectionCommand::saveTypingStyleState):
  +        * khtml/editing/edit_command.cpp:
  +        (khtml::EditCommand::styleAtPosition):
  +        * khtml/editing/html_interchange.h:
  +        * khtml/editing/htmlediting.cpp:
  +        (khtml::isSpecialElement):
  +        (khtml::isTabSpanNode):
  +        (khtml::isTabSpanTextNode):
  +        (khtml::positionBeforeTabSpan):
  +        (khtml::createTabSpanElement):
  +        * khtml/editing/htmlediting.h:
  +        * khtml/editing/insert_text_command.cpp:
  +        (khtml::InsertTextCommand::prepareForTextInsertion):
  +        (khtml::InsertTextCommand::input):
  +        (khtml::InsertTextCommand::insertTab):
  +        * khtml/editing/insert_text_command.h:
  +        * khtml/editing/markup.cpp:
  +        (khtml::createParagraphContentsFromString):
  +        (khtml::createFragmentFromText):
  +        * khtml/editing/replace_selection_command.cpp:
  +        (khtml::ReplacementFragment::removeStyleNodes):
  +        * khtml/html/htmltokenizer.cpp:
  +        (khtml::HTMLTokenizer::begin):
  +        (khtml::HTMLTokenizer::processListing):
  +        (khtml::HTMLTokenizer::parseSpecial):
  +        (khtml::HTMLTokenizer::parseText):
  +        (khtml::HTMLTokenizer::parseEntity):
  +        (khtml::HTMLTokenizer::parseTag):
  +        (khtml::HTMLTokenizer::addPending):
  +        (khtml::HTMLTokenizer::write):
  +        * khtml/html/htmltokenizer.h:
  +        (khtml::HTMLTokenizer::):
  +        * khtml/rendering/bidi.cpp:
  +        (khtml::addRun):
  +        (khtml::RenderBlock::tabWidth):
  +        (khtml::RenderBlock::computeHorizontalPositionsForLine):
  +        (khtml::RenderBlock::layoutInlineChildren):
  +        (khtml::RenderBlock::skipWhitespace):
  +        (khtml::RenderBlock::findNextLineBreak):
  +        (khtml::RenderBlock::checkLinesForTextOverflow):
  +        * khtml/rendering/break_lines.cpp:
  +        (khtml::isBreakable):
  +        * khtml/rendering/font.cpp:
  +        (Font::drawHighlightForText):
  +        (Font::drawText):
  +        (Font::floatWidth):
  +        (Font::floatCharacterWidths):
  +        (Font::checkSelectionPoint):
  +        (Font::width):
  +        * khtml/rendering/font.h:
  +        * khtml/rendering/render_block.cpp:
  +        (khtml:::RenderFlow):
  +        (khtml::RenderBlock::setStyle):
  +        (khtml::stripTrailingSpace):
  +        (khtml::RenderBlock::calcInlineMinMaxWidth):
  +        * khtml/rendering/render_block.h:
  +        * khtml/rendering/render_br.h:
  +        (khtml::RenderBR::width):
  +        * khtml/rendering/render_flexbox.cpp:
  +        (khtml::RenderFlexibleBox::layoutVerticalBox):
  +        * khtml/rendering/render_image.cpp:
  +        (RenderImage::setPixmap):
  +        (RenderImage::paint):
  +        * khtml/rendering/render_line.cpp:
  +        (khtml::EllipsisBox::paint):
  +        * khtml/rendering/render_line.h:
  +        (khtml::InlineBox::width):
  +        (khtml::InlineBox::xPos):
  +        (khtml::InlineBox::yPos):
  +        (khtml::InlineBox::height):
  +        (khtml::InlineBox::baseline):
  +        * khtml/rendering/render_list.cpp:
  +        (RenderListMarker::paint):
  +        (RenderListMarker::calcMinMaxWidth):
  +        * khtml/rendering/render_object.cpp:
  +        (RenderObject::tabWidth):
  +        (RenderObject::recalcMinMaxWidths):
  +        * khtml/rendering/render_object.h:
  +        * khtml/rendering/render_replaced.cpp:
  +        * khtml/rendering/render_text.cpp:
  +        (InlineTextBox::selectionRect):
  +        (InlineTextBox::paint):
  +        (InlineTextBox::paintSelection):
  +        (InlineTextBox::paintMarkedTextBackground):
  +        (InlineTextBox::textPos):
  +        (InlineTextBox::offsetForPosition):
  +        (InlineTextBox::positionForOffset):
  +        (RenderText::cacheWidths):
  +        (RenderText::widthFromCache):
  +        (RenderText::trimmedMinMaxWidth):
  +        (RenderText::calcMinMaxWidth):
  +        (RenderText::containsOnlyWhitespace):
  +        (RenderText::width):
  +        * khtml/rendering/render_text.h:
  +        * kwq/KWQFontMetrics.h:
  +        * kwq/KWQFontMetrics.mm:
  +        (QFontMetrics::width):
  +        (QFontMetrics::charWidth):
  +        (QFontMetrics::floatWidth):
  +        (QFontMetrics::floatCharacterWidths):
  +        (QFontMetrics::checkSelectionPoint):
  +        (QFontMetrics::boundingRect):
  +        (QFontMetrics::size):
  +        * kwq/KWQPainter.h:
  +        * kwq/KWQPainter.mm:
  +        (QPainter::drawRect):
  +        (QPainter::drawLine):
  +        (QPainter::drawText):
  +        (QPainter::drawHighlightForText):
  +        (_fillRectXX):
  +        (QPainter::fillRect):
  +        * kwq/WebCoreTextRenderer.h:
  +        * kwq/WebCoreTextRendererFactory.mm:
  +        (WebCoreInitializeEmptyTextStyle):
  +        * layout-tests/editing/deleting/delete-tab-001-expected.txt:
  +        * layout-tests/editing/deleting/delete-tab-001.html:
  +        * layout-tests/editing/deleting/delete-tab-002-expected.txt:
  +        * layout-tests/editing/deleting/delete-tab-002.html:
  +        * layout-tests/editing/deleting/delete-tab-003-expected.txt:
  +        * layout-tests/editing/deleting/delete-tab-003.html:
  +        * layout-tests/editing/deleting/delete-tab-004-expected.txt:
  +        * layout-tests/editing/deleting/delete-tab-004.html:
  +        * layout-tests/editing/inserting/insert-tab-001-expected.txt:
  +        * layout-tests/editing/inserting/insert-tab-002-expected.txt:
  +        * layout-tests/editing/inserting/insert-tab-003-expected.txt:
  +        * layout-tests/editing/inserting/insert-tab-004-expected.txt:
  +        * layout-tests/fast/js/string-replace-2-expected.txt:
  +        * layout-tests/fast/table/039-expected.txt:
  +        * layout-tests/fast/table/border-collapsing/004-expected.txt:
  +        * layout-tests/fast/tokenizer/script_extra_close-expected.txt:
  +
   2005-07-29  David Hyatt  <hyatt at apple.com>
   
   	(1) Fixes khtml-user-select: none to have the following additional behavior (that matches Firefox's implementation of the property as well)
  
  
  
  1.8       +7 -0      WebCore/khtml/editing/apply_style_command.cpp
  
  Index: apply_style_command.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/apply_style_command.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- apply_style_command.cpp	18 Jul 2005 21:52:20 -0000	1.7
  +++ apply_style_command.cpp	29 Jul 2005 23:42:45 -0000	1.8
  @@ -32,6 +32,7 @@
   #include "css/cssparser.h"
   #include "css/cssproperties.h"
   #include "dom/dom_string.h"
  +#include "htmlediting.h"
   #include "html/html_elementimpl.h"
   #include "htmlnames.h"
   #include "rendering/render_object.h"
  @@ -679,6 +680,8 @@
           int propertyID = (*it).id();
           CSSValueImpl *value = decl->getPropertyCSSValue(propertyID);
           if (value) {
  +            if (propertyID == CSS_PROP_WHITE_SPACE && isTabSpanNode(elem))
  +                continue;
               value->ref();
               removeCSSProperty(decl, propertyID);
               value->deref();
  @@ -1249,6 +1252,10 @@
       StyleChange styleChange(style, Position(startNode, 0), StyleChange::styleModeForParseMode(document()->inCompatMode()));
       int exceptionCode = 0;
       
  +    // Prevent style changes to our tab spans, because it might remove the whitespace:pre we are after
  +    if (isTabSpanTextNode(startNode))
  +        return;
  +    
       //
       // Font tags need to go outside of CSS so that CSS font sizes override leagcy font sizes.
       //
  
  
  
  1.13      +1 -1      WebCore/khtml/editing/delete_selection_command.cpp
  
  Index: delete_selection_command.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/delete_selection_command.cpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- delete_selection_command.cpp	29 Jul 2005 22:50:48 -0000	1.12
  +++ delete_selection_command.cpp	29 Jul 2005 23:42:45 -0000	1.13
  @@ -275,7 +275,7 @@
       // Figure out the typing style in effect before the delete is done.
       // FIXME: Improve typing style.
       // See this bug: <rdar://problem/3769899> Implementation of typing style needs improvement
  -    CSSComputedStyleDeclarationImpl *computedStyle = m_selectionToDelete.start().computedStyle();
  +    CSSComputedStyleDeclarationImpl *computedStyle = positionBeforeTabSpan(m_selectionToDelete.start()).computedStyle();
       computedStyle->ref();
       m_typingStyle = computedStyle->copyInheritableProperties();
       m_typingStyle->ref();
  
  
  
  1.6       +2 -1      WebCore/khtml/editing/edit_command.cpp
  
  Index: edit_command.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/edit_command.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- edit_command.cpp	5 Jul 2005 23:21:07 -0000	1.5
  +++ edit_command.cpp	29 Jul 2005 23:42:45 -0000	1.6
  @@ -26,6 +26,7 @@
   #include "edit_command.h"
   #include "selection.h"
   #include "khtml_part.h"
  +#include "htmlediting.h"
   
   #include "xml/dom_position.h"
   #include "xml/dom_docimpl.h"
  @@ -389,7 +390,7 @@
   
   CSSMutableStyleDeclarationImpl *EditCommand::styleAtPosition(const Position &pos)
   {
  -    CSSComputedStyleDeclarationImpl *computedStyle = pos.computedStyle();
  +    CSSComputedStyleDeclarationImpl *computedStyle = positionBeforeTabSpan(pos).computedStyle();
       computedStyle->ref();
       CSSMutableStyleDeclarationImpl *style = computedStyle->copyInheritableProperties();
       computedStyle->deref();
  
  
  
  1.8       +1 -0      WebCore/khtml/editing/html_interchange.h
  
  Index: html_interchange.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/html_interchange.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- html_interchange.h	5 Jul 2005 23:21:08 -0000	1.7
  +++ html_interchange.h	29 Jul 2005 23:42:45 -0000	1.8
  @@ -32,6 +32,7 @@
   #define AppleConvertedSpace       "Apple-converted-space"
   #define ApplePasteAsQuotation     "Apple-paste-as-quotation"
   #define AppleStyleSpanClass       "Apple-style-span"
  +#define AppleTabSpanClass         "Apple-tab-span"
   
   enum EAnnotateForInterchange { DoNotAnnotateForInterchange, AnnotateForInterchange };
   
  
  
  
  1.253     +56 -6     WebCore/khtml/editing/htmlediting.cpp
  
  Index: htmlediting.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/htmlediting.cpp,v
  retrieving revision 1.252
  retrieving revision 1.253
  diff -u -r1.252 -r1.253
  --- htmlediting.cpp	18 Jul 2005 21:52:20 -0000	1.252
  +++ htmlediting.cpp	29 Jul 2005 23:42:46 -0000	1.253
  @@ -71,6 +71,7 @@
   using DOM::DoNotUpdateLayout;
   using DOM::EditingTextImpl;
   using DOM::ElementImpl;
  +using DOM::HTMLAttributes;
   using DOM::HTMLElementImpl;
   using DOM::HTMLImageElementImpl;
   using DOM::NamedAttrMapImpl;
  @@ -126,8 +127,11 @@
       return 1;
   }
   
  -bool isSpecialElement(NodeImpl *n)
  +bool isSpecialElement(const NodeImpl *n)
   {
  +    if (!n)
  +        return false;
  +        
       if (!n->isHTMLElement())
           return false;
   
  @@ -138,16 +142,18 @@
           return true;
   
       RenderObject *renderer = n->renderer();
  -
  -    if (renderer && (renderer->style()->display() == TABLE || renderer->style()->display() == INLINE_TABLE))
  +    if (!renderer)
  +        return false;
  +        
  +    if (renderer->style()->display() == TABLE || renderer->style()->display() == INLINE_TABLE)
           return true;
   
  -    if (renderer && renderer->style()->isFloating())
  +    if (renderer->style()->isFloating())
           return true;
   
  -    if (renderer && renderer->style()->position() != STATIC)
  +    if (renderer->style()->position() != STATIC)
           return true;
  -
  +        
       return false;
   }
   
  @@ -280,6 +286,50 @@
       return breakNode;
   }
   
  +bool isTabSpanNode(const NodeImpl *node)
  +{
  +    return (node && node->isElementNode() && static_cast<const ElementImpl *>(node)->getAttribute("class") == AppleTabSpanClass);
  +}
  +
  +bool isTabSpanTextNode(const NodeImpl *node)
  +{
  +    return (node && node->parentNode() && isTabSpanNode(node->parentNode()));
  +}
  +
  +Position positionBeforeTabSpan(const Position& pos)
  +{
  +    NodeImpl *node = pos.node();
  +    if (isTabSpanTextNode(node))
  +        node = node->parent();
  +    else if (!isTabSpanNode(node))
  +        return pos;
  +    
  +    return Position(node->parentNode(), node->nodeIndex());
  +}
  +
  +ElementImpl *createTabSpanElement(DocumentImpl *document, NodeImpl *tabTextNode)
  +{
  +    // make the span to hold the tab
  +    int exceptionCode = 0;
  +    ElementImpl *spanElement = document->createElementNS(HTMLTags::xhtmlNamespaceURI(), "span", exceptionCode);
  +    assert(exceptionCode == 0);
  +    spanElement->setAttribute(HTMLAttributes::classAttr(), AppleTabSpanClass);
  +    spanElement->setAttribute(HTMLAttributes::style(), "white-space:pre");
  +
  +    // add tab text to that span
  +    if (!tabTextNode)
  +        tabTextNode = document->createEditingTextNode("\t");
  +    spanElement->appendChild(tabTextNode, exceptionCode);
  +    assert(exceptionCode == 0);
  +
  +    return spanElement;
  +}
  +
  +ElementImpl *createTabSpanElement(DocumentImpl *document, QString *tabText)
  +{
  +    return createTabSpanElement(document, document->createTextNode(*tabText));
  +}
  +
   bool isNodeRendered(const NodeImpl *node)
   {
       if (!node)
  
  
  
  1.109     +8 -2      WebCore/khtml/editing/htmlediting.h
  
  Index: htmlediting.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/htmlediting.h,v
  retrieving revision 1.108
  retrieving revision 1.109
  diff -u -r1.108 -r1.109
  --- htmlediting.h	5 Jul 2005 23:21:08 -0000	1.108
  +++ htmlediting.h	29 Jul 2005 23:42:46 -0000	1.109
  @@ -58,15 +58,21 @@
   
   //------------------------------------------------------------------------------------------
   
  +bool isSpecialElement(const DOM::NodeImpl *n);
  +
   DOM::ElementImpl *createDefaultParagraphElement(DOM::DocumentImpl *document);
   DOM::ElementImpl *createBreakElement(DOM::DocumentImpl *document);
   
  +bool isTabSpanNode(const DOM::NodeImpl *node);
  +bool isTabSpanTextNode(const DOM::NodeImpl *node);
  +DOM::Position positionBeforeTabSpan(const DOM::Position& pos);
  +DOM::ElementImpl *createTabSpanElement(DOM::DocumentImpl *document, DOM::NodeImpl *tabTextNode=0);
  +DOM::ElementImpl *createTabSpanElement(DOM::DocumentImpl *document, QString *tabText);
  +
   bool isNodeRendered(const DOM::NodeImpl *);
   bool isMailBlockquote(const DOM::NodeImpl *);
   DOM::NodeImpl *nearestMailBlockquote(const DOM::NodeImpl *);
   
  -bool isSpecialElement(DOM::NodeImpl *n);
  -
   //------------------------------------------------------------------------------------------
   
   bool isTableStructureNode(const DOM::NodeImpl *node);
  
  
  
  1.5       +114 -63   WebCore/khtml/editing/insert_text_command.cpp
  
  Index: insert_text_command.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/insert_text_command.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- insert_text_command.cpp	5 Jul 2005 23:21:08 -0000	1.4
  +++ insert_text_command.cpp	29 Jul 2005 23:42:46 -0000	1.5
  @@ -27,6 +27,7 @@
   
   #include "khtml_part.h"
   #include "htmlediting.h"
  +#include "html_interchange.h"
   #include "visible_position.h"
   #include "visible_text.h"
   #include "visible_units.h"
  @@ -60,23 +61,10 @@
   {
   }
   
  -Position InsertTextCommand::prepareForTextInsertion(bool adjustDownstream)
  +Position InsertTextCommand::prepareForTextInsertion(const Position& pos)
   {
  -    // Prepare for text input by looking at the current position.
  +    // Prepare for text input by looking at the specified position.
       // It may be necessary to insert a text node to receive characters.
  -    Selection selection = endingSelection();
  -    ASSERT(selection.isCaret());
  -    
  -    Position pos = selection.start();
  -    if (adjustDownstream)
  -        pos = pos.downstream();
  -    else
  -        pos = pos.upstream();
  -    
  -    Selection typingStyleRange;
  -
  -    pos = positionOutsideContainingSpecialElement(pos);
  -
       if (!pos.node()->isTextNode()) {
           NodeImpl *textNode = document()->createEditingTextNode("");
           NodeImpl *nodeToInsert = textNode;
  @@ -97,14 +85,35 @@
           else
               ASSERT_NOT_REACHED();
           
  -        pos = Position(textNode, 0);
  +        return Position(textNode, 0);
  +    }
  +
  +    if (isTabSpanTextNode(pos.node())) {
  +        Position tempPos = pos;
  +//#ifndef COALESCE_TAB_SPANS
  +#if 0
  +        NodeImpl *node = pos.node()->parentNode();
  +        if (pos.offset() > pos.node()->caretMinOffset())
  +            tempPos = Position(node->parentNode(), node->nodeIndex() + 1);
  +        else
  +            tempPos = Position(node->parentNode(), node->nodeIndex());
  +#endif        
  +        NodeImpl *textNode = document()->createEditingTextNode("");
  +        NodeImpl *originalTabSpan = tempPos.node()->parent();
  +        if (tempPos.offset() <= tempPos.node()->caretMinOffset()) {
  +            insertNodeBefore(textNode, originalTabSpan);
  +        } else if (tempPos.offset() >= tempPos.node()->caretMaxOffset()) {
  +            insertNodeAfter(textNode, originalTabSpan);
  +        } else {
  +            splitTextNodeContainingElement(static_cast<TextImpl *>(tempPos.node()), tempPos.offset());
  +            insertNodeBefore(textNode, originalTabSpan);
  +        }
  +        return Position(textNode, 0);
       }
   
       return pos;
   }
   
  -static const int spacesPerTab = 4;
  -
   static inline bool isNBSP(const QChar &c)
   {
       return c.unicode() == 0xa0;
  @@ -125,59 +134,51 @@
       // out correctly after the insertion.
       selection = endingSelection();
       deleteInsignificantTextDownstream(selection.end().trailingWhitespacePosition(selection.endAffinity()));
  -    
  -    // Make sure the document is set up to receive text
  -    Position startPosition = prepareForTextInsertion(adjustDownstream);
  -    
  -    Position endPosition;
  -
  -    TextImpl *textNode = static_cast<TextImpl *>(startPosition.node());
  -    long offset = startPosition.offset();
   
  -    // Now that we are about to add content, check to see if a placeholder element
  -    // can be removed.
  -    removeBlockPlaceholder(textNode->enclosingBlockFlowElement());
  +    // Figure out the startPosition
  +    Position startPosition = selection.start();
  +    Position endPosition;
  +    if (adjustDownstream)
  +        startPosition = startPosition.downstream();
  +    else
  +        startPosition = startPosition.upstream();
  +    startPosition = positionOutsideContainingSpecialElement(startPosition);
       
  -    // These are temporary implementations for inserting adjoining spaces
  -    // into a document. We are working on a CSS-related whitespace solution
  -    // that will replace this some day. We hope.
       if (text == "\t") {
  -        // Treat a tab like a number of spaces. This seems to be the HTML editing convention,
  -        // although the number of spaces varies (we choose four spaces). 
  -        // Note that there is no attempt to make this work like a real tab stop, it is merely 
  -        // a set number of spaces. This also seems to be the HTML editing convention.
  -        for (int i = 0; i < spacesPerTab; i++) {
  +        endPosition = insertTab(startPosition);
  +        startPosition = endPosition.previous();
  +        removeBlockPlaceholder(startPosition.node()->enclosingBlockFlowElement());
  +        m_charactersAdded += 1;
  +    } else {
  +        // Make sure the document is set up to receive text
  +        startPosition = prepareForTextInsertion(startPosition);
  +        removeBlockPlaceholder(startPosition.node()->enclosingBlockFlowElement());
  +        TextImpl *textNode = static_cast<TextImpl *>(startPosition.node());
  +        long offset = startPosition.offset();
  +
  +        if (text == " ") {
               insertSpace(textNode, offset);
  +            endPosition = Position(textNode, offset + 1);
  +
  +            m_charactersAdded++;
               rebalanceWhitespace();
  -            document()->updateLayout();
           }
  -        
  -        endPosition = Position(textNode, offset + spacesPerTab);
  +        else {
  +            const DOMString &existingText = textNode->data();
  +            if (textNode->length() >= 2 && offset >= 2 && isNBSP(existingText[offset - 1]) && !isCollapsibleWhitespace(existingText[offset - 2])) {
  +                // DOM looks like this:
  +                // character nbsp caret
  +                // As we are about to insert a non-whitespace character at the caret
  +                // convert the nbsp to a regular space.
  +                // EDIT FIXME: This needs to be improved some day to convert back only
  +                // those nbsp's added by the editor to make rendering come out right.
  +                replaceTextInNode(textNode, offset - 1, 1, " ");
  +            }
  +            insertTextIntoNode(textNode, offset, text);
  +            endPosition = Position(textNode, offset + text.length());
   
  -        m_charactersAdded += spacesPerTab;
  -    }
  -    else if (text == " ") {
  -        insertSpace(textNode, offset);
  -        endPosition = Position(textNode, offset + 1);
  -
  -        m_charactersAdded++;
  -        rebalanceWhitespace();
  -    }
  -    else {
  -        const DOMString &existingText = textNode->data();
  -        if (textNode->length() >= 2 && offset >= 2 && isNBSP(existingText[offset - 1]) && !isCollapsibleWhitespace(existingText[offset - 2])) {
  -            // DOM looks like this:
  -            // character nbsp caret
  -            // As we are about to insert a non-whitespace character at the caret
  -            // convert the nbsp to a regular space.
  -            // EDIT FIXME: This needs to be improved some day to convert back only
  -            // those nbsp's added by the editor to make rendering come out right.
  -            replaceTextInNode(textNode, offset - 1, 1, " ");
  +            m_charactersAdded += text.length();
           }
  -        insertTextIntoNode(textNode, offset, text);
  -        endPosition = Position(textNode, offset + text.length());
  -
  -        m_charactersAdded += text.length();
       }
   
       setEndingSelection(Selection(startPosition, DOWNSTREAM, endPosition, SEL_DEFAULT_AFFINITY));
  @@ -193,6 +194,56 @@
           setEndingSelection(endingSelection().end(), endingSelection().endAffinity());
   }
   
  +DOM::Position InsertTextCommand::insertTab(Position pos)
  +{
  +    Position insertPos = VisiblePosition(pos, DOWNSTREAM).deepEquivalent();
  +    NodeImpl *node = insertPos.node();
  +    unsigned int offset = insertPos.offset();
  +
  +//#ifdef COALESCE_TAB_SPANS
  +#if 1
  +    // keep tabs coalesced in tab span
  +    if (isTabSpanTextNode(node)) {
  +        insertTextIntoNode(static_cast<TextImpl *>(node), offset, "\t");
  +        return Position(node, offset + 1);
  +    }
  +#else
  +    if (isTabSpanTextNode(node)) {
  +        node = node->parentNode();
  +        if (offset > (unsigned int) node->caretMinOffset())
  +            insertPos = Position(node->parentNode(), node->nodeIndex() + 1);
  +        else
  +            insertPos = Position(node->parentNode(), node->nodeIndex());
  +        node = insertPos.node();
  +        offset = insertPos.offset();
  +    }
  +#endif
  +    
  +    // create new tab span
  +    DOM::ElementImpl * spanNode = createTabSpanElement(document());
  +    
  +    // place it
  +    if (!node->isTextNode()) {
  +        insertNodeAt(spanNode, node, offset);
  +    } else {
  +        TextImpl *textNode = static_cast<TextImpl *>(node);
  +        if (offset >= textNode->length()) {
  +            insertNodeAfter(spanNode, textNode);
  +        } else {
  +            // split node to make room for the span
  +            // NOTE: splitTextNode uses textNode for the
  +            // second node in the split, so we need to
  +            // insert the span before it.
  +            if (offset > 0)
  +                splitTextNode(textNode, offset);
  +            insertNodeBefore(spanNode, textNode);
  +        }
  +    }
  +    
  +    // return the position following the new tab
  +    return Position(spanNode->lastChild(), spanNode->lastChild()->caretMaxOffset());
  +}
  +
   void InsertTextCommand::insertSpace(TextImpl *textNode, unsigned long offset)
   {
       ASSERT(textNode);
  
  
  
  1.4       +2 -1      WebCore/khtml/editing/insert_text_command.h
  
  Index: insert_text_command.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/insert_text_command.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- insert_text_command.h	5 Jul 2005 23:21:08 -0000	1.3
  +++ insert_text_command.h	29 Jul 2005 23:42:46 -0000	1.4
  @@ -45,8 +45,9 @@
   private:
       virtual bool isInsertTextCommand() const;
   
  -    DOM::Position prepareForTextInsertion(bool adjustDownstream);
  +    DOM::Position prepareForTextInsertion(const DOM::Position& pos);
       void insertSpace(DOM::TextImpl *textNode, unsigned long offset);
  +    DOM::Position insertTab(DOM::Position pos);
   
       unsigned long m_charactersAdded;
   };
  
  
  
  1.27      +48 -13    WebCore/khtml/editing/markup.cpp
  
  Index: markup.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/markup.cpp,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- markup.cpp	18 Jul 2005 21:52:21 -0000	1.26
  +++ markup.cpp	29 Jul 2005 23:42:46 -0000	1.27
  @@ -492,6 +492,53 @@
       return markup(node, includeChildren, false, nodes);
   }
   
  +static void createParagraphContentsFromString(DOM::DocumentImpl *document, ElementImpl *paragraph, const QString &string)
  +{
  +    int exceptionCode = 0;
  +    if (string.isEmpty()) {
  +        NodeImpl *placeHolder = createBlockPlaceholderElement(document);
  +        paragraph->appendChild(placeHolder, exceptionCode);
  +        ASSERT(exceptionCode == 0);
  +        return;
  +    }
  +
  +    assert(string.find('\n') == -1);
  +
  +    QStringList tabList = QStringList::split('\t', string, true);
  +    QString tabText = "";
  +    while (!tabList.isEmpty()) {
  +        QString s = tabList.first();
  +        tabList.pop_front();
  +
  +        // append the non-tab textual part
  +        if (!s.isEmpty()) {
  +            if (tabText != "") {
  +                paragraph->appendChild(createTabSpanElement(document, &tabText), exceptionCode);
  +                ASSERT(exceptionCode == 0);
  +                tabText = "";
  +            }
  +            NodeImpl *textNode = document->createTextNode(s);
  +            paragraph->appendChild(textNode, exceptionCode);
  +            ASSERT(exceptionCode == 0);
  +        }
  +
  +        // there is a tab after every entry, except the last entry
  +        // (if the last character is a tab, the list gets an extra empty entry)
  +        if (!tabList.isEmpty()) {
  +//#ifdef COALESCE_TAB_SPANS
  +#if 1
  +            tabText += '\t';
  +#else
  +            paragraph->appendChild(createTabSpanElement(document), exceptionCode);
  +            ASSERT(exceptionCode == 0);
  +#endif
  +        } else if (tabText != "") {
  +            paragraph->appendChild(createTabSpanElement(document, &tabText), exceptionCode);
  +            ASSERT(exceptionCode == 0);
  +        }
  +    }
  +}
  +
   DOM::DocumentFragmentImpl *createFragmentFromText(DOM::DocumentImpl *document, const QString &text)
   {
       if (!document)
  @@ -503,10 +550,6 @@
       if (!text.isEmpty()) {
           QString string = text;
   
  -        // Replace tabs with four plain spaces.
  -        // These spaces will get converted along with the other existing spaces below.
  -        string.replace('\t', "    ");
  -
           // FIXME: Wrap the NBSP's in a span that says "converted space".
           int offset = 0;
           int stringLength = string.length();
  @@ -552,16 +595,8 @@
                   element->setAttribute(HTMLAttributes::classAttr(), AppleInterchangeNewline);            
               } else {
                   element = createDefaultParagraphElement(document);
  -                NodeImpl *paragraphContents;
  -                if (s.isEmpty()) {
  -                    paragraphContents = createBlockPlaceholderElement(document);
  -                } else {
  -                    paragraphContents = document->createTextNode(s);
  -                    ASSERT(exceptionCode == 0);
  -                }
  +                createParagraphContentsFromString(document, element, s);
                   element->ref();
  -                element->appendChild(paragraphContents, exceptionCode);
  -                ASSERT(exceptionCode == 0);
               }
               fragment->appendChild(element, exceptionCode);
               ASSERT(exceptionCode == 0);
  
  
  
  1.8       +4 -2      WebCore/khtml/editing/replace_selection_command.cpp
  
  Index: replace_selection_command.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/editing/replace_selection_command.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- replace_selection_command.cpp	18 Jul 2005 21:52:21 -0000	1.7
  +++ replace_selection_command.cpp	29 Jul 2005 23:42:46 -0000	1.8
  @@ -479,7 +479,7 @@
   void ReplacementFragment::removeStyleNodes()
   {
       // Since style information has been computed and cached away in
  -    // computeStylesForNodes(), these style nodes can be removed, since
  +    // computeStylesUsingTestRendering(), these style nodes can be removed, since
       // the correct styles will be added back in fixupNodeStyles().
       NodeImpl *node = m_fragment->firstChild();
       while (node) {
  @@ -502,7 +502,9 @@
               isStyleSpan(node)) {
               removeNodePreservingChildren(node);
           }
  -        else if (node->isHTMLElement()) {
  +        // need to skip tab span because fixupNodeStyles() is not called
  +        // when replace is matching style
  +        else if (node->isHTMLElement() && !isTabSpanNode(node)) {
               HTMLElementImpl *elem = static_cast<HTMLElementImpl *>(node);
               CSSMutableStyleDeclarationImpl *inlineStyleDecl = elem->inlineStyleDecl();
               if (inlineStyleDecl) {
  
  
  
  1.102     +34 -74    WebCore/khtml/html/htmltokenizer.cpp
  
  Index: htmltokenizer.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/htmltokenizer.cpp,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- htmltokenizer.cpp	22 Jul 2005 21:34:11 -0000	1.101
  +++ htmltokenizer.cpp	29 Jul 2005 23:42:48 -0000	1.102
  @@ -328,8 +328,6 @@
       tag = NoTag;
       pending = NonePending;
       discard = NoneDiscard;
  -    pre = false;
  -    prePos = 0;
       plaintext = false;
       xmp = false;
       processingInstruction = false;
  @@ -366,16 +364,11 @@
   
   void HTMLTokenizer::processListing(TokenizerString list)
   {
  -    bool old_pre = pre;
       // This function adds the listing 'list' as
       // preformatted text-tokens to the token-collection
  -    // thereby converting TABs.
  -    if(!style) pre = true;
  -    prePos = 0;
  -
       while ( !list.isEmpty() )
       {
  -        checkBuffer(3*TAB_SIZE);
  +        checkBuffer();
   
           if (skipLF && ( *list != '\n' ))
           {
  @@ -408,14 +401,11 @@
               }
               ++list;
           }
  -        else if (( *list == ' ' ) || ( *list == '\t'))
  +        else if ( *list == ' ' )
           {
               if (pending)
                   addPending();
  -            if (*list == ' ')
  -                pending = SpacePending;
  -            else
  -                pending = TabPending;
  +            pending = SpacePending;
   
               ++list;
           }
  @@ -425,7 +415,6 @@
               if (pending)
                   addPending();
   
  -            prePos++;
               *dest++ = *list;
               ++list;
           }
  @@ -434,10 +423,6 @@
   
       if (pending)
           addPending();
  -
  -    prePos = 0;
  -
  -    pre = old_pre;
   }
   
   void HTMLTokenizer::parseSpecial(TokenizerString &src)
  @@ -504,7 +489,8 @@
           }
           else {
               scriptCode[scriptCodeSize] = *src;
  -            fixUpChar(scriptCode[scriptCodeSize]);
  +            if (src->unicode() >= 0x0080)
  +                fixUpChar(scriptCode[scriptCodeSize]);
               ++scriptCodeSize;
               ++src;
           }
  @@ -811,7 +797,8 @@
           }
           else {
               *dest = *src;
  -            fixUpChar(*dest);
  +            if (src->unicode() >= 0x0080)
  +                fixUpChar(*dest);
               ++dest;
               ++src;
           }
  @@ -939,7 +926,8 @@
   
                   if (EntityUnicodeValue <= 0xFFFF) {
                       QChar c(EntityUnicodeValue);
  -                    fixUpChar(c);
  +                    if (c.unicode() >= 0x0080)
  +                        fixUpChar(c);
                       checkBuffer();
                       src.push(c);
                   } else {
  @@ -961,8 +949,6 @@
                   for(unsigned int i = 0; i < cBufferPos; i++)
                       dest[i] = cBuffer[i];
                   dest += cBufferPos;
  -                if (pre)
  -                    prePos += cBufferPos+1;
               }
   
               Entity = NoEntity;
  @@ -1118,22 +1104,20 @@
   
               while(ll--) {
                   curchar = *src;
  -                if(curchar <= '>') {
  -                    if(curchar <= ' ' || curchar == '=' || curchar == '>') {
  -                        cBuffer[cBufferPos] = '\0';
  -                        attrName = AtomicString(cBuffer);
  -                        dest = buffer;
  -                        *dest++ = 0;
  -                        tag = SearchEqual;
  -                        // This is a deliberate quirk to match Mozilla and Opera.  We have to do this
  -                        // since sites that use the "standards-compliant" path sometimes send
  -                        // <script src="foo.js"/>.  Both Moz and Opera will honor this, despite it
  -                        // being bogus HTML.  They do not honor the "/" for other tags.  This behavior
  -                        // also deviates from WinIE, but in this case we'll just copy Moz and Opera.
  -                        if (currToken.tagName == HTMLTags::script() && curchar == '>' && attrName == "/")
  -                            currToken.flat = true;
  -                        break;
  -                    }
  +                if (curchar <= '>' && (curchar >= '=' || curchar <= ' ')) {
  +                    cBuffer[cBufferPos] = '\0';
  +                    attrName = AtomicString(cBuffer);
  +                    dest = buffer;
  +                    *dest++ = 0;
  +                    tag = SearchEqual;
  +                    // This is a deliberate quirk to match Mozilla and Opera.  We have to do this
  +                    // since sites that use the "standards-compliant" path sometimes send
  +                    // <script src="foo.js"/>.  Both Moz and Opera will honor this, despite it
  +                    // being bogus HTML.  They do not honor the "/" for other tags.  This behavior
  +                    // also deviates from WinIE, but in this case we'll just copy Moz and Opera.
  +                    if (currToken.tagName == HTMLTags::script() && curchar == '>' && attrName == "/")
  +                        currToken.flat = true;
  +                    break;
                   }
                   
                   // tolower() shows up on profiles. This is faster!
  @@ -1257,7 +1241,8 @@
                       }
                   }
                   *dest = *src;
  -                fixUpChar(*dest);
  +                if (dest->unicode() >= 0x0080)
  +                    fixUpChar(*dest);
                   ++dest;
                   ++src;
               }
  @@ -1293,7 +1278,8 @@
                   }
   
                   *dest = *src;
  -                fixUpChar(*dest);
  +                if (dest->unicode() >= 0x0080)
  +                    fixUpChar(*dest);
                   ++dest;
                   ++src;
               }
  @@ -1410,8 +1396,6 @@
               processToken();
   
               if (tagName == HTMLTags::pre()) {
  -                prePos = 0;
  -                pre = beginTag;
                   discard = LFDiscard; // Discard the first LF after we open a pre.
               } else if (tagName == HTMLTags::script()) {
                   if (beginTag) {
  @@ -1471,40 +1455,24 @@
       else if ( textarea || script )
       {
           switch(pending) {
  -        case LFPending:  *dest++ = '\n'; prePos = 0; break;
  -        case SpacePending: *dest++ = ' '; ++prePos; break;
  -        case TabPending: *dest++ = '\t'; prePos += TAB_SIZE - (prePos % TAB_SIZE); break;
  +        case LFPending:  *dest++ = '\n'; break;
  +        case SpacePending: *dest++ = ' '; break;
           case NonePending:
               assert(0);
           }
       }
       else
       {
  -        int p;
  -
           switch (pending)
           {
           case SpacePending:
               // Insert a breaking space
               *dest++ = QChar(' ');
  -            prePos++;
               break;
   
           case LFPending:
               *dest = '\n';
               dest++;
  -            prePos = 0;
  -            break;
  -
  -        case TabPending:
  -            p = TAB_SIZE - ( prePos % TAB_SIZE );
  -#ifdef TOKEN_DEBUG
  -            qDebug("tab pending, prePos: %d, toadd: %d", prePos, p);
  -#endif
  -
  -            for ( int x = 0; x < p; x++ )
  -                *dest++ = QChar(' ');
  -            prePos += p;
               break;
   
           case NonePending:
  @@ -1660,9 +1628,7 @@
               }; // end case
   
               if ( pending ) {
  -                // pre context always gets its spaces/linefeeds
  -                if ( pre || script || (!parser->selectMode() &&
  -                             (!parser->noSpaces() || dest > buffer )))
  +                if ( script || (!parser->selectMode() && (!parser->noSpaces() || dest > buffer )))
                       addPending();
                   // just forget it
                   else
  @@ -1732,7 +1698,7 @@
               }
               ++src;
           }
  -        else if (( cc == ' ' ) || ( cc == '\t' ))
  +        else if (cc == ' ')
           {
   	    if (select && !script) {
                   if(discard == SpaceDiscard)
  @@ -1749,10 +1715,7 @@
               
                   if (pending)
                       addPending();
  -                if (cc == ' ')
  -                    pending = SpacePending;
  -                else
  -                    pending = TabPending;
  +                pending = SpacePending;
               }
               
               ++src;
  @@ -1763,17 +1726,14 @@
                   addPending();
   
               discard = NoneDiscard;
  -            if ( pre )
  -            {
  -                prePos++;
  -            }
   #if QT_VERSION < 300
               unsigned char row = src->row();
               if ( row > 0x05 && row < 0x10 || row > 0xfd )
                       currToken.complexText = true;
   #endif
               *dest = *src;
  -            fixUpChar( *dest );
  +            if (dest->unicode() >= 0x0080)
  +                fixUpChar( *dest );
               ++dest;
               ++src;
           }
  
  
  
  1.39      +0 -10     WebCore/khtml/html/htmltokenizer.h
  
  Index: htmltokenizer.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/html/htmltokenizer.h,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- htmltokenizer.h	18 Jul 2005 21:44:21 -0000	1.38
  +++ htmltokenizer.h	29 Jul 2005 23:42:48 -0000	1.39
  @@ -110,9 +110,6 @@
       bool flat : 1;
   };
   
  -// The count of spaces used for each tab.
  -#define TAB_SIZE 8
  -
   //-----------------------------------------------------------------------------
   
   class HTMLTokenizer : public Tokenizer, public CachedObjectClient
  @@ -201,7 +198,6 @@
           NonePending = 0,
           SpacePending,
           LFPending,
  -        TabPending
       } pending;
   
       // Discard line breaks immediately after start-tags
  @@ -249,12 +245,6 @@
       // are we in a <script> ... </script block
       bool script;
   
  -    // Are we in a <pre> ... </pre> block
  -    bool pre;
  -
  -    // if 'pre == true' we track in which column we are
  -    int prePos;
  -
       // Are we in a <style> ... </style> block
       bool style;
   
  
  
  
  1.136     +40 -22    WebCore/khtml/rendering/bidi.cpp
  
  Index: bidi.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/bidi.cpp,v
  retrieving revision 1.135
  retrieving revision 1.136
  diff -u -r1.135 -r1.136
  --- bidi.cpp	19 Jul 2005 21:18:02 -0000	1.135
  +++ bidi.cpp	29 Jul 2005 23:42:48 -0000	1.136
  @@ -385,7 +385,7 @@
           if (text->text()) {
               for (int i = bidiRun->start; i < bidiRun->stop; i++) {
                   const QChar c = text->text()[i];
  -                if (c == ' ' || c == '\n')
  +                if (c == ' ' || c == '\n' || c == '\t')
                       numSpaces++;
               }
           }
  @@ -714,6 +714,23 @@
       return lastRootBox();
   }
   
  +// usage: tw - (xpos % tw);
  +int RenderBlock::tabWidth(bool isWhitespacePre)
  +{
  +    if (!isWhitespacePre)
  +        return 0;
  +
  +    if (!m_tabWidth) {
  +        QChar   spaceChar(' ');
  +        const Font& font = style()->htmlFont();
  +        int spaceWidth = font.width(&spaceChar, 1, 0, 0);
  +        m_tabWidth = spaceWidth * 8;
  +        assert(m_tabWidth != 0);
  +    }
  +
  +    return m_tabWidth;
  +}
  +
   void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, BidiState &bidi)
   {
       // First determine our total width.
  @@ -725,7 +742,7 @@
               continue; // Positioned objects are only participating to figure out their
                         // correct static x position.  They have no effect on the width.
           if (r->obj->isText()) {
  -            int textWidth = static_cast<RenderText *>(r->obj)->width(r->start, r->stop-r->start, m_firstLine);
  +            int textWidth = static_cast<RenderText *>(r->obj)->width(r->start, r->stop-r->start, totWidth, m_firstLine);
               if (!r->compact) {
                   RenderStyle *style = r->obj->style();
                   if (style->whiteSpace() == NORMAL && style->khtmlLineBreak() == AFTER_WHITE_SPACE) {
  @@ -797,7 +814,7 @@
                   int spaces = 0;
                   for ( int i = r->start; i < r->stop; i++ ) {
                       const QChar c = static_cast<RenderText *>(r->obj)->text()[i];
  -                    if (c == ' ' || c == '\n')
  +                    if (c == ' ' || c == '\n' || c == '\t')
                           spaces++;
                   }
   
  @@ -1573,9 +1590,10 @@
                   
                   // Now apply the offset to each line if needed.
                   int delta = m_height - endLineYPos;
  -                if (delta)
  +                if (delta) {
                       for (RootInlineBox* line = endLine; line; line = line->nextRootBox())
                           line->adjustPosition(0, delta);
  +                }
                   m_height = lastRootBox()->blockHeight();
                   m_overflowHeight = kMax(m_height, m_overflowHeight);
                   int bottomOfLine = lastRootBox()->bottomOverflow();
  @@ -1796,7 +1814,7 @@
       // object iteration process.
       int w = lineWidth(m_height);
       while (!it.atEnd() && (it.obj->isInlineFlow() || (it.obj->style()->whiteSpace() != PRE && !it.obj->isBR() &&
  -          (it.current() == ' ' || it.current() == '\n' || 
  +          (it.current() == ' ' || it.current() == '\t' || it.current() == '\n' || 
              skipNonBreakingSpace(it) || it.obj->isFloatingOrPositioned())))) {
           if (it.obj->isFloatingOrPositioned()) {
               RenderObject *o = it.obj;
  @@ -2006,12 +2024,12 @@
                   // item, then this is all moot. -dwh
                   RenderObject* next = Bidinext( start.par, o, bidi );
                   if (!m_pre && next && next->isText() && static_cast<RenderText*>(next)->stringLength() > 0) {
  -                    if (static_cast<RenderText*>(next)->text()[0].unicode() == nonBreakingSpace &&
  -                        o->style()->whiteSpace() == NORMAL && o->style()->nbspMode() == SPACE) {
  -                        currentCharacterIsWS = true;
  -                    }
  -                    if (static_cast<RenderText*>(next)->text()[0].unicode() == ' ' ||
  -                        static_cast<RenderText*>(next)->text()[0] == '\n') {
  +                    RenderText *nextText = static_cast<RenderText*>(next);
  +                    QChar nextChar = nextText->text()[0];
  +
  +                    if (nextText->style()->whiteSpace() != PRE && 
  +                        (nextChar == ' ' || nextChar == '\n' || nextChar == '\t' ||
  +                        nextChar.unicode() == nonBreakingSpace && next->style()->nbspMode() == SPACE)) {
                           currentCharacterIsSpace = true;
                           currentCharacterIsWS = true;
                           ignoringSpaces = true;
  @@ -2042,7 +2060,7 @@
                   bool previousCharacterIsSpace = currentCharacterIsSpace;
                   bool previousCharacterIsWS = currentCharacterIsWS;
                   const QChar c = str[pos];
  -                currentCharacterIsSpace = c == ' ' || (!isPre && c == '\n');
  +                currentCharacterIsSpace = c == ' ' || (!isPre && (c == '\n' || c == '\t'));
                   
                   if (isPre || !currentCharacterIsSpace)
                       isLineEmpty = false;
  @@ -2055,12 +2073,12 @@
                           addMidpoint(endMid);
                           
                           // Add the width up to but not including the hyphen.
  -                        tmpW += t->width(lastSpace, pos - lastSpace, f);
  +                        tmpW += t->width(lastSpace, pos - lastSpace, f, w+tmpW);
                           
                           // For whitespace normal only, include the hyphen.  We need to ensure it will fit
                           // on the line if it shows when we break.
                           if (o->style()->whiteSpace() == NORMAL)
  -                            tmpW += t->width(pos, 1, f);
  +                            tmpW += t->width(pos, 1, f, w+tmpW);
                           
                           BidiIterator startMid(0, o, pos+1);
                           addMidpoint(startMid);
  @@ -2080,8 +2098,8 @@
                   currentCharacterIsWS = currentCharacterIsSpace || (breakNBSP && c.unicode() == nonBreakingSpace);
   
                   if (breakWords)
  -                    wrapW += t->width(pos, 1, f);
  -                if ((isPre && c == '\n') || (!isPre && isBreakable(str, pos, strlen, breakNBSP)) || (breakWords && wrapW > width)) {
  +                    wrapW += t->width(pos, 1, f, w+wrapW);
  +                if (c == '\n' || (!isPre && isBreakable(str, pos, strlen, breakNBSP)) || (breakWords && wrapW > width)) {
                       if (ignoringSpaces) {
                           if (!currentCharacterIsSpace) {
                               // Stop ignoring spaces and begin at this
  @@ -2098,7 +2116,7 @@
                           }
                       }
   
  -                    tmpW += t->width(lastSpace, pos - lastSpace, f);
  +                    tmpW += t->width(lastSpace, pos - lastSpace, f, w+tmpW);
                       if (!appliedStartWidth) {
                           tmpW += inlineWidth(o, true, false);
                           appliedStartWidth = true;
  @@ -2134,7 +2152,7 @@
                       if (o->style()->whiteSpace() == NORMAL) {
                           // In AFTER_WHITE_SPACE mode, consider the current character
                           // as candidate width for this line.
  -                        int charWidth = o->style()->khtmlLineBreak() == AFTER_WHITE_SPACE ? t->width(pos, 1, f) : 0;
  +                        int charWidth = o->style()->khtmlLineBreak() == AFTER_WHITE_SPACE ? t->width(pos, 1, f, w+tmpW) : 0;
                           if (w + tmpW + charWidth > width) {
                               if (o->style()->khtmlLineBreak() == AFTER_WHITE_SPACE) {
                                   // Check if line is too big even without the extra space
  @@ -2152,7 +2170,7 @@
                           }
                           else if (pos > 1 && str[pos-1].unicode() == SOFT_HYPHEN)
                               // Subtract the width of the soft hyphen out since we fit on a line.
  -                            tmpW -= t->width(pos-1, 1, f);
  +                            tmpW -= t->width(pos-1, 1, f, w+tmpW);
                       }
   
                       if( *(str+pos) == '\n' && isPre) {
  @@ -2224,7 +2242,7 @@
               
               // IMPORTANT: pos is > length here!
               if (!ignoringSpaces)
  -                tmpW += t->width(lastSpace, pos - lastSpace, f);
  +                tmpW += t->width(lastSpace, pos - lastSpace, f, w+tmpW);
               if (!appliedStartWidth)
                   tmpW += inlineWidth(o, true, false);
               if (!appliedEndWidth)
  @@ -2428,8 +2446,8 @@
       static AtomicString ellipsisStr(ellipsis);
       const Font& firstLineFont = style(true)->htmlFont();
       const Font& font = style()->htmlFont();
  -    int firstLineEllipsisWidth = firstLineFont.width(&ellipsis, 1, 0);
  -    int ellipsisWidth = (font == firstLineFont) ? firstLineEllipsisWidth : font.width(&ellipsis, 1, 0);
  +    int firstLineEllipsisWidth = firstLineFont.width(&ellipsis, 1, 0, 0);
  +    int ellipsisWidth = (font == firstLineFont) ? firstLineEllipsisWidth : font.width(&ellipsis, 1, 0, 0);
   
       // For LTR text truncation, we want to get the right edge of our padding box, and then we want to see
       // if the right edge of a line box exceeds that.  For RTL, we use the left edge of the padding box and
  
  
  
  1.21      +2 -2      WebCore/khtml/rendering/break_lines.cpp
  
  Index: break_lines.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/break_lines.cpp,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- break_lines.cpp	9 Jul 2005 20:19:17 -0000	1.20
  +++ break_lines.cpp	29 Jul 2005 23:42:48 -0000	1.21
  @@ -73,7 +73,7 @@
   	else // no asian font
   	    return c->isSpace();
       } else {
  -	if ( ch == ' ' || ch == '\n' )
  +	if ( ch == ' ' || ch == '\t' || ch == '\n' )
   	    return true;
       }
       return false;
  @@ -89,7 +89,7 @@
       // at the moment whether this behavior is correct or not.  Since Tiger is also not allowing breaks on spaces
       // after hyphen-like characters, this does not seem ideal for the Web.  Therefore for now we override space
       // characters up front and bypass the Unicode line breaking routines.
  -    if (ch == '\n' || ch == ' ' || (breakNBSP && ch == 0xa0))
  +    if (ch == ' ' || ch == '\n' || ch == '\t' || (breakNBSP && ch == 0xa0))
           return true;
   
       // If current character, or the previous character aren't simple latin1 then
  
  
  
  1.42      +18 -18    WebCore/khtml/rendering/font.cpp
  
  Index: font.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/font.cpp,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- font.cpp	5 Jul 2005 23:21:11 -0000	1.41
  +++ font.cpp	29 Jul 2005 23:42:48 -0000	1.42
  @@ -40,20 +40,20 @@
   using namespace khtml;
   
   #if APPLE_CHANGES
  -void Font::drawHighlightForText( QPainter *p, int x, int y, int h, 
  +void Font::drawHighlightForText( QPainter *p, int x, int y, int h, int tabWidth, int xpos, 
                        QChar *str, int slen, int pos, int len,
                        int toAdd, QPainter::TextDirection d, bool visuallyOrdered, int from, int to, QColor bg) const
   {
  -    p->drawHighlightForText(x, y, h, str + pos, std::min(slen - pos, len), from, to, toAdd, bg, d, visuallyOrdered,
  +    p->drawHighlightForText(x, y, h, tabWidth, xpos, str + pos, std::min(slen - pos, len), from, to, toAdd, bg, d, visuallyOrdered,
                   letterSpacing, wordSpacing, fontDef.smallCaps);
   }
   #endif
                        
  -void Font::drawText( QPainter *p, int x, int y, QChar *str, int slen, int pos, int len,
  +void Font::drawText( QPainter *p, int x, int y, int tabWidth, int xpos, QChar *str, int slen, int pos, int len,
                        int toAdd, QPainter::TextDirection d, bool visuallyOrdered, int from, int to, QColor bg ) const
   {
   #if APPLE_CHANGES
  -    p->drawText(x, y, str + pos, std::min(slen - pos, len), from, to, toAdd, bg, d, visuallyOrdered,
  +    p->drawText(x, y, tabWidth, xpos, str + pos, std::min(slen - pos, len), from, to, toAdd, bg, d, visuallyOrdered,
                   letterSpacing, wordSpacing, fontDef.smallCaps);
   #else
       QString qstr = QConstString(str, slen).string();
  @@ -72,7 +72,7 @@
       // ### fixme for RTL
       if ( !letterSpacing && !wordSpacing && !toAdd && from==-1 ) {
           // simply draw it
  -        p->drawText( x, y, qstr, pos, len, d );
  +        p->drawText( x, y, tabWidth, xpos, qstr, pos, len, d );
       } else {
           int numSpaces = 0;
           if ( toAdd ) {
  @@ -104,7 +104,7 @@
                   if ( bg.isValid() )
                       p->fillRect( x, y-fm.ascent(), chw, fm.height(), bg );
   
  -                p->drawText( x, y, qstr, pos+i, 1, d );
  +                p->drawText( x, y, tabWidth, xpos, qstr, pos+i, 1, d );
               }
               if ( d != QPainter::RTL )
                   x += chw;
  @@ -115,31 +115,31 @@
   
   #if APPLE_CHANGES
   
  -float Font::floatWidth( QChar *chs, int slen, int pos, int len ) const
  +float Font::floatWidth( QChar *chs, int slen, int pos, int len, int tabWidth, int xpos ) const
   {
  -    return fm.floatWidth(chs, slen, pos, len, letterSpacing, wordSpacing, fontDef.smallCaps);
  +    return fm.floatWidth(chs, slen, pos, len, tabWidth, xpos, letterSpacing, wordSpacing, fontDef.smallCaps);
   }
   
   
  -void Font::floatCharacterWidths( QChar *str, int slen, int pos, int len, int toAdd, float *buffer) const
  +void Font::floatCharacterWidths( QChar *str, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, float *buffer) const
   {
  -    fm.floatCharacterWidths(str, slen, pos, len, toAdd, buffer, letterSpacing, wordSpacing, fontDef.smallCaps);
  +    fm.floatCharacterWidths(str, slen, pos, len, toAdd, tabWidth, xpos, buffer, letterSpacing, wordSpacing, fontDef.smallCaps);
   }
   
  -int Font::checkSelectionPoint (QChar *s, int slen, int pos, int len, int toAdd, int x, bool reversed, bool includePartialGlyphs) const
  +int Font::checkSelectionPoint (QChar *s, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, int x, bool reversed, bool includePartialGlyphs) const
   {
  -    return fm.checkSelectionPoint (s, slen, pos, len, toAdd, letterSpacing, wordSpacing, fontDef.smallCaps, x, reversed, includePartialGlyphs);
  +    return fm.checkSelectionPoint (s, slen, pos, len, toAdd, tabWidth, xpos, letterSpacing, wordSpacing, fontDef.smallCaps, x, reversed, includePartialGlyphs);
   }
   
   #endif
   
  -int Font::width( QChar *chs, int slen, int pos, int len ) const
  +int Font::width( QChar *chs, int slen, int pos, int len, int tabWidth, int xpos ) const
   {
   #if APPLE_CHANGES
   #ifndef ROUND_TO_INT
   #define ROUND_TO_INT(x) (unsigned int)((x)+.5)
   #endif
  -    return ROUND_TO_INT(fm.floatWidth(chs+pos, slen-pos, 0, len, letterSpacing, wordSpacing, fontDef.smallCaps));
  +    return ROUND_TO_INT(fm.floatWidth(chs+pos, slen-pos, 0, len, tabWidth, xpos, letterSpacing, wordSpacing, fontDef.smallCaps));
   //    return fm.width(chs + pos, len);
   #else
       QString qstr = QConstString(chs+pos, len).string();
  @@ -170,11 +170,11 @@
   #endif
   }
   
  -int Font::width( QChar *chs, int slen, int pos ) const
  +int Font::width( QChar *chs, int slen, int tabWidth, int xpos ) const
   {
   #if APPLE_CHANGES
  -//    return ROUND_TO_INT(fm.floatWidth(chs, slen, pos, 1, letterSpacing, wordSpacing));
  -    return width(chs, slen, pos, 1);
  +//    return ROUND_TO_INT(fm.floatWidth(chs, slen, pos, 1, tabWidth, xpos, letterSpacing, wordSpacing));
  +    return width(chs, slen, 0, 1, tabWidth, xpos);
   #else
       int w;
       if ( !fontDef.hasNbsp && (chs+pos)->unicode() == 0xa0 )
  @@ -186,7 +186,7 @@
   	w += letterSpacing;
   
       if ( wordSpacing && (chs+pos)->isSpace() )
  -		w += wordSpacing;
  +        w += wordSpacing;
       return w;
   #endif
   }
  
  
  
  1.32      +8 -8      WebCore/khtml/rendering/font.h
  
  Index: font.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/font.h,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- font.h	5 Jul 2005 23:21:11 -0000	1.31
  +++ font.h	29 Jul 2005 23:42:49 -0000	1.32
  @@ -120,22 +120,22 @@
   
                      
   #if !APPLE_CHANGES
  -    void drawText( QPainter *p, int x, int y, QChar *str, int slen, int pos, int len, int width,
  +    void drawText( QPainter *p, int x, int y, int tabWidth, int xpos, QChar *str, int slen, int pos, int len, int width,
                      QPainter::TextDirection d, int from=-1, int to=-1, QColor bg=QColor() ) const;
   
   #else
  -    void drawText( QPainter *p, int x, int y, QChar *str, int slen, int pos, int len, int width,
  +    void drawText( QPainter *p, int x, int y, int tabWidth, int xpos, QChar *str, int slen, int pos, int len, int width,
                      QPainter::TextDirection d, bool visuallyOrdered = false, int from=-1, int to=-1, QColor bg=QColor() ) const;
  -    float floatWidth( QChar *str, int slen, int pos, int len ) const;
  -    void floatCharacterWidths( QChar *str, int slen, int pos, int len, int toAdd, float *buffer) const;
  +    float floatWidth( QChar *str, int slen, int pos, int len, int tabWidth, int xpos ) const;
  +    void floatCharacterWidths( QChar *str, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, float *buffer) const;
       bool isFixedPitch() const;
  -    int checkSelectionPoint (QChar *s, int slen, int pos, int len, int toAdd, int x, bool reversed, bool includePartialGlyphs) const;
  -    void drawHighlightForText( QPainter *p, int x, int y, int h, 
  +    int checkSelectionPoint (QChar *s, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, int x, bool reversed, bool includePartialGlyphs) const;
  +    void drawHighlightForText( QPainter *p, int x, int y, int h, int tabWidth, int xpos, 
                      QChar *str, int slen, int pos, int len, int width,
                      QPainter::TextDirection d, bool visuallyOrdered = false, int from=-1, int to=-1, QColor bg=QColor()) const;
   #endif
  -    int width( QChar *str, int slen, int pos, int len ) const;
  -    int width( QChar *str, int slen, int pos ) const;
  +    int width( QChar *str, int slen, int pos, int len, int tabWidth, int xpos ) const;
  +    int width( QChar *str, int slen, int tabWidth, int xpos ) const;
   
       bool isSmallCaps() const { return fontDef.smallCaps; }
       
  
  
  
  1.194     +5 -3      WebCore/khtml/rendering/render_block.cpp
  
  Index: render_block.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_block.cpp,v
  retrieving revision 1.193
  retrieving revision 1.194
  diff -u -r1.193 -r1.194
  --- render_block.cpp	27 Jul 2005 01:53:16 -0000	1.193
  +++ render_block.cpp	29 Jul 2005 23:42:49 -0000	1.194
  @@ -97,6 +97,7 @@
       m_topMarginQuirk = m_bottomMarginQuirk = false;
       m_overflowHeight = m_overflowWidth = 0;
       m_overflowLeft = m_overflowTop = 0;
  +    m_tabWidth = 0;
   }
   
   RenderBlock::~RenderBlock()
  @@ -131,6 +132,7 @@
       }
   
       m_lineHeight = -1;
  +    m_tabWidth = 0;
   
       // Update pseudos for :before and :after now.
       RenderObject* first = firstChild();
  @@ -2799,7 +2801,7 @@
           RenderText* t = static_cast<RenderText *>(trailingSpaceChild);
           const Font *f = t->htmlFont( false );
           QChar space[1]; space[0] = ' ';
  -        int spaceWidth = f->width(space, 1, 0);
  +        int spaceWidth = f->width(space, 1, 0, 0);
           inlineMax -= spaceWidth;
           if (inlineMin > inlineMax)
               inlineMin = inlineMax;
  @@ -2962,8 +2964,8 @@
                   int beginMin, endMin;
                   bool beginWS, endWS;
                   int beginMax, endMax;
  -                t->trimmedMinMaxWidth(beginMin, beginWS, endMin, endWS, hasBreakableChar,
  -                                      hasBreak, beginMax, endMax,
  +                t->trimmedMinMaxWidth(inlineMax, beginMin, beginWS, endMin, endWS,
  +                                      hasBreakableChar, hasBreak, beginMax, endMax,
                                         childMin, childMax, stripFrontSpaces);
   
                   // This text object is insignificant and will not be rendered.  Just
  
  
  
  1.68      +4 -1      WebCore/khtml/rendering/render_block.h
  
  Index: render_block.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_block.h,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- render_block.h	5 Jul 2005 23:21:11 -0000	1.67
  +++ render_block.h	29 Jul 2005 23:42:49 -0000	1.68
  @@ -131,6 +131,7 @@
       BidiIterator findNextLineBreak(BidiIterator &start, BidiState &info );
       RootInlineBox* constructLine(const BidiIterator& start, const BidiIterator& end);
       InlineFlowBox* createLineBoxes(RenderObject* obj);
  +    int tabWidth(bool isWhitespacePre);
       void computeHorizontalPositionsForLine(RootInlineBox* lineBox, BidiState &bidi);
       void computeVerticalPositionsForLine(RootInlineBox* lineBox);
       void checkLinesForOverflow();
  @@ -425,9 +426,11 @@
       // when dirty rect checking and hit testing.
       int m_overflowLeft;
       int m_overflowTop;
  +    
  +    // full width of a tab character
  +    int m_tabWidth;
   };
   
   }; // namespace
   
   #endif // RENDER_BLOCK_H
  -
  
  
  
  1.31      +2 -2      WebCore/khtml/rendering/render_br.h
  
  Index: render_br.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_br.h,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- render_br.h	5 Jul 2005 23:21:11 -0000	1.30
  +++ render_br.h	29 Jul 2005 23:42:49 -0000	1.31
  @@ -44,8 +44,8 @@
    
       virtual QRect selectionRect() { return QRect(); }
   
  -    virtual unsigned int width(unsigned int, unsigned int, const Font *) const { return 0; }
  -    virtual unsigned int width( unsigned int, unsigned int, bool) const { return 0; }
  +    virtual unsigned int width(unsigned int from, unsigned int len, const Font *f, int xpos) const { return 0; }
  +    virtual unsigned int width(unsigned int from, unsigned int len, int xpos, bool firstLine = false) const { return 0; }
   
       virtual short lineHeight(bool firstLine, bool isRootLineBox=false) const;
       virtual short baselinePosition( bool firstLine, bool isRootLineBox=false) const;
  
  
  
  1.25      +1 -1      WebCore/khtml/rendering/render_flexbox.cpp
  
  Index: render_flexbox.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_flexbox.cpp,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- render_flexbox.cpp	5 Jul 2005 23:21:11 -0000	1.24
  +++ render_flexbox.cpp	29 Jul 2005 23:42:49 -0000	1.25
  @@ -755,7 +755,7 @@
                   const unsigned short ellipsisAndSpace[2] = { 0x2026, ' ' };
                   static AtomicString ellipsisAndSpaceStr(ellipsisAndSpace, 2);
                   const Font& font = style(numVisibleLines == 1)->htmlFont();
  -                int ellipsisAndSpaceWidth = font.width(const_cast<QChar*>(ellipsisAndSpaceStr.unicode()), 2, 0, 2);
  +                int ellipsisAndSpaceWidth = font.width(const_cast<QChar*>(ellipsisAndSpaceStr.unicode()), 2, 0, 2, 0, 0);
   
                   // Get ellipsis width + " " + anchor width
                   int totalWidth = ellipsisAndSpaceWidth + anchorBox->width();
  
  
  
  1.83      +6 -7      WebCore/khtml/rendering/render_image.cpp
  
  Index: render_image.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_image.cpp,v
  retrieving revision 1.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- render_image.cpp	27 Jul 2005 01:53:16 -0000	1.82
  +++ render_image.cpp	29 Jul 2005 23:42:50 -0000	1.83
  @@ -116,7 +116,7 @@
           // we have an alt and the user meant it (its not a text we invented)
           if (!alt.isEmpty()) {
               const QFontMetrics &fm = style()->fontMetrics();
  -            QRect br = fm.boundingRect (  0, 0, 1024, 256, Qt::AlignAuto|Qt::WordBreak, alt.string() );
  +            QRect br = fm.boundingRect (  0, 0, 1024, 256, Qt::AlignAuto|Qt::WordBreak, alt.string(), 0, 0);  // FIX: correct tabwidth?
               if ( br.width() > iw )
                   iw = br.width();
               if ( br.height() > ih )
  @@ -312,13 +312,12 @@
                   
                   // Only draw the alt text if it'll fit within the content box,
                   // and only if it fits above the error image.
  -                int textWidth = fm.width (text, text.length());
  +                int textWidth = fm.width (text, 0, 0, text.length());
                   if (errorPictureDrawn) {
                       if (usableWidth >= textWidth && fm.height() <= imageY)
  -                        p->drawText(ax, ay+ascent, 0 /* ignored */, 0 /* ignored */, Qt::WordBreak  /* not supported */, text );
  -                }
  -                else if (usableWidth >= textWidth && cHeight >= fm.height())
  -                    p->drawText(ax, ay+ascent, 0 /* ignored */, 0 /* ignored */, Qt::WordBreak  /* not supported */, text );
  +                        p->drawText(ax, ay+ascent, tabWidth(), 0, 0 /* ignored */, 0 /* ignored */, Qt::WordBreak  /* not supported */, text );
  +                } else if (usableWidth >= textWidth && cHeight >= fm.height())
  +                    p->drawText(ax, ay+ascent, tabWidth(), 0, 0 /* ignored */, 0 /* ignored */, Qt::WordBreak  /* not supported */, text );
               }
   #else /* not APPLE_CHANGES */
               if ( !berrorPic ) {
  @@ -341,7 +340,7 @@
                   int ay = _ty + topBorder + topPad + 2;
                   const QFontMetrics &fm = style()->fontMetrics();
                   if (cWidth>5 && cHeight>=fm.height())
  -                    p->drawText(ax, ay+1, cWidth - 4, cHeight - 4, Qt::WordBreak, text );
  +                    p->drawText(ax, ay+1, tabWidth(), 0, cWidth - 4, cHeight - 4, Qt::WordBreak, text );
               }
   #endif /* APPLE_CHANGES not defined */
           }
  
  
  
  1.45      +1 -0      WebCore/khtml/rendering/render_line.cpp
  
  Index: render_line.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_line.cpp,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- render_line.cpp	9 Jul 2005 20:19:17 -0000	1.44
  +++ render_line.cpp	29 Jul 2005 23:42:50 -0000	1.45
  @@ -1041,6 +1041,7 @@
       const DOMString& str = m_str.string();
       font->drawText(p, m_x + _tx, 
                         m_y + _ty + m_baseline,
  +                      0, 0,
                         (str.implementation())->s,
                         str.length(), 0, str.length(),
                         0, 
  
  
  
  1.29      +5 -5      WebCore/khtml/rendering/render_line.h
  
  Index: render_line.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_line.h,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- render_line.h	5 Jul 2005 23:21:12 -0000	1.28
  +++ render_line.h	29 Jul 2005 23:42:50 -0000	1.29
  @@ -118,19 +118,19 @@
       RootInlineBox* root();
       
       void setWidth(int w) { m_width = w; }
  -    int width() { return m_width; }
  +    int width() const { return m_width; }
   
       void setXPos(int x) { m_x = x; }
  -    int xPos() { return m_x; }
  +    int xPos() const { return m_x; }
   
       void setYPos(int y) { m_y = y; }
  -    int yPos() { return m_y; }
  +    int yPos() const { return m_y; }
   
       void setHeight(int h) { m_height = h; }
  -    int height() { return m_height; }
  +    int height() const { return m_height; }
       
       void setBaseline(int b) { m_baseline = b; }
  -    int baseline() { return m_baseline; }
  +    int baseline() const { return m_baseline; }
   
       virtual bool hasTextChildren() { return true; }
   
  
  
  
  1.65      +12 -11    WebCore/khtml/rendering/render_list.cpp
  
  Index: render_list.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_list.cpp,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- render_list.cpp	18 Jul 2005 21:52:32 -0000	1.64
  +++ render_list.cpp	29 Jul 2005 23:42:50 -0000	1.65
  @@ -481,25 +481,25 @@
   
               if (isInside()) {
               	if( style()->direction() == LTR) {
  -                    p->drawText(_tx, _ty, 0, 0, Qt::AlignLeft|Qt::DontClip, m_item);
  -                    p->drawText(_tx + fm.width(m_item), _ty, 0, 0, Qt::AlignLeft|Qt::DontClip, 
  -                                QString::fromLatin1(". "));
  +                    p->drawText(_tx, _ty, 0, 0, 0, 0, Qt::AlignLeft|Qt::DontClip, m_item);
  +                    p->drawText(_tx + fm.width(m_item, 0, 0), _ty, 0, 0, 0, 0, Qt::AlignLeft|Qt::DontClip, 
  +                            QString::fromLatin1(". "));
                   }
               	else {
                       const QString& punct(QString::fromLatin1(" ."));
  -                    p->drawText(_tx, _ty, 0, 0, Qt::AlignLeft|Qt::DontClip, punct);
  -            	    p->drawText(_tx + fm.width(punct), _ty, 0, 0, Qt::AlignLeft|Qt::DontClip, m_item);
  +                    p->drawText(_tx, _ty, 0, 0, 0, 0, Qt::AlignLeft|Qt::DontClip, punct);
  +            	    p->drawText(_tx + fm.width(punct, 0, 0), _ty, 0, 0, 0, 0, Qt::AlignLeft|Qt::DontClip, m_item);
                   }
               } else {
                   if (style()->direction() == LTR) {
                       const QString& punct(QString::fromLatin1(". "));
  -                    p->drawText(_tx-offset/2, _ty, 0, 0, Qt::AlignRight|Qt::DontClip, punct);
  -                    p->drawText(_tx-offset/2-fm.width(punct), _ty, 0, 0, Qt::AlignRight|Qt::DontClip, m_item);
  +                    p->drawText(_tx-offset/2, _ty, 0, 0, 0, 0, Qt::AlignRight|Qt::DontClip, punct);
  +                    p->drawText(_tx-offset/2-fm.width(punct, 0, 0), _ty, 0, 0, 0, 0, Qt::AlignRight|Qt::DontClip, m_item);
                   }
               	else {
                       const QString& punct(QString::fromLatin1(" ."));
  -            	    p->drawText(_tx+offset/2, _ty, 0, 0, Qt::AlignLeft|Qt::DontClip, punct);
  -                    p->drawText(_tx+offset/2+fm.width(punct), _ty, 0, 0, Qt::AlignLeft|Qt::DontClip, m_item);
  +            	    p->drawText(_tx+offset/2, _ty, 0, 0, 0, 0, Qt::AlignLeft|Qt::DontClip, punct);
  +                    p->drawText(_tx+offset/2+fm.width(punct, 0, 0), _ty, 0, 0, 0, 0, Qt::AlignLeft|Qt::DontClip, m_item);
                   }
               }
           }
  @@ -603,8 +603,9 @@
           break;
       }
   
  -    if (isInside())
  -        m_width = fm.width(m_item) + fm.width(QString::fromLatin1(". "));
  +    if (isInside()) {
  +        m_width = fm.width(m_item, 0, 0) + fm.width(QString::fromLatin1(". "), 0, 0);
  +    }
   
   end:
   
  
  
  
  1.203     +8 -3      WebCore/khtml/rendering/render_object.cpp
  
  Index: render_object.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_object.cpp,v
  retrieving revision 1.202
  retrieving revision 1.203
  diff -u -r1.202 -r1.203
  --- render_object.cpp	29 Jul 2005 23:02:43 -0000	1.202
  +++ render_object.cpp	29 Jul 2005 23:42:50 -0000	1.203
  @@ -1739,6 +1739,14 @@
       return w;
   }
   
  +int RenderObject::tabWidth() const
  +{
  +    if (style()->whiteSpace() != PRE)
  +        return 0;
  +        
  +    return containingBlock()->tabWidth(true);
  +}
  +
   RenderCanvas* RenderObject::canvas() const
   {
       return static_cast<RenderCanvas*>(document()->renderer());
  @@ -2044,9 +2052,6 @@
       
       RenderObject *child = firstChild();
       while( child ) {
  -        // gcc sucks. if anybody knows a trick to get rid of the
  -        // warning without adding an extra (unneeded) initialisation,
  -        // go ahead
   	int cmin = 0;
   	int cmax = 0;
   	bool test = false;
  
  
  
  1.153     +2 -0      WebCore/khtml/rendering/render_object.h
  
  Index: render_object.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_object.h,v
  retrieving revision 1.152
  retrieving revision 1.153
  diff -u -r1.152 -r1.153
  --- render_object.h	29 Jul 2005 23:02:43 -0000	1.152
  +++ render_object.h	29 Jul 2005 23:42:51 -0000	1.153
  @@ -385,6 +385,8 @@
       virtual short verticalPositionHint( bool firstLine ) const;
       // the offset of baseline from the top of the object.
       virtual short baselinePosition( bool firstLine, bool isRootLineBox=false ) const;
  +    // width of tab character
  +    int tabWidth() const;
   
       /*
        * Paint the object and its children, clipped by (x|y|w|h).
  
  
  
  1.81      +2 -0      WebCore/khtml/rendering/render_replaced.cpp
  
  Index: render_replaced.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_replaced.cpp,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- render_replaced.cpp	27 Jul 2005 01:53:16 -0000	1.80
  +++ render_replaced.cpp	29 Jul 2005 23:42:51 -0000	1.81
  @@ -125,6 +125,8 @@
   
   // Returns 1 since a replaced element can have the caret positioned 
   // at its beginning (0), or at its end (1).
  +// NOTE: Yet, "select" elements can have any number of "option" elements
  +// as children, so this "0 or 1" idea does not really hold up.
   long RenderReplaced::caretMaxOffset() const 
   { 
       return 1; 
  
  
  
  1.188     +97 -63    WebCore/khtml/rendering/render_text.cpp
  
  Index: render_text.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_text.cpp,v
  retrieving revision 1.187
  retrieving revision 1.188
  diff -u -r1.187 -r1.188
  --- render_text.cpp	14 Jul 2005 20:51:55 -0000	1.187
  +++ render_text.cpp	29 Jul 2005 23:42:51 -0000	1.188
  @@ -143,12 +143,12 @@
       int selEnd = selStart;
       int selTop = rootBox->selectionTop();
       int selHeight = rootBox->selectionHeight();
  -    
  +
       // FIXME: For justified text, just return the entire text box's rect.  At the moment there's still no easy
       // way to get the width of a run including the justification padding.
       if (sPos > 0 && !m_toAdd) {
           // The selection begins in the middle of our run.
  -        int w = textObject()->width(m_start, sPos, m_firstLine);
  +        int w = textObject()->width(m_start, sPos, m_firstLine, m_x);
           if (m_reversed)
               selStart -= w;
           else
  @@ -162,14 +162,14 @@
               selEnd = m_x + m_width;
       }
       else {
  -        // Our run is partially selected, and so we have to actually do a measurement.
  +        // Our run is partially selected, and so we need to measure.
           int w = textObject()->width(sPos + m_start, ePos - sPos, m_firstLine);
           if (m_reversed)
               selEnd = selStart - w;
           else
               selEnd = selStart + w;
       }
  -
  +    
       int selLeft = m_reversed ? selEnd : selStart;
       int selRight = m_reversed ? selStart : selEnd;
   
  @@ -383,7 +383,7 @@
           int endPoint = m_len;
           if (m_truncation != cNoTruncation)
               endPoint = m_truncation - m_start;
  -        font->drawText(i.p, m_x + tx, m_y + ty + m_baseline,
  +        font->drawText(i.p, m_x + tx, m_y + ty + m_baseline, textObject()->tabWidth(), textPos(),
                          textObject()->string()->s, textObject()->string()->l, m_start, endPoint,
                          m_toAdd, m_reversed ? QPainter::RTL : QPainter::LTR, styleToUse->visuallyOrdered());
       } else {
  @@ -392,18 +392,18 @@
           if (paintSelectedTextSeparately) {
               // paint only the text that is not selected
               if (sPos >= ePos) {
  -                font->drawText(i.p, m_x + tx, m_y + ty + m_baseline,
  +                font->drawText(i.p, m_x + tx, m_y + ty + m_baseline, textObject()->tabWidth(), textPos(),
                                  textObject()->string()->s, textObject()->string()->l, m_start, m_len,
                                  m_toAdd, m_reversed ? QPainter::RTL : QPainter::LTR, styleToUse->visuallyOrdered());
               } else {
                   if (sPos - 1 >= 0) {
  -                    font->drawText(i.p, m_x + tx, m_y + ty + m_baseline, textObject()->string()->s,
  -                                   textObject()->string()->l, m_start, m_len,
  +                    font->drawText(i.p, m_x + tx, m_y + ty + m_baseline, textObject()->tabWidth(), textPos(),
  +                                   textObject()->string()->s, textObject()->string()->l, m_start, m_len,
                                      m_toAdd, m_reversed ? QPainter::RTL : QPainter::LTR, styleToUse->visuallyOrdered(), 0, sPos);
                   }
                   if (ePos < m_start + m_len) {
  -                    font->drawText(i.p, m_x + tx, m_y + ty + m_baseline, textObject()->string()->s,
  -                                   textObject()->string()->l, m_start, m_len,
  +                    font->drawText(i.p, m_x + tx, m_y + ty + m_baseline, textObject()->tabWidth(), textPos(),
  +                                   textObject()->string()->s, textObject()->string()->l, m_start, m_len,
                                      m_toAdd, m_reversed ? QPainter::RTL : QPainter::LTR, styleToUse->visuallyOrdered(), ePos, -1);
                   }
               }
  @@ -419,8 +419,8 @@
                                  selectionTextShadow->y,
                                  selectionTextShadow->blur,
                                  selectionTextShadow->color);
  -            font->drawText(i.p, m_x + tx, m_y + ty + m_baseline, textObject()->string()->s,
  -                           textObject()->string()->l, m_start, m_len,
  +            font->drawText(i.p, m_x + tx, m_y + ty + m_baseline, textObject()->tabWidth(), textPos(),
  +                           textObject()->string()->s, textObject()->string()->l, m_start, m_len,
                              m_toAdd, m_reversed ? QPainter::RTL : QPainter::LTR, styleToUse->visuallyOrdered(), sPos, ePos);
               if (selectionTextShadow)
                   i.p->clearShadow();
  @@ -524,10 +524,9 @@
       p->save();
       p->setPen(c); // Don't draw text at all!
       RootInlineBox* r = root();
  -    int x = m_x + tx;
       int y = r->selectionTop();
       int h = r->selectionHeight();
  -    f->drawHighlightForText(p, x, y + ty, h,
  +    f->drawHighlightForText(p, m_x + tx, y + ty, h, textObject()->tabWidth(), textPos(), 
                               textObject()->str->s, textObject()->str->l, m_start, m_len,
                               m_toAdd, m_reversed ? QPainter::RTL : QPainter::LTR, style->visuallyOrdered(), sPos, ePos, c);
       p->restore();
  @@ -549,10 +548,9 @@
       p->setPen(c); // Don't draw text at all!
   
       RootInlineBox* r = root();
  -    int x = m_x + tx;
       int y = r->selectionTop();
       int h = r->selectionHeight();
  -    f->drawHighlightForText(p, x, y + ty, h, textObject()->str->s, textObject()->str->l, m_start, m_len,
  +    f->drawHighlightForText(p, m_x + tx, y + ty, h, textObject()->tabWidth(), textPos(), textObject()->str->s, textObject()->str->l, m_start, m_len,
               m_toAdd, m_reversed ? QPainter::RTL : QPainter::LTR, style->visuallyOrdered(), sPos, ePos, c);
       p->restore();
   }
  @@ -727,11 +725,21 @@
       return current + 1;
   }
   
  +int InlineTextBox::textPos() const
  +{
  +    if (xPos() == 0)
  +        return 0;
  +        
  +    RenderBlock *blockElement = object()->containingBlock();
  +    return m_reversed ? xPos() - blockElement->borderRight() - blockElement->paddingRight()
  +                      : xPos() - blockElement->borderLeft() - blockElement->paddingLeft();
  +}
  +
   int InlineTextBox::offsetForPosition(int _x, bool includePartialGlyphs) const
   {
       RenderText* text = static_cast<RenderText*>(m_object);
       const Font* f = text->htmlFont(m_firstLine);
  -    return f->checkSelectionPoint(text->str->s, text->str->l, m_start, m_len, m_toAdd, _x - m_x, m_reversed, includePartialGlyphs);
  +    return f->checkSelectionPoint(text->str->s, text->str->l, m_start, m_len, m_toAdd, text->tabWidth(), textPos(), _x - m_x, m_reversed, includePartialGlyphs);
   }
   
   int InlineTextBox::positionForOffset(int offset) const
  @@ -741,13 +749,13 @@
   
       int left;
       if (m_reversed) {
  -        long len = m_start + m_len - offset;
  -        QString string(text->str->s + offset, len);
  -        left = m_x + fm.boundingRect(string, len).right();
  +	long len = m_start + m_len - offset;
  +	QString string(text->str->s + offset, len);
  +	left = m_x + fm.boundingRect(string, text->tabWidth(), textPos(), len).right();
       } else {
  -        long len = offset - m_start;
  -        QString string(text->str->s + m_start, len);
  -        left = m_x + fm.boundingRect(string, len).right();
  +	long len = offset - m_start;
  +	QString string(text->str->s + m_start, len);
  +	left = m_x + fm.boundingRect(string, text->tabWidth(), textPos(), len).right();
       }
       // FIXME: Do we need to add rightBearing here?
       return left;
  @@ -1141,7 +1149,7 @@
       return (f && f->isFixedPitch() && allAscii() && !style()->htmlFont().isSmallCaps());
   }
   
  -// We cache the width of the ' ' character for <pre> text.  We could go futher
  +// We cache the width of the ' ' character for <pre> text.  We could go further
   // and cache a widths array for all styles, at the expense of increasing the size of the
   // RenderText.
   void RenderText::cacheWidths()
  @@ -1151,7 +1159,7 @@
       if (shouldUseMonospaceCache(f)){
           float fw;
           QChar c(' ');
  -        f->floatCharacterWidths( &c, 1, 0, 1, 0, &fw);
  +        f->floatCharacterWidths( &c, 1, 0, 1, 0, 0, 0, &fw);
           m_monospaceCharacterWidth = (int)fw;
       }
       else
  @@ -1159,20 +1167,27 @@
   }
   
   
  -inline int RenderText::widthFromCache(const Font *f, int start, int len) const
  +inline int RenderText::widthFromCache(const Font *f, int start, int len, int tabWidth, int xpos) const
   {
       if (m_monospaceCharacterWidth != 0){
           int i, w = 0;
           for (i = start; i < start+len; i++){
  -            int dir = str->s[i].direction();
  -            if (dir != QChar::DirNSM && dir != QChar::DirBN)
  -                w += m_monospaceCharacterWidth;
  +            QChar c = str->s[i];
  +            int dir = c.direction();
  +            if (dir != QChar::DirNSM && dir != QChar::DirBN) {
  +                if (c == '\t' && tabWidth != 0) {
  +                    w += tabWidth - ((xpos + w) % tabWidth);
  +                } else
  +                    w += m_monospaceCharacterWidth;
  +            }
           }
  +
           return w;
       }
       
  -    return f->width(str->s, str->l, start, len);
  +    return f->width(str->s, str->l, start, len, tabWidth, xpos);
   }
  +
   #ifdef XXX
   inline int RenderText::widthFromCache(const Font *f, int start, int len) const
   {
  @@ -1186,7 +1201,8 @@
   
   #endif
   
  -void RenderText::trimmedMinMaxWidth(int& beginMinW, bool& beginWS, 
  +void RenderText::trimmedMinMaxWidth(int leadWidth,
  +                                    int& beginMinW, bool& beginWS, 
                                       int& endMinW, bool& endWS,
                                       bool& hasBreakableChar, bool& hasBreak,
                                       int& beginMaxW, int& endMaxW,
  @@ -1203,6 +1219,10 @@
           return;
       }
       
  +    // if the text has a variable width tab, we need to call 
  +    if (m_hasTab)
  +        calcMinMaxWidth(leadWidth);
  +    
       minW = m_minWidth;
       maxW = m_maxWidth;
       beginWS = stripFrontSpaces ? false : m_hasBeginWS;
  @@ -1214,10 +1234,10 @@
       hasBreakableChar = m_hasBreakableChar;
       hasBreak = m_hasBreak;
   
  -    if (stripFrontSpaces && (str->s[0] == ' ' || (!isPre && str->s[0] == '\n'))) {
  +    if (stripFrontSpaces && (str->s[0] == ' ' || (!isPre && (str->s[0] == '\n' || str->s[0] == '\t')))) {
           const Font *f = htmlFont( false );
           QChar space[1]; space[0] = ' ';
  -        int spaceWidth = f->width(space, 1, 0);
  +        int spaceWidth = f->width(space, 1, 0, 0);
           maxW -= spaceWidth;
       }
       
  @@ -1242,12 +1262,13 @@
               if (linelen)
               {
   #if !APPLE_CHANGES
  -                endMaxW = f->width(str->s, str->l, i, linelen);
  +                endMaxW = f->width(str->s, str->l, i, linelen, tabWidth(), leadWidth + endMaxW); 
   #else
  -                endMaxW = widthFromCache(f, i, linelen);
  +                endMaxW = widthFromCache(f, i, linelen, tabWidth(), leadWidth + endMaxW);
   #endif
                   if (firstLine) {
                       firstLine = false;
  +                    leadWidth = 0;
                       beginMaxW = endMaxW;
                   }
                   i += linelen;
  @@ -1255,6 +1276,7 @@
               else if (firstLine) {
                   beginMaxW = 0;
                   firstLine = false;
  +                leadWidth = 0;
               }
       
               if (i == len-1)
  @@ -1267,8 +1289,14 @@
   
   void RenderText::calcMinMaxWidth()
   {
  +    // Use 0 for the leadWidth.   If the text contains a variable width tab, the real width
  +    // will get measured when trimmedMinMaxWidth calls again with the real leadWidth.
       KHTMLAssert( !minMaxKnown() );
  +    calcMinMaxWidth(0);
  +}
   
  +void RenderText::calcMinMaxWidth(int leadWidth)
  +{
       // ### calc Min and Max width...
       m_minWidth = m_beginMinWidth = m_endMinWidth = 0;
       m_maxWidth = 0;
  @@ -1278,7 +1306,7 @@
           
       int currMinWidth = 0;
       int currMaxWidth = 0;
  -    m_hasBreakableChar = m_hasBreak = m_hasBeginWS = m_hasEndWS = false;
  +    m_hasBreakableChar = m_hasBreak = m_hasTab = m_hasBeginWS = m_hasEndWS = false;
       
       // ### not 100% correct for first-line
       const Font *f = htmlFont( false );
  @@ -1301,8 +1329,13 @@
                   m_hasBreak = true;
                   isNewline = true;
                   isSpace = false;
  -            }
  -            else
  +            } else
  +                isSpace = true;
  +        } else if (c == '\t') {
  +            if (isPre) {
  +                m_hasTab = true;
  +                isSpace = false;
  +            } else
                   isSpace = true;
           } else {
               isSpace = c == ' ';
  @@ -1318,12 +1351,14 @@
           
           if (ignoringSpaces && !isSpace)
               ignoringSpaces = false;
  -            
  -        if (ignoringSpaces || (i > 0 && c.unicode() == SOFT_HYPHEN)) // Ignore spaces and soft hyphens
  +        
  +        // Ignore spaces and soft hyphens
  +        if (ignoringSpaces || (i > 0 && c.unicode() == SOFT_HYPHEN)) {
               continue;
  +        }
           
           int wordlen = 0;
  -        while (i+wordlen < len && str->s[i+wordlen] != '\n' && str->s[i+wordlen] != ' ' &&
  +        while (i+wordlen < len && str->s[i+wordlen] != '\n' && str->s[i+wordlen] != ' ' && str->s[i+wordlen] != '\t' &&
                  (i+wordlen == 0 || str->s[i+wordlen].unicode() != SOFT_HYPHEN) && // Skip soft hyphens
                  (wordlen == 0 || !isBreakable( str->s, i+wordlen, str->l)))
               wordlen++;
  @@ -1331,20 +1366,20 @@
           if (wordlen)
           {
   #if !APPLE_CHANGES
  -            int w = f->width(str->s, str->l, i, wordlen);
  +            int w = f->width(str->s, str->l, i, wordlen, tabWidth(), leadWidth + currMaxWidth);
   #else
  -            int w = widthFromCache(f, i, wordlen);
  +            int w = widthFromCache(f, i, wordlen, tabWidth(), leadWidth + currMaxWidth);
   #endif
               currMinWidth += w;
               currMaxWidth += w;
               
  -            bool isBreakableCharSpace = (i+wordlen < len) ? ((!isPre && str->s[i+wordlen] == '\n') || 
  +            bool isBreakableCharSpace = (i+wordlen < len) ? ((!isPre && (str->s[i+wordlen] == '\n' || str->s[i+wordlen] == '\t')) || 
                                                                str->s[i+wordlen] == ' ') : false;
   
               if (i+wordlen < len && style()->whiteSpace() == NORMAL)
                   m_hasBreakableChar = true;
               
  -            // Add in wordspacing to our maxwidth, but not if this is the last word on a line or the
  +            // Add in wordSpacing to our currMaxWidth, but not if this is the last word on a line or the
               // last word in the run.
               if (wordSpacing && isBreakableCharSpace && !containsOnlyWhitespace(i+wordlen, len-(i+wordlen)))
                   currMaxWidth += wordSpacing;
  @@ -1368,7 +1403,7 @@
           }
           else {
               // Nowrap can never be broken, so don't bother setting the
  -            // breakable character boolean. Pre can only be broken if we encounter a newline.
  +            // breakable character boolean. Pre can only be broken if we encounter a newline.     
               if (style()->whiteSpace() == NORMAL || isNewline)
                   m_hasBreakableChar = true;
   
  @@ -1379,6 +1414,7 @@
               {
                   if (firstLine) {
                       firstLine = false;
  +                    leadWidth = 0;
                       m_beginMinWidth = currMaxWidth;
                   }
                   
  @@ -1387,14 +1423,14 @@
               }
               else
               {
  -                currMaxWidth += f->width( str->s, str->l, i + wordlen );
  +                currMaxWidth += f->width(str->s, str->l, i + wordlen, 1, tabWidth(), leadWidth + currMaxWidth);
               }
           }
       }
  -    
  +
       if(currMinWidth > m_minWidth) m_minWidth = currMinWidth;
       if(currMaxWidth > m_maxWidth) m_maxWidth = currMaxWidth;
  -
  +        
       if (style()->whiteSpace() != NORMAL)
           m_minWidth = m_maxWidth;
   
  @@ -1412,7 +1448,7 @@
   {
       unsigned int currPos;
       for (currPos = from; 
  -         currPos < from+len && (str->s[currPos] == '\n' || str->s[currPos].unicode() == ' '); 
  +         currPos < from+len && (str->s[currPos] == '\n' || str->s[currPos].unicode() == ' ' || str->s[currPos] == '\t'); 
            currPos++);
       return currPos >= (from+len);
   }
  @@ -1660,37 +1696,37 @@
       s->m_len = len;
   }
   
  -unsigned int RenderText::width(unsigned int from, unsigned int len, bool firstLine) const
  +unsigned int RenderText::width(unsigned int from, unsigned int len, int xpos, bool firstLine) const
   {
       if(!str->s || from > str->l ) return 0;
       if ( from + len > str->l ) len = str->l - from;
   
       const Font *f = htmlFont( firstLine );
  -    return width( from, len, f );
  +    return width( from, len, f, xpos );
   }
   
  -unsigned int RenderText::width(unsigned int from, unsigned int len, const Font *f) const
  +unsigned int RenderText::width(unsigned int from, unsigned int len, const Font *f, int xpos) const
   {
       if(!str->s || from > str->l ) return 0;
       if ( from + len > str->l ) len = str->l - from;
   
       int w;
  -    if ( f == &style()->htmlFont() && from == 0 && len == str->l )
  +    if ( style()->whiteSpace() != PRE && f == &style()->htmlFont() && from == 0 && len == str->l ) {
           w = m_maxWidth;
   #if APPLE_CHANGES
  -    else if (f == &style()->htmlFont())
  -        w = widthFromCache (f, from, len);
  +    } else if (f == &style()->htmlFont()) {
  +        w = widthFromCache (f, from, len, tabWidth(), xpos);
   #endif
  -    else
  -        w = f->width(str->s, str->l, from, len );
  -
  +    } else {
  +	w = f->width(str->s, str->l, from, len, tabWidth(), xpos );
  +    }
  +        
       //kdDebug( 6040 ) << "RenderText::width(" << from << ", " << len << ") = " << w << endl;
       return w;
   }
   
   int RenderText::width() const
   {
  -    int w;
       int minx = 100000000;
       int maxx = 0;
       // slooow
  @@ -1701,9 +1737,7 @@
               maxx = s->m_x + s->m_width;
       }
   
  -    w = kMax(0, maxx-minx);
  -
  -    return w;
  +    return kMax(0, maxx-minx);
   }
   
   QRect RenderText::getAbsoluteRepaintRect()
  
  
  
  1.82      +10 -4     WebCore/khtml/rendering/render_text.h
  
  Index: render_text.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_text.h,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- render_text.h	14 Jul 2005 20:51:55 -0000	1.81
  +++ render_text.h	29 Jul 2005 23:42:51 -0000	1.82
  @@ -128,6 +128,7 @@
       virtual long caretMaxOffset() const;
       virtual unsigned long caretMaxRenderedOffset() const;
       
  +    int textPos() const;
       int offsetForPosition(int _x, bool includePartialGlyphs = true) const;
       int positionForOffset(int offset) const;
       
  @@ -194,8 +195,8 @@
       unsigned int stringLength() const { return str->l; } // non virtual implementation of length()
       virtual void position(InlineBox* box, int from, int len, bool reverse);
   
  -    virtual unsigned int width(unsigned int from, unsigned int len, const Font *f) const;
  -    virtual unsigned int width(unsigned int from, unsigned int len, bool firstLine = false) const;
  +    virtual unsigned int width(unsigned int from, unsigned int len, const Font *f, int xpos) const;
  +    virtual unsigned int width(unsigned int from, unsigned int len, int xpos, bool firstLine = false) const;
       virtual int width() const;
       virtual int height() const;
   
  @@ -207,7 +208,11 @@
       virtual void calcMinMaxWidth();
       virtual int minWidth() const { return m_minWidth; }
       virtual int maxWidth() const { return m_maxWidth; }
  -    virtual void trimmedMinMaxWidth(int& beginMinW, bool& beginWS, 
  +
  +    // widths
  +    void calcMinMaxWidth(int leadWidth);
  +    virtual void trimmedMinMaxWidth(int leadWidth,
  +                                    int& beginMinW, bool& beginWS, 
                                       int& endMinW, bool& endWS,
                                       bool& hasBreakableChar, bool& hasBreak,
                                       int& beginMaxW, int& endMaxW,
  @@ -252,7 +257,7 @@
       virtual InlineBox *inlineBox(long offset, EAffinity affinity = UPSTREAM);
   
   #if APPLE_CHANGES
  -    int widthFromCache(const Font *, int start, int len) const;
  +    int widthFromCache(const Font *, int start, int len, int tabWidth, int xpos) const;
       bool shouldUseMonospaceCache(const Font *) const;
       void cacheWidths();
       bool allAscii() const;
  @@ -286,6 +291,7 @@
       SelectionState m_selectionState : 3 ;
       bool m_hasBreakableChar : 1; // Whether or not we can be broken into multiple lines.
       bool m_hasBreak : 1; // Whether or not we have a hard break (e.g., <pre> with '\n').
  +    bool m_hasTab : 1; // Whether or not we have a variable width tab character (e.g., <pre> with '\t').
       bool m_hasBeginWS : 1; // Whether or not we begin with WS (only true if we aren't pre)
       bool m_hasEndWS : 1; // Whether or not we end with WS (only true if we aren't pre)
       
  
  
  
  1.41      +11 -11    WebCore/kwq/KWQFontMetrics.h
  
  Index: KWQFontMetrics.h
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQFontMetrics.h,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- KWQFontMetrics.h	5 Jul 2005 23:21:16 -0000	1.40
  +++ KWQFontMetrics.h	29 Jul 2005 23:42:54 -0000	1.41
  @@ -51,22 +51,22 @@
       int lineSpacing() const;
       float xHeight() const;
       
  -    int width(QChar) const;
  -    int width(char) const;
  -    int width(const QString &, int len=-1) const;
  -    int charWidth(const QString &, int pos) const;
  -    int width(const QChar *, int len) const;
  +    int width(QChar, int tabWidth, int xpos) const;
  +    int width(char, int tabWidth, int xpos) const;
  +    int width(const QString &, int tabWidth, int xpos, int len=-1) const;
  +    int charWidth(const QString &, int pos, int tabWidth, int xpos) const;
  +    int width(const QChar *, int len, int tabWidth, int xpos) const;
       float floatWidth(const QChar *, int slen, int pos, int len,
  -                     int letterSpacing, int wordSpacing, bool smallCaps) const;
  -    float floatCharacterWidths(const QChar *, int slen, int pos, int len, int toAdd, float *buffer,
  +                     int tabWidth, int xpos, int letterSpacing, int wordSpacing, bool smallCaps) const;
  +    float floatCharacterWidths(const QChar *, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, float *buffer,
                                  int letterSpacing, int wordSpacing, bool smallCaps) const;
  -    int checkSelectionPoint (QChar *s, int slen, int pos, int len, int toAdd, int letterSpacing, int wordSpacing, bool smallCaps, int x, bool reversed, bool includePartialGlyphs) const;
  +    int checkSelectionPoint (QChar *s, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, int letterSpacing, int wordSpacing, bool smallCaps, int x, bool reversed, bool includePartialGlyphs) const;
   
       QRect boundingRect(QChar) const;
  -    QRect boundingRect(const QString &, int len=-1) const;
  -    QRect boundingRect(int, int, int, int, int, const QString &) const;
  +    QRect boundingRect(const QString &, int tabWidth, int xpos, int len=-1) const;
  +    QRect boundingRect(int, int, int, int, int, const QString &, int tabWidth, int xpos) const;
   
  -    QSize size(int, const QString &) const;
  +    QSize size(int, const QString &, int tabWidth, int xpos) const;
   
       int baselineOffset() const { return ascent(); }
       
  
  
  
  1.89      +32 -19    WebCore/kwq/KWQFontMetrics.mm
  
  Index: KWQFontMetrics.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQFontMetrics.mm,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- KWQFontMetrics.mm	5 Jul 2005 23:21:16 -0000	1.88
  +++ KWQFontMetrics.mm	29 Jul 2005 23:42:55 -0000	1.89
  @@ -158,7 +158,7 @@
       return [data->getRenderer() xHeight];
   }
   
  -int QFontMetrics::width(QChar qc) const
  +int QFontMetrics::width(QChar qc, int tabWidth, int xpos) const
   {
       if (data.isNull()) {
           ERROR("called width on an empty QFontMetrics");
  @@ -175,16 +175,18 @@
       WebCoreTextStyle style;
       WebCoreInitializeEmptyTextStyle(&style);
       style.families = families;
  +    style.tabWidth = tabWidth;
  +    style.xpos = xpos;
   
       return ROUND_TO_INT([data->getRenderer() floatWidthForRun:&run style:&style widths:0]);
   }
   
  -int QFontMetrics::charWidth(const QString &s, int pos) const
  +int QFontMetrics::charWidth(const QString &s, int pos, int tabWidth, int xpos) const
   {
  -    return width(s[pos]);
  +    return width(s[pos], tabWidth, xpos);
   }
   
  -int QFontMetrics::width(char c) const
  +int QFontMetrics::width(char c, int tabWidth, int xpos) const
   {
       if (data.isNull()) {
           ERROR("called width on an empty QFontMetrics");
  @@ -201,11 +203,13 @@
       WebCoreTextStyle style;
       WebCoreInitializeEmptyTextStyle(&style);
       style.families = families;
  +    style.tabWidth = tabWidth;
  +    style.xpos = xpos;
   
       return ROUND_TO_INT([data->getRenderer() floatWidthForRun:&run style:&style widths:0]);
   }
   
  -int QFontMetrics::width(const QString &qstring, int len) const
  +int QFontMetrics::width(const QString &qstring, int tabWidth, int xpos, int len) const
   {
       if (data.isNull()) {
           ERROR("called width on an empty QFontMetrics");
  @@ -222,11 +226,13 @@
       WebCoreTextStyle style;
       WebCoreInitializeEmptyTextStyle(&style);
       style.families = families;
  +    style.tabWidth = tabWidth;
  +    style.xpos = xpos;
   
       return ROUND_TO_INT([data->getRenderer() floatWidthForRun:&run style:&style widths:0]);
   }
   
  -int QFontMetrics::width(const QChar *uchars, int len) const
  +int QFontMetrics::width(const QChar *uchars, int len, int tabWidth, int xpos) const
   {
       if (data.isNull()) {
           ERROR("called width on an empty QFontMetrics");
  @@ -241,25 +247,28 @@
       WebCoreTextStyle style;
       WebCoreInitializeEmptyTextStyle(&style);
       style.families = families;
  +    style.tabWidth = tabWidth;
  +    style.xpos = xpos;
   
       return ROUND_TO_INT([data->getRenderer() floatWidthForRun:&run style:&style widths:0]);
   }
   
   float QFontMetrics::floatWidth(const QChar *uchars, int slen, int pos, int len,
  -                               int letterSpacing, int wordSpacing, bool smallCaps) const
  +                               int tabWidth, int xpos, int letterSpacing, int wordSpacing, bool smallCaps) const
   {
       if (data.isNull()) {
           ERROR("called floatWidth on an empty QFontMetrics");
           return 0;
       }
  -    
  -    CREATE_FAMILY_ARRAY(data->font(), families);
   
  +    CREATE_FAMILY_ARRAY(data->font(), families);
       WebCoreTextRun run;
       WebCoreInitializeTextRun(&run, (const UniChar *)uchars, slen, pos, pos+len);
       
       WebCoreTextStyle style;
       WebCoreInitializeEmptyTextStyle(&style);
  +    style.tabWidth = tabWidth;
  +    style.xpos = xpos;
       style.letterSpacing = letterSpacing;
       style.wordSpacing = wordSpacing;
       style.smallCaps = smallCaps;
  @@ -268,7 +277,7 @@
       return ROUND_TO_INT([data->getRenderer() floatWidthForRun:&run style:&style widths:0]);
   }
   
  -float QFontMetrics::floatCharacterWidths(const QChar *uchars, int slen, int pos, int len, int toAdd, float *buffer, int letterSpacing, int wordSpacing, bool smallCaps) const
  +float QFontMetrics::floatCharacterWidths(const QChar *uchars, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, float *buffer, int letterSpacing, int wordSpacing, bool smallCaps) const
   {
       if (data.isNull()) {
           ERROR("called floatCharacterWidths on an empty QFontMetrics");
  @@ -286,15 +295,17 @@
       style.wordSpacing = wordSpacing;
       style.smallCaps = smallCaps;
       style.padding = toAdd;
  +    style.tabWidth = tabWidth;
  +    style.xpos = xpos;
       style.families = families;
   
       return [data->getRenderer() floatWidthForRun:&run style:&style widths:buffer];
   }
   
  -int QFontMetrics::checkSelectionPoint (QChar *s, int slen, int pos, int len, int toAdd, int letterSpacing, int wordSpacing, bool smallCaps, int x, bool reversed, bool includePartialGlyphs) const
  +int QFontMetrics::checkSelectionPoint (QChar *s, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, int letterSpacing, int wordSpacing, bool smallCaps, int x, bool reversed, bool includePartialGlyphs) const
   {
       if (data.isNull()) {
  -        ERROR("called floatWidth on an empty QFontMetrics");
  +        ERROR("called checkSelectionPoint on an empty QFontMetrics");
           return 0;
       }
       
  @@ -309,6 +320,8 @@
       style.smallCaps = smallCaps;
       style.families = families;
       style.padding = toAdd;
  +    style.tabWidth = tabWidth;
  +    style.xpos = xpos;
       style.rtl = reversed;
   
       return [data->getRenderer() pointToOffset:&run style:&style position:x reversed:reversed includePartialGlyphs:includePartialGlyphs];
  @@ -316,21 +329,21 @@
   
   QRect QFontMetrics::boundingRect(QChar c) const
   {
  -    return QRect(0, 0, width(c), height());
  +    return QRect(0, 0, width(c, 0, 0), height());
   }
   
  -QRect QFontMetrics::boundingRect(const QString &qstring, int len) const
  +QRect QFontMetrics::boundingRect(const QString &qstring, int tabWidth, int xpos, int len) const
   {
  -    return QRect(0, 0, width(qstring, len), height());
  +    return QRect(0, 0, width(qstring, tabWidth, xpos, len), height());
   }
   
  -QRect QFontMetrics::boundingRect(int x, int y, int width, int height, int flags, const QString &str) const
  +QRect QFontMetrics::boundingRect(int x, int y, int width, int height, int flags, const QString &str, int tabWidth, int xpos) const
   {
       // FIXME: need to support word wrapping?
  -    return QRect(x, y, width, height).intersect(boundingRect(str));
  +    return QRect(x, y, width, height).intersect(boundingRect(str, tabWidth, xpos));
   }
   
  -QSize QFontMetrics::size(int, const QString &qstring) const
  +QSize QFontMetrics::size(int, const QString &qstring, int tabWidth, int xpos) const
   {
  -    return QSize(width(qstring), height());
  +    return QSize(width(qstring, tabWidth, xpos), height());
   }
  
  
  
  1.75      +3 -3      WebCore/kwq/KWQPainter.h
  
  Index: KWQPainter.h
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQPainter.h,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- KWQPainter.h	28 Jul 2005 20:47:28 -0000	1.74
  +++ KWQPainter.h	29 Jul 2005 23:42:55 -0000	1.75
  @@ -101,12 +101,12 @@
       RasterOp rasterOp() const;
       void setRasterOp(RasterOp);
   
  -    void drawText(int x, int y, int, int, int alignmentFlags, const QString &);
  -    void drawHighlightForText(int x, int y, int h, 
  +    void drawText(int x, int y, int tabWidth, int xpos, int, int, int alignmentFlags, const QString &);
  +    void drawHighlightForText(int x, int y, int h, int tabWidth, int xpos,
                     const QChar *, int length, int from, int to, int toAdd,
                     const QColor& backgroundColor, QPainter::TextDirection d, bool visuallyOrdered,
                     int letterSpacing, int wordSpacing, bool smallCaps);
  -    void drawText(int x, int y, const QChar *, int length, int from, int to, int toAdd,
  +    void drawText(int x, int y, int tabWidth, int xpos, const QChar *, int length, int from, int to, int toAdd,
                     const QColor& backgroundColor, QPainter::TextDirection d, bool visuallyOrdered,
                     int letterSpacing, int wordSpacing, bool smallCaps);
       void drawLineForText(int x, int y, int yOffset, int width);
  
  
  
  1.129     +17 -12    WebCore/kwq/KWQPainter.mm
  
  Index: KWQPainter.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/KWQPainter.mm,v
  retrieving revision 1.128
  retrieving revision 1.129
  diff -u -r1.128 -r1.129
  --- KWQPainter.mm	28 Jul 2005 20:47:28 -0000	1.128
  +++ KWQPainter.mm	29 Jul 2005 23:42:55 -0000	1.129
  @@ -70,6 +70,7 @@
       QColor focusRingColor;
   };
   
  +static inline void _fillRectXX(float x, float y, float w, float h, const QColor& col);
   QPainter::QPainter() : data(new QPainterPrivate), _isForPrinting(false), _usesInactiveTextBackgroundColor(false), _updatingControlTints(false)
   {
   }
  @@ -185,7 +186,7 @@
           return;
           
       if (data->state.brush.style() != NoBrush)
  -        _fillRect(x, y, w, h, data->state.brush.color());
  +        _fillRectXX(x, y, w, h, data->state.brush.color());
   
       if (data->state.pen.style() != NoPen) {
           _setColorFromPen();
  @@ -273,12 +274,12 @@
           // Do a rect fill of our endpoints.  This ensures we always have the
           // appearance of being a border.  We then draw the actual dotted/dashed line.
           if (x1 == x2) {
  -            _fillRect(p1.x-width/2, p1.y-width, width, width, data->state.pen.color());
  -            _fillRect(p2.x-width/2, p2.y, width, width, data->state.pen.color());
  +            _fillRectXX(p1.x-width/2, p1.y-width, width, width, data->state.pen.color());
  +            _fillRectXX(p2.x-width/2, p2.y, width, width, data->state.pen.color());
           }
           else {
  -            _fillRect(p1.x-width, p1.y-width/2, width, width, data->state.pen.color());
  -            _fillRect(p2.x, p2.y-width/2, width, width, data->state.pen.color());
  +            _fillRectXX(p1.x-width, p1.y-width/2, width, width, data->state.pen.color());
  +            _fillRectXX(p2.x, p2.y-width/2, width, width, data->state.pen.color());
           }
           
           // Example: 80 pixels with a width of 30 pixels.
  @@ -580,7 +581,7 @@
       }
   }
       
  -void QPainter::drawText(int x, int y, int, int, int alignmentFlags, const QString &qstring)
  +void QPainter::drawText(int x, int y, int tabWidth, int xpos, int, int, int alignmentFlags, const QString &qstring)
   {
       if (data->state.paintingDisabled)
           return;
  @@ -600,6 +601,8 @@
       WebCoreInitializeEmptyTextStyle(&style);
       style.textColor = nsColor(data->state.pen.color());
       style.families = families;
  +    style.tabWidth = tabWidth;
  +    style.xpos = xpos;
       
       if (alignmentFlags & Qt::AlignRight)
           x -= ROUND_TO_INT([data->textRenderer floatWidthForRun:&run style:&style widths:0]);
  @@ -607,11 +610,10 @@
       WebCoreTextGeometry geometry;
       WebCoreInitializeEmptyTextGeometry(&geometry);
       geometry.point = NSMakePoint(x, y);
  -     
       [data->textRenderer drawRun:&run style:&style geometry:&geometry];
   }
   
  -void QPainter::drawText(int x, int y, const QChar *str, int len, int from, int to, int toAdd, const QColor &backgroundColor, QPainter::TextDirection d, bool visuallyOrdered, int letterSpacing, int wordSpacing, bool smallCaps)
  +void QPainter::drawText(int x, int y, int tabWidth, int xpos, const QChar *str, int len, int from, int to, int toAdd, const QColor &backgroundColor, QPainter::TextDirection d, bool visuallyOrdered, int letterSpacing, int wordSpacing, bool smallCaps)
   {
       if (data->state.paintingDisabled || len <= 0)
           return;
  @@ -640,14 +642,15 @@
       style.smallCaps = smallCaps;
       style.families = families;
       style.padding = toAdd;
  +    style.tabWidth = tabWidth;
  +    style.xpos = xpos;
       WebCoreTextGeometry geometry;
       WebCoreInitializeEmptyTextGeometry(&geometry);
       geometry.point = NSMakePoint(x, y);
  -    
       [data->textRenderer drawRun:&run style:&style geometry:&geometry];
   }
   
  -void QPainter::drawHighlightForText(int x, int y, int h, 
  +void QPainter::drawHighlightForText(int x, int y, int h, int tabWidth, int xpos,
       const QChar *str, int len, int from, int to, int toAdd, const QColor &backgroundColor, 
       QPainter::TextDirection d, bool visuallyOrdered, int letterSpacing, int wordSpacing, bool smallCaps)
   {
  @@ -678,6 +681,8 @@
       style.smallCaps = smallCaps;
       style.families = families;    
       style.padding = toAdd;
  +    style.tabWidth = tabWidth;
  +    style.xpos = xpos;
       WebCoreTextGeometry geometry;
       WebCoreInitializeEmptyTextGeometry(&geometry);
       geometry.point = NSMakePoint(x, y);
  @@ -743,7 +748,7 @@
   }
   
   // A fillRect designed to work around buggy behavior in NSRectFill.
  -void QPainter::_fillRect(float x, float y, float w, float h, const QColor& col)
  +static inline void _fillRectXX(float x, float y, float w, float h, const QColor& col)
   {
       [nsColor(col) set];
       NSRectFillUsingOperation(NSMakeRect(x,y,w,h), NSCompositeSourceOver);
  @@ -755,7 +760,7 @@
           return;
   
       if (brush.style() == SolidPattern)
  -        _fillRect(x, y, w, h, brush.color());
  +        _fillRectXX(x, y, w, h, brush.color());
   }
   
   void QPainter::fillRect(const QRect &rect, const QBrush &brush)
  
  
  
  1.35      +5 -3      WebCore/kwq/WebCoreTextRenderer.h
  
  Index: WebCoreTextRenderer.h
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/WebCoreTextRenderer.h,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- WebCoreTextRenderer.h	5 Jul 2005 23:21:17 -0000	1.34
  +++ WebCoreTextRenderer.h	29 Jul 2005 23:42:55 -0000	1.35
  @@ -33,9 +33,11 @@
   {
       NSColor *textColor;
       NSColor *backgroundColor;
  -    int letterSpacing;
  -    int wordSpacing;
  -    int padding;
  +    float letterSpacing;
  +    float wordSpacing;
  +    float padding;
  +    float tabWidth;
  +    float xpos;
       NSString **families;
       unsigned smallCaps : 1;
       unsigned rtl : 1;
  
  
  
  1.24      +2 -0      WebCore/kwq/WebCoreTextRendererFactory.mm
  
  Index: WebCoreTextRendererFactory.mm
  ===================================================================
  RCS file: /cvs/root/WebCore/kwq/WebCoreTextRendererFactory.mm,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- WebCoreTextRendererFactory.mm	5 Jul 2005 23:21:17 -0000	1.23
  +++ WebCoreTextRendererFactory.mm	29 Jul 2005 23:42:55 -0000	1.24
  @@ -42,6 +42,8 @@
   void WebCoreInitializeEmptyTextStyle(WebCoreTextStyle *style)
   {
       style->padding = 0;
  +//    style->tabWidth = 0.0F;
  +//    style->xpos = 0.0F;
       style->textColor = nil;
       style->backgroundColor = nil;
       style->rtl = false;
  
  
  
  1.9       +7 -4      WebCore/layout-tests/editing/deleting/delete-tab-001-expected.txt
  
  Index: delete-tab-001-expected.txt
  ===================================================================
  RCS file: /cvs/root/WebCore/layout-tests/editing/deleting/delete-tab-001-expected.txt,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- delete-tab-001-expected.txt	6 Jul 2005 18:49:01 -0000	1.8
  +++ delete-tab-001-expected.txt	29 Jul 2005 23:42:56 -0000	1.9
  @@ -4,8 +4,11 @@
     RenderBlock {HTML} at (0,0) size 800x600
       RenderBody {BODY} at (8,8) size 784x584
         RenderBlock {DIV} at (0,0) size 784x56 [border: (2px solid #FF0000)]
  -        RenderInline {SPAN} at (0,0) size 56x28
  -          RenderText {TEXT} at (14,14) size 56x28
  -            text run at (14,14) width 56: "    foo"
  +        RenderInline {SPAN} at (0,0) size 80x28
  +          RenderInline {SPAN} at (0,0) size 48x28
  +            RenderText {TEXT} at (14,14) size 48x28
  +              text run at (14,14) width 48: "\x{9}"
  +          RenderText {TEXT} at (62,14) size 32x28
  +            text run at (62,14) width 32: "foo"
           RenderText {TEXT} at (0,0) size 0x0
  -caret: position 4 of child 0 {TEXT} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  +caret: position 1 of child 0 {TEXT} of child 0 {SPAN} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  
  
  
  1.4       +1 -2      WebCore/layout-tests/editing/deleting/delete-tab-001.html
  
  Index: delete-tab-001.html
  ===================================================================
  RCS file: /cvs/root/WebCore/layout-tests/editing/deleting/delete-tab-001.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- delete-tab-001.html	5 Jul 2005 23:21:18 -0000	1.3
  +++ delete-tab-001.html	29 Jul 2005 23:42:56 -0000	1.4
  @@ -15,8 +15,7 @@
   function editingTest() {
       typeCharacterCommand('\t');
       typeCharacterCommand('\t');
  -    for (i = 0; i < 4; i++)
  -        deleteCommand();
  +    deleteCommand();
   }
   
   </script>
  
  
  
  1.8       +7 -4      WebCore/layout-tests/editing/deleting/delete-tab-002-expected.txt
  
  Index: delete-tab-002-expected.txt
  ===================================================================
  RCS file: /cvs/root/WebCore/layout-tests/editing/deleting/delete-tab-002-expected.txt,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- delete-tab-002-expected.txt	6 Jul 2005 18:49:01 -0000	1.7
  +++ delete-tab-002-expected.txt	29 Jul 2005 23:42:56 -0000	1.8
  @@ -4,7 +4,10 @@
     RenderBlock {HTML} at (0,0) size 800x600
       RenderBody {BODY} at (8,8) size 784x584
         RenderBlock {DIV} at (0,0) size 784x56 [border: (2px solid #FF0000)]
  -        RenderInline {SPAN} at (0,0) size 56x28
  -          RenderText {TEXT} at (14,14) size 56x28
  -            text run at (14,14) width 56: "foo    "
  -caret: position 7 of child 0 {TEXT} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  +        RenderInline {SPAN} at (0,0) size 48x28
  +          RenderText {TEXT} at (14,14) size 32x28
  +            text run at (14,14) width 32: "foo"
  +          RenderInline {SPAN} at (0,0) size 16x28
  +            RenderText {TEXT} at (46,14) size 16x28
  +              text run at (46,14) width 16: "\x{9}"
  +caret: position 1 of child 0 {TEXT} of child 1 {SPAN} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  
  
  
  1.4       +1 -2      WebCore/layout-tests/editing/deleting/delete-tab-002.html
  
  Index: delete-tab-002.html
  ===================================================================
  RCS file: /cvs/root/WebCore/layout-tests/editing/deleting/delete-tab-002.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- delete-tab-002.html	5 Jul 2005 23:21:19 -0000	1.3
  +++ delete-tab-002.html	29 Jul 2005 23:42:56 -0000	1.4
  @@ -17,8 +17,7 @@
           moveSelectionForwardByCharacterCommand();
       typeCharacterCommand('\t');
       typeCharacterCommand('\t');
  -    for (i = 0; i < 4; i++)
  -        deleteCommand();
  +    deleteCommand();
   }
   
   </script>
  
  
  
  1.8       +9 -4      WebCore/layout-tests/editing/deleting/delete-tab-003-expected.txt
  
  Index: delete-tab-003-expected.txt
  ===================================================================
  RCS file: /cvs/root/WebCore/layout-tests/editing/deleting/delete-tab-003-expected.txt,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- delete-tab-003-expected.txt	6 Jul 2005 18:49:01 -0000	1.7
  +++ delete-tab-003-expected.txt	29 Jul 2005 23:42:56 -0000	1.8
  @@ -4,8 +4,13 @@
     RenderBlock {HTML} at (0,0) size 800x600
       RenderBody {BODY} at (8,8) size 784x584
         RenderBlock {DIV} at (0,0) size 784x56 [border: (2px solid #FF0000)]
  -        RenderInline {SPAN} at (0,0) size 56x28
  -          RenderText {TEXT} at (14,14) size 56x28
  -            text run at (14,14) width 56: "fo    o"
  +        RenderInline {SPAN} at (0,0) size 60x28
  +          RenderText {TEXT} at (14,14) size 20x28
  +            text run at (14,14) width 20: "fo"
  +          RenderInline {SPAN} at (0,0) size 28x28
  +            RenderText {TEXT} at (34,14) size 28x28
  +              text run at (34,14) width 28: "\x{9}"
  +          RenderText {TEXT} at (62,14) size 12x28
  +            text run at (62,14) width 12: "o"
           RenderText {TEXT} at (0,0) size 0x0
  -caret: position 6 of child 0 {TEXT} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  +caret: position 1 of child 0 {TEXT} of child 1 {SPAN} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  
  
  
  1.4       +1 -2      WebCore/layout-tests/editing/deleting/delete-tab-003.html
  
  Index: delete-tab-003.html
  ===================================================================
  RCS file: /cvs/root/WebCore/layout-tests/editing/deleting/delete-tab-003.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- delete-tab-003.html	5 Jul 2005 23:21:19 -0000	1.3
  +++ delete-tab-003.html	29 Jul 2005 23:42:56 -0000	1.4
  @@ -17,8 +17,7 @@
           moveSelectionForwardByCharacterCommand();
       typeCharacterCommand('\t');
       typeCharacterCommand('\t');
  -    for (i = 0; i < 4; i++)
  -        deleteCommand();
  +    deleteCommand();
   }
   
   </script>
  
  
  
  1.9       +7 -4      WebCore/layout-tests/editing/deleting/delete-tab-004-expected.txt
  
  Index: delete-tab-004-expected.txt
  ===================================================================
  RCS file: /cvs/root/WebCore/layout-tests/editing/deleting/delete-tab-004-expected.txt,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- delete-tab-004-expected.txt	6 Jul 2005 18:49:01 -0000	1.8
  +++ delete-tab-004-expected.txt	29 Jul 2005 23:42:56 -0000	1.9
  @@ -4,9 +4,12 @@
     RenderBlock {HTML} at (0,0) size 800x600
       RenderBody {BODY} at (8,8) size 784x584
         RenderBlock {DIV} at (0,0) size 784x84 [border: (2px solid #FF0000)]
  -        RenderInline {SPAN} at (0,0) size 56x56
  +        RenderInline {SPAN} at (0,0) size 80x56
             RenderBR {BR} at (14,14) size 0x28
  -          RenderText {TEXT} at (14,42) size 56x28
  -            text run at (14,42) width 56: "    foo"
  +          RenderInline {SPAN} at (0,0) size 48x28
  +            RenderText {TEXT} at (14,42) size 48x28
  +              text run at (14,42) width 48: "\x{9}"
  +          RenderText {TEXT} at (62,42) size 32x28
  +            text run at (62,42) width 32: "foo"
           RenderText {TEXT} at (0,0) size 0x0
  -caret: position 4 of child 1 {TEXT} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  +caret: position 1 of child 0 {TEXT} of child 1 {SPAN} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  
  
  
  1.5       +1 -2      WebCore/layout-tests/editing/deleting/delete-tab-004.html
  
  Index: delete-tab-004.html
  ===================================================================
  RCS file: /cvs/root/WebCore/layout-tests/editing/deleting/delete-tab-004.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- delete-tab-004.html	5 Jul 2005 23:21:19 -0000	1.4
  +++ delete-tab-004.html	29 Jul 2005 23:42:56 -0000	1.5
  @@ -16,8 +16,7 @@
       insertLineBreakCommand();
       typeCharacterCommand('\t');
       typeCharacterCommand('\t');
  -    for (i = 0; i < 4; i++)
  -        deleteCommand();
  +    deleteCommand();
   }
   
   </script>
  
  
  
  1.9       +7 -4      WebCore/layout-tests/editing/inserting/insert-tab-001-expected.txt
  
  Index: insert-tab-001-expected.txt
  ===================================================================
  RCS file: /cvs/root/WebCore/layout-tests/editing/inserting/insert-tab-001-expected.txt,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- insert-tab-001-expected.txt	6 Jul 2005 18:49:01 -0000	1.8
  +++ insert-tab-001-expected.txt	29 Jul 2005 23:42:57 -0000	1.9
  @@ -4,8 +4,11 @@
     RenderBlock {HTML} at (0,0) size 800x600
       RenderBody {BODY} at (8,8) size 784x584
         RenderBlock {DIV} at (0,0) size 784x56 [border: (2px solid #FF0000)]
  -        RenderInline {SPAN} at (0,0) size 56x28
  -          RenderText {TEXT} at (14,14) size 56x28
  -            text run at (14,14) width 56: "    foo"
  +        RenderInline {SPAN} at (0,0) size 80x28
  +          RenderInline {SPAN} at (0,0) size 48x28
  +            RenderText {TEXT} at (14,14) size 48x28
  +              text run at (14,14) width 48: "\x{9}"
  +          RenderText {TEXT} at (62,14) size 32x28
  +            text run at (62,14) width 32: "foo"
           RenderText {TEXT} at (0,0) size 0x0
  -caret: position 4 of child 0 {TEXT} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  +caret: position 1 of child 0 {TEXT} of child 0 {SPAN} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  
  
  
  1.9       +7 -4      WebCore/layout-tests/editing/inserting/insert-tab-002-expected.txt
  
  Index: insert-tab-002-expected.txt
  ===================================================================
  RCS file: /cvs/root/WebCore/layout-tests/editing/inserting/insert-tab-002-expected.txt,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- insert-tab-002-expected.txt	6 Jul 2005 18:49:02 -0000	1.8
  +++ insert-tab-002-expected.txt	29 Jul 2005 23:42:57 -0000	1.9
  @@ -4,8 +4,11 @@
     RenderBlock {HTML} at (0,0) size 800x600
       RenderBody {BODY} at (8,8) size 784x584
         RenderBlock {DIV} at (0,0) size 784x56 [border: (2px solid #FF0000)]
  -        RenderInline {SPAN} at (0,0) size 56x28
  -          RenderText {TEXT} at (14,14) size 56x28
  -            text run at (14,14) width 56: "foo    "
  +        RenderInline {SPAN} at (0,0) size 48x28
  +          RenderText {TEXT} at (14,14) size 32x28
  +            text run at (14,14) width 32: "foo"
  +          RenderInline {SPAN} at (0,0) size 16x28
  +            RenderText {TEXT} at (46,14) size 16x28
  +              text run at (46,14) width 16: "\x{9}"
           RenderText {TEXT} at (0,0) size 0x0
  -caret: position 7 of child 0 {TEXT} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  +caret: position 1 of child 0 {TEXT} of child 1 {SPAN} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  
  
  
  1.8       +9 -4      WebCore/layout-tests/editing/inserting/insert-tab-003-expected.txt
  
  Index: insert-tab-003-expected.txt
  ===================================================================
  RCS file: /cvs/root/WebCore/layout-tests/editing/inserting/insert-tab-003-expected.txt,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- insert-tab-003-expected.txt	6 Jul 2005 18:49:02 -0000	1.7
  +++ insert-tab-003-expected.txt	29 Jul 2005 23:42:57 -0000	1.8
  @@ -4,8 +4,13 @@
     RenderBlock {HTML} at (0,0) size 800x600
       RenderBody {BODY} at (8,8) size 784x584
         RenderBlock {DIV} at (0,0) size 784x56 [border: (2px solid #FF0000)]
  -        RenderInline {SPAN} at (0,0) size 56x28
  -          RenderText {TEXT} at (14,14) size 56x28
  -            text run at (14,14) width 56: "fo    o"
  +        RenderInline {SPAN} at (0,0) size 60x28
  +          RenderText {TEXT} at (14,14) size 20x28
  +            text run at (14,14) width 20: "fo"
  +          RenderInline {SPAN} at (0,0) size 28x28
  +            RenderText {TEXT} at (34,14) size 28x28
  +              text run at (34,14) width 28: "\x{9}"
  +          RenderText {TEXT} at (62,14) size 12x28
  +            text run at (62,14) width 12: "o"
           RenderText {TEXT} at (0,0) size 0x0
  -caret: position 6 of child 0 {TEXT} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  +caret: position 1 of child 0 {TEXT} of child 1 {SPAN} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  
  
  
  1.9       +7 -4      WebCore/layout-tests/editing/inserting/insert-tab-004-expected.txt
  
  Index: insert-tab-004-expected.txt
  ===================================================================
  RCS file: /cvs/root/WebCore/layout-tests/editing/inserting/insert-tab-004-expected.txt,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- insert-tab-004-expected.txt	6 Jul 2005 18:49:02 -0000	1.8
  +++ insert-tab-004-expected.txt	29 Jul 2005 23:42:57 -0000	1.9
  @@ -4,9 +4,12 @@
     RenderBlock {HTML} at (0,0) size 800x600
       RenderBody {BODY} at (8,8) size 784x584
         RenderBlock {DIV} at (0,0) size 784x84 [border: (2px solid #FF0000)]
  -        RenderInline {SPAN} at (0,0) size 56x56
  +        RenderInline {SPAN} at (0,0) size 80x56
             RenderBR {BR} at (14,14) size 0x28
  -          RenderText {TEXT} at (14,42) size 56x28
  -            text run at (14,42) width 56: "    foo"
  +          RenderInline {SPAN} at (0,0) size 48x28
  +            RenderText {TEXT} at (14,42) size 48x28
  +              text run at (14,42) width 48: "\x{9}"
  +          RenderText {TEXT} at (62,42) size 32x28
  +            text run at (62,42) width 32: "foo"
           RenderText {TEXT} at (0,0) size 0x0
  -caret: position 4 of child 1 {TEXT} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  +caret: position 1 of child 0 {TEXT} of child 1 {SPAN} of child 1 {SPAN} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  
  
  
  1.6       +3 -3      WebCore/layout-tests/fast/js/string-replace-2-expected.txt
  
  Index: string-replace-2-expected.txt
  ===================================================================
  RCS file: /cvs/root/WebCore/layout-tests/fast/js/string-replace-2-expected.txt,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- string-replace-2-expected.txt	6 Jul 2005 18:49:05 -0000	1.5
  +++ string-replace-2-expected.txt	29 Jul 2005 23:42:58 -0000	1.6
  @@ -17,7 +17,7 @@
   Support for String.replace(/…/,myFunction)
   
   function Capitalize(s){
  -        return s.toUpperCase();
  +	return s.toUpperCase();
   }
   result = foo.replace(vowels,Capitalize);
   Expected result: "It's thE End Of thE wOrld As wE knOw It, And I fEEl fInE."
  @@ -26,7 +26,7 @@
   Support for String.replace(/…/,myFunction), using RegExp
   
   function Capitalize(){
  -        return RegExp.$1.toUpperCase()+RegExp.$2;
  +	return RegExp.$1.toUpperCase()+RegExp.$2;
   }
   result = foo.replace(/([aeiou])([a-z])/g,Capitalize);
   Expected result: "It's the End Of the wOrld As we knOw It, And I fEel fIne."
  @@ -35,7 +35,7 @@
   Support for String.replace(/…/,myFunction), using parameters
   
   function Capitalize(orig,re1,re2){
  -        return re1.toUpperCase()+re2;
  +	return re1.toUpperCase()+re2;
   }
   result = foo.replace(/([aeiou])([a-z])/g,Capitalize);
   Expected result: "It's the End Of the wOrld As we knOw It, And I fEel fIne."
  
  
  
  1.9       +2 -10     WebCore/layout-tests/fast/table/039-expected.txt
  
  Index: 039-expected.txt
  ===================================================================
  RCS file: /cvs/root/WebCore/layout-tests/fast/table/039-expected.txt,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- 039-expected.txt	6 Jul 2005 18:49:06 -0000	1.8
  +++ 039-expected.txt	29 Jul 2005 23:42:58 -0000	1.9
  @@ -42,19 +42,11 @@
             RenderText {TEXT} at (0,0) size 49x18
               text run at (0,0) width 49: "Row 0:"
           RenderText {TEXT} at (49,0) size 170x18
  -          text run at (49,0) width 38: " (1,1) "
  -          text run at (87,0) width 34: "(1,2) "
  -          text run at (121,0) width 34: "(1,3) "
  -          text run at (155,0) width 34: "(1,4) "
  -          text run at (189,0) width 30: "(1,5)"
  +          text run at (49,0) width 170: " (1,1)\x{9}(1,2)\x{9}(1,3)\x{9}(1,4)\x{9}(1,5)"
           RenderBR {BR} at (0,0) size 0x0
           RenderInline {B} at (0,0) size 49x18
             RenderText {TEXT} at (0,18) size 49x18
               text run at (0,18) width 49: "Row 1:"
           RenderText {TEXT} at (49,18) size 170x18
  -          text run at (49,18) width 38: " (2,1) "
  -          text run at (87,18) width 34: "(2,2) "
  -          text run at (121,18) width 34: "(2,3) "
  -          text run at (155,18) width 34: "(2,4) "
  -          text run at (189,18) width 30: "(2,5)"
  +          text run at (49,18) width 170: " (2,1)\x{9}(2,2)\x{9}(2,3)\x{9}(2,4)\x{9}(2,5)"
           RenderBR {BR} at (0,0) size 0x0
  
  
  
  1.10      +1 -1      WebCore/layout-tests/fast/table/border-collapsing/004-expected.txt
  
  Index: 004-expected.txt
  ===================================================================
  RCS file: /cvs/root/WebCore/layout-tests/fast/table/border-collapsing/004-expected.txt,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- 004-expected.txt	19 Jul 2005 21:18:24 -0000	1.9
  +++ 004-expected.txt	29 Jul 2005 23:42:58 -0000	1.10
  @@ -28,7 +28,7 @@
             text run at (0,120) width 328: "TABLE.five { border-collapse: separate; }"
             text run at (0,135) width 464: "TABLE.five, TABLE.five TD, TABLE.five TH { border: none; }"
             text run at (0,150) width 688: "TABLE.five TR, TABLE.five COL, TABLE.five COLGROUP, TABLE.five TBODY, TABLE.five THEAD"
  -          text run at (0,165) width 296: "        { border: medium solid red; }"
  +          text run at (0,165) width 296: "\x{9}{ border: medium solid red; }"
         RenderTable {TABLE} at (16,288) size 752x163
           RenderTableSection {TBODY} at (0,0) size 0x163
             RenderTableRow {TR} at (0,0) size 0x0
  
  
  
  1.7       +1 -1      WebCore/layout-tests/fast/tokenizer/script_extra_close-expected.txt
  
  Index: script_extra_close-expected.txt
  ===================================================================
  RCS file: /cvs/root/WebCore/layout-tests/fast/tokenizer/script_extra_close-expected.txt,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- script_extra_close-expected.txt	9 Jul 2005 20:19:28 -0000	1.6
  +++ script_extra_close-expected.txt	29 Jul 2005 23:42:59 -0000	1.7
  @@ -4,7 +4,7 @@
     RenderBlock {HTML} at (0,0) size 800x600
       RenderBody {BODY} at (8,8) size 784x584
         RenderText {TEXT} at (0,0) size 55x18
  -        text run at (0,0) width 55: "TEST... "
  +        text run at (0,0) width 55: "TEST...\x{9}"
         RenderText {TEXT} at (0,0) size 0x0
         RenderText {TEXT} at (55,0) size 232x18
           text run at (55,0) width 69: "PASSED. "
  
  
  



More information about the webkit-changes mailing list