X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2b5f62a0b2db198609b45dec622a018dae37008e..910426ee7bbd9f5959b4d5d075b35f0e8e3b52a9:/src/html/htmlpars.cpp?ds=inline diff --git a/src/html/htmlpars.cpp b/src/html/htmlpars.cpp index 9ed716fe81..efd6d9349e 100644 --- a/src/html/htmlpars.cpp +++ b/src/html/htmlpars.cpp @@ -127,6 +127,8 @@ void wxHtmlParser::CreateDOMTree() m_CurTextPiece = 0; } +extern bool wxIsCDATAElement(const wxChar *tag); + void wxHtmlParser::CreateDOMSubTree(wxHtmlTag *cur, int begin_pos, int end_pos, wxHtmlTagsCache *cache) @@ -137,6 +139,15 @@ void wxHtmlParser::CreateDOMSubTree(wxHtmlTag *cur, int i = begin_pos; int textBeginning = begin_pos; + // If the tag contains CDATA text, we include the text between beginning + // and ending tag verbosely. Setting i=end_pos will skip to the very + // end of this function where text piece is added, bypassing any child + // tags parsing (CDATA element can't have child elements by definition): + if (cur != NULL && wxIsCDATAElement(cur->GetName().c_str())) + { + i = end_pos; + } + while (i < end_pos) { c = m_Source.GetChar(i); @@ -209,6 +220,7 @@ void wxHtmlParser::CreateDOMSubTree(wxHtmlTag *cur, } else i = chd->GetBeginPos(); + textBeginning = i; } @@ -860,7 +872,7 @@ bool wxMetaTagHandler::HandleTag(const wxHtmlTag& tag) } if (tag.HasParam(_T("HTTP-EQUIV")) && - tag.GetParam(_T("HTTP-EQUIV")) == _T("Content-Type") && + tag.GetParam(_T("HTTP-EQUIV")).IsSameAs(_T("Content-Type"), false) && tag.HasParam(_T("CONTENT"))) { wxString content = tag.GetParam(_T("CONTENT"));