Skip to content
Permalink
Browse files
The computed value of line-height:normal is incorrect
https://bugs.webkit.org/show_bug.cgi?id=133744

Patch by Sylvain Galineau <galineau@adobe.com> on 2015-01-26
Reviewed by Dean Jackson.

Source/WebCore:

Use font's line spacing as computed line-height value when specified value is 'normal'.
This behavior is compatible with all other engines.

No new tests; all existing tests are updated to reflect the new computed value.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::lineHeightFromStyle): If line-height wasn't set, use the font's line spacing (same as Blink).

LayoutTests:

line-height:normal now computes to a length value.
This patch updates the tests to reflect the new computed value, as needed.

* css3/calc/line-height-expected.txt:
* editing/pasteboard/simplfiying-markup-should-not-strip-content-expected.txt:
* fast/css/font-calculated-value-expected.txt:
* fast/css/font-calculated-value.html:
* fast/css/font-shorthand-from-longhands-expected.txt:
* fast/css/font-shorthand-from-longhands.html:
* fast/css/getComputedStyle/computed-style-expected.txt:
* fast/css/getComputedStyle/computed-style-font-expected.txt:
* fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* fast/css/getComputedStyle/script-tests/computed-style-font.js:
* fast/css/line-height-text-autosizing-expected.txt:
* fast/css/line-height-text-autosizing.html:
* fast/ruby/ruby-line-height-expected.txt:
* fast/ruby/script-tests/ruby-line-height.js:
* media/track/track-cue-rendering-on-resize-expected.txt:
* media/track/track-cue-rendering-on-resize.html:
* platform/mac-mavericks/platform/mac/editing/attributed-string/anchor-element-expected.txt:
* platform/mac-mavericks/platform/mac/editing/attributed-string/basic-expected.txt:
* platform/mac-mavericks/platform/mac/editing/attributed-string/font-size-expected.txt:
* platform/mac-mavericks/platform/mac/editing/attributed-string/font-style-variant-effect-expected.txt:
* platform/mac-mavericks/platform/mac/editing/attributed-string/font-weight-expected.txt:
* platform/mac-mavericks/platform/mac/editing/attributed-string/letter-spacing-expected.txt:
* platform/mac-mavericks/platform/mac/editing/attributed-string/text-decorations-expected.txt:
* platform/mac-mavericks/platform/mac/editing/attributed-string/vertical-align-expected.txt:
* platform/mac/editing/attributed-string/anchor-element-expected.txt:
* platform/mac/editing/attributed-string/basic-expected.txt:
* platform/mac/editing/attributed-string/font-size-expected.txt:
* platform/mac/editing/attributed-string/font-style-variant-effect-expected.txt:
* platform/mac/editing/attributed-string/font-weight-expected.txt:
* platform/mac/editing/attributed-string/letter-spacing-expected.txt:
* platform/mac/editing/attributed-string/text-decorations-expected.txt:
* platform/mac/editing/attributed-string/vertical-align-expected.txt:
* svg/css/getComputedStyle-basic-expected.txt:

Canonical link: https://commits.webkit.org/158909@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179168 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Sylvain Galineau authored and grorg committed Jan 27, 2015
1 parent 5007280 commit 1c44a113bfa77bc6aba061833efb31cd7dc08f43
Showing with 975 additions and 260 deletions.
  1. +44 −0 LayoutTests/ChangeLog
  2. +1 −1 LayoutTests/css3/calc/line-height-expected.txt
  3. +1 −1 LayoutTests/editing/pasteboard/simplfiying-markup-should-not-strip-content-expected.txt
  4. +1 −1 LayoutTests/fast/css/font-calculated-value-expected.txt
  5. +1 −1 LayoutTests/fast/css/font-calculated-value.html
  6. +8 −8 LayoutTests/fast/css/font-shorthand-from-longhands-expected.txt
  7. +8 −8 LayoutTests/fast/css/font-shorthand-from-longhands.html
  8. +1 −1 LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
  9. +52 −52 LayoutTests/fast/css/getComputedStyle/computed-style-font-expected.txt
  10. +1 −1 LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
  11. +52 −52 LayoutTests/fast/css/getComputedStyle/script-tests/computed-style-font.js
  12. +1 −1 LayoutTests/fast/css/line-height-text-autosizing-expected.txt
  13. +1 −1 LayoutTests/fast/css/line-height-text-autosizing.html
  14. +3 −3 LayoutTests/fast/ruby/ruby-line-height-expected.txt
  15. +3 −3 LayoutTests/fast/ruby/script-tests/ruby-line-height.js
  16. +1 −1 LayoutTests/media/track/track-cue-rendering-on-resize-expected.txt
  17. +1 −1 LayoutTests/media/track/track-cue-rendering-on-resize.html
  18. +1 −1 ...utTests/platform/mac-mavericks/platform/mac/editing/attributed-string/anchor-element-expected.txt
  19. +1 −1 LayoutTests/platform/mac-mavericks/platform/mac/editing/attributed-string/basic-expected.txt
  20. +324 −1 LayoutTests/platform/mac-mavericks/platform/mac/editing/attributed-string/font-size-expected.txt
  21. +1 −1 ...tform/mac-mavericks/platform/mac/editing/attributed-string/font-style-variant-effect-expected.txt
  22. +1 −1 LayoutTests/platform/mac-mavericks/platform/mac/editing/attributed-string/font-weight-expected.txt
  23. +1 −1 ...utTests/platform/mac-mavericks/platform/mac/editing/attributed-string/letter-spacing-expected.txt
  24. +1 −1 ...Tests/platform/mac-mavericks/platform/mac/editing/attributed-string/text-decorations-expected.txt
  25. +58 −1 ...utTests/platform/mac-mavericks/platform/mac/editing/attributed-string/vertical-align-expected.txt
  26. +1 −1 LayoutTests/platform/mac/editing/attributed-string/anchor-element-expected.txt
  27. +1 −1 LayoutTests/platform/mac/editing/attributed-string/basic-expected.txt
  28. +324 −73 LayoutTests/platform/mac/editing/attributed-string/font-size-expected.txt
  29. +1 −1 LayoutTests/platform/mac/editing/attributed-string/font-style-variant-effect-expected.txt
  30. +1 −1 LayoutTests/platform/mac/editing/attributed-string/font-weight-expected.txt
  31. +1 −1 LayoutTests/platform/mac/editing/attributed-string/letter-spacing-expected.txt
  32. +1 −1 LayoutTests/platform/mac/editing/attributed-string/text-decorations-expected.txt
  33. +58 −33 LayoutTests/platform/mac/editing/attributed-string/vertical-align-expected.txt
  34. +2 −2 LayoutTests/svg/css/getComputedStyle-basic-expected.txt
  35. +15 −0 Source/WebCore/ChangeLog
  36. +2 −2 Source/WebCore/css/CSSComputedStyleDeclaration.cpp
@@ -1,3 +1,47 @@
2015-01-26 Sylvain Galineau <galineau@adobe.com>

The computed value of line-height:normal is incorrect
https://bugs.webkit.org/show_bug.cgi?id=133744

Reviewed by Dean Jackson.

line-height:normal now computes to a length value.
This patch updates the tests to reflect the new computed value, as needed.

* css3/calc/line-height-expected.txt:
* editing/pasteboard/simplfiying-markup-should-not-strip-content-expected.txt:
* fast/css/font-calculated-value-expected.txt:
* fast/css/font-calculated-value.html:
* fast/css/font-shorthand-from-longhands-expected.txt:
* fast/css/font-shorthand-from-longhands.html:
* fast/css/getComputedStyle/computed-style-expected.txt:
* fast/css/getComputedStyle/computed-style-font-expected.txt:
* fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* fast/css/getComputedStyle/script-tests/computed-style-font.js:
* fast/css/line-height-text-autosizing-expected.txt:
* fast/css/line-height-text-autosizing.html:
* fast/ruby/ruby-line-height-expected.txt:
* fast/ruby/script-tests/ruby-line-height.js:
* media/track/track-cue-rendering-on-resize-expected.txt:
* media/track/track-cue-rendering-on-resize.html:
* platform/mac-mavericks/platform/mac/editing/attributed-string/anchor-element-expected.txt:
* platform/mac-mavericks/platform/mac/editing/attributed-string/basic-expected.txt:
* platform/mac-mavericks/platform/mac/editing/attributed-string/font-size-expected.txt:
* platform/mac-mavericks/platform/mac/editing/attributed-string/font-style-variant-effect-expected.txt:
* platform/mac-mavericks/platform/mac/editing/attributed-string/font-weight-expected.txt:
* platform/mac-mavericks/platform/mac/editing/attributed-string/letter-spacing-expected.txt:
* platform/mac-mavericks/platform/mac/editing/attributed-string/text-decorations-expected.txt:
* platform/mac-mavericks/platform/mac/editing/attributed-string/vertical-align-expected.txt:
* platform/mac/editing/attributed-string/anchor-element-expected.txt:
* platform/mac/editing/attributed-string/basic-expected.txt:
* platform/mac/editing/attributed-string/font-size-expected.txt:
* platform/mac/editing/attributed-string/font-style-variant-effect-expected.txt:
* platform/mac/editing/attributed-string/font-weight-expected.txt:
* platform/mac/editing/attributed-string/letter-spacing-expected.txt:
* platform/mac/editing/attributed-string/text-decorations-expected.txt:
* platform/mac/editing/attributed-string/vertical-align-expected.txt:
* svg/css/getComputedStyle-basic-expected.txt:

2015-01-26 Brent Fulgham <bfulgham@apple.com>

[Win] Windows gardening (removing more skips).
@@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE


PASS getComputedStyle(document.getElementById("calc-percent"), null).lineHeight is getComputedStyle(document.getElementById("control"), null).lineHeight
FAIL getComputedStyle(document.getElementById("calc-percent-pixels"), null).lineHeight should be 32px. Was normal.
FAIL getComputedStyle(document.getElementById("calc-percent-pixels"), null).lineHeight should be 32px. Was 18px.
PASS successfullyParsed is true

TEST COMPLETE
@@ -33,7 +33,7 @@ Pasted content:
| face="Verdana"
| "hello "
| <br>
| style="font-family: Helvetica;"
| style="font-family: Helvetica; line-height: 18px;"
| <font>
| face="Verdana"
| "worldWebKit<#selection-caret>"
@@ -6,7 +6,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS testDiv.style['font'] is ""
testDiv.style['font'] = 'italic small-caps calc(100 * 9) 12px arial'
PASS testDiv.style['font'] is "italic small-caps 900 12px arial"
PASS window.getComputedStyle(testDiv).getPropertyValue('font') is "italic small-caps 900 12px/normal arial"
PASS window.getComputedStyle(testDiv).getPropertyValue('font') is "italic small-caps 900 12px/14px arial"
PASS successfullyParsed is true

TEST COMPLETE
@@ -10,7 +10,7 @@
shouldBeEmptyString("testDiv.style['font']");
evalAndLog("testDiv.style['font'] = 'italic small-caps calc(100 * 9) 12px arial'");
shouldBeEqualToString("testDiv.style['font']", "italic small-caps 900 12px arial");
shouldBeEqualToString("window.getComputedStyle(testDiv).getPropertyValue('font')", "italic small-caps 900 12px/normal arial");
shouldBeEqualToString("window.getComputedStyle(testDiv).getPropertyValue('font')", "italic small-caps 900 12px/14px arial");

</script>
<script src="../../resources/js-test-post.js"></script>
@@ -4,38 +4,38 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE


PASS style.font is ''
PASS computedStyle.font is 'normal normal normal 20px/normal foobar'
PASS computedStyle.font is 'normal normal normal 20px/23px foobar'
PASS computedStyle.fontSize is '20px'
PASS checkFontStyleValue() is true
PASS style.font is '20px sans-serif'
PASS computedStyle.font is 'normal normal normal 20px/normal sans-serif'
PASS computedStyle.font is 'normal normal normal 20px/23px sans-serif'
PASS computedStyle.fontFamily is 'sans-serif'
PASS checkFontStyleValue() is true
PASS style.font is 'italic 20px sans-serif'
PASS computedStyle.font is 'italic normal normal 20px/normal sans-serif'
PASS computedStyle.font is 'italic normal normal 20px/23px sans-serif'
PASS computedStyle.fontStyle is 'italic'
PASS checkFontStyleValue() is true
PASS style.font is 'italic small-caps 20px sans-serif'
PASS computedStyle.font is 'italic small-caps normal 20px/normal sans-serif'
PASS computedStyle.font is 'italic small-caps normal 20px/23px sans-serif'
PASS computedStyle.fontVariant is 'small-caps'
PASS checkFontStyleValue() is true
PASS style.font is 'italic small-caps bold 20px sans-serif'
PASS computedStyle.font is 'italic small-caps bold 20px/normal sans-serif'
PASS computedStyle.font is 'italic small-caps bold 20px/23px sans-serif'
PASS computedStyle.fontWeight is 'bold'
PASS checkFontStyleValue() is true
PASS style.font is 'italic small-caps bold 20px/40px sans-serif'
PASS computedStyle.font is 'italic small-caps bold 20px/40px sans-serif'
PASS computedStyle.lineHeight is '40px'
PASS checkFontStyleValue() is true
PASS style.font is ''
PASS computedStyle.font is 'normal normal normal 16px/normal foobar'
PASS computedStyle.font is 'normal normal normal 16px/18px foobar'
PASS checkFontStyleValue() is true
PASS style.font is ''
PASS computedStyle.font is 'normal normal bold 16px/normal foobar'
PASS computedStyle.font is 'normal normal bold 16px/18px foobar'
PASS computedStyle.fontWeight is 'bold'
PASS checkFontStyleValue() is true
PASS style.font is 'bold 40px sans-serif'
PASS computedStyle.font is 'normal normal bold 40px/normal sans-serif'
PASS computedStyle.font is 'normal normal bold 40px/46px sans-serif'
PASS computedStyle.fontSize is '40px'
PASS computedStyle.fontFamily is 'sans-serif'
PASS checkFontStyleValue() is true
@@ -36,32 +36,32 @@
style.fontSize = "20px";
// We need at least the font-family to build the shorthand.
shouldBe("style.font", "''");
shouldBe("computedStyle.font", "'normal normal normal 20px/normal foobar'");
shouldBe("computedStyle.font", "'normal normal normal 20px/23px foobar'");
shouldBe("computedStyle.fontSize", "'20px'");
shouldBe("checkFontStyleValue()", "true");

style.fontSize = "20px";
style.fontFamily = "sans-serif";
shouldBe("style.font", "'20px sans-serif'");
shouldBe("computedStyle.font", "'normal normal normal 20px/normal sans-serif'");
shouldBe("computedStyle.font", "'normal normal normal 20px/23px sans-serif'");
shouldBe("computedStyle.fontFamily", "'sans-serif'");
shouldBe("checkFontStyleValue()", "true");

style.fontStyle = "italic";
shouldBe("style.font", "'italic 20px sans-serif'");
shouldBe("computedStyle.font", "'italic normal normal 20px/normal sans-serif'");
shouldBe("computedStyle.font", "'italic normal normal 20px/23px sans-serif'");
shouldBe("computedStyle.fontStyle", "'italic'");
shouldBe("checkFontStyleValue()", "true");

style.fontVariant = "small-caps";
shouldBe("style.font", "'italic small-caps 20px sans-serif'");
shouldBe("computedStyle.font", "'italic small-caps normal 20px/normal sans-serif'");
shouldBe("computedStyle.font", "'italic small-caps normal 20px/23px sans-serif'");
shouldBe("computedStyle.fontVariant", "'small-caps'");
shouldBe("checkFontStyleValue()", "true");

style.fontWeight = "bold";
shouldBe("style.font", "'italic small-caps bold 20px sans-serif'");
shouldBe("computedStyle.font", "'italic small-caps bold 20px/normal sans-serif'");
shouldBe("computedStyle.font", "'italic small-caps bold 20px/23px sans-serif'");
shouldBe("computedStyle.fontWeight", "'bold'");
shouldBe("checkFontStyleValue()", "true");

@@ -73,21 +73,21 @@

style.font = "";
shouldBe("style.font", "''");
shouldBe("computedStyle.font", "'normal normal normal 16px/normal foobar'");
shouldBe("computedStyle.font", "'normal normal normal 16px/18px foobar'");
shouldBe("checkFontStyleValue()", "true");

style.fontWeight = "bold";
// It is normal to return null as the font-size is mandatory to build the shorthand.
shouldBe("style.font", "''");
shouldBe("computedStyle.font", "'normal normal bold 16px/normal foobar'");
shouldBe("computedStyle.font", "'normal normal bold 16px/18px foobar'");
shouldBe("computedStyle.fontWeight", "'bold'");
shouldBe("checkFontStyleValue()", "true");

style.fontSize = "40px";
style.fontFamily = "sans-serif";
style.fontWeight = "bold";
shouldBe("style.font", "'bold 40px sans-serif'");
shouldBe("computedStyle.font", "'normal normal bold 40px/normal sans-serif'");
shouldBe("computedStyle.font", "'normal normal bold 40px/46px sans-serif'");
shouldBe("computedStyle.fontSize", "'40px'");
shouldBe("computedStyle.fontFamily", "'sans-serif'");
shouldBe("checkFontStyleValue()", "true");
@@ -50,7 +50,7 @@ height: 576px;
image-rendering: auto;
left: auto;
letter-spacing: normal;
line-height: normal;
line-height: 18px;
list-style-image: none;
list-style-position: outside;
list-style-type: disc;

0 comments on commit 1c44a11

Please sign in to comment.