Implement localizeValue for TimeInputType
https://bugs.webkit.org/show_bug.cgi?id=98237

Reviewed by Kent Tamura.

Source/WebCore:

We want to localize time values for the suggestion picker.
DateTimeStringBuilder parses a format and creates a formatted string.

Added chromium unit test LocaleMacTest.formatTime

* html/BaseMultipleFieldsDateAndTimeInputType.cpp:
(WebCore::BaseMultipleFieldsDateAndTimeInputType::shouldHaveSecondField): Moved from LayoutParameters because we want to use it inside localizeValue.
(WebCore):
* html/BaseMultipleFieldsDateAndTimeInputType.h:
(BaseMultipleFieldsDateAndTimeInputType):
* html/DateTimeInputType.cpp:
(WebCore::DateTimeInputType::setupLayoutParameters):
* html/DateTimeLocalInputType.cpp:
(WebCore::DateTimeLocalInputType::setupLayoutParameters):
* html/TimeInputType.cpp:
(WebCore::TimeInputType::localizeValue):
(WebCore):
(WebCore::TimeInputType::setupLayoutParameters):
* html/TimeInputType.h:
(TimeInputType):
* html/shadow/DateTimeEditElement.cpp:
(WebCore):
* html/shadow/DateTimeEditElement.h:
(WebCore::DateTimeEditElement::LayoutParameters::LayoutParameters):
* platform/text/LocaleICU.cpp:
(WebCore::LocaleICU::formatDateTime): Calls Localizer::formatDateTime if the date component is not a date.
* platform/text/LocaleICU.h:
(LocaleICU):
* platform/text/LocaleWin.cpp:
(WebCore::LocaleWin::formatDateTime): Calls Localizer::formatDateTime if the date component is not a date.
* platform/text/LocaleWin.h:
(LocaleWin):
* platform/text/LocaleNone.cpp:
(LocaleNone):
(WebCore::LocaleNone::formatDateTime):
* platform/text/Localizer.cpp:
(DateTimeStringBuilder):
(WebCore):
(WebCore::DateTimeStringBuilder::DateTimeStringBuilder): Takes a
Localizer pointer. This is used inside the Localizer so the Localizer
will out live the DateTimeStringBuilder.
(WebCore::DateTimeStringBuilder::build): Builds a localized string for the given format.
(WebCore::DateTimeStringBuilder::zeroPadString):
(WebCore::DateTimeStringBuilder::appendNumber): Appends a number with left zero padding to match width.
(WebCore::DateTimeStringBuilder::visitField):
(WebCore::DateTimeStringBuilder::visitLiteral):
(WebCore::DateTimeStringBuilder::toString): Returns the localized string.
(WebCore::Localizer::formatDateTime):
* platform/text/Localizer.h:
* platform/text/mac/LocaleMac.h:
(LocaleMac):
* platform/text/mac/LocaleMac.mm:
(WebCore::LocaleMac::formatDateTime): Calls Localizer::formatDateTime if the date component is not a date.

Source/WebKit/chromium:

* tests/LocaleMacTest.cpp:
(LocaleMacTest::timeComponents):
(LocaleMacTest):
(LocaleMacTest::formatTime): Tests formatDateTime() for time.
(TEST_F):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130357 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed. Fix parse error in vcproj file.

* WebCore.vcproj/WebCore.vcproj:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130358 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Removed the assumption that "final" objects have a fixed number of inline slots
https://bugs.webkit.org/show_bug.cgi?id=98332

Reviewed by Filip Pizlo.

This is a step toward object size inference.

I replaced the inline storage capacity constant with a data member per
structure, set the the maximum supported value for the constant to 100,
then fixed what broke. (Note that even though this patch increases the
theoretical maximum inline capacity, it doesn't change any actual inline
capacity.)

* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
* jit/JITPropertyAccess.cpp:
(JSC::JIT::compileGetDirectOffset): These functions just get a rename:
the constant they need is the first out of line offset along the offset
number line, which is not necessarily the same thing (and is, in this
patch, never the same thing) as the inline capacity of any given object.

(JSC::JIT::emit_op_get_by_pname):
* jit/JITPropertyAccess32_64.cpp: This function changes functionality,
since it needs to convert from the abstract offset number line to an
actual offset in memory, and it can't assume that inline and out-of-line
offsets are contiguous on the number line.

(JSC::JIT::compileGetDirectOffset): Updated for rename.

(JSC::JIT::emit_op_get_by_pname): Same as emit_op_get_by_pname above.

* llint/LowLevelInterpreter.asm: Updated to mirror changes in PropertyOffset.h,
since we duplicate values from there.

* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm: Just like the JIT, most things are just
renames, and get_by_pname changes to do more math. I also standardized
offset calculations to use a hard-coded "-2", to match the JIT. This
isn't really better, but it makes global search and replace easier,
should we choose to refactor this code not to hard-code constants.

I also renamed loadPropertyAtVariableOffsetKnownNotFinal to
loadPropertyAtVariableOffsetKnownNotInline in order to sever the assumption
that inline capacity is tied to object type, and I changed the 64bit LLInt
to use this -- not using this previously seems to have been an oversight.

* runtime/JSObject.cpp:
(JSC::JSObject::visitChildren):
(JSC::JSFinalObject::visitChildren):
* runtime/JSObject.h:
(JSC::JSObject::offsetForLocation):
(JSNonFinalObject):
(JSC::JSFinalObject::createStructure):
(JSFinalObject):
(JSC::JSFinalObject::finishCreation): Updated for above changes.

* runtime/JSPropertyNameIterator.h:
(JSPropertyNameIterator):
(JSC::JSPropertyNameIterator::finishCreation): Store the inline capacity
of our object, since it's not a constant.

(JSC::JSPropertyNameIterator::getOffset): Removed. This function was
wrong. Luckily, it was also unused, since the C++ interpreter is gone.

* runtime/PropertyMapHashTable.h:
(PropertyTable): Use a helper function instead of hard-coding assumptions
about object types.

(JSC::PropertyTable::nextOffset):
* runtime/PropertyOffset.h:
(JSC):
(JSC::checkOffset):
(JSC::validateOffset):
(JSC::isInlineOffset):
(JSC::numberOfSlotsForLastOffset):
(JSC::propertyOffsetFor): Refactored these functions to take inline capacity
as an argument, since it's not fixed at compile time anymore.

* runtime/Structure.cpp:
(JSC::Structure::Structure):
(JSC::Structure::flattenDictionaryStructure):
(JSC::Structure::putSpecificValue):
* runtime/Structure.h:
(Structure):
(JSC::Structure::outOfLineCapacity):
(JSC::Structure::hasInlineStorage):
(JSC::Structure::inlineCapacity):
(JSC::Structure::inlineSize):
(JSC::Structure::firstValidOffset):
(JSC::Structure::lastValidOffset):
(JSC::Structure::create): Removed some hard-coded assumptions about inline
capacity and object type, and replaced with more liberal use of helper functions.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130359 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-10-03  Geoffrey Garen  <ggaren@apple.com>

        First step toward fixing Windows: remove old symbol.

        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130360 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-10-03  Geoffrey Garen  <ggaren@apple.com>

        Next step toward fixing Windows: add new symbol.

        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130361 268f45cc-cd09-0410-ab3c-d52691b4dbfc
DateTimeYearFieldElement should respect min/max values specified by page authors
https://bugs.webkit.org/show_bug.cgi?id=98227

Reviewed by Hajime Morita.

Source/WebCore:

Before this patch, we always set 1 to the minimum limit and 275760 to
the maximum limit for a year field, and a user can specify any year
regardless of min/max attributes. Such wide range is unnecessary for
normal applications and we should provide a way to limit the range.

Test: fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events.html

* html/shadow/DateTimeFieldElements.h:
To add four constructor arguments, introduce Parameters struct.
Actually, we add the followings;
 - minimum year in UI
 - maximum year in UI
 - min attribute is specified
 - max attribute is specified
(Parameters):
(WebCore::DateTimeYearFieldElement::Parameters::Parameters):
(DateTimeYearFieldElement):
* html/shadow/DateTimeFieldElements.cpp:
(WebCore::DateTimeYearFieldElement::DateTimeYearFieldElement): ditto.
(WebCore::DateTimeYearFieldElement::create): ditto.
(WebCore::DateTimeYearFieldElement::clampValueForHardLimits):
Override DateTimeNumericFieldElement::clampValueForHardLimits.
By this, we allow to set out-of-range year values.
(WebCore::currentFullYear): A helper to get the current year.
(WebCore::DateTimeYearFieldElement::defaultValueForStepDown):
If the field has no value and step down operation occurs,
 - the field has the current year if the max attribute is not specified.
 - the field has the maximum value otherwise.
(WebCore::DateTimeYearFieldElement::defaultValueForStepUp): Similar change.

* html/shadow/DateTimeNumericFieldElement.h:
(DateTimeNumericFieldElement): Declare clampValueForHardLimits.
* html/shadow/DateTimeNumericFieldElement.cpp:
(WebCore::DateTimeNumericFieldElement::clampValueForHardLimits):
(WebCore::DateTimeNumericFieldElement::setValueAsInteger):
Call clampValueForHardLimits instead of clampValue in order to
distinguish limits for UI and limits for internal value update.

* html/shadow/DateTimeEditElement.h:
(LayoutParameters): Add minimumYear and maximumYear members.
(WebCore::DateTimeEditElement::LayoutParameters::LayoutParameters):
Initialize minimumYear and maximumYear.
(WebCore::DateTimeEditElement::LayoutParameters::undefinedYear):
Represents 'undefined' value for minimumYear and maximumYear.
* html/shadow/DateTimeEditElement.cpp:
(WebCore::DateTimeEditBuilder::visitField):
Preparas DateTimeYearField::Parameters and pass it to the DateTimeYearField factory.

* html/BaseMultipleFieldsDateAndTimeInputType.cpp:
(WebCore::BaseMultipleFieldsDateAndTimeInputType::fullYear):
A helper to get a year value from an attribute value string.
* html/BaseMultipleFieldsDateAndTimeInputType.h:
(BaseMultipleFieldsDateAndTimeInputType): Add fullYear().

* html/DateTimeInputType.cpp:
(WebCore::DateTimeInputType::setupLayoutParameters):
Set LayoutParameters::minimumYear and maximumYear.
* html/DateTimeLocalInputType.cpp:
(WebCore::DateTimeLocalInputType::setupLayoutParameters): ditto.
* html/MonthInputType.cpp:
(WebCore::MonthInputType::setupLayoutParameters): ditto.
* html/WeekInputType.cpp:
(WebCore::WeekInputType::setupLayoutParameters): ditto.

LayoutTests:

* fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events-expected.txt: Added.
* fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130362 268f45cc-cd09-0410-ab3c-d52691b4dbfc