- Revision
- 102538
- Author
- m...@apple.com
- Date
- 2011-12-11 11:06:56 -0800 (Sun, 11 Dec 2011)
Log Message
Source/WebCore: <rdar://problem/10561285> REGRESSION (r80438): First word on a line or after collapsed space may not be hyphenated even though it should
https://bugs.webkit.org/show_bug.cgi?id=74239
Reviewed by Anders Carlsson.
Tests: fast/text/hyphenate-first-word-after-skipped-space-expected.html
fast/text/hyphenate-first-word-after-skipped-space.html
* rendering/RenderBlockLineLayout.cpp:
(WebCore::tryHyphenating): Replaced the assumption that the character at lastSpace is a space
iff lastSpace is non-zero with a test of whether it is a space, in the sense that it should
not be counted as part of the prefix when comparing it to the value of hyphenate-limit-before.
LayoutTests: Test and updated results for <rdar://problem/10561285> REGRESSION (r80438): First word on a line or after collapsed space may not be hyphenated even though it should
https://bugs.webkit.org/show_bug.cgi?id=74239
Reviewed by Anders Carlsson.
* fast/text/hyphenate-first-word-after-skipped-space-expected.html: Added.
* fast/text/hyphenate-first-word-after-skipped-space.html: Added.
* platform/mac/fast/text/hyphenate-limit-lines-expected.txt:
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (102537 => 102538)
--- trunk/LayoutTests/ChangeLog 2011-12-11 18:04:50 UTC (rev 102537)
+++ trunk/LayoutTests/ChangeLog 2011-12-11 19:06:56 UTC (rev 102538)
@@ -1,3 +1,14 @@
+2011-12-11 Dan Bernstein <m...@apple.com>
+
+ Test and updated results for <rdar://problem/10561285> REGRESSION (r80438): First word on a line or after collapsed space may not be hyphenated even though it should
+ https://bugs.webkit.org/show_bug.cgi?id=74239
+
+ Reviewed by Anders Carlsson.
+
+ * fast/text/hyphenate-first-word-after-skipped-space-expected.html: Added.
+ * fast/text/hyphenate-first-word-after-skipped-space.html: Added.
+ * platform/mac/fast/text/hyphenate-limit-lines-expected.txt:
+
2011-12-09 Robert Hogan <rob...@webkit.org>
CSS 2.1 failure: numerous counter-increment-* tests fail
Added: trunk/LayoutTests/fast/text/hyphenate-first-word-after-skipped-space-expected.html (0 => 102538)
--- trunk/LayoutTests/fast/text/hyphenate-first-word-after-skipped-space-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/hyphenate-first-word-after-skipped-space-expected.html 2011-12-11 19:06:56 UTC (rev 102538)
@@ -0,0 +1,14 @@
+<style>
+ div {
+ -webkit-locale: "en_US";
+ -webkit-hyphens: auto;
+ -webkit-hyphenate-limit-before: 2;
+ width: 40px;
+ border: solid;
+ margin: 8px;
+ }
+</style>
+<div>Undone.</div>
+<div>Undone.</div>
+<div>Simply <!-- -->undone.</div>
+<div>I undid it.</div>
Added: trunk/LayoutTests/fast/text/hyphenate-first-word-after-skipped-space.html (0 => 102538)
--- trunk/LayoutTests/fast/text/hyphenate-first-word-after-skipped-space.html (rev 0)
+++ trunk/LayoutTests/fast/text/hyphenate-first-word-after-skipped-space.html 2011-12-11 19:06:56 UTC (rev 102538)
@@ -0,0 +1,16 @@
+<style>
+ div {
+ -webkit-locale: "en_US";
+ -webkit-hyphens: auto;
+ -webkit-hyphenate-limit-before: 2;
+ width: 40px;
+ border: solid;
+ margin: 8px;
+ }
+</style>
+<div>Undone.</div>
+<div>
+ Undone.
+</div>
+<div>Simply undone.</div>
+<div>I undid it.</div>
Modified: trunk/LayoutTests/platform/mac/fast/text/hyphenate-limit-lines-expected.txt (102537 => 102538)
--- trunk/LayoutTests/platform/mac/fast/text/hyphenate-limit-lines-expected.txt 2011-12-11 18:04:50 UTC (rev 102537)
+++ trunk/LayoutTests/platform/mac/fast/text/hyphenate-limit-lines-expected.txt 2011-12-11 19:06:56 UTC (rev 102538)
@@ -78,15 +78,16 @@
text run at (1,125) width 200: "elements, or of"
text run at (1,156) width 200: "pleasures and de" + hyphen string "-"
text run at (1,187) width 200: "sires into"
- text run at (1,218) width 200: "necessary and"
- text run at (1,249) width 155: "unnecessary\x{2014}"
- text run at (1,280) width 200: "these and other"
- text run at (1,311) width 200: "great forms of"
- text run at (1,342) width 200: "thought are all of"
- text run at (1,373) width 66: "them "
- text run at (67,373) width 134: "to be found"
- text run at (1,404) width 200: "in the Republic,"
- text run at (1,435) width 200: "and were probably"
+ text run at (1,218) width 165: "necessary and "
+ text run at (166,218) width 35: "un" + hyphen string "-"
+ text run at (1,249) width 183: "necessary\x{2014}these"
+ text run at (1,280) width 200: "and other great"
+ text run at (1,311) width 200: "forms of thought"
+ text run at (1,342) width 180: "are all of them "
+ text run at (181,342) width 20: "to"
+ text run at (1,373) width 200: "be found in the"
+ text run at (1,404) width 200: "Republic, and"
+ text run at (1,435) width 200: "were probably"
text run at (1,466) width 200: "first invented by"
text run at (1,497) width 60: "Plato."
RenderBlock (floating) {DIV} at (214,529) size 202x529 [border: (1px solid #ADD8E6)]
Modified: trunk/Source/WebCore/ChangeLog (102537 => 102538)
--- trunk/Source/WebCore/ChangeLog 2011-12-11 18:04:50 UTC (rev 102537)
+++ trunk/Source/WebCore/ChangeLog 2011-12-11 19:06:56 UTC (rev 102538)
@@ -1,3 +1,18 @@
+2011-12-11 Dan Bernstein <m...@apple.com>
+
+ <rdar://problem/10561285> REGRESSION (r80438): First word on a line or after collapsed space may not be hyphenated even though it should
+ https://bugs.webkit.org/show_bug.cgi?id=74239
+
+ Reviewed by Anders Carlsson.
+
+ Tests: fast/text/hyphenate-first-word-after-skipped-space-expected.html
+ fast/text/hyphenate-first-word-after-skipped-space.html
+
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::tryHyphenating): Replaced the assumption that the character at lastSpace is a space
+ iff lastSpace is non-zero with a test of whether it is a space, in the sense that it should
+ not be counted as part of the prefix when comparing it to the value of hyphenate-limit-before.
+
2011-12-10 Benjamin Poulain <bpoul...@apple.com>
#ifdef the parts of the Mac platform which should not be used on iOS
Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (102537 => 102538)
--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2011-12-11 18:04:50 UTC (rev 102537)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2011-12-11 19:06:56 UTC (rev 102538)
@@ -1940,12 +1940,17 @@
return;
prefixLength = lastHyphenLocation(text->characters() + lastSpace, pos - lastSpace, min(prefixLength, static_cast<unsigned>(pos - lastSpace - minimumSuffixLength)) + 1, localeIdentifier);
- // FIXME: The following assumes that the character at lastSpace is a space (and therefore should not factor
- // into hyphenate-limit-before) unless lastSpace is 0. This is wrong in the rare case of hyphenating
- // the first word in a text node which has leading whitespace.
- if (!prefixLength || prefixLength - (lastSpace ? 1 : 0) < static_cast<unsigned>(minimumPrefixLength))
+ if (!prefixLength || prefixLength < static_cast<unsigned>(minimumPrefixLength))
return;
+ // When lastSapce is a space, which it always is except sometimes at the beginning of a line or after collapsed
+ // space, it should not count towards hyphenate-limit-before.
+ if (prefixLength == static_cast<unsigned>(minimumPrefixLength)) {
+ UChar characterAtLastSpace = text->characters()[lastSpace];
+ if (characterAtLastSpace == ' ' || characterAtLastSpace == '\n' || characterAtLastSpace == '\t' || characterAtLastSpace == noBreakSpace)
+ return;
+ }
+
ASSERT(pos - lastSpace - prefixLength >= static_cast<unsigned>(minimumSuffixLength));
#if !ASSERT_DISABLED