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(); | |
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; | 592 DateComponents date; |
599 date.setMillisecondsSinceEpochForMonth(current); | 593 date.setMillisecondsSinceEpochForMonth(convertToLocalTime(currentTimeMS())); |
600 return date.fullYear(); | 594 return date.fullYear(); |
601 } | 595 } |
602 | 596 |
603 int DateTimeYearFieldElement::defaultValueForStepDown() const | 597 int DateTimeYearFieldElement::defaultValueForStepDown() const |
604 { | 598 { |
605 return m_maxIsSpecified ? DateTimeNumericFieldElement::defaultValueForStepDo
wn() : currentFullYear(); | 599 return m_maxIsSpecified ? DateTimeNumericFieldElement::defaultValueForStepDo
wn() : currentFullYear(); |
606 } | 600 } |
607 | 601 |
608 int DateTimeYearFieldElement::defaultValueForStepUp() const | 602 int DateTimeYearFieldElement::defaultValueForStepUp() const |
609 { | 603 { |
(...skipping 22 matching lines...) Expand all Loading... |
632 setValueAsInteger(value); | 626 setValueAsInteger(value); |
633 return; | 627 return; |
634 } | 628 } |
635 | 629 |
636 setEmptyValue(); | 630 setEmptyValue(); |
637 } | 631 } |
638 | 632 |
639 } // namespace blink | 633 } // namespace blink |
640 | 634 |
641 #endif | 635 #endif |
OLD | NEW |