[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/khtml/html
From: Maks Orlovich <maksim () kde ! org>
Date: 2008-07-30 16:07:12
Message-ID: 1217434032.348025.3969.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 839701 by orlovich:
Merged revision 839700:
Now that the HTML parser adds doctype nodes, it can no longer be sure that the
<html> will be the first child of #document, so use ->documentElement() instead.
Restores recovery from mis-structured head/body, w/o which we could even lose
<style> or <title> elements in some cases of malformed input
BUG:166450
BUG:167717
M +5 -5 htmlparser.cpp
--- trunk/KDE/kdelibs/khtml/html/htmlparser.cpp #839700:839701
@@ -506,11 +506,11 @@
break;
case ID_HTML:
if (!current->isDocumentNode() ) {
- if ( doc()->firstChild()->id() == ID_HTML) {
+ if ( doc()->documentElement()->id() == ID_HTML) {
// we have another <HTML> element.... apply attributes to existing one
// make sure we don't overwrite already existing attributes
NamedAttrMapImpl *map = static_cast<ElementImpl*>(n)->attributes(true);
- NamedAttrMapImpl *bmap = static_cast<ElementImpl*>(doc()->firstChild())->attributes(false);
+ NamedAttrMapImpl *bmap = static_cast<ElementImpl*>(doc()->documentElement())->attributes(false);
bool changed = false;
for (unsigned long l = 0; map && l < map->length(); ++l) {
NodeImpl::Id attrId = map->idAt(l);
@@ -1790,16 +1790,16 @@
void KHTMLParser::createHead()
{
- if(head || !doc()->firstChild())
+ if(head || !doc()->documentElement())
return;
head = new HTMLHeadElementImpl(document);
HTMLElementImpl *body = doc()->body();
int exceptioncode = 0;
- doc()->firstChild()->insertBefore(head, body, exceptioncode);
+ doc()->documentElement()->insertBefore(head, body, exceptioncode);
if ( exceptioncode ) {
#ifdef PARSER_DEBUG
- kDebug( 6035 ) << "creation of head failed!!!!";
+ kDebug( 6035 ) << "creation of head failed!!!!:" << exceptioncode;
#endif
delete head;
head = 0;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic