Changeset 130477 in webkit
- Timestamp:
- Oct 5, 2012 12:35:58 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r130475 r130477 1 2012-10-04 Kent Tamura <tkent@chromium.org> 2 3 Fix sub-field width to the maximum width of a placeholder and the maximum value 4 https://bugs.webkit.org/show_bug.cgi?id=98481 5 6 Reviewed by Hajime Morita. 7 8 Update a test and test expectations. 9 10 * fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic-expected.txt: 11 * fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic.html: 12 * platform/chromium-mac/fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic-expected.png: 13 * platform/chromium-mac/fast/forms/week-multiple-fields/week-multiple-fields-appearance-pseudo-classes-expected.png: 14 * platform/chromium-mac/fast/forms/week-multiple-fields/week-multiple-fields-appearance-pseudo-elements-expected.png: 15 * platform/chromium-mac/fast/forms/week-multiple-fields/week-multiple-fields-appearance-style-expected.png: 16 * platform/chromium/TestExpectations: 17 1 18 2012-10-05 Kangil Han <kangil.han@samsung.com> 2 19 -
trunk/LayoutTests/fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic-expected.txt
r130107 r130477 4 4 readonly 5 5 RTL 6 With max -
trunk/LayoutTests/fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic.html
r130107 r130477 7 7 <li>readonly <input type="week" readonly> <input type="week" value="1982-W25" readonly></li> 8 8 <li>RTL <input type="week" dir="rtl"> <input type="week" value="1982-W25" dir="rtl"></li> 9 <li>With max <input type="week" max="9999-W52"> <input type="week" value="1982-W25" max="9999-W52"></li> 9 10 </ul> 10 11 </body> -
trunk/LayoutTests/platform/chromium/TestExpectations
r130460 r130477 3650 3650 webkit.org/b/98390 platform/chromium/fast/forms/date/date-suggestion-picker-appearance.html [ ImageOnlyFailure Pass ] 3651 3651 3652 # Need rebaseline 3653 webkit.org/b/98481 fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic.html [ ImageOnlyFailure Pass ] 3654 webkit.org/b/98481 fast/forms/week-multiple-fields/week-multiple-fields-appearance-pseudo-classes.html [ ImageOnlyFailure Pass ] 3655 webkit.org/b/98481 fast/forms/week-multiple-fields/week-multiple-fields-appearance-pseudo-elements.html [ ImageOnlyFailure Pass ] 3656 webkit.org/b/98481 fast/forms/week-multiple-fields/week-multiple-fields-appearance-style.html [ ImageOnlyFailure Pass ] 3657 3652 3658 3653 3659 # Numerous failures in software compositing. -
trunk/Source/WebCore/ChangeLog
r130476 r130477 1 2012-10-04 Kent Tamura <tkent@chromium.org> 2 3 Fix sub-field width to the maximum width of a placeholder and the maximum value 4 https://bugs.webkit.org/show_bug.cgi?id=98481 5 6 Reviewed by Hajime Morita. 7 8 We can't assume a placeholder text is shorter than the width of 9 digits. The placeholder string for the year field of 10 input[type=week] is "----", but input[type=date] will have a 11 localized string for it. 12 13 We should set the 'width' CSS property to the maximum of the 14 placeholder width and the maximum value width in order to prevent 15 the field width from growing/narrowing. 16 17 Before this patch, we secured four digits space for a year field, 18 and allowed the field to grow its width when a larger year is 19 set. After this patch, we don't allow it to grow because the 20 'width' property is set to the maximum width. 21 22 Update week-multiple-fields-appearance-basic.html, and the 23 following tests are affected. 24 - fast/forms/week-multiple-fields/week-multiple-fields-appearance-pseudo-classes.html 25 - fast/forms/week-multiple-fields/week-multiple-fields-appearance-pseudo-elements.html 26 - fast/forms/week-multiple-fields/week-multiple-fields-appearance-style.html 27 28 * html/shadow/DateTimeNumericFieldElement.cpp: 29 (WebCore::DateTimeNumericFieldElement::DateTimeNumericFieldElement): 30 Enable customStyleForRenderer. 31 (WebCore::DateTimeNumericFieldElement::customStyleForRenderer): 32 Added. The code is similar to DateTimeSymbolicFieldElement::customStyleForRenderer(). 33 (WebCore::DateTimeNumericFieldElement::formatValue): 34 Made a function with the code in value(). This is used in 35 customStyleForRenderer() and value(). 36 (WebCore::DateTimeNumericFieldElement::value): Use formatValue(). 37 * html/shadow/DateTimeNumericFieldElement.h: 38 (DateTimeNumericFieldElement): Declare new functions. 39 1 40 2012-10-05 Kent Tamura <tkent@chromium.org> 2 41 -
trunk/Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp
r130362 r130477 28 28 #include "DateTimeNumericFieldElement.h" 29 29 30 #include "FontCache.h" 30 31 #include "KeyboardEvent.h" 31 32 #include "Localizer.h" 33 #include "RenderStyle.h" 34 #include "StyleResolver.h" 35 #include "TextRun.h" 32 36 #include <wtf/text/StringBuilder.h> 33 37 … … 63 67 , m_hasValue(false) 64 68 { 69 setHasCustomCallbacks(); 65 70 } 66 71 … … 70 75 } 71 76 77 PassRefPtr<RenderStyle> DateTimeNumericFieldElement::customStyleForRenderer() 78 { 79 FontCachePurgePreventer fontCachePurgePreventer; 80 RefPtr<RenderStyle> originalStyle = document()->styleResolver()->styleForElement(this); 81 RefPtr<RenderStyle> style = RenderStyle::clone(originalStyle.get()); 82 float maxiumWidth = style->font().width(m_placeholder); 83 maxiumWidth = std::max(maxiumWidth, style->font().width(formatValue(maximum()))); 84 style->setWidth(Length(maxiumWidth, Fixed)); 85 return style.release(); 86 } 87 72 88 int DateTimeNumericFieldElement::defaultValueForStepDown() const 73 89 { … … 84 100 m_lastDigitCharTime = 0; 85 101 DateTimeFieldElement::didBlur(); 102 } 103 104 String DateTimeNumericFieldElement::formatValue(int value) const 105 { 106 Localizer& localizer = localizerForOwner(); 107 if (m_range.maximum > 999) 108 return localizer.convertToLocalizedNumber(String::format("%04d", value)); 109 if (m_range.maximum > 99) 110 return localizer.convertToLocalizedNumber(String::format("%03d", value)); 111 return localizer.convertToLocalizedNumber(String::format("%02d", value)); 86 112 } 87 113 … … 174 200 String DateTimeNumericFieldElement::value() const 175 201 { 176 if (!m_hasValue) 177 return emptyString(); 178 179 Localizer& localizer = localizerForOwner(); 180 if (m_range.maximum > 999) 181 return localizer.convertToLocalizedNumber(String::format("%04d", m_value)); 182 183 if (m_range.maximum > 99) 184 return localizer.convertToLocalizedNumber(String::format("%03d", m_value)); 185 186 return localizer.convertToLocalizedNumber(String::format("%02d", m_value)); 202 return m_hasValue ? formatValue(m_value) : emptyString(); 187 203 } 188 204 -
trunk/Source/WebCore/html/shadow/DateTimeNumericFieldElement.h
r130362 r130477 69 69 70 70 private: 71 // Element function. 72 virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE; 73 71 74 // DateTimeFieldElement functions. 72 75 virtual void didBlur() OVERRIDE FINAL; … … 77 80 virtual String value() const OVERRIDE FINAL; 78 81 82 String formatValue(int) const; 79 83 Localizer& localizerForOwner() const; 80 84
Note: See TracChangeset
for help on using the changeset viewer.