[Text Autosizing] Combine narrow descendants of a cluster into groups that should...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Feb 2013 12:45:26 +0000 (12:45 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Feb 2013 12:45:26 +0000 (12:45 +0000)
commit6878ccd5619dca6d96a7909090efabd41367b717
tree4f27656fd3395702b4834a9aebc0f01909dfeb45
parent12d711a283337f981b451f809befd969a6f81f40
[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: https://svn.webkit.org/repository/webkit/trunk@143318 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/text-autosizing/narrow-descendants-combined-expected.html
LayoutTests/fast/text-autosizing/narrow-descendants-combined.html
Source/WebCore/ChangeLog
Source/WebCore/rendering/TextAutosizer.cpp
Source/WebCore/rendering/TextAutosizer.h