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

Side by Side Diff: Source/core/html/HTMLOptionElement.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/HTMLObjectElement.cpp ('k') | Source/core/html/HTMLOptionsCollection.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 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 5 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
6 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2010 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * Copyright (C) 2011 Motorola Mobility, Inc. All rights reserved. 8 * Copyright (C) 2011 Motorola Mobility, Inc. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 int HTMLOptionElement::index() const 154 int HTMLOptionElement::index() const
155 { 155 {
156 // It would be faster to cache the index, but harder to get it right in all cases. 156 // It would be faster to cache the index, but harder to get it right in all cases.
157 157
158 HTMLSelectElement* selectElement = ownerSelectElement(); 158 HTMLSelectElement* selectElement = ownerSelectElement();
159 if (!selectElement) 159 if (!selectElement)
160 return 0; 160 return 0;
161 161
162 int optionIndex = 0; 162 int optionIndex = 0;
163 163
164 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement> >& items = selectElem ent->listItems(); 164 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& items = selectEleme nt->listItems();
165 size_t length = items.size(); 165 size_t length = items.size();
166 for (size_t i = 0; i < length; ++i) { 166 for (size_t i = 0; i < length; ++i) {
167 if (!isHTMLOptionElement(*items[i])) 167 if (!isHTMLOptionElement(*items[i]))
168 continue; 168 continue;
169 if (items[i].get() == this) 169 if (items[i].get() == this)
170 return optionIndex; 170 return optionIndex;
171 ++optionIndex; 171 ++optionIndex;
172 } 172 }
173 173
174 return 0; 174 return 0;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 node = NodeTraversal::next(*node, this); 370 node = NodeTraversal::next(*node, this);
371 } 371 }
372 return text.toString(); 372 return text.toString();
373 } 373 }
374 374
375 HTMLFormElement* HTMLOptionElement::form() const 375 HTMLFormElement* HTMLOptionElement::form() const
376 { 376 {
377 if (HTMLSelectElement* selectElement = ownerSelectElement()) 377 if (HTMLSelectElement* selectElement = ownerSelectElement())
378 return selectElement->formOwner(); 378 return selectElement->formOwner();
379 379
380 return 0; 380 return nullptr;
381 } 381 }
382 382
383 void HTMLOptionElement::didAddUserAgentShadowRoot(ShadowRoot& root) 383 void HTMLOptionElement::didAddUserAgentShadowRoot(ShadowRoot& root)
384 { 384 {
385 updateLabel(); 385 updateLabel();
386 } 386 }
387 387
388 void HTMLOptionElement::updateLabel() 388 void HTMLOptionElement::updateLabel()
389 { 389 {
390 if (ShadowRoot* root = userAgentShadowRoot()) 390 if (ShadowRoot* root = userAgentShadowRoot())
(...skipping 20 matching lines...) Expand all
411 ASSERT(parent); 411 ASSERT(parent);
412 if (isHTMLOptGroupElement(*parent)) { 412 if (isHTMLOptGroupElement(*parent)) {
413 RenderStyle* parentStyle = parent->renderStyle() ? parent->renderSty le() : parent->computedStyle(); 413 RenderStyle* parentStyle = parent->renderStyle() ? parent->renderSty le() : parent->computedStyle();
414 return !parentStyle || parentStyle->display() == NONE; 414 return !parentStyle || parentStyle->display() == NONE;
415 } 415 }
416 } 416 }
417 return m_style->display() == NONE; 417 return m_style->display() == NONE;
418 } 418 }
419 419
420 } // namespace blink 420 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/HTMLObjectElement.cpp ('k') | Source/core/html/HTMLOptionsCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698