Changeset 127398 in webkit
- Timestamp:
- Sep 2, 2012 9:03:19 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r127392 r127398 1 2012-09-02 Yoshifumi Inoue <yosin@chromium.org> 2 3 [Forms] AM/PM field of multiple fields time input UI should be fixed width 4 https://bugs.webkit.org/show_bug.cgi?id=95542 5 6 Reviewed by Kent Tamura. 7 8 This patch changes width of AM/PM field of multiple field time input 9 UI fixed as maximum width of labels or "--". 10 11 This patch affects ports which enable both ENABLE_INPUT_TYPE_TIME and 12 ENABLE_INPUT_TYPE_TIME_MULTIPLE_FIELDS. 13 14 No new tests. Once multiple field time input UI uses "lang" HTML 15 attribute to take time format, we can write a test for this patch. 16 17 * css/html.css: 18 (input::-webkit-datetime-edit-ampm-field): Added "display" property to "inline-block" for setting width. 19 Added "text-align" property to "center". 20 * html/shadow/DateTimeSymbolicFieldElement.cpp: 21 (WebCore::DateTimeSymbolicFieldElement::DateTimeSymbolicFieldElement): Changed to call setHasCustomCallback(). 22 (WebCore::DateTimeSymbolicFieldElement::customStyleForRenderer): Added for setting field with from maximum width of labels. 23 * html/shadow/DateTimeSymbolicFieldElement.h: 24 (WebCore::DateTimeSymbolicFieldElement::visibleEmptyValue): Added for using visible empty value in customStyleForRenderer() and visibleValue(). 25 (WebCore::DateTimeSymbolicFieldElement::visibleValue): Changed to call visibleEmptyValue() instead of using literal "--". 26 (DateTimeSymbolicFieldElement): Added a declaration of customStyleForRenderer(). 27 1 28 2012-09-02 Benjamin Poulain <bpoulain@apple.com> 2 29 -
trunk/Source/WebCore/css/html.css
r126728 r127398 492 492 border: none; 493 493 padding: 0.15em; 494 display: inline-block; 495 text-align: center; 494 496 } 495 497 -
trunk/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.cpp
r127085 r127398 28 28 #include "DateTimeSymbolicFieldElement.h" 29 29 30 #include "FontCache.h" 30 31 #include "KeyboardEvent.h" 32 #include "RenderStyle.h" 33 #include "StyleResolver.h" 34 #include "TextRun.h" 31 35 #include <wtf/unicode/Unicode.h> 32 36 … … 39 43 { 40 44 ASSERT(!symbols.isEmpty()); 45 setHasCustomCallbacks(); 46 } 47 48 PassRefPtr<RenderStyle> DateTimeSymbolicFieldElement::customStyleForRenderer() 49 { 50 FontCachePurgePreventer fontCachePurgePreventer; 51 RefPtr<RenderStyle> originalStyle = document()->styleResolver()->styleForElement(this); 52 RefPtr<RenderStyle> style = RenderStyle::clone(originalStyle.get()); 53 float maxiumWidth = style->font().width(visibleEmptyValue()); 54 for (unsigned index = 0; index < m_symbols.size(); ++index) 55 maxiumWidth = std::max(maxiumWidth, style->font().width(m_symbols[index])); 56 style->setWidth(Length(maxiumWidth, Fixed)); 57 return style.release(); 41 58 } 42 59 … … 99 116 } 100 117 118 String DateTimeSymbolicFieldElement::visibleEmptyValue() const 119 { 120 // FIXME: Number of dashs should be maximum length of labels. 121 return "--"; 122 } 123 101 124 String DateTimeSymbolicFieldElement::visibleValue() const 102 125 { 103 return hasValue() ? m_symbols[m_selectedIndex] : "--";126 return hasValue() ? m_symbols[m_selectedIndex] : visibleEmptyValue(); 104 127 } 105 128 -
trunk/Source/WebCore/html/shadow/DateTimeSymbolicFieldElement.h
r127085 r127398 44 44 static const int invalidIndex = -1; 45 45 46 virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE FINAL; 47 String visibleEmptyValue() const; 48 46 49 // DateTimeFieldElement functions. 47 50 virtual void handleKeyboardEvent(KeyboardEvent*) OVERRIDE FINAL;
Note: See TracChangeset
for help on using the changeset viewer.