[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9
mitz at apple.com
mitz at apple.com
Thu Feb 4 21:27:43 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit e928366eec3fe57baf7539c491c377d8c386bfa6
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Jan 26 06:00:47 2010 +0000
<rdar://problem/7573493> Error with line break inside ?» pair of characters.
https://bugs.webkit.org/show_bug.cgi?id=17475
Reviewed by Darin Adler.
WebCore:
Test: fast/text/line-break-after-question-mark.html
Instead of unconditionally allowing lines to break after a question mark, which was intended
to mimic Internet Explorer, apply the Unicode line breaking behavior after a question mark,
with one exception in the ASCII range to match IE, namely not allowing a line break between
a question mark and a vertical line.
* rendering/break_lines.cpp:
(WebCore::shouldBreakAfter): Added a next character parameter. Changed to consult a table
for the question mark case in order to keep it fast and not require a text break iterator in
the ASCII case.
(WebCore::nextBreakablePosition): Pass the next character to shouldBreakAfter.
LayoutTests:
* fast/text/line-break-after-question-mark-expected.txt: Added.
* fast/text/line-break-after-question-mark.html: Added.
* fast/text/script-tests/line-break-after-question-mark.js: Added.
():
* platform/mac/tables/mozilla/bugs/bug6674-expected.checksum: Updated.
* platform/mac/tables/mozilla/bugs/bug6674-expected.png: Updated.
* platform/mac/tables/mozilla/bugs/bug6674-expected.txt: Updated.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53839 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 52e8a16..1c8dfd5 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
+2010-01-25 Dan Bernstein <mitz at apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/7573493> Error with line break inside ?» pair of characters.
+ https://bugs.webkit.org/show_bug.cgi?id=17475
+
+ * fast/text/line-break-after-question-mark-expected.txt: Added.
+ * fast/text/line-break-after-question-mark.html: Added.
+ * fast/text/script-tests/line-break-after-question-mark.js: Added.
+ ():
+ * platform/mac/tables/mozilla/bugs/bug6674-expected.checksum: Updated.
+ * platform/mac/tables/mozilla/bugs/bug6674-expected.png: Updated.
+ * platform/mac/tables/mozilla/bugs/bug6674-expected.txt: Updated.
+
2010-01-25 Peter Kasting <pkasting at google.com>
Reviewed by Dan Bernstein.
diff --git a/LayoutTests/fast/text/line-break-after-question-mark-expected.txt b/LayoutTests/fast/text/line-break-after-question-mark-expected.txt
new file mode 100644
index 0000000..d8fa6d8
--- /dev/null
+++ b/LayoutTests/fast/text/line-break-after-question-mark-expected.txt
@@ -0,0 +1,104 @@
+Tests when line breaking is allowed after a question mark character.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS allowsBreakBefore(33) is false
+PASS allowsBreakBefore(34) is false
+PASS allowsBreakBefore(35) is true
+PASS allowsBreakBefore(36) is true
+PASS allowsBreakBefore(37) is true
+PASS allowsBreakBefore(38) is true
+PASS allowsBreakBefore(39) is false
+PASS allowsBreakBefore(40) is true
+PASS allowsBreakBefore(41) is false
+PASS allowsBreakBefore(42) is true
+PASS allowsBreakBefore(43) is true
+PASS allowsBreakBefore(44) is false
+PASS allowsBreakBefore(45) is true
+PASS allowsBreakBefore(46) is false
+PASS allowsBreakBefore(47) is false
+PASS allowsBreakBefore(48) is true
+PASS allowsBreakBefore(49) is true
+PASS allowsBreakBefore(50) is true
+PASS allowsBreakBefore(51) is true
+PASS allowsBreakBefore(52) is true
+PASS allowsBreakBefore(53) is true
+PASS allowsBreakBefore(54) is true
+PASS allowsBreakBefore(55) is true
+PASS allowsBreakBefore(56) is true
+PASS allowsBreakBefore(57) is true
+PASS allowsBreakBefore(58) is false
+PASS allowsBreakBefore(59) is false
+PASS allowsBreakBefore(60) is true
+PASS allowsBreakBefore(61) is true
+PASS allowsBreakBefore(62) is true
+PASS allowsBreakBefore(63) is false
+PASS allowsBreakBefore(64) is true
+PASS allowsBreakBefore(65) is true
+PASS allowsBreakBefore(66) is true
+PASS allowsBreakBefore(67) is true
+PASS allowsBreakBefore(68) is true
+PASS allowsBreakBefore(69) is true
+PASS allowsBreakBefore(70) is true
+PASS allowsBreakBefore(71) is true
+PASS allowsBreakBefore(72) is true
+PASS allowsBreakBefore(73) is true
+PASS allowsBreakBefore(74) is true
+PASS allowsBreakBefore(75) is true
+PASS allowsBreakBefore(76) is true
+PASS allowsBreakBefore(77) is true
+PASS allowsBreakBefore(78) is true
+PASS allowsBreakBefore(79) is true
+PASS allowsBreakBefore(80) is true
+PASS allowsBreakBefore(81) is true
+PASS allowsBreakBefore(82) is true
+PASS allowsBreakBefore(83) is true
+PASS allowsBreakBefore(84) is true
+PASS allowsBreakBefore(85) is true
+PASS allowsBreakBefore(86) is true
+PASS allowsBreakBefore(87) is true
+PASS allowsBreakBefore(88) is true
+PASS allowsBreakBefore(89) is true
+PASS allowsBreakBefore(90) is true
+PASS allowsBreakBefore(91) is true
+PASS allowsBreakBefore(92) is true
+PASS allowsBreakBefore(93) is false
+PASS allowsBreakBefore(94) is true
+PASS allowsBreakBefore(95) is true
+PASS allowsBreakBefore(96) is true
+PASS allowsBreakBefore(97) is true
+PASS allowsBreakBefore(98) is true
+PASS allowsBreakBefore(99) is true
+PASS allowsBreakBefore(100) is true
+PASS allowsBreakBefore(101) is true
+PASS allowsBreakBefore(102) is true
+PASS allowsBreakBefore(103) is true
+PASS allowsBreakBefore(104) is true
+PASS allowsBreakBefore(105) is true
+PASS allowsBreakBefore(106) is true
+PASS allowsBreakBefore(107) is true
+PASS allowsBreakBefore(108) is true
+PASS allowsBreakBefore(109) is true
+PASS allowsBreakBefore(110) is true
+PASS allowsBreakBefore(111) is true
+PASS allowsBreakBefore(112) is true
+PASS allowsBreakBefore(113) is true
+PASS allowsBreakBefore(114) is true
+PASS allowsBreakBefore(115) is true
+PASS allowsBreakBefore(116) is true
+PASS allowsBreakBefore(117) is true
+PASS allowsBreakBefore(118) is true
+PASS allowsBreakBefore(119) is true
+PASS allowsBreakBefore(120) is true
+PASS allowsBreakBefore(121) is true
+PASS allowsBreakBefore(122) is true
+PASS allowsBreakBefore(123) is true
+PASS allowsBreakBefore(124) is true
+PASS allowsBreakBefore(125) is false
+PASS allowsBreakBefore(126) is true
+PASS allowsBreakBefore(127) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/text/line-break-after-question-mark.html b/LayoutTests/fast/text/line-break-after-question-mark.html
new file mode 100644
index 0000000..cdfb010
--- /dev/null
+++ b/LayoutTests/fast/text/line-break-after-question-mark.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/line-break-after-question-mark.js"></script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/script-tests/line-break-after-question-mark.js b/LayoutTests/fast/text/script-tests/line-break-after-question-mark.js
new file mode 100644
index 0000000..de94d95
--- /dev/null
+++ b/LayoutTests/fast/text/script-tests/line-break-after-question-mark.js
@@ -0,0 +1,21 @@
+description("Tests when line breaking is allowed after a question mark character.");
+
+var div = document.body.appendChild(document.createElement("div"));
+div.style.width = "1px";
+div.style.fontFamily = "ahem";
+div.style.fontSize = "25px";
+
+function allowsBreakBefore(i)
+{
+ div.innerText = "A?" + String.fromCharCode(i);
+ return div.offsetHeight > 25;
+}
+
+var unallowedBreaks = [0x21, 0x22, 0x27, 0x29, 0x2c, 0x2e, 0x2f, 0x3a, 0x3b, 0x3f, 0x5d, 0x7d];
+
+for (var i = 33; i < 128; ++i)
+ shouldBe("allowsBreakBefore(" + i + ")", unallowedBreaks.indexOf(i) >= 0 ? "false" : "true");
+
+document.body.removeChild(div);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/platform/mac/tables/mozilla/bugs/bug6674-expected.checksum b/LayoutTests/platform/mac/tables/mozilla/bugs/bug6674-expected.checksum
index 203d7db..a136e20 100644
--- a/LayoutTests/platform/mac/tables/mozilla/bugs/bug6674-expected.checksum
+++ b/LayoutTests/platform/mac/tables/mozilla/bugs/bug6674-expected.checksum
@@ -1 +1 @@
-3f34db6f20f905bc879d38c647d510d9
\ No newline at end of file
+22929675c6aaf2593671667a807689e9
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/tables/mozilla/bugs/bug6674-expected.png b/LayoutTests/platform/mac/tables/mozilla/bugs/bug6674-expected.png
index e9a47b9..37350bd 100644
Binary files a/LayoutTests/platform/mac/tables/mozilla/bugs/bug6674-expected.png and b/LayoutTests/platform/mac/tables/mozilla/bugs/bug6674-expected.png differ
diff --git a/LayoutTests/platform/mac/tables/mozilla/bugs/bug6674-expected.txt b/LayoutTests/platform/mac/tables/mozilla/bugs/bug6674-expected.txt
index 7da8bac..b362aa2 100644
--- a/LayoutTests/platform/mac/tables/mozilla/bugs/bug6674-expected.txt
+++ b/LayoutTests/platform/mac/tables/mozilla/bugs/bug6674-expected.txt
@@ -1,21 +1,19 @@
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
-layer at (0,0) size 800x160
- RenderBlock {HTML} at (0,0) size 800x160
- RenderBody {BODY} at (8,8) size 784x144
- RenderTable {TABLE} at (0,0) size 96x52 [border: (1px outset #808080)]
- RenderTableSection {TBODY} at (1,1) size 94x50
- RenderTableRow {TR} at (0,2) size 94x46
- RenderTableCell {TD} at (2,2) size 90x46 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
- RenderBlock {DIV} at (2,2) size 86x42 [border: (3px dotted #00FF00)]
- RenderText {#text} at (3,3) size 107x36
- text run at (3,3) width 71: "Truncated?"
- text run at (3,21) width 107: " It should not be!"
- RenderBlock {P} at (0,68) size 784x18
+layer at (0,0) size 800x124
+ RenderBlock {HTML} at (0,0) size 800x124
+ RenderBody {BODY} at (8,8) size 784x108
+ RenderTable {TABLE} at (0,0) size 96x34 [border: (1px outset #808080)]
+ RenderTableSection {TBODY} at (1,1) size 94x32
+ RenderTableRow {TR} at (0,2) size 94x28
+ RenderTableCell {TD} at (2,2) size 90x28 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+ RenderBlock {DIV} at (2,2) size 86x24 [border: (3px dotted #00FF00)]
+ RenderText {#text} at (3,3) size 178x18
+ text run at (3,3) width 178: "Truncated? It should not be!"
+ RenderBlock {P} at (0,50) size 784x18
RenderText {#text} at (0,0) size 738x18
text run at (0,0) width 463: "According to the rules of CSS, the text above should spill right out of the "
text run at (463,0) width 275: "table, as it does in the table-less case below:"
- RenderBlock {DIV} at (0,102) size 86x42 [border: (3px dotted #00FF00)]
- RenderText {#text} at (3,3) size 107x36
- text run at (3,3) width 71: "Truncated?"
- text run at (3,21) width 107: " It should not be!"
+ RenderBlock {DIV} at (0,84) size 86x24 [border: (3px dotted #00FF00)]
+ RenderText {#text} at (3,3) size 178x18
+ text run at (3,3) width 178: "Truncated? It should not be!"
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8e972d4..c059568 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2010-01-25 Dan Bernstein <mitz at apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/7573493> Error with line break inside ?» pair of characters.
+ https://bugs.webkit.org/show_bug.cgi?id=17475
+
+ Test: fast/text/line-break-after-question-mark.html
+
+ Instead of unconditionally allowing lines to break after a question mark, which was intended
+ to mimic Internet Explorer, apply the Unicode line breaking behavior after a question mark,
+ with one exception in the ASCII range to match IE, namely not allowing a line break between
+ a question mark and a vertical line.
+
+ * rendering/break_lines.cpp:
+ (WebCore::shouldBreakAfter): Added a next character parameter. Changed to consult a table
+ for the question mark case in order to keep it fast and not require a text break iterator in
+ the ASCII case.
+ (WebCore::nextBreakablePosition): Pass the next character to shouldBreakAfter.
+
2010-01-25 Peter Kasting <pkasting at google.com>
Reviewed by Dan Bernstein.
diff --git a/WebCore/rendering/break_lines.cpp b/WebCore/rendering/break_lines.cpp
index 9b46cd2..3a545e4 100644
--- a/WebCore/rendering/break_lines.cpp
+++ b/WebCore/rendering/break_lines.cpp
@@ -1,21 +1,26 @@
/*
- * Copyright (C) 2005, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2005, 2007, 2010 Apple Inc. All rights reserved.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
@@ -44,13 +49,30 @@ static inline bool isBreakableSpace(UChar ch, bool treatNoBreakSpaceAsBreak)
}
}
-static inline bool shouldBreakAfter(UChar ch)
+// This differs from the Unicode algorithm only in that Unicode does not break
+// between a question mark and a vertical line (U+007C).
+static const unsigned char internetExplorerLineBreaksAfterQuestionMarkTable[0x80] = {
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, // \t
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, // ! " ' ) , . /
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, // : ; ?
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, // ]
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1 // }
+};
+
+static const size_t internetExplorerLineBreaksAfterQuestionMarkTableSize = sizeof(internetExplorerLineBreaksAfterQuestionMarkTable) / sizeof(*internetExplorerLineBreaksAfterQuestionMarkTable);
+
+static inline bool shouldBreakAfter(UChar ch, UChar nextCh)
{
- // Match WinIE's breaking strategy, which is to always allow breaks after hyphens and question marks.
- // FIXME: it appears that IE behavior is more complex, see <http://bugs.webkit.org/show_bug.cgi?id=17475>.
switch (ch) {
- case '-':
+ // For a question mark preceding a non-ASCII characters, defer to the Unicode algorithm by returning false.
+ // For ASCII characters, use a lookup table for enhanced speed and for compatibility with Internet Explorer.
case '?':
+ return nextCh <= internetExplorerLineBreaksAfterQuestionMarkTableSize && internetExplorerLineBreaksAfterQuestionMarkTable[nextCh];
+ // Internet Explorer always allows breaking after a hyphen.
+ case '-':
case softHyphen:
// FIXME: cases for ideographicComma and ideographicFullStop are a workaround for an issue in Unicode 5.0
// which is likely to be resolved in Unicode 5.1 <http://bugs.webkit.org/show_bug.cgi?id=17411>.
@@ -88,7 +110,7 @@ int nextBreakablePosition(const UChar* str, int pos, int len, bool treatNoBreakS
for (int i = pos; i < len; i++) {
UChar ch = str[i];
- if (isBreakableSpace(ch, treatNoBreakSpaceAsBreak) || shouldBreakAfter(lastCh))
+ if (isBreakableSpace(ch, treatNoBreakSpaceAsBreak) || shouldBreakAfter(lastCh, ch))
return i;
if (needsLineBreakIterator(ch) || needsLineBreakIterator(lastCh)) {
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list