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

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

Issue 488763002: Introduce HTMLDataListOptionsCollection subclass for HTMLCollection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 #include "core/events/ScopedEventQueue.h" 50 #include "core/events/ScopedEventQueue.h"
51 #include "core/events/TouchEvent.h" 51 #include "core/events/TouchEvent.h"
52 #include "core/fileapi/FileList.h" 52 #include "core/fileapi/FileList.h"
53 #include "core/frame/EventHandlerRegistry.h" 53 #include "core/frame/EventHandlerRegistry.h"
54 #include "core/frame/FrameHost.h" 54 #include "core/frame/FrameHost.h"
55 #include "core/frame/FrameView.h" 55 #include "core/frame/FrameView.h"
56 #include "core/frame/LocalFrame.h" 56 #include "core/frame/LocalFrame.h"
57 #include "core/frame/UseCounter.h" 57 #include "core/frame/UseCounter.h"
58 #include "core/html/HTMLCollection.h" 58 #include "core/html/HTMLCollection.h"
59 #include "core/html/HTMLDataListElement.h" 59 #include "core/html/HTMLDataListElement.h"
60 #include "core/html/HTMLDataListOptionsCollection.h"
60 #include "core/html/HTMLFormElement.h" 61 #include "core/html/HTMLFormElement.h"
61 #include "core/html/HTMLImageLoader.h" 62 #include "core/html/HTMLImageLoader.h"
62 #include "core/html/HTMLOptionElement.h" 63 #include "core/html/HTMLOptionElement.h"
63 #include "core/html/forms/ColorInputType.h" 64 #include "core/html/forms/ColorInputType.h"
64 #include "core/html/forms/FileInputType.h" 65 #include "core/html/forms/FileInputType.h"
65 #include "core/html/forms/FormController.h" 66 #include "core/html/forms/FormController.h"
66 #include "core/html/forms/InputType.h" 67 #include "core/html/forms/InputType.h"
67 #include "core/html/forms/SearchInputType.h" 68 #include "core/html/forms/SearchInputType.h"
68 #include "core/html/parser/HTMLParserIdioms.h" 69 #include "core/html/parser/HTMLParserIdioms.h"
69 #include "core/html/shadow/ShadowElementNames.h" 70 #include "core/html/shadow/ShadowElementNames.h"
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 return 0; 1513 return 0;
1513 1514
1514 return toHTMLDataListElement(element); 1515 return toHTMLDataListElement(element);
1515 } 1516 }
1516 1517
1517 bool HTMLInputElement::hasValidDataListOptions() const 1518 bool HTMLInputElement::hasValidDataListOptions() const
1518 { 1519 {
1519 HTMLDataListElement* dataList = this->dataList(); 1520 HTMLDataListElement* dataList = this->dataList();
1520 if (!dataList) 1521 if (!dataList)
1521 return false; 1522 return false;
1522 RefPtrWillBeRawPtr<HTMLCollection> options = dataList->options(); 1523 RefPtrWillBeRawPtr<HTMLDataListOptionsCollection> options = dataList->option s();
1523 for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement(options ->item(i)); ++i) { 1524 for (unsigned i = 0; HTMLOptionElement* option = options->item(i); ++i) {
1524 if (isValidValue(option->value())) 1525 if (isValidValue(option->value()))
1525 return true; 1526 return true;
1526 } 1527 }
1527 return false; 1528 return false;
1528 } 1529 }
1529 1530
1530 void HTMLInputElement::setListAttributeTargetObserver(PassOwnPtrWillBeRawPtr<Lis tAttributeTargetObserver> newObserver) 1531 void HTMLInputElement::setListAttributeTargetObserver(PassOwnPtrWillBeRawPtr<Lis tAttributeTargetObserver> newObserver)
1531 { 1532 {
1532 if (m_listAttributeTargetObserver) 1533 if (m_listAttributeTargetObserver)
1533 m_listAttributeTargetObserver->unregister(); 1534 m_listAttributeTargetObserver->unregister();
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 } else { 1829 } else {
1829 parameters.step = 1.0; 1830 parameters.step = 1.0;
1830 parameters.stepBase = 0; 1831 parameters.stepBase = 0;
1831 } 1832 }
1832 1833
1833 parameters.anchorRectInRootView = document().view()->contentsToRootView(pixe lSnappedBoundingBox()); 1834 parameters.anchorRectInRootView = document().view()->contentsToRootView(pixe lSnappedBoundingBox());
1834 parameters.currentValue = value(); 1835 parameters.currentValue = value();
1835 parameters.doubleValue = m_inputType->valueAsDouble(); 1836 parameters.doubleValue = m_inputType->valueAsDouble();
1836 parameters.isAnchorElementRTL = m_inputType->computedTextDirection() == RTL; 1837 parameters.isAnchorElementRTL = m_inputType->computedTextDirection() == RTL;
1837 if (HTMLDataListElement* dataList = this->dataList()) { 1838 if (HTMLDataListElement* dataList = this->dataList()) {
1838 RefPtrWillBeRawPtr<HTMLCollection> options = dataList->options(); 1839 RefPtrWillBeRawPtr<HTMLDataListOptionsCollection> options = dataList->op tions();
1839 for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement(opt ions->item(i)); ++i) { 1840 for (unsigned i = 0; HTMLOptionElement* option = options->item(i); ++i) {
1840 if (!isValidValue(option->value())) 1841 if (!isValidValue(option->value()))
1841 continue; 1842 continue;
1842 DateTimeSuggestion suggestion; 1843 DateTimeSuggestion suggestion;
1843 suggestion.value = m_inputType->parseToNumber(option->value(), Decim al::nan()).toDouble(); 1844 suggestion.value = m_inputType->parseToNumber(option->value(), Decim al::nan()).toDouble();
1844 if (std::isnan(suggestion.value)) 1845 if (std::isnan(suggestion.value))
1845 continue; 1846 continue;
1846 suggestion.localizedValue = localizeValue(option->value()); 1847 suggestion.localizedValue = localizeValue(option->value());
1847 suggestion.label = option->value() == option->label() ? String() : o ption->label(); 1848 suggestion.label = option->value() == option->label() ? String() : o ption->label();
1848 parameters.suggestions.append(suggestion); 1849 parameters.suggestions.append(suggestion);
1849 } 1850 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 { 1886 {
1886 return m_inputType->shouldDispatchFormControlChangeEvent(oldValue, newValue) ; 1887 return m_inputType->shouldDispatchFormControlChangeEvent(oldValue, newValue) ;
1887 } 1888 }
1888 1889
1889 void HTMLInputElement::didNotifySubtreeInsertionsToDocument() 1890 void HTMLInputElement::didNotifySubtreeInsertionsToDocument()
1890 { 1891 {
1891 listAttributeTargetChanged(); 1892 listAttributeTargetChanged();
1892 } 1893 }
1893 1894
1894 } // namespace 1895 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698