Kaydet (Commit) 7a044d08 authored tarafından Maxim Monastirsky's avatar Maxim Monastirsky Kaydeden (comit) Caolán McNamara

fdo#74595 Make HTML detection to follow specs

See http://www.w3.org/TR/html-markup/documents.html#conformant-html

Change-Id: Id2835f20baad20bcb874df5e6f35a189c320367b
Reviewed-on: https://gerrit.libreoffice.org/8079Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst cd361611
...@@ -53,7 +53,7 @@ bool isHTMLStream(const OString& aStreamHeader) ...@@ -53,7 +53,7 @@ bool isHTMLStream(const OString& aStreamHeader)
for ( i = 0; i < nLength; ++i, ++pHeader ) for ( i = 0; i < nLength; ++i, ++pHeader )
{ {
char c = *pHeader; char c = *pHeader;
if ( c == ' ' || c == '\n' || c == '\t' ) if ( c == ' ' || c == '\n' || c == '\t' || c == '\r' || c == '\f' )
{ {
if ( dp == TagOpened ) if ( dp == TagOpened )
return false; // Invalid: Should start with a tag name return false; // Invalid: Should start with a tag name
...@@ -76,8 +76,8 @@ bool isHTMLStream(const OString& aStreamHeader) ...@@ -76,8 +76,8 @@ bool isHTMLStream(const OString& aStreamHeader)
} }
else if ( c == '!' ) else if ( c == '!' )
{ {
if ( i == 1 && dp == TagOpened ) if ( dp == TagOpened )
return true; // "<!" at the very beginning of the file return true; // "<!" - DOCTYPE or comments block
else else
return false; // Invalid: '!' before '<' or inside tag name return false; // Invalid: '!' before '<' or inside tag name
} }
......
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