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

Unified Diff: Source/core/html/HTMLImageElement.cpp

Issue 99333011: Make sure getAttribute() / setAttribute() callers use AtomicStrings (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years 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/html/HTMLImageElement.h ('k') | Source/core/html/HTMLInputElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLImageElement.cpp
diff --git a/Source/core/html/HTMLImageElement.cpp b/Source/core/html/HTMLImageElement.cpp
index 08b6811e501f3f50228d21a52609c2c7409433c8..1145fea772414d5019a2dc4acad3869719a83976 100644
--- a/Source/core/html/HTMLImageElement.cpp
+++ b/Source/core/html/HTMLImageElement.cpp
@@ -144,16 +144,15 @@ void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr
HTMLElement::parseAttribute(name, value);
}
-String HTMLImageElement::altText() const
+const AtomicString& HTMLImageElement::altText() const
{
// lets figure out the alt text.. magic stuff
// http://www.w3.org/TR/1998/REC-html40-19980424/appendix/notes.html#altgen
// also heavily discussed by Hixie on bugzilla
- String alt = getAttribute(altAttr);
+ if (!getAttribute(altAttr).isNull())
+ return getAttribute(altAttr);
// fall back to title attribute
- if (alt.isNull())
- alt = getAttribute(titleAttr);
- return alt;
+ return getAttribute(titleAttr);
}
RenderObject* HTMLImageElement::createRenderer(RenderStyle* style)
@@ -319,7 +318,7 @@ KURL HTMLImageElement::src() const
void HTMLImageElement::setSrc(const String& value)
{
- setAttribute(srcAttr, value);
+ setAttribute(srcAttr, AtomicString(value));
}
void HTMLImageElement::setWidth(int value)
« no previous file with comments | « Source/core/html/HTMLImageElement.h ('k') | Source/core/html/HTMLInputElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698