Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLInputElement.cpp

Issue 2174303002: Move filtering logic in GetDataListSuggestions() to Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move implementation to HTMLInputElement Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 if (!dataList) 1576 if (!dataList)
1577 return false; 1577 return false;
1578 HTMLDataListOptionsCollection* options = dataList->options(); 1578 HTMLDataListOptionsCollection* options = dataList->options();
1579 for (unsigned i = 0; HTMLOptionElement* option = options->item(i); ++i) { 1579 for (unsigned i = 0; HTMLOptionElement* option = options->item(i); ++i) {
1580 if (isValidValue(option->value())) 1580 if (isValidValue(option->value()))
1581 return true; 1581 return true;
1582 } 1582 }
1583 return false; 1583 return false;
1584 } 1584 }
1585 1585
1586 HeapVector<Member<HTMLOptionElement>> HTMLInputElement::filteredDataListOptions( ) const
1587 {
1588 HeapVector<Member<HTMLOptionElement>> filtered;
1589 HTMLDataListElement* dataList = this->dataList();
1590 if (!dataList)
1591 return filtered;
1592
1593 String prefix = innerEditorValue();
1594 if (multiple() && type() == InputTypeNames::email) {
1595 Vector<String> emails;
1596 prefix.split(',', true, emails);
1597 if (!emails.isEmpty())
1598 prefix = emails.last().stripWhiteSpace();
1599 }
1600
1601 HTMLDataListOptionsCollection* options = dataList->options();
1602 filtered.reserveCapacity(options->length());
1603 prefix = prefix.lower();
1604 for (unsigned i = 0; i < options->length(); ++i) {
1605 HTMLOptionElement* option = options->item(i);
1606 DCHECK(option);
1607 if (!option->value().lower().startsWith(prefix) || !isValidValue(option- >value()))
1608 continue;
1609 filtered.append(option);
1610 }
1611 return filtered;
1612 }
1613
1586 void HTMLInputElement::setListAttributeTargetObserver(ListAttributeTargetObserve r* newObserver) 1614 void HTMLInputElement::setListAttributeTargetObserver(ListAttributeTargetObserve r* newObserver)
1587 { 1615 {
1588 if (m_listAttributeTargetObserver) 1616 if (m_listAttributeTargetObserver)
1589 m_listAttributeTargetObserver->unregister(); 1617 m_listAttributeTargetObserver->unregister();
1590 m_listAttributeTargetObserver = newObserver; 1618 m_listAttributeTargetObserver = newObserver;
1591 } 1619 }
1592 1620
1593 void HTMLInputElement::resetListAttributeTargetObserver() 1621 void HTMLInputElement::resetListAttributeTargetObserver()
1594 { 1622 {
1595 if (isConnected()) 1623 if (isConnected())
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 { 1942 {
1915 return m_inputTypeView->hasFallbackContent(); 1943 return m_inputTypeView->hasFallbackContent();
1916 } 1944 }
1917 1945
1918 void HTMLInputElement::setFilesFromPaths(const Vector<String>& paths) 1946 void HTMLInputElement::setFilesFromPaths(const Vector<String>& paths)
1919 { 1947 {
1920 return m_inputType->setFilesFromPaths(paths); 1948 return m_inputType->setFilesFromPaths(paths);
1921 } 1949 }
1922 1950
1923 } // namespace blink 1951 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698