[Cherry-pick][Text Autosizing] prevent oscillation of font sizes during autosizing
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Feb 2013 18:57:31 +0000 (18:57 +0000)
committerJaehun Lim <ljaehun.lim@samsung.com>
Thu, 4 Apr 2013 02:45:17 +0000 (11:45 +0900)
commit61df3881bd2ea0dc5017b21655583a9ed31de0f7
tree013c06013404cb4febb4885fbee6697a96204c3e
parenta1b7c1719ef6f6e81e8e09aa3c604eb34b763061
[Cherry-pick][Text Autosizing] prevent oscillation of font sizes during autosizing

Text Autosizing: prevent oscillation of font sizes during autosizing
https://bugs.webkit.org/show_bug.cgi?id=108205

Patch by Tim Volodine <timvolodine@chromium.org> on 2013-02-19
Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

On some websites autosized font-sizes oscillate due to layouts caused by
hovering or incremental page loading (and on other sites font sizes do
eventually stabilize, but it takes many layouts before they reach a steady
size). To prevent all these cases, we no longer allow the autosizing
multiplier to change after it has been set (to a value other than 1).

This won't always give exactly the same results, but testing on 2000 top
sites shows that this makes little difference in practice, and it prevents
these very jarring cases. As a happy side-effect, this speeds up layouts
as font sizes change less.

Test: fast/text-autosizing/oscillation-javascript-fontsize-change.html

* page/FrameView.cpp:
(WebCore::FrameView::setFrameRect):
* page/Settings.cpp:
(WebCore::Settings::setTextAutosizingFontScaleFactor):
* rendering/TextAutosizer.cpp:
(WebCore::TextAutosizer::recalculateMultipliers):
(WebCore):
(WebCore::TextAutosizer::processContainer):
* rendering/TextAutosizer.h:
(TextAutosizer):

LayoutTests:

Added overflow-y:hidden to some existing tests, since previously those tests
would start off with incorrect multipliers (because mainFrame->view()-layoutSize()
is initially 785 instead of 800 as ScrollView wrongly guesses a scrollbar will
be needed), and then the multipliers would get corrected on a subsequent layout.
Now that we don't allow the multiplier to change after being set, it needs to be
right first time.
Also added specific oscillation test triggered by javascript.

* fast/text-autosizing/constrained-height-body-expected.html:
* fast/text-autosizing/constrained-height-body.html:
* fast/text-autosizing/constrained-then-float-ancestors-expected.html:
* fast/text-autosizing/constrained-then-float-ancestors.html:
* fast/text-autosizing/constrained-then-position-fixed-ancestors-expected.html:
* fast/text-autosizing/constrained-then-position-fixed-ancestors.html:
* fast/text-autosizing/nested-em-line-height-expected.html:
* fast/text-autosizing/nested-em-line-height.html:
* fast/text-autosizing/oscillation-javascript-fontsize-change-expected.html: Added.
* fast/text-autosizing/oscillation-javascript-fontsize-change.html: Added.
* fast/text-autosizing/simple-paragraph-expected.html:
* fast/text-autosizing/simple-paragraph.html:
* fast/text-autosizing/span-child-expected.html:
* fast/text-autosizing/span-child.html:
* fast/text-autosizing/unwrappable-blocks-expected.html:
* fast/text-autosizing/unwrappable-blocks.html:
* fast/text-autosizing/unwrappable-inlines-expected.html:
* fast/text-autosizing/unwrappable-inlines.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@143356 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Conflicts:

LayoutTests/ChangeLog
Source/WebCore/ChangeLog
22 files changed:
LayoutTests/fast/text-autosizing/constrained-height-body-expected.html
LayoutTests/fast/text-autosizing/constrained-height-body.html
LayoutTests/fast/text-autosizing/constrained-then-float-ancestors-expected.html
LayoutTests/fast/text-autosizing/constrained-then-float-ancestors.html
LayoutTests/fast/text-autosizing/constrained-then-position-fixed-ancestors-expected.html
LayoutTests/fast/text-autosizing/constrained-then-position-fixed-ancestors.html
LayoutTests/fast/text-autosizing/nested-em-line-height-expected.html
LayoutTests/fast/text-autosizing/nested-em-line-height.html
LayoutTests/fast/text-autosizing/oscillation-javascript-fontsize-change-expected.html [new file with mode: 0644]
LayoutTests/fast/text-autosizing/oscillation-javascript-fontsize-change.html [new file with mode: 0644]
LayoutTests/fast/text-autosizing/simple-paragraph-expected.html
LayoutTests/fast/text-autosizing/simple-paragraph.html
LayoutTests/fast/text-autosizing/span-child-expected.html
LayoutTests/fast/text-autosizing/span-child.html
LayoutTests/fast/text-autosizing/unwrappable-blocks-expected.html
LayoutTests/fast/text-autosizing/unwrappable-blocks.html
LayoutTests/fast/text-autosizing/unwrappable-inlines-expected.html
LayoutTests/fast/text-autosizing/unwrappable-inlines.html
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/Settings.cpp
Source/WebCore/rendering/TextAutosizer.cpp
Source/WebCore/rendering/TextAutosizer.h