Reviewed by Ken.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Dec 2004 17:58:20 +0000 (17:58 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Dec 2004 17:58:20 +0000 (17:58 +0000)
commit523bf262a220a8a1cac3278cf2bdab62b8e6e9aa
treed79f2caf91ab9407cc3fcda14dd9d281c41c6614
parent500dcbfe8c2b36267b95cd2d071b9d23bfc4388d
    Reviewed by Ken.

        - fixed <rdar://problem/3760910> Request to include support for custom tag names in HTML (they already work in XML)

        * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::checkOneSelector): Changed
        some code that used ID_LAST_TAG in a slightly wrong, but harmless, way.

        * khtml/editing/htmlediting.cpp:
        (khtml::debugPosition): Use nodeName rather than getTagName, since the latter works for
        per-document tags and is just better all around for things like the document.
        (khtml::debugNode): Ditto.
        * khtml/editing/selection.cpp: (khtml::Selection::debugPosition): Ditto.
        * khtml/editing/visible_position.cpp: (khtml::VisiblePosition::debugPosition): Ditto.
        * khtml/xml/dom_nodeimpl.cpp: (NodeImpl::displayNode): Ditto.
        * khtml/xml/dom_position.cpp: (DOM::Position::debugPosition): Ditto.

        * khtml/html/dtd.cpp: (DOM::checkChild): Use ID_LAST_TAG rather than 1000 for the check that allows
        non-HTML elements to be nested as desired.

        * khtml/html/htmlparser.h: Change forbidden tag array to be allocated in the object rather than on
        the heap. Also use ID_LAST_TAG for the array size; the old code used ID_CLOSE_TAG which is now a
        much larger number.
        * khtml/html/htmlparser.cpp:
        (KHTMLParser::KHTMLParser): Remove code that creates the forbidden tag array on the heap; makes more
        sense to just have the array be a member so we don't have to use new and delete on it. Also needed
        to eliminate code that used ID_CLOSE_TAG for an array size.
        (KHTMLParser::~KHTMLParser): Remove code that deletes the forbidden tag array. Also changed the code
        that manages isindex to use deref instead of delete.
        (KHTMLParser::reset): Use safer sizeof for clearing the forbidden tag array. Old code had the
        mistake of using ID_CLOSE_TAG for the array size too.
        (KHTMLParser::parseToken): Removed code that checks for bogus tags; it's not clear why it was ever
        there and it would prevent custom tags from working. Added range check before using the forbidden
        tag array with the token ID since custom tags will use index values past the end of the array.
        (KHTMLParser::getElement): Removed most of the code that makes an element by ID; now the work is done
        inside the DocumentImpl createHTMLElement. Any code that needs to be different than a dynamic
        createElement call is still here.
        * khtml/html/htmltokenizer.cpp: (khtml::HTMLTokenizer::parseTag): Call the tagId function in the
        document if getTagID fails; this creates a unique per-document ID.

        * khtml/misc/htmlhashes.h: Changed return types to unsigned short.
        * khtml/misc/htmlhashes.cpp:
        (khtml::getTagID): Changed return type to unsigned short.
        (khtml::getAttrID): Ditto.

        * khtml/misc/htmltags.c: Regenerated.
        * khtml/misc/htmltags.h: Regenerated.

        * khtml/misc/maketags: Changed the generated constants to use "const unsigned short" instead of "#define".
        Changed ID_CLOSE_TAG to be a fixed value of 32000 rather than being just past the IDs of the HTML tags.
        Also rewrote getTagName to work with the new scheme.

        * khtml/xml/dom_docimpl.h: Added overload of createHTMLElement, made it non-virtual since it's not overriden.
        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::createHTMLElement): Refactored into two separate functions, one that takes the tag ID.
        Also updated for a few tags that the parser handled but this did not.

        * kwq/KWQRenderTreeDebug.cpp:
        (getTagName): Added. Works for custom nodes, because it calls nodeName rather than using getTagName on
        the tag ID directly, which only works for standard nodes.
        (operator<<): Update to call getTagName.
        (nodePositionRelativeToRoot): Ditto.
        (writeSelection): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
28 files changed:
LayoutTests/fast/css/namespaces/001-expected.txt
LayoutTests/fast/css/namespaces/002-expected.txt
LayoutTests/fast/css/namespaces/003-expected.txt
LayoutTests/fast/css/namespaces/004-expected.txt
LayoutTests/fast/css/namespaces/005-expected.txt
LayoutTests/fast/css/namespaces/006-expected.txt
LayoutTests/fast/css/namespaces/007-expected.txt
LayoutTests/fast/overflow/003-expected.txt
WebCore/ChangeLog-2005-08-23
WebCore/khtml/css/cssstyleselector.cpp
WebCore/khtml/editing/SelectionController.cpp
WebCore/khtml/editing/htmlediting.cpp
WebCore/khtml/editing/selection.cpp
WebCore/khtml/editing/visible_position.cpp
WebCore/khtml/html/dtd.cpp
WebCore/khtml/html/htmlparser.cpp
WebCore/khtml/html/htmlparser.h
WebCore/khtml/html/htmltokenizer.cpp
WebCore/khtml/misc/htmlhashes.cpp
WebCore/khtml/misc/htmlhashes.h
WebCore/khtml/misc/htmltags.c
WebCore/khtml/misc/htmltags.h
WebCore/khtml/misc/maketags
WebCore/khtml/xml/dom_docimpl.cpp
WebCore/khtml/xml/dom_docimpl.h
WebCore/khtml/xml/dom_nodeimpl.cpp
WebCore/khtml/xml/dom_position.cpp
WebCore/kwq/KWQRenderTreeDebug.cpp