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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 #include "platform/text/PlatformLocale.h" | 76 #include "platform/text/PlatformLocale.h" |
77 #include "wtf/MathExtras.h" | 77 #include "wtf/MathExtras.h" |
78 | 78 |
79 using namespace std; | 79 using namespace std; |
80 | 80 |
81 namespace WebCore { | 81 namespace WebCore { |
82 | 82 |
83 using namespace HTMLNames; | 83 using namespace HTMLNames; |
84 | 84 |
85 class ListAttributeTargetObserver : public IdTargetObserver { | 85 class ListAttributeTargetObserver : public IdTargetObserver { |
86 WTF_MAKE_FAST_ALLOCATED; | 86 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
87 public: | 87 public: |
88 static PassOwnPtr<ListAttributeTargetObserver> create(const AtomicString& id
, HTMLInputElement*); | 88 static PassOwnPtrWillBeRawPtr<ListAttributeTargetObserver> create(const Atom
icString& id, HTMLInputElement*); |
| 89 virtual void trace(Visitor*) OVERRIDE; |
89 virtual void idTargetChanged() OVERRIDE; | 90 virtual void idTargetChanged() OVERRIDE; |
90 | 91 |
91 private: | 92 private: |
92 ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement*); | 93 ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement*); |
93 | 94 |
94 HTMLInputElement* m_element; | 95 RawPtrWillBeMember<HTMLInputElement> m_element; |
95 }; | 96 }; |
96 | 97 |
97 // FIXME: According to HTML4, the length attribute's value can be arbitrarily | 98 // FIXME: According to HTML4, the length attribute's value can be arbitrarily |
98 // large. However, due to https://bugs.webkit.org/show_bug.cgi?id=14536 things | 99 // large. However, due to https://bugs.webkit.org/show_bug.cgi?id=14536 things |
99 // get rather sluggish when a text field has a larger number of characters than | 100 // get rather sluggish when a text field has a larger number of characters than |
100 // this, even when just clicking in the text field. | 101 // this, even when just clicking in the text field. |
101 const int HTMLInputElement::maximumLength = 524288; | 102 const int HTMLInputElement::maximumLength = 524288; |
102 const int defaultSize = 20; | 103 const int defaultSize = 20; |
103 const int maxSavedResults = 256; | 104 const int maxSavedResults = 256; |
104 | 105 |
(...skipping 28 matching lines...) Expand all Loading... |
133 { | 134 { |
134 RefPtrWillBeRawPtr<HTMLInputElement> inputElement = adoptRefWillBeRefCounted
GarbageCollected(new HTMLInputElement(document, form, createdByParser)); | 135 RefPtrWillBeRawPtr<HTMLInputElement> inputElement = adoptRefWillBeRefCounted
GarbageCollected(new HTMLInputElement(document, form, createdByParser)); |
135 inputElement->ensureUserAgentShadowRoot(); | 136 inputElement->ensureUserAgentShadowRoot(); |
136 return inputElement.release(); | 137 return inputElement.release(); |
137 } | 138 } |
138 | 139 |
139 void HTMLInputElement::trace(Visitor* visitor) | 140 void HTMLInputElement::trace(Visitor* visitor) |
140 { | 141 { |
141 visitor->trace(m_inputType); | 142 visitor->trace(m_inputType); |
142 visitor->trace(m_inputTypeView); | 143 visitor->trace(m_inputTypeView); |
| 144 visitor->trace(m_listAttributeTargetObserver); |
143 HTMLTextFormControlElement::trace(visitor); | 145 HTMLTextFormControlElement::trace(visitor); |
144 } | 146 } |
145 | 147 |
146 HTMLImageLoader* HTMLInputElement::imageLoader() | 148 HTMLImageLoader* HTMLInputElement::imageLoader() |
147 { | 149 { |
148 if (!m_imageLoader) | 150 if (!m_imageLoader) |
149 m_imageLoader = adoptPtr(new HTMLImageLoader(this)); | 151 m_imageLoader = adoptPtr(new HTMLImageLoader(this)); |
150 return m_imageLoader.get(); | 152 return m_imageLoader.get(); |
151 } | 153 } |
152 | 154 |
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 if (!dataList) | 1502 if (!dataList) |
1501 return false; | 1503 return false; |
1502 RefPtr<HTMLCollection> options = dataList->options(); | 1504 RefPtr<HTMLCollection> options = dataList->options(); |
1503 for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement(options
->item(i)); ++i) { | 1505 for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement(options
->item(i)); ++i) { |
1504 if (isValidValue(option->value())) | 1506 if (isValidValue(option->value())) |
1505 return true; | 1507 return true; |
1506 } | 1508 } |
1507 return false; | 1509 return false; |
1508 } | 1510 } |
1509 | 1511 |
1510 void HTMLInputElement::setListAttributeTargetObserver(PassOwnPtr<ListAttributeTa
rgetObserver> newObserver) | 1512 void HTMLInputElement::setListAttributeTargetObserver(PassOwnPtrWillBeRawPtr<Lis
tAttributeTargetObserver> newObserver) |
1511 { | 1513 { |
1512 if (m_listAttributeTargetObserver) | 1514 if (m_listAttributeTargetObserver) |
1513 m_listAttributeTargetObserver->unregister(); | 1515 m_listAttributeTargetObserver->unregister(); |
1514 m_listAttributeTargetObserver = newObserver; | 1516 m_listAttributeTargetObserver = newObserver; |
1515 } | 1517 } |
1516 | 1518 |
1517 void HTMLInputElement::resetListAttributeTargetObserver() | 1519 void HTMLInputElement::resetListAttributeTargetObserver() |
1518 { | 1520 { |
1519 if (inDocument()) | 1521 if (inDocument()) |
1520 setListAttributeTargetObserver(ListAttributeTargetObserver::create(fastG
etAttribute(listAttr), this)); | 1522 setListAttributeTargetObserver(ListAttributeTargetObserver::create(fastG
etAttribute(listAttr), this)); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1755 void HTMLInputElement::setHeight(unsigned height) | 1757 void HTMLInputElement::setHeight(unsigned height) |
1756 { | 1758 { |
1757 setUnsignedIntegralAttribute(heightAttr, height); | 1759 setUnsignedIntegralAttribute(heightAttr, height); |
1758 } | 1760 } |
1759 | 1761 |
1760 void HTMLInputElement::setWidth(unsigned width) | 1762 void HTMLInputElement::setWidth(unsigned width) |
1761 { | 1763 { |
1762 setUnsignedIntegralAttribute(widthAttr, width); | 1764 setUnsignedIntegralAttribute(widthAttr, width); |
1763 } | 1765 } |
1764 | 1766 |
1765 PassOwnPtr<ListAttributeTargetObserver> ListAttributeTargetObserver::create(cons
t AtomicString& id, HTMLInputElement* element) | 1767 PassOwnPtrWillBeRawPtr<ListAttributeTargetObserver> ListAttributeTargetObserver:
:create(const AtomicString& id, HTMLInputElement* element) |
1766 { | 1768 { |
1767 return adoptPtr(new ListAttributeTargetObserver(id, element)); | 1769 return adoptPtrWillBeNoop(new ListAttributeTargetObserver(id, element)); |
1768 } | 1770 } |
1769 | 1771 |
1770 ListAttributeTargetObserver::ListAttributeTargetObserver(const AtomicString& id,
HTMLInputElement* element) | 1772 ListAttributeTargetObserver::ListAttributeTargetObserver(const AtomicString& id,
HTMLInputElement* element) |
1771 : IdTargetObserver(element->treeScope().idTargetObserverRegistry(), id) | 1773 : IdTargetObserver(element->treeScope().idTargetObserverRegistry(), id) |
1772 , m_element(element) | 1774 , m_element(element) |
1773 { | 1775 { |
1774 } | 1776 } |
1775 | 1777 |
| 1778 void ListAttributeTargetObserver::trace(Visitor* visitor) |
| 1779 { |
| 1780 visitor->trace(m_element); |
| 1781 IdTargetObserver::trace(visitor); |
| 1782 } |
| 1783 |
1776 void ListAttributeTargetObserver::idTargetChanged() | 1784 void ListAttributeTargetObserver::idTargetChanged() |
1777 { | 1785 { |
1778 m_element->listAttributeTargetChanged(); | 1786 m_element->listAttributeTargetChanged(); |
1779 } | 1787 } |
1780 | 1788 |
1781 void HTMLInputElement::setRangeText(const String& replacement, ExceptionState& e
xceptionState) | 1789 void HTMLInputElement::setRangeText(const String& replacement, ExceptionState& e
xceptionState) |
1782 { | 1790 { |
1783 if (!m_inputType->supportsSelectionAPI()) { | 1791 if (!m_inputType->supportsSelectionAPI()) { |
1784 exceptionState.throwDOMException(InvalidStateError, "The input element's
type ('" + m_inputType->formControlType() + "') does not support selection."); | 1792 exceptionState.throwDOMException(InvalidStateError, "The input element's
type ('" + m_inputType->formControlType() + "') does not support selection."); |
1785 return; | 1793 return; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1873 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); | 1881 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); |
1874 } | 1882 } |
1875 #endif | 1883 #endif |
1876 | 1884 |
1877 bool HTMLInputElement::shouldDispatchFormControlChangeEvent(String& oldValue, St
ring& newValue) | 1885 bool HTMLInputElement::shouldDispatchFormControlChangeEvent(String& oldValue, St
ring& newValue) |
1878 { | 1886 { |
1879 return m_inputType->shouldDispatchFormControlChangeEvent(oldValue, newValue)
; | 1887 return m_inputType->shouldDispatchFormControlChangeEvent(oldValue, newValue)
; |
1880 } | 1888 } |
1881 | 1889 |
1882 } // namespace | 1890 } // namespace |
OLD | NEW |