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

Side by Side Diff: Source/core/html/HTMLViewSourceDocument.cpp

Issue 108313015: Make calls to AtomicString(const String&) explicit in html/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Take feedback into consideration Created 6 years, 11 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) 2006, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 { 132 {
133 m_current = addSpanWithClassName("webkit-html-tag"); 133 m_current = addSpanWithClassName("webkit-html-tag");
134 134
135 AtomicString tagName(token.name()); 135 AtomicString tagName(token.name());
136 136
137 unsigned index = 0; 137 unsigned index = 0;
138 HTMLToken::AttributeList::const_iterator iter = token.attributes().begin(); 138 HTMLToken::AttributeList::const_iterator iter = token.attributes().begin();
139 while (index < source.length()) { 139 while (index < source.length()) {
140 if (iter == token.attributes().end()) { 140 if (iter == token.attributes().end()) {
141 // We want to show the remaining characters in the token. 141 // We want to show the remaining characters in the token.
142 index = addRange(source, index, source.length(), ""); 142 index = addRange(source, index, source.length(), emptyAtom);
143 ASSERT(index == source.length()); 143 ASSERT(index == source.length());
144 break; 144 break;
145 } 145 }
146 146
147 AtomicString name(iter->name); 147 AtomicString name(iter->name);
148 String value = StringImpl::create8BitIfPossible(iter->value); 148 AtomicString value(StringImpl::create8BitIfPossible(iter->value));
149 149
150 index = addRange(source, index, iter->nameRange.start - token.startIndex (), ""); 150 index = addRange(source, index, iter->nameRange.start - token.startIndex (), emptyAtom);
151 index = addRange(source, index, iter->nameRange.end - token.startIndex() , "webkit-html-attribute-name"); 151 index = addRange(source, index, iter->nameRange.end - token.startIndex() , "webkit-html-attribute-name");
152 152
153 if (tagName == baseTag && name == hrefAttr) 153 if (tagName == baseTag && name == hrefAttr)
154 addBase(value); 154 addBase(value);
155 155
156 index = addRange(source, index, iter->valueRange.start - token.startInde x(), ""); 156 index = addRange(source, index, iter->valueRange.start - token.startInde x(), emptyAtom);
157 157
158 bool isLink = name == srcAttr || name == hrefAttr; 158 bool isLink = name == srcAttr || name == hrefAttr;
159 index = addRange(source, index, iter->valueRange.end - token.startIndex( ), "webkit-html-attribute-value", isLink, tagName == aTag, value); 159 index = addRange(source, index, iter->valueRange.end - token.startIndex( ), "webkit-html-attribute-value", isLink, tagName == aTag, value);
160 160
161 ++iter; 161 ++iter;
162 } 162 }
163 m_current = m_td; 163 m_current = m_td;
164 } 164 }
165 165
166 void HTMLViewSourceDocument::processCommentToken(const String& source, HTMLToken &) 166 void HTMLViewSourceDocument::processCommentToken(const String& source, HTMLToken &)
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 finishLine(); 242 finishLine();
243 continue; 243 continue;
244 } 244 }
245 RefPtr<Text> t = Text::create(*this, substring); 245 RefPtr<Text> t = Text::create(*this, substring);
246 m_current->parserAppendChild(t); 246 m_current->parserAppendChild(t);
247 if (i < size - 1) 247 if (i < size - 1)
248 finishLine(); 248 finishLine();
249 } 249 }
250 } 250 }
251 251
252 int HTMLViewSourceDocument::addRange(const String& source, int start, int end, c onst String& className, bool isLink, bool isAnchor, const String& link) 252 int HTMLViewSourceDocument::addRange(const String& source, int start, int end, c onst AtomicString& className, bool isLink, bool isAnchor, const AtomicString& li nk)
253 { 253 {
254 ASSERT(start <= end); 254 ASSERT(start <= end);
255 if (start == end) 255 if (start == end)
256 return start; 256 return start;
257 257
258 String text = source.substring(start, end - start); 258 String text = source.substring(start, end - start);
259 if (!className.isEmpty()) { 259 if (!className.isEmpty()) {
260 if (isLink) 260 if (isLink)
261 m_current = addLink(link, isAnchor); 261 m_current = addLink(link, isAnchor);
262 else 262 else
(...skipping 26 matching lines...) Expand all
289 else 289 else
290 classValue = "webkit-html-attribute-value webkit-html-resource-link"; 290 classValue = "webkit-html-attribute-value webkit-html-resource-link";
291 anchor->setAttribute(classAttr, classValue); 291 anchor->setAttribute(classAttr, classValue);
292 anchor->setAttribute(targetAttr, "_blank"); 292 anchor->setAttribute(targetAttr, "_blank");
293 anchor->setAttribute(hrefAttr, url); 293 anchor->setAttribute(hrefAttr, url);
294 m_current->parserAppendChild(anchor); 294 m_current->parserAppendChild(anchor);
295 return anchor.release(); 295 return anchor.release();
296 } 296 }
297 297
298 } 298 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698