| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 setNeedsWillValidateCheck(); | 437 setNeedsWillValidateCheck(); |
| 438 | 438 |
| 439 bool willStoreValue = m_inputType->storesValueSeparateFromAttribute(); | 439 bool willStoreValue = m_inputType->storesValueSeparateFromAttribute(); |
| 440 | 440 |
| 441 if (didStoreValue && !willStoreValue && hasDirtyValue()) { | 441 if (didStoreValue && !willStoreValue && hasDirtyValue()) { |
| 442 setAttribute(valueAttr, AtomicString(m_valueIfDirty)); | 442 setAttribute(valueAttr, AtomicString(m_valueIfDirty)); |
| 443 m_valueIfDirty = String(); | 443 m_valueIfDirty = String(); |
| 444 } | 444 } |
| 445 if (!didStoreValue && willStoreValue) { | 445 if (!didStoreValue && willStoreValue) { |
| 446 AtomicString valueString = fastGetAttribute(valueAttr); | 446 AtomicString valueString = fastGetAttribute(valueAttr); |
| 447 m_inputType->warnIfValueIsInvalid(valueString); |
| 447 m_valueIfDirty = sanitizeValue(valueString); | 448 m_valueIfDirty = sanitizeValue(valueString); |
| 448 } else | 449 } else { |
| 450 m_inputType->warnIfValueIsInvalid(hasDirtyValue() ? m_valueIfDirty : fas
tGetAttribute(valueAttr).string()); |
| 449 updateValueIfNeeded(); | 451 updateValueIfNeeded(); |
| 452 } |
| 450 | 453 |
| 451 m_needsToUpdateViewValue = true; | 454 m_needsToUpdateViewValue = true; |
| 452 m_inputTypeView->updateView(); | 455 m_inputTypeView->updateView(); |
| 453 | 456 |
| 454 if (didRespectHeightAndWidth != m_inputType->shouldRespectHeightAndWidthAttr
ibutes()) { | 457 if (didRespectHeightAndWidth != m_inputType->shouldRespectHeightAndWidthAttr
ibutes()) { |
| 455 ASSERT(elementData()); | 458 ASSERT(elementData()); |
| 456 AttributeCollection attributes = attributesWithoutUpdate(); | 459 AttributeCollection attributes = attributesWithoutUpdate(); |
| 457 if (const Attribute* height = attributes.find(heightAttr)) | 460 if (const Attribute* height = attributes.find(heightAttr)) |
| 458 attributeChanged(heightAttr, height->value()); | 461 attributeChanged(heightAttr, height->value()); |
| 459 if (const Attribute* width = attributes.find(widthAttr)) | 462 if (const Attribute* width = attributes.find(widthAttr)) |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 updateType(); | 656 updateType(); |
| 654 else if (name == valueAttr) { | 657 else if (name == valueAttr) { |
| 655 // We only need to setChanged if the form is looking at the default valu
e right now. | 658 // We only need to setChanged if the form is looking at the default valu
e right now. |
| 656 if (!hasDirtyValue()) { | 659 if (!hasDirtyValue()) { |
| 657 updatePlaceholderVisibility(false); | 660 updatePlaceholderVisibility(false); |
| 658 setNeedsStyleRecalc(SubtreeStyleChange); | 661 setNeedsStyleRecalc(SubtreeStyleChange); |
| 659 } | 662 } |
| 660 m_needsToUpdateViewValue = true; | 663 m_needsToUpdateViewValue = true; |
| 661 setNeedsValidityCheck(); | 664 setNeedsValidityCheck(); |
| 662 m_valueAttributeWasUpdatedAfterParsing = !m_parsingInProgress; | 665 m_valueAttributeWasUpdatedAfterParsing = !m_parsingInProgress; |
| 666 m_inputType->warnIfValueIsInvalid(value); |
| 663 m_inputTypeView->valueAttributeChanged(); | 667 m_inputTypeView->valueAttributeChanged(); |
| 664 } else if (name == checkedAttr) { | 668 } else if (name == checkedAttr) { |
| 665 // Another radio button in the same group might be checked by state | 669 // Another radio button in the same group might be checked by state |
| 666 // restore. We shouldn't call setChecked() even if this has the checked | 670 // restore. We shouldn't call setChecked() even if this has the checked |
| 667 // attribute. So, delay the setChecked() call until | 671 // attribute. So, delay the setChecked() call until |
| 668 // finishParsingChildren() is called if parsing is in progress. | 672 // finishParsingChildren() is called if parsing is in progress. |
| 669 if (!m_parsingInProgress && m_reflectsCheckedAttribute) { | 673 if (!m_parsingInProgress && m_reflectsCheckedAttribute) { |
| 670 setChecked(!value.isNull()); | 674 setChecked(!value.isNull()); |
| 671 m_reflectsCheckedAttribute = true; | 675 m_reflectsCheckedAttribute = true; |
| 672 } | 676 } |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 { | 998 { |
| 995 if (isFileUpload() && !value.isEmpty()) { | 999 if (isFileUpload() && !value.isEmpty()) { |
| 996 exceptionState.throwDOMException(InvalidStateError, "This input element
accepts a filename, which may only be programmatically set to the empty string."
); | 1000 exceptionState.throwDOMException(InvalidStateError, "This input element
accepts a filename, which may only be programmatically set to the empty string."
); |
| 997 return; | 1001 return; |
| 998 } | 1002 } |
| 999 setValue(value, eventBehavior); | 1003 setValue(value, eventBehavior); |
| 1000 } | 1004 } |
| 1001 | 1005 |
| 1002 void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior even
tBehavior) | 1006 void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior even
tBehavior) |
| 1003 { | 1007 { |
| 1008 m_inputType->warnIfValueIsInvalid(value); |
| 1004 if (!m_inputType->canSetValue(value)) | 1009 if (!m_inputType->canSetValue(value)) |
| 1005 return; | 1010 return; |
| 1006 | 1011 |
| 1007 RefPtrWillBeRawPtr<HTMLInputElement> protector(this); | 1012 RefPtrWillBeRawPtr<HTMLInputElement> protector(this); |
| 1008 EventQueueScope scope; | 1013 EventQueueScope scope; |
| 1009 String sanitizedValue = sanitizeValue(value); | 1014 String sanitizedValue = sanitizeValue(value); |
| 1010 bool valueChanged = sanitizedValue != this->value(); | 1015 bool valueChanged = sanitizedValue != this->value(); |
| 1011 | 1016 |
| 1012 setLastChangeWasNotUserEdit(); | 1017 setLastChangeWasNotUserEdit(); |
| 1013 m_needsToUpdateViewValue = true; | 1018 m_needsToUpdateViewValue = true; |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1880 { | 1885 { |
| 1881 return m_inputType->shouldDispatchFormControlChangeEvent(oldValue, newValue)
; | 1886 return m_inputType->shouldDispatchFormControlChangeEvent(oldValue, newValue)
; |
| 1882 } | 1887 } |
| 1883 | 1888 |
| 1884 void HTMLInputElement::didNotifySubtreeInsertionsToDocument() | 1889 void HTMLInputElement::didNotifySubtreeInsertionsToDocument() |
| 1885 { | 1890 { |
| 1886 listAttributeTargetChanged(); | 1891 listAttributeTargetChanged(); |
| 1887 } | 1892 } |
| 1888 | 1893 |
| 1889 } // namespace | 1894 } // namespace |
| OLD | NEW |