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

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

Issue 656723005: Use C++11 features in core/html (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: mike's comments Created 6 years, 1 month 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
« no previous file with comments | « Source/core/html/HTMLImageElement.cpp ('k') | Source/core/html/HTMLKeygenElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 setNeedsValidityCheck(); 1097 setNeedsValidityCheck();
1098 1098
1099 // Clear autofill flag (and yellow background) on user edit. 1099 // Clear autofill flag (and yellow background) on user edit.
1100 setAutofilled(false); 1100 setAutofilled(false);
1101 } 1101 }
1102 1102
1103 void* HTMLInputElement::preDispatchEventHandler(Event* event) 1103 void* HTMLInputElement::preDispatchEventHandler(Event* event)
1104 { 1104 {
1105 if (event->type() == EventTypeNames::textInput && m_inputTypeView->shouldSub mitImplicitly(event)) { 1105 if (event->type() == EventTypeNames::textInput && m_inputTypeView->shouldSub mitImplicitly(event)) {
1106 event->stopPropagation(); 1106 event->stopPropagation();
1107 return 0; 1107 return nullptr;
1108 } 1108 }
1109 if (event->type() != EventTypeNames::click) 1109 if (event->type() != EventTypeNames::click)
1110 return 0; 1110 return nullptr;
1111 if (!event->isMouseEvent() || toMouseEvent(event)->button() != LeftButton) 1111 if (!event->isMouseEvent() || toMouseEvent(event)->button() != LeftButton)
1112 return 0; 1112 return nullptr;
1113 #if ENABLE(OILPAN) 1113 #if ENABLE(OILPAN)
1114 return m_inputTypeView->willDispatchClick(); 1114 return m_inputTypeView->willDispatchClick();
1115 #else 1115 #else
1116 // FIXME: Check whether there are any cases where this actually ends up leak ing. 1116 // FIXME: Check whether there are any cases where this actually ends up leak ing.
1117 return m_inputTypeView->willDispatchClick().leakPtr(); 1117 return m_inputTypeView->willDispatchClick().leakPtr();
1118 #endif 1118 #endif
1119 } 1119 }
1120 1120
1121 void HTMLInputElement::postDispatchEventHandler(Event* event, void* dataFromPreD ispatch) 1121 void HTMLInputElement::postDispatchEventHandler(Event* event, void* dataFromPreD ispatch)
1122 { 1122 {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 } 1266 }
1267 1267
1268 static Vector<String> parseAcceptAttribute(const String& acceptString, bool (*pr edicate)(const String&)) 1268 static Vector<String> parseAcceptAttribute(const String& acceptString, bool (*pr edicate)(const String&))
1269 { 1269 {
1270 Vector<String> types; 1270 Vector<String> types;
1271 if (acceptString.isEmpty()) 1271 if (acceptString.isEmpty())
1272 return types; 1272 return types;
1273 1273
1274 Vector<String> splitTypes; 1274 Vector<String> splitTypes;
1275 acceptString.split(',', false, splitTypes); 1275 acceptString.split(',', false, splitTypes);
1276 for (size_t i = 0; i < splitTypes.size(); ++i) { 1276 for (const String& splitType : splitTypes) {
1277 String trimmedType = stripLeadingAndTrailingHTMLSpaces(splitTypes[i]); 1277 String trimmedType = stripLeadingAndTrailingHTMLSpaces(splitType);
1278 if (trimmedType.isEmpty()) 1278 if (trimmedType.isEmpty())
1279 continue; 1279 continue;
1280 if (!predicate(trimmedType)) 1280 if (!predicate(trimmedType))
1281 continue; 1281 continue;
1282 types.append(trimmedType.lower()); 1282 types.append(trimmedType.lower());
1283 } 1283 }
1284 1284
1285 return types; 1285 return types;
1286 } 1286 }
1287 1287
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 } 1524 }
1525 1525
1526 HTMLElement* HTMLInputElement::list() const 1526 HTMLElement* HTMLInputElement::list() const
1527 { 1527 {
1528 return dataList(); 1528 return dataList();
1529 } 1529 }
1530 1530
1531 HTMLDataListElement* HTMLInputElement::dataList() const 1531 HTMLDataListElement* HTMLInputElement::dataList() const
1532 { 1532 {
1533 if (!m_hasNonEmptyList) 1533 if (!m_hasNonEmptyList)
1534 return 0; 1534 return nullptr;
1535 1535
1536 if (!m_inputType->shouldRespectListAttribute()) 1536 if (!m_inputType->shouldRespectListAttribute())
1537 return 0; 1537 return nullptr;
1538 1538
1539 Element* element = treeScope().getElementById(fastGetAttribute(listAttr)); 1539 Element* element = treeScope().getElementById(fastGetAttribute(listAttr));
1540 if (!element) 1540 if (!element)
1541 return 0; 1541 return nullptr;
1542 if (!isHTMLDataListElement(*element)) 1542 if (!isHTMLDataListElement(*element))
1543 return 0; 1543 return nullptr;
1544 1544
1545 return toHTMLDataListElement(element); 1545 return toHTMLDataListElement(element);
1546 } 1546 }
1547 1547
1548 bool HTMLInputElement::hasValidDataListOptions() const 1548 bool HTMLInputElement::hasValidDataListOptions() const
1549 { 1549 {
1550 HTMLDataListElement* dataList = this->dataList(); 1550 HTMLDataListElement* dataList = this->dataList();
1551 if (!dataList) 1551 if (!dataList)
1552 return false; 1552 return false;
1553 RefPtrWillBeRawPtr<HTMLDataListOptionsCollection> options = dataList->option s(); 1553 RefPtrWillBeRawPtr<HTMLDataListOptionsCollection> options = dataList->option s();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 return scope->isInRequiredGroup(this); 1666 return scope->isInRequiredGroup(this);
1667 return false; 1667 return false;
1668 } 1668 }
1669 1669
1670 HTMLInputElement* HTMLInputElement::checkedRadioButtonForGroup() 1670 HTMLInputElement* HTMLInputElement::checkedRadioButtonForGroup()
1671 { 1671 {
1672 if (checked()) 1672 if (checked())
1673 return this; 1673 return this;
1674 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) 1674 if (RadioButtonGroupScope* scope = radioButtonGroupScope())
1675 return scope->checkedButtonForGroup(name()); 1675 return scope->checkedButtonForGroup(name());
1676 return 0; 1676 return nullptr;
1677 } 1677 }
1678 1678
1679 RadioButtonGroupScope* HTMLInputElement::radioButtonGroupScope() const 1679 RadioButtonGroupScope* HTMLInputElement::radioButtonGroupScope() const
1680 { 1680 {
1681 // FIXME: Remove type check. 1681 // FIXME: Remove type check.
1682 if (type() != InputTypeNames::radio) 1682 if (type() != InputTypeNames::radio)
1683 return 0; 1683 return nullptr;
1684 if (HTMLFormElement* formElement = form()) 1684 if (HTMLFormElement* formElement = form())
1685 return &formElement->radioButtonGroupScope(); 1685 return &formElement->radioButtonGroupScope();
1686 if (inDocument()) 1686 if (inDocument())
1687 return &document().formController().radioButtonGroupScope(); 1687 return &document().formController().radioButtonGroupScope();
1688 return 0; 1688 return nullptr;
1689 } 1689 }
1690 1690
1691 inline void HTMLInputElement::addToRadioButtonGroup() 1691 inline void HTMLInputElement::addToRadioButtonGroup()
1692 { 1692 {
1693 if (RadioButtonGroupScope* scope = radioButtonGroupScope()) 1693 if (RadioButtonGroupScope* scope = radioButtonGroupScope())
1694 scope->addButton(this); 1694 scope->addButton(this);
1695 } 1695 }
1696 1696
1697 inline void HTMLInputElement::removeFromRadioButtonGroup() 1697 inline void HTMLInputElement::removeFromRadioButtonGroup()
1698 { 1698 {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1847 { 1847 {
1848 listAttributeTargetChanged(); 1848 listAttributeTargetChanged();
1849 } 1849 }
1850 1850
1851 AXObject* HTMLInputElement::popupRootAXObject() 1851 AXObject* HTMLInputElement::popupRootAXObject()
1852 { 1852 {
1853 return m_inputTypeView->popupRootAXObject(); 1853 return m_inputTypeView->popupRootAXObject();
1854 } 1854 }
1855 1855
1856 } // namespace 1856 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/HTMLImageElement.cpp ('k') | Source/core/html/HTMLKeygenElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698