[Cherry-pick][Text Autosizing] Combine narrow descendants of a cluster into groups...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Feb 2013 12:45:26 +0000 (12:45 +0000)
committerJaehun Lim <ljaehun.lim@samsung.com>
Thu, 4 Apr 2013 02:43:43 +0000 (11:43 +0900)
commita1b7c1719ef6f6e81e8e09aa3c604eb34b763061
tree92fa2db4254ed968c7eed67c0efbaf42b3d705d8
parent515e556f64f1a7932ebf31360c416a55e2f0d2de
[Cherry-pick][Text Autosizing] Combine narrow descendants of a cluster into groups that should be autosized with the same multiplier.

[Text Autosizing] Combine narrow descendants of a cluster into groups that should be autosized with the same multiplier.
https://bugs.webkit.org/show_bug.cgi?id=109825

Source/WebCore:

Enhancement of the approach introduced in https://bugs.webkit.org/show_bug.cgi?id=109573.
Instead of using the same text size multiplier for all narrow descendants of any autosizing
cluster, group the descendants by how much narrower they are than the cluster's
|blockContainingAllText| and process each group separately with a different multiplier for
each one.
For example, we want nested comments on the page to be autosized as a group but separately
from a sidebar on the same page.

Patch by Anton Vayvod <avayvod@chromium.org> on 2013-02-19
Reviewed by Kenneth Rohde Christiansen.

Updated the existing test to verify the patch.

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

    Splits the narrow descendants of the autosizing cluster into groups before processing
    each group individually.

(WebCore::TextAutosizer::getNarrowDescendantsGroupedByWidth):

    Sorts the narrow descendants of the given cluster into groups, combining them by the
    difference between their content widths. If sorted by width, two consecutive nodes
    belong to the same group if their width difference is no greater than 100 CSS units.

* rendering/TextAutosizer.h:

    New method definitions.

LayoutTests:

Verify that narrow descendants are grouped and autosized separately according to the
difference between the descendant's width and the width of its enclosing cluster's
|blockContainingAllText|.

Patch by Anton Vayvod <avayvod@chromium.org> on 2013-02-19
Reviewed by Kenneth Rohde Christiansen.

* fast/text-autosizing/narrow-descendants-combined-expected.html:
* fast/text-autosizing/narrow-descendants-combined.html:

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

Conflicts:

LayoutTests/ChangeLog
Source/WebCore/ChangeLog
LayoutTests/ChangeLog
LayoutTests/fast/text-autosizing/narrow-descendants-combined-expected.html
LayoutTests/fast/text-autosizing/narrow-descendants-combined.html
Source/WebCore/rendering/TextAutosizer.cpp
Source/WebCore/rendering/TextAutosizer.h