[Webkit-unassigned] [Bug 45730] API to support localized numbers for <input type=number>

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Oct 12 00:23:03 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=45730





--- Comment #12 from Kent Tamura <tkent at chromium.org>  2010-10-12 00:23:03 PST ---
Thank you for the comments.

(In reply to comment #9)
>  static bool isNumberCharacter(UChar ch)
>  {
> -    return ch == '+' || ch == '-' || ch == '.' || ch == 'e' || ch == 'E'
> -        || (ch >= '0' && ch <= '9');
> +    return isLocalizedNumberCharacter(ch) || ch == '+' || ch == '-' || ch == '.' || ch == 'e' || ch == 'E' || (ch >= '0' && ch <= '9');
>  }
> 
> This is confusing. Where does the definition come from? For example, a comment before isLocalizedNumberCharacter() says that it includes both period and comma for U.S. locale. But this only forces period. Why?

We try to parse a value in a localized number format, and try to parse it in the HTML5 format if the parsing in the localized number format fails.  I added a comment about this to HTMLInputElement::sanitizeValue() and ChangeLog.

> +++ b/WebCore/rendering/RenderTextControlSingleLine.cpp
> @@ -693,7 +693,7 @@ void RenderTextControlSingleLine::updateFromElement()
>                  shouldUpdateValue = static_cast<HTMLTextFormControlElement*>(node())->supportsPlaceholder() || !static_cast<HTMLInputElement*>(node())->formControlValueMatchesRenderer();
>              }
>              if (shouldUpdateValue)
> -                setInnerTextValue(inputElement()->value());
> +                setInnerTextValue(inputElement()->visibleValue());
>          }
> 
> What is this change expected to provide? It seems out of place in a bug that adds an API. ChangeLog comment doesn't explain the reason for this change.
> 
> The concept of "visibleValue" in general seems unclear. How is one supposed to perform DOM manipulation if rendered value is different from DOM value? 

ok, I added an explanation of visibleValue() to ChangeLog.
visibleValue() is a localized representation of a number, and value() (DOM manipulation) is the HTML5 number representation.

> E.g. what if JS code want to select part of the number in the input field?

We can't do it.  HTML5 doesn't provide selection API for type=number.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list