Skip to content
  • tkent@chromium.org's avatar
    Fix sub-field width to the maximum width of a placeholder and the maximum value · 44582991
    tkent@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=98481
    
    Reviewed by Hajime Morita.
    
    Source/WebCore:
    
    We can't assume a placeholder text is shorter than the width of
    digits. The placeholder string for the year field of
    input[type=week] is "----", but input[type=date] will have a
    localized string for it.
    
    We should set the 'width' CSS property to the maximum of the
    placeholder width and the maximum value width in order to prevent
    the field width from growing/narrowing.
    
    Before this patch, we secured four digits space for a year field,
    and allowed the field to grow its width when a larger year is
    set. After this patch, we don't allow it to grow because the
    'width' property is set to the maximum width.
    
    Update week-multiple-fields-appearance-basic.html, and the
    following tests are affected.
    - fast/forms/week-multiple-fields/week-multiple-fields-appearance-pseudo-classes.html
    - fast/forms/week-multiple-fields/week-multiple-fields-appearance-pseudo-elements.html
    - fast/forms/week-multiple-fields/week-multiple-fields-appearance-style.html
    
    * html/shadow/DateTimeNumericFieldElement.cpp:
    (WebCore::DateTimeNumericFieldElement::DateTimeNumericFieldElement):
    Enable customStyleForRenderer.
    (WebCore::DateTimeNumericFieldElement::customStyleForRenderer):
    Added. The code is similar to DateTimeSymbolicFieldElement::customStyleForRenderer().
    (WebCore::DateTimeNumericFieldElement::formatValue):
    Made a function with the code in value(). This is used in
    customStyleForRenderer() and value().
    (WebCore::DateTimeNumericFieldElement::value): Use formatValue().
    * html/shadow/DateTimeNumericFieldElement.h:
    (DateTimeNumericFieldElement): Declare new functions.
    
    LayoutTests:
    
    Update a test and test expectations.
    
    * fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic-expected.txt:
    * fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic.html:
    * platform/chromium-mac/fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic-expected.png:
    * platform/chromium-mac/fast/forms/week-multiple-fields/week-multiple-fields-appearance-pseudo-classes-expected.png:
    * platform/chromium-mac/fast/forms/week-multiple-fields/week-multiple-fields-appearance-pseudo-elements-expected.png:
    * platform/chromium-mac/fast/forms/week-multiple-fields/week-multiple-fields-appearance-style-expected.png:
    * platform/chromium/TestExpectations:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130477 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    44582991