Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. |
| 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
| 8 * Copyright (C) 2010 Google Inc. All rights reserved. | 8 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
| 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. | 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 652 m_autocomplete = Uninitialized; | 652 m_autocomplete = Uninitialized; |
| 653 else | 653 else |
| 654 m_autocomplete = On; | 654 m_autocomplete = On; |
| 655 } | 655 } |
| 656 } else if (name == typeAttr) | 656 } else if (name == typeAttr) |
| 657 updateType(); | 657 updateType(); |
| 658 else if (name == valueAttr) { | 658 else if (name == valueAttr) { |
| 659 // We only need to setChanged if the form is looking at the default valu e right now. | 659 // We only need to setChanged if the form is looking at the default valu e right now. |
| 660 if (!hasDirtyValue()) { | 660 if (!hasDirtyValue()) { |
| 661 updatePlaceholderVisibility(false); | 661 updatePlaceholderVisibility(false); |
| 662 setNeedsStyleRecalc(SubtreeStyleChange); | 662 setNeedsStyleRecalc(StyleChangeReasonForTracing::ControlValue, Subtr eeStyleChange); |
|
esprehn
2014/09/19 04:53:10
ditto for all of these.
kouhei (in TOK)
2014/09/22 09:03:54
Done.
| |
| 663 } | 663 } |
| 664 m_needsToUpdateViewValue = true; | 664 m_needsToUpdateViewValue = true; |
| 665 setNeedsValidityCheck(); | 665 setNeedsValidityCheck(); |
| 666 m_valueAttributeWasUpdatedAfterParsing = !m_parsingInProgress; | 666 m_valueAttributeWasUpdatedAfterParsing = !m_parsingInProgress; |
| 667 m_inputType->warnIfValueIsInvalidAndElementIsVisible(value); | 667 m_inputType->warnIfValueIsInvalidAndElementIsVisible(value); |
| 668 m_inputTypeView->valueAttributeChanged(); | 668 m_inputTypeView->valueAttributeChanged(); |
| 669 } else if (name == checkedAttr) { | 669 } else if (name == checkedAttr) { |
| 670 // Another radio button in the same group might be checked by state | 670 // Another radio button in the same group might be checked by state |
| 671 // restore. We shouldn't call setChecked() even if this has the checked | 671 // restore. We shouldn't call setChecked() even if this has the checked |
| 672 // attribute. So, delay the setChecked() call until | 672 // attribute. So, delay the setChecked() call until |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 692 } else if (name == onsearchAttr) { | 692 } else if (name == onsearchAttr) { |
| 693 // Search field and slider attributes all just cause updateFromElement t o be called through style recalcing. | 693 // Search field and slider attributes all just cause updateFromElement t o be called through style recalcing. |
| 694 setAttributeEventListener(EventTypeNames::search, createAttributeEventLi stener(this, name, value, eventParameterName())); | 694 setAttributeEventListener(EventTypeNames::search, createAttributeEventLi stener(this, name, value, eventParameterName())); |
| 695 } else if (name == resultsAttr) { | 695 } else if (name == resultsAttr) { |
| 696 int oldResults = m_maxResults; | 696 int oldResults = m_maxResults; |
| 697 m_maxResults = !value.isNull() ? std::min(value.toInt(), maxSavedResults ) : -1; | 697 m_maxResults = !value.isNull() ? std::min(value.toInt(), maxSavedResults ) : -1; |
| 698 // FIXME: Detaching just for maxResults change is not ideal. We should figure out the right | 698 // FIXME: Detaching just for maxResults change is not ideal. We should figure out the right |
| 699 // time to relayout for this change. | 699 // time to relayout for this change. |
| 700 if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0) ) | 700 if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0) ) |
| 701 lazyReattachIfAttached(); | 701 lazyReattachIfAttached(); |
| 702 setNeedsStyleRecalc(SubtreeStyleChange); | 702 setNeedsStyleRecalc(StyleChangeReasonForTracing::Control, SubtreeStyleCh ange); |
| 703 UseCounter::count(document(), UseCounter::ResultsAttribute); | 703 UseCounter::count(document(), UseCounter::ResultsAttribute); |
| 704 } else if (name == incrementalAttr) { | 704 } else if (name == incrementalAttr) { |
| 705 setNeedsStyleRecalc(SubtreeStyleChange); | 705 setNeedsStyleRecalc(StyleChangeReasonForTracing::Control, SubtreeStyleCh ange); |
| 706 UseCounter::count(document(), UseCounter::IncrementalAttribute); | 706 UseCounter::count(document(), UseCounter::IncrementalAttribute); |
| 707 } else if (name == minAttr) { | 707 } else if (name == minAttr) { |
| 708 m_inputTypeView->minOrMaxAttributeChanged(); | 708 m_inputTypeView->minOrMaxAttributeChanged(); |
| 709 m_inputType->sanitizeValueInResponseToMinOrMaxAttributeChange(); | 709 m_inputType->sanitizeValueInResponseToMinOrMaxAttributeChange(); |
| 710 setNeedsValidityCheck(); | 710 setNeedsValidityCheck(); |
| 711 UseCounter::count(document(), UseCounter::MinAttribute); | 711 UseCounter::count(document(), UseCounter::MinAttribute); |
| 712 } else if (name == maxAttr) { | 712 } else if (name == maxAttr) { |
| 713 m_inputTypeView->minOrMaxAttributeChanged(); | 713 m_inputTypeView->minOrMaxAttributeChanged(); |
| 714 setNeedsValidityCheck(); | 714 setNeedsValidityCheck(); |
| 715 UseCounter::count(document(), UseCounter::MaxAttribute); | 715 UseCounter::count(document(), UseCounter::MaxAttribute); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 848 } | 848 } |
| 849 | 849 |
| 850 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB ehavior) | 850 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB ehavior) |
| 851 { | 851 { |
| 852 if (checked() == nowChecked) | 852 if (checked() == nowChecked) |
| 853 return; | 853 return; |
| 854 | 854 |
| 855 RefPtrWillBeRawPtr<HTMLInputElement> protector(this); | 855 RefPtrWillBeRawPtr<HTMLInputElement> protector(this); |
| 856 m_reflectsCheckedAttribute = false; | 856 m_reflectsCheckedAttribute = false; |
| 857 m_isChecked = nowChecked; | 857 m_isChecked = nowChecked; |
| 858 setNeedsStyleRecalc(SubtreeStyleChange); | 858 setNeedsStyleRecalc(StyleChangeReasonForTracing::Control, SubtreeStyleChange ); |
| 859 | 859 |
| 860 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) | 860 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) |
| 861 scope->updateCheckedState(this); | 861 scope->updateCheckedState(this); |
| 862 if (renderer() && renderer()->style()->hasAppearance()) | 862 if (renderer() && renderer()->style()->hasAppearance()) |
| 863 RenderTheme::theme().stateChanged(renderer(), CheckedControlState); | 863 RenderTheme::theme().stateChanged(renderer(), CheckedControlState); |
| 864 | 864 |
| 865 setNeedsValidityCheck(); | 865 setNeedsValidityCheck(); |
| 866 | 866 |
| 867 // Ideally we'd do this from the render tree (matching | 867 // Ideally we'd do this from the render tree (matching |
| 868 // RenderTextView), but it's not possible to do it at the moment | 868 // RenderTextView), but it's not possible to do it at the moment |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 962 { | 962 { |
| 963 return m_suggestedValue; | 963 return m_suggestedValue; |
| 964 } | 964 } |
| 965 | 965 |
| 966 void HTMLInputElement::setSuggestedValue(const String& value) | 966 void HTMLInputElement::setSuggestedValue(const String& value) |
| 967 { | 967 { |
| 968 if (!m_inputType->canSetSuggestedValue()) | 968 if (!m_inputType->canSetSuggestedValue()) |
| 969 return; | 969 return; |
| 970 m_needsToUpdateViewValue = true; | 970 m_needsToUpdateViewValue = true; |
| 971 m_suggestedValue = sanitizeValue(value); | 971 m_suggestedValue = sanitizeValue(value); |
| 972 setNeedsStyleRecalc(SubtreeStyleChange); | 972 setNeedsStyleRecalc(StyleChangeReasonForTracing::ControlValue, SubtreeStyleC hange); |
| 973 m_inputTypeView->updateView(); | 973 m_inputTypeView->updateView(); |
| 974 } | 974 } |
| 975 | 975 |
| 976 void HTMLInputElement::setEditingValue(const String& value) | 976 void HTMLInputElement::setEditingValue(const String& value) |
| 977 { | 977 { |
| 978 if (!renderer() || !isTextField()) | 978 if (!renderer() || !isTextField()) |
| 979 return; | 979 return; |
| 980 setInnerEditorValue(value); | 980 setInnerEditorValue(value); |
| 981 subtreeHasChanged(); | 981 subtreeHasChanged(); |
| 982 | 982 |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1677 { | 1677 { |
| 1678 int maxLength; | 1678 int maxLength; |
| 1679 if (!parseHTMLInteger(value, maxLength)) | 1679 if (!parseHTMLInteger(value, maxLength)) |
| 1680 maxLength = maximumLength; | 1680 maxLength = maximumLength; |
| 1681 if (maxLength < 0 || maxLength > maximumLength) | 1681 if (maxLength < 0 || maxLength > maximumLength) |
| 1682 maxLength = maximumLength; | 1682 maxLength = maximumLength; |
| 1683 int oldMaxLength = m_maxLength; | 1683 int oldMaxLength = m_maxLength; |
| 1684 m_maxLength = maxLength; | 1684 m_maxLength = maxLength; |
| 1685 if (oldMaxLength != maxLength) | 1685 if (oldMaxLength != maxLength) |
| 1686 updateValueIfNeeded(); | 1686 updateValueIfNeeded(); |
| 1687 setNeedsStyleRecalc(SubtreeStyleChange); | 1687 setNeedsStyleRecalc(StyleChangeReasonForTracing::Control, SubtreeStyleChange ); |
| 1688 setNeedsValidityCheck(); | 1688 setNeedsValidityCheck(); |
| 1689 } | 1689 } |
| 1690 | 1690 |
| 1691 void HTMLInputElement::updateValueIfNeeded() | 1691 void HTMLInputElement::updateValueIfNeeded() |
| 1692 { | 1692 { |
| 1693 String newValue = sanitizeValue(m_valueIfDirty); | 1693 String newValue = sanitizeValue(m_valueIfDirty); |
| 1694 ASSERT(!m_valueIfDirty.isNull() || newValue.isNull()); | 1694 ASSERT(!m_valueIfDirty.isNull() || newValue.isNull()); |
| 1695 if (newValue != m_valueIfDirty) | 1695 if (newValue != m_valueIfDirty) |
| 1696 setValue(newValue); | 1696 setValue(newValue); |
| 1697 } | 1697 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1893 { | 1893 { |
| 1894 listAttributeTargetChanged(); | 1894 listAttributeTargetChanged(); |
| 1895 } | 1895 } |
| 1896 | 1896 |
| 1897 AXObject* HTMLInputElement::popupRootAXObject() | 1897 AXObject* HTMLInputElement::popupRootAXObject() |
| 1898 { | 1898 { |
| 1899 return m_inputTypeView->popupRootAXObject(); | 1899 return m_inputTypeView->popupRootAXObject(); |
| 1900 } | 1900 } |
| 1901 | 1901 |
| 1902 } // namespace | 1902 } // namespace |
| OLD | NEW |