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

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

Issue 2384273007: reflow comments in core/html/*.{cpp,h},core/html/imports (Closed)
Patch Set: comments Created 4 years, 2 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 * Copyright (C) 2003-2008, 2011, 2012, 2014 Apple Inc. All rights reserved. 4 * Copyright (C) 2003-2008, 2011, 2012, 2014 Apple Inc. All rights reserved.
5 * Copyright (C) 2014 Samsung Electronics. All rights reserved. 5 * Copyright (C) 2014 Samsung Electronics. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 return nullptr; 417 return nullptr;
418 } 418 }
419 419
420 bool HTMLCollection::namedPropertyQuery(const AtomicString& name, 420 bool HTMLCollection::namedPropertyQuery(const AtomicString& name,
421 ExceptionState&) { 421 ExceptionState&) {
422 return namedItem(name); 422 return namedItem(name);
423 } 423 }
424 424
425 void HTMLCollection::supportedPropertyNames(Vector<String>& names) { 425 void HTMLCollection::supportedPropertyNames(Vector<String>& names) {
426 // As per the specification (https://dom.spec.whatwg.org/#htmlcollection): 426 // As per the specification (https://dom.spec.whatwg.org/#htmlcollection):
427 // The supported property names are the values from the list returned by these steps: 427 // The supported property names are the values from the list returned by these
428 // steps:
428 // 1. Let result be an empty list. 429 // 1. Let result be an empty list.
429 // 2. For each element represented by the collection, in tree order, run these substeps: 430 // 2. For each element represented by the collection, in tree order, run these
430 // 1. If element has an ID which is neither the empty string nor is in resul t, append element's ID to result. 431 // substeps:
431 // 2. If element is in the HTML namespace and has a name attribute whose val ue is neither the empty string 432 // 1. If element has an ID which is neither the empty string nor is in
432 // nor is in result, append element's name attribute value to result. 433 // result, append element's ID to result.
434 // 2. If element is in the HTML namespace and has a name attribute whose
435 // value is neither the empty string nor is in result, append element's
436 // name attribute value to result.
433 // 3. Return result. 437 // 3. Return result.
434 HashSet<AtomicString> existingNames; 438 HashSet<AtomicString> existingNames;
435 unsigned length = this->length(); 439 unsigned length = this->length();
436 for (unsigned i = 0; i < length; ++i) { 440 for (unsigned i = 0; i < length; ++i) {
437 Element* element = item(i); 441 Element* element = item(i);
438 const AtomicString& idAttribute = element->getIdAttribute(); 442 const AtomicString& idAttribute = element->getIdAttribute();
439 if (!idAttribute.isEmpty()) { 443 if (!idAttribute.isEmpty()) {
440 HashSet<AtomicString>::AddResult addResult = 444 HashSet<AtomicString>::AddResult addResult =
441 existingNames.add(idAttribute); 445 existingNames.add(idAttribute);
442 if (addResult.isNewEntry) 446 if (addResult.isNewEntry)
(...skipping 30 matching lines...) Expand all
473 if (!idAttrVal.isEmpty()) 477 if (!idAttrVal.isEmpty())
474 cache->addElementWithId(idAttrVal, element); 478 cache->addElementWithId(idAttrVal, element);
475 if (!element->isHTMLElement()) 479 if (!element->isHTMLElement())
476 continue; 480 continue;
477 const AtomicString& nameAttrVal = element->getNameAttribute(); 481 const AtomicString& nameAttrVal = element->getNameAttribute();
478 if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal && 482 if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal &&
479 (type() != DocAll || 483 (type() != DocAll ||
480 nameShouldBeVisibleInDocumentAll(toHTMLElement(*element)))) 484 nameShouldBeVisibleInDocumentAll(toHTMLElement(*element))))
481 cache->addElementWithName(nameAttrVal, element); 485 cache->addElementWithName(nameAttrVal, element);
482 } 486 }
483 // Set the named item cache last as traversing the tree may cause cache invali dation. 487 // Set the named item cache last as traversing the tree may cause cache
488 // invalidation.
484 setNamedItemCache(cache); 489 setNamedItemCache(cache);
485 } 490 }
486 491
487 void HTMLCollection::namedItems(const AtomicString& name, 492 void HTMLCollection::namedItems(const AtomicString& name,
488 HeapVector<Member<Element>>& result) const { 493 HeapVector<Member<Element>>& result) const {
489 DCHECK(result.isEmpty()); 494 DCHECK(result.isEmpty());
490 if (name.isEmpty()) 495 if (name.isEmpty())
491 return; 496 return;
492 497
493 updateIdNameCache(); 498 updateIdNameCache();
(...skipping 12 matching lines...) Expand all
506 511
507 HTMLCollection::NamedItemCache::NamedItemCache() {} 512 HTMLCollection::NamedItemCache::NamedItemCache() {}
508 513
509 DEFINE_TRACE(HTMLCollection) { 514 DEFINE_TRACE(HTMLCollection) {
510 visitor->trace(m_namedItemCache); 515 visitor->trace(m_namedItemCache);
511 visitor->trace(m_collectionItemsCache); 516 visitor->trace(m_collectionItemsCache);
512 LiveNodeListBase::trace(visitor); 517 LiveNodeListBase::trace(visitor);
513 } 518 }
514 519
515 } // namespace blink 520 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLCollection.h ('k') | third_party/WebKit/Source/core/html/HTMLDetailsElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698