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

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

Issue 2258033002: Replace ASSERT()s with DCHECK*() in core/html/*.{cpp,h}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace ASSERT()s with DCHECK*() in core/html/*.{cpp,h}. Created 4 years, 4 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 m_lineNumber = 0; 90 m_lineNumber = 0;
91 } 91 }
92 92
93 void HTMLViewSourceDocument::addSource(const String& source, HTMLToken& token, S ourceAnnotation annotation) 93 void HTMLViewSourceDocument::addSource(const String& source, HTMLToken& token, S ourceAnnotation annotation)
94 { 94 {
95 if (!m_current) 95 if (!m_current)
96 createContainingTable(); 96 createContainingTable();
97 97
98 switch (token.type()) { 98 switch (token.type()) {
99 case HTMLToken::Uninitialized: 99 case HTMLToken::Uninitialized:
100 ASSERT_NOT_REACHED(); 100 NOTREACHED();
101 break; 101 break;
102 case HTMLToken::DOCTYPE: 102 case HTMLToken::DOCTYPE:
103 processDoctypeToken(source, token); 103 processDoctypeToken(source, token);
104 break; 104 break;
105 case HTMLToken::EndOfFile: 105 case HTMLToken::EndOfFile:
106 processEndOfFileToken(source, token); 106 processEndOfFileToken(source, token);
107 break; 107 break;
108 case HTMLToken::StartTag: 108 case HTMLToken::StartTag:
109 case HTMLToken::EndTag: 109 case HTMLToken::EndTag:
110 processTagToken(source, token, annotation); 110 processTagToken(source, token, annotation);
(...skipping 27 matching lines...) Expand all
138 m_current = addSpanWithClassName("html-tag"); 138 m_current = addSpanWithClassName("html-tag");
139 139
140 AtomicString tagName(token.name()); 140 AtomicString tagName(token.name());
141 141
142 unsigned index = 0; 142 unsigned index = 0;
143 HTMLToken::AttributeList::const_iterator iter = token.attributes().begin(); 143 HTMLToken::AttributeList::const_iterator iter = token.attributes().begin();
144 while (index < source.length()) { 144 while (index < source.length()) {
145 if (iter == token.attributes().end()) { 145 if (iter == token.attributes().end()) {
146 // We want to show the remaining characters in the token. 146 // We want to show the remaining characters in the token.
147 index = addRange(source, index, source.length(), emptyAtom); 147 index = addRange(source, index, source.length(), emptyAtom);
148 ASSERT(index == source.length()); 148 DCHECK_EQ(index, source.length());
149 break; 149 break;
150 } 150 }
151 151
152 AtomicString name(iter->name()); 152 AtomicString name(iter->name());
153 AtomicString value(iter->value8BitIfNecessary()); 153 AtomicString value(iter->value8BitIfNecessary());
154 154
155 index = addRange(source, index, iter->nameRange().start - token.startInd ex(), emptyAtom); 155 index = addRange(source, index, iter->nameRange().start - token.startInd ex(), emptyAtom);
156 index = addRange(source, index, iter->nameRange().end - token.startIndex (), "html-attribute-name"); 156 index = addRange(source, index, iter->nameRange().end - token.startIndex (), "html-attribute-name");
157 157
158 if (tagName == baseTag && name == hrefAttr) 158 if (tagName == baseTag && name == hrefAttr)
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 maybeAddSpanForAnnotation(annotation); 251 maybeAddSpanForAnnotation(annotation);
252 m_current->parserAppendChild(Text::create(*this, substring)); 252 m_current->parserAppendChild(Text::create(*this, substring));
253 m_current = oldElement; 253 m_current = oldElement;
254 if (i < size - 1) 254 if (i < size - 1)
255 finishLine(); 255 finishLine();
256 } 256 }
257 } 257 }
258 258
259 int HTMLViewSourceDocument::addRange(const String& source, int start, int end, c onst AtomicString& className, bool isLink, bool isAnchor, const AtomicString& li nk) 259 int HTMLViewSourceDocument::addRange(const String& source, int start, int end, c onst AtomicString& className, bool isLink, bool isAnchor, const AtomicString& li nk)
260 { 260 {
261 ASSERT(start <= end); 261 DCHECK_LE(start, end);
262 if (start == end) 262 if (start == end)
263 return start; 263 return start;
264 264
265 String text = source.substring(start, end - start); 265 String text = source.substring(start, end - start);
266 if (!className.isEmpty()) { 266 if (!className.isEmpty()) {
267 if (isLink) 267 if (isLink)
268 m_current = addLink(link, isAnchor); 268 m_current = addLink(link, isAnchor);
269 else 269 else
270 m_current = addSpanWithClassName(className); 270 m_current = addSpanWithClassName(className);
271 } 271 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 312
313 DEFINE_TRACE(HTMLViewSourceDocument) 313 DEFINE_TRACE(HTMLViewSourceDocument)
314 { 314 {
315 visitor->trace(m_current); 315 visitor->trace(m_current);
316 visitor->trace(m_tbody); 316 visitor->trace(m_tbody);
317 visitor->trace(m_td); 317 visitor->trace(m_td);
318 HTMLDocument::trace(visitor); 318 HTMLDocument::trace(visitor);
319 } 319 }
320 320
321 } // namespace blink 321 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp ('k') | third_party/WebKit/Source/core/html/ImageData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698