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

Unified Diff: Source/core/dom/Element.cpp

Issue 645443003: Move parts of core/dom to C++11 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed nit Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Element.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index e6adcbf20803289c0b34ae37f93e15ae70b84cb8..931f3dbbea4078789e0abc53177820f930fef11d 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -129,12 +129,11 @@ typedef WillBeHeapVector<RefPtrWillBeMember<Attr> > AttrNodeList;
static Attr* findAttrNodeInList(const AttrNodeList& attrNodeList, const QualifiedName& name)
{
- AttrNodeList::const_iterator end = attrNodeList.end();
- for (AttrNodeList::const_iterator it = attrNodeList.begin(); it != end; ++it) {
- if ((*it)->qualifiedName() == name)
- return it->get();
+ for (const auto& attr : attrNodeList) {
+ if (attr->qualifiedName() == name)
+ return attr.get();
}
- return 0;
+ return nullptr;
}
PassRefPtrWillBeRawPtr<Element> Element::create(const QualifiedName& tagName, Document* document)
@@ -342,7 +341,7 @@ ActiveAnimations* Element::activeAnimations() const
{
if (hasRareData())
return elementRareData()->activeAnimations();
- return 0;
+ return nullptr;
}
ActiveAnimations& Element::ensureActiveAnimations()
@@ -545,7 +544,7 @@ Element* Element::offsetParentForBindings()
Element* element = offsetParent();
if (!element || !element->isInShadowTree())
return element;
- return element->containingShadowRoot()->shouldExposeToBindings() ? element : 0;
+ return element->containingShadowRoot()->shouldExposeToBindings() ? element : nullptr;
}
Element* Element::offsetParent()
@@ -553,7 +552,7 @@ Element* Element::offsetParent()
document().updateLayoutIgnorePendingStylesheets();
if (RenderObject* renderer = this->renderer())
return renderer->offsetParent();
- return 0;
+ return nullptr;
}
int Element::clientLeft()
@@ -1606,7 +1605,7 @@ void Element::removeCallbackSelectors()
ElementShadow* Element::shadow() const
{
- return hasRareData() ? elementRareData()->shadow() : 0;
+ return hasRareData() ? elementRareData()->shadow() : nullptr;
}
ElementShadow& Element::ensureShadow()
@@ -1666,7 +1665,7 @@ CustomElementDefinition* Element::customElementDefinition() const
{
if (hasRareData())
return elementRareData()->customElementDefinition();
- return 0;
+ return nullptr;
}
PassRefPtrWillBeRawPtr<ShadowRoot> Element::createShadowRoot(ExceptionState& exceptionState)
@@ -1689,11 +1688,11 @@ ShadowRoot* Element::shadowRoot() const
{
ElementShadow* elementShadow = shadow();
if (!elementShadow)
- return 0;
+ return nullptr;
ShadowRoot* shadowRoot = elementShadow->youngestShadowRoot();
if (shadowRoot->type() == ShadowRoot::AuthorShadowRoot)
return shadowRoot;
- return 0;
+ return nullptr;
}
ShadowRoot* Element::userAgentShadowRoot() const
@@ -1705,7 +1704,7 @@ ShadowRoot* Element::userAgentShadowRoot() const
}
}
- return 0;
+ return nullptr;
}
ShadowRoot& Element::ensureUserAgentShadowRoot()
@@ -1796,9 +1795,9 @@ void Element::formatForDebugger(char* buffer, unsigned length) const
}
#endif
-WillBeHeapVector<RefPtrWillBeMember<Attr> >* Element::attrNodeList()
+WillBeHeapVector<RefPtrWillBeMember<Attr>>* Element::attrNodeList()
{
- return hasRareData() ? elementRareData()->attrNodeList() : 0;
+ return hasRareData() ? elementRareData()->attrNodeList() : nullptr;
}
WillBeHeapVector<RefPtrWillBeMember<Attr> >& Element::ensureAttrNodeList()
@@ -2222,7 +2221,7 @@ void Element::setOuterHTML(const String& html, ExceptionState& exceptionState)
return;
parent->replaceChild(fragment.release(), this, exceptionState);
- RefPtrWillBeRawPtr<Node> node = next ? next->previousSibling() : 0;
+ RefPtrWillBeRawPtr<Node> node = next ? next->previousSibling() : nullptr;
if (!exceptionState.hadException() && node && node->isTextNode())
mergeWithNextTextNode(toText(node.get()), exceptionState);
@@ -2238,17 +2237,17 @@ Node* Element::insertAdjacent(const String& where, Node* newChild, ExceptionStat
if (!exceptionState.hadException())
return newChild;
}
- return 0;
+ return nullptr;
}
if (equalIgnoringCase(where, "afterBegin")) {
insertBefore(newChild, firstChild(), exceptionState);
- return exceptionState.hadException() ? 0 : newChild;
+ return exceptionState.hadException() ? nullptr : newChild;
}
if (equalIgnoringCase(where, "beforeEnd")) {
appendChild(newChild, exceptionState);
- return exceptionState.hadException() ? 0 : newChild;
+ return exceptionState.hadException() ? nullptr : newChild;
}
if (equalIgnoringCase(where, "afterEnd")) {
@@ -2257,11 +2256,11 @@ Node* Element::insertAdjacent(const String& where, Node* newChild, ExceptionStat
if (!exceptionState.hadException())
return newChild;
}
- return 0;
+ return nullptr;
}
exceptionState.throwDOMException(SyntaxError, "The value provided ('" + where + "') is not one of 'beforeBegin', 'afterBegin', 'beforeEnd', or 'afterEnd'.");
- return 0;
+ return nullptr;
}
// Step 1 of http://domparsing.spec.whatwg.org/#insertadjacenthtml()
@@ -2271,14 +2270,14 @@ static Element* contextElementForInsertion(const String& where, Element* element
Element* parent = element->parentElement();
if (!parent) {
exceptionState.throwDOMException(NoModificationAllowedError, "The element has no parent.");
- return 0;
+ return nullptr;
}
return parent;
}
if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "beforeEnd"))
return element;
exceptionState.throwDOMException(SyntaxError, "The value provided ('" + where + "') is not one of 'beforeBegin', 'afterBegin', 'beforeEnd', or 'afterEnd'.");
- return 0;
+ return nullptr;
}
Element* Element::insertAdjacentElement(const String& where, Element* newChild, ExceptionState& exceptionState)
@@ -2286,7 +2285,7 @@ Element* Element::insertAdjacentElement(const String& where, Element* newChild,
if (!newChild) {
// IE throws COM Exception E_INVALIDARG; this is the best DOM exception alternative.
exceptionState.throwTypeError("The node provided is null.");
- return 0;
+ return nullptr;
}
Node* returnValue = insertAdjacent(where, newChild, exceptionState);
@@ -2421,7 +2420,7 @@ RenderStyle* Element::computedStyle(PseudoId pseudoElementSpecifier)
if (!inActiveDocument()) {
// FIXME: Try to do better than this. Ensure that styleForElement() works for elements that are not in the
// document tree and figure out when to destroy the computed style for such elements.
- return 0;
+ return nullptr;
}
// FIXME: Find and use the renderer from the pseudo element instead of the actual element so that the 'length'
@@ -2578,14 +2577,14 @@ void Element::createPseudoElementIfNeeded(PseudoId pseudoId)
PseudoElement* Element::pseudoElement(PseudoId pseudoId) const
{
- return hasRareData() ? elementRareData()->pseudoElement(pseudoId) : 0;
+ return hasRareData() ? elementRareData()->pseudoElement(pseudoId) : nullptr;
}
RenderObject* Element::pseudoElementRenderer(PseudoId pseudoId) const
{
if (PseudoElement* element = pseudoElement(pseudoId))
return element->renderer();
- return 0;
+ return nullptr;
}
bool Element::matches(const String& selectors, ExceptionState& exceptionState)
@@ -3085,7 +3084,7 @@ void Element::synchronizeStyleAttributeInternal() const
CSSStyleDeclaration* Element::style()
{
if (!isStyledElement())
- return 0;
+ return nullptr;
return &ensureElementRareData().ensureInlineCSSStyleDeclaration(this);
}
« no previous file with comments | « Source/core/dom/Element.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698