| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 m_current = addSpanWithClassName("webkit-html-comment"); | 168 m_current = addSpanWithClassName("webkit-html-comment"); |
| 169 addText(source, "webkit-html-comment"); | 169 addText(source, "webkit-html-comment"); |
| 170 m_current = m_td; | 170 m_current = m_td; |
| 171 } | 171 } |
| 172 | 172 |
| 173 void HTMLViewSourceDocument::processCharacterToken(const String& source, HTMLTok
en&) | 173 void HTMLViewSourceDocument::processCharacterToken(const String& source, HTMLTok
en&) |
| 174 { | 174 { |
| 175 addText(source, ""); | 175 addText(source, ""); |
| 176 } | 176 } |
| 177 | 177 |
| 178 PassRefPtr<Element> HTMLViewSourceDocument::addSpanWithClassName(const AtomicStr
ing& className) | 178 PassRefPtrWillBeRawPtr<Element> HTMLViewSourceDocument::addSpanWithClassName(con
st AtomicString& className) |
| 179 { | 179 { |
| 180 if (m_current == m_tbody) { | 180 if (m_current == m_tbody) { |
| 181 addLine(className); | 181 addLine(className); |
| 182 return m_current; | 182 return m_current; |
| 183 } | 183 } |
| 184 | 184 |
| 185 RefPtrWillBeRawPtr<HTMLSpanElement> span = HTMLSpanElement::create(*this); | 185 RefPtrWillBeRawPtr<HTMLSpanElement> span = HTMLSpanElement::create(*this); |
| 186 span->setAttribute(classAttr, className); | 186 span->setAttribute(classAttr, className); |
| 187 m_current->parserAppendChild(span); | 187 m_current->parserAppendChild(span); |
| 188 return span.release(); | 188 return span.release(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 m_current = addLink(link, isAnchor); | 260 m_current = addLink(link, isAnchor); |
| 261 else | 261 else |
| 262 m_current = addSpanWithClassName(className); | 262 m_current = addSpanWithClassName(className); |
| 263 } | 263 } |
| 264 addText(text, className); | 264 addText(text, className); |
| 265 if (!className.isEmpty() && m_current != m_tbody) | 265 if (!className.isEmpty() && m_current != m_tbody) |
| 266 m_current = toElement(m_current->parentNode()); | 266 m_current = toElement(m_current->parentNode()); |
| 267 return end; | 267 return end; |
| 268 } | 268 } |
| 269 | 269 |
| 270 PassRefPtr<Element> HTMLViewSourceDocument::addBase(const AtomicString& href) | 270 PassRefPtrWillBeRawPtr<Element> HTMLViewSourceDocument::addBase(const AtomicStri
ng& href) |
| 271 { | 271 { |
| 272 RefPtrWillBeRawPtr<HTMLBaseElement> base = HTMLBaseElement::create(*this); | 272 RefPtrWillBeRawPtr<HTMLBaseElement> base = HTMLBaseElement::create(*this); |
| 273 base->setAttribute(hrefAttr, href); | 273 base->setAttribute(hrefAttr, href); |
| 274 m_current->parserAppendChild(base); | 274 m_current->parserAppendChild(base); |
| 275 return base.release(); | 275 return base.release(); |
| 276 } | 276 } |
| 277 | 277 |
| 278 PassRefPtr<Element> HTMLViewSourceDocument::addLink(const AtomicString& url, boo
l isAnchor) | 278 PassRefPtrWillBeRawPtr<Element> HTMLViewSourceDocument::addLink(const AtomicStri
ng& url, bool isAnchor) |
| 279 { | 279 { |
| 280 if (m_current == m_tbody) | 280 if (m_current == m_tbody) |
| 281 addLine("webkit-html-tag"); | 281 addLine("webkit-html-tag"); |
| 282 | 282 |
| 283 // Now create a link for the attribute value instead of a span. | 283 // Now create a link for the attribute value instead of a span. |
| 284 RefPtrWillBeRawPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::create(*th
is); | 284 RefPtrWillBeRawPtr<HTMLAnchorElement> anchor = HTMLAnchorElement::create(*th
is); |
| 285 const char* classValue; | 285 const char* classValue; |
| 286 if (isAnchor) | 286 if (isAnchor) |
| 287 classValue = "webkit-html-attribute-value webkit-html-external-link"; | 287 classValue = "webkit-html-attribute-value webkit-html-external-link"; |
| 288 else | 288 else |
| 289 classValue = "webkit-html-attribute-value webkit-html-resource-link"; | 289 classValue = "webkit-html-attribute-value webkit-html-resource-link"; |
| 290 anchor->setAttribute(classAttr, classValue); | 290 anchor->setAttribute(classAttr, classValue); |
| 291 anchor->setAttribute(targetAttr, "_blank"); | 291 anchor->setAttribute(targetAttr, "_blank"); |
| 292 anchor->setAttribute(hrefAttr, url); | 292 anchor->setAttribute(hrefAttr, url); |
| 293 m_current->parserAppendChild(anchor); | 293 m_current->parserAppendChild(anchor); |
| 294 return anchor.release(); | 294 return anchor.release(); |
| 295 } | 295 } |
| 296 | 296 |
| 297 void HTMLViewSourceDocument::trace(Visitor* visitor) | 297 void HTMLViewSourceDocument::trace(Visitor* visitor) |
| 298 { | 298 { |
| 299 visitor->trace(m_current); | 299 visitor->trace(m_current); |
| 300 visitor->trace(m_tbody); | 300 visitor->trace(m_tbody); |
| 301 visitor->trace(m_td); | 301 visitor->trace(m_td); |
| 302 HTMLDocument::trace(visitor); | 302 HTMLDocument::trace(visitor); |
| 303 } | 303 } |
| 304 | 304 |
| 305 } | 305 } |
| OLD | NEW |