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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 m_autocomplete = Uninitialized; | 653 m_autocomplete = Uninitialized; |
654 else | 654 else |
655 m_autocomplete = On; | 655 m_autocomplete = On; |
656 } | 656 } |
657 } else if (name == typeAttr) | 657 } else if (name == typeAttr) |
658 updateType(); | 658 updateType(); |
659 else if (name == valueAttr) { | 659 else if (name == valueAttr) { |
660 // We only need to setChanged if the form is looking at the default valu
e right now. | 660 // We only need to setChanged if the form is looking at the default valu
e right now. |
661 if (!hasDirtyValue()) { | 661 if (!hasDirtyValue()) { |
662 updatePlaceholderVisibility(false); | 662 updatePlaceholderVisibility(false); |
663 setNeedsStyleRecalc(SubtreeStyleChange); | 663 setNeedsStyleRecalc(StyleRecalcDueToControlValue, SubtreeStyleChange
); |
664 } | 664 } |
665 m_needsToUpdateViewValue = true; | 665 m_needsToUpdateViewValue = true; |
666 setNeedsValidityCheck(); | 666 setNeedsValidityCheck(); |
667 m_valueAttributeWasUpdatedAfterParsing = !m_parsingInProgress; | 667 m_valueAttributeWasUpdatedAfterParsing = !m_parsingInProgress; |
668 m_inputType->warnIfValueIsInvalidAndElementIsVisible(value); | 668 m_inputType->warnIfValueIsInvalidAndElementIsVisible(value); |
669 m_inputTypeView->valueAttributeChanged(); | 669 m_inputTypeView->valueAttributeChanged(); |
670 } else if (name == checkedAttr) { | 670 } else if (name == checkedAttr) { |
671 // Another radio button in the same group might be checked by state | 671 // Another radio button in the same group might be checked by state |
672 // restore. We shouldn't call setChecked() even if this has the checked | 672 // restore. We shouldn't call setChecked() even if this has the checked |
673 // attribute. So, delay the setChecked() call until | 673 // attribute. So, delay the setChecked() call until |
(...skipping 19 matching lines...) Expand all Loading... |
693 } else if (name == onsearchAttr) { | 693 } else if (name == onsearchAttr) { |
694 // Search field and slider attributes all just cause updateFromElement t
o be called through style recalcing. | 694 // Search field and slider attributes all just cause updateFromElement t
o be called through style recalcing. |
695 setAttributeEventListener(EventTypeNames::search, createAttributeEventLi
stener(this, name, value, eventParameterName())); | 695 setAttributeEventListener(EventTypeNames::search, createAttributeEventLi
stener(this, name, value, eventParameterName())); |
696 } else if (name == resultsAttr) { | 696 } else if (name == resultsAttr) { |
697 int oldResults = m_maxResults; | 697 int oldResults = m_maxResults; |
698 m_maxResults = !value.isNull() ? std::min(value.toInt(), maxSavedResults
) : -1; | 698 m_maxResults = !value.isNull() ? std::min(value.toInt(), maxSavedResults
) : -1; |
699 // FIXME: Detaching just for maxResults change is not ideal. We should
figure out the right | 699 // FIXME: Detaching just for maxResults change is not ideal. We should
figure out the right |
700 // time to relayout for this change. | 700 // time to relayout for this change. |
701 if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0)
) | 701 if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0)
) |
702 lazyReattachIfAttached(); | 702 lazyReattachIfAttached(); |
703 setNeedsStyleRecalc(SubtreeStyleChange); | 703 setNeedsStyleRecalc(StyleRecalcDueToControl, SubtreeStyleChange); |
704 UseCounter::count(document(), UseCounter::ResultsAttribute); | 704 UseCounter::count(document(), UseCounter::ResultsAttribute); |
705 } else if (name == incrementalAttr) { | 705 } else if (name == incrementalAttr) { |
706 setNeedsStyleRecalc(SubtreeStyleChange); | 706 setNeedsStyleRecalc(StyleRecalcDueToControl, SubtreeStyleChange); |
707 UseCounter::count(document(), UseCounter::IncrementalAttribute); | 707 UseCounter::count(document(), UseCounter::IncrementalAttribute); |
708 } else if (name == minAttr) { | 708 } else if (name == minAttr) { |
709 m_inputTypeView->minOrMaxAttributeChanged(); | 709 m_inputTypeView->minOrMaxAttributeChanged(); |
710 m_inputType->sanitizeValueInResponseToMinOrMaxAttributeChange(); | 710 m_inputType->sanitizeValueInResponseToMinOrMaxAttributeChange(); |
711 setNeedsValidityCheck(); | 711 setNeedsValidityCheck(); |
712 UseCounter::count(document(), UseCounter::MinAttribute); | 712 UseCounter::count(document(), UseCounter::MinAttribute); |
713 } else if (name == maxAttr) { | 713 } else if (name == maxAttr) { |
714 m_inputTypeView->minOrMaxAttributeChanged(); | 714 m_inputTypeView->minOrMaxAttributeChanged(); |
715 setNeedsValidityCheck(); | 715 setNeedsValidityCheck(); |
716 UseCounter::count(document(), UseCounter::MaxAttribute); | 716 UseCounter::count(document(), UseCounter::MaxAttribute); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 } | 849 } |
850 | 850 |
851 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB
ehavior) | 851 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB
ehavior) |
852 { | 852 { |
853 if (checked() == nowChecked) | 853 if (checked() == nowChecked) |
854 return; | 854 return; |
855 | 855 |
856 RefPtrWillBeRawPtr<HTMLInputElement> protector(this); | 856 RefPtrWillBeRawPtr<HTMLInputElement> protector(this); |
857 m_reflectsCheckedAttribute = false; | 857 m_reflectsCheckedAttribute = false; |
858 m_isChecked = nowChecked; | 858 m_isChecked = nowChecked; |
859 setNeedsStyleRecalc(SubtreeStyleChange); | 859 setNeedsStyleRecalc(StyleRecalcDueToControl, SubtreeStyleChange); |
860 | 860 |
861 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) | 861 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) |
862 scope->updateCheckedState(this); | 862 scope->updateCheckedState(this); |
863 if (renderer() && renderer()->style()->hasAppearance()) | 863 if (renderer() && renderer()->style()->hasAppearance()) |
864 RenderTheme::theme().stateChanged(renderer(), CheckedControlState); | 864 RenderTheme::theme().stateChanged(renderer(), CheckedControlState); |
865 | 865 |
866 setNeedsValidityCheck(); | 866 setNeedsValidityCheck(); |
867 | 867 |
868 // Ideally we'd do this from the render tree (matching | 868 // Ideally we'd do this from the render tree (matching |
869 // RenderTextView), but it's not possible to do it at the moment | 869 // 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... |
963 { | 963 { |
964 return m_suggestedValue; | 964 return m_suggestedValue; |
965 } | 965 } |
966 | 966 |
967 void HTMLInputElement::setSuggestedValue(const String& value) | 967 void HTMLInputElement::setSuggestedValue(const String& value) |
968 { | 968 { |
969 if (!m_inputType->canSetSuggestedValue()) | 969 if (!m_inputType->canSetSuggestedValue()) |
970 return; | 970 return; |
971 m_needsToUpdateViewValue = true; | 971 m_needsToUpdateViewValue = true; |
972 m_suggestedValue = sanitizeValue(value); | 972 m_suggestedValue = sanitizeValue(value); |
973 setNeedsStyleRecalc(SubtreeStyleChange); | 973 setNeedsStyleRecalc(StyleRecalcDueToControlValue, SubtreeStyleChange); |
974 m_inputTypeView->updateView(); | 974 m_inputTypeView->updateView(); |
975 } | 975 } |
976 | 976 |
977 void HTMLInputElement::setEditingValue(const String& value) | 977 void HTMLInputElement::setEditingValue(const String& value) |
978 { | 978 { |
979 if (!renderer() || !isTextField()) | 979 if (!renderer() || !isTextField()) |
980 return; | 980 return; |
981 setInnerEditorValue(value); | 981 setInnerEditorValue(value); |
982 subtreeHasChanged(); | 982 subtreeHasChanged(); |
983 | 983 |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 { | 1678 { |
1679 int maxLength; | 1679 int maxLength; |
1680 if (!parseHTMLInteger(value, maxLength)) | 1680 if (!parseHTMLInteger(value, maxLength)) |
1681 maxLength = maximumLength; | 1681 maxLength = maximumLength; |
1682 if (maxLength < 0 || maxLength > maximumLength) | 1682 if (maxLength < 0 || maxLength > maximumLength) |
1683 maxLength = maximumLength; | 1683 maxLength = maximumLength; |
1684 int oldMaxLength = m_maxLength; | 1684 int oldMaxLength = m_maxLength; |
1685 m_maxLength = maxLength; | 1685 m_maxLength = maxLength; |
1686 if (oldMaxLength != maxLength) | 1686 if (oldMaxLength != maxLength) |
1687 updateValueIfNeeded(); | 1687 updateValueIfNeeded(); |
1688 setNeedsStyleRecalc(SubtreeStyleChange); | 1688 setNeedsStyleRecalc(StyleRecalcDueToControl, SubtreeStyleChange); |
1689 setNeedsValidityCheck(); | 1689 setNeedsValidityCheck(); |
1690 } | 1690 } |
1691 | 1691 |
1692 void HTMLInputElement::updateValueIfNeeded() | 1692 void HTMLInputElement::updateValueIfNeeded() |
1693 { | 1693 { |
1694 String newValue = sanitizeValue(m_valueIfDirty); | 1694 String newValue = sanitizeValue(m_valueIfDirty); |
1695 ASSERT(!m_valueIfDirty.isNull() || newValue.isNull()); | 1695 ASSERT(!m_valueIfDirty.isNull() || newValue.isNull()); |
1696 if (newValue != m_valueIfDirty) | 1696 if (newValue != m_valueIfDirty) |
1697 setValue(newValue); | 1697 setValue(newValue); |
1698 } | 1698 } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1894 { | 1894 { |
1895 listAttributeTargetChanged(); | 1895 listAttributeTargetChanged(); |
1896 } | 1896 } |
1897 | 1897 |
1898 AXObject* HTMLInputElement::popupRootAXObject() | 1898 AXObject* HTMLInputElement::popupRootAXObject() |
1899 { | 1899 { |
1900 return m_inputTypeView->popupRootAXObject(); | 1900 return m_inputTypeView->popupRootAXObject(); |
1901 } | 1901 } |
1902 | 1902 |
1903 } // namespace | 1903 } // namespace |
OLD | NEW |