Commit 4bbddd4f authored by hyatt's avatar hyatt
Browse files

Fix for 3098045.

	Do not treat XHTML-style tags e.g., <br/> or <table/> as
	self-closing.  This is absolutely wrong, and it does not
	match the behavior of other browsers.  According to the HTML4
	spec for parsing, / is an erroneous character and should simply
	be dropped, so <table/> should be treated like <table>.

	Fixes for crashes on glazman's blog and on tantek's blog.  Both
	still mis-render, but at least they don't crash.

        Reviewed by gramps (and darin too)

        * khtml/html/htmltokenizer.cpp:
	* khtml/rendering/render_container.cpp:
	* khtml/rendering/render_style.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3045 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ec317767
2002-12-13 David Hyatt <hyatt@apple.com>
Fix for 3098045.
Do not treat XHTML-style tags e.g., <br/> or <table/> as
self-closing. This is absolutely wrong, and it does not
match the behavior of other browsers. According to the HTML4
spec for parsing, / is an erroneous character and should simply
be dropped, so <table/> should be treated like <table>.
Fixes for crashes on glazman's blog and on tantek's blog. Both
still mis-render, but at least they don't crash.
Reviewed by gramps (and darin too)
* khtml/html/htmltokenizer.cpp:
* khtml/rendering/render_container.cpp:
* khtml/rendering/render_style.cpp:
=== Alexander-37u1 ===
2002-12-13 David Hyatt <hyatt@apple.com>
......
2002-12-13 David Hyatt <hyatt@apple.com>
Fix for 3098045.
Do not treat XHTML-style tags e.g., <br/> or <table/> as
self-closing. This is absolutely wrong, and it does not
match the behavior of other browsers. According to the HTML4
spec for parsing, / is an erroneous character and should simply
be dropped, so <table/> should be treated like <table>.
Fixes for crashes on glazman's blog and on tantek's blog. Both
still mis-render, but at least they don't crash.
Reviewed by gramps (and darin too)
* khtml/html/htmltokenizer.cpp:
* khtml/rendering/render_container.cpp:
* khtml/rendering/render_style.cpp:
=== Alexander-37u1 ===
2002-12-13 David Hyatt <hyatt@apple.com>
......
......@@ -907,13 +907,10 @@ void HTMLTokenizer::parseTag(DOMStringIt &src)
else
// Start Tag
beginTag = true;
// Accept empty xml tags like <br/>
if(len > 1 && ptr[len-1] == '/' ) {
if(len > 1 && ptr[len-1] == '/' )
ptr[--len] = '\0';
// if its like <br/> and not like <input/ value=foo>, take it as flat
if (*src == '>')
currToken.flat = true;
}
uint tagID = khtml::getTagID(ptr, len);
if (!tagID) {
......@@ -992,9 +989,6 @@ void HTMLTokenizer::parseTag(DOMStringIt &src)
else
kdDebug( 6036 ) << "Known attribute: " << QCString(cBuffer, cBufferPos+1).data() << endl;
#endif
// did we just get />
if (!a && cBufferPos == 1 && *cBuffer == '/' && curchar == '>')
currToken.flat = true;
tag = SearchEqual;
break;
......
......@@ -211,16 +211,18 @@ void RenderContainer::insertPseudoChild(RenderStyle::PseudoId type, RenderObject
if (pseudo->contentType()==CONTENT_TEXT)
{
RenderObject* po = new (renderArena()) RenderFlow(0 /* anonymous box */);
po->setParent(this); // Set the parent now, so setStyle will be able to find a renderArena.
po->setStyle(pseudo);
po->setParent(0); // Unset the parent to avoid asserting in addChild.
addChild(po, beforeChild);
RenderText* t = new (renderArena()) RenderText(0 /*anonymous object */, pseudo->contentText());
t->setParent(po); // Set the parent now, so setStyle will be able to find a renderArena.
t->setStyle(pseudo);
// kdDebug() << DOM::DOMString(pseudo->contentText()).string() << endl;
t->setParent(0); // Unset the parent to avoid asserting in addChild.
po->addChild(t);
// kdDebug() << DOM::DOMString(pseudo->contentText()).string() << endl;
t->close();
po->close();
......@@ -228,7 +230,9 @@ void RenderContainer::insertPseudoChild(RenderStyle::PseudoId type, RenderObject
else if (pseudo->contentType()==CONTENT_OBJECT)
{
RenderObject* po = new (renderArena()) RenderImage(0);
po->setParent(this); // Set the parent now, so setStyle will be able to find a renderArena.
po->setStyle(pseudo);
po->setParent(0); // Unset the parent to avoid asserting in addChild.
addChild(po, beforeChild);
po->close();
}
......
......@@ -482,9 +482,12 @@ void RenderStyle::setContent(DOM::DOMStringImpl* s)
content = new ContentData;
else
content->clearContent();
if (!s)
s = new DOM::DOMStringImpl("");
content->_content.text = s;
content->_content.text->ref();
content->_contentType = CONTENT_TEXT;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment