| 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 | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
| 6 * rights reserved. | 6 * rights reserved. |
| 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
| 9 * Copyright (C) 2010 Google Inc. All rights reserved. | 9 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 10 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. | 10 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. |
| (...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1551 | 1551 |
| 1552 return toHTMLDataListElement(element); | 1552 return toHTMLDataListElement(element); |
| 1553 } | 1553 } |
| 1554 | 1554 |
| 1555 bool HTMLInputElement::hasValidDataListOptions() const { | 1555 bool HTMLInputElement::hasValidDataListOptions() const { |
| 1556 HTMLDataListElement* dataList = this->dataList(); | 1556 HTMLDataListElement* dataList = this->dataList(); |
| 1557 if (!dataList) | 1557 if (!dataList) |
| 1558 return false; | 1558 return false; |
| 1559 HTMLDataListOptionsCollection* options = dataList->options(); | 1559 HTMLDataListOptionsCollection* options = dataList->options(); |
| 1560 for (unsigned i = 0; HTMLOptionElement* option = options->item(i); ++i) { | 1560 for (unsigned i = 0; HTMLOptionElement* option = options->item(i); ++i) { |
| 1561 if (isValidValue(option->value())) | 1561 if (!option->value().isEmpty() && !option->isDisabledFormControl() && |
| 1562 isValidValue(option->value())) |
| 1562 return true; | 1563 return true; |
| 1563 } | 1564 } |
| 1564 return false; | 1565 return false; |
| 1565 } | 1566 } |
| 1566 | 1567 |
| 1567 HeapVector<Member<HTMLOptionElement>> | 1568 HeapVector<Member<HTMLOptionElement>> |
| 1568 HTMLInputElement::filteredDataListOptions() const { | 1569 HTMLInputElement::filteredDataListOptions() const { |
| 1569 HeapVector<Member<HTMLOptionElement>> filtered; | 1570 HeapVector<Member<HTMLOptionElement>> filtered; |
| 1570 HTMLDataListElement* dataList = this->dataList(); | 1571 HTMLDataListElement* dataList = this->dataList(); |
| 1571 if (!dataList) | 1572 if (!dataList) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1586 HTMLOptionElement* option = options->item(i); | 1587 HTMLOptionElement* option = options->item(i); |
| 1587 DCHECK(option); | 1588 DCHECK(option); |
| 1588 if (!value.isEmpty()) { | 1589 if (!value.isEmpty()) { |
| 1589 // Firefox shows OPTIONs with matched labels, Edge shows OPTIONs | 1590 // Firefox shows OPTIONs with matched labels, Edge shows OPTIONs |
| 1590 // with matches values. We show both. | 1591 // with matches values. We show both. |
| 1591 if (option->value().foldCase().find(value) == kNotFound && | 1592 if (option->value().foldCase().find(value) == kNotFound && |
| 1592 option->label().foldCase().find(value) == kNotFound) | 1593 option->label().foldCase().find(value) == kNotFound) |
| 1593 continue; | 1594 continue; |
| 1594 } | 1595 } |
| 1595 // TODO(tkent): Should allow invalid strings. crbug.com/607097. | 1596 // TODO(tkent): Should allow invalid strings. crbug.com/607097. |
| 1596 if (!isValidValue(option->value())) | 1597 if (option->value().isEmpty() || option->isDisabledFormControl() || |
| 1598 !isValidValue(option->value())) |
| 1597 continue; | 1599 continue; |
| 1598 filtered.push_back(option); | 1600 filtered.push_back(option); |
| 1599 } | 1601 } |
| 1600 return filtered; | 1602 return filtered; |
| 1601 } | 1603 } |
| 1602 | 1604 |
| 1603 void HTMLInputElement::setListAttributeTargetObserver( | 1605 void HTMLInputElement::setListAttributeTargetObserver( |
| 1604 ListAttributeTargetObserver* newObserver) { | 1606 ListAttributeTargetObserver* newObserver) { |
| 1605 if (m_listAttributeTargetObserver) | 1607 if (m_listAttributeTargetObserver) |
| 1606 m_listAttributeTargetObserver->unregister(); | 1608 m_listAttributeTargetObserver->unregister(); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1809 } | 1811 } |
| 1810 | 1812 |
| 1811 parameters.anchorRectInScreen = | 1813 parameters.anchorRectInScreen = |
| 1812 document().view()->contentsToScreen(pixelSnappedBoundingBox()); | 1814 document().view()->contentsToScreen(pixelSnappedBoundingBox()); |
| 1813 parameters.doubleValue = m_inputType->valueAsDouble(); | 1815 parameters.doubleValue = m_inputType->valueAsDouble(); |
| 1814 parameters.isAnchorElementRTL = | 1816 parameters.isAnchorElementRTL = |
| 1815 m_inputTypeView->computedTextDirection() == TextDirection::kRtl; | 1817 m_inputTypeView->computedTextDirection() == TextDirection::kRtl; |
| 1816 if (HTMLDataListElement* dataList = this->dataList()) { | 1818 if (HTMLDataListElement* dataList = this->dataList()) { |
| 1817 HTMLDataListOptionsCollection* options = dataList->options(); | 1819 HTMLDataListOptionsCollection* options = dataList->options(); |
| 1818 for (unsigned i = 0; HTMLOptionElement* option = options->item(i); ++i) { | 1820 for (unsigned i = 0; HTMLOptionElement* option = options->item(i); ++i) { |
| 1819 if (!isValidValue(option->value())) | 1821 if (option->value().isEmpty() || option->isDisabledFormControl() || |
| 1822 !isValidValue(option->value())) |
| 1820 continue; | 1823 continue; |
| 1821 DateTimeSuggestion suggestion; | 1824 DateTimeSuggestion suggestion; |
| 1822 suggestion.value = | 1825 suggestion.value = |
| 1823 m_inputType->parseToNumber(option->value(), Decimal::nan()) | 1826 m_inputType->parseToNumber(option->value(), Decimal::nan()) |
| 1824 .toDouble(); | 1827 .toDouble(); |
| 1825 if (std::isnan(suggestion.value)) | 1828 if (std::isnan(suggestion.value)) |
| 1826 continue; | 1829 continue; |
| 1827 suggestion.localizedValue = localizeValue(option->value()); | 1830 suggestion.localizedValue = localizeValue(option->value()); |
| 1828 suggestion.label = | 1831 suggestion.label = |
| 1829 option->value() == option->label() ? String() : option->label(); | 1832 option->value() == option->label() ? String() : option->label(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1880 | 1883 |
| 1881 bool HTMLInputElement::hasFallbackContent() const { | 1884 bool HTMLInputElement::hasFallbackContent() const { |
| 1882 return m_inputTypeView->hasFallbackContent(); | 1885 return m_inputTypeView->hasFallbackContent(); |
| 1883 } | 1886 } |
| 1884 | 1887 |
| 1885 void HTMLInputElement::setFilesFromPaths(const Vector<String>& paths) { | 1888 void HTMLInputElement::setFilesFromPaths(const Vector<String>& paths) { |
| 1886 return m_inputType->setFilesFromPaths(paths); | 1889 return m_inputType->setFilesFromPaths(paths); |
| 1887 } | 1890 } |
| 1888 | 1891 |
| 1889 } // namespace blink | 1892 } // namespace blink |
| OLD | NEW |