webengine/osswebengine/WebCore/html/HTMLParser.cpp
branchRCL_3
changeset 35 1f3c3f2f5b0a
parent 10 a359256acfc6
child 44 800203832575
equal deleted inserted replaced
34:220a17280356 35:1f3c3f2f5b0a
   839         gFunctionMap.set(thTag.localName().impl(), &HTMLParser::tableCellCreateErrorCheck);
   839         gFunctionMap.set(thTag.localName().impl(), &HTMLParser::tableCellCreateErrorCheck);
   840         gFunctionMap.set(theadTag.localName().impl(), &HTMLParser::tableSectionCreateErrorCheck);
   840         gFunctionMap.set(theadTag.localName().impl(), &HTMLParser::tableSectionCreateErrorCheck);
   841         gFunctionMap.set(trTag.localName().impl(), &HTMLParser::nestedCreateErrorCheck);
   841         gFunctionMap.set(trTag.localName().impl(), &HTMLParser::nestedCreateErrorCheck);
   842         gFunctionMap.set(ttTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
   842         gFunctionMap.set(ttTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
   843         gFunctionMap.set(uTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
   843         gFunctionMap.set(uTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
       
   844         gFunctionMap.set(ulTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
   844     }
   845     }
   845 
   846 
   846     bool proceed = true;
   847     bool proceed = true;
   847     RefPtr<Node> result;
   848     RefPtr<Node> result;
   848     if (CreateErrorCheckFunc errorCheckFunc = gFunctionMap.get(t->tagName.impl()))
   849     if (CreateErrorCheckFunc errorCheckFunc = gFunctionMap.get(t->tagName.impl()))
   856 {
   857 {
   857     // www.liceo.edu.mx is an example of a site that achieves a level of nesting of
   858     // www.liceo.edu.mx is an example of a site that achieves a level of nesting of
   858     // about 1500 tags, all from a bunch of <b>s.  We will only allow at most 20
   859     // about 1500 tags, all from a bunch of <b>s.  We will only allow at most 20
   859     // nested tags of the same type before just ignoring them all together.
   860     // nested tags of the same type before just ignoring them all together.
   860     unsigned i = 0;
   861     unsigned i = 0;
   861     for (HTMLStackElem* curr = blockStack;
   862     for (HTMLStackElem* curr = blockStack; i < cMaxRedundantTagDepth && curr; curr = curr->next) {
   862          i < cMaxRedundantTagDepth && curr && curr->tagName == tagName;
   863         if (curr->tagName == tagName)
   863          curr = curr->next, i++);
   864             i++;
       
   865     }
   864     return i != cMaxRedundantTagDepth;
   866     return i != cMaxRedundantTagDepth;
   865 }
   867 }
   866 
   868 
   867 void HTMLParser::processCloseTag(Token* t)
   869 void HTMLParser::processCloseTag(Token* t)
   868 {
   870 {