| 1 | = How to enable Form features = |
| 2 | |
| 3 | == input[type=number] == |
| 4 | |
| 5 | If you have never done anything for input[type=number], it lacks the following features: |
| 6 | Spin button UI |
| 7 | Number localization |
| 8 | |
| 9 | === Spin button UI === |
| 10 | |
| 11 | This is optional. Opera has similar UI, but IE10 has no spin button. |
| 12 | If you want the spin button UI, implement RenderTheme::adjustInnerSpinButtonStyle and paintInnerSpinButtonStyle. |
| 13 | Test: fast/forms/number/number-{appearance,spinbutton}*.html |
| 14 | |
| 15 | === Number localization === |
| 16 | |
| 17 | This is optional. IE10 localizes numbers, but Opera doesn't. |
| 18 | This feature requires Locale class implementation. If your port is using WebCore/platform/text/LocaleNone.cpp, this feature is disabled. Use WebCore/platform/text/{LocaleICU.cpp,mac/LocaleMac.mm,win/LocaleWin.cpp}, or implement your own Locale class. |
| 19 | Test: fast/forms/number/number-l10n-input.html |
| 20 | |
| 21 | == Interactive form validation == |
| 22 | |
| 23 | 1. Implement WebCore/page/ValidationMessageClient.h for your port |
| 24 | 2. Set it to PageClients::validationMessageClient |
| 25 | 3. Page::settings()->setInteractiveFormValidationEnabled(true) |
| 26 | |
| 27 | Doing step 3 without step 1 and 2 enables platform-neutral form validation UI. But it has some unresolvable bugs. You should provide your ValidationMessageClient. |
| 28 | |
| 29 | == input[type=color] == |
| 30 | |
| 31 | Enable ENABLE_INPUT_TYPE_COLOR flag, and implement ChromeClient::createColorChooser. |
| 32 | |
| 33 | == Date, datetime-local, month, time, week input types == |
| 34 | |
| 35 | WebCore provides two UI types for them. |
| 36 | Multiple-fields UI (ENABLE_INPUT_MULTIPLE_FIELDS_UI flag) |
| 37 | Chooser-only UI (no ENABLE_INPUT_MULTIPLE_FIELDS_UI flag) |
| 38 | |
| 39 | In the multiple-fields UI, users can specify values quickly with keyboard or mouse input. This UI is not suitable for mobile devices with touch input. Optionally we can provide platform-specific chooser dialog UI. |
| 40 | The Chooser-only UI is simple. We provide only platform-specific chooser dialog UI. |
| 41 | |
| 42 | === Chooser-only UI === |
| 43 | |
| 44 | 1. Enable ENABLE_INPUT_TYPE_FOO without ENABLE_INPUT_MULTIPLE_FIELDS_UI |
| 45 | 2. Implement Locale class (See "Number localization" section) |
| 46 | 3. Implement ChromeClient::openDateTimeChooser |
| 47 | |
| 48 | === Multiple-fields UI === |
| 49 | |
| 50 | 1. Enable ENABLE_INPUT_TYPE_FOO and ENABLE_INPUT_MULTIPLE_FIELDS_UI |
| 51 | 2. Implement Locale class (See "Number localization" section) |
| 52 | 2. Implement RenderTheme::adjustInnerSpinButonStyle and paintInnerSpinButtonStyle |
| 53 | 3. Optionally, provide chooser dialog UI. |
| 54 | 3.1 Implement RenderTheme::supportsCalendarPicker so that it returns true for supported input types. |
| 55 | 3.2 Implement ChromeClient::openDateTimeChooser |
| 56 | Note that WebCore has calendar chooser implementation built with HTML. It supports date type, month type, week type, and year-month-day part of datetime-local type. It requires ENABLE_CALENDAR_PICKER and ENABLE_PAGE_POPUP. This implementation doesn't support time type and the time part of datetime-local type. |
| 57 | If we add their support in the future, ENABLE_CALENDAR_PICKER can be used for the chooser-only UI too. |
| 58 | |
| 59 | == input[type=datetime] == |
| 60 | |
| 61 | Do not enable it. You can not make an appropriate UI with the current WebCore code. |
| 62 | |
| 63 | == Datalist element == |
| 64 | |
| 65 | This depends on input types. |
| 66 | |
| 67 | === Text field types === |
| 68 | |
| 69 | 1. Enable ENABLE_DATALIST_ELEMENT |
| 70 | 2. Implement RenderTheme::supportsDataListUI so that it returns true for supported types. |
| 71 | 3. In WebKit layer, hook keyboard input, focus, or touch events for a target text field, and show UI to choose values of HTMLInputElement::dataList. |
| 72 | |
| 73 | === Range type === |
| 74 | |
| 75 | 1. Enable ENABLE_DATALIST_ELEMENT |
| 76 | 2. Implement RenderTheme::supportsDataListUI so that it returns true for range type. |
| 77 | 3. Implement/override RenderTheme::slideTickSnappingThreshold, sliderTickSize, sliderTickOffsetFromTrackCenter. |
| 78 | |
| 79 | === Color type === |
| 80 | |
| 81 | 1. Enable ENABLE_DATALIST_ELEMENT |
| 82 | 2. Implement RenderTheme::supportsDataListUI so that it returns true for color type. |
| 83 | 3. Your ColorChooser implementation should respect ColorChooserClient::shouldShowSuggestions and suggestions. |
| 84 | |
| 85 | === Date, datetime-local, month, time, week types === |
| 86 | |
| 87 | 1. Enable ENABLE_DATALIST_ELEMENT |
| 88 | 2. Implement RenderTheme::supportsDataListUI so that it returns true for supported types. |
| 89 | 3. Implement ChromeClient::openDateTimeChooser so that it handles DateTimeChooserParameters::suggestionValues. |
| 90 | |