Commit fe4e2eb6 authored by mmaxfield@apple.com's avatar mmaxfield@apple.com

a fractional value of the css letter-spacing property is not rendered as expected

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

Reviewed by Simon Fraser.

Source/WebCore:

This turns on fractional letter-spacing and word-spacing CSS values.
It is taken mostly from Blink r153727 and iOS. Updating the relevant
types is all that is necessary

Existing tests have been updated.

* css/DeprecatedStyleBuilder.cpp:
(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* platform/graphics/Font.cpp:
(WebCore::Font::Font):
(WebCore::Font::width):
* platform/graphics/Font.h:
(WebCore::Font::wordSpacing):
(WebCore::Font::letterSpacing):
(WebCore::Font::setWordSpacing):
(WebCore::Font::setLetterSpacing):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::wordSpacing):
(WebCore::RenderStyle::letterSpacing):
(WebCore::RenderStyle::setWordSpacing):
(WebCore::RenderStyle::setLetterSpacing):
* rendering/style/RenderStyle.h:

LayoutTests:

Manually verified that these tests are correct after enabling fractional letter-spacing and word spacing

* platform/mac/css1/text_properties/letter_spacing-expected.png:
* platform/mac/css1/text_properties/letter_spacing-expected.txt:
* platform/mac/css1/text_properties/word_spacing-expected.png:
* platform/mac/css1/text_properties/word_spacing-expected.txt:
* platform/mac/fast/text/basic/013-expected.png:
* platform/mac/fast/text/basic/013-expected.txt:
* platform/mac/fast/text/text-letter-spacing-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/text-spacing-01-b-expected.png:
* platform/mac/svg/W3C-SVG-1.1/text-spacing-01-b-expected.txt:
* platform/mac/svg/batik/text/textLayout-expected.txt:
* platform/mac/svg/custom/text-letter-spacing-expected.png:
* platform/mac/svg/custom/text-letter-spacing-expected.txt:
* platform/mac/svg/text/text-spacing-01-b-expected.png:
* platform/mac/svg/text/text-spacing-01-b-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@161521 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2ed3ced4
2014-01-07 Myles C. Maxfield <mmaxfield@apple.com>
a fractional value of the css letter-spacing property is not rendered as expected
https://bugs.webkit.org/show_bug.cgi?id=20606
Reviewed by Simon Fraser.
Manually verified that these tests are correct after enabling fractional letter-spacing and word spacing
* platform/mac/css1/text_properties/letter_spacing-expected.png:
* platform/mac/css1/text_properties/letter_spacing-expected.txt:
* platform/mac/css1/text_properties/word_spacing-expected.png:
* platform/mac/css1/text_properties/word_spacing-expected.txt:
* platform/mac/fast/text/basic/013-expected.png:
* platform/mac/fast/text/basic/013-expected.txt:
* platform/mac/fast/text/text-letter-spacing-expected.txt:
* platform/mac/svg/W3C-SVG-1.1/text-spacing-01-b-expected.png:
* platform/mac/svg/W3C-SVG-1.1/text-spacing-01-b-expected.txt:
* platform/mac/svg/batik/text/textLayout-expected.txt:
* platform/mac/svg/custom/text-letter-spacing-expected.png:
* platform/mac/svg/custom/text-letter-spacing-expected.txt:
* platform/mac/svg/text/text-spacing-01-b-expected.png:
* platform/mac/svg/text/text-spacing-01-b-expected.txt:
2014-01-08 Alexey Proskuryakov <ap@apple.com>
Flaky Test: http/tests/xmlhttprequest/xmlhttprequest-50ms-download-dispatch.html
......@@ -32,21 +32,21 @@ layer at (0,0) size 785x1378
text run at (264,150) width 0: " "
RenderBlock {HR} at (0,212) size 769x2 [border: (1px inset #000000)]
RenderBlock {P} at (0,230) size 769x72
RenderText {#text} at (0,0) size 694x72
text run at (0,0) width 671: "This letters in this"
text run at (0,18) width 694: "sentence should have"
text run at (0,36) width 659: "extra space between"
text run at (0,54) width 175: "them."
RenderText {#text} at (0,0) size 710x72
text run at (0,0) width 687: "This letters in this"
text run at (0,18) width 710: "sentence should have"
text run at (0,36) width 675: "extra space between"
text run at (0,54) width 179: "them."
RenderBlock {P} at (0,318) size 769x54
RenderText {#text} at (0,0) size 765x54
text run at (0,0) width 691: "This letters in this sentence"
text run at (0,18) width 765: "should have extra space between"
text run at (0,36) width 125: "them."
RenderText {#text} at (0,0) size 718x54
text run at (0,0) width 718: "This letters in this sentence"
text run at (0,18) width 585: "should have extra space"
text run at (0,36) width 338: "between them."
RenderBlock {P} at (0,388) size 769x54
RenderText {#text} at (0,0) size 765x54
text run at (0,0) width 691: "This letters in this sentence"
text run at (0,18) width 765: "should have extra space between"
text run at (0,36) width 125: "them."
RenderText {#text} at (0,0) size 718x54
text run at (0,0) width 718: "This letters in this sentence"
text run at (0,18) width 585: "should have extra space"
text run at (0,36) width 338: "between them."
RenderBlock {P} at (0,458) size 769x18
RenderText {#text} at (0,0) size 687x18
text run at (0,0) width 687: "This letters in this sentence should have extra space between them."
......@@ -59,9 +59,9 @@ layer at (0,0) size 785x1378
text run at (0,18) width 703: "should have extra space between"
text run at (0,36) width 115: "them."
RenderBlock {P} at (0,596) size 769x36
RenderText {#text} at (0,0) size 694x36
text run at (0,0) width 694: "This letters in this sentence should have extra space"
text run at (0,18) width 183: "between them."
RenderText {#text} at (0,0) size 704x36
text run at (0,0) width 704: "This letters in this sentence should have extra space"
text run at (0,18) width 186: "between them."
RenderBlock {P} at (0,648) size 769x36
RenderText {#text} at (0,0) size 754x36
text run at (0,0) width 754: "This letters in this sentence should have extra space between them,"
......@@ -76,8 +76,8 @@ layer at (0,0) size 785x1378
text run at (0,0) width 731: "This letters in this sentence should have normal space between them, since percentage values are not allowed on this"
text run at (0,18) width 57: "property."
RenderBlock {P} at (0,752) size 769x18
RenderText {#text} at (0,0) size 638x18
text run at (0,0) width 638: "This letters in this sentence should have reduced space between them, since negative values are allowed on this property."
RenderText {#text} at (0,0) size 566x18
text run at (0,0) width 566: "This letters in this sentence should have reduced space between them, since negative values are allowed on this property."
RenderTable {TABLE} at (0,786) size 769x576 [border: (1px outset #808080)]
RenderTableSection {TBODY} at (1,1) size 767x574
RenderTableRow {TR} at (0,0) size 767x26
......@@ -91,21 +91,21 @@ layer at (0,0) size 785x1378
text run at (4,4) width 4: " "
RenderTableCell {TD} at (12,26) size 755x548 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
RenderBlock {P} at (4,4) size 747x72
RenderText {#text} at (0,0) size 694x72
text run at (0,0) width 671: "This letters in this"
text run at (0,18) width 694: "sentence should have"
text run at (0,36) width 659: "extra space between"
text run at (0,54) width 175: "them."
RenderText {#text} at (0,0) size 710x72
text run at (0,0) width 687: "This letters in this"
text run at (0,18) width 710: "sentence should have"
text run at (0,36) width 675: "extra space between"
text run at (0,54) width 179: "them."
RenderBlock {P} at (4,92) size 747x54
RenderText {#text} at (0,0) size 691x54
text run at (0,0) width 691: "This letters in this sentence"
text run at (0,18) width 564: "should have extra space"
text run at (0,36) width 326: "between them."
RenderText {#text} at (0,0) size 718x54
text run at (0,0) width 718: "This letters in this sentence"
text run at (0,18) width 585: "should have extra space"
text run at (0,36) width 338: "between them."
RenderBlock {P} at (4,162) size 747x54
RenderText {#text} at (0,0) size 691x54
text run at (0,0) width 691: "This letters in this sentence"
text run at (0,18) width 564: "should have extra space"
text run at (0,36) width 326: "between them."
RenderText {#text} at (0,0) size 718x54
text run at (0,0) width 718: "This letters in this sentence"
text run at (0,18) width 585: "should have extra space"
text run at (0,36) width 338: "between them."
RenderBlock {P} at (4,232) size 747x18
RenderText {#text} at (0,0) size 687x18
text run at (0,0) width 687: "This letters in this sentence should have extra space between them."
......@@ -118,9 +118,9 @@ layer at (0,0) size 785x1378
text run at (0,18) width 703: "should have extra space between"
text run at (0,36) width 115: "them."
RenderBlock {P} at (4,370) size 747x36
RenderText {#text} at (0,0) size 694x36
text run at (0,0) width 694: "This letters in this sentence should have extra space"
text run at (0,18) width 183: "between them."
RenderText {#text} at (0,0) size 704x36
text run at (0,0) width 704: "This letters in this sentence should have extra space"
text run at (0,18) width 186: "between them."
RenderBlock {P} at (4,422) size 747x36
RenderText {#text} at (0,0) size 685x36
text run at (0,0) width 685: "This letters in this sentence should have extra space between"
......@@ -135,5 +135,5 @@ layer at (0,0) size 785x1378
text run at (0,0) width 731: "This letters in this sentence should have normal space between them, since percentage values are not allowed on this"
text run at (0,18) width 57: "property."
RenderBlock {P} at (4,526) size 747x18
RenderText {#text} at (0,0) size 638x18
text run at (0,0) width 638: "This letters in this sentence should have reduced space between them, since negative values are allowed on this property."
RenderText {#text} at (0,0) size 566x18
text run at (0,0) width 566: "This letters in this sentence should have reduced space between them, since negative values are allowed on this property."
......@@ -33,14 +33,14 @@ layer at (0,0) size 785x997
text run at (0,165) width 0: " "
RenderBlock {HR} at (0,227) size 769x2 [border: (1px inset #000000)]
RenderBlock {P} at (0,245) size 769x18
RenderText {#text} at (0,0) size 701x18
text run at (0,0) width 701: "This words in this sentence should have extra space between them."
RenderText {#text} at (0,0) size 709x18
text run at (0,0) width 709: "This words in this sentence should have extra space between them."
RenderBlock {P} at (0,279) size 769x18
RenderText {#text} at (0,0) size 601x18
text run at (0,0) width 601: "This words in this sentence should have extra space between them."
RenderText {#text} at (0,0) size 610x18
text run at (0,0) width 610: "This words in this sentence should have extra space between them."
RenderBlock {P} at (0,313) size 769x18
RenderText {#text} at (0,0) size 601x18
text run at (0,0) width 601: "This words in this sentence should have extra space between them."
RenderText {#text} at (0,0) size 610x18
text run at (0,0) width 610: "This words in this sentence should have extra space between them."
RenderBlock {P} at (0,347) size 769x18
RenderText {#text} at (0,0) size 461x18
text run at (0,0) width 461: "This words in this sentence should have extra space between them."
......@@ -51,8 +51,8 @@ layer at (0,0) size 785x997
RenderText {#text} at (0,0) size 581x18
text run at (0,0) width 581: "This words in this sentence should have extra space between them."
RenderBlock {P} at (0,449) size 769x18
RenderText {#text} at (0,0) size 491x18
text run at (0,0) width 491: "This words in this sentence should have extra space between them."
RenderText {#text} at (0,0) size 493x18
text run at (0,0) width 493: "This words in this sentence should have extra space between them."
RenderBlock {P} at (0,483) size 769x36
RenderText {#text} at (0,0) size 751x18
text run at (0,0) width 751: "This words in this sentence should have extra space between them, but the last few words in the sentence"
......@@ -65,8 +65,8 @@ layer at (0,0) size 785x997
RenderText {#text} at (0,0) size 668x18
text run at (0,0) width 668: "This sentence should have normal word-spacing, since percentage values are not allowed on this property."
RenderBlock {P} at (0,569) size 769x18
RenderText {#text} at (0,0) size 707x18
text run at (0,0) width 707: "This words in this sentence should have reduced space between them, since negative values are allowed on this property."
RenderText {#text} at (0,0) size 704x18
text run at (0,0) width 704: "This words in this sentence should have reduced space between them, since negative values are allowed on this property."
RenderTable {TABLE} at (0,603) size 769x378 [border: (1px outset #808080)]
RenderTableSection {TBODY} at (1,1) size 767x376
RenderTableRow {TR} at (0,0) size 767x26
......@@ -80,14 +80,14 @@ layer at (0,0) size 785x997
text run at (4,4) width 4: " "
RenderTableCell {TD} at (12,26) size 755x350 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
RenderBlock {P} at (4,4) size 747x18
RenderText {#text} at (0,0) size 701x18
text run at (0,0) width 701: "This words in this sentence should have extra space between them."
RenderText {#text} at (0,0) size 709x18
text run at (0,0) width 709: "This words in this sentence should have extra space between them."
RenderBlock {P} at (4,38) size 747x18
RenderText {#text} at (0,0) size 601x18
text run at (0,0) width 601: "This words in this sentence should have extra space between them."
RenderText {#text} at (0,0) size 610x18
text run at (0,0) width 610: "This words in this sentence should have extra space between them."
RenderBlock {P} at (4,72) size 747x18
RenderText {#text} at (0,0) size 601x18
text run at (0,0) width 601: "This words in this sentence should have extra space between them."
RenderText {#text} at (0,0) size 610x18
text run at (0,0) width 610: "This words in this sentence should have extra space between them."
RenderBlock {P} at (4,106) size 747x18
RenderText {#text} at (0,0) size 461x18
text run at (0,0) width 461: "This words in this sentence should have extra space between them."
......@@ -98,8 +98,8 @@ layer at (0,0) size 785x997
RenderText {#text} at (0,0) size 581x18
text run at (0,0) width 581: "This words in this sentence should have extra space between them."
RenderBlock {P} at (4,208) size 747x18
RenderText {#text} at (0,0) size 491x18
text run at (0,0) width 491: "This words in this sentence should have extra space between them."
RenderText {#text} at (0,0) size 493x18
text run at (0,0) width 493: "This words in this sentence should have extra space between them."
RenderBlock {P} at (4,242) size 747x36
RenderText {#text} at (0,0) size 688x36
text run at (0,0) width 688: "This words in this sentence should have extra space between them, but the last few words in the"
......@@ -113,5 +113,5 @@ layer at (0,0) size 785x997
RenderText {#text} at (0,0) size 668x18
text run at (0,0) width 668: "This sentence should have normal word-spacing, since percentage values are not allowed on this property."
RenderBlock {P} at (4,328) size 747x18
RenderText {#text} at (0,0) size 707x18
text run at (0,0) width 707: "This words in this sentence should have reduced space between them, since negative values are allowed on this property."
RenderText {#text} at (0,0) size 704x18
text run at (0,0) width 704: "This words in this sentence should have reduced space between them, since negative values are allowed on this property."
......@@ -37,34 +37,34 @@ layer at (0,0) size 800x267
text run at (0,18) width 296: "be inherited. This was discovered in Safari 1.0."
RenderBlock {DIV} at (0,110) size 784x120
RenderBlock {P} at (0,0) size 784x18
RenderText {#text} at (0,0) size 122x18
text run at (0,0) width 122: "Text inside "
RenderInline {B} at (0,0) size 46x18
RenderText {#text} at (122,0) size 46x18
text run at (122,0) width 46: "bold"
RenderText {#text} at (168,0) size 93x18
text run at (168,0) width 93: " element."
RenderText {#text} at (0,0) size 132x18
text run at (0,0) width 132: "Text inside "
RenderInline {B} at (0,0) size 50x18
RenderText {#text} at (131,0) size 50x18
text run at (131,0) width 50: "bold"
RenderText {#text} at (180,0) size 101x18
text run at (180,0) width 101: " element."
RenderBlock {P} at (0,34) size 784x18
RenderText {#text} at (0,0) size 122x18
text run at (0,0) width 122: "Text inside "
RenderInline {STRONG} at (0,0) size 67x18
RenderText {#text} at (122,0) size 67x18
text run at (122,0) width 67: "strong"
RenderText {#text} at (189,0) size 93x18
text run at (189,0) width 93: " element."
RenderText {#text} at (0,0) size 132x18
text run at (0,0) width 132: "Text inside "
RenderInline {STRONG} at (0,0) size 73x18
RenderText {#text} at (131,0) size 73x18
text run at (131,0) width 73: "strong"
RenderText {#text} at (203,0) size 101x18
text run at (203,0) width 101: " element."
RenderBlock {P} at (0,68) size 784x18
RenderText {#text} at (0,0) size 122x18
text run at (0,0) width 122: "Text inside "
RenderInline {I} at (0,0) size 55x18
RenderText {#text} at (122,0) size 55x18
text run at (122,0) width 55: "italic"
RenderText {#text} at (177,0) size 93x18
text run at (177,0) width 93: " element."
RenderText {#text} at (0,0) size 132x18
text run at (0,0) width 132: "Text inside "
RenderInline {I} at (0,0) size 61x18
RenderText {#text} at (131,0) size 61x18
text run at (131,0) width 61: "italic"
RenderText {#text} at (191,0) size 101x18
text run at (191,0) width 101: " element."
RenderBlock {P} at (0,102) size 784x18
RenderText {#text} at (0,0) size 122x18
text run at (0,0) width 122: "Text inside "
RenderInline {EM} at (0,0) size 91x18
RenderText {#text} at (122,0) size 91x18
text run at (122,0) width 91: "emphasis"
RenderText {#text} at (213,0) size 93x18
text run at (213,0) width 93: " element."
RenderText {#text} at (0,0) size 132x18
text run at (0,0) width 132: "Text inside "
RenderInline {EM} at (0,0) size 99x18
RenderText {#text} at (131,0) size 99x18
text run at (131,0) width 99: "emphasis"
RenderText {#text} at (229,0) size 101x18
text run at (229,0) width 101: " element."
layer at (0,0) size 163023x1728
layer at (0,0) size 9600207x1728
RenderView at (0,0) size 785x585
layer at (0,0) size 785x1728
RenderBlock {HTML} at (0,0) size 785x1728
......@@ -40,10 +40,10 @@ layer at (0,0) size 785x1728
text run at (0,18) width 37: "a 'w', "
text run at (37,18) width 407: "perhaps on two different lines, unless you scroll way to the right."
RenderBlock {P} at (0,398) size 769x36 [bgcolor=#EEEEEE]
RenderInline {SPAN} at (0,0) size 163015x36
RenderText {#text} at (160,0) size 163015x36
text run at (160,0) width 162855: "Hello,"
text run at (0,18) width 135717: "world"
RenderInline {SPAN} at (0,0) size 9600199x36
RenderText {#text} at (160,0) size 9600199x36
text run at (160,0) width 9600039: "Hello,"
text run at (0,18) width 8000037: "world"
RenderBlock {P} at (0,450) size 769x18 [bgcolor=#FFFFFF]
RenderText {#text} at (0,0) size 528x18
text run at (0,0) width 528: "The next line tests a small negative line spacing, and should be crammed backwards"
......@@ -158,11 +158,11 @@ layer at (8,858) size 19399x36
RenderText {#text} at (160,0) size 19399x36
text run at (160,0) width 19239: "Hello,"
text run at (0,18) width 16037: "world"
layer at (8,944) size 163015x36
RenderInline {SPAN} at (0,0) size 163015x36 [bgcolor=#CCCCFF]
RenderText {#text} at (160,0) size 163015x36
text run at (160,0) width 162855: "Hello,"
text run at (0,18) width 135717: "world"
layer at (8,944) size 9600199x36
RenderInline {SPAN} at (0,0) size 9600199x36 [bgcolor=#CCCCFF]
RenderText {#text} at (160,0) size 9600199x36
text run at (160,0) width 9600039: "Hello,"
text run at (0,18) width 8000037: "world"
layer at (8,1030) size 0x18
RenderInline {SPAN} at (0,0) size 0x18 [bgcolor=#CCCCFF]
RenderText {#text} at (160,0) size 0x18
......
......@@ -26,9 +26,25 @@ layer at (0,0) size 480x360
chunk 1 text run 15 at (37.33,16.00) startOffset 14 endOffset 15 width 2.17: ":"
chunk 1 text run 16 at (38.50,16.00) startOffset 15 endOffset 16 width 2.67: "-"
chunk 1 text run 17 at (40.17,16.00) startOffset 16 endOffset 17 width 4.50: "1"
RenderSVGText {text} at (3,16) size 58x9 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 58x9
chunk 1 text run 1 at (3.00,24.00) startOffset 0 endOffset 17 width 57.17: "letter-spacing:.3"
RenderSVGText {text} at (3,16) size 62x9 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 62x9
chunk 1 text run 1 at (3.00,24.00) startOffset 0 endOffset 1 width 1.83: "l"
chunk 1 text run 2 at (5.13,24.00) startOffset 1 endOffset 2 width 4.50: "e"
chunk 1 text run 3 at (9.93,24.00) startOffset 2 endOffset 3 width 2.17: "t"
chunk 1 text run 4 at (12.40,24.00) startOffset 3 endOffset 4 width 2.17: "t"
chunk 1 text run 5 at (14.87,24.00) startOffset 4 endOffset 5 width 4.50: "e"
chunk 1 text run 6 at (19.67,24.00) startOffset 5 endOffset 6 width 2.67: "r"
chunk 1 text run 7 at (22.63,24.00) startOffset 6 endOffset 7 width 2.67: "-"
chunk 1 text run 8 at (25.60,24.00) startOffset 7 endOffset 8 width 4.00: "s"
chunk 1 text run 9 at (29.90,24.00) startOffset 8 endOffset 9 width 4.50: "p"
chunk 1 text run 10 at (34.70,24.00) startOffset 9 endOffset 10 width 4.50: "a"
chunk 1 text run 11 at (39.50,24.00) startOffset 10 endOffset 11 width 4.00: "c"
chunk 1 text run 12 at (43.80,24.00) startOffset 11 endOffset 12 width 1.83: "i"
chunk 1 text run 13 at (45.93,24.00) startOffset 12 endOffset 13 width 4.50: "n"
chunk 1 text run 14 at (50.73,24.00) startOffset 13 endOffset 14 width 4.50: "g"
chunk 1 text run 15 at (55.53,24.00) startOffset 14 endOffset 15 width 2.17: ":"
chunk 1 text run 16 at (58.00,24.00) startOffset 15 endOffset 16 width 2.17: "."
chunk 1 text run 17 at (60.47,24.00) startOffset 16 endOffset 17 width 4.50: "3"
RenderSVGText {text} at (3,25) size 64x9 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 64x9
chunk 1 text run 1 at (3.00,33.00) startOffset 0 endOffset 16 width 64.00: "ws:0 - Two Words"
......
......@@ -117,15 +117,15 @@ layer at (0,0) size 450x500
RenderSVGText {text} at (290,233) size 104x9 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 104x9
chunk 1 text run 1 at (290.00,240.00) startOffset 0 endOffset 29 width 104.00: "textLength=\"120\",kerning=\"10\""
RenderSVGContainer {g} at (40,253) size 104x39
RenderSVGText {text} at (40,253) size 104x28 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 104x28
RenderSVGContainer {g} at (40,253) size 105x39
RenderSVGText {text} at (40,253) size 105x28 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 105x28
chunk 1 text run 1 at (40.00,275.00) startOffset 0 endOffset 1 width 9.00: "s"
chunk 1 text run 2 at (56.00,275.00) startOffset 1 endOffset 2 width 11.00: "a"
chunk 1 text run 3 at (74.00,275.00) startOffset 2 endOffset 3 width 19.00: "m"
chunk 1 text run 4 at (100.00,275.00) startOffset 3 endOffset 4 width 12.00: "p"
chunk 1 text run 5 at (119.00,275.00) startOffset 4 endOffset 5 width 7.00: "l"
chunk 1 text run 6 at (133.00,275.00) startOffset 5 endOffset 6 width 11.00: "e"
chunk 1 text run 2 at (56.20,275.00) startOffset 1 endOffset 2 width 11.00: "a"
chunk 1 text run 3 at (74.40,275.00) startOffset 2 endOffset 3 width 19.00: "m"
chunk 1 text run 4 at (100.60,275.00) startOffset 3 endOffset 4 width 12.00: "p"
chunk 1 text run 5 at (119.80,275.00) startOffset 4 endOffset 5 width 7.00: "l"
chunk 1 text run 6 at (134.00,275.00) startOffset 5 endOffset 6 width 11.00: "e"
RenderSVGText {text} at (40,283) size 76x9 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 76x9
chunk 1 text run 1 at (40.00,290.00) startOffset 0 endOffset 22 width 76.00: "letter-spacing=\"0.3em\""
......
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderSVGRoot {svg} at (20,10) size 350x158
RenderSVGContainer {g} at (20,10) size 350x158
RenderSVGText {text} at (10,5) size 175x19 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 175x19
RenderSVGRoot {svg} at (20,10) size 362x158
RenderSVGContainer {g} at (20,10) size 362x158
RenderSVGText {text} at (10,5) size 181x19 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 181x19
chunk 1 text run 1 at (10.00,20.00) startOffset 0 endOffset 1 width 11.50: "A"
chunk 1 text run 2 at (39.50,20.00) startOffset 1 endOffset 2 width 10.50: "B"
chunk 1 text run 3 at (68.00,20.00) startOffset 2 endOffset 3 width 10.50: "C"
chunk 1 text run 4 at (96.50,20.00) startOffset 3 endOffset 4 width 4.00: " "
chunk 1 text run 5 at (118.50,20.00) startOffset 4 endOffset 5 width 11.50: "D"
chunk 1 text run 6 at (148.00,20.00) startOffset 5 endOffset 6 width 10.00: "E"
chunk 1 text run 7 at (176.00,20.00) startOffset 6 endOffset 7 width 9.00: "F"
RenderSVGText {text} at (10,25) size 175x19 contains 1 chunk(s)
RenderSVGTSpan {tspan} at (0,0) size 69x19
RenderSVGInlineText {#text} at (0,0) size 69x19
chunk 1 text run 2 at (40.40,20.00) startOffset 1 endOffset 2 width 10.50: "B"
chunk 1 text run 3 at (69.80,20.00) startOffset 2 endOffset 3 width 10.50: "C"
chunk 1 text run 4 at (99.19,20.00) startOffset 3 endOffset 4 width 4.00: " "
chunk 1 text run 5 at (122.09,20.00) startOffset 4 endOffset 5 width 11.50: "D"
chunk 1 text run 6 at (152.49,20.00) startOffset 5 endOffset 6 width 10.00: "E"
chunk 1 text run 7 at (181.39,20.00) startOffset 6 endOffset 7 width 9.00: "F"
RenderSVGText {text} at (10,25) size 181x19 contains 1 chunk(s)
RenderSVGTSpan {tspan} at (0,0) size 71x19
RenderSVGInlineText {#text} at (0,0) size 71x19
chunk 1 text run 1 at (10.00,40.00) startOffset 0 endOffset 1 width 11.50: "A"
chunk 1 text run 2 at (39.50,40.00) startOffset 1 endOffset 2 width 10.50: "B"
chunk 1 text run 3 at (68.00,40.00) startOffset 2 endOffset 3 width 10.50: "C"
RenderSVGInlineText {#text} at (86,0) size 4x19
chunk 1 text run 1 at (96.50,40.00) startOffset 0 endOffset 1 width 4.00: " "
RenderSVGTSpan {tspan} at (0,0) size 67x19
RenderSVGInlineText {#text} at (108,0) size 67x19
chunk 1 text run 1 at (118.50,40.00) startOffset 0 endOffset 1 width 11.50: "D"
chunk 1 text run 2 at (148.00,40.00) startOffset 1 endOffset 2 width 10.00: "E"
chunk 1 text run 3 at (176.00,40.00) startOffset 2 endOffset 3 width 9.00: "F"
chunk 1 text run 2 at (40.40,40.00) startOffset 1 endOffset 2 width 10.50: "B"
chunk 1 text run 3 at (69.80,40.00) startOffset 2 endOffset 3 width 10.50: "C"
RenderSVGInlineText {#text} at (89,0) size 4x19
chunk 1 text run 1 at (99.19,40.00) startOffset 0 endOffset 1 width 4.00: " "
RenderSVGTSpan {tspan} at (0,0) size 69x19
RenderSVGInlineText {#text} at (112,0) size 69x19
chunk 1 text run 1 at (122.09,40.00) startOffset 0 endOffset 1 width 11.50: "D"
chunk 1 text run 2 at (152.49,40.00) startOffset 1 endOffset 2 width 10.00: "E"
chunk 1 text run 3 at (181.39,40.00) startOffset 2 endOffset 3 width 9.00: "F"
RenderSVGText {text} at (10,45) size 129x19 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 129x19
chunk 1 text run 1 at (10.00,60.00) startOffset 0 endOffset 1 width 11.50: "A"
......
......@@ -26,9 +26,25 @@ layer at (0,0) size 800x600
chunk 1 text run 15 at (36.80,16.00) startOffset 14 endOffset 15 width 2.20: ":"
chunk 1 text run 16 at (38.00,16.00) startOffset 15 endOffset 16 width 2.70: "-"
chunk 1 text run 17 at (39.70,16.00) startOffset 16 endOffset 17 width 4.40: "1"
RenderSVGText {text} at (3,16) size 57x9 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 57x9
chunk 1 text run 1 at (3.00,24.00) startOffset 0 endOffset 17 width 56.60: "letter-spacing:.3"
RenderSVGText {text} at (3,16) size 62x9 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 62x9
chunk 1 text run 1 at (3.00,24.00) startOffset 0 endOffset 1 width 1.80: "l"
chunk 1 text run 2 at (5.10,24.00) startOffset 1 endOffset 2 width 4.40: "e"
chunk 1 text run 3 at (9.80,24.00) startOffset 2 endOffset 3 width 2.20: "t"
chunk 1 text run 4 at (12.30,24.00) startOffset 3 endOffset 4 width 2.20: "t"
chunk 1 text run 5 at (14.80,24.00) startOffset 4 endOffset 5 width 4.40: "e"
chunk 1 text run 6 at (19.50,24.00) startOffset 5 endOffset 6 width 2.70: "r"
chunk 1 text run 7 at (22.50,24.00) startOffset 6 endOffset 7 width 2.70: "-"
chunk 1 text run 8 at (25.50,24.00) startOffset 7 endOffset 8 width 4.00: "s"
chunk 1 text run 9 at (29.80,24.00) startOffset 8 endOffset 9 width 4.40: "p"
chunk 1 text run 10 at (34.50,24.00) startOffset 9 endOffset 10 width 4.40: "a"
chunk 1 text run 11 at (39.20,24.00) startOffset 10 endOffset 11 width 4.00: "c"
chunk 1 text run 12 at (43.50,24.00) startOffset 11 endOffset 12 width 1.80: "i"
chunk 1 text run 13 at (45.60,24.00) startOffset 12 endOffset 13 width 4.40: "n"
chunk 1 text run 14 at (50.30,24.00) startOffset 13 endOffset 14 width 4.40: "g"
chunk 1 text run 15 at (55.00,24.00) startOffset 14 endOffset 15 width 2.20: ":"
chunk 1 text run 16 at (57.50,24.00) startOffset 15 endOffset 16 width 2.20: "."
chunk 1 text run 17 at (60.00,24.00) startOffset 16 endOffset 17 width 4.40: "3"
RenderSVGText {text} at (3,25) size 64x9 contains 1 chunk(s)
RenderSVGInlineText {#text} at (0,0) size 64x9
chunk 1 text run 1 at (3.00,33.00) startOffset 0 endOffset 16 width 63.90: "ws:0 - Two Words"
......
2014-01-07 Myles C. Maxfield <mmaxfield@apple.com>
a fractional value of the css letter-spacing property is not rendered as expected
https://bugs.webkit.org/show_bug.cgi?id=20606
Reviewed by Simon Fraser.
This turns on fractional letter-spacing and word-spacing CSS values.
It is taken mostly from Blink r153727 and iOS. Updating the relevant
types is all that is necessary
Existing tests have been updated.
* css/DeprecatedStyleBuilder.cpp:
(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder):
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
* platform/graphics/Font.cpp:
(WebCore::Font::Font):
(WebCore::Font::width):
* platform/graphics/Font.h:
(WebCore::Font::wordSpacing):
(WebCore::Font::letterSpacing):
(WebCore::Font::setWordSpacing):
(WebCore::Font::setLetterSpacing):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::wordSpacing):
(WebCore::RenderStyle::letterSpacing):
(WebCore::RenderStyle::setWordSpacing):
(WebCore::RenderStyle::setLetterSpacing):
* rendering/style/RenderStyle.h:
2014-01-08 Anders Carlsson <andersca@apple.com>
Add WTF::StringView and use it for grammar checking
......@@ -2312,14 +2312,7 @@ DeprecatedStyleBuilder::DeprecatedStyleBuilder()
setPropertyHandler(CSSPropertyImageResolution, ApplyPropertyImageResolution::createHandler());
#endif
setPropertyHandler(CSSPropertyLeft, ApplyPropertyLength<&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset, AutoEnabled>::createHandler());
// FIXME: We should reconcile the difference in datatype between iOS and OpenSource. On iOS we want letter spacing to
// be float for sub-pixel kerning. See <https://bugs.webkit.org/show_bug.cgi?id=20606>.
#if !PLATFORM(IOS)
setPropertyHandler(CSSPropertyLetterSpacing, ApplyPropertyComputeLength<int, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
#else
setPropertyHandler(CSSPropertyLetterSpacing, ApplyPropertyComputeLength<float, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
#endif
setPropertyHandler(CSSPropertyLetterSpacing, ApplyPropertyComputeLength<float, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing, &RenderStyle::initialLetterSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
#if ENABLE(IOS_TEXT_AUTOSIZING)
setPropertyHandler(CSSPropertyLineHeight, ApplyPropertyLineHeightForIOSTextAutosizing::createHandler());
......@@ -2536,14 +2529,7 @@ DeprecatedStyleBuilder::DeprecatedStyleBuilder()
setPropertyHandler(CSSPropertyWidows, ApplyPropertyAuto<short, &RenderStyle::widows, &RenderStyle::setWidows, &RenderStyle::hasAutoWidows, &RenderStyle::setHasAutoWidows>::createHandler());
setPropertyHandler(CSSPropertyWidth, ApplyPropertyLength<&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled, NoneDisabled, UndefinedDisabled>::createHandler());
setPropertyHandler(CSSPropertyWordBreak, ApplyPropertyDefault<EWordBreak, &RenderStyle::wordBreak, EWordBreak, &RenderStyle::setWordBreak, EWordBreak, &RenderStyle::initialWordBreak>::createHandler());
// FIXME: We should reconcile the difference in datatype between iOS and OpenSource. On iOS we want word spacing to
// be float for sub-pixel kerning. See <https://bugs.webkit.org/show_bug.cgi?id=20606>.
#if !PLATFORM(IOS)
setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyComputeLength<int, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
#else
setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyComputeLength<float, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
#endif
setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyComputeLength<float, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing, &RenderStyle::initialWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
// UAs must treat 'word-wrap' as an alternate name for the 'overflow-wrap' property. So using the same handlers.
setPropertyHandler(CSSPropertyWordWrap, ApplyPropertyDefault<EOverflowWrap, &RenderStyle::overflowWrap, EOverflowWrap, &RenderStyle::setOverflowWrap, EOverflowWrap, &RenderStyle::initialOverflowWrap>::createHandler());
......
......@@ -1212,16 +1212,8 @@ CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap()
new LengthPropertyWrapper<Length>(CSSPropertyLineHeight, &RenderStyle::specifiedLineHeight, &RenderStyle::setLineHeight),
new PropertyWrapper<int>(CSSPropertyOutlineOffset, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset),
new PropertyWrapper<unsigned short>(CSSPropertyOutlineWidth, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth),
// FIXME: We should reconcile the difference in datatype between iOS and OpenSource. On iOS we want these properties to
// be float for sub-pixel kerning. See <rdar://problem/5020763>.
#if !PLATFORM(IOS)
new PropertyWrapper<int>(CSSPropertyLetterSpacing, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing),
new PropertyWrapper<int>(CSSPropertyWordSpacing, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing),
#else
new PropertyWrapper<float>(CSSPropertyLetterSpacing, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing),
new PropertyWrapper<float>(CSSPropertyWordSpacing, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing),
#endif
new LengthPropertyWrapper<Length>(CSSPropertyTextIndent, &RenderStyle::textIndent, &RenderStyle::setTextIndent),
new PropertyWrapper<float>(CSSPropertyWebkitPerspective, &RenderStyle::perspective, &RenderStyle::setPerspective),
......
......@@ -107,7 +107,7 @@ Font::Font()
{
}
Font::Font(const FontDescription& fd, short letterSpacing, short wordSpacing)
Font::Font(const FontDescription& fd, float letterSpacing, float wordSpacing)
: m_fontDescription(fd)
, m_letterSpacing(letterSpacing)
, m_wordSpacing(wordSpacing)
......@@ -340,7 +340,7 @@ float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFo
}
bool hasKerningOrLigatures = typesettingFeatures() & (Kerning | Ligatures);
bool hasWordSpacingOrLetterSpacing = wordSpacing() | letterSpacing();
bool hasWordSpacingOrLetterSpacing = wordSpacing() || letterSpacing();
float* cacheEntry = m_glyphs->widthCache().add(run, std::numeric_limits<float>::quiet_NaN(), hasKerningOrLigatures, hasWordSpacingOrLetterSpacing, glyphOverflow);
if (cacheEntry && !std::isnan(*cacheEntry))
return *cacheEntry;
......
......@@ -79,7 +79,7 @@ struct GlyphOverflow {
class Font {
public:
Font();
Font(const FontDescription&, short letterSpacing, short wordSpacing);
Font(const FontDescription&, float letterSpacing, float wordSpacing);
// This constructor is only used if the platform wants to start with a native font.
Font(const FontPlatformData&, bool isPrinting, FontSmoothingMode = AutoSmoothing);
~Font();
......@@ -115,10 +115,10 @@ public:
bool isSmallCaps() const { return m_fontDescription.smallCaps(); }
short wordSpacing() const { return m_wordSpacing; }
short letterSpacing() const { return m_letterSpacing; }
void setWordSpacing(short s) { m_wordSpacing = s; }
void setLetterSpacing(short s) { m_letterSpacing = s; }
float wordSpacing() const { return m_wordSpacing; }
float letterSpacing() const { return m_letterSpacing; }
void setWordSpacing(float s) { m_wordSpacing = s; }
void setLetterSpacing(float s) { m_letterSpacing = s; }
bool isFixedPitch() const;
bool isPrinterFont() const { return m_fontDescription.usePrinterFont(); }
bool isSVGFont() const { return primaryFont()->isSVGFont(); }
...