[webkit-changes] cvs commit:
WebCore/layout-tests/fast/text/whitespace
tab-character-basics-expected.txt tab-character-basics.html
David
harrison at opensource.apple.com
Mon Aug 15 16:31:17 PDT 2005
harrison 05/08/15 16:31:17
Modified: . ChangeLog
khtml/rendering bidi.cpp
Added: layout-tests/fast/text/whitespace
tab-character-basics-expected.txt
tab-character-basics.html
Log:
Reviewed by Darin.
<rdar://problem/4202641> Line breaks do not happen inside whitespace:pre; word-wrap: break-word
Test cases added: fast/text/whitespace/tab-character-basics.html
Refined Dave's earlier patch for this bug to handle whitespace:pre that is not at the beginning of a line.
* khtml/rendering/bidi.cpp:
(khtml::RenderBlock::findNextLineBreak):
* layout-tests/fast/text/whitespace/tab-character-basics-expected.txt: Added.
* layout-tests/fast/text/whitespace/tab-character-basics.html: Added.
Revision Changes Path
1.4579 +15 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4578
retrieving revision 1.4579
diff -u -r1.4578 -r1.4579
--- ChangeLog 15 Aug 2005 21:57:12 -0000 1.4578
+++ ChangeLog 15 Aug 2005 23:31:04 -0000 1.4579
@@ -1,3 +1,18 @@
+2005-08-15 David Harrison <harrison at apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/4202641> Line breaks do not happen inside whitespace:pre; word-wrap: break-word
+
+ Test cases added: fast/text/whitespace/tab-character-basics.html
+
+ Refined Dave's earlier patch for this bug to handle whitespace:pre that is not at the beginning of a line.
+
+ * khtml/rendering/bidi.cpp:
+ (khtml::RenderBlock::findNextLineBreak):
+ * layout-tests/fast/text/whitespace/tab-character-basics-expected.txt: Added.
+ * layout-tests/fast/text/whitespace/tab-character-basics.html: Added.
+
2005-08-15 Darin Adler <darin at apple.com>
Reviewed by Justin.
1.140 +15 -16 WebCore/khtml/rendering/bidi.cpp
Index: bidi.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/bidi.cpp,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -r1.139 -r1.140
--- bidi.cpp 15 Aug 2005 04:31:06 -0000 1.139
+++ bidi.cpp 15 Aug 2005 23:31:16 -0000 1.140
@@ -2079,7 +2079,7 @@
bool previousCharacterIsSpace = currentCharacterIsSpace;
bool previousCharacterIsWS = currentCharacterIsWS;
const QChar c = str[pos];
- currentCharacterIsSpace = c == ' ' || (!isPre && (c == '\n' || c == '\t'));
+ currentCharacterIsSpace = c == ' ' || c == '\t' || (!isPre && (c == '\n'));
if (isPre || !currentCharacterIsSpace)
isLineEmpty = false;
@@ -2112,13 +2112,13 @@
bool applyWordSpacing = false;
bool isNormal = o->style()->whiteSpace() == NORMAL;
bool breakNBSP = isNormal && o->style()->nbspMode() == SPACE;
- bool breakWords = w == 0 && o->style()->wordWrap() == BREAK_WORD && (isNormal || o->style()->whiteSpace() == PRE);
+ bool breakWords = o->style()->wordWrap() == BREAK_WORD && ((isNormal && w == 0) || o->style()->whiteSpace() == PRE);
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)) {
+ if (c == '\n' || (!isPre && isBreakable(str, pos, strlen, breakNBSP)) || (breakWords && (w + wrapW > width))) {
if (ignoringSpaces) {
if (!currentCharacterIsSpace) {
// Stop ignoring spaces and begin at this
@@ -2179,7 +2179,7 @@
// If the line needs the extra whitespace to be too long,
// then move the line break to the space and skip all
// additional whitespace.
- if (w + tmpW < width) {
+ if (w + tmpW <= width) {
lBreak.obj = o;
lBreak.pos = pos;
skipWhitespace(lBreak, bidi);
@@ -2279,19 +2279,18 @@
if (currentCharacterIsSpace)
checkForBreak = true;
else {
+ checkForBreak = false;
RenderText* nextText = static_cast<RenderText*>(next);
- int strlen = nextText->stringLength();
- QChar *str = nextText->text();
- if (strlen &&
- ((str[0].unicode() == ' ') ||
- (next->style()->whiteSpace() != PRE && str[0] == '\n'))) {
- // If the next item on the line is text, and if we did not end with
- // a space, then the next text run continues our word (and so it needs to
- // keep adding to |tmpW|. Just update and continue.
- checkForBreak = true;
- tmpW += nextText->htmlFont(m_firstLine)->getWordSpacing();
- } else
- checkForBreak = false;
+ if (nextText->stringLength() != 0) {
+ QChar c = nextText->text()[0];
+ if (c == ' ' || c == '\t' || (c == '\n' && next->style()->whiteSpace() != PRE)) {
+ // If the next item on the line is text, and if we did not end with
+ // a space, then the next text run continues our word (and so it needs to
+ // keep adding to |tmpW|. Just update and continue.
+ checkForBreak = true;
+ tmpW += nextText->htmlFont(m_firstLine)->getWordSpacing();
+ }
+ }
bool canPlaceOnLine = (w + tmpW <= width+1) || !isNormal;
if (canPlaceOnLine && checkForBreak) {
w += tmpW;
1.1 WebCore/layout-tests/fast/text/whitespace/tab-character-basics-expected.txt
Index: tab-character-basics-expected.txt
===================================================================
layer at (0,0) size 800x600
RenderCanvas at (0,0) size 800x600
layer at (0,0) size 800x502
RenderBlock {HTML} at (0,0) size 800x502
RenderBody {BODY} at (8,8) size 646x486 [border: (3px solid #FF0000)]
RenderBlock {P} at (3,19) size 640x21 [color=#0000FF]
RenderText {TEXT} at (0,0) size 530x21
text run at (0,0) width 530: "-- Following text and list are whitespace:NORMAL only"
RenderBlock {P} at (3,56) size 640x42
RenderText {TEXT} at (0,0) size 310x21
text run at (0,0) width 310: "0123456789012345678901234567890"
RenderBR {BR} at (310,0) size 0x21
RenderText {TEXT} at (0,21) size 80x21
text run at (0,21) width 80: "X\x{9}XX\x{9}XXX"
RenderBlock {OL} at (3,114) size 640x63
RenderListItem {LI} at (40,0) size 600x21
RenderListMarker at (0,0) size 0x16
RenderText {TEXT} at (0,0) size 30x21
text run at (0,0) width 30: "a\x{9}X"
RenderListItem {LI} at (40,21) size 600x21
RenderListMarker at (0,0) size 0x16
RenderText {TEXT} at (0,0) size 40x21
text run at (0,0) width 40: "bb\x{9}X"
RenderListItem {LI} at (40,42) size 600x21
RenderListMarker at (0,0) size 0x16
RenderText {TEXT} at (0,0) size 50x21
text run at (0,0) width 50: "ccc\x{9}X"
RenderBlock {P} at (3,193) size 640x21 [color=#0000FF]
RenderText {TEXT} at (0,0) size 500x21
text run at (0,0) width 500: "-- Following text and list are whitespace:PRE only"
RenderBlock {OL} at (3,230) size 640x63
RenderListItem {LI} at (40,0) size 600x21
RenderListMarker at (0,0) size 0x16
RenderText {TEXT} at (0,0) size 170x21
text run at (0,0) width 170: "a\x{9}\x{9}X"
RenderListItem {LI} at (40,21) size 600x21
RenderListMarker at (0,0) size 0x16
RenderText {TEXT} at (0,0) size 90x21
text run at (0,0) width 90: "bb\x{9}X"
RenderListItem {LI} at (40,42) size 600x21
RenderListMarker at (0,0) size 0x16
RenderText {TEXT} at (0,0) size 90x21
text run at (0,0) width 90: "ccc\x{9}X"
RenderBlock {P} at (3,309) size 640x63
RenderText {TEXT} at (0,0) size 510x21
text run at (0,0) width 510: "012345678901234567890123456789012345678901234567890"
RenderBR {BR} at (510,0) size 0x21
RenderText {TEXT} at (0,21) size 640x42
text run at (0,21) width 640: "X\x{9}\x{9}XX\x{9}\x{9}XXX\x{9}\x{9}XXXX\x{9}\x{9}"
text run at (0,42) width 50: "XXXXX"
RenderBlock {P} at (3,388) size 640x21 [color=#0000FF]
RenderText {TEXT} at (0,0) size 600x21
text run at (0,0) width 600: "-- Following text mixes whitespace:NORMAL and whitespace:PRE"
RenderBlock {P} at (3,425) size 640x42
RenderText {TEXT} at (0,0) size 490x21
text run at (0,0) width 490: "AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH IIII JJJJ"
RenderInline {SPAN} at (0,0) size 640x41
RenderText {TEXT} at (490,0) size 640x42
text run at (490,0) width 150: "\x{9}\x{9}"
text run at (0,21) width 160: "\x{9}\x{9}"
RenderText {TEXT} at (160,21) size 40x21
text run at (160,21) width 40: "KKKK"
1.1 WebCore/layout-tests/fast/text/whitespace/tab-character-basics.html
Index: tab-character-basics.html
===================================================================
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<body style="border-style: solid; border-color: red;
width: 640px; font-family:Monaco; word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; " contenteditable="true">
<p style="color:blue">-- Following text and list are whitespace:NORMAL only</p>
<p>0123456789012345678901234567890<BR>X XX XXX</p>
<ol><li>a X</li><li>bb X</li><li>ccc X</li></ol>
<p style="color:blue">-- Following text and list are whitespace:PRE only</p>
<ol style="white-space:pre"><li>a X</li><li>bb X</li><li>ccc X</li></ol>
<p style="white-space:pre">012345678901234567890123456789012345678901234567890<BR>X XX XXX XXXX XXXXX</p>
<p style="color:blue">-- Following text mixes whitespace:NORMAL and whitespace:PRE</p>
<p>AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH IIII JJJJ<SPAN class="Apple-tab-span" style="white-space:pre"> </SPAN>KKKK</p>
</body>
</html>
More information about the webkit-changes
mailing list