OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
582 PassRefPtrWillBeRawPtr<DateTimeYearFieldElement> DateTimeYearFieldElement::creat e(Document& document, FieldOwner& fieldOwner, const DateTimeYearFieldElement::Pa rameters& parameters) | 582 PassRefPtrWillBeRawPtr<DateTimeYearFieldElement> DateTimeYearFieldElement::creat e(Document& document, FieldOwner& fieldOwner, const DateTimeYearFieldElement::Pa rameters& parameters) |
583 { | 583 { |
584 DEFINE_STATIC_LOCAL(AtomicString, yearPsuedoId, ("-webkit-datetime-edit-year -field", AtomicString::ConstructFromLiteral)); | 584 DEFINE_STATIC_LOCAL(AtomicString, yearPsuedoId, ("-webkit-datetime-edit-year -field", AtomicString::ConstructFromLiteral)); |
585 RefPtrWillBeRawPtr<DateTimeYearFieldElement> field = adoptRefWillBeNoop(new DateTimeYearFieldElement(document, fieldOwner, parameters)); | 585 RefPtrWillBeRawPtr<DateTimeYearFieldElement> field = adoptRefWillBeNoop(new DateTimeYearFieldElement(document, fieldOwner, parameters)); |
586 field->initialize(yearPsuedoId, queryString(WebLocalizedString::AXYearFieldT ext)); | 586 field->initialize(yearPsuedoId, queryString(WebLocalizedString::AXYearFieldT ext)); |
587 return field.release(); | 587 return field.release(); |
588 } | 588 } |
589 | 589 |
590 static int currentFullYear() | 590 static int currentFullYear() |
591 { | 591 { |
592 double current = currentTimeMS(); | 592 double current = convertToLocalTime(currentTimeMS()); |
593 double utcOffset = calculateUTCOffset(); | |
594 double dstOffset = calculateDSTOffset(current, utcOffset); | |
595 int offset = static_cast<int>((utcOffset + dstOffset) / msPerMinute); | |
596 current += offset * msPerMinute; | |
597 | |
598 DateComponents date; | 593 DateComponents date; |
599 date.setMillisecondsSinceEpochForMonth(current); | 594 date.setMillisecondsSinceEpochForMonth(current); |
tkent
2014/07/28 00:40:26
nit:
date.setMillisecondsSinceEpochForMonth(conve
kangil_
2014/07/31 00:45:45
Done.
| |
600 return date.fullYear(); | 595 return date.fullYear(); |
601 } | 596 } |
602 | 597 |
603 int DateTimeYearFieldElement::defaultValueForStepDown() const | 598 int DateTimeYearFieldElement::defaultValueForStepDown() const |
604 { | 599 { |
605 return m_maxIsSpecified ? DateTimeNumericFieldElement::defaultValueForStepDo wn() : currentFullYear(); | 600 return m_maxIsSpecified ? DateTimeNumericFieldElement::defaultValueForStepDo wn() : currentFullYear(); |
606 } | 601 } |
607 | 602 |
608 int DateTimeYearFieldElement::defaultValueForStepUp() const | 603 int DateTimeYearFieldElement::defaultValueForStepUp() const |
609 { | 604 { |
(...skipping 22 matching lines...) Expand all Loading... | |
632 setValueAsInteger(value); | 627 setValueAsInteger(value); |
633 return; | 628 return; |
634 } | 629 } |
635 | 630 |
636 setEmptyValue(); | 631 setEmptyValue(); |
637 } | 632 } |
638 | 633 |
639 } // namespace blink | 634 } // namespace blink |
640 | 635 |
641 #endif | 636 #endif |
OLD | NEW |