Changeset 136411 in webkit


Ignore:
Timestamp:
Dec 3, 2012 10:21:57 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Text Autosizing: don't autosize horizontal menu items implemented via floating list items
https://bugs.webkit.org/show_bug.cgi?id=103840

Patch by Anton Vayvod <avayvod@chromium.org> on 2012-12-03
Reviewed by Kenneth Rohde Christiansen.

Floating list items are often used to implement horizontal menus. Currently, text autosizing
disregards such elements as autosizing containers. List items are often then autosized as part
of a bigger cluster (usually the whole page) and look too big.
This change turns floating list items into autosizing clusters so they are autosized separately
resulting in no font size multiplication for menu items implemented in this manner.

Source/WebCore:

Test: fast/text-autosizing/cluster-list-item.html

  • rendering/TextAutosizer.cpp:

(WebCore::TextAutosizer::isAutosizingContainer): Returns true for floating list items; split the
condition logically.

LayoutTests:

  • fast/text-autosizing/cluster-list-item-expected.html: Renamed from LayoutTests/fast/text-autosizing/list-item-out-of-flow-expected.html.
  • fast/text-autosizing/cluster-list-item.html: Renamed from LayoutTests/fast/text-autosizing/list-item-out-of-flow.html; added case for a floating list item.
Location:
trunk
Files:
3 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r136409 r136411  
     12012-12-03  Anton Vayvod  <avayvod@chromium.org>
     2
     3        Text Autosizing: don't autosize horizontal menu items implemented via floating list items
     4        https://bugs.webkit.org/show_bug.cgi?id=103840
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Floating list items are often used to implement horizontal menus. Currently, text autosizing
     9        disregards such elements as autosizing containers. List items are often then autosized as part
     10        of a bigger cluster (usually the whole page) and look too big.
     11        This change turns floating list items into autosizing clusters so they are autosized separately
     12        resulting in no font size multiplication for menu items implemented in this manner.
     13
     14        * fast/text-autosizing/cluster-list-item-expected.html: Renamed from LayoutTests/fast/text-autosizing/list-item-out-of-flow-expected.html.
     15        * fast/text-autosizing/cluster-list-item.html: Renamed from LayoutTests/fast/text-autosizing/list-item-out-of-flow.html; added case for a floating list item.
     16
    1172012-12-03  Tony Chang  <tony@chromium.org>
    218
  • trunk/LayoutTests/fast/text-autosizing/cluster-list-item-expected.html

    r136410 r136411  
    1717                Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    1818        </li>
    19         <li style="position: absolute; width: 800px; font-size: 2.5rem">
    20                 This list element becomes a separate autosizing cluster since it's positioned out of the list flow. Hence its computed font size is 40px (16 * 400 / 320).<br>
     19        <li style="font-size: 1.25rem">
     20                This element is autosized to computed font size of 20px similarly to the first list item.<br>
    2121                Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    2222        </li>
    23         <li style="font-size: 1.25rem">
    24                 This element is autosized to computed font size of 20px similarly to the first list item.<br>
     23        <li style="float: left; width: 800px; font-size: 2.5rem">
     24                This list element becomes a separate autosizing cluster since it's floating. Hence its computed font size is 40px (16 * 400 / 320).<br>
     25                Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
     26        </li>
     27        <li style="position: absolute; margin-top: 280px; width: 800px; font-size: 2.5rem">
     28                This list element becomes a separate autosizing cluster since it's positioned out of the list flow. Hence its computed font size is 40px (16 * 400 / 320).<br>
     29                Margin is added so it doesn't overlap with the previous element.<br>
    2530                Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    2631        </li>
  • trunk/LayoutTests/fast/text-autosizing/cluster-list-item.html

    r136410 r136411  
    2626                Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    2727        </li>
    28         <li style="position: absolute; width: 800px">
    29                 This list element becomes a separate autosizing cluster since it's positioned out of the list flow. Hence its computed font size is 40px (16 * 400 / 320).<br>
     28        <li>
     29                This element is autosized to computed font size of 20px similarly to the first list item.<br>
    3030                Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    3131        </li>
    32         <li>
    33                 This element is autosized to computed font size of 20px similarly to the first list item.<br>
     32        <li style="float: left; width: 800px">
     33                This list element becomes a separate autosizing cluster since it's floating. Hence its computed font size is 40px (16 * 400 / 320).<br>
     34                Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
     35        </li>
     36        <li style="position: absolute; margin-top: 280px; width: 800px">
     37                This list element becomes a separate autosizing cluster since it's positioned out of the list flow. Hence its computed font size is 40px (16 * 400 / 320).<br>
     38                Margin is added so it doesn't overlap with the previous element.<br>
    3439                Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
    3540        </li>
  • trunk/Source/WebCore/ChangeLog

    r136410 r136411  
     12012-12-03  Anton Vayvod  <avayvod@chromium.org>
     2
     3        Text Autosizing: don't autosize horizontal menu items implemented via floating list items
     4        https://bugs.webkit.org/show_bug.cgi?id=103840
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Floating list items are often used to implement horizontal menus. Currently, text autosizing
     9        disregards such elements as autosizing containers. List items are often then autosized as part
     10        of a bigger cluster (usually the whole page) and look too big.
     11        This change turns floating list items into autosizing clusters so they are autosized separately
     12        resulting in no font size multiplication for menu items implemented in this manner.
     13
     14        Test: fast/text-autosizing/cluster-list-item.html
     15
     16        * rendering/TextAutosizer.cpp:
     17        (WebCore::TextAutosizer::isAutosizingContainer): Returns true for floating list items; split the
     18        condition logically.
     19
    1202012-12-03  Viatcheslav Ostapenko  <v.ostapenko@samsung.com>
    221
  • trunk/Source/WebCore/rendering/TextAutosizer.cpp

    r136047 r136411  
    206206    // - Must not be inline, as different multipliers on one line looks terrible.
    207207    // - Must not be list items, as items in the same list should look consistent (*).
    208     // * except for those list items positioned out of the list's flow.
    209     return renderer->isRenderBlock()
    210         && !renderer->isInline()
    211         && (!renderer->isListItem() || renderer->isOutOfFlowPositioned());
     208    // - Must not be normal list items, as items in the same list should look
     209    //   consistent, unless they are floating or position:absolute/fixed.
     210    if (!renderer->isRenderBlock() || renderer->isInline())
     211        return false;
     212    if (renderer->isListItem())
     213        return renderer->isFloating() || renderer->isOutOfFlowPositioned();
     214    return true;
    212215}
    213216
Note: See TracChangeset for help on using the changeset viewer.