OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |