Commit baa79d0b authored by hyatt's avatar hyatt

Fix for 3109226, epinions page is mostly blank. Add a hack

	to disallow > but only inside attribute values for which there
	is no corresponding attribute name.

	Also fix attribute values with no name so that the value is
	used as the name so that e.g., <option "selected"> works.

        Reviewed by darin

        * khtml/html/htmltokenizer.cpp:
        (HTMLTokenizer::HTMLTokenizer):
        * khtml/html/htmltokenizer.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3068 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a3f4f106
2002-12-15 David Hyatt <hyatt@apple.com>
Fix for 3109226, epinions page is mostly blank. Add a hack
to disallow > but only inside attribute values for which there
is no corresponding attribute name.
Also fix attribute values with no name so that the value is
used as the name so that e.g., <option "selected"> works.
Reviewed by darin
* khtml/html/htmltokenizer.cpp:
(HTMLTokenizer::HTMLTokenizer):
* khtml/html/htmltokenizer.h:
2002-12-15 Darin Adler <darin@apple.com>
Reviewed by Dave.
......
2002-12-15 David Hyatt <hyatt@apple.com>
Fix for 3109226, epinions page is mostly blank. Add a hack
to disallow > but only inside attribute values for which there
is no corresponding attribute name.
Also fix attribute values with no name so that the value is
used as the name so that e.g., <option "selected"> works.
Reviewed by darin
* khtml/html/htmltokenizer.cpp:
(HTMLTokenizer::HTMLTokenizer):
* khtml/html/htmltokenizer.h:
2002-12-15 Darin Adler <darin@apple.com>
Reviewed by Dave.
......
......@@ -225,7 +225,8 @@ HTMLTokenizer::HTMLTokenizer(DOM::DocumentPtr *_doc, KHTMLView *_view)
m_executingScript = 0;
loadingExtScript = false;
onHold = false;
attrNamePresent = false;
reset();
}
......@@ -963,6 +964,7 @@ void HTMLTokenizer::parseTag(DOMStringIt &src)
tag = SearchValue;
*dest++ = 0;
attrName = QString::null;
attrNamePresent = false;
}
else
tag = AttributeName;
......@@ -990,9 +992,13 @@ void HTMLTokenizer::parseTag(DOMStringIt &src)
unsigned int a;
cBuffer[cBufferPos] = '\0';
a = khtml::getAttrID(cBuffer, cBufferPos);
if ( !a )
if (a)
attrNamePresent = true;
else {
attrName = QString::fromLatin1(QCString(cBuffer, cBufferPos+1).data());
attrNamePresent = !attrName.isEmpty();
}
dest = buffer;
*dest++ = a;
#ifdef TOKEN_DEBUG
......@@ -1012,6 +1018,7 @@ void HTMLTokenizer::parseTag(DOMStringIt &src)
if ( cBufferPos == CBUFLEN ) {
cBuffer[cBufferPos] = '\0';
attrName = QString::fromLatin1(QCString(cBuffer, cBufferPos+1).data());
attrNamePresent = !attrName.isEmpty();
dest = buffer;
*dest++ = 0;
tag = SearchEqual;
......@@ -1040,6 +1047,7 @@ void HTMLTokenizer::parseTag(DOMStringIt &src)
tag = SearchValue;
*dest++ = 0;
attrName = QString::null;
attrNamePresent = false;
}
else {
DOMString v("");
......@@ -1083,6 +1091,25 @@ void HTMLTokenizer::parseTag(DOMStringIt &src)
checkBuffer();
curchar = src->unicode();
if (curchar == '>' && !attrNamePresent) {
// Handle a case like <img '>. Just go ahead and be willing
// to close the whole tag. Don't consume the character and
// just go back into SearchEnd while ignoring the whole
// value.
// FIXME: Note that this is actually not a very good solution. It's
// an interim hack and doesn't handle the general case of
// unmatched quotes among attributes that have names. -dwh
while(dest > buffer+1 && (*(dest-1) == '\n' || *(dest-1) == '\r'))
dest--; // remove trailing newlines
DOMString v(buffer+1, dest-buffer-1);
attrName.setUnicode(buffer+1,dest-buffer-1);
currToken.addAttribute(parser->docPtr()->document(), buffer, attrName, v);
tag = SearchAttribute;
dest = buffer;
tquote = NoQuote;
break;
}
if(curchar <= '\'' && !src.escaped()) {
// ### attributes like '&{blaa....};' are supposed to be treated as jscript.
if ( curchar == '&' )
......@@ -1098,6 +1125,8 @@ void HTMLTokenizer::parseTag(DOMStringIt &src)
while(dest > buffer+1 && (*(dest-1) == '\n' || *(dest-1) == '\r'))
dest--; // remove trailing newlines
DOMString v(buffer+1, dest-buffer-1);
if (!attrNamePresent)
attrName.setUnicode(buffer+1,dest-buffer-1);
currToken.addAttribute(parser->docPtr()->document(), buffer, attrName, v);
dest = buffer;
......
......@@ -289,7 +289,10 @@ protected:
// name of an unknown attribute
QString attrName;
// whether or not the attrname is present (either we found a known HTML attr or we found an unknown
// nonempty attrName).
bool attrNamePresent;
// Used to store the code of a srcipting sequence
QChar *scriptCode;
// Size of the script sequenze stored in @ref #scriptCode
......
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