[webkit-changes] cvs commit: WebKit/WebCoreSupport.subproj
WebTextRenderer.m
Adele
adele at opensource.apple.com
Tue Jul 5 16:21:32 PDT 2005
adele 05/07/05 16:21:31
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/dom quadraticCurveTo-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
. ChangeLog
WebCoreSupport.subproj WebTextRenderer.m
Log:
WebCore:
Rolling out changes for <rdar://problem/3792529> REGRESSION (Mail): Tabs do not work the way they did in Panther (especially useful in plain text mail)
since it caused a 2% performance regression.
* khtml/editing/apply_style_command.cpp:
(khtml::createStyleSpanElement):
(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/editing/htmlediting.h:
* khtml/editing/insert_text_command.cpp:
(khtml::InsertTextCommand::prepareForTextInsertion):
(khtml::InsertTextCommand::input):
* khtml/editing/insert_text_command.h:
* khtml/editing/markup.cpp:
(khtml::createFragmentFromText):
* khtml/editing/replace_selection_command.cpp:
(khtml::ReplacementFragment::removeStyleNodes):
* khtml/html/htmltokenizer.cpp:
(khtml::HTMLTokenizer::begin):
(khtml::HTMLTokenizer::processListing):
(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::computeHorizontalPositionsForLine):
(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::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::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::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::drawText):
(QPainter::drawHighlightForText):
* 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/dom/quadraticCurveTo-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:
WebKit:
Rolling out changes for <rdar://problem/3792529> REGRESSION (Mail): Tabs do not work the way they did in Panther (especially useful in plain text mail)
since it caused a 2% performance regression.
* WebCoreSupport.subproj/WebTextRenderer.m:
(isSpace):
(-[WebTextRenderer _CG_drawHighlightForRun:style:geometry:]):
(-[WebTextRenderer _CG_floatWidthForRun:style:widths:fonts:glyphs:startPosition:numGlyphs:]):
(-[WebTextRenderer _extendCharacterToGlyphMapToInclude:]):
(-[WebTextRenderer _CG_pointToOffset:style:position:reversed:includePartialGlyphs:]):
(initializeCharacterWidthIterator):
(widthForNextCharacter):
Revision Changes Path
1.4370 +124 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4369
retrieving revision 1.4370
diff -u -r1.4369 -r1.4370
--- ChangeLog 5 Jul 2005 21:28:55 -0000 1.4369
+++ ChangeLog 5 Jul 2005 23:21:04 -0000 1.4370
@@ -1,3 +1,127 @@
+2005-07-05 Adele Peterson <adele at apple.com>
+
+ Rolling out changes for <rdar://problem/3792529> REGRESSION (Mail): Tabs do not work the way they did in Panther (especially useful in plain text mail)
+ since it caused a 2% performance regression.
+
+ * khtml/editing/apply_style_command.cpp:
+ (khtml::createStyleSpanElement):
+ (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/editing/htmlediting.h:
+ * khtml/editing/insert_text_command.cpp:
+ (khtml::InsertTextCommand::prepareForTextInsertion):
+ (khtml::InsertTextCommand::input):
+ * khtml/editing/insert_text_command.h:
+ * khtml/editing/markup.cpp:
+ (khtml::createFragmentFromText):
+ * khtml/editing/replace_selection_command.cpp:
+ (khtml::ReplacementFragment::removeStyleNodes):
+ * khtml/html/htmltokenizer.cpp:
+ (khtml::HTMLTokenizer::begin):
+ (khtml::HTMLTokenizer::processListing):
+ (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::computeHorizontalPositionsForLine):
+ (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::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::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::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::drawText):
+ (QPainter::drawHighlightForText):
+ * 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/dom/quadraticCurveTo-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-05 Beth Dakin <bdakin at apple.com>
Adding colspan test for HTMLTableElement and bdo test for HTMLElement.
1.4 +1 -8 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- apply_style_command.cpp 30 Jun 2005 01:27:38 -0000 1.3
+++ apply_style_command.cpp 5 Jul 2005 23:21:07 -0000 1.4
@@ -32,7 +32,6 @@
#include "css/cssparser.h"
#include "css/cssproperties.h"
#include "dom/dom_string.h"
-#include "htmlediting.h"
#include "html/html_elementimpl.h"
#include "misc/htmltags.h"
#include "misc/htmlattrs.h"
@@ -285,7 +284,7 @@
ElementImpl *createStyleSpanElement(DocumentImpl *document)
{
int exceptionCode = 0;
- ElementImpl *styleElement = document->createHTMLElement("span", exceptionCode);
+ ElementImpl *styleElement = document->createHTMLElement("SPAN", exceptionCode);
ASSERT(exceptionCode == 0);
styleElement->setAttribute(ATTR_CLASS, styleSpanClassString());
return styleElement;
@@ -679,8 +678,6 @@
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();
@@ -1251,10 +1248,6 @@
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.4 +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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- delete_selection_command.cpp 30 Jun 2005 01:27:38 -0000 1.3
+++ delete_selection_command.cpp 5 Jul 2005 23:21:07 -0000 1.4
@@ -267,7 +267,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 = positionBeforeTabSpan(m_selectionToDelete.start()).computedStyle();
+ CSSComputedStyleDeclarationImpl *computedStyle = m_selectionToDelete.start().computedStyle();
computedStyle->ref();
m_typingStyle = computedStyle->copyInheritableProperties();
m_typingStyle->ref();
1.5 +1 -2 WebCore/khtml/editing/edit_command.cpp
Index: edit_command.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/edit_command.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- edit_command.cpp 30 Jun 2005 01:27:38 -0000 1.4
+++ edit_command.cpp 5 Jul 2005 23:21:07 -0000 1.5
@@ -26,7 +26,6 @@
#include "edit_command.h"
#include "selection.h"
#include "khtml_part.h"
-#include "htmlediting.h"
#include "xml/dom_position.h"
#include "xml/dom_docimpl.h"
@@ -390,7 +389,7 @@
CSSMutableStyleDeclarationImpl *EditCommand::styleAtPosition(const Position &pos)
{
- CSSComputedStyleDeclarationImpl *computedStyle = positionBeforeTabSpan(pos).computedStyle();
+ CSSComputedStyleDeclarationImpl *computedStyle = pos.computedStyle();
computedStyle->ref();
CSSMutableStyleDeclarationImpl *style = computedStyle->copyInheritableProperties();
computedStyle->deref();
1.7 +0 -1 WebCore/khtml/editing/html_interchange.h
Index: html_interchange.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/html_interchange.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- html_interchange.h 30 Jun 2005 01:27:38 -0000 1.6
+++ html_interchange.h 5 Jul 2005 23:21:08 -0000 1.7
@@ -32,7 +32,6 @@
#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.249 +6 -55 WebCore/khtml/editing/htmlediting.cpp
Index: htmlediting.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/htmlediting.cpp,v
retrieving revision 1.248
retrieving revision 1.249
diff -u -r1.248 -r1.249
--- htmlediting.cpp 30 Jun 2005 01:27:38 -0000 1.248
+++ htmlediting.cpp 5 Jul 2005 23:21:08 -0000 1.249
@@ -126,11 +126,8 @@
return 1;
}
-bool isSpecialElement(const NodeImpl *n)
+bool isSpecialElement(NodeImpl *n)
{
- if (!n)
- return false;
-
if (!n->isHTMLElement())
return false;
@@ -141,18 +138,16 @@
return true;
RenderObject *renderer = n->renderer();
- if (!renderer)
- return false;
-
- if (renderer->style()->display() == TABLE || renderer->style()->display() == INLINE_TABLE)
+
+ if (renderer && (renderer->style()->display() == TABLE || renderer->style()->display() == INLINE_TABLE))
return true;
- if (renderer->style()->isFloating())
+ if (renderer && renderer->style()->isFloating())
return true;
- if (renderer->style()->position() != STATIC)
+ if (renderer && renderer->style()->position() != STATIC)
return true;
-
+
return false;
}
@@ -285,50 +280,6 @@
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->createHTMLElement("span", exceptionCode);
- assert(exceptionCode == 0);
- spanElement->setAttribute(ATTR_CLASS, AppleTabSpanClass);
- spanElement->setAttribute(ATTR_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.108 +2 -8 WebCore/khtml/editing/htmlediting.h
Index: htmlediting.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/htmlediting.h,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -r1.107 -r1.108
--- htmlediting.h 30 Jun 2005 01:27:38 -0000 1.107
+++ htmlediting.h 5 Jul 2005 23:21:08 -0000 1.108
@@ -58,21 +58,15 @@
//------------------------------------------------------------------------------------------
-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.4 +63 -115 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- insert_text_command.cpp 30 Jun 2005 01:56:12 -0000 1.3
+++ insert_text_command.cpp 5 Jul 2005 23:21:08 -0000 1.4
@@ -27,11 +27,9 @@
#include "khtml_part.h"
#include "htmlediting.h"
-#include "html_interchange.h"
#include "visible_position.h"
#include "visible_text.h"
#include "visible_units.h"
-#include "misc/htmlattrs.h"
#include "xml/dom_docimpl.h"
#include "xml/dom_position.h"
#include "xml/dom_textimpl.h"
@@ -62,10 +60,23 @@
{
}
-Position InsertTextCommand::prepareForTextInsertion(const Position& pos)
+Position InsertTextCommand::prepareForTextInsertion(bool adjustDownstream)
{
- // Prepare for text input by looking at the specified position.
+ // Prepare for text input by looking at the current 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;
@@ -86,35 +97,14 @@
else
ASSERT_NOT_REACHED();
- 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);
+ pos = Position(textNode, 0);
}
return pos;
}
+static const int spacesPerTab = 4;
+
static inline bool isNBSP(const QChar &c)
{
return c.unicode() == 0xa0;
@@ -135,51 +125,59 @@
// out correctly after the insertion.
selection = endingSelection();
deleteInsignificantTextDownstream(selection.end().trailingWhitespacePosition(selection.endAffinity()));
-
- // Figure out the startPosition
- Position startPosition = selection.start();
+
+ // Make sure the document is set up to receive text
+ Position startPosition = prepareForTextInsertion(adjustDownstream);
+
Position endPosition;
- if (adjustDownstream)
- startPosition = startPosition.downstream();
- else
- startPosition = startPosition.upstream();
- startPosition = positionOutsideContainingSpecialElement(startPosition);
+
+ 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());
+ // 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") {
- 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 == " ") {
+ // 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++) {
insertSpace(textNode, offset);
- endPosition = Position(textNode, offset + 1);
-
- m_charactersAdded++;
rebalanceWhitespace();
+ document()->updateLayout();
}
- 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());
+
+ endPosition = Position(textNode, offset + spacesPerTab);
- m_charactersAdded += 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, " ");
}
+ insertTextIntoNode(textNode, offset, text);
+ endPosition = Position(textNode, offset + text.length());
+
+ m_charactersAdded += text.length();
}
setEndingSelection(Selection(startPosition, DOWNSTREAM, endPosition, SEL_DEFAULT_AFFINITY));
@@ -195,56 +193,6 @@
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.3 +1 -2 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- insert_text_command.h 30 Jun 2005 01:27:38 -0000 1.2
+++ insert_text_command.h 5 Jul 2005 23:21:08 -0000 1.3
@@ -45,9 +45,8 @@
private:
virtual bool isInsertTextCommand() const;
- DOM::Position prepareForTextInsertion(const DOM::Position& pos);
+ DOM::Position prepareForTextInsertion(bool adjustDownstream);
void insertSpace(DOM::TextImpl *textNode, unsigned long offset);
- DOM::Position insertTab(DOM::Position pos);
unsigned long m_charactersAdded;
};
1.23 +13 -48 WebCore/khtml/editing/markup.cpp
Index: markup.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/markup.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- markup.cpp 30 Jun 2005 01:56:12 -0000 1.22
+++ markup.cpp 5 Jul 2005 23:21:08 -0000 1.23
@@ -485,53 +485,6 @@
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)
@@ -543,6 +496,10 @@
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();
@@ -588,8 +545,16 @@
element->setAttribute(ATTR_CLASS, AppleInterchangeNewline);
} else {
element = createDefaultParagraphElement(document);
- createParagraphContentsFromString(document, element, s);
+ NodeImpl *paragraphContents;
+ if (s.isEmpty()) {
+ paragraphContents = createBlockPlaceholderElement(document);
+ } else {
+ paragraphContents = document->createTextNode(s);
+ ASSERT(exceptionCode == 0);
+ }
element->ref();
+ element->appendChild(paragraphContents, exceptionCode);
+ ASSERT(exceptionCode == 0);
}
fragment->appendChild(element, exceptionCode);
ASSERT(exceptionCode == 0);
1.4 +2 -4 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- replace_selection_command.cpp 30 Jun 2005 01:27:38 -0000 1.3
+++ replace_selection_command.cpp 5 Jul 2005 23:21:08 -0000 1.4
@@ -500,7 +500,7 @@
void ReplacementFragment::removeStyleNodes()
{
// Since style information has been computed and cached away in
- // computeStylesUsingTestRendering(), these style nodes can be removed, since
+ // computeStylesForNodes(), these style nodes can be removed, since
// the correct styles will be added back in fixupNodeStyles().
NodeImpl *node = m_fragment->firstChild();
while (node) {
@@ -522,9 +522,7 @@
isStyleSpan(node)) {
removeNodePreservingChildren(node);
}
- // need to skip tab span because fixupNodeStyles() is not called
- // when replace is matching style
- else if (node->isHTMLElement() && !isTabSpanNode(node)) {
+ else if (node->isHTMLElement()) {
HTMLElementImpl *elem = static_cast<HTMLElementImpl *>(node);
CSSMutableStyleDeclarationImpl *inlineStyleDecl = elem->inlineStyleDecl();
if (inlineStyleDecl) {
1.95 +59 -8 WebCore/khtml/html/htmltokenizer.cpp
Index: htmltokenizer.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/htmltokenizer.cpp,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -r1.94 -r1.95
--- htmltokenizer.cpp 30 Jun 2005 01:27:40 -0000 1.94
+++ htmltokenizer.cpp 5 Jul 2005 23:21:10 -0000 1.95
@@ -311,6 +311,8 @@
tag = NoTag;
pending = NonePending;
discard = NoneDiscard;
+ pre = false;
+ prePos = 0;
plaintext = false;
xmp = false;
processingInstruction = false;
@@ -347,11 +349,16 @@
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();
+ checkBuffer(3*TAB_SIZE);
if (skipLF && ( *list != '\n' ))
{
@@ -384,11 +391,14 @@
}
++list;
}
- else if ( *list == ' ' )
+ else if (( *list == ' ' ) || ( *list == '\t'))
{
if (pending)
addPending();
- pending = SpacePending;
+ if (*list == ' ')
+ pending = SpacePending;
+ else
+ pending = TabPending;
++list;
}
@@ -398,6 +408,7 @@
if (pending)
addPending();
+ prePos++;
*dest++ = *list;
++list;
}
@@ -406,6 +417,10 @@
if (pending)
addPending();
+
+ prePos = 0;
+
+ pre = old_pre;
}
void HTMLTokenizer::parseSpecial(TokenizerString &src)
@@ -926,6 +941,8 @@
for(unsigned int i = 0; i < cBufferPos; i++)
dest[i] = cBuffer[i];
dest += cBufferPos;
+ if (pre)
+ prePos += cBufferPos+1;
}
Entity = NoEntity;
@@ -1397,8 +1414,17 @@
processToken();
+ // we have to take care to close the pre block in
+ // case we encounter an unallowed element....
+ if(pre && beginTag && !DOM::checkChild(ID_PRE, tagID, !parser->doc()->inCompatMode())) {
+ kdDebug(6036) << " not allowed in <pre> " << (int)tagID << endl;
+ pre = false;
+ }
+
switch( tagID ) {
case ID_PRE:
+ prePos = 0;
+ pre = beginTag;
discard = LFDiscard; // Discard the first LF after we open a pre.
break;
case ID_SCRIPT:
@@ -1469,24 +1495,40 @@
else if ( textarea || script )
{
switch(pending) {
- case LFPending: *dest++ = '\n'; break;
- case SpacePending: *dest++ = ' '; break;
+ case LFPending: *dest++ = '\n'; prePos = 0; break;
+ case SpacePending: *dest++ = ' '; ++prePos; break;
+ case TabPending: *dest++ = '\t'; prePos += TAB_SIZE - (prePos % TAB_SIZE); 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:
@@ -1641,7 +1683,9 @@
}; // end case
if ( pending ) {
- if ( script || (!parser->selectMode() && (!parser->noSpaces() || dest > buffer )))
+ // pre context always gets its spaces/linefeeds
+ if ( pre || script || (!parser->selectMode() &&
+ (!parser->noSpaces() || dest > buffer )))
addPending();
// just forget it
else
@@ -1711,7 +1755,7 @@
}
++src;
}
- else if (cc == ' ')
+ else if (( cc == ' ' ) || ( cc == '\t' ))
{
if (select && !script) {
if(discard == SpaceDiscard)
@@ -1728,7 +1772,10 @@
if (pending)
addPending();
- pending = SpacePending;
+ if (cc == ' ')
+ pending = SpacePending;
+ else
+ pending = TabPending;
}
++src;
@@ -1739,6 +1786,10 @@
addPending();
discard = NoneDiscard;
+ if ( pre )
+ {
+ prePos++;
+ }
#if QT_VERSION < 300
unsigned char row = src->row();
if ( row > 0x05 && row < 0x10 || row > 0xfd )
1.36 +10 -0 WebCore/khtml/html/htmltokenizer.h
Index: htmltokenizer.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/htmltokenizer.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- htmltokenizer.h 30 Jun 2005 01:27:40 -0000 1.35
+++ htmltokenizer.h 5 Jul 2005 23:21:10 -0000 1.36
@@ -116,6 +116,9 @@
bool flat;
};
+// The count of spaces used for each tab.
+#define TAB_SIZE 8
+
//-----------------------------------------------------------------------------
class HTMLTokenizer : public Tokenizer, public CachedObjectClient
@@ -204,6 +207,7 @@
NonePending = 0,
SpacePending,
LFPending,
+ TabPending
} pending;
// Discard line breaks immediately after start-tags
@@ -251,6 +255,12 @@
// 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.132 +21 -35 WebCore/khtml/rendering/bidi.cpp
Index: bidi.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/bidi.cpp,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -r1.131 -r1.132
--- bidi.cpp 30 Jun 2005 01:27:40 -0000 1.131
+++ bidi.cpp 5 Jul 2005 23:21:10 -0000 1.132
@@ -386,7 +386,7 @@
if (text->text()) {
for (int i = bidiRun->start; i < bidiRun->stop; i++) {
const QChar c = text->text()[i];
- if (c == ' ' || c == '\n' || c == '\t')
+ if (c == ' ' || c == '\n')
numSpaces++;
}
}
@@ -714,20 +714,6 @@
return lastRootBox();
}
-// usage: tw - (xpos % tw);
-int RenderBlock::tabWidth(bool isWhitespacePre)
-{
- if (!isWhitespacePre)
- return 0;
-
- QChar spaceChar(' ');
- const Font& font = style()->htmlFont();
- int tw = font.width(&spaceChar, 1, 0, 0);
- tw *= 8;
-
- return tw;
-}
-
void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, BidiState &bidi)
{
// First determine our total width.
@@ -739,7 +725,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, totWidth, m_firstLine);
+ int textWidth = static_cast<RenderText *>(r->obj)->width(r->start, r->stop-r->start, m_firstLine);
if (!r->compact) {
RenderStyle *style = r->obj->style();
if (style->whiteSpace() == NORMAL && style->khtmlLineBreak() == AFTER_WHITE_SPACE) {
@@ -811,7 +797,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' || c == '\t')
+ if (c == ' ' || c == '\n')
spaces++;
}
@@ -1790,7 +1776,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() == '\t' || it.current() == '\n' ||
+ (it.current() == ' ' || it.current() == '\n' ||
skipNonBreakingSpace(it) || it.obj->isFloatingOrPositioned())))) {
if (it.obj->isFloatingOrPositioned()) {
RenderObject *o = it.obj;
@@ -2000,12 +1986,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) {
- 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)) {
+ 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') {
currentCharacterIsSpace = true;
currentCharacterIsWS = true;
ignoringSpaces = true;
@@ -2036,7 +2022,7 @@
bool previousCharacterIsSpace = currentCharacterIsSpace;
bool previousCharacterIsWS = currentCharacterIsWS;
const QChar c = str[pos];
- currentCharacterIsSpace = c == ' ' || (!isPre && (c == '\n' || c == '\t'));
+ currentCharacterIsSpace = c == ' ' || (!isPre && c == '\n');
if (isPre || !currentCharacterIsSpace)
isLineEmpty = false;
@@ -2049,12 +2035,12 @@
addMidpoint(endMid);
// Add the width up to but not including the hyphen.
- tmpW += t->width(lastSpace, pos - lastSpace, f, w+tmpW);
+ tmpW += t->width(lastSpace, pos - lastSpace, f);
// 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, w+tmpW);
+ tmpW += t->width(pos, 1, f);
BidiIterator startMid(0, o, pos+1);
addMidpoint(startMid);
@@ -2074,8 +2060,8 @@
currentCharacterIsWS = currentCharacterIsSpace || (breakNBSP && c.unicode() == nonBreakingSpace);
if (breakWords)
- wrapW += t->width(pos, 1, f, w+wrapW);
- if (c == '\n' || (!isPre && isBreakable(str, pos, strlen, breakNBSP)) || (breakWords && wrapW > width)) {
+ wrapW += t->width(pos, 1, f);
+ if ((isPre && c == '\n') || (!isPre && isBreakable(str, pos, strlen, breakNBSP)) || (breakWords && wrapW > width)) {
if (ignoringSpaces) {
if (!currentCharacterIsSpace) {
// Stop ignoring spaces and begin at this
@@ -2092,7 +2078,7 @@
}
}
- tmpW += t->width(lastSpace, pos - lastSpace, f, w+tmpW);
+ tmpW += t->width(lastSpace, pos - lastSpace, f);
if (!appliedStartWidth) {
tmpW += inlineWidth(o, true, false);
appliedStartWidth = true;
@@ -2128,7 +2114,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, w+tmpW) : 0;
+ int charWidth = o->style()->khtmlLineBreak() == AFTER_WHITE_SPACE ? t->width(pos, 1, f) : 0;
if (w + tmpW + charWidth > width) {
if (o->style()->khtmlLineBreak() == AFTER_WHITE_SPACE) {
// Check if line is too big even without the extra space
@@ -2146,7 +2132,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, w+tmpW);
+ tmpW -= t->width(pos-1, 1, f);
}
if( *(str+pos) == '\n' && isPre) {
@@ -2218,7 +2204,7 @@
// IMPORTANT: pos is > length here!
if (!ignoringSpaces)
- tmpW += t->width(lastSpace, pos - lastSpace, f, w+tmpW);
+ tmpW += t->width(lastSpace, pos - lastSpace, f);
if (!appliedStartWidth)
tmpW += inlineWidth(o, true, false);
if (!appliedEndWidth)
@@ -2422,8 +2408,8 @@
static AtomicString ellipsisStr(ellipsis);
const Font& firstLineFont = style(true)->htmlFont();
const Font& font = style()->htmlFont();
- int firstLineEllipsisWidth = firstLineFont.width(&ellipsis, 1, 0, 0);
- int ellipsisWidth = (font == firstLineFont) ? firstLineEllipsisWidth : font.width(&ellipsis, 1, 0, 0);
+ int firstLineEllipsisWidth = firstLineFont.width(&ellipsis, 1, 0);
+ int ellipsisWidth = (font == firstLineFont) ? firstLineEllipsisWidth : font.width(&ellipsis, 1, 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.19 +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.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- break_lines.cpp 30 Jun 2005 01:27:40 -0000 1.18
+++ break_lines.cpp 5 Jul 2005 23:21:11 -0000 1.19
@@ -73,7 +73,7 @@
else // no asian font
return c->isSpace();
} else {
- if ( ch == ' ' || ch == '\t' || ch == '\n' )
+ if ( ch == ' ' || 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 == ' ' || ch == '\n' || ch == '\t' || (breakNBSP && ch == 0xa0))
+ if (ch == '\n' || ch == ' ' || (breakNBSP && ch == 0xa0))
return true;
// If current character, or the previous character aren't simple latin1 then
1.41 +18 -18 WebCore/khtml/rendering/font.cpp
Index: font.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/font.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- font.cpp 30 Jun 2005 01:27:40 -0000 1.40
+++ font.cpp 5 Jul 2005 23:21:11 -0000 1.41
@@ -40,20 +40,20 @@
using namespace khtml;
#if APPLE_CHANGES
-void Font::drawHighlightForText( QPainter *p, int x, int y, int h, int tabWidth, int xpos,
+void Font::drawHighlightForText( QPainter *p, int x, int y, int h,
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, tabWidth, xpos, str + pos, std::min(slen - pos, len), from, to, toAdd, bg, d, visuallyOrdered,
+ p->drawHighlightForText(x, y, h, 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, int tabWidth, int xpos, QChar *str, int slen, int pos, int len,
+void Font::drawText( QPainter *p, int x, int y, 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, tabWidth, xpos, str + pos, std::min(slen - pos, len), from, to, toAdd, bg, d, visuallyOrdered,
+ p->drawText(x, y, 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, tabWidth, xpos, qstr, pos, len, d );
+ p->drawText( x, y, 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, tabWidth, xpos, qstr, pos+i, 1, d );
+ p->drawText( x, y, 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, int tabWidth, int xpos ) const
+float Font::floatWidth( QChar *chs, int slen, int pos, int len ) const
{
- return fm.floatWidth(chs, slen, pos, len, tabWidth, xpos, letterSpacing, wordSpacing, fontDef.smallCaps);
+ return fm.floatWidth(chs, slen, pos, len, letterSpacing, wordSpacing, fontDef.smallCaps);
}
-void Font::floatCharacterWidths( QChar *str, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, float *buffer) const
+void Font::floatCharacterWidths( QChar *str, int slen, int pos, int len, int toAdd, float *buffer) const
{
- fm.floatCharacterWidths(str, slen, pos, len, toAdd, tabWidth, xpos, buffer, letterSpacing, wordSpacing, fontDef.smallCaps);
+ fm.floatCharacterWidths(str, slen, pos, len, toAdd, buffer, letterSpacing, wordSpacing, fontDef.smallCaps);
}
-int Font::checkSelectionPoint (QChar *s, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, int x, bool reversed, bool includePartialGlyphs) const
+int Font::checkSelectionPoint (QChar *s, int slen, int pos, int len, int toAdd, int x, bool reversed, bool includePartialGlyphs) const
{
- return fm.checkSelectionPoint (s, slen, pos, len, toAdd, tabWidth, xpos, letterSpacing, wordSpacing, fontDef.smallCaps, x, reversed, includePartialGlyphs);
+ return fm.checkSelectionPoint (s, slen, pos, len, toAdd, letterSpacing, wordSpacing, fontDef.smallCaps, x, reversed, includePartialGlyphs);
}
#endif
-int Font::width( QChar *chs, int slen, int pos, int len, int tabWidth, int xpos ) const
+int Font::width( QChar *chs, int slen, int pos, int len ) 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, tabWidth, xpos, letterSpacing, wordSpacing, fontDef.smallCaps));
+ return ROUND_TO_INT(fm.floatWidth(chs+pos, slen-pos, 0, len, 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 tabWidth, int xpos ) const
+int Font::width( QChar *chs, int slen, int pos ) const
{
#if APPLE_CHANGES
-// return ROUND_TO_INT(fm.floatWidth(chs, slen, pos, 1, tabWidth, xpos, letterSpacing, wordSpacing));
- return width(chs, slen, 0, 1, tabWidth, xpos);
+// return ROUND_TO_INT(fm.floatWidth(chs, slen, pos, 1, letterSpacing, wordSpacing));
+ return width(chs, slen, pos, 1);
#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.31 +8 -8 WebCore/khtml/rendering/font.h
Index: font.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/font.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- font.h 30 Jun 2005 01:27:40 -0000 1.30
+++ font.h 5 Jul 2005 23:21:11 -0000 1.31
@@ -120,22 +120,22 @@
#if !APPLE_CHANGES
- void drawText( QPainter *p, int x, int y, int tabWidth, int xpos, QChar *str, int slen, int pos, int len, int width,
+ void drawText( QPainter *p, int x, int y, 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, int tabWidth, int xpos, QChar *str, int slen, int pos, int len, int width,
+ void drawText( QPainter *p, int x, int y, 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, int tabWidth, int xpos ) const;
- void floatCharacterWidths( QChar *str, int slen, int pos, int len, int toAdd, int tabWidth, int xpos, float *buffer) 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;
bool isFixedPitch() const;
- 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,
+ 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,
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, int tabWidth, int xpos ) const;
- int width( QChar *str, int slen, int tabWidth, int xpos ) const;
+ int width( QChar *str, int slen, int pos, int len ) const;
+ int width( QChar *str, int slen, int pos ) const;
bool isSmallCaps() const { return fontDef.smallCaps; }
1.186 +3 -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.185
retrieving revision 1.186
diff -u -r1.185 -r1.186
--- render_block.cpp 30 Jun 2005 01:27:40 -0000 1.185
+++ render_block.cpp 5 Jul 2005 23:21:11 -0000 1.186
@@ -2796,7 +2796,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, 0);
+ int spaceWidth = f->width(space, 1, 0);
inlineMax -= spaceWidth;
if (inlineMin > inlineMax)
inlineMin = inlineMax;
@@ -2959,8 +2959,8 @@
int beginMin, endMin;
bool beginWS, endWS;
int beginMax, endMax;
- t->trimmedMinMaxWidth(inlineMax, beginMin, beginWS, endMin, endWS,
- hasBreakableChar, hasBreak, beginMax, endMax,
+ t->trimmedMinMaxWidth(beginMin, beginWS, endMin, endWS, hasBreakableChar,
+ hasBreak, beginMax, endMax,
childMin, childMax, stripFrontSpaces);
// This text object is insignificant and will not be rendered. Just
1.67 +0 -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.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- render_block.h 30 Jun 2005 01:27:40 -0000 1.66
+++ render_block.h 5 Jul 2005 23:21:11 -0000 1.67
@@ -131,7 +131,6 @@
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();
1.30 +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.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- render_br.h 30 Jun 2005 01:27:40 -0000 1.29
+++ render_br.h 5 Jul 2005 23:21:11 -0000 1.30
@@ -44,8 +44,8 @@
virtual QRect selectionRect() { return QRect(); }
- 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 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 short lineHeight(bool firstLine, bool isRootLineBox=false) const;
virtual short baselinePosition( bool firstLine, bool isRootLineBox=false) const;
1.24 +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.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- render_flexbox.cpp 30 Jun 2005 01:27:41 -0000 1.23
+++ render_flexbox.cpp 5 Jul 2005 23:21:11 -0000 1.24
@@ -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, 0, 0);
+ int ellipsisAndSpaceWidth = font.width(const_cast<QChar*>(ellipsisAndSpaceStr.unicode()), 2, 0, 2);
// Get ellipsis width + " " + anchor width
int totalWidth = ellipsisAndSpaceWidth + anchorBox->width();
1.77 +7 -6 WebCore/khtml/rendering/render_image.cpp
Index: render_image.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_image.cpp,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- render_image.cpp 5 Jul 2005 07:57:47 -0000 1.76
+++ render_image.cpp 5 Jul 2005 23:21:11 -0000 1.77
@@ -114,7 +114,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(), 0, 0); // FIX: correct tabwidth?
+ QRect br = fm.boundingRect ( 0, 0, 1024, 256, Qt::AlignAuto|Qt::WordBreak, alt.string() );
if ( br.width() > iw )
iw = br.width();
if ( br.height() > ih )
@@ -309,12 +309,13 @@
// 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, 0, 0, text.length());
+ int textWidth = fm.width (text, text.length());
if (errorPictureDrawn) {
if (usableWidth >= textWidth && fm.height() <= imageY)
- 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 );
+ 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 );
}
#else /* not APPLE_CHANGES */
if ( !berrorPic ) {
@@ -337,7 +338,7 @@
int ay = _ty + topBorder + topPad + 2;
const QFontMetrics &fm = style()->fontMetrics();
if (cWidth>5 && cHeight>=fm.height())
- p->drawText(ax, ay+1, tabWidth(), 0, cWidth - 4, cHeight - 4, Qt::WordBreak, text );
+ p->drawText(ax, ay+1, cWidth - 4, cHeight - 4, Qt::WordBreak, text );
}
#endif /* APPLE_CHANGES not defined */
}
1.43 +0 -1 WebCore/khtml/rendering/render_line.cpp
Index: render_line.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_line.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- render_line.cpp 30 Jun 2005 01:27:41 -0000 1.42
+++ render_line.cpp 5 Jul 2005 23:21:12 -0000 1.43
@@ -1042,7 +1042,6 @@
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.28 +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.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- render_line.h 30 Jun 2005 01:27:41 -0000 1.27
+++ render_line.h 5 Jul 2005 23:21:12 -0000 1.28
@@ -118,19 +118,19 @@
RootInlineBox* root();
void setWidth(int w) { m_width = w; }
- int width() const { return m_width; }
+ int width() { return m_width; }
void setXPos(int x) { m_x = x; }
- int xPos() const { return m_x; }
+ int xPos() { return m_x; }
void setYPos(int y) { m_y = y; }
- int yPos() const { return m_y; }
+ int yPos() { return m_y; }
void setHeight(int h) { m_height = h; }
- int height() const { return m_height; }
+ int height() { return m_height; }
void setBaseline(int b) { m_baseline = b; }
- int baseline() const { return m_baseline; }
+ int baseline() { return m_baseline; }
virtual bool hasTextChildren() { return true; }
1.62 +11 -12 WebCore/khtml/rendering/render_list.cpp
Index: render_list.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_list.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- render_list.cpp 30 Jun 2005 01:27:41 -0000 1.61
+++ render_list.cpp 5 Jul 2005 23:21:12 -0000 1.62
@@ -479,25 +479,25 @@
if (isInside()) {
if( style()->direction() == LTR) {
- 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(". "));
+ 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(". "));
}
else {
const QString& punct(QString::fromLatin1(" ."));
- 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);
+ 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);
}
} else {
if (style()->direction() == LTR) {
const QString& punct(QString::fromLatin1(". "));
- 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);
+ 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);
}
else {
const QString& punct(QString::fromLatin1(" ."));
- 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);
+ 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);
}
}
}
@@ -601,9 +601,8 @@
break;
}
- if (isInside()) {
- m_width = fm.width(m_item, 0, 0) + fm.width(QString::fromLatin1(". "), 0, 0);
- }
+ if (isInside())
+ m_width = fm.width(m_item) + fm.width(QString::fromLatin1(". "));
end:
1.197 +3 -5 WebCore/khtml/rendering/render_object.cpp
Index: render_object.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_object.cpp,v
retrieving revision 1.196
retrieving revision 1.197
diff -u -r1.196 -r1.197
--- render_object.cpp 30 Jun 2005 01:27:41 -0000 1.196
+++ render_object.cpp 5 Jul 2005 23:21:12 -0000 1.197
@@ -1736,11 +1736,6 @@
return w;
}
-int RenderObject::tabWidth() const
-{
- return containingBlock()->tabWidth(style()->whiteSpace() == PRE);
-}
-
RenderCanvas* RenderObject::canvas() const
{
return static_cast<RenderCanvas*>(document()->renderer());
@@ -2053,6 +2048,9 @@
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.151 +0 -2 WebCore/khtml/rendering/render_object.h
Index: render_object.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_object.h,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -r1.150 -r1.151
--- render_object.h 30 Jun 2005 01:27:41 -0000 1.150
+++ render_object.h 5 Jul 2005 23:21:12 -0000 1.151
@@ -387,8 +387,6 @@
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.79 +0 -2 WebCore/khtml/rendering/render_replaced.cpp
Index: render_replaced.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_replaced.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- render_replaced.cpp 30 Jun 2005 01:27:41 -0000 1.78
+++ render_replaced.cpp 5 Jul 2005 23:21:13 -0000 1.79
@@ -125,8 +125,6 @@
// 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.186 +63 -97 WebCore/khtml/rendering/render_text.cpp
Index: render_text.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_text.cpp,v
retrieving revision 1.185
retrieving revision 1.186
diff -u -r1.185 -r1.186
--- render_text.cpp 30 Jun 2005 01:27:41 -0000 1.185
+++ render_text.cpp 5 Jul 2005 23:21:13 -0000 1.186
@@ -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, m_x);
+ int w = textObject()->width(m_start, sPos, m_firstLine);
if (m_reversed)
selStart -= w;
else
@@ -162,14 +162,14 @@
selEnd = m_x + m_width;
}
else {
- // Our run is partially selected, and so we need to measure.
+ // Our run is partially selected, and so we have to actually do a measurement.
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, textObject()->tabWidth(), textPos(),
+ font->drawText(i.p, m_x + tx, m_y + ty + m_baseline,
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, textObject()->tabWidth(), textPos(),
+ font->drawText(i.p, m_x + tx, m_y + ty + m_baseline,
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()->tabWidth(), textPos(),
- textObject()->string()->s, textObject()->string()->l, 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,
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()->tabWidth(), textPos(),
- textObject()->string()->s, textObject()->string()->l, 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,
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()->tabWidth(), textPos(),
- textObject()->string()->s, textObject()->string()->l, 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,
m_toAdd, m_reversed ? QPainter::RTL : QPainter::LTR, styleToUse->visuallyOrdered(), sPos, ePos);
if (selectionTextShadow)
i.p->clearShadow();
@@ -524,9 +524,10 @@
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, m_x + tx, y + ty, h, textObject()->tabWidth(), textPos(),
+ f->drawHighlightForText(p, x, y + ty, h,
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();
@@ -548,9 +549,10 @@
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, m_x + tx, y + ty, h, textObject()->tabWidth(), textPos(), textObject()->str->s, textObject()->str->l, m_start, m_len,
+ f->drawHighlightForText(p, x, y + ty, h, 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();
}
@@ -725,21 +727,11 @@
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, text->tabWidth(), textPos(), _x - m_x, m_reversed, includePartialGlyphs);
+ return f->checkSelectionPoint(text->str->s, text->str->l, m_start, m_len, m_toAdd, _x - m_x, m_reversed, includePartialGlyphs);
}
int InlineTextBox::positionForOffset(int offset) const
@@ -749,13 +741,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, text->tabWidth(), textPos(), len).right();
+ long len = m_start + m_len - offset;
+ QString string(text->str->s + offset, len);
+ left = m_x + fm.boundingRect(string, len).right();
} else {
- long len = offset - m_start;
- QString string(text->str->s + m_start, len);
- left = m_x + fm.boundingRect(string, text->tabWidth(), textPos(), len).right();
+ long len = offset - m_start;
+ QString string(text->str->s + m_start, len);
+ left = m_x + fm.boundingRect(string, len).right();
}
// FIXME: Do we need to add rightBearing here?
return left;
@@ -1149,7 +1141,7 @@
return (f && f->isFixedPitch() && allAscii() && !style()->htmlFont().isSmallCaps());
}
-// We cache the width of the ' ' character for <pre> text. We could go further
+// We cache the width of the ' ' character for <pre> text. We could go futher
// and cache a widths array for all styles, at the expense of increasing the size of the
// RenderText.
void RenderText::cacheWidths()
@@ -1159,7 +1151,7 @@
if (shouldUseMonospaceCache(f)){
float fw;
QChar c(' ');
- f->floatCharacterWidths( &c, 1, 0, 1, 0, 0, 0, &fw);
+ f->floatCharacterWidths( &c, 1, 0, 1, 0, &fw);
m_monospaceCharacterWidth = (int)fw;
}
else
@@ -1167,27 +1159,20 @@
}
-inline int RenderText::widthFromCache(const Font *f, int start, int len, int tabWidth, int xpos) const
+inline int RenderText::widthFromCache(const Font *f, int start, int len) const
{
if (m_monospaceCharacterWidth != 0){
int i, w = 0;
for (i = start; i < start+len; i++){
- 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;
- }
+ int dir = str->s[i].direction();
+ if (dir != QChar::DirNSM && dir != QChar::DirBN)
+ w += m_monospaceCharacterWidth;
}
-
return w;
}
- return f->width(str->s, str->l, start, len, tabWidth, xpos);
+ return f->width(str->s, str->l, start, len);
}
-
#ifdef XXX
inline int RenderText::widthFromCache(const Font *f, int start, int len) const
{
@@ -1201,8 +1186,7 @@
#endif
-void RenderText::trimmedMinMaxWidth(int leadWidth,
- int& beginMinW, bool& beginWS,
+void RenderText::trimmedMinMaxWidth(int& beginMinW, bool& beginWS,
int& endMinW, bool& endWS,
bool& hasBreakableChar, bool& hasBreak,
int& beginMaxW, int& endMaxW,
@@ -1219,10 +1203,6 @@
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;
@@ -1234,10 +1214,10 @@
hasBreakableChar = m_hasBreakableChar;
hasBreak = m_hasBreak;
- if (stripFrontSpaces && (str->s[0] == ' ' || (!isPre && (str->s[0] == '\n' || str->s[0] == '\t')))) {
+ if (stripFrontSpaces && (str->s[0] == ' ' || (!isPre && str->s[0] == '\n'))) {
const Font *f = htmlFont( false );
QChar space[1]; space[0] = ' ';
- int spaceWidth = f->width(space, 1, 0, 0);
+ int spaceWidth = f->width(space, 1, 0);
maxW -= spaceWidth;
}
@@ -1262,13 +1242,12 @@
if (linelen)
{
#if !APPLE_CHANGES
- endMaxW = f->width(str->s, str->l, i, linelen, tabWidth(), leadWidth + endMaxW);
+ endMaxW = f->width(str->s, str->l, i, linelen);
#else
- endMaxW = widthFromCache(f, i, linelen, tabWidth(), leadWidth + endMaxW);
+ endMaxW = widthFromCache(f, i, linelen);
#endif
if (firstLine) {
firstLine = false;
- leadWidth = 0;
beginMaxW = endMaxW;
}
i += linelen;
@@ -1276,7 +1255,6 @@
else if (firstLine) {
beginMaxW = 0;
firstLine = false;
- leadWidth = 0;
}
if (i == len-1)
@@ -1289,14 +1267,8 @@
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;
@@ -1306,7 +1278,7 @@
int currMinWidth = 0;
int currMaxWidth = 0;
- m_hasBreakableChar = m_hasBreak = m_hasTab = m_hasBeginWS = m_hasEndWS = false;
+ m_hasBreakableChar = m_hasBreak = m_hasBeginWS = m_hasEndWS = false;
// ### not 100% correct for first-line
const Font *f = htmlFont( false );
@@ -1329,13 +1301,8 @@
m_hasBreak = true;
isNewline = true;
isSpace = false;
- } else
- isSpace = true;
- } else if (c == '\t') {
- if (isPre) {
- m_hasTab = true;
- isSpace = false;
- } else
+ }
+ else
isSpace = true;
} else {
isSpace = c == ' ';
@@ -1351,14 +1318,12 @@
if (ignoringSpaces && !isSpace)
ignoringSpaces = false;
-
- // Ignore spaces and soft hyphens
- if (ignoringSpaces || (i > 0 && c.unicode() == SOFT_HYPHEN)) {
+
+ if (ignoringSpaces || (i > 0 && c.unicode() == SOFT_HYPHEN)) // Ignore spaces and soft hyphens
continue;
- }
int wordlen = 0;
- while (i+wordlen < len && str->s[i+wordlen] != '\n' && str->s[i+wordlen] != ' ' && str->s[i+wordlen] != '\t' &&
+ while (i+wordlen < len && str->s[i+wordlen] != '\n' && str->s[i+wordlen] != ' ' &&
(i+wordlen == 0 || str->s[i+wordlen].unicode() != SOFT_HYPHEN) && // Skip soft hyphens
(wordlen == 0 || !isBreakable( str->s, i+wordlen, str->l)))
wordlen++;
@@ -1366,20 +1331,20 @@
if (wordlen)
{
#if !APPLE_CHANGES
- int w = f->width(str->s, str->l, i, wordlen, tabWidth(), leadWidth + currMaxWidth);
+ int w = f->width(str->s, str->l, i, wordlen);
#else
- int w = widthFromCache(f, i, wordlen, tabWidth(), leadWidth + currMaxWidth);
+ int w = widthFromCache(f, i, wordlen);
#endif
currMinWidth += w;
currMaxWidth += w;
- bool isBreakableCharSpace = (i+wordlen < len) ? ((!isPre && (str->s[i+wordlen] == '\n' || str->s[i+wordlen] == '\t')) ||
+ bool isBreakableCharSpace = (i+wordlen < len) ? ((!isPre && str->s[i+wordlen] == '\n') ||
str->s[i+wordlen] == ' ') : false;
if (i+wordlen < len && style()->whiteSpace() == NORMAL)
m_hasBreakableChar = true;
- // Add in wordSpacing to our currMaxWidth, but not if this is the last word on a line or the
+ // Add in wordspacing to our maxwidth, 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;
@@ -1403,7 +1368,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;
@@ -1414,7 +1379,6 @@
{
if (firstLine) {
firstLine = false;
- leadWidth = 0;
m_beginMinWidth = currMaxWidth;
}
@@ -1423,14 +1387,14 @@
}
else
{
- currMaxWidth += f->width(str->s, str->l, i + wordlen, 1, tabWidth(), leadWidth + currMaxWidth);
+ currMaxWidth += f->width( str->s, str->l, i + wordlen );
}
}
}
-
+
if(currMinWidth > m_minWidth) m_minWidth = currMinWidth;
if(currMaxWidth > m_maxWidth) m_maxWidth = currMaxWidth;
-
+
if (style()->whiteSpace() != NORMAL)
m_minWidth = m_maxWidth;
@@ -1448,7 +1412,7 @@
{
unsigned int currPos;
for (currPos = from;
- currPos < from+len && (str->s[currPos] == '\n' || str->s[currPos].unicode() == ' ' || str->s[currPos] == '\t');
+ currPos < from+len && (str->s[currPos] == '\n' || str->s[currPos].unicode() == ' ');
currPos++);
return currPos >= (from+len);
}
@@ -1695,37 +1659,37 @@
s->m_len = len;
}
-unsigned int RenderText::width(unsigned int from, unsigned int len, int xpos, bool firstLine) const
+unsigned int RenderText::width(unsigned int from, unsigned int len, 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, xpos );
+ return width( from, len, f );
}
-unsigned int RenderText::width(unsigned int from, unsigned int len, const Font *f, int xpos) const
+unsigned int RenderText::width(unsigned int from, unsigned int len, const Font *f) const
{
if(!str->s || from > str->l ) return 0;
if ( from + len > str->l ) len = str->l - from;
int w;
- if ( style()->whiteSpace() != PRE && f == &style()->htmlFont() && from == 0 && len == str->l ) {
+ if ( f == &style()->htmlFont() && from == 0 && len == str->l )
w = m_maxWidth;
#if APPLE_CHANGES
- } else if (f == &style()->htmlFont()) {
- w = widthFromCache (f, from, len, tabWidth(), xpos);
+ else if (f == &style()->htmlFont())
+ w = widthFromCache (f, from, len);
#endif
- } else {
- w = f->width(str->s, str->l, from, len, tabWidth(), xpos );
- }
-
+ else
+ w = f->width(str->s, str->l, from, len );
+
//kdDebug( 6040 ) << "RenderText::width(" << from << ", " << len << ") = " << w << endl;
return w;
}
int RenderText::width() const
{
+ int w;
int minx = 100000000;
int maxx = 0;
// slooow
@@ -1736,7 +1700,9 @@
maxx = s->m_x + s->m_width;
}
- return kMax(0, maxx-minx);
+ w = kMax(0, maxx-minx);
+
+ return w;
}
QRect RenderText::getAbsoluteRepaintRect()
1.80 +4 -10 WebCore/khtml/rendering/render_text.h
Index: render_text.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_text.h,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -r1.79 -r1.80
--- render_text.h 30 Jun 2005 01:27:41 -0000 1.79
+++ render_text.h 5 Jul 2005 23:21:13 -0000 1.80
@@ -124,7 +124,6 @@
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;
@@ -191,8 +190,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, int xpos) const;
- virtual unsigned int width(unsigned int from, unsigned int len, int xpos, bool firstLine = false) const;
+ 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 int width() const;
virtual int height() const;
@@ -204,11 +203,7 @@
virtual void calcMinMaxWidth();
virtual int minWidth() const { return m_minWidth; }
virtual int maxWidth() const { return m_maxWidth; }
-
- // widths
- void calcMinMaxWidth(int leadWidth);
- virtual void trimmedMinMaxWidth(int leadWidth,
- int& beginMinW, bool& beginWS,
+ virtual void trimmedMinMaxWidth(int& beginMinW, bool& beginWS,
int& endMinW, bool& endWS,
bool& hasBreakableChar, bool& hasBreak,
int& beginMaxW, int& endMaxW,
@@ -253,7 +248,7 @@
virtual InlineBox *inlineBox(long offset, EAffinity affinity = UPSTREAM);
#if APPLE_CHANGES
- int widthFromCache(const Font *, int start, int len, int tabWidth, int xpos) const;
+ int widthFromCache(const Font *, int start, int len) const;
bool shouldUseMonospaceCache(const Font *) const;
void cacheWidths();
bool allAscii() const;
@@ -285,7 +280,6 @@
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.40 +11 -11 WebCore/kwq/KWQFontMetrics.h
Index: KWQFontMetrics.h
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQFontMetrics.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- KWQFontMetrics.h 3 Jul 2005 09:51:34 -0000 1.39
+++ KWQFontMetrics.h 5 Jul 2005 23:21:16 -0000 1.40
@@ -51,22 +51,22 @@
int lineSpacing() const;
float xHeight() 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;
+ 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;
float floatWidth(const QChar *, int slen, int pos, int len,
- 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;
+ float floatCharacterWidths(const QChar *, int slen, int pos, int len, int toAdd, float *buffer,
int letterSpacing, int wordSpacing, bool smallCaps) 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;
+ 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;
QRect boundingRect(QChar) 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;
+ QRect boundingRect(const QString &, int len=-1) const;
+ QRect boundingRect(int, int, int, int, int, const QString &) const;
- QSize size(int, const QString &, int tabWidth, int xpos) const;
+ QSize size(int, const QString &) const;
int baselineOffset() const { return ascent(); }
1.88 +16 -30 WebCore/kwq/KWQFontMetrics.mm
Index: KWQFontMetrics.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQFontMetrics.mm,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- KWQFontMetrics.mm 3 Jul 2005 09:51:34 -0000 1.87
+++ KWQFontMetrics.mm 5 Jul 2005 23:21:16 -0000 1.88
@@ -158,7 +158,7 @@
return [data->getRenderer() xHeight];
}
-int QFontMetrics::width(QChar qc, int tabWidth, int xpos) const
+int QFontMetrics::width(QChar qc) const
{
if (data.isNull()) {
ERROR("called width on an empty QFontMetrics");
@@ -175,18 +175,16 @@
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, int tabWidth, int xpos) const
+int QFontMetrics::charWidth(const QString &s, int pos) const
{
- return width(s[pos], tabWidth, xpos);
+ return width(s[pos]);
}
-int QFontMetrics::width(char c, int tabWidth, int xpos) const
+int QFontMetrics::width(char c) const
{
if (data.isNull()) {
ERROR("called width on an empty QFontMetrics");
@@ -203,13 +201,11 @@
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 tabWidth, int xpos, int len) const
+int QFontMetrics::width(const QString &qstring, int len) const
{
if (data.isNull()) {
ERROR("called width on an empty QFontMetrics");
@@ -226,13 +222,11 @@
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, int tabWidth, int xpos) const
+int QFontMetrics::width(const QChar *uchars, int len) const
{
if (data.isNull()) {
ERROR("called width on an empty QFontMetrics");
@@ -247,14 +241,12 @@
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 tabWidth, int xpos, int letterSpacing, int wordSpacing, bool smallCaps) const
+ int letterSpacing, int wordSpacing, bool smallCaps) const
{
if (data.isNull()) {
ERROR("called floatWidth on an empty QFontMetrics");
@@ -268,8 +260,6 @@
WebCoreTextStyle style;
WebCoreInitializeEmptyTextStyle(&style);
- style.tabWidth = tabWidth;
- style.xpos = xpos;
style.letterSpacing = letterSpacing;
style.wordSpacing = wordSpacing;
style.smallCaps = smallCaps;
@@ -278,7 +268,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, int tabWidth, int xpos, float *buffer, int letterSpacing, int wordSpacing, bool smallCaps) const
+float QFontMetrics::floatCharacterWidths(const QChar *uchars, int slen, int pos, int len, int toAdd, float *buffer, int letterSpacing, int wordSpacing, bool smallCaps) const
{
if (data.isNull()) {
ERROR("called floatCharacterWidths on an empty QFontMetrics");
@@ -296,14 +286,12 @@
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 tabWidth, int xpos, 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 letterSpacing, int wordSpacing, bool smallCaps, int x, bool reversed, bool includePartialGlyphs) const
{
if (data.isNull()) {
ERROR("called floatWidth on an empty QFontMetrics");
@@ -321,8 +309,6 @@
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];
@@ -330,21 +316,21 @@
QRect QFontMetrics::boundingRect(QChar c) const
{
- return QRect(0, 0, width(c, 0, 0), height());
+ return QRect(0, 0, width(c), height());
}
-QRect QFontMetrics::boundingRect(const QString &qstring, int tabWidth, int xpos, int len) const
+QRect QFontMetrics::boundingRect(const QString &qstring, int len) const
{
- return QRect(0, 0, width(qstring, tabWidth, xpos, len), height());
+ return QRect(0, 0, width(qstring, len), height());
}
-QRect QFontMetrics::boundingRect(int x, int y, int width, int height, int flags, const QString &str, int tabWidth, int xpos) const
+QRect QFontMetrics::boundingRect(int x, int y, int width, int height, int flags, const QString &str) const
{
// FIXME: need to support word wrapping?
- return QRect(x, y, width, height).intersect(boundingRect(str, tabWidth, xpos));
+ return QRect(x, y, width, height).intersect(boundingRect(str));
}
-QSize QFontMetrics::size(int, const QString &qstring, int tabWidth, int xpos) const
+QSize QFontMetrics::size(int, const QString &qstring) const
{
- return QSize(width(qstring, tabWidth, xpos), height());
+ return QSize(width(qstring), height());
}
1.73 +3 -3 WebCore/kwq/KWQPainter.h
Index: KWQPainter.h
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQPainter.h,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- KWQPainter.h 30 Jun 2005 01:27:44 -0000 1.72
+++ KWQPainter.h 5 Jul 2005 23:21:16 -0000 1.73
@@ -101,12 +101,12 @@
RasterOp rasterOp() const;
void setRasterOp(RasterOp);
- 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,
+ void drawText(int x, int y, int, int, int alignmentFlags, const QString &);
+ void drawHighlightForText(int x, int y, int h,
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, int tabWidth, int xpos, const QChar *, int length, int from, int to, int toAdd,
+ void drawText(int x, int y, 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.126 +5 -9 WebCore/kwq/KWQPainter.mm
Index: KWQPainter.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQPainter.mm,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -r1.125 -r1.126
--- KWQPainter.mm 30 Jun 2005 01:27:44 -0000 1.125
+++ KWQPainter.mm 5 Jul 2005 23:21:17 -0000 1.126
@@ -597,7 +597,7 @@
}
}
-void QPainter::drawText(int x, int y, int tabWidth, int xpos, int, int, int alignmentFlags, const QString &qstring)
+void QPainter::drawText(int x, int y, int, int, int alignmentFlags, const QString &qstring)
{
if (data->state.paintingDisabled)
return;
@@ -617,8 +617,6 @@
WebCoreInitializeEmptyTextStyle(&style);
style.textColor = data->state.pen.color().getNSColor();
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]);
@@ -626,10 +624,11 @@
WebCoreTextGeometry geometry;
WebCoreInitializeEmptyTextGeometry(&geometry);
geometry.point = NSMakePoint(x, y);
+
[data->textRenderer drawRun:&run style:&style geometry:&geometry];
}
-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)
+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)
{
if (data->state.paintingDisabled || len <= 0)
return;
@@ -658,15 +657,14 @@
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, int tabWidth, int xpos,
+void QPainter::drawHighlightForText(int x, int y, int h,
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)
{
@@ -697,8 +695,6 @@
style.smallCaps = smallCaps;
style.families = families;
style.padding = toAdd;
- style.tabWidth = tabWidth;
- style.xpos = xpos;
WebCoreTextGeometry geometry;
WebCoreInitializeEmptyTextGeometry(&geometry);
geometry.point = NSMakePoint(x, y);
1.34 +0 -2 WebCore/kwq/WebCoreTextRenderer.h
Index: WebCoreTextRenderer.h
===================================================================
RCS file: /cvs/root/WebCore/kwq/WebCoreTextRenderer.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- WebCoreTextRenderer.h 30 Jun 2005 01:27:44 -0000 1.33
+++ WebCoreTextRenderer.h 5 Jul 2005 23:21:17 -0000 1.34
@@ -36,8 +36,6 @@
int letterSpacing;
int wordSpacing;
int padding;
- int tabWidth;
- int xpos;
NSString **families;
unsigned smallCaps : 1;
unsigned rtl : 1;
1.23 +0 -2 WebCore/kwq/WebCoreTextRendererFactory.mm
Index: WebCoreTextRendererFactory.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/WebCoreTextRendererFactory.mm,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- WebCoreTextRendererFactory.mm 30 Jun 2005 01:27:44 -0000 1.22
+++ WebCoreTextRendererFactory.mm 5 Jul 2005 23:21:17 -0000 1.23
@@ -42,8 +42,6 @@
void WebCoreInitializeEmptyTextStyle(WebCoreTextStyle *style)
{
style->padding = 0;
- style->tabWidth = 0;
- style->xpos = 0;
style->textColor = nil;
style->backgroundColor = nil;
style->rtl = false;
1.6 +4 -7 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- delete-tab-001-expected.txt 30 Jun 2005 01:27:45 -0000 1.5
+++ delete-tab-001-expected.txt 5 Jul 2005 23:21:18 -0000 1.6
@@ -4,11 +4,8 @@
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 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"
+ RenderInline {SPAN} at (0,0) size 56x28
+ RenderText {TEXT} at (14,14) size 56x28
+ text run at (14,14) width 56: " foo"
RenderText {TEXT} at (0,0) size 0x0
-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
+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
1.3 +2 -1 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- delete-tab-001.html 30 Jun 2005 01:27:45 -0000 1.2
+++ delete-tab-001.html 5 Jul 2005 23:21:18 -0000 1.3
@@ -15,7 +15,8 @@
function editingTest() {
typeCharacterCommand('\t');
typeCharacterCommand('\t');
- deleteCommand();
+ for (i = 0; i < 4; i++)
+ deleteCommand();
}
</script>
1.5 +4 -7 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- delete-tab-002-expected.txt 30 Jun 2005 01:27:45 -0000 1.4
+++ delete-tab-002-expected.txt 5 Jul 2005 23:21:18 -0000 1.5
@@ -4,10 +4,7 @@
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 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
+ 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
1.3 +2 -1 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- delete-tab-002.html 30 Jun 2005 01:27:45 -0000 1.2
+++ delete-tab-002.html 5 Jul 2005 23:21:19 -0000 1.3
@@ -17,7 +17,8 @@
moveSelectionForwardByCharacterCommand();
typeCharacterCommand('\t');
typeCharacterCommand('\t');
- deleteCommand();
+ for (i = 0; i < 4; i++)
+ deleteCommand();
}
</script>
1.5 +4 -9 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- delete-tab-003-expected.txt 30 Jun 2005 01:27:45 -0000 1.4
+++ delete-tab-003-expected.txt 5 Jul 2005 23:21:19 -0000 1.5
@@ -4,13 +4,8 @@
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 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"
+ RenderInline {SPAN} at (0,0) size 56x28
+ RenderText {TEXT} at (14,14) size 56x28
+ text run at (14,14) width 56: "fo o"
RenderText {TEXT} at (0,0) size 0x0
-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
+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
1.3 +2 -1 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- delete-tab-003.html 30 Jun 2005 01:27:45 -0000 1.2
+++ delete-tab-003.html 5 Jul 2005 23:21:19 -0000 1.3
@@ -17,7 +17,8 @@
moveSelectionForwardByCharacterCommand();
typeCharacterCommand('\t');
typeCharacterCommand('\t');
- deleteCommand();
+ for (i = 0; i < 4; i++)
+ deleteCommand();
}
</script>
1.6 +4 -7 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- delete-tab-004-expected.txt 30 Jun 2005 01:27:45 -0000 1.5
+++ delete-tab-004-expected.txt 5 Jul 2005 23:21:19 -0000 1.6
@@ -4,12 +4,9 @@
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 80x56
+ RenderInline {SPAN} at (0,0) size 56x56
RenderBR {BR} at (14,14) size 0x28
- 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 (14,42) size 56x28
+ text run at (14,42) width 56: " foo"
RenderText {TEXT} at (0,0) size 0x0
-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
+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
1.4 +2 -1 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- delete-tab-004.html 30 Jun 2005 01:27:45 -0000 1.3
+++ delete-tab-004.html 5 Jul 2005 23:21:19 -0000 1.4
@@ -16,7 +16,8 @@
insertLineBreakCommand();
typeCharacterCommand('\t');
typeCharacterCommand('\t');
- deleteCommand();
+ for (i = 0; i < 4; i++)
+ deleteCommand();
}
</script>
1.6 +4 -7 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- insert-tab-001-expected.txt 30 Jun 2005 01:27:46 -0000 1.5
+++ insert-tab-001-expected.txt 5 Jul 2005 23:21:20 -0000 1.6
@@ -4,11 +4,8 @@
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 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"
+ RenderInline {SPAN} at (0,0) size 56x28
+ RenderText {TEXT} at (14,14) size 56x28
+ text run at (14,14) width 56: " foo"
RenderText {TEXT} at (0,0) size 0x0
-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
+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
1.6 +4 -7 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- insert-tab-002-expected.txt 30 Jun 2005 01:27:46 -0000 1.5
+++ insert-tab-002-expected.txt 5 Jul 2005 23:21:20 -0000 1.6
@@ -4,11 +4,8 @@
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 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}"
+ RenderInline {SPAN} at (0,0) size 56x28
+ RenderText {TEXT} at (14,14) size 56x28
+ text run at (14,14) width 56: "foo "
RenderText {TEXT} at (0,0) size 0x0
-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
+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
1.5 +4 -9 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- insert-tab-003-expected.txt 30 Jun 2005 01:27:46 -0000 1.4
+++ insert-tab-003-expected.txt 5 Jul 2005 23:21:20 -0000 1.5
@@ -4,13 +4,8 @@
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 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"
+ RenderInline {SPAN} at (0,0) size 56x28
+ RenderText {TEXT} at (14,14) size 56x28
+ text run at (14,14) width 56: "fo o"
RenderText {TEXT} at (0,0) size 0x0
-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
+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
1.6 +4 -7 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- insert-tab-004-expected.txt 30 Jun 2005 01:27:46 -0000 1.5
+++ insert-tab-004-expected.txt 5 Jul 2005 23:21:20 -0000 1.6
@@ -4,12 +4,9 @@
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 80x56
+ RenderInline {SPAN} at (0,0) size 56x56
RenderBR {BR} at (14,14) size 0x28
- 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 (14,42) size 56x28
+ text run at (14,42) width 56: " foo"
RenderText {TEXT} at (0,0) size 0x0
-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
+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
1.3 +4 -3 WebCore/layout-tests/fast/dom/quadraticCurveTo-expected.txt
Index: quadraticCurveTo-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/fast/dom/quadraticCurveTo-expected.txt,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- quadraticCurveTo-expected.txt 30 Jun 2005 01:27:46 -0000 1.2
+++ quadraticCurveTo-expected.txt 5 Jul 2005 23:21:21 -0000 1.3
@@ -4,8 +4,9 @@
RenderBlock {HTML} at (0,0) size 800x414
RenderBody {BODY} at (8,16) size 784x18
RenderBlock {P} at (0,0) size 784x18
- RenderText {TEXT} at (0,0) size 416x18
- text run at (0,0) width 358: "This test case should produce a sine-wave stroked with 1"
- text run at (358,0) width 58: "px black."
+ RenderText {TEXT} at (0,0) size 420x18
+ text run at (0,0) width 358: "\x{9}\x{9}\x{9}This test case should produce a sine-wave stroked with 1"
+ text run at (358,0) width 62: "px black. "
+ text run at (420,0) width 0: "\x{9}\x{9}"
RenderBlock (anonymous) at (0,50) size 800x364
RenderCanvasImage {CANVAS} at (0,0) size 480x360
1.3 +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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- string-replace-2-expected.txt 30 Jun 2005 01:27:47 -0000 1.2
+++ string-replace-2-expected.txt 5 Jul 2005 23:21:22 -0000 1.3
@@ -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.6 +10 -2 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- 039-expected.txt 30 Jun 2005 01:27:47 -0000 1.5
+++ 039-expected.txt 5 Jul 2005 23:21:22 -0000 1.6
@@ -42,11 +42,19 @@
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 170: " (1,1)\x{9}(1,2)\x{9}(1,3)\x{9}(1,4)\x{9}(1,5)"
+ 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)"
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 170: " (2,1)\x{9}(2,2)\x{9}(2,3)\x{9}(2,4)\x{9}(2,5)"
+ 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)"
RenderBR {BR} at (0,0) size 0x0
1.6 +3 -3 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- 004-expected.txt 30 Jun 2005 01:27:47 -0000 1.5
+++ 004-expected.txt 5 Jul 2005 23:21:22 -0000 1.6
@@ -17,9 +17,9 @@
text run at (333,0) width 172: "The styles applied here are:"
RenderBlock {PRE} at (0,92) size 784x180
RenderText {TEXT} at (0,0) size 688x180
- text run at (0,0) width 152: "TABLE\x{9}{ margin: 1"
+ text run at (0,0) width 152: "TABLE { margin: 1"
text run at (152,0) width 256: "em; border: medium solid blue; }"
- text run at (0,15) width 368: "TD\x{9}{ border: thin solid green; padding: 5"
+ text run at (0,15) width 368: "TD { border: thin solid green; padding: 5"
text run at (368,15) width 40: "px; }"
text run at (0,30) width 352: "TH { border: medium solid purple; padding: 5"
text run at (352,30) width 40: "px; }"
@@ -34,7 +34,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: "\x{9}{ border: medium solid red; }"
+ text run at (0,165) width 296: " { 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.3 +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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- script_extra_close-expected.txt 30 Jun 2005 01:27:47 -0000 1.2
+++ script_extra_close-expected.txt 5 Jul 2005 23:21:23 -0000 1.3
@@ -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...\x{9}"
+ text run at (0,0) width 55: "TEST... "
RenderText {TEXT} at (0,0) size 0x0
RenderText {TEXT} at (0,0) size 0x0
RenderText {TEXT} at (55,0) size 232x18
1.3212 +14 -0 WebKit/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebKit/ChangeLog,v
retrieving revision 1.3211
retrieving revision 1.3212
diff -u -r1.3211 -r1.3212
--- ChangeLog 5 Jul 2005 18:37:34 -0000 1.3211
+++ ChangeLog 5 Jul 2005 23:21:23 -0000 1.3212
@@ -1,3 +1,17 @@
+2005-07-05 Adele Peterson <adele at apple.com>
+
+ Rolling out changes for <rdar://problem/3792529> REGRESSION (Mail): Tabs do not work the way they did in Panther (especially useful in plain text mail)
+ since it caused a 2% performance regression.
+
+ * WebCoreSupport.subproj/WebTextRenderer.m:
+ (isSpace):
+ (-[WebTextRenderer _CG_drawHighlightForRun:style:geometry:]):
+ (-[WebTextRenderer _CG_floatWidthForRun:style:widths:fonts:glyphs:startPosition:numGlyphs:]):
+ (-[WebTextRenderer _extendCharacterToGlyphMapToInclude:]):
+ (-[WebTextRenderer _CG_pointToOffset:style:position:reversed:includePartialGlyphs:]):
+ (initializeCharacterWidthIterator):
+ (widthForNextCharacter):
+
2005-07-05 John Sullivan <sullivan at apple.com>
Reviewed by Chris Blumenberg.
1.177 +21 -29 WebKit/WebCoreSupport.subproj/WebTextRenderer.m
Index: WebTextRenderer.m
===================================================================
RCS file: /cvs/root/WebKit/WebCoreSupport.subproj/WebTextRenderer.m,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -r1.176 -r1.177
--- WebTextRenderer.m 30 Jun 2005 01:28:36 -0000 1.176
+++ WebTextRenderer.m 5 Jul 2005 23:21:31 -0000 1.177
@@ -179,11 +179,11 @@
static inline BOOL isSpace(UniChar c)
{
- return c == SPACE || c == '\t' || c == '\n' || c == NO_BREAK_SPACE;
+ return c == SPACE || c == '\n' || c == NO_BREAK_SPACE;
}
static const uint8_t isRoundingHackCharacterTable[0x100] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*\t*/, 1 /*\n*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*\n*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1 /*space*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*-*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*?*/,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -287,7 +287,7 @@
// Iterator functions
static void initializeCharacterWidthIterator (CharacterWidthIterator *iterator, WebTextRenderer *renderer, const WebCoreTextRun *run , const WebCoreTextStyle *style);
-static float widthForNextCharacter (CharacterWidthIterator *iterator, float leadWidth, ATSGlyphRef *glyphUsed, NSFont **fontUsed);
+static float widthForNextCharacter (CharacterWidthIterator *iterator, ATSGlyphRef *glyphUsed, NSFont **fontUsed);
// Misc.
@@ -1008,13 +1008,13 @@
// The starting point needs to be adjusted to account for the width of
// the glyphs at the start of the run.
while (widthIterator.currentCharacter < (unsigned)run->from) {
- startPosition += widthForNextCharacter(&widthIterator, style->xpos + startPosition, 0, 0);
+ startPosition += widthForNextCharacter(&widthIterator, 0, 0);
}
float startX = startPosition + geometry->point.x;
float backgroundWidth = 0.0;
while (widthIterator.currentCharacter < (unsigned)run->to) {
- backgroundWidth += widthForNextCharacter(&widthIterator, style->xpos + startPosition + backgroundWidth, 0, 0);
+ backgroundWidth += widthForNextCharacter(&widthIterator, 0, 0);
}
if (style->backgroundColor != nil){
@@ -1028,7 +1028,7 @@
if (style->rtl){
float completeRunWidth = startPosition + backgroundWidth;
while (widthIterator.currentCharacter < run->length) {
- completeRunWidth += widthForNextCharacter(&widthIterator, completeRunWidth, 0, 0);
+ completeRunWidth += widthForNextCharacter(&widthIterator, 0, 0);
}
[NSBezierPath fillRect:NSMakeRect(geometry->point.x + completeRunWidth - startPosition - backgroundWidth, yPos, backgroundWidth, height)];
@@ -1203,7 +1203,7 @@
initializeCharacterWidthIterator(&widthIterator, self, run, style);
if (startPosition)
*startPosition = widthIterator.widthToStart;
- while ((_nextWidth = widthForNextCharacter(&widthIterator, _totalWidth+style->xpos, &glyphUsed, &fontUsed)) != INVALID_WIDTH){
+ while ((_nextWidth = widthForNextCharacter(&widthIterator, &glyphUsed, &fontUsed)) != INVALID_WIDTH){
if (fontBuffer)
fontBuffer[numGlyphs] = fontUsed;
if (glyphBuffer)
@@ -1339,9 +1339,8 @@
buffer[i] = ZERO_WIDTH_SPACE;
buffer[0x7F] = ZERO_WIDTH_SPACE;
- // But \n, \t, and nonbreaking space must render as a space.
+ // But both \n and nonbreaking space must render as a space.
buffer['\n'] = ' ';
- buffer['\t'] = ' ';
buffer[NO_BREAK_SPACE] = ' ';
}
@@ -1757,8 +1756,7 @@
- (int)_CG_pointToOffset:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style position:(int)x reversed:(BOOL)reversed includePartialGlyphs:(BOOL)includePartialGlyphs
{
float delta = (float)x;
- float width; /// FIX: CHECK THIS
- float leadWidth = style->xpos;
+ float width;
unsigned offset = run->from;
CharacterWidthIterator widthIterator;
@@ -1768,8 +1766,7 @@
width = [self floatWidthForRun:run style:style widths:nil];
delta -= width;
while (offset < run->length) {
- float w = widthForNextCharacter(&widthIterator, leadWidth, 0, 0);
- leadWidth += w;
+ float w = widthForNextCharacter(&widthIterator, 0, 0);
if (w == INVALID_WIDTH) {
// Something very bad happened, like we only have half of a surrogate pair.
break;
@@ -1789,8 +1786,7 @@
}
} else {
while (offset < run->length) {
- float w = widthForNextCharacter(&widthIterator, leadWidth, 0, 0);
- leadWidth += w;
+ float w = widthForNextCharacter(&widthIterator, 0, 0);
if (w == INVALID_WIDTH) {
// Something very bad happened, like we only have half of a surrogate pair.
break;
@@ -1946,7 +1942,7 @@
initializeCharacterWidthIterator (&startPositionIterator, renderer, &startPositionRun, style);
while (startPositionIterator.currentCharacter < (unsigned)startPositionRun.to){
- widthForNextCharacter(&startPositionIterator, startPositionIterator.runWidthSoFar+style->xpos, 0, 0);
+ widthForNextCharacter(&startPositionIterator, 0, 0);
}
iterator->widthToStart = startPositionIterator.runWidthSoFar;
}
@@ -1965,7 +1961,7 @@
#define HIRAGANA_KATAKANA_VOICING_MARKS 8
// Return INVALID_WIDTH if an error is encountered or we're at the end of the range in the run.
-static float widthForNextCharacter(CharacterWidthIterator *iterator, float leadWidth, ATSGlyphRef *glyphUsed, NSFont **fontUsed)
+static float widthForNextCharacter(CharacterWidthIterator *iterator, ATSGlyphRef *glyphUsed, NSFont **fontUsed)
{
WebTextRenderer *renderer = iterator->renderer;
const WebCoreTextRun *run = iterator->run;
@@ -2073,19 +2069,15 @@
}
// Now that we have glyph and font, get its width.
- WebGlyphWidth width;
- if (c == '\t' && style->tabWidth != 0) {
- width = style->tabWidth - (CEIL_TO_INT(leadWidth) % style->tabWidth);
- } else {
- width = widthForGlyph(renderer, *glyphUsed, *fontUsed);
- // We special case spaces in two ways when applying word rounding.
- // First, we round spaces to an adjusted width in all fonts.
- // Second, in fixed-pitch fonts we ensure that all characters that
- // match the width of the space character have the same width as the space character.
- if ((renderer->treatAsFixedPitch ? width == renderer->spaceWidth : *glyphUsed == renderer->spaceGlyph) && iterator->style->applyWordRounding)
- width = renderer->adjustedSpaceWidth;
- }
+ WebGlyphWidth width = widthForGlyph(renderer, *glyphUsed, *fontUsed);
+ // We special case spaces in two ways when applying word rounding.
+ // First, we round spaces to an adjusted width in all fonts.
+ // Second, in fixed-pitch fonts we ensure that all characters that
+ // match the width of the space character have the same width as the space character.
+ if ((renderer->treatAsFixedPitch ? width == renderer->spaceWidth : *glyphUsed == renderer->spaceGlyph) && iterator->style->applyWordRounding)
+ width = renderer->adjustedSpaceWidth;
+
// Try to find a substitute font if this font didn't have a glyph for a character in the
// string. If one isn't found we end up drawing and measuring the 0 glyph, usually a box.
if (*glyphUsed == 0 && iterator->style->attemptFontSubstitution) {
More information about the webkit-changes
mailing list