[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