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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 index = addRange(source, index, iter->nameRange().end - token.startIndex(), | 156 index = addRange(source, index, iter->nameRange().end - token.startIndex(), |
157 "html-attribute-name"); | 157 "html-attribute-name"); |
158 | 158 |
159 if (tagName == baseTag && name == hrefAttr) | 159 if (tagName == baseTag && name == hrefAttr) |
160 addBase(value); | 160 addBase(value); |
161 | 161 |
162 index = addRange(source, index, | 162 index = addRange(source, index, |
163 iter->valueRange().start - token.startIndex(), emptyAtom); | 163 iter->valueRange().start - token.startIndex(), emptyAtom); |
164 | 164 |
165 if (name == srcsetAttr) { | 165 if (name == srcsetAttr) { |
166 index = addSrcset(source, index, iter->valueRange().end - token.startInd
ex()); | 166 index = |
| 167 addSrcset(source, index, iter->valueRange().end - token.startIndex()); |
167 } else { | 168 } else { |
168 bool isLink = name == srcAttr || name == hrefAttr; | 169 bool isLink = name == srcAttr || name == hrefAttr; |
169 index = addRange(source, index, iter->valueRange().end - token.startInde
x(), | 170 index = |
170 "html-attribute-value", isLink, tagName == aTag, value)
; | 171 addRange(source, index, iter->valueRange().end - token.startIndex(), |
| 172 "html-attribute-value", isLink, tagName == aTag, value); |
171 } | 173 } |
172 | 174 |
173 ++iter; | 175 ++iter; |
174 } | 176 } |
175 m_current = m_td; | 177 m_current = m_td; |
176 } | 178 } |
177 | 179 |
178 void HTMLViewSourceDocument::processCommentToken(const String& source, | 180 void HTMLViewSourceDocument::processCommentToken(const String& source, |
179 HTMLToken&) { | 181 HTMLToken&) { |
180 m_current = addSpanWithClassName("html-comment"); | 182 m_current = addSpanWithClassName("html-comment"); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 else | 312 else |
311 classValue = "html-attribute-value html-resource-link"; | 313 classValue = "html-attribute-value html-resource-link"; |
312 anchor->setAttribute(classAttr, classValue); | 314 anchor->setAttribute(classAttr, classValue); |
313 anchor->setAttribute(targetAttr, "_blank"); | 315 anchor->setAttribute(targetAttr, "_blank"); |
314 anchor->setAttribute(hrefAttr, url); | 316 anchor->setAttribute(hrefAttr, url); |
315 m_current->parserAppendChild(anchor); | 317 m_current->parserAppendChild(anchor); |
316 return anchor; | 318 return anchor; |
317 } | 319 } |
318 | 320 |
319 int HTMLViewSourceDocument::addSrcset(const String& source, | 321 int HTMLViewSourceDocument::addSrcset(const String& source, |
320 int start, | 322 int start, |
321 int end) { | 323 int end) { |
322 String srcset = source.substring(start, end-start); | 324 String srcset = source.substring(start, end - start); |
323 Vector<String> srclist; | 325 Vector<String> srclist; |
324 srcset.split(',', true, srclist); | 326 srcset.split(',', true, srclist); |
325 unsigned size = srclist.size(); | 327 unsigned size = srclist.size(); |
326 for (unsigned i = 0; i < size; i++) { | 328 for (unsigned i = 0; i < size; i++) { |
327 Vector<String> tmp; | 329 Vector<String> tmp; |
328 srclist[i].split(' ', tmp); | 330 srclist[i].split(' ', tmp); |
329 if (tmp.size() > 0) { | 331 if (tmp.size() > 0) { |
330 AtomicString link(tmp[0]); | 332 AtomicString link(tmp[0]); |
331 m_current = addLink(link, false); | 333 m_current = addLink(link, false); |
332 addText(srclist[i], "html-attribute-value"); | 334 addText(srclist[i], "html-attribute-value"); |
(...skipping 16 matching lines...) Expand all Loading... |
349 } | 351 } |
350 | 352 |
351 DEFINE_TRACE(HTMLViewSourceDocument) { | 353 DEFINE_TRACE(HTMLViewSourceDocument) { |
352 visitor->trace(m_current); | 354 visitor->trace(m_current); |
353 visitor->trace(m_tbody); | 355 visitor->trace(m_tbody); |
354 visitor->trace(m_td); | 356 visitor->trace(m_td); |
355 HTMLDocument::trace(visitor); | 357 HTMLDocument::trace(visitor); |
356 } | 358 } |
357 | 359 |
358 } // namespace blink | 360 } // namespace blink |
OLD | NEW |