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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 if (focusedFieldIndex() != invalidFieldIndex) | 560 if (focusedFieldIndex() != invalidFieldIndex) |
561 return; | 561 return; |
562 focusOnNextFocusableField(0); | 562 focusOnNextFocusableField(0); |
563 } | 563 } |
564 | 564 |
565 void DateTimeEditElement::focusByOwner(Element* oldFocusedElement) | 565 void DateTimeEditElement::focusByOwner(Element* oldFocusedElement) |
566 { | 566 { |
567 if (oldFocusedElement && oldFocusedElement->isDateTimeFieldElement()) { | 567 if (oldFocusedElement && oldFocusedElement->isDateTimeFieldElement()) { |
568 DateTimeFieldElement* oldFocusedField = static_cast<DateTimeFieldElement
*>(oldFocusedElement); | 568 DateTimeFieldElement* oldFocusedField = static_cast<DateTimeFieldElement
*>(oldFocusedElement); |
569 size_t index = fieldIndexOf(*oldFocusedField); | 569 size_t index = fieldIndexOf(*oldFocusedField); |
570 document().updateLayoutTreeForNode(oldFocusedField); | 570 document().updateStyleAndLayoutTreeForNode(oldFocusedField); |
571 if (index != invalidFieldIndex && oldFocusedField->isFocusable()) { | 571 if (index != invalidFieldIndex && oldFocusedField->isFocusable()) { |
572 oldFocusedField->focus(); | 572 oldFocusedField->focus(); |
573 return; | 573 return; |
574 } | 574 } |
575 } | 575 } |
576 focusOnNextFocusableField(0); | 576 focusOnNextFocusableField(0); |
577 } | 577 } |
578 | 578 |
579 DateTimeFieldElement* DateTimeEditElement::focusedField() const | 579 DateTimeFieldElement* DateTimeEditElement::focusedField() const |
580 { | 580 { |
(...skipping 11 matching lines...) Expand all Loading... |
592 } | 592 } |
593 | 593 |
594 void DateTimeEditElement::fieldValueChanged() | 594 void DateTimeEditElement::fieldValueChanged() |
595 { | 595 { |
596 if (m_editControlOwner) | 596 if (m_editControlOwner) |
597 m_editControlOwner->editControlValueChanged(); | 597 m_editControlOwner->editControlValueChanged(); |
598 } | 598 } |
599 | 599 |
600 bool DateTimeEditElement::focusOnNextFocusableField(size_t startIndex) | 600 bool DateTimeEditElement::focusOnNextFocusableField(size_t startIndex) |
601 { | 601 { |
602 document().updateLayoutTreeIgnorePendingStylesheets(); | 602 document().updateStyleAndLayoutTreeIgnorePendingStylesheets(); |
603 for (size_t fieldIndex = startIndex; fieldIndex < m_fields.size(); ++fieldIn
dex) { | 603 for (size_t fieldIndex = startIndex; fieldIndex < m_fields.size(); ++fieldIn
dex) { |
604 if (m_fields[fieldIndex]->isFocusable()) { | 604 if (m_fields[fieldIndex]->isFocusable()) { |
605 m_fields[fieldIndex]->focus(); | 605 m_fields[fieldIndex]->focus(); |
606 return true; | 606 return true; |
607 } | 607 } |
608 } | 608 } |
609 return false; | 609 return false; |
610 } | 610 } |
611 | 611 |
612 bool DateTimeEditElement::focusOnNextField(const DateTimeFieldElement& field) | 612 bool DateTimeEditElement::focusOnNextField(const DateTimeFieldElement& field) |
613 { | 613 { |
614 const size_t startFieldIndex = fieldIndexOf(field); | 614 const size_t startFieldIndex = fieldIndexOf(field); |
615 if (startFieldIndex == invalidFieldIndex) | 615 if (startFieldIndex == invalidFieldIndex) |
616 return false; | 616 return false; |
617 return focusOnNextFocusableField(startFieldIndex + 1); | 617 return focusOnNextFocusableField(startFieldIndex + 1); |
618 } | 618 } |
619 | 619 |
620 bool DateTimeEditElement::focusOnPreviousField(const DateTimeFieldElement& field
) | 620 bool DateTimeEditElement::focusOnPreviousField(const DateTimeFieldElement& field
) |
621 { | 621 { |
622 const size_t startFieldIndex = fieldIndexOf(field); | 622 const size_t startFieldIndex = fieldIndexOf(field); |
623 if (startFieldIndex == invalidFieldIndex) | 623 if (startFieldIndex == invalidFieldIndex) |
624 return false; | 624 return false; |
625 document().updateLayoutTreeIgnorePendingStylesheets(); | 625 document().updateStyleAndLayoutTreeIgnorePendingStylesheets(); |
626 size_t fieldIndex = startFieldIndex; | 626 size_t fieldIndex = startFieldIndex; |
627 while (fieldIndex > 0) { | 627 while (fieldIndex > 0) { |
628 --fieldIndex; | 628 --fieldIndex; |
629 if (m_fields[fieldIndex]->isFocusable()) { | 629 if (m_fields[fieldIndex]->isFocusable()) { |
630 m_fields[fieldIndex]->focus(); | 630 m_fields[fieldIndex]->focus(); |
631 return true; | 631 return true; |
632 } | 632 } |
633 } | 633 } |
634 return false; | 634 return false; |
635 } | 635 } |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 | 806 |
807 DateTimeFieldsState DateTimeEditElement::valueAsDateTimeFieldsState() const | 807 DateTimeFieldsState DateTimeEditElement::valueAsDateTimeFieldsState() const |
808 { | 808 { |
809 DateTimeFieldsState dateTimeFieldsState; | 809 DateTimeFieldsState dateTimeFieldsState; |
810 for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) | 810 for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) |
811 m_fields[fieldIndex]->populateDateTimeFieldsState(dateTimeFieldsState); | 811 m_fields[fieldIndex]->populateDateTimeFieldsState(dateTimeFieldsState); |
812 return dateTimeFieldsState; | 812 return dateTimeFieldsState; |
813 } | 813 } |
814 | 814 |
815 } // namespace blink | 815 } // namespace blink |
OLD | NEW |