Changeset 7701 in webkit


Ignore:
Timestamp:
Sep 27, 2004 5:57:52 PM (20 years ago)
Author:
hyatt
Message:

ChangeLog

Location:
trunk/WebCore/khtml/html
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/khtml/html/htmlparser.cpp

    r7450 r7701  
    254254        if(endTag[e->id()] == DOM::OPTIONAL)
    255255            popBlock(t->id);
     256           
     257        if (isHeaderTag(t->id))
     258            // Do not allow two header tags to be nested if the intervening tags are inlines.
     259            popNestedHeaderTag();
    256260    }
    257261
     
    12001204}
    12011205
     1206bool KHTMLParser::isHeaderTag(int _id)
     1207{
     1208    switch (_id) {
     1209        case ID_H1:
     1210        case ID_H2:
     1211        case ID_H3:
     1212        case ID_H4:
     1213        case ID_H5:
     1214        case ID_H6:
     1215            return true;
     1216        default:
     1217            return false;
     1218    }
     1219}
     1220
     1221void KHTMLParser::popNestedHeaderTag()
     1222{
     1223    // This function only cares about checking for nested headers that have only inlines in between them.
     1224    NodeImpl* currNode = current;
     1225    for (HTMLStackElem* curr = blockStack; curr; curr = curr->next) {
     1226        if (isHeaderTag(curr->id)) {
     1227            popBlock(curr->id);
     1228            return;
     1229        }
     1230        if (currNode && !currNode->isInline())
     1231            return;
     1232        currNode = curr->node;
     1233    }
     1234}
     1235
    12021236bool KHTMLParser::isResidualStyleTag(int _id)
    12031237{
  • trunk/WebCore/khtml/html/htmlparser.h

    r5560 r7701  
    136136    bool allowNestedRedundantTag(int _id);
    137137   
     138    static bool isHeaderTag(int _id);
     139    void popNestedHeaderTag();
     140
    138141    ushort *forbiddenTag;
    139142   
Note: See TracChangeset for help on using the changeset viewer.