Text Autosizing: Multiply large fonts less, as they are already more legible.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2012 16:24:15 +0000 (16:24 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2012 16:24:15 +0000 (16:24 +0000)
commited9db2f48750ca21d3a535ff04632bdc6902da34
tree9d85c9af35472013c0180d25e2faee4a7d8e42eb
parentaa8561ce34aa7cecfdf5ce4e7617a6997d238a89
Text Autosizing: Multiply large fonts less, as they are already more legible.
https://bugs.webkit.org/show_bug.cgi?id=94227

Patch by John Mellor <johnme@chromium.org> on 2012-08-23
Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

Rather than uniformly multiplying font sizes by the multiplier (derived
from the width of the block), we should multiply fonts that are already
large less, since they are already more legible hence there is less need
for them to grow.

However it is still important to maintain differentiation between text
that the author specified to be of different sizes.

This algorithm multiplies text by the multiplier up until a predefined
"pleasant" font size; beyond that the computedSize goes up with
specifiedSize but at a gradient of less than 1 in order to gradually
fade out the size increase; finally for very large specifiedSizes the
computedSize will be the same as the specifiedSize.

For further details, including a graph, please see the bug report.

Test: fast/text-autosizing/various-font-sizes.html

* rendering/TextAutosizer.cpp:
(WebCore::TextAutosizer::computeAutosizedFontSize):

    Implements the custom multiplication. See comment for details.

* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::lineHeight):

    Use computeAutosizedFontSize instead of directly multiplying.

(WebCore::RenderStyle::setFontSize):

    Use computeAutosizedFontSize instead of directly multiplying.

LayoutTests:

Added test demonstrating how various font sizes are affected.

* fast/text-autosizing/various-font-sizes-expected.html: Added.
* fast/text-autosizing/various-font-sizes.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126438 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/text-autosizing/various-font-sizes-expected.html [new file with mode: 0644]
LayoutTests/fast/text-autosizing/various-font-sizes.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/TextAutosizer.cpp
Source/WebCore/rendering/TextAutosizer.h
Source/WebCore/rendering/style/RenderStyle.cpp