| 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 if (focusedFieldIndex() != invalidFieldIndex) | 566 if (focusedFieldIndex() != invalidFieldIndex) |
| 567 return; | 567 return; |
| 568 focusOnNextFocusableField(0); | 568 focusOnNextFocusableField(0); |
| 569 } | 569 } |
| 570 | 570 |
| 571 void DateTimeEditElement::focusByOwner(Element* oldFocusedElement) | 571 void DateTimeEditElement::focusByOwner(Element* oldFocusedElement) |
| 572 { | 572 { |
| 573 if (oldFocusedElement && oldFocusedElement->isDateTimeFieldElement()) { | 573 if (oldFocusedElement && oldFocusedElement->isDateTimeFieldElement()) { |
| 574 DateTimeFieldElement* oldFocusedField = static_cast<DateTimeFieldElement
*>(oldFocusedElement); | 574 DateTimeFieldElement* oldFocusedField = static_cast<DateTimeFieldElement
*>(oldFocusedElement); |
| 575 size_t index = fieldIndexOf(*oldFocusedField); | 575 size_t index = fieldIndexOf(*oldFocusedField); |
| 576 document().updateLayoutTreeIgnorePendingStylesheets(); |
| 576 if (index != invalidFieldIndex && oldFocusedField->isFocusable()) { | 577 if (index != invalidFieldIndex && oldFocusedField->isFocusable()) { |
| 577 oldFocusedField->focus(); | 578 oldFocusedField->focus(); |
| 578 return; | 579 return; |
| 579 } | 580 } |
| 580 } | 581 } |
| 581 focusOnNextFocusableField(0); | 582 focusOnNextFocusableField(0); |
| 582 } | 583 } |
| 583 | 584 |
| 584 DateTimeFieldElement* DateTimeEditElement::focusedField() const | 585 DateTimeFieldElement* DateTimeEditElement::focusedField() const |
| 585 { | 586 { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 597 } | 598 } |
| 598 | 599 |
| 599 void DateTimeEditElement::fieldValueChanged() | 600 void DateTimeEditElement::fieldValueChanged() |
| 600 { | 601 { |
| 601 if (m_editControlOwner) | 602 if (m_editControlOwner) |
| 602 m_editControlOwner->editControlValueChanged(); | 603 m_editControlOwner->editControlValueChanged(); |
| 603 } | 604 } |
| 604 | 605 |
| 605 bool DateTimeEditElement::focusOnNextFocusableField(size_t startIndex) | 606 bool DateTimeEditElement::focusOnNextFocusableField(size_t startIndex) |
| 606 { | 607 { |
| 608 document().updateLayoutTreeIgnorePendingStylesheets(); |
| 607 for (size_t fieldIndex = startIndex; fieldIndex < m_fields.size(); ++fieldIn
dex) { | 609 for (size_t fieldIndex = startIndex; fieldIndex < m_fields.size(); ++fieldIn
dex) { |
| 608 if (m_fields[fieldIndex]->isFocusable()) { | 610 if (m_fields[fieldIndex]->isFocusable()) { |
| 609 m_fields[fieldIndex]->focus(); | 611 m_fields[fieldIndex]->focus(); |
| 610 return true; | 612 return true; |
| 611 } | 613 } |
| 612 } | 614 } |
| 613 return false; | 615 return false; |
| 614 } | 616 } |
| 615 | 617 |
| 616 bool DateTimeEditElement::focusOnNextField(const DateTimeFieldElement& field) | 618 bool DateTimeEditElement::focusOnNextField(const DateTimeFieldElement& field) |
| 617 { | 619 { |
| 618 const size_t startFieldIndex = fieldIndexOf(field); | 620 const size_t startFieldIndex = fieldIndexOf(field); |
| 619 if (startFieldIndex == invalidFieldIndex) | 621 if (startFieldIndex == invalidFieldIndex) |
| 620 return false; | 622 return false; |
| 621 return focusOnNextFocusableField(startFieldIndex + 1); | 623 return focusOnNextFocusableField(startFieldIndex + 1); |
| 622 } | 624 } |
| 623 | 625 |
| 624 bool DateTimeEditElement::focusOnPreviousField(const DateTimeFieldElement& field
) | 626 bool DateTimeEditElement::focusOnPreviousField(const DateTimeFieldElement& field
) |
| 625 { | 627 { |
| 626 const size_t startFieldIndex = fieldIndexOf(field); | 628 const size_t startFieldIndex = fieldIndexOf(field); |
| 627 if (startFieldIndex == invalidFieldIndex) | 629 if (startFieldIndex == invalidFieldIndex) |
| 628 return false; | 630 return false; |
| 631 document().updateLayoutTreeIgnorePendingStylesheets(); |
| 629 size_t fieldIndex = startFieldIndex; | 632 size_t fieldIndex = startFieldIndex; |
| 630 while (fieldIndex > 0) { | 633 while (fieldIndex > 0) { |
| 631 --fieldIndex; | 634 --fieldIndex; |
| 632 if (m_fields[fieldIndex]->isFocusable()) { | 635 if (m_fields[fieldIndex]->isFocusable()) { |
| 633 m_fields[fieldIndex]->focus(); | 636 m_fields[fieldIndex]->focus(); |
| 634 return true; | 637 return true; |
| 635 } | 638 } |
| 636 } | 639 } |
| 637 return false; | 640 return false; |
| 638 } | 641 } |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 { | 814 { |
| 812 DateTimeFieldsState dateTimeFieldsState; | 815 DateTimeFieldsState dateTimeFieldsState; |
| 813 for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) | 816 for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) |
| 814 m_fields[fieldIndex]->populateDateTimeFieldsState(dateTimeFieldsState); | 817 m_fields[fieldIndex]->populateDateTimeFieldsState(dateTimeFieldsState); |
| 815 return dateTimeFieldsState; | 818 return dateTimeFieldsState; |
| 816 } | 819 } |
| 817 | 820 |
| 818 } // namespace blink | 821 } // namespace blink |
| 819 | 822 |
| 820 #endif | 823 #endif |
| OLD | NEW |