haikuwebkit/LayoutTests/fast/text/line-height-minimumFontSize...

28 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

Setting the minimum font size preference doesn’t affect absolute line-height values, so lines overlap https://bugs.webkit.org/show_bug.cgi?id=174406 Source/WebCore: Reviewed by Simon Fraser. <rdar://problem/10139227> Reviewed by NOBODY. When the minimumFontSize API preference is set, we will increase the font size without increasing the line height. If the content specifies line-height as an absolute value, there can be two unfortunate results: - Adjacent lines in a paragraph can overlap - If the paragraph (or containin block or whatever) uses overflow: hidden, the first and last lines can be cut off and potentially indecipherable. Instead, we should use the minimum font size preference as a signal that we should increase the line-height as well as the font-size. Eventually, we will want to increase it by an amount proportional to the increase in font-size (which can be due to minimumFontSize, minimumLogicalFontSize, text autosizing, etc.). However, because minimumLogicalFontSize is on by default, this would cause a behavior change on many webpages which use small text, so such a change would be too risky right now. Instead, we can pretend that minimumFontSize is the only cause that text increases, and use this as the only signal to boost the corresponding line-height. Tests: fast/text/line-height-minimumFontSize-text-zoom.html fast/text/line-height-minimumFontSize-visual.html fast/text/line-height-minimumFontSize-zoom.html fast/text/line-height-minimumFontSize.html fast/text/line-height-minimumFontSize-autosize.html * css/StyleBuilderCustom.h: (WebCore::computeBaseSpecifiedFontSize): (WebCore::computeLineHeightMultiplierDueToFontSize): (WebCore::StyleBuilderCustom::applyValueLineHeight): (WebCore::StyleBuilderCustom::applyValueFill): (WebCore::StyleBuilderCustom::applyValueStroke): (WebCore::StyleBuilderCustom::applyValueContent): * rendering/TextAutoSizing.cpp: LayoutTests: <rdar://problem/10139227> Reviewed by Simon Fraser. * fast/text/line-height-minimumFontSize-autosize-expected.text: Added. * fast/text/line-height-minimumFontSize-autosize.html: Added. * fast/text/line-height-minimumFontSize-expected.txt: Added. * fast/text/line-height-minimumFontSize-text-zoom-expected.html: Added. * fast/text/line-height-minimumFontSize-text-zoom.html: Added. * fast/text/line-height-minimumFontSize-visual-expected.html: Added. * fast/text/line-height-minimumFontSize-visual.html: Added. * fast/text/line-height-minimumFontSize-zoom-expected.html: Added. * fast/text/line-height-minimumFontSize-zoom.html: Added. * fast/text/line-height-minimumFontSize.html: Added. Canonical link: https://commits.webkit.org/191476@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-19 23:38:06 +00:00
This test makes sure that minimumFontSize affects line-height.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Math.round(parseFloat(window.getComputedStyle(document.getElementById('test1')).getPropertyValue('line-height'))) is comparisonLineHeight
PASS Math.round(parseFloat(window.getComputedStyle(document.getElementById('test2')).getPropertyValue('line-height'))) is comparisonLineHeight
PASS Math.round(parseFloat(window.getComputedStyle(document.getElementById('test3')).getPropertyValue('line-height'))) is 20 / 16 * 64
PASS Math.round(parseFloat(window.getComputedStyle(document.getElementById('test4')).getPropertyValue('line-height'))) is 20 / 10 * 64
PASS Math.round(parseFloat(window.getComputedStyle(document.getElementById('test5')).getPropertyValue('line-height'))) is 1.5 * 64
PASS Math.round(parseFloat(window.getComputedStyle(document.getElementById('test6')).getPropertyValue('line-height'))) is 1.5 * 64
PASS Math.round(parseFloat(window.getComputedStyle(document.getElementById('test7')).getPropertyValue('line-height'))) is 1.5 * 64
PASS Math.round(parseFloat(window.getComputedStyle(document.getElementById('test8')).getPropertyValue('line-height'))) is 1.5 * 64
PASS Math.round(parseFloat(window.getComputedStyle(document.getElementById('test9')).getPropertyValue('line-height'))) is 192
PASS successfullyParsed is true
TEST COMPLETE
1: Hello World
1: Hello World
2: Hello World
3: Hello World
4: Hello World
5: Hello World
6: Hello World
7: Hello World
8: Hello World
9: Hello World