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

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

Issue 2723053002: Use the correct case converter for |localName| and |tagName| (Closed)
Patch Set: Oops... Created 3 years, 9 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) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. 4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved.
5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
6 * (http://www.torchmobile.com/) 6 * (http://www.torchmobile.com/)
7 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 7 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return true; 107 return true;
108 return !node.isElementNode() && node.parentNode()->isHTMLElement(); 108 return !node.isElementNode() && node.parentNode()->isHTMLElement();
109 } 109 }
110 110
111 } // anonymous namespace 111 } // anonymous namespace
112 112
113 DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(HTMLElement); 113 DEFINE_ELEMENT_FACTORY_WITH_TAGNAME(HTMLElement);
114 114
115 String HTMLElement::debugNodeName() const { 115 String HTMLElement::debugNodeName() const {
116 if (document().isHTMLDocument()) { 116 if (document().isHTMLDocument()) {
117 return tagQName().hasPrefix() ? Element::nodeName().upper() 117 return tagQName().hasPrefix() ? Element::nodeName().upperASCII()
118 : tagQName().localName().upper(); 118 : tagQName().localName().upperASCII();
119 } 119 }
120 return Element::nodeName(); 120 return Element::nodeName();
121 } 121 }
122 122
123 String HTMLElement::nodeName() const { 123 String HTMLElement::nodeName() const {
124 // localNameUpper may intern and cache an AtomicString. 124 // localNameUpper may intern and cache an AtomicString.
125 DCHECK(isMainThread()); 125 DCHECK(isMainThread());
126 126
127 // FIXME: Would be nice to have an atomicstring lookup based off uppercase 127 // FIXME: Would be nice to have an atomicstring lookup based off uppercase
128 // chars that does not have to copy the string on a hit in the hash. 128 // chars that does not have to copy the string on a hit in the hash.
129 // FIXME: We should have a way to detect XHTML elements and replace the 129 // FIXME: We should have a way to detect XHTML elements and replace the
130 // hasPrefix() check with it. 130 // hasPrefix() check with it.
131 if (document().isHTMLDocument()) { 131 if (document().isHTMLDocument()) {
132 if (!tagQName().hasPrefix()) 132 if (!tagQName().hasPrefix())
133 return tagQName().localNameUpper(); 133 return tagQName().localNameUpper();
134 return Element::nodeName().upper(); 134 return Element::nodeName().upperASCII();
135 } 135 }
136 return Element::nodeName(); 136 return Element::nodeName();
137 } 137 }
138 138
139 bool HTMLElement::shouldSerializeEndTag() const { 139 bool HTMLElement::shouldSerializeEndTag() const {
140 // See https://www.w3.org/TR/DOM-Parsing/ 140 // See https://www.w3.org/TR/DOM-Parsing/
141 if (hasTagName(areaTag) || hasTagName(baseTag) || hasTagName(basefontTag) || 141 if (hasTagName(areaTag) || hasTagName(baseTag) || hasTagName(basefontTag) ||
142 hasTagName(bgsoundTag) || hasTagName(brTag) || hasTagName(colTag) || 142 hasTagName(bgsoundTag) || hasTagName(brTag) || hasTagName(colTag) ||
143 hasTagName(embedTag) || hasTagName(frameTag) || hasTagName(hrTag) || 143 hasTagName(embedTag) || hasTagName(frameTag) || hasTagName(hrTag) ||
144 hasTagName(imgTag) || hasTagName(inputTag) || hasTagName(keygenTag) || 144 hasTagName(imgTag) || hasTagName(inputTag) || hasTagName(keygenTag) ||
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 1179
1180 #ifndef NDEBUG 1180 #ifndef NDEBUG
1181 1181
1182 // For use in the debugger 1182 // For use in the debugger
1183 void dumpInnerHTML(blink::HTMLElement*); 1183 void dumpInnerHTML(blink::HTMLElement*);
1184 1184
1185 void dumpInnerHTML(blink::HTMLElement* element) { 1185 void dumpInnerHTML(blink::HTMLElement* element) {
1186 printf("%s\n", element->innerHTML().ascii().data()); 1186 printf("%s\n", element->innerHTML().ascii().data());
1187 } 1187 }
1188 #endif 1188 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/QualifiedName.cpp ('k') | third_party/WebKit/Source/wtf/text/AtomicString.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698