| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 #include "platform/PlatformMouseEvent.h" | 74 #include "platform/PlatformMouseEvent.h" |
| 75 #include "platform/RuntimeEnabledFeatures.h" | 75 #include "platform/RuntimeEnabledFeatures.h" |
| 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 namespace blink { | 79 namespace blink { |
| 80 | 80 |
| 81 using namespace HTMLNames; | 81 using namespace HTMLNames; |
| 82 | 82 |
| 83 class ListAttributeTargetObserver : public IdTargetObserver { | 83 class ListAttributeTargetObserver : public IdTargetObserver { |
| 84 USING_FAST_MALLOC_WILL_BE_REMOVED(ListAttributeTargetObserver); | |
| 85 public: | 84 public: |
| 86 static PassOwnPtrWillBeRawPtr<ListAttributeTargetObserver> create(const Atom
icString& id, HTMLInputElement*); | 85 static RawPtr<ListAttributeTargetObserver> create(const AtomicString& id, HT
MLInputElement*); |
| 87 DECLARE_VIRTUAL_TRACE(); | 86 DECLARE_VIRTUAL_TRACE(); |
| 88 void idTargetChanged() override; | 87 void idTargetChanged() override; |
| 89 | 88 |
| 90 private: | 89 private: |
| 91 ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement*); | 90 ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement*); |
| 92 | 91 |
| 93 RawPtrWillBeMember<HTMLInputElement> m_element; | 92 Member<HTMLInputElement> m_element; |
| 94 }; | 93 }; |
| 95 | 94 |
| 96 // FIXME: According to HTML4, the length attribute's value can be arbitrarily | 95 // FIXME: According to HTML4, the length attribute's value can be arbitrarily |
| 97 // large. However, due to https://bugs.webkit.org/show_bug.cgi?id=14536 things | 96 // large. However, due to https://bugs.webkit.org/show_bug.cgi?id=14536 things |
| 98 // get rather sluggish when a text field has a larger number of characters than | 97 // get rather sluggish when a text field has a larger number of characters than |
| 99 // this, even when just clicking in the text field. | 98 // this, even when just clicking in the text field. |
| 100 const int HTMLInputElement::maximumLength = 524288; | 99 const int HTMLInputElement::maximumLength = 524288; |
| 101 const int defaultSize = 20; | 100 const int defaultSize = 20; |
| 102 const int maxSavedResults = 256; | 101 const int maxSavedResults = 256; |
| 103 | 102 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 124 // |m_inputType| is lazily created when constructed by the parser to avoid | 123 // |m_inputType| is lazily created when constructed by the parser to avoid |
| 125 // constructing unnecessarily a text inputType and its shadow subtree, just | 124 // constructing unnecessarily a text inputType and its shadow subtree, just |
| 126 // to destroy them when the |type| attribute gets set by the parser to | 125 // to destroy them when the |type| attribute gets set by the parser to |
| 127 // something else than 'text'. | 126 // something else than 'text'. |
| 128 , m_inputType(createdByParser ? nullptr : InputType::createText(*this)) | 127 , m_inputType(createdByParser ? nullptr : InputType::createText(*this)) |
| 129 , m_inputTypeView(m_inputType) | 128 , m_inputTypeView(m_inputType) |
| 130 { | 129 { |
| 131 setHasCustomStyleCallbacks(); | 130 setHasCustomStyleCallbacks(); |
| 132 } | 131 } |
| 133 | 132 |
| 134 PassRefPtrWillBeRawPtr<HTMLInputElement> HTMLInputElement::create(Document& docu
ment, HTMLFormElement* form, bool createdByParser) | 133 RawPtr<HTMLInputElement> HTMLInputElement::create(Document& document, HTMLFormEl
ement* form, bool createdByParser) |
| 135 { | 134 { |
| 136 RefPtrWillBeRawPtr<HTMLInputElement> inputElement = adoptRefWillBeNoop(new H
TMLInputElement(document, form, createdByParser)); | 135 RawPtr<HTMLInputElement> inputElement = new HTMLInputElement(document, form,
createdByParser); |
| 137 if (!createdByParser) | 136 if (!createdByParser) |
| 138 inputElement->ensureUserAgentShadowRoot(); | 137 inputElement->ensureUserAgentShadowRoot(); |
| 139 return inputElement.release(); | 138 return inputElement.release(); |
| 140 } | 139 } |
| 141 | 140 |
| 142 DEFINE_TRACE(HTMLInputElement) | 141 DEFINE_TRACE(HTMLInputElement) |
| 143 { | 142 { |
| 144 visitor->trace(m_inputType); | 143 visitor->trace(m_inputType); |
| 145 visitor->trace(m_inputTypeView); | 144 visitor->trace(m_inputTypeView); |
| 146 visitor->trace(m_listAttributeTargetObserver); | 145 visitor->trace(m_listAttributeTargetObserver); |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 | 462 |
| 464 void HTMLInputElement::updateType() | 463 void HTMLInputElement::updateType() |
| 465 { | 464 { |
| 466 ASSERT(m_inputType); | 465 ASSERT(m_inputType); |
| 467 ASSERT(m_inputTypeView); | 466 ASSERT(m_inputTypeView); |
| 468 | 467 |
| 469 const AtomicString& newTypeName = InputType::normalizeTypeName(fastGetAttrib
ute(typeAttr)); | 468 const AtomicString& newTypeName = InputType::normalizeTypeName(fastGetAttrib
ute(typeAttr)); |
| 470 if (m_inputType->formControlType() == newTypeName) | 469 if (m_inputType->formControlType() == newTypeName) |
| 471 return; | 470 return; |
| 472 | 471 |
| 473 RefPtrWillBeRawPtr<InputType> newType = InputType::create(*this, newTypeName
); | 472 RawPtr<InputType> newType = InputType::create(*this, newTypeName); |
| 474 removeFromRadioButtonGroup(); | 473 removeFromRadioButtonGroup(); |
| 475 | 474 |
| 476 bool didStoreValue = m_inputType->storesValueSeparateFromAttribute(); | 475 bool didStoreValue = m_inputType->storesValueSeparateFromAttribute(); |
| 477 bool didRespectHeightAndWidth = m_inputType->shouldRespectHeightAndWidthAttr
ibutes(); | 476 bool didRespectHeightAndWidth = m_inputType->shouldRespectHeightAndWidthAttr
ibutes(); |
| 478 bool couldBeSuccessfulSubmitButton = canBeSuccessfulSubmitButton(); | 477 bool couldBeSuccessfulSubmitButton = canBeSuccessfulSubmitButton(); |
| 479 | 478 |
| 480 m_inputTypeView->destroyShadowSubtree(); | 479 m_inputTypeView->destroyShadowSubtree(); |
| 481 lazyReattachIfAttached(); | 480 lazyReattachIfAttached(); |
| 482 | 481 |
| 483 m_inputType = newType.release(); | 482 m_inputType = newType.release(); |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 { | 913 { |
| 915 m_inputType->readingChecked(); | 914 m_inputType->readingChecked(); |
| 916 return m_isChecked; | 915 return m_isChecked; |
| 917 } | 916 } |
| 918 | 917 |
| 919 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB
ehavior) | 918 void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventB
ehavior) |
| 920 { | 919 { |
| 921 if (checked() == nowChecked) | 920 if (checked() == nowChecked) |
| 922 return; | 921 return; |
| 923 | 922 |
| 924 RefPtrWillBeRawPtr<HTMLInputElement> protector(this); | 923 RawPtr<HTMLInputElement> protector(this); |
| 925 m_reflectsCheckedAttribute = false; | 924 m_reflectsCheckedAttribute = false; |
| 926 m_isChecked = nowChecked; | 925 m_isChecked = nowChecked; |
| 927 | 926 |
| 928 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) | 927 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) |
| 929 scope->updateCheckedState(this); | 928 scope->updateCheckedState(this); |
| 930 if (layoutObject()) | 929 if (layoutObject()) |
| 931 LayoutTheme::theme().controlStateChanged(*layoutObject(), CheckedControl
State); | 930 LayoutTheme::theme().controlStateChanged(*layoutObject(), CheckedControl
State); |
| 932 | 931 |
| 933 setNeedsValidityCheck(); | 932 setNeedsValidityCheck(); |
| 934 | 933 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 } | 1070 } |
| 1072 setValue(value, eventBehavior); | 1071 setValue(value, eventBehavior); |
| 1073 } | 1072 } |
| 1074 | 1073 |
| 1075 void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior even
tBehavior) | 1074 void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior even
tBehavior) |
| 1076 { | 1075 { |
| 1077 m_inputType->warnIfValueIsInvalidAndElementIsVisible(value); | 1076 m_inputType->warnIfValueIsInvalidAndElementIsVisible(value); |
| 1078 if (!m_inputType->canSetValue(value)) | 1077 if (!m_inputType->canSetValue(value)) |
| 1079 return; | 1078 return; |
| 1080 | 1079 |
| 1081 RefPtrWillBeRawPtr<HTMLInputElement> protector(this); | 1080 RawPtr<HTMLInputElement> protector(this); |
| 1082 EventQueueScope scope; | 1081 EventQueueScope scope; |
| 1083 String sanitizedValue = sanitizeValue(value); | 1082 String sanitizedValue = sanitizeValue(value); |
| 1084 bool valueChanged = sanitizedValue != this->value(); | 1083 bool valueChanged = sanitizedValue != this->value(); |
| 1085 | 1084 |
| 1086 setLastChangeWasNotUserEdit(); | 1085 setLastChangeWasNotUserEdit(); |
| 1087 m_needsToUpdateViewValue = true; | 1086 m_needsToUpdateViewValue = true; |
| 1088 m_suggestedValue = String(); // Prevent TextFieldInputType::setValue from us
ing the suggested value. | 1087 m_suggestedValue = String(); // Prevent TextFieldInputType::setValue from us
ing the suggested value. |
| 1089 | 1088 |
| 1090 m_inputType->setValue(sanitizedValue, valueChanged, eventBehavior); | 1089 m_inputType->setValue(sanitizedValue, valueChanged, eventBehavior); |
| 1091 | 1090 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 #if ENABLE(OILPAN) | 1179 #if ENABLE(OILPAN) |
| 1181 return m_inputTypeView->willDispatchClick(); | 1180 return m_inputTypeView->willDispatchClick(); |
| 1182 #else | 1181 #else |
| 1183 // FIXME: Check whether there are any cases where this actually ends up leak
ing. | 1182 // FIXME: Check whether there are any cases where this actually ends up leak
ing. |
| 1184 return m_inputTypeView->willDispatchClick().leakPtr(); | 1183 return m_inputTypeView->willDispatchClick().leakPtr(); |
| 1185 #endif | 1184 #endif |
| 1186 } | 1185 } |
| 1187 | 1186 |
| 1188 void HTMLInputElement::postDispatchEventHandler(Event* event, void* dataFromPreD
ispatch) | 1187 void HTMLInputElement::postDispatchEventHandler(Event* event, void* dataFromPreD
ispatch) |
| 1189 { | 1188 { |
| 1190 OwnPtrWillBeRawPtr<ClickHandlingState> state = adoptPtrWillBeNoop(static_cas
t<ClickHandlingState*>(dataFromPreDispatch)); | 1189 RawPtr<ClickHandlingState> state = static_cast<ClickHandlingState*>(dataFrom
PreDispatch); |
| 1191 if (!state) | 1190 if (!state) |
| 1192 return; | 1191 return; |
| 1193 // m_inputTypeView could be freed if the type attribute is modified through
a change event handler. | 1192 // m_inputTypeView could be freed if the type attribute is modified through
a change event handler. |
| 1194 RefPtrWillBeRawPtr<InputTypeView> protect(m_inputTypeView.get()); | 1193 RawPtr<InputTypeView> protect(m_inputTypeView.get()); |
| 1195 m_inputTypeView->didDispatchClick(event, *state); | 1194 m_inputTypeView->didDispatchClick(event, *state); |
| 1196 } | 1195 } |
| 1197 | 1196 |
| 1198 void HTMLInputElement::defaultEventHandler(Event* evt) | 1197 void HTMLInputElement::defaultEventHandler(Event* evt) |
| 1199 { | 1198 { |
| 1200 if (evt->isMouseEvent() && evt->type() == EventTypeNames::click && toMouseEv
ent(evt)->button() == LeftButton) { | 1199 if (evt->isMouseEvent() && evt->type() == EventTypeNames::click && toMouseEv
ent(evt)->button() == LeftButton) { |
| 1201 m_inputTypeView->handleClickEvent(toMouseEvent(evt)); | 1200 m_inputTypeView->handleClickEvent(toMouseEvent(evt)); |
| 1202 if (evt->defaultHandled()) | 1201 if (evt->defaultHandled()) |
| 1203 return; | 1202 return; |
| 1204 } | 1203 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1244 | 1243 |
| 1245 if (evt->isKeyboardEvent() && evt->type() == EventTypeNames::keyup) { | 1244 if (evt->isKeyboardEvent() && evt->type() == EventTypeNames::keyup) { |
| 1246 m_inputTypeView->handleKeyupEvent(toKeyboardEvent(evt)); | 1245 m_inputTypeView->handleKeyupEvent(toKeyboardEvent(evt)); |
| 1247 if (evt->defaultHandled()) | 1246 if (evt->defaultHandled()) |
| 1248 return; | 1247 return; |
| 1249 } | 1248 } |
| 1250 | 1249 |
| 1251 if (m_inputTypeView->shouldSubmitImplicitly(evt)) { | 1250 if (m_inputTypeView->shouldSubmitImplicitly(evt)) { |
| 1252 // FIXME: Remove type check. | 1251 // FIXME: Remove type check. |
| 1253 if (type() == InputTypeNames::search) | 1252 if (type() == InputTypeNames::search) |
| 1254 document().postTask(BLINK_FROM_HERE, createSameThreadTask(&HTMLInput
Element::onSearch, PassRefPtrWillBeRawPtr<HTMLInputElement>(this))); | 1253 document().postTask(BLINK_FROM_HERE, createSameThreadTask(&HTMLInput
Element::onSearch, RawPtr<HTMLInputElement>(this))); |
| 1255 // Form submission finishes editing, just as loss of focus does. | 1254 // Form submission finishes editing, just as loss of focus does. |
| 1256 // If there was a change, send the event now. | 1255 // If there was a change, send the event now. |
| 1257 if (wasChangedSinceLastFormControlChangeEvent()) | 1256 if (wasChangedSinceLastFormControlChangeEvent()) |
| 1258 dispatchFormControlChangeEvent(); | 1257 dispatchFormControlChangeEvent(); |
| 1259 | 1258 |
| 1260 RefPtrWillBeRawPtr<HTMLFormElement> formForSubmission = m_inputTypeView-
>formForSubmission(); | 1259 RawPtr<HTMLFormElement> formForSubmission = m_inputTypeView->formForSubm
ission(); |
| 1261 // Form may never have been present, or may have been destroyed by code
responding to the change event. | 1260 // Form may never have been present, or may have been destroyed by code
responding to the change event. |
| 1262 if (formForSubmission) | 1261 if (formForSubmission) |
| 1263 formForSubmission->submitImplicitly(evt, canTriggerImplicitSubmissio
n()); | 1262 formForSubmission->submitImplicitly(evt, canTriggerImplicitSubmissio
n()); |
| 1264 | 1263 |
| 1265 evt->setDefaultHandled(); | 1264 evt->setDefaultHandled(); |
| 1266 return; | 1265 return; |
| 1267 } | 1266 } |
| 1268 | 1267 |
| 1269 if (evt->isBeforeTextInsertedEvent()) | 1268 if (evt->isBeforeTextInsertedEvent()) |
| 1270 m_inputTypeView->handleBeforeTextInsertedEvent(static_cast<BeforeTextIns
ertedEvent*>(evt)); | 1269 m_inputTypeView->handleBeforeTextInsertedEvent(static_cast<BeforeTextIns
ertedEvent*>(evt)); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1604 return nullptr; | 1603 return nullptr; |
| 1605 | 1604 |
| 1606 return toHTMLDataListElement(element); | 1605 return toHTMLDataListElement(element); |
| 1607 } | 1606 } |
| 1608 | 1607 |
| 1609 bool HTMLInputElement::hasValidDataListOptions() const | 1608 bool HTMLInputElement::hasValidDataListOptions() const |
| 1610 { | 1609 { |
| 1611 HTMLDataListElement* dataList = this->dataList(); | 1610 HTMLDataListElement* dataList = this->dataList(); |
| 1612 if (!dataList) | 1611 if (!dataList) |
| 1613 return false; | 1612 return false; |
| 1614 RefPtrWillBeRawPtr<HTMLDataListOptionsCollection> options = dataList->option
s(); | 1613 RawPtr<HTMLDataListOptionsCollection> options = dataList->options(); |
| 1615 for (unsigned i = 0; HTMLOptionElement* option = options->item(i); ++i) { | 1614 for (unsigned i = 0; HTMLOptionElement* option = options->item(i); ++i) { |
| 1616 if (isValidValue(option->value())) | 1615 if (isValidValue(option->value())) |
| 1617 return true; | 1616 return true; |
| 1618 } | 1617 } |
| 1619 return false; | 1618 return false; |
| 1620 } | 1619 } |
| 1621 | 1620 |
| 1622 void HTMLInputElement::setListAttributeTargetObserver(PassOwnPtrWillBeRawPtr<Lis
tAttributeTargetObserver> newObserver) | 1621 void HTMLInputElement::setListAttributeTargetObserver(RawPtr<ListAttributeTarget
Observer> newObserver) |
| 1623 { | 1622 { |
| 1624 if (m_listAttributeTargetObserver) | 1623 if (m_listAttributeTargetObserver) |
| 1625 m_listAttributeTargetObserver->unregister(); | 1624 m_listAttributeTargetObserver->unregister(); |
| 1626 m_listAttributeTargetObserver = newObserver; | 1625 m_listAttributeTargetObserver = newObserver; |
| 1627 } | 1626 } |
| 1628 | 1627 |
| 1629 void HTMLInputElement::resetListAttributeTargetObserver() | 1628 void HTMLInputElement::resetListAttributeTargetObserver() |
| 1630 { | 1629 { |
| 1631 if (inDocument()) | 1630 if (inDocument()) |
| 1632 setListAttributeTargetObserver(ListAttributeTargetObserver::create(fastG
etAttribute(listAttr), this)); | 1631 setListAttributeTargetObserver(ListAttributeTargetObserver::create(fastG
etAttribute(listAttr), this)); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1798 void HTMLInputElement::setHeight(unsigned height) | 1797 void HTMLInputElement::setHeight(unsigned height) |
| 1799 { | 1798 { |
| 1800 setUnsignedIntegralAttribute(heightAttr, height); | 1799 setUnsignedIntegralAttribute(heightAttr, height); |
| 1801 } | 1800 } |
| 1802 | 1801 |
| 1803 void HTMLInputElement::setWidth(unsigned width) | 1802 void HTMLInputElement::setWidth(unsigned width) |
| 1804 { | 1803 { |
| 1805 setUnsignedIntegralAttribute(widthAttr, width); | 1804 setUnsignedIntegralAttribute(widthAttr, width); |
| 1806 } | 1805 } |
| 1807 | 1806 |
| 1808 PassOwnPtrWillBeRawPtr<ListAttributeTargetObserver> ListAttributeTargetObserver:
:create(const AtomicString& id, HTMLInputElement* element) | 1807 RawPtr<ListAttributeTargetObserver> ListAttributeTargetObserver::create(const At
omicString& id, HTMLInputElement* element) |
| 1809 { | 1808 { |
| 1810 return adoptPtrWillBeNoop(new ListAttributeTargetObserver(id, element)); | 1809 return new ListAttributeTargetObserver(id, element); |
| 1811 } | 1810 } |
| 1812 | 1811 |
| 1813 ListAttributeTargetObserver::ListAttributeTargetObserver(const AtomicString& id,
HTMLInputElement* element) | 1812 ListAttributeTargetObserver::ListAttributeTargetObserver(const AtomicString& id,
HTMLInputElement* element) |
| 1814 : IdTargetObserver(element->treeScope().idTargetObserverRegistry(), id) | 1813 : IdTargetObserver(element->treeScope().idTargetObserverRegistry(), id) |
| 1815 , m_element(element) | 1814 , m_element(element) |
| 1816 { | 1815 { |
| 1817 } | 1816 } |
| 1818 | 1817 |
| 1819 DEFINE_TRACE(ListAttributeTargetObserver) | 1818 DEFINE_TRACE(ListAttributeTargetObserver) |
| 1820 { | 1819 { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1871 parameters.step = 1.0; | 1870 parameters.step = 1.0; |
| 1872 parameters.stepBase = 0; | 1871 parameters.stepBase = 0; |
| 1873 } | 1872 } |
| 1874 | 1873 |
| 1875 parameters.anchorRectInRootFrame = document().view()->contentsToRootFrame(pi
xelSnappedBoundingBox()); | 1874 parameters.anchorRectInRootFrame = document().view()->contentsToRootFrame(pi
xelSnappedBoundingBox()); |
| 1876 parameters.anchorRectInScreen = document().view()->contentsToScreen(pixelSna
ppedBoundingBox()); | 1875 parameters.anchorRectInScreen = document().view()->contentsToScreen(pixelSna
ppedBoundingBox()); |
| 1877 parameters.currentValue = value(); | 1876 parameters.currentValue = value(); |
| 1878 parameters.doubleValue = m_inputType->valueAsDouble(); | 1877 parameters.doubleValue = m_inputType->valueAsDouble(); |
| 1879 parameters.isAnchorElementRTL = m_inputType->computedTextDirection() == RTL; | 1878 parameters.isAnchorElementRTL = m_inputType->computedTextDirection() == RTL; |
| 1880 if (HTMLDataListElement* dataList = this->dataList()) { | 1879 if (HTMLDataListElement* dataList = this->dataList()) { |
| 1881 RefPtrWillBeRawPtr<HTMLDataListOptionsCollection> options = dataList->op
tions(); | 1880 RawPtr<HTMLDataListOptionsCollection> options = dataList->options(); |
| 1882 for (unsigned i = 0; HTMLOptionElement* option = options->item(i); ++i)
{ | 1881 for (unsigned i = 0; HTMLOptionElement* option = options->item(i); ++i)
{ |
| 1883 if (!isValidValue(option->value())) | 1882 if (!isValidValue(option->value())) |
| 1884 continue; | 1883 continue; |
| 1885 DateTimeSuggestion suggestion; | 1884 DateTimeSuggestion suggestion; |
| 1886 suggestion.value = m_inputType->parseToNumber(option->value(), Decim
al::nan()).toDouble(); | 1885 suggestion.value = m_inputType->parseToNumber(option->value(), Decim
al::nan()).toDouble(); |
| 1887 if (std::isnan(suggestion.value)) | 1886 if (std::isnan(suggestion.value)) |
| 1888 continue; | 1887 continue; |
| 1889 suggestion.localizedValue = localizeValue(option->value()); | 1888 suggestion.localizedValue = localizeValue(option->value()); |
| 1890 suggestion.label = option->value() == option->label() ? String() : o
ption->label(); | 1889 suggestion.label = option->value() == option->label() ? String() : o
ption->label(); |
| 1891 parameters.suggestions.append(suggestion); | 1890 parameters.suggestions.append(suggestion); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1945 void HTMLInputElement::ensurePrimaryContent() | 1944 void HTMLInputElement::ensurePrimaryContent() |
| 1946 { | 1945 { |
| 1947 m_inputTypeView->ensurePrimaryContent(); | 1946 m_inputTypeView->ensurePrimaryContent(); |
| 1948 } | 1947 } |
| 1949 | 1948 |
| 1950 bool HTMLInputElement::hasFallbackContent() const | 1949 bool HTMLInputElement::hasFallbackContent() const |
| 1951 { | 1950 { |
| 1952 return m_inputTypeView->hasFallbackContent(); | 1951 return m_inputTypeView->hasFallbackContent(); |
| 1953 } | 1952 } |
| 1954 } // namespace blink | 1953 } // namespace blink |
| OLD | NEW |