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

Side by Side Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 2912383002: Add support for Element.getAttributeNames() (Closed)
Patch Set: Removed redundant file Created 3 years, 6 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 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * (C) 2007 Eric Seidel (eric@webkit.org) 9 * (C) 2007 Eric Seidel (eric@webkit.org)
10 * 10 *
(...skipping 2806 matching lines...) Expand 10 before | Expand all | Expand 10 after
2817 HasEventListeners(EventTypeNames::keyup)) 2817 HasEventListeners(EventTypeNames::keyup))
2818 return true; 2818 return true;
2819 if (!IsSVGElement()) 2819 if (!IsSVGElement())
2820 return false; 2820 return false;
2821 return (HasEventListeners(EventTypeNames::focus) || 2821 return (HasEventListeners(EventTypeNames::focus) ||
2822 HasEventListeners(EventTypeNames::blur) || 2822 HasEventListeners(EventTypeNames::blur) ||
2823 HasEventListeners(EventTypeNames::focusin) || 2823 HasEventListeners(EventTypeNames::focusin) ||
2824 HasEventListeners(EventTypeNames::focusout)); 2824 HasEventListeners(EventTypeNames::focusout));
2825 } 2825 }
2826 2826
2827 Vector<AtomicString> Element::getAttributeNames() const {
tkent 2017/06/01 23:48:10 nit: I'd like to move this next to attributesForBi
Shanmuga Pandi 2017/06/02 05:21:51 Done.
2828 Vector<AtomicString> attributesVector;
2829 if (!hasAttributes())
2830 return attributesVector;
2831
2832 AttributeCollection attributes = element_data_->Attributes();
2833 attributesVector.ReserveInitialCapacity(attributes.size());
2834 for (const Attribute& attr : attributes)
2835 attributesVector.UncheckedAppend(attr.GetName().ToString());
2836 return attributesVector;
2837 }
2838
2827 bool Element::IsFocusable() const { 2839 bool Element::IsFocusable() const {
2828 // Style cannot be cleared out for non-active documents, so in that case the 2840 // Style cannot be cleared out for non-active documents, so in that case the
2829 // needsLayoutTreeUpdateForNode check is invalid. 2841 // needsLayoutTreeUpdateForNode check is invalid.
2830 DCHECK(!GetDocument().IsActive() || 2842 DCHECK(!GetDocument().IsActive() ||
2831 !GetDocument().NeedsLayoutTreeUpdateForNode(*this)); 2843 !GetDocument().NeedsLayoutTreeUpdateForNode(*this));
2832 return isConnected() && SupportsFocus() && !IsInert() && 2844 return isConnected() && SupportsFocus() && !IsInert() &&
2833 LayoutObjectIsFocusable(); 2845 LayoutObjectIsFocusable();
2834 } 2846 }
2835 2847
2836 bool Element::IsKeyboardFocusable() const { 2848 bool Element::IsKeyboardFocusable() const {
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after
4352 } 4364 }
4353 4365
4354 DEFINE_TRACE_WRAPPERS(Element) { 4366 DEFINE_TRACE_WRAPPERS(Element) {
4355 if (HasRareData()) { 4367 if (HasRareData()) {
4356 visitor->TraceWrappers(GetElementRareData()); 4368 visitor->TraceWrappers(GetElementRareData());
4357 } 4369 }
4358 ContainerNode::TraceWrappers(visitor); 4370 ContainerNode::TraceWrappers(visitor);
4359 } 4371 }
4360 4372
4361 } // namespace blink 4373 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698