summaryrefslogtreecommitdiffstats
path: root/WebCore/html/HTMLViewSourceDocument.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/html/HTMLViewSourceDocument.cpp')
-rw-r--r--WebCore/html/HTMLViewSourceDocument.cpp33
1 files changed, 18 insertions, 15 deletions
diff --git a/WebCore/html/HTMLViewSourceDocument.cpp b/WebCore/html/HTMLViewSourceDocument.cpp
index 55c6df7..13404cc 100644
--- a/WebCore/html/HTMLViewSourceDocument.cpp
+++ b/WebCore/html/HTMLViewSourceDocument.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -47,6 +47,9 @@ using namespace HTMLNames;
HTMLViewSourceDocument::HTMLViewSourceDocument(Frame* frame, const String& mimeType)
: HTMLDocument(frame)
, m_type(mimeType)
+ , m_current(0)
+ , m_tbody(0)
+ , m_td(0)
{
setUsesBeforeAfterRules(true);
}
@@ -67,23 +70,23 @@ Tokenizer* HTMLViewSourceDocument::createTokenizer()
void HTMLViewSourceDocument::createContainingTable()
{
- RefPtr<HTMLHtmlElement> html = new HTMLHtmlElement(htmlTag, this);
+ RefPtr<Element> html = new HTMLHtmlElement(htmlTag, this);
addChild(html);
html->attach();
- RefPtr<HTMLBodyElement> body = new HTMLBodyElement(bodyTag, this);
+ RefPtr<Element> body = new HTMLBodyElement(bodyTag, this);
html->addChild(body);
body->attach();
// Create a line gutter div that can be used to make sure the gutter extends down the height of the whole
// document.
- RefPtr<HTMLDivElement> div = new HTMLDivElement(divTag, this);
+ RefPtr<Element> div = new HTMLDivElement(divTag, this);
RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create();
attrs->addAttribute(MappedAttribute::create(classAttr, "webkit-line-gutter-backdrop"));
div->setAttributeMap(attrs.release());
body->addChild(div);
div->attach();
- RefPtr<HTMLTableElement> table = new HTMLTableElement(tableTag, this);
+ RefPtr<Element> table = new HTMLTableElement(tableTag, this);
body->addChild(table);
table->attach();
m_tbody = new HTMLTableSectionElement(tbodyTag, this);
@@ -202,31 +205,31 @@ void HTMLViewSourceDocument::addViewSourceDoctypeToken(DoctypeToken* doctypeToke
addText(text, "webkit-html-doctype");
}
-PassRefPtr<Element> HTMLViewSourceDocument::addSpanWithClassName(const String& className)
+Element* HTMLViewSourceDocument::addSpanWithClassName(const String& className)
{
if (m_current == m_tbody) {
addLine(className);
return m_current;
}
- RefPtr<HTMLElement> span = new HTMLElement(spanTag, this);
+ Element* span = new HTMLElement(spanTag, this);
RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create();
attrs->addAttribute(MappedAttribute::create(classAttr, className));
span->setAttributeMap(attrs.release());
m_current->addChild(span);
span->attach();
- return span.release();
+ return span;
}
void HTMLViewSourceDocument::addLine(const String& className)
{
// Create a table row.
- RefPtr<HTMLTableRowElement> trow = new HTMLTableRowElement(trTag, this);
+ RefPtr<Element> trow = new HTMLTableRowElement(trTag, this);
m_tbody->addChild(trow);
trow->attach();
// Create a cell that will hold the line number (it is generated in the stylesheet using counters).
- RefPtr<HTMLTableCellElement> td = new HTMLTableCellElement(tdTag, this);
+ Element* td = new HTMLTableCellElement(tdTag, this);
RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create();
attrs->addAttribute(MappedAttribute::create(classAttr, "webkit-line-number"));
td->setAttributeMap(attrs.release());
@@ -243,7 +246,7 @@ void HTMLViewSourceDocument::addLine(const String& className)
m_current = m_td = td;
#ifdef DEBUG_LINE_NUMBERS
- RefPtr<Text> lineNumberText = Text::create(this, String::number(tokenizer()->lineNumber() + 1) + " ");
+ RefPtr<Text> lineNumberText = new Text(this, String::number(tokenizer()->lineNumber() + 1) + " ");
td->addChild(lineNumberText);
lineNumberText->attach();
#endif
@@ -274,7 +277,7 @@ void HTMLViewSourceDocument::addText(const String& text, const String& className
}
if (m_current == m_tbody)
addLine(className);
- RefPtr<Text> t = Text::create(this, substring);
+ RefPtr<Text> t = new Text(this, substring);
m_current->addChild(t);
t->attach();
if (i < size - 1)
@@ -286,13 +289,13 @@ void HTMLViewSourceDocument::addText(const String& text, const String& className
m_current = m_tbody;
}
-PassRefPtr<Element> HTMLViewSourceDocument::addLink(const String& url, bool isAnchor)
+Element* HTMLViewSourceDocument::addLink(const String& url, bool isAnchor)
{
if (m_current == m_tbody)
addLine("webkit-html-tag");
// Now create a link for the attribute value instead of a span.
- RefPtr<HTMLAnchorElement> anchor = new HTMLAnchorElement(this);
+ Element* anchor = new HTMLAnchorElement(aTag, this);
RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create();
const char* classValue;
if (isAnchor)
@@ -305,7 +308,7 @@ PassRefPtr<Element> HTMLViewSourceDocument::addLink(const String& url, bool isAn
anchor->setAttributeMap(attrs.release());
m_current->addChild(anchor);
anchor->attach();
- return anchor.release();
+ return anchor;
}
}