Commit 2ef4491c authored by mitz@apple.com's avatar mitz@apple.com

<rdar://problem/8285090> First word on a line doesn’t hyphenate properly

https://bugs.webkit.org/show_bug.cgi?id=43679

Reviewed by Anders Carlsson.

WebCore: 

Test: fast/text/hyphenate-first-word.html

* rendering/RenderBlockLineLayout.cpp:
(WebCore::tryHyphenating): The character at lastSpace is not necessarily a whitespace character
before the current word. It can also be part of the word, such as when the word is the first
one on the line. Include the charcater at lastSpace in the string passed to lastHyphenLocation().

LayoutTests: 

* fast/text/hyphenate-first-word.html: Added.
* platform/mac/fast/text/hyphenate-first-word-expected.checksum: Added.
* platform/mac/fast/text/hyphenate-first-word-expected.png: Added.
* platform/mac/fast/text/hyphenate-first-word-expected.txt: Added.
* platform/mac/fast/text/hyphenate-locale-expected.checksum:
* platform/mac/fast/text/hyphenate-locale-expected.png:
* platform/mac/fast/text/hyphenate-locale-expected.txt:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64920 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0fca1e0c
2010-08-07 Dan Bernstein <mitz@apple.com>
Reviewed by Anders Carlsson.
<rdar://problem/8285090> First word on a line doesn’t hyphenate properly
https://bugs.webkit.org/show_bug.cgi?id=43679
* fast/text/hyphenate-first-word.html: Added.
* platform/mac/fast/text/hyphenate-first-word-expected.checksum: Added.
* platform/mac/fast/text/hyphenate-first-word-expected.png: Added.
* platform/mac/fast/text/hyphenate-first-word-expected.txt: Added.
* platform/mac/fast/text/hyphenate-locale-expected.checksum:
* platform/mac/fast/text/hyphenate-locale-expected.png:
* platform/mac/fast/text/hyphenate-locale-expected.txt:
2010-08-07 Adam Barth <abarth@webkit.org>
Reviewed by Dimitri Glazkov.
<div style="font-size: 96px; border: solid; width: 220px; -webkit-hyphens: auto; -webkit-hyphenate-locale: 'en_US'">declination</div>
\ No newline at end of file
7ee0b8d95d296cf3119e0f6a20900885
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock {DIV} at (0,0) size 226x336 [border: (3px solid #000000)]
RenderText {#text} at (3,3) size 177x330
text run at (3,3) width 166: "dec"
text run at (3,113) width 177: "lina"
text run at (3,223) width 150: "tion"
d109cac1345539a0091c08f3deccdd47
\ No newline at end of file
23ced8a73b7111987f71f5121b86de66
\ No newline at end of file
......@@ -25,21 +25,21 @@ layer at (0,0) size 785x754
text run at (0,0) width 158: "throughout"
RenderBlock {DIV} at (0,369) size 135x369
RenderBlock {DIV} at (0,0) size 135x82
RenderText {#text} at (0,0) size 130x82
text run at (0,0) width 130: "reciproc"
text run at (0,41) width 38: "ity"
RenderText {#text} at (0,0) size 102x82
text run at (0,0) width 66: "reci"
text run at (0,41) width 102: "procity"
RenderBlock {DIV} at (0,82) size 135x82
RenderText {#text} at (0,0) size 130x82
text run at (0,0) width 130: "reciproc"
text run at (0,41) width 38: "ity"
RenderText {#text} at (0,0) size 102x82
text run at (0,0) width 66: "reci"
text run at (0,41) width 102: "procity"
RenderBlock {DIV} at (0,164) size 135x82
RenderText {#text} at (0,0) size 130x82
text run at (0,0) width 130: "reciproc"
text run at (0,41) width 38: "ity"
RenderText {#text} at (0,0) size 102x82
text run at (0,0) width 66: "reci"
text run at (0,41) width 102: "procity"
RenderBlock {DIV} at (0,246) size 135x82
RenderText {#text} at (0,0) size 130x82
text run at (0,0) width 130: "reciproc"
text run at (0,41) width 38: "ity"
RenderText {#text} at (0,0) size 102x82
text run at (0,0) width 66: "reci"
text run at (0,41) width 102: "procity"
RenderBlock {DIV} at (0,328) size 135x41
RenderText {#text} at (0,0) size 156x41
text run at (0,0) width 156: "reciprocity"
2010-08-07 Dan Bernstein <mitz@apple.com>
Reviewed by Anders Carlsson.
<rdar://problem/8285090> First word on a line doesn’t hyphenate properly
https://bugs.webkit.org/show_bug.cgi?id=43679
Test: fast/text/hyphenate-first-word.html
* rendering/RenderBlockLineLayout.cpp:
(WebCore::tryHyphenating): The character at lastSpace is not necessarily a whitespace character
before the current word. It can also be part of the word, such as when the word is the first
one on the line. Include the charcater at lastSpace in the string passed to lastHyphenLocation().
2010-08-07 Dan Bernstein <mitz@apple.com>
Build fix
......@@ -1331,8 +1331,8 @@ static void tryHyphenating(RenderText* text, const Font& font, const AtomicStrin
if (!prefixLength)
return;
prefixLength = 1 + lastHyphenLocation(text->characters() + lastSpace + 1, pos - lastSpace - 1, prefixLength, localeIdentifier);
if (prefixLength <= 1)
prefixLength = lastHyphenLocation(text->characters() + lastSpace, pos - lastSpace, prefixLength + 1, localeIdentifier);
if (!prefixLength)
return;
#if !ASSERT_DISABLED
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment