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

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

Issue 23513013: Have Text constructor take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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 | Annotate | Revision Log
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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 td->setAttribute(valueAttr, String::number(++m_lineNumber)); 191 td->setAttribute(valueAttr, String::number(++m_lineNumber));
192 trow->parserAppendChild(td); 192 trow->parserAppendChild(td);
193 193
194 // Create a second cell for the line contents 194 // Create a second cell for the line contents
195 td = HTMLTableCellElement::create(tdTag, *this); 195 td = HTMLTableCellElement::create(tdTag, *this);
196 td->setAttribute(classAttr, "webkit-line-content"); 196 td->setAttribute(classAttr, "webkit-line-content");
197 trow->parserAppendChild(td); 197 trow->parserAppendChild(td);
198 m_current = m_td = td; 198 m_current = m_td = td;
199 199
200 #ifdef DEBUG_LINE_NUMBERS 200 #ifdef DEBUG_LINE_NUMBERS
201 RefPtr<Text> lineNumberText = Text::create(this, String::number(parser()->li neNumber() + 1) + " "); 201 RefPtr<Text> lineNumberText = Text::create(*this, String::number(parser()->l ineNumber() + 1) + " ");
202 td->addChild(lineNumberText); 202 td->addChild(lineNumberText);
203 lineNumberText->lazyAttach(); 203 lineNumberText->lazyAttach();
204 #endif 204 #endif
205 205
206 // Open up the needed spans. 206 // Open up the needed spans.
207 if (!className.isEmpty()) { 207 if (!className.isEmpty()) {
208 if (className == "webkit-html-attribute-name" || className == "webkit-ht ml-attribute-value") 208 if (className == "webkit-html-attribute-name" || className == "webkit-ht ml-attribute-value")
209 m_current = addSpanWithClassName("webkit-html-tag"); 209 m_current = addSpanWithClassName("webkit-html-tag");
210 m_current = addSpanWithClassName(className); 210 m_current = addSpanWithClassName(className);
211 } 211 }
(...skipping 20 matching lines...) Expand all
232 for (unsigned i = 0; i < size; i++) { 232 for (unsigned i = 0; i < size; i++) {
233 String substring = lines[i]; 233 String substring = lines[i];
234 if (m_current == m_tbody) 234 if (m_current == m_tbody)
235 addLine(className); 235 addLine(className);
236 if (substring.isEmpty()) { 236 if (substring.isEmpty()) {
237 if (i == size - 1) 237 if (i == size - 1)
238 break; 238 break;
239 finishLine(); 239 finishLine();
240 continue; 240 continue;
241 } 241 }
242 RefPtr<Text> t = Text::create(this, substring); 242 RefPtr<Text> t = Text::create(*this, substring);
243 m_current->parserAppendChild(t); 243 m_current->parserAppendChild(t);
244 if (i < size - 1) 244 if (i < size - 1)
245 finishLine(); 245 finishLine();
246 } 246 }
247 } 247 }
248 248
249 int HTMLViewSourceDocument::addRange(const String& source, int start, int end, c onst String& className, bool isLink, bool isAnchor, const String& link) 249 int HTMLViewSourceDocument::addRange(const String& source, int start, int end, c onst String& className, bool isLink, bool isAnchor, const String& link)
250 { 250 {
251 ASSERT(start <= end); 251 ASSERT(start <= end);
252 if (start == end) 252 if (start == end)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 else 286 else
287 classValue = "webkit-html-attribute-value webkit-html-resource-link"; 287 classValue = "webkit-html-attribute-value webkit-html-resource-link";
288 anchor->setAttribute(classAttr, classValue); 288 anchor->setAttribute(classAttr, classValue);
289 anchor->setAttribute(targetAttr, "_blank"); 289 anchor->setAttribute(targetAttr, "_blank");
290 anchor->setAttribute(hrefAttr, url); 290 anchor->setAttribute(hrefAttr, url);
291 m_current->parserAppendChild(anchor); 291 m_current->parserAppendChild(anchor);
292 return anchor.release(); 292 return anchor.release();
293 } 293 }
294 294
295 } 295 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLOptionElement.cpp ('k') | Source/core/html/parser/HTMLConstructionSite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698