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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 } else if (name == maxlengthAttr) { | 724 } else if (name == maxlengthAttr) { |
725 parseMaxLengthAttribute(value); | 725 parseMaxLengthAttribute(value); |
726 } else if (name == minlengthAttr) { | 726 } else if (name == minlengthAttr) { |
727 parseMinLengthAttribute(value); | 727 parseMinLengthAttribute(value); |
728 } else if (name == sizeAttr) { | 728 } else if (name == sizeAttr) { |
729 int oldSize = m_size; | 729 int oldSize = m_size; |
730 m_size = defaultSize; | 730 m_size = defaultSize; |
731 int valueAsInteger; | 731 int valueAsInteger; |
732 if (!value.isEmpty() && parseHTMLInteger(value, valueAsInteger) && value
AsInteger > 0) | 732 if (!value.isEmpty() && parseHTMLInteger(value, valueAsInteger) && value
AsInteger > 0) |
733 m_size = valueAsInteger; | 733 m_size = valueAsInteger; |
734 if (m_size != oldSize && renderer()) | 734 if (m_size != oldSize && layoutObject()) |
735 renderer()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidatio
n(); | 735 layoutObject()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalid
ation(); |
736 } else if (name == altAttr) | 736 } else if (name == altAttr) |
737 m_inputTypeView->altAttributeChanged(); | 737 m_inputTypeView->altAttributeChanged(); |
738 else if (name == srcAttr) | 738 else if (name == srcAttr) |
739 m_inputTypeView->srcAttributeChanged(); | 739 m_inputTypeView->srcAttributeChanged(); |
740 else if (name == usemapAttr || name == accesskeyAttr) { | 740 else if (name == usemapAttr || name == accesskeyAttr) { |
741 // FIXME: ignore for the moment | 741 // FIXME: ignore for the moment |
742 } else if (name == onsearchAttr) { | 742 } else if (name == onsearchAttr) { |
743 // Search field and slider attributes all just cause updateFromElement t
o be called through style recalcing. | 743 // Search field and slider attributes all just cause updateFromElement t
o be called through style recalcing. |
744 setAttributeEventListener(EventTypeNames::search, createAttributeEventLi
stener(this, name, value, eventParameterName())); | 744 setAttributeEventListener(EventTypeNames::search, createAttributeEventLi
stener(this, name, value, eventParameterName())); |
745 } else if (name == resultsAttr) { | 745 } else if (name == resultsAttr) { |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 { | 904 { |
905 if (checked() == nowChecked) | 905 if (checked() == nowChecked) |
906 return; | 906 return; |
907 | 907 |
908 RefPtrWillBeRawPtr<HTMLInputElement> protector(this); | 908 RefPtrWillBeRawPtr<HTMLInputElement> protector(this); |
909 m_reflectsCheckedAttribute = false; | 909 m_reflectsCheckedAttribute = false; |
910 m_isChecked = nowChecked; | 910 m_isChecked = nowChecked; |
911 | 911 |
912 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) | 912 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) |
913 scope->updateCheckedState(this); | 913 scope->updateCheckedState(this); |
914 if (renderer() && renderer()->style()->hasAppearance()) | 914 if (layoutObject() && layoutObject()->style()->hasAppearance()) |
915 LayoutTheme::theme().stateChanged(renderer(), CheckedControlState); | 915 LayoutTheme::theme().stateChanged(layoutObject(), CheckedControlState); |
916 | 916 |
917 setNeedsValidityCheck(); | 917 setNeedsValidityCheck(); |
918 | 918 |
919 // Ideally we'd do this from the render tree (matching | 919 // Ideally we'd do this from the render tree (matching |
920 // RenderTextView), but it's not possible to do it at the moment | 920 // RenderTextView), but it's not possible to do it at the moment |
921 // because of the way the code is structured. | 921 // because of the way the code is structured. |
922 if (renderer()) { | 922 if (layoutObject()) { |
923 if (AXObjectCache* cache = renderer()->document().existingAXObjectCache(
)) | 923 if (AXObjectCache* cache = layoutObject()->document().existingAXObjectCa
che()) |
924 cache->checkedStateChanged(this); | 924 cache->checkedStateChanged(this); |
925 } | 925 } |
926 | 926 |
927 // Only send a change event for items in the document (avoid firing during | 927 // Only send a change event for items in the document (avoid firing during |
928 // parsing) and don't send a change event for a radio button that's getting | 928 // parsing) and don't send a change event for a radio button that's getting |
929 // unchecked to match other browsers. DOM is not a useful standard for this | 929 // unchecked to match other browsers. DOM is not a useful standard for this |
930 // because it says only to fire change events at "lose focus" time, which is | 930 // because it says only to fire change events at "lose focus" time, which is |
931 // definitely wrong in practice for these types of elements. | 931 // definitely wrong in practice for these types of elements. |
932 if (eventBehavior != DispatchNoEvent && inDocument() && m_inputType->shouldS
endChangeEventAfterCheckedChanged()) { | 932 if (eventBehavior != DispatchNoEvent && inDocument() && m_inputType->shouldS
endChangeEventAfterCheckedChanged()) { |
933 setTextAsOfLastFormControlChangeEvent(String()); | 933 setTextAsOfLastFormControlChangeEvent(String()); |
934 if (eventBehavior == DispatchInputAndChangeEvent) | 934 if (eventBehavior == DispatchInputAndChangeEvent) |
935 dispatchFormControlInputEvent(); | 935 dispatchFormControlInputEvent(); |
936 dispatchFormControlChangeEvent(); | 936 dispatchFormControlChangeEvent(); |
937 } | 937 } |
938 | 938 |
939 pseudoStateChanged(CSSSelector::PseudoChecked); | 939 pseudoStateChanged(CSSSelector::PseudoChecked); |
940 } | 940 } |
941 | 941 |
942 void HTMLInputElement::setIndeterminate(bool newValue) | 942 void HTMLInputElement::setIndeterminate(bool newValue) |
943 { | 943 { |
944 if (indeterminate() == newValue) | 944 if (indeterminate() == newValue) |
945 return; | 945 return; |
946 | 946 |
947 m_isIndeterminate = newValue; | 947 m_isIndeterminate = newValue; |
948 | 948 |
949 pseudoStateChanged(CSSSelector::PseudoIndeterminate); | 949 pseudoStateChanged(CSSSelector::PseudoIndeterminate); |
950 | 950 |
951 if (renderer() && renderer()->style()->hasAppearance()) | 951 if (layoutObject() && layoutObject()->style()->hasAppearance()) |
952 LayoutTheme::theme().stateChanged(renderer(), CheckedControlState); | 952 LayoutTheme::theme().stateChanged(layoutObject(), CheckedControlState); |
953 } | 953 } |
954 | 954 |
955 int HTMLInputElement::size() const | 955 int HTMLInputElement::size() const |
956 { | 956 { |
957 return m_size; | 957 return m_size; |
958 } | 958 } |
959 | 959 |
960 bool HTMLInputElement::sizeShouldIncludeDecoration(int& preferredSize) const | 960 bool HTMLInputElement::sizeShouldIncludeDecoration(int& preferredSize) const |
961 { | 961 { |
962 return m_inputTypeView->sizeShouldIncludeDecoration(defaultSize, preferredSi
ze); | 962 return m_inputTypeView->sizeShouldIncludeDecoration(defaultSize, preferredSi
ze); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 if (!m_inputType->canSetSuggestedValue()) | 1020 if (!m_inputType->canSetSuggestedValue()) |
1021 return; | 1021 return; |
1022 m_needsToUpdateViewValue = true; | 1022 m_needsToUpdateViewValue = true; |
1023 m_suggestedValue = sanitizeValue(value); | 1023 m_suggestedValue = sanitizeValue(value); |
1024 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(
StyleChangeReason::ControlValue)); | 1024 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(
StyleChangeReason::ControlValue)); |
1025 m_inputTypeView->updateView(); | 1025 m_inputTypeView->updateView(); |
1026 } | 1026 } |
1027 | 1027 |
1028 void HTMLInputElement::setEditingValue(const String& value) | 1028 void HTMLInputElement::setEditingValue(const String& value) |
1029 { | 1029 { |
1030 if (!renderer() || !isTextField()) | 1030 if (!layoutObject() || !isTextField()) |
1031 return; | 1031 return; |
1032 setInnerEditorValue(value); | 1032 setInnerEditorValue(value); |
1033 subtreeHasChanged(); | 1033 subtreeHasChanged(); |
1034 | 1034 |
1035 unsigned max = value.length(); | 1035 unsigned max = value.length(); |
1036 if (focused()) | 1036 if (focused()) |
1037 setSelectionRange(max, max, SelectionHasNoDirection, NotDispatchSelectEv
ent); | 1037 setSelectionRange(max, max, SelectionHasNoDirection, NotDispatchSelectEv
ent); |
1038 else | 1038 else |
1039 cacheSelectionInResponseToSetValue(max); | 1039 cacheSelectionInResponseToSetValue(max); |
1040 | 1040 |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1424 bool HTMLInputElement::canReceiveDroppedFiles() const | 1424 bool HTMLInputElement::canReceiveDroppedFiles() const |
1425 { | 1425 { |
1426 return m_canReceiveDroppedFiles; | 1426 return m_canReceiveDroppedFiles; |
1427 } | 1427 } |
1428 | 1428 |
1429 void HTMLInputElement::setCanReceiveDroppedFiles(bool canReceiveDroppedFiles) | 1429 void HTMLInputElement::setCanReceiveDroppedFiles(bool canReceiveDroppedFiles) |
1430 { | 1430 { |
1431 if (m_canReceiveDroppedFiles == canReceiveDroppedFiles) | 1431 if (m_canReceiveDroppedFiles == canReceiveDroppedFiles) |
1432 return; | 1432 return; |
1433 m_canReceiveDroppedFiles = canReceiveDroppedFiles; | 1433 m_canReceiveDroppedFiles = canReceiveDroppedFiles; |
1434 if (renderer()) | 1434 if (layoutObject()) |
1435 renderer()->updateFromElement(); | 1435 layoutObject()->updateFromElement(); |
1436 } | 1436 } |
1437 | 1437 |
1438 String HTMLInputElement::sanitizeValue(const String& proposedValue) const | 1438 String HTMLInputElement::sanitizeValue(const String& proposedValue) const |
1439 { | 1439 { |
1440 if (proposedValue.isNull()) | 1440 if (proposedValue.isNull()) |
1441 return proposedValue; | 1441 return proposedValue; |
1442 return m_inputType->sanitizeValue(proposedValue); | 1442 return m_inputType->sanitizeValue(proposedValue); |
1443 } | 1443 } |
1444 | 1444 |
1445 String HTMLInputElement::localizeValue(const String& proposedValue) const | 1445 String HTMLInputElement::localizeValue(const String& proposedValue) const |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1913 void HTMLInputElement::ensurePrimaryContent() | 1913 void HTMLInputElement::ensurePrimaryContent() |
1914 { | 1914 { |
1915 m_inputTypeView->ensurePrimaryContent(); | 1915 m_inputTypeView->ensurePrimaryContent(); |
1916 } | 1916 } |
1917 | 1917 |
1918 bool HTMLInputElement::hasFallbackContent() const | 1918 bool HTMLInputElement::hasFallbackContent() const |
1919 { | 1919 { |
1920 return m_inputTypeView->hasFallbackContent(); | 1920 return m_inputTypeView->hasFallbackContent(); |
1921 } | 1921 } |
1922 } // namespace | 1922 } // namespace |
OLD | NEW |