Changeset 139216 in webkit


Ignore:
Timestamp:
Jan 9, 2013 11:41:01 AM (11 years ago)
Author:
ojan@chromium.org
Message:

min-content gets the wrong value if min-width is set on some form controls
https://bugs.webkit.org/show_bug.cgi?id=106389

Reviewed by Tony Chang.

Source/WebCore:

Simplify the logic. The only exposed change in behavior is that
m_minPreferredLogicalWidth gets set to m_maxPreferredLogicalWidth
instead of 0 when min-width is set.

Test: fast/forms/min-content-form-controls.html

  • rendering/RenderFileUploadControl.cpp:

(WebCore::RenderFileUploadControl::computePreferredLogicalWidths):

  • rendering/RenderListBox.cpp:

(WebCore::RenderListBox::computePreferredLogicalWidths):

  • rendering/RenderMenuList.cpp:

(WebCore::RenderMenuList::computePreferredLogicalWidths):

  • rendering/RenderSlider.cpp:

(WebCore::RenderSlider::computePreferredLogicalWidths):

  • rendering/RenderTextControl.cpp:

(WebCore::RenderTextControl::computePreferredLogicalWidths):

LayoutTests:

  • fast/forms/min-content-form-controls-expected.txt: Added.
  • fast/forms/min-content-form-controls.html: Added.
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r139214 r139216  
     12013-01-08  Ojan Vafai  <ojan@chromium.org>
     2
     3        min-content gets the wrong value if min-width is set on some form controls
     4        https://bugs.webkit.org/show_bug.cgi?id=106389
     5
     6        Reviewed by Tony Chang.
     7
     8        * fast/forms/min-content-form-controls-expected.txt: Added.
     9        * fast/forms/min-content-form-controls.html: Added.
     10
    1112013-01-09  Roger Fong  <roger_fong@apple.com>
    212
  • trunk/LayoutTests/platform/mac/TestExpectations

    r139176 r139216  
    12451245webkit.org/b/105932 [ MountainLion Debug ] http/tests/inspector/resource-har-pages.html [ Crash ]
    12461246
     1247# Need to see this run on the bots to see what's wrong. The code change in
     1248# https://bugs.webkit.org/show_bug.cgi?id=106389 is only touching cross-platform code.
     1249Bug(ojan) fast/forms/min-content-form-controls.html [ Failure ]
     1250
    12471251webkit.org/b/105986 [ Debug ] transitions/hang-with-bad-transition-list.html [ Pass Crash ]
    12481252webkit.org/b/105986 [ Debug ] svg/dynamic-updates/SVGFEMorphologyElement-dom-in-attr.html [ Pass Crash ]
  • trunk/Source/WebCore/ChangeLog

    r139213 r139216  
     12013-01-08  Ojan Vafai  <ojan@chromium.org>
     2
     3        min-content gets the wrong value if min-width is set on some form controls
     4        https://bugs.webkit.org/show_bug.cgi?id=106389
     5
     6        Reviewed by Tony Chang.
     7
     8        Simplify the logic. The only exposed change in behavior is that
     9        m_minPreferredLogicalWidth gets set to m_maxPreferredLogicalWidth
     10        instead of 0 when min-width is set.
     11
     12        Test: fast/forms/min-content-form-controls.html
     13
     14        * rendering/RenderFileUploadControl.cpp:
     15        (WebCore::RenderFileUploadControl::computePreferredLogicalWidths):
     16        * rendering/RenderListBox.cpp:
     17        (WebCore::RenderListBox::computePreferredLogicalWidths):
     18        * rendering/RenderMenuList.cpp:
     19        (WebCore::RenderMenuList::computePreferredLogicalWidths):
     20        * rendering/RenderSlider.cpp:
     21        (WebCore::RenderSlider::computePreferredLogicalWidths):
     22        * rendering/RenderTextControl.cpp:
     23        (WebCore::RenderTextControl::computePreferredLogicalWidths):
     24
    1252013-01-09  Abhishek Arya  <inferno@chromium.org>
    226
  • trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp

    r139089 r139216  
    191191                defaultLabelWidth += buttonRenderer->maxPreferredLogicalWidth() + afterButtonSpacing;
    192192        m_maxPreferredLogicalWidth = static_cast<int>(ceilf(max(minDefaultLabelWidth, defaultLabelWidth)));
     193
     194        if (!style->width().isPercent())
     195            m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
    193196    }
    194197
     
    196199        m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style->minWidth().value()));
    197200        m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style->minWidth().value()));
    198     } else if (style->width().isPercent())
    199         m_minPreferredLogicalWidth = 0;
    200     else
    201         m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
     201    }
    202202
    203203    if (style->maxWidth().isFixed()) {
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r139089 r139216  
    217217        if (m_vBar)
    218218            m_maxPreferredLogicalWidth += m_vBar->width();
     219
     220        if (!style()->width().isPercent())
     221            m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
    219222    }
    220223
     
    222225        m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
    223226        m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
    224     } else if (style()->width().isPercent())
    225         m_minPreferredLogicalWidth = 0;
    226     else
    227         m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
     227    }
    228228
    229229    if (style()->maxWidth().isFixed()) {
  • trunk/Source/WebCore/rendering/RenderMenuList.cpp

    r139089 r139216  
    280280    if (style()->width().isFixed() && style()->width().value() > 0)
    281281        m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentBoxLogicalWidthForBoxSizing(style()->width().value());
    282     else
     282    else {
    283283        m_maxPreferredLogicalWidth = max(m_optionsWidth, theme()->minimumMenuListSize(style())) + m_innerBlock->paddingLeft() + m_innerBlock->paddingRight();
     284
     285        if (!style()->width().isPercent())
     286            m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
     287    }
    284288
    285289    if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
    286290        m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
    287291        m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
    288     } else if (style()->width().isPercent())
    289         m_minPreferredLogicalWidth = 0;
    290     else
    291         m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
     292    }
    292293
    293294    if (style()->maxWidth().isFixed()) {
  • trunk/Source/WebCore/rendering/RenderSlider.cpp

    r139089 r139216  
    7878    if (style()->width().isFixed() && style()->width().value() > 0)
    7979        m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentBoxLogicalWidthForBoxSizing(style()->width().value());
    80     else
     80    else {
    8181        m_maxPreferredLogicalWidth = defaultTrackLength * style()->effectiveZoom();
     82
     83        if (!style()->width().isPercent())
     84            m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
     85    }
    8286
    8387    if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
    8488        m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
    8589        m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
    86     } else if (style()->width().isPercent())
    87         m_minPreferredLogicalWidth = 0;
    88     else
    89         m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
    90    
     90    }
     91
    9192    if (style()->maxWidth().isFixed()) {
    9293        m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->maxWidth().value()));
  • trunk/Source/WebCore/rendering/RenderTextControl.cpp

    r139089 r139216  
    270270        if (RenderBox* innerTextRenderBox = innerTextElement()->renderBox())
    271271            m_maxPreferredLogicalWidth += innerTextRenderBox->paddingLeft() + innerTextRenderBox->paddingRight();
     272
     273        if (!style()->width().isPercent())
     274            m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
    272275    }
    273276
     
    275278        m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
    276279        m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
    277     } else if (style()->width().isPercent())
    278         m_minPreferredLogicalWidth = 0;
    279     else
    280         m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
     280    }
    281281
    282282    if (style()->maxWidth().isFixed()) {
Note: See TracChangeset for help on using the changeset viewer.