[webkit-changes] cvs commit: WebCore/khtml/rendering bidi.cpp
render_text.cpp
Beth
bdakin at opensource.apple.com
Mon Oct 24 15:51:08 PDT 2005
bdakin 05/10/24 15:51:07
Modified: . ChangeLog
. ChangeLog
khtml/rendering bidi.cpp render_text.cpp
Added: fast/text softHyphen-expected.checksum
softHyphen-expected.png softHyphen-expected.txt
softHyphen.html
Log:
Revision Changes Path
1.49 +13 -0 LayoutTests/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/LayoutTests/ChangeLog,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- ChangeLog 24 Oct 2005 22:33:55 -0000 1.48
+++ ChangeLog 24 Oct 2005 22:51:02 -0000 1.49
@@ -9,6 +9,19 @@
2005-10-24 Mitz Pettel <opendarwin.org at mitzpettel.com>
+ Reviewed by Darin. Committed by beth.
+
+ Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=5384
+ Soft hyphen displayed as hyphen when it is the first character
+ in a line/run.
+
+ * fast/text/softHyphen-expected.checksum: Added.
+ * fast/text/softHyphen-expected.png: Added.
+ * fast/text/softHyphen-expected.txt: Added.
+ * fast/text/softHyphen.html: Added.
+
+2005-10-24 Mitz Pettel <opendarwin.org at mitzpettel.com>
+
Reviewed by Darin. Committed by David Harrison.
http://bugzilla.opendarwin.org/show_bug.cgi?id=5449
1.1 LayoutTests/fast/text/softHyphen-expected.checksum
Index: softHyphen-expected.checksum
===================================================================
cbe706ff23f5ece1525db69e07737061
1.1 LayoutTests/fast/text/softHyphen-expected.png
<<Binary file>>
1.1 LayoutTests/fast/text/softHyphen-expected.txt
Index: softHyphen-expected.txt
===================================================================
layer at (0,0) size 785x992
RenderCanvas at (0,0) size 785x600
layer at (0,0) size 785x992
RenderBlock {HTML} at (0,0) size 785x992
RenderBody {BODY} at (8,16) size 769x960
RenderBlock {P} at (0,0) size 769x18
RenderText {TEXT} at (0,0) size 429x18
text run at (0,0) width 429: "In all of the following, there should not be a hyphen before \x{201C}lorem\x{201D}."
RenderBlock {P} at (0,34) size 769x18
RenderText {TEXT} at (0,0) size 20x18
text run at (0,0) width 20: "Do"
RenderBlock (floating) {SPAN} at (755,0) size 14x20 [border: (1px solid #FF0000)]
RenderText {TEXT} at (1,1) size 12x18
text run at (1,1) width 12: "X"
RenderText {TEXT} at (20,0) size 78x18
text run at (20,0) width 78: "lorem ipsum"
RenderBlock {P} at (0,68) size 769x18
RenderBlock (floating) {SPAN} at (755,0) size 14x20 [border: (1px solid #FF0000)]
RenderText {TEXT} at (1,1) size 12x18
text run at (1,1) width 12: "X"
RenderText {TEXT} at (0,0) size 78x18
text run at (0,0) width 78: "lorem ipsum"
RenderBlock {P} at (0,102) size 769x20
RenderText {TEXT} at (0,1) size 20x18
text run at (0,1) width 20: "Do"
RenderText {TEXT} at (34,1) size 78x18
text run at (34,1) width 78: "lorem ipsum"
RenderBlock {P} at (0,138) size 769x18
RenderText {TEXT} at (0,0) size 20x18
text run at (0,0) width 20: "Do"
RenderText {TEXT} at (20,0) size 78x18
text run at (20,0) width 78: "lorem ipsum"
RenderBlock (anonymous) at (0,172) size 769x18
RenderText {TEXT} at (0,0) size 20x18
text run at (0,0) width 20: "Do"
RenderBlock {P} at (0,206) size 769x18
RenderText {TEXT} at (0,0) size 78x18
text run at (0,0) width 78: "lorem ipsum"
RenderBlock {P} at (0,240) size 769x36
RenderText {TEXT} at (0,0) size 20x18
text run at (0,0) width 20: "Do"
RenderBR {BR} at (0,0) size 0x0
RenderText {TEXT} at (0,18) size 78x18
text run at (0,18) width 78: "lorem ipsum"
RenderBlock {P} at (0,292) size 769x18
RenderText {TEXT} at (0,0) size 20x18
text run at (0,0) width 20: "Do"
RenderInline {SPAN} at (0,0) size 36x18
RenderText {TEXT} at (20,0) size 36x18
text run at (20,0) width 36: "lorem"
RenderText {TEXT} at (56,0) size 42x18
text run at (56,0) width 42: " ipsum"
RenderBlock {P} at (0,326) size 769x18
RenderText {TEXT} at (0,0) size 12x18
text run at (0,0) width 12: "D"
RenderInline {SPAN} at (0,0) size 8x18
RenderText {TEXT} at (12,0) size 8x18
text run at (12,0) width 8: "o"
RenderText {TEXT} at (20,0) size 78x18
text run at (20,0) width 78: "lorem ipsum"
RenderBlock {P} at (0,360) size 769x18
RenderText {TEXT} at (0,0) size 24x18
text run at (0,0) width 24: "Do "
RenderInline {SPAN} at (0,0) size 36x18
RenderText {TEXT} at (24,0) size 36x18
text run at (24,0) width 36: "lorem"
RenderText {TEXT} at (60,0) size 42x18
text run at (60,0) width 42: " ipsum"
RenderBlock {P} at (0,394) size 769x18
RenderText {TEXT} at (0,0) size 12x18
text run at (0,0) width 12: "D"
RenderInline {SPAN} at (0,0) size 12x18
RenderText {TEXT} at (12,0) size 12x18
text run at (12,0) width 12: "o "
RenderText {TEXT} at (24,0) size 78x18
text run at (24,0) width 78: "lorem ipsum"
RenderBlock {P} at (0,428) size 769x18
RenderText {TEXT} at (0,0) size 24x18
text run at (0,0) width 24: "Do "
RenderInline {SPAN} at (0,0) size 36x18
RenderText {TEXT} at (24,0) size 36x18
text run at (24,0) width 36: "lorem"
RenderText {TEXT} at (60,0) size 42x18
text run at (60,0) width 42: " ipsum"
RenderBlock {P} at (0,462) size 769x18
RenderText {TEXT} at (0,0) size 12x18
text run at (0,0) width 12: "D"
RenderInline {SPAN} at (0,0) size 12x18
RenderText {TEXT} at (12,0) size 12x18
text run at (12,0) width 12: "o "
RenderText {TEXT} at (24,0) size 78x18
text run at (24,0) width 78: "lorem ipsum"
RenderBlock {P} at (0,496) size 769x18
RenderText {TEXT} at (0,0) size 64x18
text run at (0,0) width 24: "Do "
text run at (24,0) width 40: " lorem"
RenderBlock {P} at (0,530) size 769x18
RenderText {TEXT} at (0,0) size 60x18
text run at (0,0) width 20: "Do"
text run at (20,0) width 4: " "
text run at (24,0) width 36: "lorem"
RenderBlock {P} at (0,564) size 769x18
RenderText {TEXT} at (0,0) size 60x18
text run at (0,0) width 24: "Do "
text run at (24,0) width 36: "lorem"
RenderBlock {P} at (0,598) size 769x18
RenderText {TEXT} at (0,0) size 60x18
text run at (0,0) width 20: "Do"
text run at (20,0) width 4: " "
text run at (24,0) width 36: "lorem"
RenderBlock {P} at (0,632) size 769x18
RenderText {TEXT} at (0,0) size 64x18
text run at (0,0) width 24: "Do "
text run at (24,0) width 4: " "
text run at (28,0) width 36: "lorem"
RenderBlock {P} at (0,666) size 769x18
RenderText {TEXT} at (0,0) size 60x18
text run at (0,0) width 24: "Do "
text run at (24,0) width 36: "lorem"
RenderBlock {P} at (0,700) size 769x18
RenderText {TEXT} at (0,0) size 20x18
text run at (0,0) width 20: "Do"
RenderInline {SPAN} at (0,0) size 0x18
RenderText {TEXT} at (20,0) size 78x18
text run at (20,0) width 78: "lorem ipsum"
RenderBlock {P} at (0,734) size 769x18
RenderText {TEXT} at (0,0) size 98x18
text run at (0,0) width 20: "Do"
text run at (20,0) width 78: "lorem ipsum"
RenderBlock {P} at (0,768) size 769x18
RenderInline {SPAN} at (0,0) size 20x18
RenderText {TEXT} at (0,0) size 20x18
text run at (0,0) width 20: "Do"
RenderText {TEXT} at (20,0) size 78x18
text run at (20,0) width 78: "lorem ipsum"
RenderBlock {P} at (0,802) size 769x18
RenderText {TEXT} at (0,0) size 20x18
text run at (0,0) width 20: "Do"
RenderInline {SPAN} at (0,0) size 78x18
RenderText {TEXT} at (20,0) size 78x18
text run at (20,0) width 78: "lorem ipsum"
RenderBlock {P} at (0,836) size 769x18
RenderInline {SPAN} at (0,0) size 20x18
RenderText {TEXT} at (0,0) size 20x18
text run at (0,0) width 20: "Do"
RenderText {TEXT} at (20,0) size 78x18
text run at (20,0) width 78: "lorem ipsum"
RenderBlock {P} at (0,870) size 769x18
RenderText {TEXT} at (0,0) size 246x18
text run at (0,0) width 246: "The following pair should be the same:"
RenderBlock {P} at (0,904) size 769x20
RenderText {TEXT} at (0,1) size 15x18
text run at (0,1) width 15: "W"
RenderBlock {SPAN} at (15,0) size 14x20 [border: (1px solid #FF0000)]
RenderText {TEXT} at (1,1) size 12x18
text run at (1,1) width 12: "X"
RenderText {TEXT} at (29,1) size 12x18
text run at (29,1) width 12: "Y"
RenderBlock {P} at (0,940) size 769x20
RenderText {TEXT} at (0,1) size 15x18
text run at (0,1) width 15: "W"
RenderBlock {SPAN} at (15,0) size 14x20 [border: (1px solid #FF0000)]
RenderText {TEXT} at (1,1) size 12x18
text run at (1,1) width 12: "X"
RenderText {TEXT} at (29,1) size 12x18
text run at (29,1) width 12: "Y"
layer at (28,118) size 14x20
RenderBlock (relative positioned) {SPAN} at (20,0) size 14x20 [border: (1px solid #FF0000)]
RenderText {TEXT} at (1,1) size 12x18
text run at (1,1) width 12: "X"
layer at (771,154) size 14x20
RenderBlock (positioned) {SPAN} at (771,154) size 14x20 [border: (1px solid #FF0000)]
RenderText {TEXT} at (1,1) size 12x18
text run at (1,1) width 12: "X"
1.1 LayoutTests/fast/text/softHyphen.html
Index: softHyphen.html
===================================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Soft hyphen displayed when first character</title>
</head>
<body>
<p>
In all of the following, there should not be a hyphen before “lorem”.
</p>
<p>Do<span style="float:right; display:inline-block; border:1px solid red;">X</span>­lorem ipsum</p>
<p><span style="float:right; display:inline-block; border:1px solid red;">X</span>­lorem ipsum</p>
<p>Do<span style="position:relative; display:inline-block; border:1px solid red;">X</span>­lorem ipsum</p>
<p>Do<span style="position:absolute; right:0; display:inline-block; border:1px solid red;">X</span>­lorem ipsum</p>
Do<p>­lorem ipsum</p>
<p>Do<br/>­lorem ipsum</p>
<p>Do<span>­lorem</span> ipsum</p>
<p>D<span>o</span>­lorem ipsum</p>
<p>Do <span>­lorem</span> ipsum</p>
<p>D<span>o </span>­lorem ipsum</p>
<p>Do <span>­lorem</span> ipsum</p>
<p>D<span>o </span>­lorem ipsum</p>
<p>Do ­ lorem</p><!-- WinIE displays as two spaces -->
<p>Do­ ­lorem</p>
<p>Do ­lorem</p>
<p>Do­ lorem</p>
<p>Do ­ lorem</p><!-- WinIE displays as two spaces -->
<p>Do ­ lorem</p>
<p>Do<span></span>­lorem ipsum</p>
<p>Do­­lorem ipsum</p>
<p><span>Do­</span>­lorem ipsum</p>
<p>Do­<span>­lorem ipsum</span></p>
<p><span>Do­­</span>lorem ipsum</p>
<p>The following pair should be the same:</p><!-- RenderText fix -->
<p>W<span style="display:inline-block; border:1px solid red;">­X</span>Y</p>
<p>W<span style="display:inline-block; border:1px solid red;">X</span>Y</p>
</body>
1.277 +15 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.276
retrieving revision 1.277
diff -u -r1.276 -r1.277
--- ChangeLog 24 Oct 2005 22:43:45 -0000 1.276
+++ ChangeLog 24 Oct 2005 22:51:04 -0000 1.277
@@ -1,3 +1,18 @@
+2005-10-24 Mitz Pettel <opendarwin.org at mitzpettel.com>
+
+ Reviewed by Darin, committed by beth.
+
+ Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=5384
+ Soft hyphen displayed as hyphen when it is the first character
+ in a line/run.
+
+ * khtml/rendering/bidi.cpp:
+ (khtml::checkMidpoints):
+ (khtml::RenderBlock::skipWhitespace):
+ (khtml::RenderBlock::findNextLineBreak):
+ * khtml/rendering/render_text.cpp:
+ (RenderText::calcMinMaxWidth):
+
2005-10-23 David Hyatt <hyatt at apple.com>
Make sure the button's generated text using the value with
1.153 +24 -8 WebCore/khtml/rendering/bidi.cpp
Index: bidi.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/bidi.cpp,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -r1.152 -r1.153
--- bidi.cpp 24 Oct 2005 17:47:26 -0000 1.152
+++ bidi.cpp 24 Oct 2005 22:51:06 -0000 1.153
@@ -475,9 +475,14 @@
if (endpoint.obj->isText()) {
// Don't shave a character off the endpoint if it was from a soft hyphen.
RenderText* textObj = static_cast<RenderText*>(endpoint.obj);
- if (endpoint.pos+1 < textObj->length() &&
- textObj->text()[endpoint.pos+1].unicode() == SOFT_HYPHEN)
- return;
+ if (endpoint.pos+1 < textObj->length()) {
+ if (textObj->text()[endpoint.pos+1].unicode() == SOFT_HYPHEN)
+ return;
+ } else if (startpoint.obj->isText()) {
+ RenderText *startText = static_cast<RenderText*>(startpoint.obj);
+ if (startText->length() > 0 && startText->text()[0].unicode() == SOFT_HYPHEN)
+ return;
+ }
}
endpoint.pos--;
}
@@ -1893,7 +1898,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() == '\t' || it.current() == '\n' || it.current().unicode() == SOFT_HYPHEN ||
skipNonBreakingSpace(it) || it.obj->isFloatingOrPositioned())))) {
if (it.obj->isFloatingOrPositioned()) {
RenderObject *o = it.obj;
@@ -1969,6 +1974,7 @@
RenderObject *o = start.obj;
RenderObject *last = o;
+ RenderObject *previous = o;
int pos = start.pos;
bool prevLineBrokeCleanly = previousLineBrokeCleanly;
@@ -2145,11 +2151,19 @@
isLineEmpty = false;
// Check for soft hyphens. Go ahead and ignore them.
- if (c.unicode() == SOFT_HYPHEN && pos > 0) {
+ if (c.unicode() == SOFT_HYPHEN) {
if (!ignoringSpaces) {
// Ignore soft hyphens
- BidiIterator endMid(0, o, pos-1);
- addMidpoint(endMid);
+ BidiIterator endMid;
+ if (pos > 0)
+ endMid = BidiIterator(0, o, pos-1);
+ else
+ endMid = BidiIterator(0, previous, previous->isText() ? static_cast<RenderText *>(previous)->stringLength() - 1 : 0);
+ // Two consecutive soft hyphens. Avoid overlapping midpoints.
+ if (sNumMidpoints && smidpoints->at(sNumMidpoints - 1).obj == endMid.obj && smidpoints->at(sNumMidpoints - 1).pos > endMid.pos)
+ sNumMidpoints--;
+ else
+ addMidpoint(endMid);
// Add the width up to but not including the hyphen.
tmpW += t->width(lastSpace, pos - lastSpace, f, w+tmpW);
@@ -2248,7 +2262,7 @@
}
goto end; // Didn't fit. Jump to the end.
}
- else if (pos > 1 && str[pos-1].unicode() == SOFT_HYPHEN)
+ else if (pos > 0 && 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);
}
@@ -2396,6 +2410,8 @@
}
last = o;
+ if (!o->isFloating() && (!o->isPositioned() || o->hasStaticX() || o->hasStaticY() || !o->container()->isInlineFlow()))
+ previous = o;
o = next;
if (!last->isFloatingOrPositioned() && last->isReplaced() && last->style()->whiteSpace() == NORMAL &&
1.203 +2 -2 WebCore/khtml/rendering/render_text.cpp
Index: render_text.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_text.cpp,v
retrieving revision 1.202
retrieving revision 1.203
diff -u -r1.202 -r1.203
--- render_text.cpp 20 Oct 2005 06:02:24 -0000 1.202
+++ render_text.cpp 24 Oct 2005 22:51:06 -0000 1.203
@@ -1334,13 +1334,13 @@
ignoringSpaces = false;
// Ignore spaces and soft hyphens
- if (ignoringSpaces || (i > 0 && c.unicode() == SOFT_HYPHEN)) {
+ if (ignoringSpaces || c.unicode() == SOFT_HYPHEN) {
continue;
}
bool hasBreak = isBreakable(txt, i, len, nextBreakable);
int j = i;
- while (c != '\n' && c != ' ' && c != '\t' && (j == 0 || c.unicode() != SOFT_HYPHEN)) {
+ while (c != '\n' && c != ' ' && c != '\t' && c.unicode() != SOFT_HYPHEN) {
j++;
if (j == len)
break;
More information about the webkit-changes
mailing list