Title: [120624] trunk
- Revision
- 120624
- Author
- [email protected]
- Date
- 2012-06-18 13:40:28 -0700 (Mon, 18 Jun 2012)
Log Message
Ideographic comma and full-stops are mishandled in linebreak
https://bugs.webkit.org/show_bug.cgi?id=87041
Reviewed by Alexey Proskuryakov.
Source/WebCore:
Test: fast/text/line-breaks-after-ideographic-comma-or-full-stop-2.html
Specifically, line breaks were always allowed after an ideographic comma or full stop, even
before a closing bracket.
* rendering/break_lines.cpp:
(WebCore::shouldBreakAfter): Removed code that unconditionally allowed line breaks after
ideographic commas and full stops, which was added for <http://webkit.org/b/17411> to work
around an issue in Unicode 5.0. Current line break iterator implementations are based on
newer versions of Unicode, which do not have that issue, so we can use them instead of the
hardcoded approximate rule.
LayoutTests:
* fast/text/line-breaks-after-ideographic-comma-or-full-stop-2-expected.txt: Added.
* fast/text/line-breaks-after-ideographic-comma-or-full-stop-2.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (120623 => 120624)
--- trunk/LayoutTests/ChangeLog 2012-06-18 20:35:50 UTC (rev 120623)
+++ trunk/LayoutTests/ChangeLog 2012-06-18 20:40:28 UTC (rev 120624)
@@ -1,3 +1,13 @@
+2012-06-18 Dan Bernstein <[email protected]>
+
+ Ideographic comma and full-stops are mishandled in linebreak
+ https://bugs.webkit.org/show_bug.cgi?id=87041
+
+ Reviewed by Alexey Proskuryakov.
+
+ * fast/text/line-breaks-after-ideographic-comma-or-full-stop-2-expected.txt: Added.
+ * fast/text/line-breaks-after-ideographic-comma-or-full-stop-2.html: Added.
+
2012-06-18 Mike West <[email protected]>
Crash in CSPSource::parseSource
Added: trunk/LayoutTests/fast/text/line-breaks-after-ideographic-comma-or-full-stop-2-expected.txt (0 => 120624)
--- trunk/LayoutTests/fast/text/line-breaks-after-ideographic-comma-or-full-stop-2-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/text/line-breaks-after-ideographic-comma-or-full-stop-2-expected.txt 2012-06-18 20:40:28 UTC (rev 120624)
@@ -0,0 +1,4 @@
+This tests that a line break is prohibited between an ideographic comma and a right corner bracket.
+
+う、」う
+PASS
Added: trunk/LayoutTests/fast/text/line-breaks-after-ideographic-comma-or-full-stop-2.html (0 => 120624)
--- trunk/LayoutTests/fast/text/line-breaks-after-ideographic-comma-or-full-stop-2.html (rev 0)
+++ trunk/LayoutTests/fast/text/line-breaks-after-ideographic-comma-or-full-stop-2.html 2012-06-18 20:40:28 UTC (rev 120624)
@@ -0,0 +1,22 @@
+<p>
+ This tests that a line break is prohibited between an ideographic comma and a right corner bracket.
+</p>
+<div id="target" style="font-size: 72px;">う、」う</div>
+<p id="result">Test did not run.</p>
+<script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ var target = document.getElementById("target");
+ var range = document.createRange();
+ range.setStart(target.firstChild, 0);
+ range.setEnd(target.firstChild, 2);
+ var width = Math.ceil(range.getBoundingClientRect().width);
+ target.style.width = width + "px";
+
+ range.setStart(target.firstChild, 2);
+ range.setEnd(target.firstChild, 3);
+ var left = Math.ceil(range.getBoundingClientRect().left) - target.offsetLeft;
+
+ document.getElementById("result").innerText = left >= width ? "PASS" : "FAIL";
+</script>
Modified: trunk/Source/WebCore/ChangeLog (120623 => 120624)
--- trunk/Source/WebCore/ChangeLog 2012-06-18 20:35:50 UTC (rev 120623)
+++ trunk/Source/WebCore/ChangeLog 2012-06-18 20:40:28 UTC (rev 120624)
@@ -1,3 +1,22 @@
+2012-06-18 Dan Bernstein <[email protected]>
+
+ Ideographic comma and full-stops are mishandled in linebreak
+ https://bugs.webkit.org/show_bug.cgi?id=87041
+
+ Reviewed by Alexey Proskuryakov.
+
+ Test: fast/text/line-breaks-after-ideographic-comma-or-full-stop-2.html
+
+ Specifically, line breaks were always allowed after an ideographic comma or full stop, even
+ before a closing bracket.
+
+ * rendering/break_lines.cpp:
+ (WebCore::shouldBreakAfter): Removed code that unconditionally allowed line breaks after
+ ideographic commas and full stops, which was added for <http://webkit.org/b/17411> to work
+ around an issue in Unicode 5.0. Current line break iterator implementations are based on
+ newer versions of Unicode, which do not have that issue, so we can use them instead of the
+ hardcoded approximate rule.
+
2012-06-18 Martin Robinson <[email protected]>
[TextureMapper] Rename shader variables to match the naming scheme of the newer filter shaders
Modified: trunk/Source/WebCore/rendering/break_lines.cpp (120623 => 120624)
--- trunk/Source/WebCore/rendering/break_lines.cpp 2012-06-18 20:35:50 UTC (rev 120623)
+++ trunk/Source/WebCore/rendering/break_lines.cpp 2012-06-18 20:40:28 UTC (rev 120624)
@@ -121,32 +121,21 @@
static inline bool shouldBreakAfter(UChar lastCh, UChar ch, UChar nextCh)
{
- switch (ch) {
- case ideographicComma:
- case ideographicFullStop:
- // 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>.
- // We may want to remove or conditionalize this workaround at some point.
- return true;
- case '-':
- if (isASCIIDigit(nextCh)) {
- // Don't allow line breaking between '-' and a digit if the '-' may mean a minus sign in the context,
- // while allow breaking in 'ABCD-1234' and '1234-5678' which may be in long URLs.
- return isASCIIAlphanumeric(lastCh);
- }
- // Fall through
- default:
- // If both ch and nextCh are ASCII characters, use a lookup table for enhanced speed and for compatibility
- // with other browsers (see comments for asciiLineBreakTable for details).
- if (ch >= asciiLineBreakTableFirstChar && ch <= asciiLineBreakTableLastChar
- && nextCh >= asciiLineBreakTableFirstChar && nextCh <= asciiLineBreakTableLastChar) {
- const unsigned char* tableRow = asciiLineBreakTable[ch - asciiLineBreakTableFirstChar];
- int nextChIndex = nextCh - asciiLineBreakTableFirstChar;
- return tableRow[nextChIndex / 8] & (1 << (nextChIndex % 8));
- }
- // Otherwise defer to the Unicode algorithm by returning false.
- return false;
+ // Don't allow line breaking between '-' and a digit if the '-' may mean a minus sign in the context,
+ // while allow breaking in 'ABCD-1234' and '1234-5678' which may be in long URLs.
+ if (ch == '-' && isASCIIDigit(nextCh))
+ return isASCIIAlphanumeric(lastCh);
+
+ // If both ch and nextCh are ASCII characters, use a lookup table for enhanced speed and for compatibility
+ // with other browsers (see comments for asciiLineBreakTable for details).
+ if (ch >= asciiLineBreakTableFirstChar && ch <= asciiLineBreakTableLastChar
+ && nextCh >= asciiLineBreakTableFirstChar && nextCh <= asciiLineBreakTableLastChar) {
+ const unsigned char* tableRow = asciiLineBreakTable[ch - asciiLineBreakTableFirstChar];
+ int nextChIndex = nextCh - asciiLineBreakTableFirstChar;
+ return tableRow[nextChIndex / 8] & (1 << (nextChIndex % 8));
}
+ // Otherwise defer to the Unicode algorithm by returning false.
+ return false;
}
static inline bool needsLineBreakIterator(UChar ch)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes