Changeset 9639 in webkit


Ignore:
Timestamp:
Jul 9, 2005, 1:19:28 PM (20 years ago)
Author:
hyatt
Message:

Fix for bugzilla bug 3405, replace NodeImpl::Id with a new class,
QualifiedName, to represent tag names (for DOM elements and CSS
selectors).

Reviewed by mjs

  • WebCore.pbproj/project.pbxproj:
  • khtml/css/css_base.cpp: (CSSSelector::anyTagName): (CSSSelector::print): (CSSSelector::specificity): (CSSSelector::selectorText):
  • khtml/css/css_base.h: (DOM::CSSNamespace::uri): (DOM::CSSNamespace::prefix): (DOM::CSSNamespace::namespaceForPrefix): (DOM::CSSSelector::CSSSelector): (DOM::CSSSelector::hasTag):
  • khtml/css/css_ruleimpl.cpp:
  • khtml/css/css_ruleimpl.h:
  • khtml/css/css_stylesheetimpl.cpp: (CSSStyleSheetImpl::addNamespace): (CSSStyleSheetImpl::determineNamespace):
  • khtml/css/css_stylesheetimpl.h:
  • khtml/css/cssparser.cpp: (CSSParser::CSSParser): (CSSParser::parseSheet):
  • khtml/css/cssparser.h:
  • khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::matchRules): (khtml::CSSStyleSelector::matchRulesForList): (khtml::CSSStyleSelector::canShareStyleWithElement): (khtml::CSSStyleSelector::adjustRenderStyle): (khtml::CSSStyleSelector::checkSelector): (khtml::CSSStyleSelector::checkOneSelector): (khtml::CSSRuleSet::addRule):
  • khtml/css/cssstyleselector.h: (khtml::CSSRuleSet::getTagRules):
  • khtml/css/parser.y:
  • khtml/dom/css_stylesheet.cpp: (LinkStyle::operator = ): (LinkStyle::sheet):
  • khtml/dom/dom_element.cpp: (Element::tagName):
  • khtml/dom/dom_node.cpp: (Node::namespaceURI): (Node::setPrefix):
  • khtml/dom/dom_node.h:
  • khtml/dom/html_base.cpp: (HTMLBodyElement::operator = ): (HTMLFrameElement::operator = ): (HTMLIFrameElement::operator = ): (HTMLFrameSetElement::operator = ): (HTMLHeadElement::operator = ): (HTMLHtmlElement::operator = ):
  • khtml/dom/html_block.cpp: (HTMLBlockquoteElement::operator = ): (HTMLDivElement::operator = ): (HTMLHRElement::operator = ): (HTMLHeadingElement::operator = ): (HTMLParagraphElement::operator = ): (HTMLPreElement::operator = ):
  • khtml/dom/html_element.cpp: (HTMLElement::assignOther):
  • khtml/dom/html_element.h:
  • khtml/dom/html_form.cpp: (HTMLButtonElement::operator = ): (HTMLFieldSetElement::operator = ): (HTMLFormElement::operator = ): (HTMLInputElement::operator = ): (HTMLLabelElement::operator = ): (HTMLLegendElement::operator = ): (HTMLOptGroupElement::operator = ): (HTMLSelectElement::operator = ): (HTMLTextAreaElement::operator = ): (HTMLOptionElement::operator = ): (HTMLIsIndexElement::operator = ):
  • khtml/dom/html_head.cpp: (HTMLBaseElement::operator = ): (HTMLLinkElement::operator = ): (HTMLMetaElement::operator = ): (HTMLScriptElement::operator = ): (HTMLStyleElement::operator = ): (HTMLTitleElement::operator = ):
  • khtml/dom/html_image.cpp: (HTMLAreaElement::operator = ): (HTMLImageElement::operator = ): (HTMLMapElement::operator = ):
  • khtml/dom/html_inline.cpp: (HTMLAnchorElement::operator = ): (HTMLBRElement::operator = ): (HTMLFontElement::operator = ): (HTMLModElement::HTMLModElement): (HTMLModElement::operator = ): (HTMLQuoteElement::HTMLQuoteElement): (HTMLQuoteElement::operator = ):
  • khtml/dom/html_inline.h:
  • khtml/dom/html_list.cpp: (HTMLDListElement::operator = ): (HTMLDirectoryElement::operator = ): (HTMLLIElement::operator = ): (HTMLMenuElement::operator = ): (HTMLOListElement::operator = ): (HTMLUListElement::operator = ):
  • khtml/dom/html_misc.cpp: (HTMLBaseFontElement::operator = ):
  • khtml/dom/html_object.cpp: (DOM::HTMLAppletElement::operator = ): (DOM::HTMLObjectElement::operator = ): (DOM::HTMLParamElement::operator = ):
  • khtml/dom/html_table.cpp: (HTMLTableCaptionElement::operator = ): (HTMLTableCellElement::operator = ): (HTMLTableColElement::operator = ): (HTMLTableElement::operator = ): (HTMLTableRowElement::operator = ): (HTMLTableSectionElement::operator = ):
  • khtml/ecma/kjs_css.cpp: (KJS::DOMStyleSheetList::tryGet):
  • khtml/ecma/kjs_dom.cpp: (KJS::DOMNode::putValue): (KJS::DOMElement::tryGet): (KJS::getRuntimeObject):
  • khtml/ecma/kjs_html.cpp: (KJS::HTMLDocument::tryGet): (KJS::KJS::HTMLDocument::putValue): (KJS::KJS::HTMLElement::classInfo): (KJS::): (KJS::HTMLElement::getSetInfo): (KJS::KJS::HTMLElement::tryGet): (KJS::KJS::HTMLElement::implementsCall): (KJS::KJS::HTMLElement::call): (KJS::HTMLElement::htmlGetter): (KJS::HTMLElement::headGetter): (KJS::HTMLElement::linkGetter): (KJS::HTMLElement::titleGetter): (KJS::HTMLElement::metaGetter): (KJS::HTMLElement::baseGetter): (KJS::HTMLElement::isIndexGetter): (KJS::HTMLElement::styleGetter): (KJS::HTMLElement::bodyGetter): (KJS::HTMLElement::formGetter): (KJS::HTMLElement::selectGetter): (KJS::HTMLElement::optGroupGetter): (KJS::HTMLElement::optionGetter): (KJS::getInputSelectionStart): (KJS::getInputSelectionEnd): (KJS::HTMLElement::inputGetter): (KJS::HTMLElement::textAreaGetter): (KJS::HTMLElement::buttonGetter): (KJS::HTMLElement::labelGetter): (KJS::HTMLElement::fieldSetGetter): (KJS::HTMLElement::legendGetter): (KJS::HTMLElement::uListGetter): (KJS::HTMLElement::oListGetter): (KJS::HTMLElement::dListGetter): (KJS::HTMLElement::dirGetter): (KJS::HTMLElement::menuGetter): (KJS::HTMLElement::liGetter): (KJS::HTMLElement::divGetter): (KJS::HTMLElement::paragraphGetter): (KJS::HTMLElement::headingGetter): (KJS::HTMLElement::blockQuoteGetter): (KJS::HTMLElement::quoteGetter): (KJS::HTMLElement::preGetter): (KJS::HTMLElement::brGetter): (KJS::HTMLElement::baseFontGetter): (KJS::HTMLElement::fontGetter): (KJS::HTMLElement::hrGetter): (KJS::HTMLElement::modGetter): (KJS::HTMLElement::anchorGetter): (KJS::HTMLElement::imageGetter): (KJS::HTMLElement::objectGetter): (KJS::HTMLElement::paramGetter): (KJS::HTMLElement::appletGetter): (KJS::HTMLElement::mapGetter): (KJS::HTMLElement::areaGetter): (KJS::HTMLElement::scriptGetter): (KJS::HTMLElement::tableGetter): (KJS::HTMLElement::tableCaptionGetter): (KJS::HTMLElement::tableColGetter): (KJS::HTMLElement::tableSectionGetter): (KJS::HTMLElement::tableRowGetter): (KJS::HTMLElement::tableCellGetter): (KJS::HTMLElement::frameSetGetter): (KJS::HTMLElement::frameGetter): (KJS::HTMLElement::iFrameGetter): (KJS::HTMLElement::marqueeGetter): (KJS::HTMLElement::getValueProperty): (KJS::KJS::HTMLElement::hasOwnProperty): (KJS::KJS::HTMLElement::toString): (KJS::getForm): (KJS::KJS::HTMLElement::pushEventHandlerScope): (KJS::KJS::HTMLElementFunction::tryCall): (KJS::KJS::HTMLElement::tryPut): (KJS::HTMLElement::htmlSetter): (KJS::HTMLElement::headSetter): (KJS::HTMLElement::linkSetter): (KJS::HTMLElement::titleSetter): (KJS::HTMLElement::metaSetter): (KJS::HTMLElement::baseSetter): (KJS::HTMLElement::isIndexSetter): (KJS::HTMLElement::styleSetter): (KJS::HTMLElement::bodySetter): (KJS::HTMLElement::formSetter): (KJS::HTMLElement::selectSetter): (KJS::HTMLElement::optGroupSetter): (KJS::HTMLElement::optionSetter): (KJS::HTMLElement::inputSetter): (KJS::HTMLElement::textAreaSetter): (KJS::HTMLElement::buttonSetter): (KJS::HTMLElement::labelSetter): (KJS::HTMLElement::fieldSetSetter): (KJS::HTMLElement::legendSetter): (KJS::HTMLElement::uListSetter): (KJS::HTMLElement::oListSetter): (KJS::HTMLElement::dListSetter): (KJS::HTMLElement::dirSetter): (KJS::HTMLElement::menuSetter): (KJS::HTMLElement::liSetter): (KJS::HTMLElement::divSetter): (KJS::HTMLElement::paragraphSetter): (KJS::HTMLElement::headingSetter): (KJS::HTMLElement::blockQuoteSetter): (KJS::HTMLElement::quoteSetter): (KJS::HTMLElement::preSetter): (KJS::HTMLElement::brSetter): (KJS::HTMLElement::baseFontSetter): (KJS::HTMLElement::fontSetter): (KJS::HTMLElement::hrSetter): (KJS::HTMLElement::modSetter): (KJS::HTMLElement::anchorSetter): (KJS::HTMLElement::imageSetter): (KJS::HTMLElement::objectSetter): (KJS::HTMLElement::paramSetter): (KJS::HTMLElement::appletSetter): (KJS::HTMLElement::mapSetter): (KJS::HTMLElement::areaSetter): (KJS::HTMLElement::scriptSetter): (KJS::HTMLElement::tableSetter): (KJS::HTMLElement::tableCaptionSetter): (KJS::HTMLElement::tableColSetter): (KJS::HTMLElement::tableSectionSetter): (KJS::HTMLElement::tableRowSetter): (KJS::HTMLElement::tableCellSetter): (KJS::HTMLElement::frameSetSetter): (KJS::HTMLElement::frameSetter): (KJS::HTMLElement::iFrameSetter): (KJS::HTMLElement::marqueeSetter): (KJS::HTMLElement::putValue): (KJS::toHTMLTableCaptionElement): (KJS::toHTMLTableSectionElement): (KJS::KJS::HTMLCollection::tryGet): (KJS::KJS::HTMLSelectCollection::tryPut):
  • khtml/ecma/kjs_html.h:
  • khtml/ecma/kjs_window.cpp:
  • khtml/editing/apply_style_command.cpp: (khtml::isStyleSpan): (khtml::isEmptyStyleSpan): (khtml::isEmptyFontTag): (khtml::createFontElement): (khtml::createStyleSpanElement): (khtml::ApplyStyleCommand::applyInlineStyle): (khtml::ApplyStyleCommand::isHTMLStyleNode): (khtml::ApplyStyleCommand::removeHTMLFontStyle): (khtml::areIdenticalElements): (khtml::ApplyStyleCommand::mergeEndWithNextIfIdentical): (khtml::ApplyStyleCommand::addInlineStyleIfNeeded):
  • khtml/editing/break_blockquote_command.cpp: (khtml::BreakBlockquoteCommand::doApply):
  • khtml/editing/composite_edit_command.cpp: (khtml::CompositeEditCommand::insertNodeBefore): (khtml::CompositeEditCommand::insertNodeAfter): (khtml::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary): (khtml::createBlockPlaceholderElement):
  • khtml/editing/delete_selection_command.cpp: (khtml::isListStructureNode): (khtml::DeleteSelectionCommand::handleSpecialCaseBRDelete): (khtml::DeleteSelectionCommand::handleGeneralDelete): (khtml::DeleteSelectionCommand::moveNodesAfterNode):
  • khtml/editing/htmlediting.cpp: (khtml::isSpecialElement): (khtml::createDefaultParagraphElement): (khtml::createBreakElement): (khtml::isMailBlockquote):
  • khtml/editing/insert_line_break_command.cpp: (khtml::InsertLineBreakCommand::doApply):
  • khtml/editing/insert_paragraph_separator_command.cpp: (khtml::InsertParagraphSeparatorCommand::doApply):
  • khtml/editing/markup.cpp: (khtml::startMarkup): (khtml::endMarkup): (khtml::markup): (khtml::createMarkup): (khtml::createFragmentFromText):
  • khtml/editing/replace_selection_command.cpp: (khtml::isProbablyBlock): (khtml::isProbablyTableStructureNode): (khtml::ReplacementFragment::isInterchangeNewlineNode): (khtml::ReplacementFragment::removeStyleNodes): (khtml::ReplaceSelectionCommand::doApply): (khtml::ReplaceSelectionCommand::updateNodesInserted):
  • khtml/editing/selection.cpp: (khtml::Selection::debugRenderer):
  • khtml/editing/visible_position.cpp: (khtml::VisiblePosition::init): (khtml::VisiblePosition::isCandidate): (khtml::VisiblePosition::isAtomicNode):
  • khtml/editing/visible_text.cpp: (khtml::TextIterator::handleNonTextNode): (khtml::TextIterator::exitNode): (khtml::SimplifiedBackwardsTextIterator::handleNonTextNode):
  • khtml/editing/visible_units.cpp: (khtml::endOfLine):
  • khtml/html/dtd.cpp: Removed.
  • khtml/html/dtd.h: Removed.
  • khtml/html/html_baseimpl.cpp: (HTMLBodyElementImpl::HTMLBodyElementImpl): (HTMLFrameElementImpl::HTMLFrameElementImpl): (HTMLFrameElementImpl::init): (HTMLFrameElementImpl::attach): (HTMLFrameSetElementImpl::HTMLFrameSetElementImpl): (HTMLFrameSetElementImpl::checkDTD): (HTMLFrameSetElementImpl::attach): (HTMLHeadElementImpl::HTMLHeadElementImpl): (HTMLHeadElementImpl::checkDTD): (HTMLHtmlElementImpl::HTMLHtmlElementImpl): (HTMLHtmlElementImpl::checkDTD): (HTMLIFrameElementImpl::HTMLIFrameElementImpl):
  • khtml/html/html_baseimpl.h: (DOM::HTMLBodyElementImpl::endTagRequirement): (DOM::HTMLBodyElementImpl::tagPriority): (DOM::HTMLFrameElementImpl::endTagRequirement): (DOM::HTMLFrameElementImpl::tagPriority): (DOM::HTMLFrameSetElementImpl::endTagRequirement): (DOM::HTMLFrameSetElementImpl::tagPriority): (DOM::HTMLHeadElementImpl::endTagRequirement): (DOM::HTMLHeadElementImpl::tagPriority): (DOM::HTMLHtmlElementImpl::endTagRequirement): (DOM::HTMLHtmlElementImpl::tagPriority): (DOM::HTMLIFrameElementImpl::endTagRequirement): (DOM::HTMLIFrameElementImpl::tagPriority):
  • khtml/html/html_blockimpl.cpp: (HTMLBlockquoteElementImpl::HTMLBlockquoteElementImpl): (HTMLDivElementImpl::HTMLDivElementImpl): (HTMLHRElementImpl::HTMLHRElementImpl): (HTMLHeadingElementImpl::HTMLHeadingElementImpl): (HTMLHeadingElementImpl::checkDTD): (HTMLParagraphElementImpl::HTMLParagraphElementImpl): (HTMLParagraphElementImpl::checkDTD): (HTMLPreElementImpl::HTMLPreElementImpl): (HTMLMarqueeElementImpl::HTMLMarqueeElementImpl): (HTMLMarqueeElementImpl::parseMappedAttribute):
  • khtml/html/html_blockimpl.h: (DOM::HTMLBlockquoteElementImpl::endTagRequirement): (DOM::HTMLBlockquoteElementImpl::tagPriority): (DOM::HTMLDivElementImpl::endTagRequirement): (DOM::HTMLDivElementImpl::tagPriority): (DOM::HTMLHRElementImpl::endTagRequirement): (DOM::HTMLHRElementImpl::tagPriority): (DOM::HTMLHeadingElementImpl::endTagRequirement): (DOM::HTMLHeadingElementImpl::tagPriority): (DOM::HTMLParagraphElementImpl::endTagRequirement): (DOM::HTMLParagraphElementImpl::tagPriority): (DOM::HTMLPreElementImpl::endTagRequirement): (DOM::HTMLPreElementImpl::tagPriority): (DOM::HTMLMarqueeElementImpl::endTagRequirement): (DOM::HTMLMarqueeElementImpl::tagPriority):
  • khtml/html/html_canvasimpl.cpp: (HTMLCanvasElementImpl::HTMLCanvasElementImpl):
  • khtml/html/html_canvasimpl.h:
  • khtml/html/html_documentimpl.cpp: (DOM::HTMLDocumentImpl::childAllowed): (DOM::HTMLDocumentImpl::createElement):
  • khtml/html/html_documentimpl.h:
  • khtml/html/html_elementimpl.cpp: (HTMLElementImpl::HTMLElementImpl): (HTMLElementImpl::nodeName): (HTMLElementImpl::endTagRequirement): (HTMLElementImpl::tagPriority): (HTMLElementImpl::cloneNode): (HTMLElementImpl::createContextualFragment): (HTMLElementImpl::setInnerHTML): (HTMLElementImpl::setOuterHTML): (HTMLElementImpl::setInnerText): (HTMLElementImpl::setOuterText): (HTMLElementImpl::toString): (HTMLElementImpl::id): (HTMLElementImpl::childAllowed): (HTMLElementImpl::isRecognizedTagName): (inlineTagList): (blockTagList): (HTMLElementImpl::inEitherTagList): (HTMLElementImpl::inInlineTagList): (HTMLElementImpl::inBlockTagList): (HTMLElementImpl::checkDTD):
  • khtml/html/html_elementimpl.h: (DOM::):
  • khtml/html/html_formimpl.cpp: (DOM::HTMLFormElementImpl::HTMLFormElementImpl): (DOM::HTMLFormElementImpl::submitClick): (DOM::HTMLFormElementImpl::formData): (DOM::HTMLFormElementImpl::submit): (DOM::HTMLFormElementImpl::radioClicked): (DOM::HTMLGenericFormElementImpl::HTMLGenericFormElementImpl): (DOM::HTMLGenericFormElementImpl::getForm): (DOM::HTMLButtonElementImpl::HTMLButtonElementImpl): (DOM::HTMLFieldSetElementImpl::HTMLFieldSetElementImpl): (DOM::HTMLFieldSetElementImpl::checkDTD): (DOM::HTMLFieldSetElementImpl::isFocusable): (DOM::HTMLInputElementImpl::HTMLInputElementImpl): (DOM::HTMLInputElementImpl::init): (DOM::HTMLLabelElementImpl::HTMLLabelElementImpl): (DOM::HTMLLabelElementImpl::form): (DOM::HTMLLegendElementImpl::HTMLLegendElementImpl): (DOM::HTMLLegendElementImpl::formElement): (DOM::HTMLSelectElementImpl::HTMLSelectElementImpl): (DOM::HTMLSelectElementImpl::init): (DOM::HTMLSelectElementImpl::checkDTD): (DOM::HTMLSelectElementImpl::selectedIndex): (DOM::HTMLSelectElementImpl::setSelectedIndex): (DOM::HTMLSelectElementImpl::length): (DOM::HTMLSelectElementImpl::add): (DOM::HTMLSelectElementImpl::value): (DOM::HTMLSelectElementImpl::setValue): (DOM::HTMLSelectElementImpl::state): (DOM::HTMLSelectElementImpl::restoreState): (DOM::HTMLSelectElementImpl::appendFormData): (DOM::HTMLSelectElementImpl::optionToListIndex): (DOM::HTMLSelectElementImpl::listToOptionIndex): (DOM::HTMLSelectElementImpl::recalcListItems): (DOM::HTMLSelectElementImpl::reset): (DOM::HTMLSelectElementImpl::notifyOptionSelected): (DOM::HTMLKeygenElementImpl::HTMLKeygenElementImpl): (DOM::HTMLOptGroupElementImpl::HTMLOptGroupElementImpl): (DOM::HTMLOptGroupElementImpl::recalcSelectOptions): (DOM::HTMLOptionElementImpl::HTMLOptionElementImpl): (DOM::HTMLOptionElementImpl::index): (DOM::HTMLOptionElementImpl::getSelect): (DOM::HTMLTextAreaElementImpl::HTMLTextAreaElementImpl): (DOM::HTMLIsIndexElementImpl::HTMLIsIndexElementImpl):
  • khtml/html/html_formimpl.h: (DOM::HTMLFormElementImpl::endTagRequirement): (DOM::HTMLFormElementImpl::tagPriority): (DOM::HTMLGenericFormElementImpl::endTagRequirement): (DOM::HTMLGenericFormElementImpl::tagPriority): (DOM::HTMLFieldSetElementImpl::tagPriority): (DOM::HTMLInputElementImpl::endTagRequirement): (DOM::HTMLInputElementImpl::tagPriority): (DOM::HTMLLabelElementImpl::tagPriority): (DOM::HTMLSelectElementImpl::tagPriority): (DOM::HTMLKeygenElementImpl::tagPriority): (DOM::HTMLOptGroupElementImpl::checkDTD): (DOM::HTMLOptionElementImpl::endTagRequirement): (DOM::HTMLOptionElementImpl::tagPriority): (DOM::HTMLOptionElementImpl::checkDTD): (DOM::HTMLTextAreaElementImpl::checkDTD): (DOM::HTMLTextAreaElementImpl::cols): (DOM::HTMLIsIndexElementImpl::endTagRequirement): (DOM::HTMLIsIndexElementImpl::tagPriority):
  • khtml/html/html_headimpl.cpp: (HTMLBaseElementImpl::HTMLBaseElementImpl): (HTMLLinkElementImpl::HTMLLinkElementImpl): (HTMLMetaElementImpl::HTMLMetaElementImpl): (HTMLScriptElementImpl::HTMLScriptElementImpl): (HTMLStyleElementImpl::HTMLStyleElementImpl): (HTMLTitleElementImpl::HTMLTitleElementImpl):
  • khtml/html/html_headimpl.h: (DOM::HTMLBaseElementImpl::endTagRequirement): (DOM::HTMLBaseElementImpl::tagPriority): (DOM::HTMLLinkElementImpl::endTagRequirement): (DOM::HTMLLinkElementImpl::tagPriority): (DOM::HTMLMetaElementImpl::endTagRequirement): (DOM::HTMLMetaElementImpl::tagPriority): (DOM::HTMLScriptElementImpl::endTagRequirement): (DOM::HTMLScriptElementImpl::tagPriority): (DOM::HTMLScriptElementImpl::checkDTD): (DOM::HTMLStyleElementImpl::endTagRequirement): (DOM::HTMLStyleElementImpl::tagPriority): (DOM::HTMLStyleElementImpl::checkDTD): (DOM::HTMLTitleElementImpl::checkDTD):
  • khtml/html/html_imageimpl.cpp: (HTMLImageLoader::updateFromElement): (HTMLImageElementImpl::HTMLImageElementImpl): (HTMLImageElementImpl::~HTMLImageElementImpl): (HTMLMapElementImpl::HTMLMapElementImpl): (HTMLMapElementImpl::checkDTD): (HTMLMapElementImpl::mapMouseEvent): (HTMLAreaElementImpl::HTMLAreaElementImpl):
  • khtml/html/html_imageimpl.h: (DOM::HTMLImageElementImpl::endTagRequirement): (DOM::HTMLImageElementImpl::tagPriority): (DOM::HTMLAreaElementImpl::endTagRequirement): (DOM::HTMLAreaElementImpl::tagPriority): (DOM::HTMLMapElementImpl::endTagRequirement): (DOM::HTMLMapElementImpl::tagPriority):
  • khtml/html/html_inlineimpl.cpp: (DOM::HTMLAnchorElementImpl::HTMLAnchorElementImpl): (DOM::HTMLAnchorElementImpl::defaultEventHandler): (DOM::HTMLBRElementImpl::HTMLBRElementImpl): (DOM::HTMLFontElementImpl::HTMLFontElementImpl): (DOM::HTMLModElementImpl::HTMLModElementImpl): (DOM::HTMLQuoteElementImpl::HTMLQuoteElementImpl):
  • khtml/html/html_inlineimpl.h: (DOM::HTMLAnchorElementImpl::endTagRequirement): (DOM::HTMLAnchorElementImpl::tagPriority): (DOM::HTMLBRElementImpl::endTagRequirement): (DOM::HTMLBRElementImpl::tagPriority): (DOM::HTMLFontElementImpl::endTagRequirement): (DOM::HTMLFontElementImpl::tagPriority): (DOM::HTMLModElementImpl::endTagRequirement): (DOM::HTMLModElementImpl::tagPriority): (DOM::HTMLQuoteElementImpl::endTagRequirement): (DOM::HTMLQuoteElementImpl::tagPriority):
  • khtml/html/html_listimpl.cpp: (DOM::HTMLOListElementImpl::parseMappedAttribute): (DOM::HTMLLIElementImpl::attach): (DOM::HTMLLIElementImpl::setValue):
  • khtml/html/html_listimpl.h: (DOM::HTMLUListElementImpl::HTMLUListElementImpl): (DOM::HTMLUListElementImpl::endTagRequirement): (DOM::HTMLUListElementImpl::tagPriority): (DOM::HTMLDirectoryElementImpl::HTMLDirectoryElementImpl): (DOM::HTMLDirectoryElementImpl::endTagRequirement): (DOM::HTMLDirectoryElementImpl::tagPriority): (DOM::HTMLMenuElementImpl::HTMLMenuElementImpl): (DOM::HTMLMenuElementImpl::endTagRequirement): (DOM::HTMLMenuElementImpl::tagPriority): (DOM::HTMLOListElementImpl::HTMLOListElementImpl): (DOM::HTMLOListElementImpl::endTagRequirement): (DOM::HTMLOListElementImpl::tagPriority): (DOM::HTMLLIElementImpl::HTMLLIElementImpl): (DOM::HTMLLIElementImpl::endTagRequirement): (DOM::HTMLLIElementImpl::tagPriority): (DOM::HTMLDListElementImpl::HTMLDListElementImpl): (DOM::HTMLDListElementImpl::endTagRequirement): (DOM::HTMLDListElementImpl::tagPriority):
  • khtml/html/html_miscimpl.cpp: (DOM::HTMLBaseFontElementImpl::HTMLBaseFontElementImpl): (DOM::HTMLCollectionImpl::traverseNextItem): (DOM::HTMLCollectionImpl::checkForNameMatch): (DOM::HTMLCollectionImpl::updateNameCache): (DOM::HTMLFormCollectionImpl::getNamedFormItem): (DOM::HTMLFormCollectionImpl::updateNameCache):
  • khtml/html/html_miscimpl.h: (DOM::HTMLBaseFontElementImpl::endTagRequirement): (DOM::HTMLBaseFontElementImpl::tagPriority):
  • khtml/html/html_objectimpl.cpp: (DOM::HTMLAppletElementImpl::HTMLAppletElementImpl): (DOM::HTMLAppletElementImpl::checkDTD): (DOM::HTMLEmbedElementImpl::HTMLEmbedElementImpl): (DOM::HTMLEmbedElementImpl::checkDTD): (DOM::HTMLEmbedElementImpl::rendererIsNeeded): (DOM::HTMLObjectElementImpl::HTMLObjectElementImpl): (DOM::HTMLObjectElementImpl::checkDTD): (DOM::HTMLObjectElementImpl::form): (DOM::HTMLParamElementImpl::HTMLParamElementImpl):
  • khtml/html/html_objectimpl.h: (DOM::HTMLAppletElementImpl::endTagRequirement): (DOM::HTMLAppletElementImpl::tagPriority): (DOM::HTMLEmbedElementImpl::endTagRequirement): (DOM::HTMLEmbedElementImpl::tagPriority): (DOM::HTMLObjectElementImpl::endTagRequirement): (DOM::HTMLObjectElementImpl::tagPriority): (DOM::HTMLParamElementImpl::endTagRequirement): (DOM::HTMLParamElementImpl::tagPriority):
  • khtml/html/html_tableimpl.cpp: (DOM::HTMLTableElementImpl::HTMLTableElementImpl): (DOM::HTMLTableElementImpl::checkDTD): (DOM::HTMLTableElementImpl::createTHead): (DOM::HTMLTableElementImpl::createTFoot): (DOM::HTMLTableElementImpl::insertRow): (DOM::HTMLTableElementImpl::deleteRow): (DOM::HTMLTableElementImpl::addChild): (DOM::HTMLTableSectionElementImpl::HTMLTableSectionElementImpl): (DOM::HTMLTableSectionElementImpl::checkDTD): (DOM::HTMLTableSectionElementImpl::addChild): (DOM::HTMLTableSectionElementImpl::numRows): (DOM::HTMLTableRowElementImpl::checkDTD): (DOM::HTMLTableRowElementImpl::addChild): (DOM::HTMLTableRowElementImpl::rowIndex): (DOM::HTMLTableRowElementImpl::sectionRowIndex): (DOM::HTMLTableRowElementImpl::insertCell): (DOM::HTMLTableCellElementImpl::HTMLTableCellElementImpl): (DOM::HTMLTableCellElementImpl::cellIndex): (DOM::HTMLTableCellElementImpl::additionalAttributeStyleDecl): (DOM::HTMLTableColElementImpl::HTMLTableColElementImpl):
  • khtml/html/html_tableimpl.h: (DOM::HTMLTableElementImpl::endTagRequirement): (DOM::HTMLTableElementImpl::tagPriority): (DOM::HTMLTablePartElementImpl::HTMLTablePartElementImpl): (DOM::HTMLTableSectionElementImpl::endTagRequirement): (DOM::HTMLTableSectionElementImpl::tagPriority): (DOM::HTMLTableRowElementImpl::HTMLTableRowElementImpl): (DOM::HTMLTableRowElementImpl::endTagRequirement): (DOM::HTMLTableRowElementImpl::tagPriority): (DOM::HTMLTableCellElementImpl::endTagRequirement): (DOM::HTMLTableCellElementImpl::tagPriority): (DOM::HTMLTableColElementImpl::endTagRequirement): (DOM::HTMLTableColElementImpl::tagPriority): (DOM::HTMLTableColElementImpl::checkDTD): (DOM::HTMLTableCaptionElementImpl::HTMLTableCaptionElementImpl): (DOM::HTMLTableCaptionElementImpl::endTagRequirement): (DOM::HTMLTableCaptionElementImpl::tagPriority):
  • khtml/html/htmlfactory.cpp: Added. (DOM::htmlConstructor): (DOM::headConstructor): (DOM::bodyConstructor): (DOM::baseConstructor): (DOM::linkConstructor): (DOM::metaConstructor): (DOM::styleConstructor): (DOM::titleConstructor): (DOM::frameConstructor): (DOM::framesetConstructor): (DOM::iframeConstructor): (DOM::formConstructor): (DOM::buttonConstructor): (DOM::inputConstructor): (DOM::isindexConstructor): (DOM::fieldsetConstructor): (DOM::labelConstructor): (DOM::legendConstructor): (DOM::optgroupConstructor): (DOM::optionConstructor): (DOM::selectConstructor): (DOM::textareaConstructor): (DOM::dlConstructor): (DOM::ulConstructor): (DOM::olConstructor): (DOM::dirConstructor): (DOM::menuConstructor): (DOM::liConstructor): (DOM::blockquoteConstructor): (DOM::divConstructor): (DOM::headingConstructor): (DOM::hrConstructor): (DOM::paragraphConstructor): (DOM::preConstructor): (DOM::basefontConstructor): (DOM::fontConstructor): (DOM::modConstructor): (DOM::anchorConstructor): (DOM::imageConstructor): (DOM::mapConstructor): (DOM::areaConstructor): (DOM::canvasConstructor): (DOM::appletConstructor): (DOM::embedConstructor): (DOM::objectConstructor): (DOM::paramConstructor): (DOM::scriptConstructor): (DOM::tableConstructor): (DOM::tableCaptionConstructor): (DOM::tableColConstructor): (DOM::tableRowConstructor): (DOM::tableCellConstructor): (DOM::tableSectionConstructor): (DOM::brConstructor): (DOM::quoteConstructor): (DOM::marqueeConstructor): (DOM::HTMLElementFactory::createHTMLElement):
  • khtml/html/htmlfactory.h: Added.
  • khtml/html/htmlnames.cpp: (DOM::HTMLNames::init):
  • khtml/html/htmlnames.h: (DOM::HTMLNames::xhtmlNamespaceURI):
  • khtml/html/htmlparser.cpp: (HTMLStackElem::HTMLStackElem): (HTMLParser::HTMLParser): (HTMLParser::~HTMLParser): (HTMLParser::reset): (HTMLParser::setCurrent): (HTMLParser::parseToken): (isTableSection): (isTablePart): (isTableRelated): (HTMLParser::insertNode): (HTMLParser::handleError): (HTMLParser::textCreateErrorCheck): (HTMLParser::commentCreateErrorCheck): (HTMLParser::headCreateErrorCheck): (HTMLParser::bodyCreateErrorCheck): (HTMLParser::framesetCreateErrorCheck): (HTMLParser::iframeCreateErrorCheck): (HTMLParser::formCreateErrorCheck): (HTMLParser::isindexCreateErrorCheck): (HTMLParser::selectCreateErrorCheck): (HTMLParser::ddCreateErrorCheck): (HTMLParser::dtCreateErrorCheck): (HTMLParser::nestedCreateErrorCheck): (HTMLParser::nestedStyleCreateErrorCheck): (HTMLParser::tableCellCreateErrorCheck): (HTMLParser::tableSectionCreateErrorCheck): (HTMLParser::noembedCreateErrorCheck): (HTMLParser::noframesCreateErrorCheck): (HTMLParser::noscriptCreateErrorCheck): (HTMLParser::nolayerCreateErrorCheck): (HTMLParser::getNode): (HTMLParser::allowNestedRedundantTag): (HTMLParser::processCloseTag): (HTMLParser::isHeaderTag): (HTMLParser::popNestedHeaderTag): (HTMLParser::isInline): (HTMLParser::isResidualStyleTag): (HTMLParser::isAffectedByResidualStyle): (HTMLParser::handleResidualStyleCloseTagAcrossBlocks): (HTMLParser::reopenResidualStyleTags): (HTMLParser::pushBlock): (HTMLParser::popBlock): (HTMLParser::popOneBlock): (HTMLParser::popInlineBlocks): (HTMLParser::freeBlock): (HTMLParser::createHead): (HTMLParser::handleIsindex): (HTMLParser::startBody): (HTMLParser::finished):
  • khtml/html/htmlparser.h: (HTMLParser::skipMode): (HTMLParser::setSkipMode): (HTMLParser::popBlock):
  • khtml/html/htmltokenizer.cpp: (khtml::HTMLTokenizer::HTMLTokenizer): (khtml::HTMLTokenizer::parseSpecial): (khtml::HTMLTokenizer::scriptHandler): (khtml::HTMLTokenizer::parseComment): (khtml::HTMLTokenizer::parseTag): (khtml::HTMLTokenizer::processToken):
  • khtml/html/htmltokenizer.h: (khtml::Token::Token): (khtml::Token::~Token): (khtml::Token::addAttribute): (khtml::Token::isOpenTag): (khtml::Token::isCloseTag): (khtml::Token::reset):
  • khtml/khtml_part.cpp: (KHTMLPart::init): (KHTMLPart::selectionComputedStyle):
  • khtml/khtmlview.cpp: (KHTMLView::layout): (isSubmitImage):
  • khtml/misc/decoder.cpp: (Decoder::decode):
  • khtml/misc/hashmap.h: (khtml::::size): (khtml::::isEmpty): (khtml::::begin): (khtml::::end): (khtml::::get):
  • khtml/misc/hashset.h: (khtml::::size): (khtml::::isEmpty): (khtml::::begin): (khtml::::end): (khtml::::contains):
  • khtml/misc/hashtable.h: (khtml::HashTableIterator::skipEmptyBuckets): (khtml::::lookup): (khtml::::find): (khtml::::contains): (khtml::::remove):
  • khtml/misc/htmlhashes.cpp: (khtml::getAttrID):
  • khtml/misc/htmlhashes.h:
  • khtml/rendering/bidi.cpp: (khtml::BidiIterator::direction):
  • khtml/rendering/break_lines.cpp: (khtml::isBreakable):
  • khtml/rendering/render_applet.cpp: (RenderApplet::createWidgetIfNecessary):
  • khtml/rendering/render_block.cpp: (khtml::RenderBlock::layoutBlock):
  • khtml/rendering/render_box.cpp: (RenderBox::paintRootBoxDecorations): (RenderBox::paintBackgroundExtended):
  • khtml/rendering/render_canvasimage.cpp: (RenderCanvasImage::paint):
  • khtml/rendering/render_canvasimage.h:
  • khtml/rendering/render_container.cpp: (RenderContainer::updatePseudoChild):
  • khtml/rendering/render_flow.cpp: (RenderFlow::addFocusRingRects):
  • khtml/rendering/render_form.cpp: (RenderFieldset::findLegend): (RenderSelect::updateFromElement): (RenderSelect::layout): (RenderSelect::slotSelected): (RenderSelect::slotSelectionChanged): (RenderSelect::updateSelection):
  • khtml/rendering/render_frames.cpp: (RenderPartObject::updateWidget): (RenderPartObject::slotViewCleared):
  • khtml/rendering/render_image.cpp: (RenderImage::paint): (RenderImage::imageMap): (RenderImage::updateAltText):
  • khtml/rendering/render_image.h:
  • khtml/rendering/render_layer.cpp: (Marquee::marqueeSpeed):
  • khtml/rendering/render_line.cpp:
  • khtml/rendering/render_list.cpp: (getParentOfFirstLineBox):
  • khtml/rendering/render_object.cpp: (RenderObject::isBody): (RenderObject::isHR): (RenderObject::isHTMLMarquee): (RenderObject::sizesToMaxWidth): (RenderObject::information): (RenderObject::setStyle): (RenderObject::getTextDecorationColors): (RenderObject::setPixmap):
  • khtml/rendering/render_style.cpp: (RenderStyle::getPseudoStyle):
  • khtml/rendering/render_style.h:
  • khtml/rendering/render_table.cpp: (RenderTable::addChild): (RenderTable::layout): (RenderTableSection::addChild): (RenderTableRow::addChild): (RenderTableCell::updateFromElement): (RenderTableCol::updateFromElement):
  • khtml/xml/dom2_rangeimpl.cpp:
  • khtml/xml/dom2_traversalimpl.cpp:
  • khtml/xml/dom_atomicstring.cpp: (DOM::equal): (DOM::AtomicString::init):
  • khtml/xml/dom_atomicstring.h:
  • khtml/xml/dom_docimpl.cpp: (DocumentImpl::createElement): (DocumentImpl::importNode): (DocumentImpl::createElementNS): (DocumentImpl::body): (DocumentImpl::shouldScheduleLayout): (DocumentImpl::attrId): (DocumentImpl::recalcStyleSelector):
  • khtml/xml/dom_docimpl.h:
  • khtml/xml/dom_elementimpl.cpp: (AttrImpl::prefix): (AttrImpl::setPrefix): (ElementImpl::ElementImpl): (ElementImpl::~ElementImpl): (ElementImpl::cloneNode): (ElementImpl::hasAttributes): (ElementImpl::nodeName): (ElementImpl::setPrefix): (ElementImpl::openTagStartToString): (ElementImpl::toString): (StyledElementImpl::StyledElementImpl):
  • khtml/xml/dom_elementimpl.h: (DOM::ElementImpl::tagName): (DOM::ElementImpl::hasTagName): (DOM::ElementImpl::hasLocalName): (DOM::ElementImpl::localName): (DOM::ElementImpl::prefix): (DOM::ElementImpl::namespaceURI): (DOM::ElementImpl::mouseEventHandler):
  • khtml/xml/dom_nodeimpl.cpp: (DOM::NodeImpl::lastDescendant): (DOM::NodeImpl::prefix): (DOM::NodeImpl::setPrefix): (DOM::NodeImpl::localName): (DOM::NodeImpl::namespaceURI): (DOM::NodeImpl::checkSetPrefix): (DOM::NodeImpl::isAtomicNode): (DOM::NodeImpl::maxDeepOffset): (DOM::NodeImpl::enclosingBlockFlowOrTableElement): (DOM::NodeImpl::enclosingBlockFlowElement): (DOM::NodeImpl::enclosingInlineElement): (DOM::NodeImpl::rootEditableElement): (DOM::NodeImpl::getElementsByTagNameNS): (DOM::NodeImpl::showTreeAndMark): (DOM::ContainerNodeImpl::addChild): (DOM::TagNodeListImpl::TagNodeListImpl): (DOM::TagNodeListImpl::item): (DOM::TagNodeListImpl::nodeMatches):
  • khtml/xml/dom_nodeimpl.h: (DOM::NodeImpl::hasTagName): (DOM::NodeImpl::isCommentNode): (DOM::NodeImpl::isDocumentNode): (DOM::NodeImpl::closeRenderer): (DOM::NodeImpl::getElementsByTagName):
  • khtml/xml/dom_position.cpp: (DOM::Position::downstream): (DOM::Position::rendersInDifferentPosition): (DOM::Position::leadingWhitespacePosition): (DOM::Position::trailingWhitespacePosition):
  • khtml/xml/dom_qname.cpp: (DOM::hashComponents): (DOM::QNameHash::hash): (DOM::QNameHash::equal): (DOM::equalComponents): (DOM::convertComponents): (DOM::QualifiedName::QualifiedName): (DOM::QualifiedName::deref): (DOM::QualifiedName::setPrefix):
  • khtml/xml/dom_qname.h: (DOM::QualifiedName::hasPrefix): (DOM::operator==):
  • khtml/xml/dom_textimpl.cpp: (CommentImpl::localName): (CommentImpl::nodeName): (TextImpl::localName): (TextImpl::nodeName):
  • khtml/xml/dom_textimpl.h: (DOM::CommentImpl::isCommentNode): (DOM::TextImpl::isTextNode):
  • khtml/xml/xml_tokenizer.cpp: (khtml::XMLTokenizer::startElement): (khtml::XMLTokenizer::insertErrorMessageBlock): (khtml::XMLTokenizer::addScripts):
  • kwq/DOM.mm: (-[DOMNode setPrefix:]): (+[DOMNode _nodeWithImpl:]): (-[DOMElement tagName]):
  • kwq/DOMHTML.mm: (-[DOMHTMLQuoteElement _quoteElementImpl]):
  • kwq/KWQAccObject.mm: (-[KWQAccObject role]): (-[KWQAccObject title]): (-[KWQAccObject accessibilityIsIgnored]):
  • kwq/KWQDOMNode.cpp: Removed.
  • kwq/KWQDOMNode.h: Removed.
  • kwq/KWQFont.h: (QFont::): (QFont::isFixedPitch):
  • kwq/KWQFont.mm: (QFont::QFont): (QFont::operator=): (QFont::determinePitch): (QFont::operator==):
  • kwq/KWQKHTMLPart.cpp: (KWQKHTMLPart::isFrameSet):
  • kwq/KWQKHTMLPart.mm: (scanForForm): (KWQKHTMLPart::currentForm): (KWQKHTMLPart::searchForLabelsAboveCell): (KWQKHTMLPart::searchForLabelsBeforeElement): (listParent): (isTextFirstInListItem): (KWQKHTMLPart::attributedString): (KWQKHTMLPart::styleForSelectionStart): (KWQKHTMLPart::setSelectionFromNone):
  • kwq/KWQRenderTreeDebug.cpp: (getTagName):
  • kwq/WebCoreBridge.mm: (inputElementFromDOMElement): (formElementFromDOMElement): (-[WebCoreBridge elementAtPoint:]):
  • layout-tests/fast/dom/css-dom-read-expected.txt:
  • layout-tests/fast/overflow/003-expected.txt:
  • layout-tests/fast/tokenizer/002-expected.txt:
  • layout-tests/fast/tokenizer/external-script-document-write-expected.txt:
  • layout-tests/fast/tokenizer/script_extra_close-expected.txt:
  • layout-tests/fast/tokenizer/script_quirk-expected.txt: Removed.
  • layout-tests/fast/tokenizer/script_quirk.html: Removed.
Location:
trunk
Files:
2 added
6 deleted
139 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/fast/dom/css-dom-read-expected.txt

    r9435 r9639  
    1010.three { display: list-item; list-style-type: square; margin-left: 3em; }
    1111.four { display: none; color: red; }
    12 I { display: block; }
     12i { display: block; }
    1313
  • trunk/LayoutTests/fast/overflow/003-expected.txt

    r8582 r9639  
    55layer at (10,10) size 282x302 clip at (11,11) size 265x300 scrollHeight 1292
    66  RenderBlock {channel} at (0,0) size 282x302 [bgcolor=#EEEEEE] [border: (1px solid #000000)]
    7     RenderBlock {TITLE} at (11,11) size 255x19
     7    RenderBlock {title} at (11,11) size 255x19
    88      RenderText {TEXT} at (0,0) size 154x19
    99        text run at (0,0) width 154: "scottandrew.com"
     
    1212        text run at (0,0) width 191: "DHTML, DOM and JavaScript News"
    1313    RenderBlock {item} at (1,62) size 265x97 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
    14       RenderInline {TITLE} at (0,0) size 233x15
     14      RenderInline {title} at (0,0) size 233x15
    1515        RenderText {TEXT} at (10,11) size 233x15
    1616          text run at (10,11) width 233: "DHTML Animation Array Generator"
     
    2525      RenderText {TEXT} at (0,0) size 0x0
    2626    RenderBlock {item} at (1,169) size 265x82 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
    27       RenderInline {TITLE} at (0,0) size 177x15
     27      RenderInline {title} at (0,0) size 177x15
    2828        RenderText {TEXT} at (10,11) size 177x15
    2929          text run at (10,11) width 177: "DOM and Extended Entries"
     
    3939      RenderText {TEXT} at (0,0) size 0x0
    4040    RenderBlock {item} at (1,261) size 265x82 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
    41       RenderInline {TITLE} at (0,0) size 164x15
     41      RenderInline {title} at (0,0) size 164x15
    4242        RenderText {TEXT} at (10,11) size 164x15
    4343          text run at (10,11) width 164: "cellspacing and the DOM"
     
    5353      RenderText {TEXT} at (0,0) size 0x0
    5454    RenderBlock {item} at (1,353) size 265x97 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
    55       RenderInline {TITLE} at (0,0) size 177x15
     55      RenderInline {title} at (0,0) size 177x15
    5656        RenderText {TEXT} at (10,11) size 177x15
    5757          text run at (10,11) width 177: "contenteditable for Mozilla"
     
    6868      RenderText {TEXT} at (0,0) size 0x0
    6969    RenderBlock {item} at (1,460) size 265x82 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
    70       RenderInline {TITLE} at (0,0) size 182x30
     70      RenderInline {title} at (0,0) size 182x30
    7171        RenderText {TEXT} at (10,11) size 182x30
    7272          text run at (10,11) width 182: "DHTML Timeline/Keyframe"
     
    8282      RenderText {TEXT} at (0,0) size 0x0
    8383    RenderBlock {item} at (1,552) size 265x97 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
    84       RenderInline {TITLE} at (0,0) size 157x30
     84      RenderInline {title} at (0,0) size 157x30
    8585        RenderText {TEXT} at (10,11) size 157x30
    8686          text run at (10,11) width 157: "DynAPI 2.9 and Mozilla"
     
    9797      RenderText {TEXT} at (0,0) size 0x0
    9898    RenderBlock {item} at (1,659) size 265x67 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
    99       RenderInline {TITLE} at (0,0) size 154x15
     99      RenderInline {title} at (0,0) size 154x15
    100100        RenderText {TEXT} at (10,11) size 154x15
    101101          text run at (10,11) width 154: "!lineDraw bookmarklet"
     
    110110      RenderText {TEXT} at (0,0) size 0x0
    111111    RenderBlock {item} at (1,736) size 265x97 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
    112       RenderInline {TITLE} at (0,0) size 201x15
     112      RenderInline {title} at (0,0) size 201x15
    113113        RenderText {TEXT} at (10,11) size 201x15
    114114          text run at (10,11) width 201: "Mozilla, DHTML and DOM links"
     
    125125      RenderText {TEXT} at (0,0) size 0x0
    126126    RenderBlock {item} at (1,843) size 265x67 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
    127       RenderInline {TITLE} at (0,0) size 103x15
     127      RenderInline {title} at (0,0) size 103x15
    128128        RenderText {TEXT} at (10,11) size 103x15
    129129          text run at (10,11) width 103: "Mozilla 1.0 RC2"
     
    138138      RenderText {TEXT} at (0,0) size 0x0
    139139    RenderBlock {item} at (1,920) size 265x97 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
    140       RenderInline {TITLE} at (0,0) size 236x30
     140      RenderInline {title} at (0,0) size 236x30
    141141        RenderText {TEXT} at (10,11) size 236x30
    142142          text run at (10,11) width 236: "javascript: is deprecated. Don't use"
     
    153153      RenderText {TEXT} at (0,0) size 0x0
    154154    RenderBlock {item} at (1,1027) size 265x67 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
    155       RenderInline {TITLE} at (0,0) size 176x15
     155      RenderInline {title} at (0,0) size 176x15
    156156        RenderText {TEXT} at (10,11) size 176x15
    157157          text run at (10,11) width 176: "Conditional Script Loading"
     
    164164      RenderText {TEXT} at (0,0) size 0x0
    165165    RenderBlock {item} at (1,1104) size 265x82 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
    166       RenderInline {TITLE} at (0,0) size 115x15
     166      RenderInline {title} at (0,0) size 115x15
    167167        RenderText {TEXT} at (10,11) size 115x15
    168168          text run at (10,11) width 115: "Stories and Tools"
     
    178178      RenderText {TEXT} at (0,0) size 0x0
    179179    RenderBlock {item} at (1,1196) size 265x97 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
    180       RenderInline {TITLE} at (0,0) size 166x15
     180      RenderInline {title} at (0,0) size 166x15
    181181        RenderText {TEXT} at (10,11) size 166x15
    182182          text run at (10,11) width 166: "Whole Lotto Gecko Links"
  • trunk/LayoutTests/fast/tokenizer/002-expected.txt

    r7122 r9639  
    11layer at (0,0) size 800x600
    22  RenderCanvas at (0,0) size 800x600
    3 layer at (0,0) size 800x34
    4   RenderBlock {HTML} at (0,0) size 800x34
    5     RenderBody {BODY} at (8,8) size 784x18
     3layer at (0,0) size 800x600
     4  RenderBlock {HTML} at (0,0) size 800x600
     5    RenderBody {BODY} at (8,8) size 784x584
    66      RenderText {TEXT} at (0,0) size 315x18
    77        text run at (0,0) width 315: "you shouldn't see a random chinese character here"
  • trunk/LayoutTests/fast/tokenizer/external-script-document-write-expected.txt

    r7857 r9639  
    55    RenderBody {BODY} at (8,8) size 784x18
    66      RenderInline {SPAN} at (0,0) size 0x0
    7       RenderText {TEXT} at (0,0) size 226x18
    8         text run at (0,0) width 226: "This should be a span: [object span]"
     7      RenderText {TEXT} at (0,0) size 239x18
     8        text run at (0,0) width 239: "This should be a span: [object SPAN]"
  • trunk/LayoutTests/fast/tokenizer/script_extra_close-expected.txt

    r9603 r9639  
    77        text run at (0,0) width 55: "TEST... "
    88      RenderText {TEXT} at (0,0) size 0x0
    9       RenderText {TEXT} at (0,0) size 0x0
    109      RenderText {TEXT} at (55,0) size 232x18
    1110        text run at (55,0) width 69: "PASSED. "
  • trunk/WebCore/ChangeLog-2005-08-23

    r9636 r9639  
     12005-07-09  David Hyatt  <hyatt@apple.com>
     2
     3        Fix for bugzilla bug 3405, replace NodeImpl::Id with a new class,
     4        QualifiedName, to represent tag names (for DOM elements and CSS
     5        selectors).
     6       
     7        Reviewed by mjs
     8
     9        * WebCore.pbproj/project.pbxproj:
     10        * khtml/css/css_base.cpp:
     11        (CSSSelector::anyTagName):
     12        (CSSSelector::print):
     13        (CSSSelector::specificity):
     14        (CSSSelector::selectorText):
     15        * khtml/css/css_base.h:
     16        (DOM::CSSNamespace::uri):
     17        (DOM::CSSNamespace::prefix):
     18        (DOM::CSSNamespace::namespaceForPrefix):
     19        (DOM::CSSSelector::CSSSelector):
     20        (DOM::CSSSelector::hasTag):
     21        * khtml/css/css_ruleimpl.cpp:
     22        * khtml/css/css_ruleimpl.h:
     23        * khtml/css/css_stylesheetimpl.cpp:
     24        (CSSStyleSheetImpl::addNamespace):
     25        (CSSStyleSheetImpl::determineNamespace):
     26        * khtml/css/css_stylesheetimpl.h:
     27        * khtml/css/cssparser.cpp:
     28        (CSSParser::CSSParser):
     29        (CSSParser::parseSheet):
     30        * khtml/css/cssparser.h:
     31        * khtml/css/cssstyleselector.cpp:
     32        (khtml::CSSStyleSelector::matchRules):
     33        (khtml::CSSStyleSelector::matchRulesForList):
     34        (khtml::CSSStyleSelector::canShareStyleWithElement):
     35        (khtml::CSSStyleSelector::adjustRenderStyle):
     36        (khtml::CSSStyleSelector::checkSelector):
     37        (khtml::CSSStyleSelector::checkOneSelector):
     38        (khtml::CSSRuleSet::addRule):
     39        * khtml/css/cssstyleselector.h:
     40        (khtml::CSSRuleSet::getTagRules):
     41        * khtml/css/parser.y:
     42        * khtml/dom/css_stylesheet.cpp:
     43        (LinkStyle::operator = ):
     44        (LinkStyle::sheet):
     45        * khtml/dom/dom_element.cpp:
     46        (Element::tagName):
     47        * khtml/dom/dom_node.cpp:
     48        (Node::namespaceURI):
     49        (Node::setPrefix):
     50        * khtml/dom/dom_node.h:
     51        * khtml/dom/html_base.cpp:
     52        (HTMLBodyElement::operator = ):
     53        (HTMLFrameElement::operator = ):
     54        (HTMLIFrameElement::operator = ):
     55        (HTMLFrameSetElement::operator = ):
     56        (HTMLHeadElement::operator = ):
     57        (HTMLHtmlElement::operator = ):
     58        * khtml/dom/html_block.cpp:
     59        (HTMLBlockquoteElement::operator = ):
     60        (HTMLDivElement::operator = ):
     61        (HTMLHRElement::operator = ):
     62        (HTMLHeadingElement::operator = ):
     63        (HTMLParagraphElement::operator = ):
     64        (HTMLPreElement::operator = ):
     65        * khtml/dom/html_element.cpp:
     66        (HTMLElement::assignOther):
     67        * khtml/dom/html_element.h:
     68        * khtml/dom/html_form.cpp:
     69        (HTMLButtonElement::operator = ):
     70        (HTMLFieldSetElement::operator = ):
     71        (HTMLFormElement::operator = ):
     72        (HTMLInputElement::operator = ):
     73        (HTMLLabelElement::operator = ):
     74        (HTMLLegendElement::operator = ):
     75        (HTMLOptGroupElement::operator = ):
     76        (HTMLSelectElement::operator = ):
     77        (HTMLTextAreaElement::operator = ):
     78        (HTMLOptionElement::operator = ):
     79        (HTMLIsIndexElement::operator = ):
     80        * khtml/dom/html_head.cpp:
     81        (HTMLBaseElement::operator = ):
     82        (HTMLLinkElement::operator = ):
     83        (HTMLMetaElement::operator = ):
     84        (HTMLScriptElement::operator = ):
     85        (HTMLStyleElement::operator = ):
     86        (HTMLTitleElement::operator = ):
     87        * khtml/dom/html_image.cpp:
     88        (HTMLAreaElement::operator = ):
     89        (HTMLImageElement::operator = ):
     90        (HTMLMapElement::operator = ):
     91        * khtml/dom/html_inline.cpp:
     92        (HTMLAnchorElement::operator = ):
     93        (HTMLBRElement::operator = ):
     94        (HTMLFontElement::operator = ):
     95        (HTMLModElement::HTMLModElement):
     96        (HTMLModElement::operator = ):
     97        (HTMLQuoteElement::HTMLQuoteElement):
     98        (HTMLQuoteElement::operator = ):
     99        * khtml/dom/html_inline.h:
     100        * khtml/dom/html_list.cpp:
     101        (HTMLDListElement::operator = ):
     102        (HTMLDirectoryElement::operator = ):
     103        (HTMLLIElement::operator = ):
     104        (HTMLMenuElement::operator = ):
     105        (HTMLOListElement::operator = ):
     106        (HTMLUListElement::operator = ):
     107        * khtml/dom/html_misc.cpp:
     108        (HTMLBaseFontElement::operator = ):
     109        * khtml/dom/html_object.cpp:
     110        (DOM::HTMLAppletElement::operator = ):
     111        (DOM::HTMLObjectElement::operator = ):
     112        (DOM::HTMLParamElement::operator = ):
     113        * khtml/dom/html_table.cpp:
     114        (HTMLTableCaptionElement::operator = ):
     115        (HTMLTableCellElement::operator = ):
     116        (HTMLTableColElement::operator = ):
     117        (HTMLTableElement::operator = ):
     118        (HTMLTableRowElement::operator = ):
     119        (HTMLTableSectionElement::operator = ):
     120        * khtml/ecma/kjs_css.cpp:
     121        (KJS::DOMStyleSheetList::tryGet):
     122        * khtml/ecma/kjs_dom.cpp:
     123        (KJS::DOMNode::putValue):
     124        (KJS::DOMElement::tryGet):
     125        (KJS::getRuntimeObject):
     126        * khtml/ecma/kjs_html.cpp:
     127        (KJS::HTMLDocument::tryGet):
     128        (KJS::KJS::HTMLDocument::putValue):
     129        (KJS::KJS::HTMLElement::classInfo):
     130        (KJS::):
     131        (KJS::HTMLElement::getSetInfo):
     132        (KJS::KJS::HTMLElement::tryGet):
     133        (KJS::KJS::HTMLElement::implementsCall):
     134        (KJS::KJS::HTMLElement::call):
     135        (KJS::HTMLElement::htmlGetter):
     136        (KJS::HTMLElement::headGetter):
     137        (KJS::HTMLElement::linkGetter):
     138        (KJS::HTMLElement::titleGetter):
     139        (KJS::HTMLElement::metaGetter):
     140        (KJS::HTMLElement::baseGetter):
     141        (KJS::HTMLElement::isIndexGetter):
     142        (KJS::HTMLElement::styleGetter):
     143        (KJS::HTMLElement::bodyGetter):
     144        (KJS::HTMLElement::formGetter):
     145        (KJS::HTMLElement::selectGetter):
     146        (KJS::HTMLElement::optGroupGetter):
     147        (KJS::HTMLElement::optionGetter):
     148        (KJS::getInputSelectionStart):
     149        (KJS::getInputSelectionEnd):
     150        (KJS::HTMLElement::inputGetter):
     151        (KJS::HTMLElement::textAreaGetter):
     152        (KJS::HTMLElement::buttonGetter):
     153        (KJS::HTMLElement::labelGetter):
     154        (KJS::HTMLElement::fieldSetGetter):
     155        (KJS::HTMLElement::legendGetter):
     156        (KJS::HTMLElement::uListGetter):
     157        (KJS::HTMLElement::oListGetter):
     158        (KJS::HTMLElement::dListGetter):
     159        (KJS::HTMLElement::dirGetter):
     160        (KJS::HTMLElement::menuGetter):
     161        (KJS::HTMLElement::liGetter):
     162        (KJS::HTMLElement::divGetter):
     163        (KJS::HTMLElement::paragraphGetter):
     164        (KJS::HTMLElement::headingGetter):
     165        (KJS::HTMLElement::blockQuoteGetter):
     166        (KJS::HTMLElement::quoteGetter):
     167        (KJS::HTMLElement::preGetter):
     168        (KJS::HTMLElement::brGetter):
     169        (KJS::HTMLElement::baseFontGetter):
     170        (KJS::HTMLElement::fontGetter):
     171        (KJS::HTMLElement::hrGetter):
     172        (KJS::HTMLElement::modGetter):
     173        (KJS::HTMLElement::anchorGetter):
     174        (KJS::HTMLElement::imageGetter):
     175        (KJS::HTMLElement::objectGetter):
     176        (KJS::HTMLElement::paramGetter):
     177        (KJS::HTMLElement::appletGetter):
     178        (KJS::HTMLElement::mapGetter):
     179        (KJS::HTMLElement::areaGetter):
     180        (KJS::HTMLElement::scriptGetter):
     181        (KJS::HTMLElement::tableGetter):
     182        (KJS::HTMLElement::tableCaptionGetter):
     183        (KJS::HTMLElement::tableColGetter):
     184        (KJS::HTMLElement::tableSectionGetter):
     185        (KJS::HTMLElement::tableRowGetter):
     186        (KJS::HTMLElement::tableCellGetter):
     187        (KJS::HTMLElement::frameSetGetter):
     188        (KJS::HTMLElement::frameGetter):
     189        (KJS::HTMLElement::iFrameGetter):
     190        (KJS::HTMLElement::marqueeGetter):
     191        (KJS::HTMLElement::getValueProperty):
     192        (KJS::KJS::HTMLElement::hasOwnProperty):
     193        (KJS::KJS::HTMLElement::toString):
     194        (KJS::getForm):
     195        (KJS::KJS::HTMLElement::pushEventHandlerScope):
     196        (KJS::KJS::HTMLElementFunction::tryCall):
     197        (KJS::KJS::HTMLElement::tryPut):
     198        (KJS::HTMLElement::htmlSetter):
     199        (KJS::HTMLElement::headSetter):
     200        (KJS::HTMLElement::linkSetter):
     201        (KJS::HTMLElement::titleSetter):
     202        (KJS::HTMLElement::metaSetter):
     203        (KJS::HTMLElement::baseSetter):
     204        (KJS::HTMLElement::isIndexSetter):
     205        (KJS::HTMLElement::styleSetter):
     206        (KJS::HTMLElement::bodySetter):
     207        (KJS::HTMLElement::formSetter):
     208        (KJS::HTMLElement::selectSetter):
     209        (KJS::HTMLElement::optGroupSetter):
     210        (KJS::HTMLElement::optionSetter):
     211        (KJS::HTMLElement::inputSetter):
     212        (KJS::HTMLElement::textAreaSetter):
     213        (KJS::HTMLElement::buttonSetter):
     214        (KJS::HTMLElement::labelSetter):
     215        (KJS::HTMLElement::fieldSetSetter):
     216        (KJS::HTMLElement::legendSetter):
     217        (KJS::HTMLElement::uListSetter):
     218        (KJS::HTMLElement::oListSetter):
     219        (KJS::HTMLElement::dListSetter):
     220        (KJS::HTMLElement::dirSetter):
     221        (KJS::HTMLElement::menuSetter):
     222        (KJS::HTMLElement::liSetter):
     223        (KJS::HTMLElement::divSetter):
     224        (KJS::HTMLElement::paragraphSetter):
     225        (KJS::HTMLElement::headingSetter):
     226        (KJS::HTMLElement::blockQuoteSetter):
     227        (KJS::HTMLElement::quoteSetter):
     228        (KJS::HTMLElement::preSetter):
     229        (KJS::HTMLElement::brSetter):
     230        (KJS::HTMLElement::baseFontSetter):
     231        (KJS::HTMLElement::fontSetter):
     232        (KJS::HTMLElement::hrSetter):
     233        (KJS::HTMLElement::modSetter):
     234        (KJS::HTMLElement::anchorSetter):
     235        (KJS::HTMLElement::imageSetter):
     236        (KJS::HTMLElement::objectSetter):
     237        (KJS::HTMLElement::paramSetter):
     238        (KJS::HTMLElement::appletSetter):
     239        (KJS::HTMLElement::mapSetter):
     240        (KJS::HTMLElement::areaSetter):
     241        (KJS::HTMLElement::scriptSetter):
     242        (KJS::HTMLElement::tableSetter):
     243        (KJS::HTMLElement::tableCaptionSetter):
     244        (KJS::HTMLElement::tableColSetter):
     245        (KJS::HTMLElement::tableSectionSetter):
     246        (KJS::HTMLElement::tableRowSetter):
     247        (KJS::HTMLElement::tableCellSetter):
     248        (KJS::HTMLElement::frameSetSetter):
     249        (KJS::HTMLElement::frameSetter):
     250        (KJS::HTMLElement::iFrameSetter):
     251        (KJS::HTMLElement::marqueeSetter):
     252        (KJS::HTMLElement::putValue):
     253        (KJS::toHTMLTableCaptionElement):
     254        (KJS::toHTMLTableSectionElement):
     255        (KJS::KJS::HTMLCollection::tryGet):
     256        (KJS::KJS::HTMLSelectCollection::tryPut):
     257        * khtml/ecma/kjs_html.h:
     258        * khtml/ecma/kjs_window.cpp:
     259        * khtml/editing/apply_style_command.cpp:
     260        (khtml::isStyleSpan):
     261        (khtml::isEmptyStyleSpan):
     262        (khtml::isEmptyFontTag):
     263        (khtml::createFontElement):
     264        (khtml::createStyleSpanElement):
     265        (khtml::ApplyStyleCommand::applyInlineStyle):
     266        (khtml::ApplyStyleCommand::isHTMLStyleNode):
     267        (khtml::ApplyStyleCommand::removeHTMLFontStyle):
     268        (khtml::areIdenticalElements):
     269        (khtml::ApplyStyleCommand::mergeEndWithNextIfIdentical):
     270        (khtml::ApplyStyleCommand::addInlineStyleIfNeeded):
     271        * khtml/editing/break_blockquote_command.cpp:
     272        (khtml::BreakBlockquoteCommand::doApply):
     273        * khtml/editing/composite_edit_command.cpp:
     274        (khtml::CompositeEditCommand::insertNodeBefore):
     275        (khtml::CompositeEditCommand::insertNodeAfter):
     276        (khtml::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):
     277        (khtml::createBlockPlaceholderElement):
     278        * khtml/editing/delete_selection_command.cpp:
     279        (khtml::isListStructureNode):
     280        (khtml::DeleteSelectionCommand::handleSpecialCaseBRDelete):
     281        (khtml::DeleteSelectionCommand::handleGeneralDelete):
     282        (khtml::DeleteSelectionCommand::moveNodesAfterNode):
     283        * khtml/editing/htmlediting.cpp:
     284        (khtml::isSpecialElement):
     285        (khtml::createDefaultParagraphElement):
     286        (khtml::createBreakElement):
     287        (khtml::isMailBlockquote):
     288        * khtml/editing/insert_line_break_command.cpp:
     289        (khtml::InsertLineBreakCommand::doApply):
     290        * khtml/editing/insert_paragraph_separator_command.cpp:
     291        (khtml::InsertParagraphSeparatorCommand::doApply):
     292        * khtml/editing/markup.cpp:
     293        (khtml::startMarkup):
     294        (khtml::endMarkup):
     295        (khtml::markup):
     296        (khtml::createMarkup):
     297        (khtml::createFragmentFromText):
     298        * khtml/editing/replace_selection_command.cpp:
     299        (khtml::isProbablyBlock):
     300        (khtml::isProbablyTableStructureNode):
     301        (khtml::ReplacementFragment::isInterchangeNewlineNode):
     302        (khtml::ReplacementFragment::removeStyleNodes):
     303        (khtml::ReplaceSelectionCommand::doApply):
     304        (khtml::ReplaceSelectionCommand::updateNodesInserted):
     305        * khtml/editing/selection.cpp:
     306        (khtml::Selection::debugRenderer):
     307        * khtml/editing/visible_position.cpp:
     308        (khtml::VisiblePosition::init):
     309        (khtml::VisiblePosition::isCandidate):
     310        (khtml::VisiblePosition::isAtomicNode):
     311        * khtml/editing/visible_text.cpp:
     312        (khtml::TextIterator::handleNonTextNode):
     313        (khtml::TextIterator::exitNode):
     314        (khtml::SimplifiedBackwardsTextIterator::handleNonTextNode):
     315        * khtml/editing/visible_units.cpp:
     316        (khtml::endOfLine):
     317        * khtml/html/dtd.cpp: Removed.
     318        * khtml/html/dtd.h: Removed.
     319        * khtml/html/html_baseimpl.cpp:
     320        (HTMLBodyElementImpl::HTMLBodyElementImpl):
     321        (HTMLFrameElementImpl::HTMLFrameElementImpl):
     322        (HTMLFrameElementImpl::init):
     323        (HTMLFrameElementImpl::attach):
     324        (HTMLFrameSetElementImpl::HTMLFrameSetElementImpl):
     325        (HTMLFrameSetElementImpl::checkDTD):
     326        (HTMLFrameSetElementImpl::attach):
     327        (HTMLHeadElementImpl::HTMLHeadElementImpl):
     328        (HTMLHeadElementImpl::checkDTD):
     329        (HTMLHtmlElementImpl::HTMLHtmlElementImpl):
     330        (HTMLHtmlElementImpl::checkDTD):
     331        (HTMLIFrameElementImpl::HTMLIFrameElementImpl):
     332        * khtml/html/html_baseimpl.h:
     333        (DOM::HTMLBodyElementImpl::endTagRequirement):
     334        (DOM::HTMLBodyElementImpl::tagPriority):
     335        (DOM::HTMLFrameElementImpl::endTagRequirement):
     336        (DOM::HTMLFrameElementImpl::tagPriority):
     337        (DOM::HTMLFrameSetElementImpl::endTagRequirement):
     338        (DOM::HTMLFrameSetElementImpl::tagPriority):
     339        (DOM::HTMLHeadElementImpl::endTagRequirement):
     340        (DOM::HTMLHeadElementImpl::tagPriority):
     341        (DOM::HTMLHtmlElementImpl::endTagRequirement):
     342        (DOM::HTMLHtmlElementImpl::tagPriority):
     343        (DOM::HTMLIFrameElementImpl::endTagRequirement):
     344        (DOM::HTMLIFrameElementImpl::tagPriority):
     345        * khtml/html/html_blockimpl.cpp:
     346        (HTMLBlockquoteElementImpl::HTMLBlockquoteElementImpl):
     347        (HTMLDivElementImpl::HTMLDivElementImpl):
     348        (HTMLHRElementImpl::HTMLHRElementImpl):
     349        (HTMLHeadingElementImpl::HTMLHeadingElementImpl):
     350        (HTMLHeadingElementImpl::checkDTD):
     351        (HTMLParagraphElementImpl::HTMLParagraphElementImpl):
     352        (HTMLParagraphElementImpl::checkDTD):
     353        (HTMLPreElementImpl::HTMLPreElementImpl):
     354        (HTMLMarqueeElementImpl::HTMLMarqueeElementImpl):
     355        (HTMLMarqueeElementImpl::parseMappedAttribute):
     356        * khtml/html/html_blockimpl.h:
     357        (DOM::HTMLBlockquoteElementImpl::endTagRequirement):
     358        (DOM::HTMLBlockquoteElementImpl::tagPriority):
     359        (DOM::HTMLDivElementImpl::endTagRequirement):
     360        (DOM::HTMLDivElementImpl::tagPriority):
     361        (DOM::HTMLHRElementImpl::endTagRequirement):
     362        (DOM::HTMLHRElementImpl::tagPriority):
     363        (DOM::HTMLHeadingElementImpl::endTagRequirement):
     364        (DOM::HTMLHeadingElementImpl::tagPriority):
     365        (DOM::HTMLParagraphElementImpl::endTagRequirement):
     366        (DOM::HTMLParagraphElementImpl::tagPriority):
     367        (DOM::HTMLPreElementImpl::endTagRequirement):
     368        (DOM::HTMLPreElementImpl::tagPriority):
     369        (DOM::HTMLMarqueeElementImpl::endTagRequirement):
     370        (DOM::HTMLMarqueeElementImpl::tagPriority):
     371        * khtml/html/html_canvasimpl.cpp:
     372        (HTMLCanvasElementImpl::HTMLCanvasElementImpl):
     373        * khtml/html/html_canvasimpl.h:
     374        * khtml/html/html_documentimpl.cpp:
     375        (DOM::HTMLDocumentImpl::childAllowed):
     376        (DOM::HTMLDocumentImpl::createElement):
     377        * khtml/html/html_documentimpl.h:
     378        * khtml/html/html_elementimpl.cpp:
     379        (HTMLElementImpl::HTMLElementImpl):
     380        (HTMLElementImpl::nodeName):
     381        (HTMLElementImpl::endTagRequirement):
     382        (HTMLElementImpl::tagPriority):
     383        (HTMLElementImpl::cloneNode):
     384        (HTMLElementImpl::createContextualFragment):
     385        (HTMLElementImpl::setInnerHTML):
     386        (HTMLElementImpl::setOuterHTML):
     387        (HTMLElementImpl::setInnerText):
     388        (HTMLElementImpl::setOuterText):
     389        (HTMLElementImpl::toString):
     390        (HTMLElementImpl::id):
     391        (HTMLElementImpl::childAllowed):
     392        (HTMLElementImpl::isRecognizedTagName):
     393        (inlineTagList):
     394        (blockTagList):
     395        (HTMLElementImpl::inEitherTagList):
     396        (HTMLElementImpl::inInlineTagList):
     397        (HTMLElementImpl::inBlockTagList):
     398        (HTMLElementImpl::checkDTD):
     399        * khtml/html/html_elementimpl.h:
     400        (DOM::):
     401        * khtml/html/html_formimpl.cpp:
     402        (DOM::HTMLFormElementImpl::HTMLFormElementImpl):
     403        (DOM::HTMLFormElementImpl::submitClick):
     404        (DOM::HTMLFormElementImpl::formData):
     405        (DOM::HTMLFormElementImpl::submit):
     406        (DOM::HTMLFormElementImpl::radioClicked):
     407        (DOM::HTMLGenericFormElementImpl::HTMLGenericFormElementImpl):
     408        (DOM::HTMLGenericFormElementImpl::getForm):
     409        (DOM::HTMLButtonElementImpl::HTMLButtonElementImpl):
     410        (DOM::HTMLFieldSetElementImpl::HTMLFieldSetElementImpl):
     411        (DOM::HTMLFieldSetElementImpl::checkDTD):
     412        (DOM::HTMLFieldSetElementImpl::isFocusable):
     413        (DOM::HTMLInputElementImpl::HTMLInputElementImpl):
     414        (DOM::HTMLInputElementImpl::init):
     415        (DOM::HTMLLabelElementImpl::HTMLLabelElementImpl):
     416        (DOM::HTMLLabelElementImpl::form):
     417        (DOM::HTMLLegendElementImpl::HTMLLegendElementImpl):
     418        (DOM::HTMLLegendElementImpl::formElement):
     419        (DOM::HTMLSelectElementImpl::HTMLSelectElementImpl):
     420        (DOM::HTMLSelectElementImpl::init):
     421        (DOM::HTMLSelectElementImpl::checkDTD):
     422        (DOM::HTMLSelectElementImpl::selectedIndex):
     423        (DOM::HTMLSelectElementImpl::setSelectedIndex):
     424        (DOM::HTMLSelectElementImpl::length):
     425        (DOM::HTMLSelectElementImpl::add):
     426        (DOM::HTMLSelectElementImpl::value):
     427        (DOM::HTMLSelectElementImpl::setValue):
     428        (DOM::HTMLSelectElementImpl::state):
     429        (DOM::HTMLSelectElementImpl::restoreState):
     430        (DOM::HTMLSelectElementImpl::appendFormData):
     431        (DOM::HTMLSelectElementImpl::optionToListIndex):
     432        (DOM::HTMLSelectElementImpl::listToOptionIndex):
     433        (DOM::HTMLSelectElementImpl::recalcListItems):
     434        (DOM::HTMLSelectElementImpl::reset):
     435        (DOM::HTMLSelectElementImpl::notifyOptionSelected):
     436        (DOM::HTMLKeygenElementImpl::HTMLKeygenElementImpl):
     437        (DOM::HTMLOptGroupElementImpl::HTMLOptGroupElementImpl):
     438        (DOM::HTMLOptGroupElementImpl::recalcSelectOptions):
     439        (DOM::HTMLOptionElementImpl::HTMLOptionElementImpl):
     440        (DOM::HTMLOptionElementImpl::index):
     441        (DOM::HTMLOptionElementImpl::getSelect):
     442        (DOM::HTMLTextAreaElementImpl::HTMLTextAreaElementImpl):
     443        (DOM::HTMLIsIndexElementImpl::HTMLIsIndexElementImpl):
     444        * khtml/html/html_formimpl.h:
     445        (DOM::HTMLFormElementImpl::endTagRequirement):
     446        (DOM::HTMLFormElementImpl::tagPriority):
     447        (DOM::HTMLGenericFormElementImpl::endTagRequirement):
     448        (DOM::HTMLGenericFormElementImpl::tagPriority):
     449        (DOM::HTMLFieldSetElementImpl::tagPriority):
     450        (DOM::HTMLInputElementImpl::endTagRequirement):
     451        (DOM::HTMLInputElementImpl::tagPriority):
     452        (DOM::HTMLLabelElementImpl::tagPriority):
     453        (DOM::HTMLSelectElementImpl::tagPriority):
     454        (DOM::HTMLKeygenElementImpl::tagPriority):
     455        (DOM::HTMLOptGroupElementImpl::checkDTD):
     456        (DOM::HTMLOptionElementImpl::endTagRequirement):
     457        (DOM::HTMLOptionElementImpl::tagPriority):
     458        (DOM::HTMLOptionElementImpl::checkDTD):
     459        (DOM::HTMLTextAreaElementImpl::checkDTD):
     460        (DOM::HTMLTextAreaElementImpl::cols):
     461        (DOM::HTMLIsIndexElementImpl::endTagRequirement):
     462        (DOM::HTMLIsIndexElementImpl::tagPriority):
     463        * khtml/html/html_headimpl.cpp:
     464        (HTMLBaseElementImpl::HTMLBaseElementImpl):
     465        (HTMLLinkElementImpl::HTMLLinkElementImpl):
     466        (HTMLMetaElementImpl::HTMLMetaElementImpl):
     467        (HTMLScriptElementImpl::HTMLScriptElementImpl):
     468        (HTMLStyleElementImpl::HTMLStyleElementImpl):
     469        (HTMLTitleElementImpl::HTMLTitleElementImpl):
     470        * khtml/html/html_headimpl.h:
     471        (DOM::HTMLBaseElementImpl::endTagRequirement):
     472        (DOM::HTMLBaseElementImpl::tagPriority):
     473        (DOM::HTMLLinkElementImpl::endTagRequirement):
     474        (DOM::HTMLLinkElementImpl::tagPriority):
     475        (DOM::HTMLMetaElementImpl::endTagRequirement):
     476        (DOM::HTMLMetaElementImpl::tagPriority):
     477        (DOM::HTMLScriptElementImpl::endTagRequirement):
     478        (DOM::HTMLScriptElementImpl::tagPriority):
     479        (DOM::HTMLScriptElementImpl::checkDTD):
     480        (DOM::HTMLStyleElementImpl::endTagRequirement):
     481        (DOM::HTMLStyleElementImpl::tagPriority):
     482        (DOM::HTMLStyleElementImpl::checkDTD):
     483        (DOM::HTMLTitleElementImpl::checkDTD):
     484        * khtml/html/html_imageimpl.cpp:
     485        (HTMLImageLoader::updateFromElement):
     486        (HTMLImageElementImpl::HTMLImageElementImpl):
     487        (HTMLImageElementImpl::~HTMLImageElementImpl):
     488        (HTMLMapElementImpl::HTMLMapElementImpl):
     489        (HTMLMapElementImpl::checkDTD):
     490        (HTMLMapElementImpl::mapMouseEvent):
     491        (HTMLAreaElementImpl::HTMLAreaElementImpl):
     492        * khtml/html/html_imageimpl.h:
     493        (DOM::HTMLImageElementImpl::endTagRequirement):
     494        (DOM::HTMLImageElementImpl::tagPriority):
     495        (DOM::HTMLAreaElementImpl::endTagRequirement):
     496        (DOM::HTMLAreaElementImpl::tagPriority):
     497        (DOM::HTMLMapElementImpl::endTagRequirement):
     498        (DOM::HTMLMapElementImpl::tagPriority):
     499        * khtml/html/html_inlineimpl.cpp:
     500        (DOM::HTMLAnchorElementImpl::HTMLAnchorElementImpl):
     501        (DOM::HTMLAnchorElementImpl::defaultEventHandler):
     502        (DOM::HTMLBRElementImpl::HTMLBRElementImpl):
     503        (DOM::HTMLFontElementImpl::HTMLFontElementImpl):
     504        (DOM::HTMLModElementImpl::HTMLModElementImpl):
     505        (DOM::HTMLQuoteElementImpl::HTMLQuoteElementImpl):
     506        * khtml/html/html_inlineimpl.h:
     507        (DOM::HTMLAnchorElementImpl::endTagRequirement):
     508        (DOM::HTMLAnchorElementImpl::tagPriority):
     509        (DOM::HTMLBRElementImpl::endTagRequirement):
     510        (DOM::HTMLBRElementImpl::tagPriority):
     511        (DOM::HTMLFontElementImpl::endTagRequirement):
     512        (DOM::HTMLFontElementImpl::tagPriority):
     513        (DOM::HTMLModElementImpl::endTagRequirement):
     514        (DOM::HTMLModElementImpl::tagPriority):
     515        (DOM::HTMLQuoteElementImpl::endTagRequirement):
     516        (DOM::HTMLQuoteElementImpl::tagPriority):
     517        * khtml/html/html_listimpl.cpp:
     518        (DOM::HTMLOListElementImpl::parseMappedAttribute):
     519        (DOM::HTMLLIElementImpl::attach):
     520        (DOM::HTMLLIElementImpl::setValue):
     521        * khtml/html/html_listimpl.h:
     522        (DOM::HTMLUListElementImpl::HTMLUListElementImpl):
     523        (DOM::HTMLUListElementImpl::endTagRequirement):
     524        (DOM::HTMLUListElementImpl::tagPriority):
     525        (DOM::HTMLDirectoryElementImpl::HTMLDirectoryElementImpl):
     526        (DOM::HTMLDirectoryElementImpl::endTagRequirement):
     527        (DOM::HTMLDirectoryElementImpl::tagPriority):
     528        (DOM::HTMLMenuElementImpl::HTMLMenuElementImpl):
     529        (DOM::HTMLMenuElementImpl::endTagRequirement):
     530        (DOM::HTMLMenuElementImpl::tagPriority):
     531        (DOM::HTMLOListElementImpl::HTMLOListElementImpl):
     532        (DOM::HTMLOListElementImpl::endTagRequirement):
     533        (DOM::HTMLOListElementImpl::tagPriority):
     534        (DOM::HTMLLIElementImpl::HTMLLIElementImpl):
     535        (DOM::HTMLLIElementImpl::endTagRequirement):
     536        (DOM::HTMLLIElementImpl::tagPriority):
     537        (DOM::HTMLDListElementImpl::HTMLDListElementImpl):
     538        (DOM::HTMLDListElementImpl::endTagRequirement):
     539        (DOM::HTMLDListElementImpl::tagPriority):
     540        * khtml/html/html_miscimpl.cpp:
     541        (DOM::HTMLBaseFontElementImpl::HTMLBaseFontElementImpl):
     542        (DOM::HTMLCollectionImpl::traverseNextItem):
     543        (DOM::HTMLCollectionImpl::checkForNameMatch):
     544        (DOM::HTMLCollectionImpl::updateNameCache):
     545        (DOM::HTMLFormCollectionImpl::getNamedFormItem):
     546        (DOM::HTMLFormCollectionImpl::updateNameCache):
     547        * khtml/html/html_miscimpl.h:
     548        (DOM::HTMLBaseFontElementImpl::endTagRequirement):
     549        (DOM::HTMLBaseFontElementImpl::tagPriority):
     550        * khtml/html/html_objectimpl.cpp:
     551        (DOM::HTMLAppletElementImpl::HTMLAppletElementImpl):
     552        (DOM::HTMLAppletElementImpl::checkDTD):
     553        (DOM::HTMLEmbedElementImpl::HTMLEmbedElementImpl):
     554        (DOM::HTMLEmbedElementImpl::checkDTD):
     555        (DOM::HTMLEmbedElementImpl::rendererIsNeeded):
     556        (DOM::HTMLObjectElementImpl::HTMLObjectElementImpl):
     557        (DOM::HTMLObjectElementImpl::checkDTD):
     558        (DOM::HTMLObjectElementImpl::form):
     559        (DOM::HTMLParamElementImpl::HTMLParamElementImpl):
     560        * khtml/html/html_objectimpl.h:
     561        (DOM::HTMLAppletElementImpl::endTagRequirement):
     562        (DOM::HTMLAppletElementImpl::tagPriority):
     563        (DOM::HTMLEmbedElementImpl::endTagRequirement):
     564        (DOM::HTMLEmbedElementImpl::tagPriority):
     565        (DOM::HTMLObjectElementImpl::endTagRequirement):
     566        (DOM::HTMLObjectElementImpl::tagPriority):
     567        (DOM::HTMLParamElementImpl::endTagRequirement):
     568        (DOM::HTMLParamElementImpl::tagPriority):
     569        * khtml/html/html_tableimpl.cpp:
     570        (DOM::HTMLTableElementImpl::HTMLTableElementImpl):
     571        (DOM::HTMLTableElementImpl::checkDTD):
     572        (DOM::HTMLTableElementImpl::createTHead):
     573        (DOM::HTMLTableElementImpl::createTFoot):
     574        (DOM::HTMLTableElementImpl::insertRow):
     575        (DOM::HTMLTableElementImpl::deleteRow):
     576        (DOM::HTMLTableElementImpl::addChild):
     577        (DOM::HTMLTableSectionElementImpl::HTMLTableSectionElementImpl):
     578        (DOM::HTMLTableSectionElementImpl::checkDTD):
     579        (DOM::HTMLTableSectionElementImpl::addChild):
     580        (DOM::HTMLTableSectionElementImpl::numRows):
     581        (DOM::HTMLTableRowElementImpl::checkDTD):
     582        (DOM::HTMLTableRowElementImpl::addChild):
     583        (DOM::HTMLTableRowElementImpl::rowIndex):
     584        (DOM::HTMLTableRowElementImpl::sectionRowIndex):
     585        (DOM::HTMLTableRowElementImpl::insertCell):
     586        (DOM::HTMLTableCellElementImpl::HTMLTableCellElementImpl):
     587        (DOM::HTMLTableCellElementImpl::cellIndex):
     588        (DOM::HTMLTableCellElementImpl::additionalAttributeStyleDecl):
     589        (DOM::HTMLTableColElementImpl::HTMLTableColElementImpl):
     590        * khtml/html/html_tableimpl.h:
     591        (DOM::HTMLTableElementImpl::endTagRequirement):
     592        (DOM::HTMLTableElementImpl::tagPriority):
     593        (DOM::HTMLTablePartElementImpl::HTMLTablePartElementImpl):
     594        (DOM::HTMLTableSectionElementImpl::endTagRequirement):
     595        (DOM::HTMLTableSectionElementImpl::tagPriority):
     596        (DOM::HTMLTableRowElementImpl::HTMLTableRowElementImpl):
     597        (DOM::HTMLTableRowElementImpl::endTagRequirement):
     598        (DOM::HTMLTableRowElementImpl::tagPriority):
     599        (DOM::HTMLTableCellElementImpl::endTagRequirement):
     600        (DOM::HTMLTableCellElementImpl::tagPriority):
     601        (DOM::HTMLTableColElementImpl::endTagRequirement):
     602        (DOM::HTMLTableColElementImpl::tagPriority):
     603        (DOM::HTMLTableColElementImpl::checkDTD):
     604        (DOM::HTMLTableCaptionElementImpl::HTMLTableCaptionElementImpl):
     605        (DOM::HTMLTableCaptionElementImpl::endTagRequirement):
     606        (DOM::HTMLTableCaptionElementImpl::tagPriority):
     607        * khtml/html/htmlfactory.cpp: Added.
     608        (DOM::htmlConstructor):
     609        (DOM::headConstructor):
     610        (DOM::bodyConstructor):
     611        (DOM::baseConstructor):
     612        (DOM::linkConstructor):
     613        (DOM::metaConstructor):
     614        (DOM::styleConstructor):
     615        (DOM::titleConstructor):
     616        (DOM::frameConstructor):
     617        (DOM::framesetConstructor):
     618        (DOM::iframeConstructor):
     619        (DOM::formConstructor):
     620        (DOM::buttonConstructor):
     621        (DOM::inputConstructor):
     622        (DOM::isindexConstructor):
     623        (DOM::fieldsetConstructor):
     624        (DOM::labelConstructor):
     625        (DOM::legendConstructor):
     626        (DOM::optgroupConstructor):
     627        (DOM::optionConstructor):
     628        (DOM::selectConstructor):
     629        (DOM::textareaConstructor):
     630        (DOM::dlConstructor):
     631        (DOM::ulConstructor):
     632        (DOM::olConstructor):
     633        (DOM::dirConstructor):
     634        (DOM::menuConstructor):
     635        (DOM::liConstructor):
     636        (DOM::blockquoteConstructor):
     637        (DOM::divConstructor):
     638        (DOM::headingConstructor):
     639        (DOM::hrConstructor):
     640        (DOM::paragraphConstructor):
     641        (DOM::preConstructor):
     642        (DOM::basefontConstructor):
     643        (DOM::fontConstructor):
     644        (DOM::modConstructor):
     645        (DOM::anchorConstructor):
     646        (DOM::imageConstructor):
     647        (DOM::mapConstructor):
     648        (DOM::areaConstructor):
     649        (DOM::canvasConstructor):
     650        (DOM::appletConstructor):
     651        (DOM::embedConstructor):
     652        (DOM::objectConstructor):
     653        (DOM::paramConstructor):
     654        (DOM::scriptConstructor):
     655        (DOM::tableConstructor):
     656        (DOM::tableCaptionConstructor):
     657        (DOM::tableColConstructor):
     658        (DOM::tableRowConstructor):
     659        (DOM::tableCellConstructor):
     660        (DOM::tableSectionConstructor):
     661        (DOM::brConstructor):
     662        (DOM::quoteConstructor):
     663        (DOM::marqueeConstructor):
     664        (DOM::HTMLElementFactory::createHTMLElement):
     665        * khtml/html/htmlfactory.h: Added.
     666        * khtml/html/htmlnames.cpp:
     667        (DOM::HTMLNames::init):
     668        * khtml/html/htmlnames.h:
     669        (DOM::HTMLNames::xhtmlNamespaceURI):
     670        * khtml/html/htmlparser.cpp:
     671        (HTMLStackElem::HTMLStackElem):
     672        (HTMLParser::HTMLParser):
     673        (HTMLParser::~HTMLParser):
     674        (HTMLParser::reset):
     675        (HTMLParser::setCurrent):
     676        (HTMLParser::parseToken):
     677        (isTableSection):
     678        (isTablePart):
     679        (isTableRelated):
     680        (HTMLParser::insertNode):
     681        (HTMLParser::handleError):
     682        (HTMLParser::textCreateErrorCheck):
     683        (HTMLParser::commentCreateErrorCheck):
     684        (HTMLParser::headCreateErrorCheck):
     685        (HTMLParser::bodyCreateErrorCheck):
     686        (HTMLParser::framesetCreateErrorCheck):
     687        (HTMLParser::iframeCreateErrorCheck):
     688        (HTMLParser::formCreateErrorCheck):
     689        (HTMLParser::isindexCreateErrorCheck):
     690        (HTMLParser::selectCreateErrorCheck):
     691        (HTMLParser::ddCreateErrorCheck):
     692        (HTMLParser::dtCreateErrorCheck):
     693        (HTMLParser::nestedCreateErrorCheck):
     694        (HTMLParser::nestedStyleCreateErrorCheck):
     695        (HTMLParser::tableCellCreateErrorCheck):
     696        (HTMLParser::tableSectionCreateErrorCheck):
     697        (HTMLParser::noembedCreateErrorCheck):
     698        (HTMLParser::noframesCreateErrorCheck):
     699        (HTMLParser::noscriptCreateErrorCheck):
     700        (HTMLParser::nolayerCreateErrorCheck):
     701        (HTMLParser::getNode):
     702        (HTMLParser::allowNestedRedundantTag):
     703        (HTMLParser::processCloseTag):
     704        (HTMLParser::isHeaderTag):
     705        (HTMLParser::popNestedHeaderTag):
     706        (HTMLParser::isInline):
     707        (HTMLParser::isResidualStyleTag):
     708        (HTMLParser::isAffectedByResidualStyle):
     709        (HTMLParser::handleResidualStyleCloseTagAcrossBlocks):
     710        (HTMLParser::reopenResidualStyleTags):
     711        (HTMLParser::pushBlock):
     712        (HTMLParser::popBlock):
     713        (HTMLParser::popOneBlock):
     714        (HTMLParser::popInlineBlocks):
     715        (HTMLParser::freeBlock):
     716        (HTMLParser::createHead):
     717        (HTMLParser::handleIsindex):
     718        (HTMLParser::startBody):
     719        (HTMLParser::finished):
     720        * khtml/html/htmlparser.h:
     721        (HTMLParser::skipMode):
     722        (HTMLParser::setSkipMode):
     723        (HTMLParser::popBlock):
     724        * khtml/html/htmltokenizer.cpp:
     725        (khtml::HTMLTokenizer::HTMLTokenizer):
     726        (khtml::HTMLTokenizer::parseSpecial):
     727        (khtml::HTMLTokenizer::scriptHandler):
     728        (khtml::HTMLTokenizer::parseComment):
     729        (khtml::HTMLTokenizer::parseTag):
     730        (khtml::HTMLTokenizer::processToken):
     731        * khtml/html/htmltokenizer.h:
     732        (khtml::Token::Token):
     733        (khtml::Token::~Token):
     734        (khtml::Token::addAttribute):
     735        (khtml::Token::isOpenTag):
     736        (khtml::Token::isCloseTag):
     737        (khtml::Token::reset):
     738        * khtml/khtml_part.cpp:
     739        (KHTMLPart::init):
     740        (KHTMLPart::selectionComputedStyle):
     741        * khtml/khtmlview.cpp:
     742        (KHTMLView::layout):
     743        (isSubmitImage):
     744        * khtml/misc/decoder.cpp:
     745        (Decoder::decode):
     746        * khtml/misc/hashmap.h:
     747        (khtml::::size):
     748        (khtml::::isEmpty):
     749        (khtml::::begin):
     750        (khtml::::end):
     751        (khtml::::get):
     752        * khtml/misc/hashset.h:
     753        (khtml::::size):
     754        (khtml::::isEmpty):
     755        (khtml::::begin):
     756        (khtml::::end):
     757        (khtml::::contains):
     758        * khtml/misc/hashtable.h:
     759        (khtml::HashTableIterator::skipEmptyBuckets):
     760        (khtml::::lookup):
     761        (khtml::::find):
     762        (khtml::::contains):
     763        (khtml::::remove):
     764        * khtml/misc/htmlhashes.cpp:
     765        (khtml::getAttrID):
     766        * khtml/misc/htmlhashes.h:
     767        * khtml/rendering/bidi.cpp:
     768        (khtml::BidiIterator::direction):
     769        * khtml/rendering/break_lines.cpp:
     770        (khtml::isBreakable):
     771        * khtml/rendering/render_applet.cpp:
     772        (RenderApplet::createWidgetIfNecessary):
     773        * khtml/rendering/render_block.cpp:
     774        (khtml::RenderBlock::layoutBlock):
     775        * khtml/rendering/render_box.cpp:
     776        (RenderBox::paintRootBoxDecorations):
     777        (RenderBox::paintBackgroundExtended):
     778        * khtml/rendering/render_canvasimage.cpp:
     779        (RenderCanvasImage::paint):
     780        * khtml/rendering/render_canvasimage.h:
     781        * khtml/rendering/render_container.cpp:
     782        (RenderContainer::updatePseudoChild):
     783        * khtml/rendering/render_flow.cpp:
     784        (RenderFlow::addFocusRingRects):
     785        * khtml/rendering/render_form.cpp:
     786        (RenderFieldset::findLegend):
     787        (RenderSelect::updateFromElement):
     788        (RenderSelect::layout):
     789        (RenderSelect::slotSelected):
     790        (RenderSelect::slotSelectionChanged):
     791        (RenderSelect::updateSelection):
     792        * khtml/rendering/render_frames.cpp:
     793        (RenderPartObject::updateWidget):
     794        (RenderPartObject::slotViewCleared):
     795        * khtml/rendering/render_image.cpp:
     796        (RenderImage::paint):
     797        (RenderImage::imageMap):
     798        (RenderImage::updateAltText):
     799        * khtml/rendering/render_image.h:
     800        * khtml/rendering/render_layer.cpp:
     801        (Marquee::marqueeSpeed):
     802        * khtml/rendering/render_line.cpp:
     803        * khtml/rendering/render_list.cpp:
     804        (getParentOfFirstLineBox):
     805        * khtml/rendering/render_object.cpp:
     806        (RenderObject::isBody):
     807        (RenderObject::isHR):
     808        (RenderObject::isHTMLMarquee):
     809        (RenderObject::sizesToMaxWidth):
     810        (RenderObject::information):
     811        (RenderObject::setStyle):
     812        (RenderObject::getTextDecorationColors):
     813        (RenderObject::setPixmap):
     814        * khtml/rendering/render_style.cpp:
     815        (RenderStyle::getPseudoStyle):
     816        * khtml/rendering/render_style.h:
     817        * khtml/rendering/render_table.cpp:
     818        (RenderTable::addChild):
     819        (RenderTable::layout):
     820        (RenderTableSection::addChild):
     821        (RenderTableRow::addChild):
     822        (RenderTableCell::updateFromElement):
     823        (RenderTableCol::updateFromElement):
     824        * khtml/xml/dom2_rangeimpl.cpp:
     825        * khtml/xml/dom2_traversalimpl.cpp:
     826        * khtml/xml/dom_atomicstring.cpp:
     827        (DOM::equal):
     828        (DOM::AtomicString::init):
     829        * khtml/xml/dom_atomicstring.h:
     830        * khtml/xml/dom_docimpl.cpp:
     831        (DocumentImpl::createElement):
     832        (DocumentImpl::importNode):
     833        (DocumentImpl::createElementNS):
     834        (DocumentImpl::body):
     835        (DocumentImpl::shouldScheduleLayout):
     836        (DocumentImpl::attrId):
     837        (DocumentImpl::recalcStyleSelector):
     838        * khtml/xml/dom_docimpl.h:
     839        * khtml/xml/dom_elementimpl.cpp:
     840        (AttrImpl::prefix):
     841        (AttrImpl::setPrefix):
     842        (ElementImpl::ElementImpl):
     843        (ElementImpl::~ElementImpl):
     844        (ElementImpl::cloneNode):
     845        (ElementImpl::hasAttributes):
     846        (ElementImpl::nodeName):
     847        (ElementImpl::setPrefix):
     848        (ElementImpl::openTagStartToString):
     849        (ElementImpl::toString):
     850        (StyledElementImpl::StyledElementImpl):
     851        * khtml/xml/dom_elementimpl.h:
     852        (DOM::ElementImpl::tagName):
     853        (DOM::ElementImpl::hasTagName):
     854        (DOM::ElementImpl::hasLocalName):
     855        (DOM::ElementImpl::localName):
     856        (DOM::ElementImpl::prefix):
     857        (DOM::ElementImpl::namespaceURI):
     858        (DOM::ElementImpl::mouseEventHandler):
     859        * khtml/xml/dom_nodeimpl.cpp:
     860        (DOM::NodeImpl::lastDescendant):
     861        (DOM::NodeImpl::prefix):
     862        (DOM::NodeImpl::setPrefix):
     863        (DOM::NodeImpl::localName):
     864        (DOM::NodeImpl::namespaceURI):
     865        (DOM::NodeImpl::checkSetPrefix):
     866        (DOM::NodeImpl::isAtomicNode):
     867        (DOM::NodeImpl::maxDeepOffset):
     868        (DOM::NodeImpl::enclosingBlockFlowOrTableElement):
     869        (DOM::NodeImpl::enclosingBlockFlowElement):
     870        (DOM::NodeImpl::enclosingInlineElement):
     871        (DOM::NodeImpl::rootEditableElement):
     872        (DOM::NodeImpl::getElementsByTagNameNS):
     873        (DOM::NodeImpl::showTreeAndMark):
     874        (DOM::ContainerNodeImpl::addChild):
     875        (DOM::TagNodeListImpl::TagNodeListImpl):
     876        (DOM::TagNodeListImpl::item):
     877        (DOM::TagNodeListImpl::nodeMatches):
     878        * khtml/xml/dom_nodeimpl.h:
     879        (DOM::NodeImpl::hasTagName):
     880        (DOM::NodeImpl::isCommentNode):
     881        (DOM::NodeImpl::isDocumentNode):
     882        (DOM::NodeImpl::closeRenderer):
     883        (DOM::NodeImpl::getElementsByTagName):
     884        * khtml/xml/dom_position.cpp:
     885        (DOM::Position::downstream):
     886        (DOM::Position::rendersInDifferentPosition):
     887        (DOM::Position::leadingWhitespacePosition):
     888        (DOM::Position::trailingWhitespacePosition):
     889        * khtml/xml/dom_qname.cpp:
     890        (DOM::hashComponents):
     891        (DOM::QNameHash::hash):
     892        (DOM::QNameHash::equal):
     893        (DOM::equalComponents):
     894        (DOM::convertComponents):
     895        (DOM::QualifiedName::QualifiedName):
     896        (DOM::QualifiedName::deref):
     897        (DOM::QualifiedName::setPrefix):
     898        * khtml/xml/dom_qname.h:
     899        (DOM::QualifiedName::hasPrefix):
     900        (DOM::operator==):
     901        * khtml/xml/dom_textimpl.cpp:
     902        (CommentImpl::localName):
     903        (CommentImpl::nodeName):
     904        (TextImpl::localName):
     905        (TextImpl::nodeName):
     906        * khtml/xml/dom_textimpl.h:
     907        (DOM::CommentImpl::isCommentNode):
     908        (DOM::TextImpl::isTextNode):
     909        * khtml/xml/xml_tokenizer.cpp:
     910        (khtml::XMLTokenizer::startElement):
     911        (khtml::XMLTokenizer::insertErrorMessageBlock):
     912        (khtml::XMLTokenizer::addScripts):
     913        * kwq/DOM.mm:
     914        (-[DOMNode setPrefix:]):
     915        (+[DOMNode _nodeWithImpl:]):
     916        (-[DOMElement tagName]):
     917        * kwq/DOMHTML.mm:
     918        (-[DOMHTMLQuoteElement _quoteElementImpl]):
     919        * kwq/KWQAccObject.mm:
     920        (-[KWQAccObject role]):
     921        (-[KWQAccObject title]):
     922        (-[KWQAccObject accessibilityIsIgnored]):
     923        * kwq/KWQDOMNode.cpp: Removed.
     924        * kwq/KWQDOMNode.h: Removed.
     925        * kwq/KWQFont.h:
     926        (QFont::):
     927        (QFont::isFixedPitch):
     928        * kwq/KWQFont.mm:
     929        (QFont::QFont):
     930        (QFont::operator=):
     931        (QFont::determinePitch):
     932        (QFont::operator==):
     933        * kwq/KWQKHTMLPart.cpp:
     934        (KWQKHTMLPart::isFrameSet):
     935        * kwq/KWQKHTMLPart.mm:
     936        (scanForForm):
     937        (KWQKHTMLPart::currentForm):
     938        (KWQKHTMLPart::searchForLabelsAboveCell):
     939        (KWQKHTMLPart::searchForLabelsBeforeElement):
     940        (listParent):
     941        (isTextFirstInListItem):
     942        (KWQKHTMLPart::attributedString):
     943        (KWQKHTMLPart::styleForSelectionStart):
     944        (KWQKHTMLPart::setSelectionFromNone):
     945        * kwq/KWQRenderTreeDebug.cpp:
     946        (getTagName):
     947        * kwq/WebCoreBridge.mm:
     948        (inputElementFromDOMElement):
     949        (formElementFromDOMElement):
     950        (-[WebCoreBridge elementAtPoint:]):
     951        * layout-tests/fast/dom/css-dom-read-expected.txt:
     952        * layout-tests/fast/overflow/003-expected.txt:
     953        * layout-tests/fast/tokenizer/002-expected.txt:
     954        * layout-tests/fast/tokenizer/external-script-document-write-expected.txt:
     955        * layout-tests/fast/tokenizer/script_extra_close-expected.txt:
     956        * layout-tests/fast/tokenizer/script_quirk-expected.txt: Removed.
     957        * layout-tests/fast/tokenizer/script_quirk.html: Removed.
     958
    19592005-07-08  Eric Seidel  <eseidel@apple.com>
    2960
  • trunk/WebCore/WebCore.pbproj/project.pbxproj

    r9636 r9639  
    221221//2D3
    222222//2D4
    223 //350
    224 //351
    225 //352
    226 //353
    227 //354
    228                 354F248902EE28590ACA2ACA = {
    229                         fileEncoding = 30;
    230                         isa = PBXFileReference;
    231                         lastKnownFileType = sourcecode.c.h;
    232                         path = KWQDOMNode.h;
    233                         refType = 4;
    234                         sourceTree = "<group>";
    235                 };
    236                 354F248A02EE28590ACA2ACA = {
    237                         fileEncoding = 30;
    238                         isa = PBXFileReference;
    239                         lastKnownFileType = sourcecode.cpp.cpp;
    240                         path = KWQDOMNode.cpp;
    241                         refType = 4;
    242                         sourceTree = "<group>";
    243                 };
    244 //350
    245 //351
    246 //352
    247 //353
    248 //354
    249223//510
    250224//511
     
    24922466                                93F198DE08245E59001E9ABC,
    24932467                                93F198E008245E59001E9ABC,
    2494                                 93F198E208245E59001E9ABC,
    24952468                                93F198E308245E59001E9ABC,
    24962469                                93F198E408245E59001E9ABC,
     
    25692542                                93F1992F08245E59001E9ABC,
    25702543                                93F1993008245E59001E9ABC,
    2571                                 93F1993108245E59001E9ABC,
    25722544                                93F1993208245E59001E9ABC,
    25732545                                93F1993308245E59001E9ABC,
     
    27242696                                93F199CA08245E59001E9ABC,
    27252697                                93F199CB08245E59001E9ABC,
    2726                                 93F199CC08245E59001E9ABC,
    27272698                                93F199CE08245E59001E9ABC,
    27282699                                93F199CF08245E59001E9ABC,
     
    28052776                                65DE852908765FC30011428A,
    28062777                                65DE852A08765FC30011428A,
     2778                                A85D7C19087A6ED9006A9172,
     2779                                BCEF3435087B563E00BBF833,
    28072780                                A8FD8B87087CB45700DC3707,
    28082781                        );
     
    30503023                        };
    30513024                };
    3052                 93F198E208245E59001E9ABC = {
    3053                         fileRef = F523D23602DE4396018635CA;
    3054                         isa = PBXBuildFile;
    3055                         settings = {
    3056                         };
    3057                 };
    30583025                93F198E308245E59001E9ABC = {
    30593026                        fileRef = F523D23802DE4396018635CA;
     
    35083475                93F1993008245E59001E9ABC = {
    35093476                        fileRef = F58785EA02DE37CB01EA4122;
    3510                         isa = PBXBuildFile;
    3511                         settings = {
    3512                         };
    3513                 };
    3514                 93F1993108245E59001E9ABC = {
    3515                         fileRef = 354F248902EE28590ACA2ACA;
    35163477                        isa = PBXBuildFile;
    35173478                        settings = {
     
    44764437                93F199CB08245E59001E9ABC = {
    44774438                        fileRef = BCBDB094059A28B100B83B92;
    4478                         isa = PBXBuildFile;
    4479                         settings = {
    4480                         };
    4481                 };
    4482                 93F199CC08245E59001E9ABC = {
    4483                         fileRef = BC7FDE3205C1D9AB0070A902;
    44844439                        isa = PBXBuildFile;
    44854440                        settings = {
     
    50204975                                93F19A8C08245E59001E9ABC,
    50214976                                93F19A8D08245E59001E9ABC,
    5022                                 93F19A8E08245E59001E9ABC,
    50234977                                93F19A8F08245E59001E9ABC,
    50244978                                93F19A9008245E59001E9ABC,
     
    50735027                                93F19AC108245E59001E9ABC,
    50745028                                93F19AC208245E59001E9ABC,
    5075                                 93F19AC308245E59001E9ABC,
    50765029                                93F19AC408245E59001E9ABC,
    50775030                                93F19AC508245E59001E9ABC,
     
    51155068                                93F19AED08245E59001E9ABC,
    51165069                                93F19AEE08245E59001E9ABC,
    5117                                 93F19AEF08245E59001E9ABC,
    51185070                                93F19AF008245E59001E9ABC,
    51195071                                93F19AF108245E59001E9ABC,
     
    51805132                                550A0BCD085F604D007353D6,
    51815133                                65F3782A0870D958000B2F94,
     5134                                A85D7C18087A6ED9006A9172,
     5135                                BCEF3434087B563E00BBF833,
    51825136                                A8FD8B86087CB44C00DC3707,
    51835137                        );
     
    58215775                        };
    58225776                };
    5823                 93F19A8E08245E59001E9ABC = {
    5824                         fileRef = F523D23502DE4396018635CA;
    5825                         isa = PBXBuildFile;
    5826                         settings = {
    5827                         };
    5828                 };
    58295777                93F19A8F08245E59001E9ABC = {
    58305778                        fileRef = F523D23702DE4396018635CA;
     
    61396087                        };
    61406088                };
    6141                 93F19AC308245E59001E9ABC = {
    6142                         fileRef = 354F248A02EE28590ACA2ACA;
    6143                         isa = PBXBuildFile;
    6144                         settings = {
    6145                         };
    6146                 };
    61476089                93F19AC408245E59001E9ABC = {
    61486090                        fileRef = F5117BCA02F9FFEF018635CE;
     
    63876329                93F19AEE08245E59001E9ABC = {
    63886330                        fileRef = BCBDB093059A28B100B83B92;
    6389                         isa = PBXBuildFile;
    6390                         settings = {
    6391                         };
    6392                 };
    6393                 93F19AEF08245E59001E9ABC = {
    6394                         fileRef = BC7FDE3105C1D9AB0070A902;
    63956331                        isa = PBXBuildFile;
    63966332                        settings = {
     
    3043930375                        sourceTree = "<group>";
    3044030376                };
    30441                 BC7FDE3105C1D9AB0070A902 = {
    30442                         fileEncoding = 30;
    30443                         isa = PBXFileReference;
    30444                         lastKnownFileType = sourcecode.cpp.cpp;
    30445                         path = xml_namespace_table.cpp;
    30446                         refType = 4;
    30447                         sourceTree = "<group>";
    30448                 };
    30449                 BC7FDE3205C1D9AB0070A902 = {
    30450                         fileEncoding = 30;
    30451                         isa = PBXFileReference;
    30452                         lastKnownFileType = sourcecode.c.h;
    30453                         path = xml_namespace_table.h;
    30454                         refType = 4;
    30455                         sourceTree = "<group>";
    30456                 };
    3045730377                BC80A6930468B78100DBCC9C = {
    3045830378                        fileEncoding = 30;
     
    3059930519                        refType = 4;
    3060030520                        sourceTree = "<group>";
     30521                };
     30522                BCEF3432087B563E00BBF833 = {
     30523                        fileEncoding = 30;
     30524                        isa = PBXFileReference;
     30525                        lastKnownFileType = sourcecode.cpp.cpp;
     30526                        path = htmlfactory.cpp;
     30527                        refType = 4;
     30528                        sourceTree = "<group>";
     30529                };
     30530                BCEF3433087B563E00BBF833 = {
     30531                        fileEncoding = 30;
     30532                        isa = PBXFileReference;
     30533                        lastKnownFileType = sourcecode.c.h;
     30534                        path = htmlfactory.h;
     30535                        refType = 4;
     30536                        sourceTree = "<group>";
     30537                };
     30538                BCEF3434087B563E00BBF833 = {
     30539                        fileRef = BCEF3432087B563E00BBF833;
     30540                        isa = PBXBuildFile;
     30541                        settings = {
     30542                        };
     30543                };
     30544                BCEF3435087B563E00BBF833 = {
     30545                        fileRef = BCEF3433087B563E00BBF833;
     30546                        isa = PBXBuildFile;
     30547                        settings = {
     30548                        };
    3060130549                };
    3060230550                BCF0192403D3802200B2D04D = {
     
    3101530963                                F58784CD02DE375901EA4122,
    3101630964                                F58784DA02DE375901EA4122,
    31017                                 354F248902EE28590ACA2ACA,
    31018                                 354F248A02EE28590ACA2ACA,
    3101930965                                931C8A160380288B008635CE,
    3102030966                                931C8A170380288B008635CE,
     
    3198531931                        sourceTree = "<group>";
    3198631932                };
    31987                 F523D23502DE4396018635CA = {
    31988                         fileEncoding = 30;
    31989                         isa = PBXFileReference;
    31990                         lastKnownFileType = sourcecode.cpp.cpp;
    31991                         path = dtd.cpp;
    31992                         refType = 4;
    31993                         sourceTree = "<group>";
    31994                 };
    31995                 F523D23602DE4396018635CA = {
    31996                         fileEncoding = 30;
    31997                         isa = PBXFileReference;
    31998                         lastKnownFileType = sourcecode.c.h;
    31999                         path = dtd.h;
    32000                         refType = 4;
    32001                         sourceTree = "<group>";
    32002                 };
    3200331933                F523D23702DE4396018635CA = {
    3200431934                        fileEncoding = 30;
     
    3222732157                F523D27702DE4398018635CA = {
    3222832158                        children = (
     32159                                BCEF3432087B563E00BBF833,
     32160                                BCEF3433087B563E00BBF833,
    3222932161                                550A0BCB085F604D007353D6,
    3223032162                                550A0BCC085F604D007353D6,
    32231                                 F523D23502DE4396018635CA,
    32232                                 F523D23602DE4396018635CA,
    3223332163                                F523D23702DE4396018635CA,
    3223432164                                F523D23802DE4396018635CA,
     
    3294232872                                F523D30702DE4476018635CA,
    3294332873                                F523D30802DE4476018635CA,
    32944                                 BC7FDE3105C1D9AB0070A902,
    32945                                 BC7FDE3205C1D9AB0070A902,
    3294632874                                F523D30902DE4476018635CA,
    3294732875                                F523D30A02DE4476018635CA,
  • trunk/WebCore/khtml/css/css_base.cpp

    r9361 r9639  
    9494// --------------------------------------------------------------------------------
    9595
     96const QualifiedName& CSSSelector::anyTagName()
     97{
     98    static QualifiedName anyName(nullAtom, starAtom, starAtom);
     99    return anyName;
     100}
     101
    96102void CSSSelector::print(void)
    97103{
    98     kdDebug( 6080 ) << "[Selector: tag = " <<       tag << ", attr = \"" << attr << "\", match = \"" << match
     104    kdDebug( 6080 ) << "[Selector: tag = " <<       tag.localName().string() << ", attr = \"" << attr << "\", match = \"" << match
    99105                    << "\" value = \"" << value.string().latin1() << "\" relation = " << (int)relation
    100106                    << "]" << endl;
     
    108114    // FIXME: Pseudo-elements and pseudo-classes do not have the same specificity. This function
    109115    // isn't quite correct.
    110     int s = ((localNamePart(tag) == anyLocalName) ? 0 : 1);
     116    int s = (tag.localName() == starAtom ? 0 : 1);
    111117    switch(match)
    112118    {
     
    241247DOMString CSSSelector::selectorText() const
    242248{
    243     // FIXME: Support namespaces when dumping the selector text.  This requires preserving
    244     // the original namespace prefix used. Ugh. -dwh
     249    // FIXME: Support namespaces when dumping the selector text. -dwh
    245250    DOMString str;
    246251    const CSSSelector* cs = this;
    247     Q_UINT16 tag = localNamePart(cs->tag);
    248     if ( tag == anyLocalName && cs->attr == ATTR_ID && cs->match == CSSSelector::Exact )
     252    const AtomicString& localName = cs->tag.localName();
     253    if (localName == starAtom && cs->attr == ATTR_ID && cs->match == CSSSelector::Exact)
    249254    {
    250255        str = "#";
    251256        str += cs->value.string();
    252257    }
    253     else if ( tag == anyLocalName && cs->attr == ATTR_CLASS && cs->match == CSSSelector::Class )
     258    else if (localName == starAtom && cs->attr == ATTR_CLASS && cs->match == CSSSelector::Class)
    254259    {
    255260        str = ".";
    256261        str += cs->value.string();
    257262    }
    258     else if ( tag == anyLocalName && cs->match == CSSSelector::PseudoClass )
     263    else if (localName == starAtom  && cs->match == CSSSelector::PseudoClass)
    259264    {
    260265        str = ":";
    261266        str += cs->value.string();
    262267    }
    263     else if ( tag == anyLocalName && cs->match == CSSSelector::PseudoElement )
     268    else if (localName == starAtom && cs->match == CSSSelector::PseudoElement)
    264269    {
    265270        str = "::";
     
    268273    else
    269274    {
    270         if ( tag == anyLocalName )
     275        if (localName == starAtom)
    271276            str = "*";
    272277        else
    273             str = getTagName( cs->tag );
    274         if ( cs->attr == ATTR_ID && cs->match == CSSSelector::Exact )
     278            str = localName;
     279        if (cs->attr == ATTR_ID && cs->match == CSSSelector::Exact)
    275280        {
    276281            str += "#";
    277282            str += cs->value.string();
    278283        }
    279         else if ( cs->attr == ATTR_CLASS && cs->match == CSSSelector::Class )
     284        else if (cs->attr == ATTR_CLASS && cs->match == CSSSelector::Class)
    280285        {
    281286            str += ".";
    282287            str += cs->value.string();
    283288        }
    284         else if ( cs->match == CSSSelector::PseudoClass )
     289        else if (cs->match == CSSSelector::PseudoClass)
    285290        {
    286291            str += ":";
    287292            str += cs->value.string();
    288293        }
    289         else if ( cs->match == CSSSelector::PseudoElement )
     294        else if (cs->match == CSSSelector::PseudoElement)
    290295        {
    291296            str += "::";
     
    293298        }
    294299        // optional attribute
    295         if ( cs->attr ) {
    296             DOMString attrName = getAttrName( cs->attr );
     300        if (cs->attr) {
     301            DOMString attrName = getAttrName(cs->attr);
    297302            str += "[";
    298303            str += attrName;
  • trunk/WebCore/khtml/css/css_base.h

    r9361 r9639  
    2828#include "dom/dom_misc.h"
    2929#include "xml/dom_nodeimpl.h"
     30#include "dom_qname.h"
    3031#include "misc/shared.h"
    3132#include <qdatetime.h>
     
    4748
    4849    struct CSSNamespace {
    49         DOMString m_prefix;
    50         DOMString m_uri;
     50        AtomicString m_prefix;
     51        AtomicString m_uri;
    5152        CSSNamespace* m_parent;
    5253
    5354        MAIN_THREAD_ALLOCATED;
    5455
    55         CSSNamespace(const DOMString& p, const DOMString& u, CSSNamespace* parent)
     56        CSSNamespace(const AtomicString& p, const AtomicString& u, CSSNamespace* parent)
    5657            :m_prefix(p), m_uri(u), m_parent(parent) {}
    5758        ~CSSNamespace() { delete m_parent; }
    5859       
    59         const DOMString& uri() { return m_uri; }
    60         const DOMString& prefix() { return m_prefix; }
     60        const AtomicString& uri() { return m_uri; }
     61        const AtomicString& prefix() { return m_prefix; }
    6162       
    62         CSSNamespace* namespaceForPrefix(const DOMString& prefix) {
     63        CSSNamespace* namespaceForPrefix(const AtomicString& prefix) {
    6364            if (prefix == m_prefix)
    6465                return this;
     
    7374    {
    7475    public:
    75         CSSSelector()
    76             : tagHistory(0), simpleSelector(0), nextSelector(0), attr(0), tag(anyQName),
     76        CSSSelector()
     77            : tagHistory(0), simpleSelector(0), nextSelector(0), attr(0), tag(anyTagName()),
     78              relation( Descendant ), match( None ),
     79              pseudoId( 0 ), _pseudoType(PseudoNotParsed)
     80        {}
     81       
     82        CSSSelector(const QualifiedName& qName)
     83            : tagHistory(0), simpleSelector(0), nextSelector(0), attr(0), tag(qName),
    7784              relation( Descendant ), match( None ),
    7885              pseudoId( 0 ), _pseudoType(PseudoNotParsed)
     
    168175        }
    169176
     177        static const QualifiedName& anyTagName();
     178
     179        bool hasTag() const { return tag != anyTagName(); }
     180
    170181        mutable DOM::AtomicString value;
    171182        CSSSelector* tagHistory;
     
    173184        CSSSelector* nextSelector; // used for ,-chained selectors
    174185        Q_UINT32     attr;
    175         Q_UINT32     tag;
     186       
     187        QualifiedName tag;
    176188
    177189        Relation relation              : 3;
  • trunk/WebCore/khtml/css/css_ruleimpl.cpp

    r9158 r9639  
    3232
    3333#include "misc/loader.h"
    34 #include "misc/htmltags.h"
    3534#include "misc/htmlattrs.h"
    3635#include "xml/dom_docimpl.h"
  • trunk/WebCore/khtml/css/css_ruleimpl.h

    r9151 r9639  
    3131#include "misc/loader_client.h"
    3232#include "misc/shared.h"
     33#include "misc/main_thread_malloc.h"
    3334#include "css_valueimpl.h"
    3435
     
    5152        : StyleBaseImpl(parent), m_type(CSSRule::UNKNOWN_RULE) {}
    5253
     54    MAIN_THREAD_ALLOCATED;
     55
    5356    virtual bool isRule() { return true; }
    5457    unsigned short type() const { return m_type; }
     
    7275        : CSSRuleImpl(parent) { m_type = CSSRule::CHARSET_RULE; }
    7376
     77    MAIN_THREAD_ALLOCATED;
     78
    7479    virtual bool isCharsetRule() { return true; }
    7580
     
    8691public:
    8792    CSSFontFaceRuleImpl(StyleBaseImpl *parent);
    88 
    8993    virtual ~CSSFontFaceRuleImpl();
    9094
     95    MAIN_THREAD_ALLOCATED;
     96   
    9197    CSSMutableStyleDeclarationImpl *style() const { return m_style; }
    9298
     
    105111    CSSImportRuleImpl( StyleBaseImpl *parent, const DOM::DOMString &href,
    106112                       MediaListImpl *media );
    107 
    108113    virtual ~CSSImportRuleImpl();
     114
     115    MAIN_THREAD_ALLOCATED;
    109116
    110117    DOM::DOMString href() const { return m_strHref; }
     
    157164    CSSMediaRuleImpl( StyleBaseImpl *parent, const DOM::DOMString &media );
    158165    CSSMediaRuleImpl( StyleBaseImpl *parent, MediaListImpl *mediaList, CSSRuleListImpl *ruleList );
    159 
    160166    virtual ~CSSMediaRuleImpl();
     167
     168    MAIN_THREAD_ALLOCATED;
    161169
    162170    MediaListImpl *media() const { return m_lstMedia; }
     
    180188public:
    181189    CSSPageRuleImpl(StyleBaseImpl *parent);
    182 
    183190    virtual ~CSSPageRuleImpl();
     191
     192    MAIN_THREAD_ALLOCATED;
    184193
    185194    CSSMutableStyleDeclarationImpl *style() const { return m_style; }
     
    200209public:
    201210    CSSStyleRuleImpl(StyleBaseImpl *parent);
    202 
    203211    virtual ~CSSStyleRuleImpl();
     212
     213    MAIN_THREAD_ALLOCATED;
    204214
    205215    CSSMutableStyleDeclarationImpl *style() const { return m_style; }
     
    228238    CSSUnknownRuleImpl(StyleBaseImpl *parent) : CSSRuleImpl(parent) {}
    229239
     240    MAIN_THREAD_ALLOCATED;
     241
    230242    virtual bool isUnknownRule() { return true; }
    231243};
  • trunk/WebCore/khtml/css/css_stylesheetimpl.cpp

    r9156 r9639  
    3939#include "misc/loader.h"
    4040
    41 #include "xml_namespace_table.h"
    42 
    4341#include <kdebug.h>
    4442
     
    211209}
    212210
    213 void CSSStyleSheetImpl::addNamespace(CSSParser* p, const DOM::DOMString& prefix, const DOM::DOMString& uri)
     211void CSSStyleSheetImpl::addNamespace(CSSParser* p, const AtomicString& prefix, const AtomicString& uri)
    214212{
    215213    if (uri.isEmpty())
     
    221219        // Set the default namespace on the parser so that selectors that omit namespace info will
    222220        // be able to pick it up easily.
    223         p->defaultNamespace = XmlNamespaceTable::getNamespaceID(uri, false);
    224 }
    225 
    226 void CSSStyleSheetImpl::determineNamespace(Q_UINT32& id, const DOM::DOMString& prefix)
    227 {
    228     // If the stylesheet has no namespaces we can just return.  There won't be any need to ever check
    229     // namespace values in selectors.
    230     if (!m_namespaces)
    231         return;
    232    
     221        p->defaultNamespace = uri;
     222}
     223
     224const AtomicString& CSSStyleSheetImpl::determineNamespace(const AtomicString& prefix)
     225{
    233226    if (prefix.isEmpty())
    234         id = makeId(noNamespace, localNamePart(id)); // No namespace. If an element/attribute has a namespace, we won't match it.
    235     else if (prefix == "*")
    236         id = makeId(anyNamespace, localNamePart(id)); // We'll match any namespace.
    237     else {
     227        return emptyAtom; // No namespace. If an element/attribute has a namespace, we won't match it.
     228    else if (prefix == starAtom)
     229        return starAtom; // We'll match any namespace.
     230    else if (m_namespaces) {
    238231        CSSNamespace* ns = m_namespaces->namespaceForPrefix(prefix);
    239232        if (ns)
    240             // Look up the id for this namespace URI.
    241             id = makeId(XmlNamespaceTable::getNamespaceID(ns->uri(), false), localNamePart(id));
    242     }
     233            return ns->uri();
     234    }
     235    return emptyAtom; // Assume we wont match any namespaces.
    243236}
    244237
  • trunk/WebCore/khtml/css/css_stylesheetimpl.h

    r9156 r9639  
    105105    unsigned long addRule ( const DOMString &selector, const DOMString &style, long index, int &exceptioncode );
    106106
    107     void addNamespace(CSSParser* p, const DOM::DOMString& prefix, const DOM::DOMString& uri);
    108     void determineNamespace(Q_UINT32& id, const DOM::DOMString& prefix);
     107    void addNamespace(CSSParser* p, const AtomicString& prefix, const AtomicString& uri);
     108    const AtomicString& determineNamespace(const AtomicString& prefix);
    109109   
    110110    virtual bool parseString( const DOMString &string, bool strict = true );
  • trunk/WebCore/khtml/css/cssparser.cpp

    r9157 r9639  
    103103    inParseShortHand = false;
    104104   
    105     defaultNamespace = anyNamespace;
     105    defaultNamespace = starAtom;
    106106   
    107107    yy_start = 1;
     
    162162{
    163163    styleElement = sheet;
    164     defaultNamespace = anyNamespace; // Reset the default namespace.
     164    defaultNamespace = starAtom; // Reset the default namespace.
    165165   
    166166    setupParser ("", string, "");
  • trunk/WebCore/khtml/css/cssparser.h

    r8041 r9639  
    165165        bool inParseShortHand;
    166166
    167         Q_UINT16 defaultNamespace;
     167        AtomicString defaultNamespace;
    168168       
    169169        static CSSParser *currentParser;
  • trunk/WebCore/khtml/css/cssstyleselector.cpp

    r9597 r9639  
    340340                                                   firstRuleIndex, lastRuleIndex);
    341341    }
    342     matchRulesForList(rules->getTagRules(localNamePart(element->id())),
     342    matchRulesForList(rules->getTagRules(element->localName().implementation()),
    343343                      firstRuleIndex, lastRuleIndex);
    344344    matchRulesForList(rules->getUniversalRules(), firstRuleIndex, lastRuleIndex);
     
    361361    for (CSSRuleData* d = rules->first(); d; d = d->next()) {
    362362        CSSStyleRuleImpl* rule = d->rule();
    363         Q_UINT16 cssTagId = localNamePart(element->id());
    364         Q_UINT16 tag = localNamePart(d->selector()->tag);
    365         if ((cssTagId == tag || tag == anyLocalName) && checkSelector(d->selector(), element)) {
     363        const AtomicString& localName = element->localName();
     364        const AtomicString& selectorLocalName = d->selector()->tag.localName();
     365        if ((localName == selectorLocalName || selectorLocalName == starAtom) && checkSelector(d->selector(), element)) {
    366366            // If the rule has no properties to apply, then ignore it.
    367367            CSSMutableStyleDeclarationImpl* decl = rule->declaration();
     
    610610        bool mouseInside = element->renderer() ? element->renderer()->mouseInside() : false;
    611611        StyledElementImpl* s = static_cast<StyledElementImpl*>(n);
    612         if (s->renderer() && (s->id() == element->id()) && !s->hasID() &&
     612        if (s->renderer() && (s->tagName() == element->tagName()) && !s->hasID() &&
    613613            (s->hasClass() == element->hasClass()) && !s->inlineStyleDecl() &&
    614614            (s->hasMappedAttributes() == styledElement->hasMappedAttributes()) &&
     
    886886        // these tags to retain their display types.
    887887        if (!strictParsing && e) {
    888             if (e->id() == ID_TD) {
     888            if (e->hasTagName(HTMLNames::td())) {
    889889                style->setDisplay(TABLE_CELL);
    890890                style->setFloating(FNONE);
    891891            }
    892             else if (e->id() == ID_TABLE)
     892            else if (e->hasTagName(HTMLNames::table()))
    893893                style->setDisplay(style->isDisplayInlineType() ? INLINE_TABLE : TABLE);
    894894        }
     
    896896        // Frames and framesets never honor position:relative or position:absolute.  This is necessary to
    897897        // fix a crash where a site tries to position these objects.  They also never honor display.
    898         if (e && (e->id() == ID_FRAME || e->id() == ID_FRAMESET)) {
     898        if (e && (e->hasTagName(HTMLNames::frame()) || e->hasTagName(HTMLNames::frameset()))) {
    899899            style->setPosition(STATIC);
    900900            style->setDisplay(BLOCK);
     
    902902
    903903        // Table headers with a text-align of auto will change the text-align to center.
    904         if (e && e->id() == ID_TH && style->textAlign() == TAAUTO)
     904        if (e && e->hasTagName(HTMLNames::th()) && style->textAlign() == TAAUTO)
    905905            style->setTextAlign(CENTER);
    906906       
     
    980980    // so, we can't allow that to apply to every element on the page.  We assume the author intended
    981981    // to apply the rules only to links.
    982     bool onlyHoverActive = (sel->tag == anyQName &&
     982    bool onlyHoverActive = (!sel->hasTag() &&
    983983                            (sel->match == CSSSelector::PseudoClass &&
    984984                              (sel->pseudoType() == CSSSelector::PseudoHover ||
     
    10971097        return false;
    10981098
    1099     if (sel->tag != anyQName) {
    1100         int eltID = e->id();
    1101         Q_UINT16 localName = localNamePart(eltID);
    1102         Q_UINT16 ns = namespacePart(eltID);
    1103         Q_UINT16 selLocalName = localNamePart(sel->tag);
    1104         Q_UINT16 selNS = namespacePart(sel->tag);
    1105        
    1106         if (localName <= ID_LAST_TAG && e->isHTMLElement())
    1107             ns = xhtmlNamespace; // FIXME: Really want to move away from this complicated hackery and just
    1108                                  // switch tags and attr names over to AtomicStrings.
    1109        
    1110         if ((selLocalName != anyLocalName && localName != selLocalName) ||
    1111             (selNS != anyNamespace && ns != selNS))
     1099    if (sel->hasTag()) {
     1100        const AtomicString& localName = e->localName();
     1101        const AtomicString& ns = e->namespaceURI();
     1102        const AtomicString& selLocalName = sel->tag.localName();
     1103        const AtomicString& selNS = sel->tag.namespaceURI();
     1104   
     1105        if ((selLocalName != starAtom && localName != selLocalName) ||
     1106            (selNS != starAtom && ns != selNS))
    11121107            return false;
    11131108    }
     
    12961291                // If we're in quirks mode, then hover should never match anchors with no
    12971292                // href.  This is important for sites like wsj.com.
    1298                 if (strictParsing || e->id() != ID_A || e->isLink()) {
     1293                if (strictParsing || !e->hasTagName(HTMLNames::a()) || e->isLink()) {
    12991294                    if (element == e && style)
    13001295                        style->setAffectedByHoverRules(true);
     
    13271322                // If we're in quirks mode, then :active should never match anchors with no
    13281323                // href.
    1329                 if (strictParsing || e->id() != ID_A || e->isLink()) {
     1324                if (strictParsing || !e->hasTagName(HTMLNames::a()) || e->isLink()) {
    13301325                    if (element == e && style)
    13311326                        style->setAffectedByActiveRules(true);
     
    14211416}
    14221417
    1423 void CSSRuleSet::addToRuleSet(int key, IntRuleMap& map,
    1424                               CSSStyleRuleImpl* rule, CSSSelector* sel)
    1425 {
    1426     assert(key);
    1427     assert(key != -1);
    1428     CSSRuleDataList* rules = map.get(key);
    1429     if (!rules) {
    1430         rules = new CSSRuleDataList(m_ruleCount++, rule, sel);
    1431         map.insert(key, rules);
    1432     } else
    1433         rules->append(m_ruleCount++, rule, sel);
    1434 }
    1435 
    14361418void CSSRuleSet::addRule(CSSStyleRuleImpl* rule, CSSSelector* sel)
    14371419{
     
    14451427    }
    14461428     
    1447     Q_UINT16 localName = localNamePart(sel->tag);
    1448     if (localName != anyLocalName) {
    1449         // FIXME: maybe it would be better to just use an int-keyed HashMap here
    1450         addToRuleSet(localName, m_tagRules, rule, sel);
     1429    const AtomicString& localName = sel->tag.localName();
     1430    if (localName != starAtom) {
     1431        addToRuleSet(localName.implementation(), m_tagRules, rule, sel);
    14511432        return;
    14521433    }
  • trunk/WebCore/khtml/css/cssstyleselector.h

    r9597 r9639  
    2525
    2626#include <qptrvector.h>
    27 #include <qptrdict.h>
    2827#include "misc/pointerhash.h"
    2928
     
    275274
    276275        typedef HashMap<DOM::DOMStringImpl *, CSSRuleDataList *, PointerHash<DOM::DOMStringImpl *> > AtomRuleMap;
    277         typedef HashMap<int, CSSRuleDataList *, PointerHash<int> > IntRuleMap;
    278276
    279277        void addRulesFromSheet(DOM::CSSStyleSheetImpl* sheet, const DOM::DOMString &medium = "screen");
     
    282280        void addToRuleSet(DOM::DOMStringImpl* key, AtomRuleMap& map,
    283281                          DOM::CSSStyleRuleImpl* rule, DOM::CSSSelector* sel);
    284         void addToRuleSet(int key, IntRuleMap& map,
    285                           DOM::CSSStyleRuleImpl* rule, DOM::CSSSelector* sel);
    286282
    287283        CSSRuleDataList* getIDRules(DOM::DOMStringImpl* key) { return m_idRules.get(key); }
    288284        CSSRuleDataList* getClassRules(DOM::DOMStringImpl* key) { return m_classRules.get(key); }
    289         CSSRuleDataList* getTagRules(int key) { return m_tagRules.get(key); }
     285        CSSRuleDataList* getTagRules(DOM::DOMStringImpl* key) { return m_tagRules.get(key); }
    290286        CSSRuleDataList* getUniversalRules() { return m_universalRules; }
    291287
     
    293289        AtomRuleMap m_idRules;
    294290        AtomRuleMap m_classRules;
    295         IntRuleMap m_tagRules;
     291        AtomRuleMap m_tagRules;
    296292        CSSRuleDataList* m_universalRules;
    297293       
  • trunk/WebCore/khtml/css/parser.y

    r9609 r9639  
    3535#include <misc/htmlhashes.h>
    3636#include "cssparser.h"
    37 
    38 #include "xml_namespace_table.h"
    39    
     37   
    4038#include <assert.h>
    4139#include <kdebug.h>
     
    131129    int prop_id;
    132130    int attribute;
    133     int element;
    134131    CSSSelector::Relation relation;
    135132    bool b;
     
    176173%token '.'
    177174%token '['
     175
     176%token <string> '*'
    178177
    179178%token IMPORT_SYM
     
    266265%type <value> function
    267266
    268 %type <element> element_name
     267%type <string> element_name
    269268
    270269%type <attribute> attrib_id
     
    406405    CSSParser *p = static_cast<CSSParser *>(parser);
    407406    if (p->styleElement && p->styleElement->isCSSStyleSheet())
    408         static_cast<CSSStyleSheetImpl*>(p->styleElement)->addNamespace(p, domString($3), domString($4));
     407        static_cast<CSSStyleSheetImpl*>(p->styleElement)->addNamespace(p, atomicString($3), atomicString($4));
    409408}
    410409| NAMESPACE_SYM error invalid_block
     
    625624simple_selector:
    626625    element_name maybe_space {
    627         $$ = new CSSSelector();
    628         $$->tag = $1;
     626        CSSParser *p = static_cast<CSSParser *>(parser);
     627        $$ = new CSSSelector(QualifiedName(nullAtom, atomicString($1), p->defaultNamespace));
    629628    }
    630629    | element_name specifier_list maybe_space {
    631         $$ = $2;
    632         if ( $$ )
    633             $$->tag = $1;
     630        $$ = $2;
     631        if ($$) {
     632            CSSParser *p = static_cast<CSSParser *>(parser);
     633            $$->tag = QualifiedName(nullAtom, atomicString($1), p->defaultNamespace);
     634        }
    634635    }
    635636    | specifier_list maybe_space {
    636637        $$ = $1;
    637         if ($$)
    638             $$->tag = makeId(static_cast<CSSParser*>(parser)->defaultNamespace, anyLocalName);;
     638        CSSParser *p = static_cast<CSSParser *>(parser);
     639        if ($$ && p->defaultNamespace != starAtom)
     640            $$->tag = QualifiedName(nullAtom, starAtom, p->defaultNamespace);
    639641    }
    640642    | namespace_selector '|' element_name maybe_space {
    641         $$ = new CSSSelector();
    642         $$->tag = $3;
     643        AtomicString namespacePrefix = atomicString($1);
    643644        CSSParser *p = static_cast<CSSParser *>(parser);
    644645        if (p->styleElement && p->styleElement->isCSSStyleSheet())
    645             static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace($$->tag, domString($1));
     646            $$ = new CSSSelector(QualifiedName(namespacePrefix,
     647                                               atomicString($3),
     648                                               static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace(namespacePrefix)));
     649        else // FIXME: Shouldn't this case be an error?
     650            $$ = new CSSSelector(QualifiedName(nullAtom, atomicString($3), p->defaultNamespace));
    646651    }
    647652    | namespace_selector '|' element_name specifier_list maybe_space {
    648653        $$ = $4;
    649654        if ($$) {
    650             $$->tag = $3;
     655            AtomicString namespacePrefix = atomicString($1);
    651656            CSSParser *p = static_cast<CSSParser *>(parser);
    652657            if (p->styleElement && p->styleElement->isCSSStyleSheet())
    653                 static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace($$->tag, domString($1));
     658                $$->tag = QualifiedName(namespacePrefix,
     659                                        atomicString($3),
     660                                        static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace(namespacePrefix));
     661            else // FIXME: Shouldn't this case be an error?
     662                $$->tag = QualifiedName(nullAtom, atomicString($3), p->defaultNamespace);
    654663        }
    655664    }
     
    657666        $$ = $3;
    658667        if ($$) {
    659             $$->tag = makeId(anyNamespace, anyLocalName);
     668            AtomicString namespacePrefix = atomicString($1);
    660669            CSSParser *p = static_cast<CSSParser *>(parser);
    661670            if (p->styleElement && p->styleElement->isCSSStyleSheet())
    662                 static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace($$->tag, domString($1));
     671                $$->tag = QualifiedName(namespacePrefix,
     672                                        starAtom,
     673                                        static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace(namespacePrefix));
    663674        }
    664675    }
     
    667678element_name:
    668679    IDENT {
    669         CSSParser *p = static_cast<CSSParser *>(parser);
     680        ParseString& str = $1;
     681        CSSParser *p = static_cast<CSSParser *>(parser);
    670682        DOM::DocumentImpl *doc = p->document();
    671         QString tag = qString($1);
    672         if ( doc ) {
    673             if (doc->isHTMLDocument())
    674                 tag = tag.lower();
    675             const DOMString dtag(tag);
    676             $$ = makeId(p->defaultNamespace, doc->tagId(0, dtag.implementation(), false));
    677         } else {
    678             $$ = makeId(p->defaultNamespace, khtml::getTagID(tag.lower().ascii(), tag.length()));
    679             // this case should never happen - only when loading
    680             // the default stylesheet - which must not contain unknown tags
    681 //          assert($$ != 0);
    682         }
     683        if (doc && doc->isHTMLDocument())
     684            str.lower();
     685        $$ = str;
    683686    }
    684687    | '*' {
    685         $$ = makeId(static_cast<CSSParser*>(parser)->defaultNamespace, anyLocalName);
     688        static unsigned short star = '*';
     689        $$.string = &star;
     690        $$.length = 1;
    686691    }
    687692  ;
     
    770775        $$->attr = $5;
    771776        $$->match = CSSSelector::Set;
    772         CSSParser *p = static_cast<CSSParser *>(parser);
    773         if (p->styleElement && p->styleElement->isCSSStyleSheet())
    774             static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace($$->attr, domString($3));
     777        // FIXME: For now we're breaking namespace support on attributes.  When we switch to atomicstring, then we can make
     778        // it work again.
     779        //CSSParser *p = static_cast<CSSParser *>(parser);
     780        //if (p->styleElement && p->styleElement->isCSSStyleSheet())
     781        //    static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace($$->attr, domString($3));
    775782    }
    776783    | '[' maybe_space namespace_selector '|' attrib_id match maybe_space ident_or_string maybe_space ']' {
     
    779786        $$->match = (CSSSelector::Match)$6;
    780787        $$->value = atomicString($8);
    781         CSSParser *p = static_cast<CSSParser *>(parser);
    782         if (p->styleElement && p->styleElement->isCSSStyleSheet())
    783             static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace($$->attr, domString($3));
     788        // FIXME: For now we're breaking namespace support on attributes.  When we switch to atomicstring, then we can make
     789        // it work again.
     790        //CSSParser *p = static_cast<CSSParser *>(parser);
     791        //if (p->styleElement && p->styleElement->isCSSStyleSheet())
     792        //    static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace($$->attr, domString($3));
    784793    }
    785794  ;
  • trunk/WebCore/khtml/dom/css_stylesheet.cpp

    r6647 r9639  
    386386    // ### check link is really linking a style sheet
    387387    if( n && n->isElementNode() &&
    388         (n->id() == ID_STYLE || n->id() == ID_LINK) ) {
     388        (n->hasTagName(HTMLNames::style()) || n->hasTagName(HTMLNames::link()))) {
    389389    node = n;
    390390    if(node) node->ref();
     
    400400StyleSheet LinkStyle::sheet()
    401401{
    402     int id = node ? node->id() : 0;
     402    if (!node)
     403        return StyleSheet();
     404
    403405    // ### add PI
    404406    return
    405         ( id == ID_STYLE) ?
     407        (node->hasTagName(HTMLNames::style())) ?
    406408        static_cast<HTMLStyleElementImpl *>(node)->sheet()
    407         : ( (id == ID_LINK) ?
     409        : ( node->hasTagName(HTMLNames::link()) ?
    408410            static_cast<HTMLLinkElementImpl *>(node)->sheet()
    409411            : StyleSheet() );
  • trunk/WebCore/khtml/dom/dom_element.cpp

    r9165 r9639  
    142142{
    143143    if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
    144     return static_cast<ElementImpl*>(impl)->tagName();
     144    return static_cast<ElementImpl*>(impl)->nodeName();
    145145}
    146146
  • trunk/WebCore/khtml/dom/dom_node.cpp

    r9156 r9639  
    325325{
    326326    if (!impl) return DOMString();
    327     return impl->getDocument()->namespaceURI(impl->id());
     327    return impl->namespaceURI();
    328328}
    329329
     
    338338    if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
    339339    int exceptioncode = 0;
    340     impl->setPrefix(prefix,exceptioncode);
     340    impl->setPrefix(prefix.implementation(),exceptioncode);
    341341    if (exceptioncode)
    342342        throw DOMException(exceptioncode);
     
    377377}
    378378
    379 
    380 unsigned int Node::elementId() const
    381 {
    382     if (!impl) return 0;
    383     return impl->id();
    384 }
    385 
    386379unsigned long Node::index() const
    387380{
  • trunk/WebCore/khtml/dom/dom_node.h

    r9178 r9639  
    856856
    857857    /**
    858      * @internal
    859      * not part of the DOM.
    860      * @returns the element id, in case this is an element, 0 otherwise
    861      */
    862     Q_UINT32 elementId() const;
    863 
    864     /**
    865858     * tests if this Node is 0. Useful especially, if casting to a derived
    866859     * class:
  • trunk/WebCore/khtml/dom/html_base.cpp

    r5360 r9639  
    4242HTMLBodyElement &HTMLBodyElement::operator = (const Node &other)
    4343{
    44     assignOther( other, ID_BODY );
     44    assignOther( other, HTMLNames::body() );
    4545    return *this;
    4646}
     
    136136HTMLFrameElement &HTMLFrameElement::operator = (const Node &other)
    137137{
    138     assignOther( other, ID_FRAME );
     138    assignOther( other, HTMLNames::frame() );
    139139    return *this;
    140140}
     
    266266HTMLIFrameElement &HTMLIFrameElement::operator = (const Node &other)
    267267{
    268     assignOther( other, ID_IFRAME );
     268    assignOther( other, HTMLNames::iframe() );
    269269    return *this;
    270270}
     
    415415HTMLFrameSetElement &HTMLFrameSetElement::operator = (const Node &other)
    416416{
    417     assignOther( other, ID_FRAMESET );
     417    assignOther( other, HTMLNames::frameset() );
    418418    return *this;
    419419}
     
    467467HTMLHeadElement &HTMLHeadElement::operator = (const Node &other)
    468468{
    469     assignOther( other, ID_HEAD );
     469    assignOther( other, HTMLNames::head() );
    470470    return *this;
    471471}
     
    508508HTMLHtmlElement &HTMLHtmlElement::operator = (const Node &other)
    509509{
    510     assignOther( other, ID_HTML );
     510    assignOther( other, HTMLNames::html() );
    511511    return *this;
    512512}
  • trunk/WebCore/khtml/dom/html_block.cpp

    r1326 r9639  
    4444HTMLBlockquoteElement &HTMLBlockquoteElement::operator = (const Node &other)
    4545{
    46     assignOther( other, ID_BLOCKQUOTE );
     46    assignOther( other, HTMLNames::blockquote() );
    4747    return *this;
    4848}
     
    8585HTMLDivElement &HTMLDivElement::operator = (const Node &other)
    8686{
    87     assignOther( other, ID_DIV );
     87    assignOther( other, HTMLNames::div() );
    8888    return *this;
    8989}
     
    126126HTMLHRElement &HTMLHRElement::operator = (const Node &other)
    127127{
    128     assignOther( other, ID_HR );
     128    assignOther( other, HTMLNames::hr() );
    129129    return *this;
    130130}
     
    206206HTMLHeadingElement &HTMLHeadingElement::operator = (const Node &other)
    207207{
    208     if(other.elementId() != ID_H1 ||
    209        other.elementId() != ID_H2 ||
    210        other.elementId() != ID_H3 ||
    211        other.elementId() != ID_H4 ||
    212        other.elementId() != ID_H5 ||
    213        other.elementId() != ID_H6 )
     208    if (!other.handle()->hasTagName(HTMLNames::h1()) &&
     209        !other.handle()->hasTagName(HTMLNames::h2()) &&
     210        !other.handle()->hasTagName(HTMLNames::h3()) &&
     211        !other.handle()->hasTagName(HTMLNames::h4()) &&
     212        !other.handle()->hasTagName(HTMLNames::h5()) &&
     213        !other.handle()->hasTagName(HTMLNames::h6()))
    214214    {
    215215        if ( impl ) impl->deref();
    216216        impl = 0;
    217217    } else {
     218
    218219    Node::operator = (other);
    219220    }
     
    258259HTMLParagraphElement &HTMLParagraphElement::operator = (const Node &other)
    259260{
    260     assignOther( other, ID_P );
     261    assignOther( other, HTMLNames::p() );
    261262    return *this;
    262263}
     
    299300HTMLPreElement &HTMLPreElement::operator = (const Node &other)
    300301{
    301     assignOther( other, ID_PRE );
     302    assignOther( other, HTMLNames::pre() );
    302303    return *this;
    303304}
  • trunk/WebCore/khtml/dom/html_element.cpp

    r9156 r9639  
    183183}
    184184
    185 void HTMLElement::assignOther( const Node &other, int elementId )
    186 {
    187     if((int)other.elementId() != elementId) {
     185void HTMLElement::assignOther( const Node &other, const QualifiedName& tagName )
     186{
     187    if (!other.handle()->hasTagName(tagName)) {
    188188        if ( impl ) impl->deref();
    189189        impl = 0;
  • trunk/WebCore/khtml/dom/html_element.h

    r6666 r9639  
    3131
    3232#include <dom/dom_element.h>
     33#include "dom_qname.h"
     34
    3335class KHTMLView;
    3436
     
    226228     * @internal
    227229     */
    228     void assignOther( const Node &other, int elementId );
     230    void assignOther( const Node &other, const QualifiedName& tagName );
    229231};
    230232
  • trunk/WebCore/khtml/dom/html_form.cpp

    r9156 r9639  
    4848HTMLButtonElement &HTMLButtonElement::operator = (const Node &other)
    4949{
    50     assignOther( other, ID_BUTTON );   
     50    assignOther( other, HTMLNames::button() ); 
    5151    return *this;
    5252}
     
    158158HTMLFieldSetElement &HTMLFieldSetElement::operator = (const Node &other)
    159159{
    160     assignOther( other, ID_FIELDSET );
     160    assignOther( other, HTMLNames::fieldset() );
    161161    return *this;
    162162}
     
    194194HTMLFormElement &HTMLFormElement::operator = (const Node &other)
    195195{
    196     assignOther( other, ID_FORM );
     196    assignOther( other, HTMLNames::form() );
    197197    return *this;
    198198}
     
    312312HTMLInputElement &HTMLInputElement::operator = (const Node &other)
    313313{
    314     assignOther( other, ID_INPUT );
     314    assignOther( other, HTMLNames::input() );
    315315    return *this;
    316316}
     
    575575HTMLLabelElement &HTMLLabelElement::operator = (const Node &other)
    576576{
    577     assignOther( other, ID_LABEL );
     577    assignOther( other, HTMLNames::label() );
    578578    return *this;
    579579}
     
    634634HTMLLegendElement &HTMLLegendElement::operator = (const Node &other)
    635635{
    636     assignOther( other, ID_LEGEND );
     636    assignOther( other, HTMLNames::legend() );
    637637    return *this;
    638638}
     
    692692HTMLOptGroupElement &HTMLOptGroupElement::operator = (const Node &other)
    693693{
    694     assignOther( other, ID_OPTGROUP );
     694    assignOther( other, HTMLNames::optgroup() );
    695695    return *this;
    696696}
     
    745745HTMLSelectElement &HTMLSelectElement::operator = (const Node &other)
    746746{
    747     assignOther( other, ID_SELECT );
     747    assignOther( other, HTMLNames::select() );
    748748    return *this;
    749749}
     
    907907HTMLTextAreaElement &HTMLTextAreaElement::operator = (const Node &other)
    908908{
    909     assignOther( other, ID_TEXTAREA );
     909    assignOther( other, HTMLNames::textarea() );
    910910    return *this;
    911911}
     
    10751075HTMLOptionElement &HTMLOptionElement::operator = (const Node &other)
    10761076{
    1077     assignOther( other, ID_OPTION );
     1077    assignOther( other, HTMLNames::option() );
    10781078    return *this;
    10791079}
     
    11831183HTMLIsIndexElement &HTMLIsIndexElement::operator = (const Node &other)
    11841184{
    1185     assignOther( other, ID_ISINDEX );
     1185    assignOther( other, HTMLNames::isindex() );
    11861186    return *this;
    11871187}
  • trunk/WebCore/khtml/dom/html_head.cpp

    r9466 r9639  
    4343HTMLBaseElement &HTMLBaseElement::operator = (const Node &other)
    4444{
    45     assignOther( other, ID_BASE );
     45    assignOther( other, HTMLNames::base() );
    4646    return *this;
    4747}
     
    9898HTMLLinkElement &HTMLLinkElement::operator = (const Node &other)
    9999{
    100     assignOther( other, ID_LINK );
     100    assignOther( other, HTMLNames::link() );
    101101    return *this;
    102102}
     
    239239HTMLMetaElement &HTMLMetaElement::operator = (const Node &other)
    240240{
    241     assignOther( other, ID_META );
     241    assignOther( other, HTMLNames::meta() );
    242242    return *this;
    243243}
     
    313313HTMLScriptElement &HTMLScriptElement::operator = (const Node &other)
    314314{
    315     assignOther( other, ID_SCRIPT );
     315    assignOther( other, HTMLNames::script() );
    316316    return *this;
    317317}
     
    425425HTMLStyleElement &HTMLStyleElement::operator = (const Node &other)
    426426{
    427     assignOther( other, ID_STYLE );
     427    assignOther( other, HTMLNames::style() );
    428428    return *this;
    429429}
     
    497497HTMLTitleElement &HTMLTitleElement::operator = (const Node &other)
    498498{
    499     assignOther( other, ID_TITLE );
     499    assignOther( other, HTMLNames::title() );
    500500    return *this;
    501501}
  • trunk/WebCore/khtml/dom/html_image.cpp

    r5360 r9639  
    4747HTMLAreaElement &HTMLAreaElement::operator = (const Node &other)
    4848{
    49     assignOther( other, ID_AREA );
     49    assignOther( other, HTMLNames::area() );
    5050    return *this;
    5151}
     
    177177HTMLImageElement &HTMLImageElement::operator = (const Node &other)
    178178{
    179     assignOther( other, ID_IMG );
     179    assignOther( other, HTMLNames::img() );
    180180    return *this;
    181181}
     
    373373HTMLMapElement &HTMLMapElement::operator = (const Node &other)
    374374{
    375     assignOther( other, ID_MAP );
     375    assignOther( other, HTMLNames::map() );
    376376    return *this;
    377377}
  • trunk/WebCore/khtml/dom/html_inline.cpp

    r9156 r9639  
    4646HTMLAnchorElement &HTMLAnchorElement::operator = (const Node &other)
    4747{
    48     assignOther( other, ID_A );
     48    assignOther( other, HTMLNames::a() );
    4949    return *this;
    5050}
     
    218218HTMLBRElement &HTMLBRElement::operator = (const Node &other)
    219219{
    220     assignOther( other, ID_BR );
     220    assignOther( other, HTMLNames::br() );
    221221    return *this;
    222222}
     
    259259HTMLFontElement &HTMLFontElement::operator = (const Node &other)
    260260{
    261     assignOther( other, ID_FONT );
     261    assignOther( other, HTMLNames::font() );
    262262    return *this;
    263263}
     
    320320    : HTMLElement()
    321321{
    322     if (_impl && (_impl->id() == ID_INS || _impl->id() == ID_DEL))
     322    if (_impl && (_impl->hasTagName(HTMLNames::ins()) || _impl->hasTagName(HTMLNames::del())))
    323323        impl = _impl;
    324324    else
     
    329329HTMLModElement &HTMLModElement::operator = (const Node &other)
    330330{
    331     if( other.elementId() != ID_INS &&
    332         other.elementId() != ID_DEL )
    333     {
     331    if (!other.handle()->hasTagName(HTMLNames::ins()) &&
     332        !other.handle()->hasTagName(HTMLNames::del())) {
    334333        if ( impl ) impl->deref();
    335334        impl = 0;
     
    382381}
    383382
    384 HTMLQuoteElement::HTMLQuoteElement(HTMLGenericElementImpl *_impl)
     383HTMLQuoteElement::HTMLQuoteElement(HTMLQuoteElementImpl *_impl)
    385384    : HTMLElement()
    386385{
    387     if (_impl && _impl->id() == ID_Q)
    388         impl = _impl;
    389     else
    390         impl = 0;
     386    impl = _impl;
    391387    if ( impl ) impl->ref();
    392388}
     
    394390HTMLQuoteElement &HTMLQuoteElement::operator = (const Node &other)
    395391{
    396     assignOther( other, ID_Q );
     392    assignOther( other, HTMLNames::q() );
    397393    return *this;
    398394}
  • trunk/WebCore/khtml/dom/html_inline.h

    r1024 r9639  
    426426         {(*this)=other;}
    427427protected:
    428     HTMLQuoteElement(HTMLGenericElementImpl *impl);
     428    HTMLQuoteElement(HTMLQuoteElementImpl *impl);
    429429public:
    430430
  • trunk/WebCore/khtml/dom/html_list.cpp

    r1326 r9639  
    4242HTMLDListElement &HTMLDListElement::operator = (const Node &other)
    4343{
    44     assignOther( other, ID_DL );
     44    assignOther( other, HTMLNames::dl() );
    4545    return *this;
    4646}
     
    8989HTMLDirectoryElement &HTMLDirectoryElement::operator = (const Node &other)
    9090{
    91     assignOther( other, ID_DIR );
     91    assignOther( other, HTMLNames::dir() );
    9292    return *this;
    9393}
     
    136136HTMLLIElement &HTMLLIElement::operator = (const Node &other)
    137137{
    138     assignOther( other, ID_LI );
     138    assignOther( other, HTMLNames::li() );
    139139    return *this;
    140140}
     
    191191HTMLMenuElement &HTMLMenuElement::operator = (const Node &other)
    192192{
    193     assignOther( other, ID_MENU );
     193    assignOther( other, HTMLNames::menu() );
    194194    return *this;
    195195}
     
    238238HTMLOListElement &HTMLOListElement::operator = (const Node &other)
    239239{
    240     assignOther( other, ID_OL );
     240    assignOther( other, HTMLNames::ol() );
    241241    return *this;
    242242}
     
    311311HTMLUListElement &HTMLUListElement::operator = (const Node &other)
    312312{
    313     assignOther( other, ID_UL );
     313    assignOther( other, HTMLNames::ul() );
    314314    return *this;
    315315}
  • trunk/WebCore/khtml/dom/html_misc.cpp

    r9156 r9639  
    4242HTMLBaseFontElement &HTMLBaseFontElement::operator = (const Node &other)
    4343{
    44     assignOther( other, ID_BASEFONT );
     44    assignOther( other, HTMLNames::basefont() );
    4545    return *this;
    4646}
  • trunk/WebCore/khtml/dom/html_object.cpp

    r6135 r9639  
    4444HTMLAppletElement &HTMLAppletElement::operator = (const Node &other)
    4545{
    46     assignOther( other, ID_APPLET );
     46    assignOther( other, HTMLNames::applet() );
    4747    return *this;
    4848}
     
    195195HTMLObjectElement &HTMLObjectElement::operator = (const Node &other)
    196196{
    197     assignOther( other, ID_OBJECT );
     197    assignOther( other, HTMLNames::object() );
    198198    return *this;
    199199}
     
    433433HTMLParamElement &HTMLParamElement::operator = (const Node &other)
    434434{
    435     assignOther( other, ID_PARAM );
     435    assignOther( other, HTMLNames::param() );
    436436    return *this;
    437437}
  • trunk/WebCore/khtml/dom/html_table.cpp

    r5334 r9639  
    4646HTMLTableCaptionElement &HTMLTableCaptionElement::operator = (const Node &other)
    4747{
    48     assignOther( other, ID_CAPTION );
     48    assignOther( other, HTMLNames::caption() );
    4949    return *this;
    5050}
     
    8787HTMLTableCellElement &HTMLTableCellElement::operator = (const Node &other)
    8888{
    89     if( other.elementId() != ID_TD &&
    90         other.elementId() != ID_TH )
    91     {
     89    if (!other.handle()->hasTagName(HTMLNames::td()) ||
     90        !other.handle()->hasTagName(HTMLNames::th())) {
    9291        if ( impl ) impl->deref();
    9392        impl = 0;
     
    296295HTMLTableColElement &HTMLTableColElement::operator = (const Node &other)
    297296{
    298     if( other.elementId() != ID_COL &&
    299         other.elementId() != ID_COLGROUP )
    300     {
     297    if (!other.handle()->hasTagName(HTMLNames::col()) &&
     298        !other.handle()->hasTagName(HTMLNames::colgroup())) {
    301299        if ( impl ) impl->deref();
    302300        impl = 0;
     
    402400HTMLTableElement &HTMLTableElement::operator = (const Node &other)
    403401{
    404     assignOther( other, ID_TABLE );
     402    assignOther( other, HTMLNames::table() );
    405403    return *this;
    406404}
     
    639637HTMLTableRowElement &HTMLTableRowElement::operator = (const Node &other)
    640638{
    641     assignOther( other, ID_TR );
     639    assignOther( other, HTMLNames::tr() );
    642640    return *this;
    643641}
     
    776774HTMLTableSectionElement &HTMLTableSectionElement::operator = (const Node &other)
    777775{
    778     if(other.elementId() != ID_TBODY &&
    779        other.elementId() != ID_THEAD &&
    780        other.elementId() != ID_TFOOT )
    781     {
     776    if (!other.handle()->hasTagName(HTMLNames::tbody()) &&
     777        !other.handle()->hasTagName(HTMLNames::thead()) &&
     778        !other.handle()->hasTagName(HTMLNames::tfoot())) {
    782779        if ( impl ) impl->deref();
    783780        impl = 0;
  • trunk/WebCore/khtml/ecma/kjs_css.cpp

    r9582 r9639  
    3030#include "html/html_headimpl.h" // for HTMLStyleElement
    3131#include "kjs_dom.h"
    32 #include "misc/htmltags.h"
     32#include "htmlnames.h"
    3333
    3434#include <kdebug.h>
     
    5656using DOM::DOMString;
    5757using DOM::ElementImpl;
     58using DOM::HTMLNames;
    5859using DOM::HTMLStyleElementImpl;
    5960using DOM::MediaListImpl;
     
    405406  // But unicity of stylesheet ids is good practice anyway ;)
    406407  ElementImpl *element = m_doc->getElementById(p.string());
    407   if (element && element->id() == ID_STYLE)
     408  if (element && element->hasTagName(HTMLNames::style()))
    408409    return getDOMStyleSheet(exec, static_cast<HTMLStyleElementImpl *>(element)->sheet());
    409410
  • trunk/WebCore/khtml/ecma/kjs_dom.cpp

    r9582 r9639  
    4848#include "html_objectimpl.h"
    4949
    50 #include "misc/htmltags.h"
    51 
    5250#if APPLE_CHANGES
    5351#include <JavaScriptCore/runtime_object.h>
     
    6866using DOM::HTMLElementImpl;
    6967using DOM::HTMLEmbedElementImpl;
     68using DOM::HTMLNames;
    7069using DOM::HTMLObjectElementImpl;
    7170using DOM::NamedNodeMapImpl;
     
    463462    break;
    464463  case Prefix:
    465     node.setPrefix(value.toString(exec).string(), exception);
     464    node.setPrefix(value.toString(exec).string().implementation(), exception);
    466465    break;
    467466  case OnAbort:
     
    11881187    switch( entry->value ) {
    11891188    case TagName:
    1190       return getStringOrNull(element.tagName());
     1189      return getStringOrNull(element.nodeName());
    11911190    case Style:
    11921191      return getDOMCSSStyleDeclaration(exec,element.style());
     
    17111710        return 0;
    17121711
    1713     switch (n->id()) {
    1714         case ID_APPLET: {
    1715             HTMLAppletElementImpl *appletElement = static_cast<HTMLAppletElementImpl *>(n);
    1716             if (appletElement->getAppletInstance())
    1717                 // The instance is owned by the applet element.
    1718                 return new RuntimeObjectImp(appletElement->getAppletInstance(), false);
    1719             break;
    1720         }
    1721         case ID_EMBED: {
    1722             HTMLEmbedElementImpl *embedElement = static_cast<HTMLEmbedElementImpl *>(n);
    1723             if (embedElement->getEmbedInstance())
    1724                 return new RuntimeObjectImp(embedElement->getEmbedInstance(), false);
    1725             break;
    1726         }
    1727         case ID_OBJECT: {
    1728             HTMLObjectElementImpl *objectElement = static_cast<HTMLObjectElementImpl *>(n);
    1729             if (objectElement->getObjectInstance())
    1730                 return new RuntimeObjectImp(objectElement->getObjectInstance(), false);
    1731             break;
    1732         }
     1712    if (n->hasTagName(HTMLNames::applet())) {
     1713        HTMLAppletElementImpl *appletElement = static_cast<HTMLAppletElementImpl *>(n);
     1714        if (appletElement->getAppletInstance())
     1715            // The instance is owned by the applet element.
     1716            return new RuntimeObjectImp(appletElement->getAppletInstance(), false);
     1717    }
     1718    else if (n->hasTagName(HTMLNames::embed())) {
     1719        HTMLEmbedElementImpl *embedElement = static_cast<HTMLEmbedElementImpl *>(n);
     1720        if (embedElement->getEmbedInstance())
     1721            return new RuntimeObjectImp(embedElement->getEmbedInstance(), false);
     1722    }
     1723    else if (n->hasTagName(HTMLNames::object())) {
     1724        HTMLObjectElementImpl *objectElement = static_cast<HTMLObjectElementImpl *>(n);
     1725        if (objectElement->getObjectInstance())
     1726            return new RuntimeObjectImp(objectElement->getObjectInstance(), false);
    17331727    }
    17341728   
  • trunk/WebCore/khtml/ecma/kjs_html.cpp

    r9582 r9639  
    4646#include "kjs_events.h"
    4747#include "kjs_proxy.h"
    48 
    49 #include "misc/htmltags.h"
    5048
    5149#include "rendering/render_canvasimage.h"
     
    110108using DOM::HTMLMetaElementImpl;
    111109using DOM::HTMLModElementImpl;
     110using DOM::HTMLNames;
    112111using DOM::HTMLOListElementImpl;
    113112using DOM::HTMLObjectElementImpl;
     
    354353    return Value(val);
    355354
    356   HTMLBodyElementImpl *bodyElement = (body && body->id() == ID_BODY) ? static_cast<HTMLBodyElementImpl *>(body) : 0;
     355  HTMLBodyElementImpl *bodyElement = (body && body->hasTagName(HTMLNames::body())) ? static_cast<HTMLBodyElementImpl *>(body) : 0;
    357356
    358357  if (entry) {
     
    430429  HTMLDocumentImpl &doc = *static_cast<HTMLDocumentImpl *>(impl());
    431430  HTMLElementImpl *body = doc.body();
    432   HTMLBodyElementImpl *bodyElement = (body && body->id() == ID_BODY) ? static_cast<HTMLBodyElementImpl *>(body) : 0;
     431  HTMLBodyElementImpl *bodyElement = (body && body->hasTagName(HTMLNames::body())) ? static_cast<HTMLBodyElementImpl *>(body) : 0;
    433432
    434433  switch (token) {
     
    584583const ClassInfo* KJS::HTMLElement::classInfo() const
    585584{
    586   switch (impl()->id()) {
    587   case ID_HTML:
    588     return &html_info;
    589   case ID_HEAD:
    590     return &head_info;
    591   case ID_LINK:
    592     return &link_info;
    593   case ID_TITLE:
    594     return &title_info;
    595   case ID_META:
    596     return &meta_info;
    597   case ID_BASE:
    598     return &base_info;
    599   case ID_ISINDEX:
    600     return &isIndex_info;
    601   case ID_STYLE:
    602     return &style_info;
    603   case ID_BODY:
    604     return &body_info;
    605   case ID_FORM:
    606     return &form_info;
    607   case ID_SELECT:
    608     return &select_info;
    609   case ID_OPTGROUP:
    610     return &optGroup_info;
    611   case ID_OPTION:
    612     return &option_info;
    613   case ID_INPUT:
    614     return &input_info;
    615   case ID_TEXTAREA:
    616     return &textArea_info;
    617   case ID_BUTTON:
    618     return &button_info;
    619   case ID_LABEL:
    620     return &label_info;
    621   case ID_FIELDSET:
    622     return &fieldSet_info;
    623   case ID_LEGEND:
    624     return &legend_info;
    625   case ID_UL:
    626     return &ul_info;
    627   case ID_OL:
    628     return &ol_info;
    629   case ID_DL:
    630     return &dl_info;
    631   case ID_DIR:
    632     return &dir_info;
    633   case ID_MENU:
    634     return &menu_info;
    635   case ID_LI:
    636     return &li_info;
    637   case ID_DIV:
    638     return &div_info;
    639   case ID_P:
    640     return &p_info;
    641   case ID_H1:
    642   case ID_H2:
    643   case ID_H3:
    644   case ID_H4:
    645   case ID_H5:
    646   case ID_H6:
    647     return &heading_info;
    648   case ID_BLOCKQUOTE:
    649     return &blockQuote_info;
    650   case ID_Q:
    651     return &q_info;
    652   case ID_PRE:
    653     return &pre_info;
    654   case ID_BR:
    655     return &br_info;
    656   case ID_BASEFONT:
    657     return &baseFont_info;
    658   case ID_FONT:
    659     return &font_info;
    660   case ID_HR:
    661     return &hr_info;
    662   case ID_INS:
    663   case ID_DEL:
    664     return &mod_info;
    665   case ID_A:
    666     return &a_info;
    667   case ID_CANVAS:
    668     return &canvas_info;
    669   case ID_IMG:
    670     return &img_info;
    671   case ID_OBJECT:
    672     return &object_info;
    673   case ID_PARAM:
    674     return &param_info;
    675   case ID_APPLET:
    676     return &applet_info;
    677   case ID_MAP:
    678     return &map_info;
    679   case ID_AREA:
    680     return &area_info;
    681   case ID_SCRIPT:
    682     return &script_info;
    683   case ID_TABLE:
    684     return &table_info;
    685   case ID_CAPTION:
    686     return &caption_info;
    687   case ID_COL:
    688     return &col_info;
    689   case ID_THEAD:
    690     return &tablesection_info;
    691   case ID_TBODY:
    692     return &tablesection_info;
    693   case ID_TFOOT:
    694     return &tablesection_info;
    695   case ID_TR:
    696     return &tr_info;
    697   case ID_TH:
    698     return &tablecell_info;
    699   case ID_TD:
    700     return &tablecell_info;
    701   case ID_FRAMESET:
    702     return &frameSet_info;
    703   case ID_FRAME:
    704     return &frame_info;
    705   case ID_IFRAME:
    706     return &iFrame_info;
    707   case ID_MARQUEE:
    708     return &marquee_info;
    709   default:
     585    // FIXME: We want to use HashMap here, but there are compiler issues to deal with.
     586    static QPtrDict<const ClassInfo> classInfoDict;
     587    if (classInfoDict.isEmpty()) {
     588        classInfoDict.insert(HTMLNames::a().localName().implementation(), &a_info);
     589        classInfoDict.insert(HTMLNames::applet().localName().implementation(), &applet_info);
     590        classInfoDict.insert(HTMLNames::area().localName().implementation(), &area_info);
     591        classInfoDict.insert(HTMLNames::base().localName().implementation(), &base_info);
     592        classInfoDict.insert(HTMLNames::basefont().localName().implementation(), &baseFont_info);
     593        classInfoDict.insert(HTMLNames::blockquote().localName().implementation(), &blockQuote_info);
     594        classInfoDict.insert(HTMLNames::body().localName().implementation(), &body_info);
     595        classInfoDict.insert(HTMLNames::br().localName().implementation(), &br_info);
     596        classInfoDict.insert(HTMLNames::button().localName().implementation(), &button_info);
     597        classInfoDict.insert(HTMLNames::canvas().localName().implementation(), &canvas_info);
     598        classInfoDict.insert(HTMLNames::caption().localName().implementation(), &caption_info);
     599        classInfoDict.insert(HTMLNames::col().localName().implementation(), &col_info);
     600        classInfoDict.insert(HTMLNames::colgroup().localName().implementation(), &col_info);
     601        classInfoDict.insert(HTMLNames::del().localName().implementation(), &mod_info);
     602        classInfoDict.insert(HTMLNames::dir().localName().implementation(), &dir_info);
     603        classInfoDict.insert(HTMLNames::div().localName().implementation(), &div_info);
     604        classInfoDict.insert(HTMLNames::dl().localName().implementation(), &dl_info);
     605        classInfoDict.insert(HTMLNames::fieldset().localName().implementation(), &fieldSet_info);
     606        classInfoDict.insert(HTMLNames::font().localName().implementation(), &font_info);
     607        classInfoDict.insert(HTMLNames::form().localName().implementation(), &form_info);
     608        classInfoDict.insert(HTMLNames::frame().localName().implementation(), &frame_info);
     609        classInfoDict.insert(HTMLNames::frameset().localName().implementation(), &frameSet_info);
     610        classInfoDict.insert(HTMLNames::h1().localName().implementation(), &heading_info);
     611        classInfoDict.insert(HTMLNames::h2().localName().implementation(), &heading_info);
     612        classInfoDict.insert(HTMLNames::h3().localName().implementation(), &heading_info);
     613        classInfoDict.insert(HTMLNames::h4().localName().implementation(), &heading_info);
     614        classInfoDict.insert(HTMLNames::h5().localName().implementation(), &heading_info);
     615        classInfoDict.insert(HTMLNames::h6().localName().implementation(), &heading_info);
     616        classInfoDict.insert(HTMLNames::head().localName().implementation(), &head_info);
     617        classInfoDict.insert(HTMLNames::hr().localName().implementation(), &hr_info);
     618        classInfoDict.insert(HTMLNames::html().localName().implementation(), &html_info);
     619        classInfoDict.insert(HTMLNames::iframe().localName().implementation(), &iFrame_info);
     620        classInfoDict.insert(HTMLNames::img().localName().implementation(), &img_info);
     621        classInfoDict.insert(HTMLNames::input().localName().implementation(), &input_info);
     622        classInfoDict.insert(HTMLNames::ins().localName().implementation(), &mod_info);
     623        classInfoDict.insert(HTMLNames::isindex().localName().implementation(), &isIndex_info);
     624        classInfoDict.insert(HTMLNames::label().localName().implementation(), &label_info);
     625        classInfoDict.insert(HTMLNames::legend().localName().implementation(), &legend_info);
     626        classInfoDict.insert(HTMLNames::li().localName().implementation(), &li_info);
     627        classInfoDict.insert(HTMLNames::link().localName().implementation(), &link_info);
     628        classInfoDict.insert(HTMLNames::map().localName().implementation(), &map_info);
     629        classInfoDict.insert(HTMLNames::marquee().localName().implementation(), &marquee_info);
     630        classInfoDict.insert(HTMLNames::menu().localName().implementation(), &menu_info);
     631        classInfoDict.insert(HTMLNames::meta().localName().implementation(), &meta_info);
     632        classInfoDict.insert(HTMLNames::object().localName().implementation(), &object_info);
     633        classInfoDict.insert(HTMLNames::ol().localName().implementation(), &ol_info);
     634        classInfoDict.insert(HTMLNames::option().localName().implementation(), &option_info);
     635        classInfoDict.insert(HTMLNames::optgroup().localName().implementation(), &optGroup_info);
     636        classInfoDict.insert(HTMLNames::p().localName().implementation(), &p_info);
     637        classInfoDict.insert(HTMLNames::param().localName().implementation(), &param_info);
     638        classInfoDict.insert(HTMLNames::pre().localName().implementation(), &pre_info);
     639        classInfoDict.insert(HTMLNames::q().localName().implementation(), &q_info);
     640        classInfoDict.insert(HTMLNames::script().localName().implementation(), &script_info);
     641        classInfoDict.insert(HTMLNames::select().localName().implementation(), &select_info);
     642        classInfoDict.insert(HTMLNames::style().localName().implementation(), &style_info);
     643        classInfoDict.insert(HTMLNames::table().localName().implementation(), &table_info);
     644        classInfoDict.insert(HTMLNames::tbody().localName().implementation(), &tablesection_info);
     645        classInfoDict.insert(HTMLNames::td().localName().implementation(), &tablecell_info);
     646        classInfoDict.insert(HTMLNames::textarea().localName().implementation(), &textArea_info);
     647        classInfoDict.insert(HTMLNames::th().localName().implementation(), &tablecell_info);
     648        classInfoDict.insert(HTMLNames::thead().localName().implementation(), &tablesection_info);
     649        classInfoDict.insert(HTMLNames::tfoot().localName().implementation(), &tablesection_info);
     650        classInfoDict.insert(HTMLNames::title().localName().implementation(), &title_info);
     651        classInfoDict.insert(HTMLNames::tr().localName().implementation(), &tr_info);
     652        classInfoDict.insert(HTMLNames::ul().localName().implementation(), &ul_info);
     653    }
     654   
     655    HTMLElementImpl* element = static_cast<HTMLElementImpl*>(impl());
     656    const ClassInfo* result = classInfoDict.find(element->localName().implementation());
     657    if (result)
     658        return result;
    710659    return &info;
    711   }
    712 }
     660}
     661
     662const HTMLElement::Accessors HTMLElement::html_accessors = { &HTMLElement::htmlGetter, &HTMLElement::htmlSetter };
     663const HTMLElement::Accessors HTMLElement::head_accessors = { &HTMLElement::headGetter, &HTMLElement::headSetter };
     664const HTMLElement::Accessors HTMLElement::link_accessors = { &HTMLElement::linkGetter, &HTMLElement::linkSetter };
     665const HTMLElement::Accessors HTMLElement::title_accessors = { &HTMLElement::titleGetter, &HTMLElement::titleSetter };
     666const HTMLElement::Accessors HTMLElement::meta_accessors = { &HTMLElement::metaGetter, &HTMLElement::metaSetter };
     667const HTMLElement::Accessors HTMLElement::base_accessors = { &HTMLElement::baseGetter, &HTMLElement::baseSetter };
     668const HTMLElement::Accessors HTMLElement::isIndex_accessors = { &HTMLElement::isIndexGetter, &HTMLElement::isIndexSetter };
     669const HTMLElement::Accessors HTMLElement::style_accessors = { &HTMLElement::styleGetter, &HTMLElement::styleSetter };
     670const HTMLElement::Accessors HTMLElement::body_accessors = { &HTMLElement::bodyGetter, &HTMLElement::bodySetter };
     671const HTMLElement::Accessors HTMLElement::form_accessors = { &HTMLElement::formGetter, &HTMLElement::formSetter };
     672const HTMLElement::Accessors HTMLElement::select_accessors = { &HTMLElement::selectGetter, &HTMLElement::selectSetter };
     673const HTMLElement::Accessors HTMLElement::optGroup_accessors = { &HTMLElement::optGroupGetter, &HTMLElement::optGroupSetter };
     674const HTMLElement::Accessors HTMLElement::option_accessors = { &HTMLElement::optionGetter, &HTMLElement::optionSetter };
     675const HTMLElement::Accessors HTMLElement::input_accessors = { &HTMLElement::inputGetter, &HTMLElement::inputSetter };
     676const HTMLElement::Accessors HTMLElement::textArea_accessors = { &HTMLElement::textAreaGetter, &HTMLElement::textAreaSetter };
     677const HTMLElement::Accessors HTMLElement::button_accessors = { &HTMLElement::buttonGetter, &HTMLElement::buttonSetter };
     678const HTMLElement::Accessors HTMLElement::label_accessors = { &HTMLElement::labelGetter, &HTMLElement::labelSetter };
     679const HTMLElement::Accessors HTMLElement::fieldSet_accessors = { &HTMLElement::fieldSetGetter, &HTMLElement::fieldSetSetter };
     680const HTMLElement::Accessors HTMLElement::legend_accessors = { &HTMLElement::legendGetter, &HTMLElement::legendSetter };
     681const HTMLElement::Accessors HTMLElement::ul_accessors = { &HTMLElement::uListGetter, &HTMLElement::uListSetter };
     682const HTMLElement::Accessors HTMLElement::ol_accessors = { &HTMLElement::oListGetter, &HTMLElement::oListSetter };
     683const HTMLElement::Accessors HTMLElement::dl_accessors = { &HTMLElement::dListGetter, &HTMLElement::dListSetter };
     684const HTMLElement::Accessors HTMLElement::dir_accessors = { &HTMLElement::dirGetter, &HTMLElement::dirSetter };
     685const HTMLElement::Accessors HTMLElement::menu_accessors = { &HTMLElement::menuGetter, &HTMLElement::menuSetter };
     686const HTMLElement::Accessors HTMLElement::li_accessors = { &HTMLElement::liGetter, &HTMLElement::liSetter };
     687const HTMLElement::Accessors HTMLElement::div_accessors = { &HTMLElement::divGetter, &HTMLElement::divSetter };
     688const HTMLElement::Accessors HTMLElement::p_accessors = { &HTMLElement::paragraphGetter, &HTMLElement::paragraphSetter };
     689const HTMLElement::Accessors HTMLElement::heading_accessors = { &HTMLElement::headingGetter, &HTMLElement::headingSetter };
     690const HTMLElement::Accessors HTMLElement::blockQuote_accessors = { &HTMLElement::blockQuoteGetter, &HTMLElement::blockQuoteSetter };
     691const HTMLElement::Accessors HTMLElement::q_accessors = { &HTMLElement::quoteGetter, &HTMLElement::quoteSetter };
     692const HTMLElement::Accessors HTMLElement::pre_accessors = { &HTMLElement::preGetter, &HTMLElement::preSetter };
     693const HTMLElement::Accessors HTMLElement::br_accessors = { &HTMLElement::brGetter, &HTMLElement::brSetter };
     694const HTMLElement::Accessors HTMLElement::baseFont_accessors = { &HTMLElement::baseFontGetter, &HTMLElement::baseFontSetter };
     695const HTMLElement::Accessors HTMLElement::font_accessors = { &HTMLElement::fontGetter, &HTMLElement::fontSetter };
     696const HTMLElement::Accessors HTMLElement::hr_accessors = { &HTMLElement::hrGetter, &HTMLElement::hrSetter };
     697const HTMLElement::Accessors HTMLElement::mod_accessors = { &HTMLElement::modGetter, &HTMLElement::modSetter };
     698const HTMLElement::Accessors HTMLElement::a_accessors = { &HTMLElement::anchorGetter, &HTMLElement::anchorSetter };
     699const HTMLElement::Accessors HTMLElement::canvas_accessors = { &HTMLElement::imageGetter, &HTMLElement::imageSetter };
     700const HTMLElement::Accessors HTMLElement::img_accessors = { &HTMLElement::imageGetter, &HTMLElement::imageSetter };
     701const HTMLElement::Accessors HTMLElement::object_accessors = { &HTMLElement::objectGetter, &HTMLElement::objectSetter };
     702const HTMLElement::Accessors HTMLElement::param_accessors = { &HTMLElement::paramGetter, &HTMLElement::paramSetter };
     703const HTMLElement::Accessors HTMLElement::applet_accessors = { &HTMLElement::appletGetter, &HTMLElement::appletSetter };
     704const HTMLElement::Accessors HTMLElement::map_accessors = { &HTMLElement::mapGetter, &HTMLElement::mapSetter };
     705const HTMLElement::Accessors HTMLElement::area_accessors = { &HTMLElement::areaGetter, &HTMLElement::areaSetter };
     706const HTMLElement::Accessors HTMLElement::script_accessors = { &HTMLElement::scriptGetter, &HTMLElement::scriptSetter };
     707const HTMLElement::Accessors HTMLElement::table_accessors = { &HTMLElement::tableGetter, &HTMLElement::tableSetter };
     708const HTMLElement::Accessors HTMLElement::caption_accessors = { &HTMLElement::tableCaptionGetter, &HTMLElement::tableCaptionSetter };
     709const HTMLElement::Accessors HTMLElement::col_accessors = { &HTMLElement::tableColGetter, &HTMLElement::tableColSetter };
     710const HTMLElement::Accessors HTMLElement::tablesection_accessors = { &HTMLElement::tableSectionGetter, &HTMLElement::tableSectionSetter };
     711const HTMLElement::Accessors HTMLElement::tr_accessors = { &HTMLElement::tableRowGetter, &HTMLElement::tableRowSetter };
     712const HTMLElement::Accessors HTMLElement::tablecell_accessors = { &HTMLElement::tableCellGetter, &HTMLElement::tableCellSetter };
     713const HTMLElement::Accessors HTMLElement::frameSet_accessors = { &HTMLElement::frameSetGetter, &HTMLElement::frameSetSetter };
     714const HTMLElement::Accessors HTMLElement::frame_accessors = { &HTMLElement::frameGetter, &HTMLElement::frameSetter };
     715const HTMLElement::Accessors HTMLElement::iFrame_accessors = { &HTMLElement::iFrameGetter, &HTMLElement::iFrameSetter };
     716const HTMLElement::Accessors HTMLElement::marquee_accessors = { &HTMLElement::marqueeGetter, &HTMLElement::marqueeSetter };
     717
     718const HTMLElement::Accessors* HTMLElement::getSetInfo() const
     719{
     720    // FIXME: We want to use HashMap here, but there are compiler issues to deal with.
     721    static QPtrDict<const HTMLElement::Accessors> getSetInfoDict;
     722    if (getSetInfoDict.isEmpty()) {
     723        getSetInfoDict.insert(HTMLNames::a().localName().implementation(), &a_accessors);
     724        getSetInfoDict.insert(HTMLNames::applet().localName().implementation(), &applet_accessors);
     725        getSetInfoDict.insert(HTMLNames::area().localName().implementation(), &area_accessors);
     726        getSetInfoDict.insert(HTMLNames::base().localName().implementation(), &base_accessors);
     727        getSetInfoDict.insert(HTMLNames::basefont().localName().implementation(), &baseFont_accessors);
     728        getSetInfoDict.insert(HTMLNames::blockquote().localName().implementation(), &blockQuote_accessors);
     729        getSetInfoDict.insert(HTMLNames::body().localName().implementation(), &body_accessors);
     730        getSetInfoDict.insert(HTMLNames::br().localName().implementation(), &br_accessors);
     731        getSetInfoDict.insert(HTMLNames::button().localName().implementation(), &button_accessors);
     732        getSetInfoDict.insert(HTMLNames::canvas().localName().implementation(), &canvas_accessors);
     733        getSetInfoDict.insert(HTMLNames::caption().localName().implementation(), &caption_accessors);
     734        getSetInfoDict.insert(HTMLNames::col().localName().implementation(), &col_accessors);
     735        getSetInfoDict.insert(HTMLNames::colgroup().localName().implementation(), &col_accessors);
     736        getSetInfoDict.insert(HTMLNames::del().localName().implementation(), &mod_accessors);
     737        getSetInfoDict.insert(HTMLNames::dir().localName().implementation(), &dir_accessors);
     738        getSetInfoDict.insert(HTMLNames::div().localName().implementation(), &div_accessors);
     739        getSetInfoDict.insert(HTMLNames::dl().localName().implementation(), &dl_accessors);
     740        getSetInfoDict.insert(HTMLNames::fieldset().localName().implementation(), &fieldSet_accessors);
     741        getSetInfoDict.insert(HTMLNames::font().localName().implementation(), &font_accessors);
     742        getSetInfoDict.insert(HTMLNames::form().localName().implementation(), &form_accessors);
     743        getSetInfoDict.insert(HTMLNames::frame().localName().implementation(), &frame_accessors);
     744        getSetInfoDict.insert(HTMLNames::frameset().localName().implementation(), &frameSet_accessors);
     745        getSetInfoDict.insert(HTMLNames::h1().localName().implementation(), &heading_accessors);
     746        getSetInfoDict.insert(HTMLNames::h2().localName().implementation(), &heading_accessors);
     747        getSetInfoDict.insert(HTMLNames::h3().localName().implementation(), &heading_accessors);
     748        getSetInfoDict.insert(HTMLNames::h4().localName().implementation(), &heading_accessors);
     749        getSetInfoDict.insert(HTMLNames::h5().localName().implementation(), &heading_accessors);
     750        getSetInfoDict.insert(HTMLNames::h6().localName().implementation(), &heading_accessors);
     751        getSetInfoDict.insert(HTMLNames::head().localName().implementation(), &head_accessors);
     752        getSetInfoDict.insert(HTMLNames::hr().localName().implementation(), &hr_accessors);
     753        getSetInfoDict.insert(HTMLNames::html().localName().implementation(), &html_accessors);
     754        getSetInfoDict.insert(HTMLNames::iframe().localName().implementation(), &iFrame_accessors);
     755        getSetInfoDict.insert(HTMLNames::img().localName().implementation(), &img_accessors);
     756        getSetInfoDict.insert(HTMLNames::input().localName().implementation(), &input_accessors);
     757        getSetInfoDict.insert(HTMLNames::ins().localName().implementation(), &mod_accessors);
     758        getSetInfoDict.insert(HTMLNames::isindex().localName().implementation(), &isIndex_accessors);
     759        getSetInfoDict.insert(HTMLNames::label().localName().implementation(), &label_accessors);
     760        getSetInfoDict.insert(HTMLNames::legend().localName().implementation(), &legend_accessors);
     761        getSetInfoDict.insert(HTMLNames::li().localName().implementation(), &li_accessors);
     762        getSetInfoDict.insert(HTMLNames::link().localName().implementation(), &link_accessors);
     763        getSetInfoDict.insert(HTMLNames::map().localName().implementation(), &map_accessors);
     764        getSetInfoDict.insert(HTMLNames::marquee().localName().implementation(), &marquee_accessors);
     765        getSetInfoDict.insert(HTMLNames::menu().localName().implementation(), &menu_accessors);
     766        getSetInfoDict.insert(HTMLNames::meta().localName().implementation(), &meta_accessors);
     767        getSetInfoDict.insert(HTMLNames::object().localName().implementation(), &object_accessors);
     768        getSetInfoDict.insert(HTMLNames::ol().localName().implementation(), &ol_accessors);
     769        getSetInfoDict.insert(HTMLNames::option().localName().implementation(), &option_accessors);
     770        getSetInfoDict.insert(HTMLNames::optgroup().localName().implementation(), &optGroup_accessors);
     771        getSetInfoDict.insert(HTMLNames::p().localName().implementation(), &p_accessors);
     772        getSetInfoDict.insert(HTMLNames::param().localName().implementation(), &param_accessors);
     773        getSetInfoDict.insert(HTMLNames::pre().localName().implementation(), &pre_accessors);
     774        getSetInfoDict.insert(HTMLNames::q().localName().implementation(), &q_accessors);
     775        getSetInfoDict.insert(HTMLNames::script().localName().implementation(), &script_accessors);
     776        getSetInfoDict.insert(HTMLNames::select().localName().implementation(), &select_accessors);
     777        getSetInfoDict.insert(HTMLNames::style().localName().implementation(), &style_accessors);
     778        getSetInfoDict.insert(HTMLNames::table().localName().implementation(), &table_accessors);
     779        getSetInfoDict.insert(HTMLNames::tbody().localName().implementation(), &tablesection_accessors);
     780        getSetInfoDict.insert(HTMLNames::td().localName().implementation(), &tablecell_accessors);
     781        getSetInfoDict.insert(HTMLNames::textarea().localName().implementation(), &textArea_accessors);
     782        getSetInfoDict.insert(HTMLNames::th().localName().implementation(), &tablecell_accessors);
     783        getSetInfoDict.insert(HTMLNames::thead().localName().implementation(), &tablesection_accessors);
     784        getSetInfoDict.insert(HTMLNames::tfoot().localName().implementation(), &tablesection_accessors);
     785        getSetInfoDict.insert(HTMLNames::title().localName().implementation(), &title_accessors);
     786        getSetInfoDict.insert(HTMLNames::tr().localName().implementation(), &tr_accessors);
     787        getSetInfoDict.insert(HTMLNames::ul().localName().implementation(), &ul_accessors);
     788    }
     789   
     790    HTMLElementImpl* element = static_cast<HTMLElementImpl*>(impl());
     791    const HTMLElement::Accessors* result = getSetInfoDict.find(element->localName().implementation());
     792    if (result)
     793        return result;
     794    return 0;
     795}
     796
    713797/*
    714798@begin HTMLElementTable 14
     
    11851269
    11861270@begin HTMLCanvasElementTable 1
    1187   getContext      KJS::HTMLElement::GetContext                  DontDelete|Function 0
     1271  getContext      KJS::HTMLElement::GetContext                  DontDelete|Function 1
    11881272@end
    11891273*/
     
    11961280Value KJS::HTMLElement::tryGet(ExecState *exec, const Identifier &propertyName) const
    11971281{
    1198   HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
     1282    HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
    11991283#ifdef KJS_VERBOSE
    1200   kdDebug(6070) << "KJS::HTMLElement::tryGet " << propertyName.qstring() << " thisTag=" << element.tagName().string() << endl;
     1284    kdDebug(6070) << "KJS::HTMLElement::tryGet " << propertyName.qstring() << " thisTag=" << element.tagName().string() << endl;
    12011285#endif
    1202   // First look at dynamic properties
    1203   switch (element.id()) {
    1204     case ID_FORM: {
    1205       HTMLFormElementImpl &form = static_cast<HTMLFormElementImpl &>(element);
    1206       // Check if we're retrieving an element (by index or by name)
    1207       bool ok;
    1208       uint u = propertyName.toULong(&ok);
    1209       if (ok)
    1210         return getDOMNode(exec, form.elements()->item(u));
    1211       ValueImp *namedItems = HTMLCollection(exec, form.elements().get()).getNamedItems(exec, propertyName);
    1212       if (!namedItems->isUndefined())
    1213         return namedItems;
    1214     }
    1215       break;
    1216     case ID_SELECT: {
    1217       HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
    1218       bool ok;
    1219       uint u = propertyName.toULong(&ok);
    1220       if (ok)
    1221         return getDOMNode(exec, select.optionsHTMLCollection()->item(u)); // not specified by DOM(?) but supported in netscape/IE
    1222     }
    1223       break;
    1224     case ID_FRAMESET: {
     1286    // First look at dynamic properties
     1287    if (element.hasLocalName(HTMLNames::form())) {
     1288        HTMLFormElementImpl &form = static_cast<HTMLFormElementImpl &>(element);
     1289        // Check if we're retrieving an element (by index or by name)
     1290        bool ok;
     1291        uint u = propertyName.toULong(&ok);
     1292        if (ok)
     1293            return getDOMNode(exec, form.elements()->item(u));
     1294        ValueImp *namedItems = HTMLCollection(exec, form.elements().get()).getNamedItems(exec, propertyName);
     1295        if (!namedItems->isUndefined())
     1296            return namedItems;
     1297    }
     1298    else if (element.hasLocalName(HTMLNames::select())) {
     1299        HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
     1300        bool ok;
     1301        uint u = propertyName.toULong(&ok);
     1302        if (ok)
     1303            return getDOMNode(exec, select.optionsHTMLCollection()->item(u)); // not specified by DOM(?) but supported in netscape/IE
     1304    }
     1305    else if (element.hasLocalName(HTMLNames::frameset())) {
    12251306        NodeImpl *frame = element.children()->namedItem(propertyName.string());
    1226         if (frame && frame->id() == ID_FRAME) {
     1307        if (frame && frame->hasTagName(HTMLNames::frame())) {
    12271308            DocumentImpl* doc = static_cast<HTMLFrameElementImpl *>(frame)->contentDocument();
    12281309            if (doc) {
     
    12371318        }
    12381319    }
    1239         break;
    1240     case ID_FRAME:
    1241     case ID_IFRAME: {
     1320    else if (element.hasLocalName(HTMLNames::frame()) || element.hasLocalName(HTMLNames::iframe())) {
    12421321        DocumentImpl* doc = static_cast<HTMLFrameElementImpl &>(element).contentDocument();
    1243         if ( doc ) {
     1322        if (doc) {
    12441323            KHTMLPart* part = doc->part();
    1245             if ( part ) {
     1324            if (part) {
    12461325              Window *window = Window::retrieveWindow(part);
    12471326              if (window && window->hasProperty(exec, propertyName))
     
    12501329        }
    12511330    }
    1252       break;
    12531331#if APPLE_CHANGES
    1254     case ID_EMBED:
    1255     case ID_OBJECT:
    1256     case ID_APPLET: {
    1257         if (propertyName == "__apple_runtime_object") {
     1332    else if (element.hasLocalName(HTMLNames::embed()) || element.hasLocalName(HTMLNames::object()) ||
     1333             element.hasLocalName(HTMLNames::applet())) {
     1334        if (propertyName == "__apple_runtime_object")
    12581335            return getRuntimeObject(exec,&element);
    1259         }
    1260 
    12611336        Value runtimeObject = getRuntimeObject(exec,&element);
    12621337        if (!runtimeObject.isNull()) {
    12631338            ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject.imp());
    1264             if (imp->hasProperty(exec, propertyName)) {
     1339            if (imp->hasProperty(exec, propertyName))
    12651340                return imp->get (exec, propertyName);
    1266             }
    12671341        }
    12681342    }
    1269       break;
    12701343#endif
    1271     default:
    1272         break;
    1273     }
    1274 
    1275   const HashTable* table = classInfo()->propHashTable; // get the right hashtable
    1276   const HashEntry* entry = Lookup::findEntry(table, propertyName);
    1277   if (entry) {
    1278     if (entry->attr & Function)
    1279       return lookupOrCreateFunction<KJS::HTMLElementFunction>(exec, propertyName, this, entry->value, entry->params, entry->attr);
    1280     return getValueProperty(exec, entry->value);
    1281   }
    1282 
    1283   // Base HTMLElement stuff or parent class forward, as usual
    1284   return DOMObjectLookupGet<KJS::HTMLElementFunction, KJS::HTMLElement, DOMElement>(exec, propertyName, &HTMLElementTable, this);
     1344
     1345    const HashTable* table = classInfo()->propHashTable; // get the right hashtable
     1346    const HashEntry* entry = Lookup::findEntry(table, propertyName);
     1347    if (entry) {
     1348        if (entry->attr & Function)
     1349            return lookupOrCreateFunction<KJS::HTMLElementFunction>(exec, propertyName, this, entry->value, entry->params, entry->attr);
     1350        return getValueProperty(exec, entry->value);
     1351    }
     1352
     1353    // Base HTMLElement stuff or parent class forward, as usual
     1354    return DOMObjectLookupGet<KJS::HTMLElementFunction, KJS::HTMLElement, DOMElement>(exec, propertyName, &HTMLElementTable, this);
    12851355}
    12861356
     
    12881358{
    12891359    HTMLElementImpl *element = static_cast<HTMLElementImpl *>(impl());
    1290     switch (element->id()) {
    1291         case ID_EMBED:
    1292         case ID_OBJECT:
    1293         case ID_APPLET: {
    1294                 DocumentImpl* doc = element->getDocument();
    1295                 KJSProxy *proxy = KJSProxy::proxy(doc->part());
    1296                 ExecState *exec = proxy->interpreter()->globalExec();
    1297                 Value runtimeObject = getRuntimeObject(exec,element);
    1298                 if (!runtimeObject.isNull()) {
    1299                     ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject.imp());
    1300                     return imp->implementsCall ();
    1301                 }
    1302             }
    1303             break;
    1304         default:
    1305             break;
     1360    if (element->hasTagName(HTMLNames::embed()) ||
     1361        element->hasTagName(HTMLNames::object()) ||
     1362        element->hasTagName(HTMLNames::applet())) {
     1363        DocumentImpl* doc = element->getDocument();
     1364        KJSProxy *proxy = KJSProxy::proxy(doc->part());
     1365        ExecState *exec = proxy->interpreter()->globalExec();
     1366        Value runtimeObject = getRuntimeObject(exec,element);
     1367        if (!runtimeObject.isNull()) {
     1368            ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject.imp());
     1369            return imp->implementsCall ();
     1370        }
    13061371    }
    13071372    return false;
     
    13111376{
    13121377    HTMLElementImpl *element = static_cast<HTMLElementImpl *>(impl());
    1313     switch (element->id()) {
    1314         case ID_EMBED:
    1315         case ID_OBJECT:
    1316         case ID_APPLET: {
    1317                 Value runtimeObject = getRuntimeObject(exec,element);
    1318                 if (!runtimeObject.isNull()) {
    1319                     ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject.imp());
    1320                     return imp->call (exec, thisObj, args);
    1321                 }
    1322             }
    1323             break;
    1324         default:
    1325             break;
     1378    if (element->hasTagName(HTMLNames::embed()) ||
     1379        element->hasTagName(HTMLNames::object()) ||
     1380        element->hasTagName(HTMLNames::applet())) {
     1381        Value runtimeObject = getRuntimeObject(exec,element);
     1382        if (!runtimeObject.isNull()) {
     1383            ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject.imp());
     1384            return imp->call (exec, thisObj, args);
     1385        }
     1386    }
     1387    return Undefined();
     1388}
     1389
     1390Value HTMLElement::htmlGetter(ExecState* exec, int token) const
     1391{
     1392    HTMLHtmlElementImpl& html = *static_cast<HTMLHtmlElementImpl*>(impl());
     1393    if (token == HtmlVersion)
     1394        return String(html.version());
     1395    return Undefined();
     1396}
     1397
     1398Value HTMLElement::headGetter(ExecState* exec, int token) const
     1399{
     1400    HTMLHeadElementImpl &head = *static_cast<HTMLHeadElementImpl*>(impl());
     1401    if (token == HeadProfile)
     1402        return String(head.profile());
     1403    return Undefined();
     1404}
     1405
     1406Value HTMLElement::linkGetter(ExecState* exec, int token) const
     1407{
     1408    HTMLLinkElementImpl &link = *static_cast<HTMLLinkElementImpl*>(impl());
     1409    switch (token) {
     1410        case LinkDisabled:
     1411            return Boolean(link.disabled());
     1412        case LinkCharset:
     1413            return String(link.charset());
     1414        case LinkHref:
     1415            return String(link.href());
     1416        case LinkHrefLang:
     1417            return String(link.hreflang());
     1418        case LinkMedia:           
     1419            return String(link.media());
     1420        case LinkRel:             
     1421            return String(link.rel());
     1422        case LinkRev:           
     1423            return String(link.rev());
     1424        case LinkTarget:         
     1425            return String(link.target());
     1426        case LinkType:           
     1427            return String(link.type());
     1428        case LinkSheet:           
     1429            return getDOMStyleSheet(exec, link.sheet());
     1430    }
     1431    return Undefined();
     1432}
     1433
     1434Value HTMLElement::titleGetter(ExecState* exec, int token) const
     1435{
     1436    HTMLTitleElementImpl& title = *static_cast<HTMLTitleElementImpl*>(impl());
     1437    if (token == TitleText)
     1438        return String(title.text());
     1439    return Undefined();
     1440}
     1441
     1442Value HTMLElement::metaGetter(ExecState* exec, int token) const
     1443{
     1444    HTMLMetaElementImpl& meta = *static_cast<HTMLMetaElementImpl*>(impl());
     1445    switch (token) {
     1446        case MetaContent:         return String(meta.content());
     1447        case MetaHttpEquiv:       return String(meta.httpEquiv());
     1448        case MetaName:            return String(meta.name());
     1449        case MetaScheme:          return String(meta.scheme());
     1450    }
     1451    return Undefined();
     1452}
     1453
     1454Value HTMLElement::baseGetter(ExecState* exec, int token) const
     1455{
     1456    HTMLBaseElementImpl& base = *static_cast<HTMLBaseElementImpl*>(impl());
     1457    switch (token) {
     1458        case BaseHref:            return String(base.href());
     1459        case BaseTarget:          return String(base.target());
     1460    }
     1461    return Undefined();
     1462}
     1463
     1464Value HTMLElement::isIndexGetter(ExecState* exec, int token) const
     1465{
     1466    HTMLIsIndexElementImpl& isindex = *static_cast<HTMLIsIndexElementImpl*>(impl());
     1467    switch (token) {
     1468        case IsIndexForm:            return getDOMNode(exec, isindex.form()); // type HTMLFormElement
     1469        case IsIndexPrompt:          return String(isindex.prompt());
     1470    }
     1471    return Undefined();
     1472}
     1473
     1474Value HTMLElement::styleGetter(ExecState* exec, int token) const
     1475{
     1476    HTMLStyleElementImpl& style = *static_cast<HTMLStyleElementImpl*>(impl());
     1477    switch (token) {
     1478        case StyleDisabled:        return Boolean(style.disabled());
     1479        case StyleMedia:           return String(style.media());
     1480        case StyleType:            return String(style.type());
     1481        case StyleSheet:           return getDOMStyleSheet(exec, style.sheet());
     1482    }
     1483    return Undefined();
     1484}
     1485
     1486Value HTMLElement::bodyGetter(ExecState* exec, int token) const
     1487{
     1488    HTMLBodyElementImpl& body = *static_cast<HTMLBodyElementImpl*>(impl());
     1489    switch (token) {
     1490        case BodyALink:           return String(body.aLink());
     1491        case BodyBackground:      return String(body.background());
     1492        case BodyBgColor:         return String(body.bgColor());
     1493        case BodyLink:            return String(body.link());
     1494        case BodyText:            return String(body.text());
     1495        case BodyVLink:           return String(body.vLink());
     1496        default: {
     1497            // Update the document's layout before we compute these attributes.
     1498            DocumentImpl *doc = body.getDocument();
     1499            if (doc)
     1500                doc->updateLayoutIgnorePendingStylesheets();
     1501            KHTMLView *view = doc ? doc->view() : 0;
     1502            switch (token) {
     1503                case BodyScrollLeft:
     1504                    return Number(view ? view->contentsX() : 0);
     1505                case BodyScrollTop:
     1506                    return Number(view ? view->contentsY() : 0);
     1507                case BodyScrollHeight:
     1508                    return Number(view ? view->contentsHeight() : 0);
     1509                case BodyScrollWidth:
     1510                    return Number(view ? view->contentsWidth() : 0);
     1511            }
     1512        }
     1513    }
     1514    return Undefined();
     1515}
     1516
     1517Value HTMLElement::formGetter(ExecState* exec, int token) const
     1518{
     1519    HTMLFormElementImpl& form = *static_cast<HTMLFormElementImpl*>(impl());
     1520    switch (token) {
     1521        case FormElements:        return getHTMLCollection(exec, form.elements().get());
     1522        case FormLength:          return Number(form.length());
     1523        case FormName:            return String(form.name());
     1524        case FormAcceptCharset:   return String(form.acceptCharset());
     1525        case FormAction:          return String(form.action());
     1526        case FormEncType:         return String(form.enctype());
     1527        case FormMethod:          return String(form.method());
     1528        case FormTarget:          return String(form.target());
     1529    }
     1530    return Undefined();
     1531}
     1532
     1533Value HTMLElement::selectGetter(ExecState* exec, int token) const
     1534{
     1535    HTMLSelectElementImpl& select = *static_cast<HTMLSelectElementImpl*>(impl());
     1536    switch (token) {
     1537        case SelectType:            return String(select.type());
     1538        case SelectSelectedIndex:   return Number(select.selectedIndex());
     1539        case SelectValue:           return String(select.value());
     1540        case SelectLength:          return Number(select.length());
     1541        case SelectForm:            return getDOMNode(exec, select.form()); // type HTMLFormElement
     1542        case SelectOptions:         return getSelectHTMLCollection(exec, select.optionsHTMLCollection().get(), &select); // type HTMLCollection
     1543        case SelectDisabled:        return Boolean(select.disabled());
     1544        case SelectMultiple:        return Boolean(select.multiple());
     1545        case SelectName:            return String(select.name());
     1546        case SelectSize:            return Number(select.size());
     1547        case SelectTabIndex:        return Number(select.tabIndex());
     1548    }
     1549    return Undefined();
     1550}
     1551
     1552Value HTMLElement::optGroupGetter(ExecState* exec, int token) const
     1553{
     1554    HTMLOptGroupElementImpl& optgroup = *static_cast<HTMLOptGroupElementImpl*>(impl());
     1555    switch (token) {
     1556        case OptGroupDisabled:        return Boolean(optgroup.disabled());
     1557        case OptGroupLabel:           return String(optgroup.label());
     1558    }
     1559    return Undefined();
     1560}
     1561
     1562Value HTMLElement::optionGetter(ExecState* exec, int token) const
     1563{
     1564    HTMLOptionElementImpl& option = *static_cast<HTMLOptionElementImpl*>(impl());
     1565    switch (token) {
     1566        case OptionForm:            return getDOMNode(exec,option.form()); // type HTMLFormElement
     1567        case OptionDefaultSelected: return Boolean(option.defaultSelected());
     1568        case OptionText:            return String(option.text());
     1569        case OptionIndex:           return Number(option.index());
     1570        case OptionDisabled:        return Boolean(option.disabled());
     1571        case OptionLabel:           return String(option.label());
     1572        case OptionSelected:        return Boolean(option.selected());
     1573        case OptionValue:           return String(option.value());
    13261574    }
    13271575    return Undefined();
     
    13301578static Value getInputSelectionStart(HTMLInputElementImpl &input)
    13311579{
    1332   if (input.canHaveSelection()) {
    1333     return Number(input.selectionStart());
    1334   }
    1335   return Undefined();
     1580    if (input.canHaveSelection())
     1581        return Number(input.selectionStart());
     1582    return Undefined();
    13361583}
    13371584
    13381585static Value getInputSelectionEnd(HTMLInputElementImpl &input)
    13391586{
    1340   if (input.canHaveSelection()) {
    1341     return Number(input.selectionEnd());
    1342   }
    1343   return Undefined();
    1344 }
    1345 
    1346 Value KJS::HTMLElement::getValueProperty(ExecState *exec, int token) const
    1347 {
    1348   HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
    1349   switch (element.id()) {
    1350   case ID_HTML: {
    1351     HTMLHtmlElementImpl &html = static_cast<HTMLHtmlElementImpl &>(element);
    1352     if      (token == HtmlVersion)         return String(html.version());
    1353   }
    1354   break;
    1355   case ID_HEAD: {
    1356     HTMLHeadElementImpl &head = static_cast<HTMLHeadElementImpl &>(element);
    1357     if      (token == HeadProfile)         return String(head.profile());
    1358   }
    1359   break;
    1360   case ID_LINK: {
    1361     HTMLLinkElementImpl &link = static_cast<HTMLLinkElementImpl &>(element);
    1362     switch (token) {
    1363     case LinkDisabled:        return Boolean(link.disabled());
    1364     case LinkCharset:         return String(link.charset());
    1365     case LinkHref:            return String(link.href());
    1366     case LinkHrefLang:        return String(link.hreflang());
    1367     case LinkMedia:           return String(link.media());
    1368     case LinkRel:             return String(link.rel());
    1369     case LinkRev:             return String(link.rev());
    1370     case LinkTarget:          return String(link.target());
    1371     case LinkType:            return String(link.type());
    1372     case LinkSheet:           return getDOMStyleSheet(exec, link.sheet());
    1373     }
    1374   }
    1375   break;
    1376   case ID_TITLE: {
    1377     HTMLTitleElementImpl &title = static_cast<HTMLTitleElementImpl &>(element);
    1378     switch (token) {
    1379     case TitleText:                 return String(title.text());
    1380     }
    1381   }
    1382   break;
    1383   case ID_META: {
    1384     HTMLMetaElementImpl &meta = static_cast<HTMLMetaElementImpl &>(element);
    1385     switch (token) {
    1386     case MetaContent:         return String(meta.content());
    1387     case MetaHttpEquiv:       return String(meta.httpEquiv());
    1388     case MetaName:            return String(meta.name());
    1389     case MetaScheme:          return String(meta.scheme());
    1390     }
    1391   }
    1392   break;
    1393   case ID_BASE: {
    1394     HTMLBaseElementImpl &base = static_cast<HTMLBaseElementImpl &>(element);
    1395     switch (token) {
    1396     case BaseHref:            return String(base.href());
    1397     case BaseTarget:          return String(base.target());
    1398     }
    1399   }
    1400   break;
    1401   case ID_ISINDEX: {
    1402     HTMLIsIndexElementImpl &isindex = static_cast<HTMLIsIndexElementImpl &>(element);
    1403     switch (token) {
    1404     case IsIndexForm:            return getDOMNode(exec, isindex.form()); // type HTMLFormElement
    1405     case IsIndexPrompt:          return String(isindex.prompt());
    1406     }
    1407   }
    1408   break;
    1409   case ID_STYLE: {
    1410     HTMLStyleElementImpl &style = static_cast<HTMLStyleElementImpl &>(element);
    1411     switch (token) {
    1412     case StyleDisabled:        return Boolean(style.disabled());
    1413     case StyleMedia:           return String(style.media());
    1414     case StyleType:            return String(style.type());
    1415     case StyleSheet:           return getDOMStyleSheet(exec, style.sheet());
    1416     }
    1417   }
    1418   break;
    1419   case ID_BODY: {
    1420     HTMLBodyElementImpl &body = static_cast<HTMLBodyElementImpl &>(element);
    1421     switch (token) {
    1422     case BodyALink:           return String(body.aLink());
    1423     case BodyBackground:      return String(body.background());
    1424     case BodyBgColor:         return String(body.bgColor());
    1425     case BodyLink:            return String(body.link());
    1426     case BodyText:            return String(body.text());
    1427     case BodyVLink:           return String(body.vLink());
    1428     default:
    1429       // Update the document's layout before we compute these attributes.
    1430       DocumentImpl *doc = body.getDocument();
    1431       if (doc)
    1432         doc->updateLayoutIgnorePendingStylesheets();
    1433       KHTMLView *view = doc ? doc->view() : 0;
    1434       switch (token) {
    1435         case BodyScrollLeft:
    1436             return Number(view ? view->contentsX() : 0);
    1437         case BodyScrollTop:
    1438             return Number(view ? view->contentsY() : 0);
    1439         case BodyScrollHeight:   return Number(view ? view->contentsHeight() : 0);
    1440         case BodyScrollWidth:    return Number(view ? view->contentsWidth() : 0);
    1441       }
    1442     }
    1443   }
    1444   break;
    1445 
    1446   case ID_FORM: {
    1447     HTMLFormElementImpl &form = static_cast<HTMLFormElementImpl &>(element);
    1448     switch (token) {
    1449     case FormElements:        return getHTMLCollection(exec, form.elements().get());
    1450     case FormLength:          return Number(form.length());
    1451     case FormName:            return String(form.name());
    1452     case FormAcceptCharset:   return String(form.acceptCharset());
    1453     case FormAction:          return String(form.action());
    1454     case FormEncType:         return String(form.enctype());
    1455     case FormMethod:          return String(form.method());
    1456     case FormTarget:          return String(form.target());
    1457     }
    1458   }
    1459   break;
    1460   case ID_SELECT: {
    1461     HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
    1462     switch (token) {
    1463     case SelectType:            return String(select.type());
    1464     case SelectSelectedIndex:   return Number(select.selectedIndex());
    1465     case SelectValue:           return String(select.value());
    1466     case SelectLength:          return Number(select.length());
    1467     case SelectForm:            return getDOMNode(exec, select.form()); // type HTMLFormElement
    1468     case SelectOptions:         return getSelectHTMLCollection(exec, select.optionsHTMLCollection().get(), &select); // type HTMLCollection
    1469     case SelectDisabled:        return Boolean(select.disabled());
    1470     case SelectMultiple:        return Boolean(select.multiple());
    1471     case SelectName:            return String(select.name());
    1472     case SelectSize:            return Number(select.size());
    1473     case SelectTabIndex:        return Number(select.tabIndex());
    1474     }
    1475   }
    1476   break;
    1477   case ID_OPTGROUP: {
    1478     HTMLOptGroupElementImpl &optgroup = static_cast<HTMLOptGroupElementImpl &>(element);
    1479     switch (token) {
    1480     case OptGroupDisabled:        return Boolean(optgroup.disabled());
    1481     case OptGroupLabel:           return String(optgroup.label());
    1482     }
    1483   }
    1484   break;
    1485   case ID_OPTION: {
    1486     HTMLOptionElementImpl &option = static_cast<HTMLOptionElementImpl &>(element);
    1487     switch (token) {
    1488     case OptionForm:            return getDOMNode(exec,option.form()); // type HTMLFormElement
    1489     case OptionDefaultSelected: return Boolean(option.defaultSelected());
    1490     case OptionText:            return String(option.text());
    1491     case OptionIndex:           return Number(option.index());
    1492     case OptionDisabled:        return Boolean(option.disabled());
    1493     case OptionLabel:           return String(option.label());
    1494     case OptionSelected:        return Boolean(option.selected());
    1495     case OptionValue:           return String(option.value());
    1496     }
    1497   }
    1498   break;
    1499   case ID_INPUT: {
    1500     HTMLInputElementImpl &input = static_cast<HTMLInputElementImpl &>(element);
    1501     switch (token) {
    1502     case InputDefaultValue:    return String(input.defaultValue());
    1503     case InputDefaultChecked:  return Boolean(input.defaultChecked());
    1504     case InputForm:            return getDOMNode(exec,input.form()); // type HTMLFormElement
    1505     case InputAccept:          return String(input.accept());
    1506     case InputAccessKey:       return String(input.accessKey());
    1507     case InputAlign:           return String(input.align());
    1508     case InputAlt:             return String(input.alt());
    1509     case InputChecked:         return Boolean(input.checked());
    1510     case InputDisabled:        return Boolean(input.disabled());
    1511     case InputMaxLength:       return Number(input.maxLength());
    1512     case InputName:            return String(input.name());
    1513     case InputReadOnly:        return Boolean(input.readOnly());
    1514     case InputSelectionStart:  return getInputSelectionStart(input);
    1515     case InputSelectionEnd:    return getInputSelectionEnd(input);
    1516     case InputSize:            return String(input.sizeDOM());
    1517     case InputSrc:             return String(input.src());
    1518     case InputTabIndex:        return Number(input.tabIndex());
    1519     case InputType:            return String(input.type());
    1520     case InputUseMap:          return String(input.useMap());
    1521     case InputValue:           return String(input.value());
    1522     }
    1523   }
    1524   break;
    1525   case ID_TEXTAREA: {
    1526     HTMLTextAreaElementImpl &textarea = static_cast<HTMLTextAreaElementImpl &>(element);
    1527     switch (token) {
    1528     case TextAreaDefaultValue:    return String(textarea.defaultValue());
    1529     case TextAreaForm:            return getDOMNode(exec,textarea.form()); // type HTMLFormElement
    1530     case TextAreaAccessKey:       return String(textarea.accessKey());
    1531     case TextAreaCols:            return Number(textarea.cols());
    1532     case TextAreaDisabled:        return Boolean(textarea.disabled());
    1533     case TextAreaName:            return String(textarea.name());
    1534     case TextAreaReadOnly:        return Boolean(textarea.readOnly());
    1535     case TextAreaRows:            return Number(textarea.rows());
    1536     case TextAreaSelectionStart:  return Number(textarea.selectionStart());
    1537     case TextAreaSelectionEnd:    return Number(textarea.selectionEnd());
    1538     case TextAreaTabIndex:        return Number(textarea.tabIndex());
    1539     case TextAreaType:            return String(textarea.type());
    1540     case TextAreaValue:           return String(textarea.value());
    1541     }
    1542   }
    1543   break;
    1544   case ID_BUTTON: {
    1545     HTMLButtonElementImpl &button = static_cast<HTMLButtonElementImpl &>(element);
    1546     switch (token) {
    1547     case ButtonForm:            return getDOMNode(exec,button.form()); // type HTMLFormElement
    1548     case ButtonAccessKey:       return String(button.accessKey());
    1549     case ButtonDisabled:        return Boolean(button.disabled());
    1550     case ButtonName:            return String(button.name());
    1551     case ButtonTabIndex:        return Number(button.tabIndex());
    1552     case ButtonType:            return String(button.type());
    1553     case ButtonValue:           return String(button.value());
    1554     }
    1555   }
    1556   break;
    1557   case ID_LABEL: {
    1558     HTMLLabelElementImpl &label = static_cast<HTMLLabelElementImpl &>(element);
    1559     switch (token) {
    1560     case LabelForm:            return getDOMNode(exec,label.form()); // type HTMLFormElement
    1561     case LabelAccessKey:       return String(label.accessKey());
    1562     case LabelHtmlFor:         return String(label.htmlFor());
    1563     }
    1564   }
    1565   break;
    1566   case ID_FIELDSET: {
    1567     HTMLFieldSetElementImpl &fieldSet = static_cast<HTMLFieldSetElementImpl &>(element);
    1568     switch (token) {
    1569     case FieldSetForm:            return getDOMNode(exec,fieldSet.form()); // type HTMLFormElement
    1570     }
    1571   }
    1572   break;
    1573   case ID_LEGEND: {
    1574     HTMLLegendElementImpl &legend = static_cast<HTMLLegendElementImpl &>(element);
    1575     switch (token) {
    1576     case LegendForm:            return getDOMNode(exec,legend.form()); // type HTMLFormElement
    1577     case LegendAccessKey:       return String(legend.accessKey());
    1578     case LegendAlign:           return String(legend.align());
    1579     }
    1580   }
    1581   break;
    1582   case ID_UL: {
    1583     HTMLUListElementImpl &uList = static_cast<HTMLUListElementImpl &>(element);
    1584     switch (token) {
    1585     case UListCompact:         return Boolean(uList.compact());
    1586     case UListType:            return String(uList.type());
    1587     }
    1588   }
    1589   break;
    1590   case ID_OL: {
    1591     HTMLOListElementImpl &oList = static_cast<HTMLOListElementImpl &>(element);
    1592     switch (token) {
    1593     case OListCompact:         return Boolean(oList.compact());
    1594     case OListStart:           return Number(oList.start());
    1595     case OListType:            return String(oList.type());
    1596     }
    1597   }
    1598   break;
    1599   case ID_DL: {
    1600     HTMLDListElementImpl &dList = static_cast<HTMLDListElementImpl &>(element);
    1601     switch (token) {
    1602     case DListCompact:         return Boolean(dList.compact());
    1603     }
    1604   }
    1605   break;
    1606   case ID_DIR: {
    1607     HTMLDirectoryElementImpl &directory = static_cast<HTMLDirectoryElementImpl &>(element);
    1608     switch (token) {
    1609     case DirectoryCompact:         return Boolean(directory.compact());
    1610     }
    1611   }
    1612   break;
    1613   case ID_MENU: {
    1614     HTMLMenuElementImpl &menu = static_cast<HTMLMenuElementImpl &>(element);
    1615     switch (token) {
    1616     case MenuCompact:         return Boolean(menu.compact());
    1617     }
    1618   }
    1619   break;
    1620   case ID_LI: {
    1621     HTMLLIElementImpl &li = static_cast<HTMLLIElementImpl &>(element);
    1622     switch (token) {
    1623     case LIType:            return String(li.type());
    1624     case LIValue:           return Number(li.value());
    1625     }
    1626   }
    1627   break;
    1628   case ID_DIV: {
    1629     HTMLDivElementImpl &div = static_cast<HTMLDivElementImpl &>(element);
    1630     switch (token) {
    1631     case DivAlign:           return String(div.align());
    1632     }
    1633   }
    1634   break;
    1635   case ID_P: {
    1636     HTMLParagraphElementImpl &paragraph = static_cast<HTMLParagraphElementImpl &>(element);
    1637     switch (token) {
    1638     case ParagraphAlign:           return String(paragraph.align());
    1639     }
    1640   }
    1641   break;
    1642   case ID_H1:
    1643   case ID_H2:
    1644   case ID_H3:
    1645   case ID_H4:
    1646   case ID_H5:
    1647   case ID_H6: {
    1648     HTMLHeadingElementImpl &heading = static_cast<HTMLHeadingElementImpl &>(element);
    1649     switch (token) {
    1650     case HeadingAlign:           return String(heading.align());
    1651     }
    1652   }
    1653   break;
    1654   case ID_BLOCKQUOTE: {
    1655     HTMLBlockquoteElementImpl &blockquote = static_cast<HTMLBlockquoteElementImpl &>(element);
    1656     switch (token) {
    1657     case BlockQuoteCite:            return String(blockquote.cite());
    1658     }
    1659   }
    1660   case ID_Q: {
    1661     HTMLQuoteElementImpl &quote = static_cast<HTMLQuoteElementImpl &>(element);
    1662     switch (token) {
    1663     case QuoteCite:            return String(quote.cite());
    1664     }
    1665   }
    1666   case ID_PRE: {
    1667     HTMLPreElementImpl &pre = static_cast<HTMLPreElementImpl &>(element);
    1668     switch (token) {
    1669     case PreWidth:           return Number(pre.width());
    1670     }
    1671   }
    1672   break;
    1673   case ID_BR: {
    1674     HTMLBRElementImpl &br = static_cast<HTMLBRElementImpl &>(element);
    1675     switch (token) {
    1676     case BRClear:           return String(br.clear());
    1677     }
    1678   }
    1679   break;
    1680   case ID_BASEFONT: {
    1681     HTMLBaseFontElementImpl &baseFont = static_cast<HTMLBaseFontElementImpl &>(element);
    1682     switch (token) {
    1683     case BaseFontColor:           return String(baseFont.color());
    1684     case BaseFontFace:            return String(baseFont.face());
    1685     case BaseFontSize:            return String(baseFont.size());
    1686     }
    1687   }
    1688   break;
    1689   case ID_FONT: {
    1690     HTMLFontElementImpl &font = static_cast<HTMLFontElementImpl &>(element);
    1691     switch (token) {
    1692     case FontColor:           return String(font.color());
    1693     case FontFace:            return String(font.face());
    1694     case FontSize:            return String(font.size());
    1695     }
    1696   }
    1697   break;
    1698   case ID_HR: {
    1699     HTMLHRElementImpl &hr = static_cast<HTMLHRElementImpl &>(element);
    1700     switch (token) {
    1701     case HRAlign:           return String(hr.align());
    1702     case HRNoShade:         return Boolean(hr.noShade());
    1703     case HRSize:            return String(hr.size());
    1704     case HRWidth:           return String(hr.width());
    1705     }
    1706   }
    1707   break;
    1708   case ID_INS:
    1709   case ID_DEL: {
    1710     HTMLModElementImpl &mod = static_cast<HTMLModElementImpl &>(element);
    1711     switch (token) {
    1712     case ModCite:            return String(mod.cite());
    1713     case ModDateTime:        return String(mod.dateTime());
    1714     }
    1715   }
    1716   break;
    1717   case ID_A: {
    1718     HTMLAnchorElementImpl &anchor = static_cast<HTMLAnchorElementImpl &>(element);
    1719     switch (token) {
    1720     case AnchorAccessKey:       return String(anchor.accessKey());
    1721     case AnchorCharset:         return String(anchor.charset());
    1722     case AnchorCoords:          return String(anchor.coords());
    1723     case AnchorHref:            return String(anchor.href());
    1724     case AnchorHrefLang:        return String(anchor.hreflang());
    1725     case AnchorHash:            return String('#'+KURL(anchor.href().string()).ref());
    1726     case AnchorHost:            return String(KURL(anchor.href().string()).host());
    1727     case AnchorHostname: {
    1728       KURL url(anchor.href().string());
    1729       kdDebug(6070) << "anchor::hostname uses:" <<url.url()<<endl;
    1730       if (url.port()==0)
    1731         return String(url.host());
    1732       else
    1733         return String(url.host() + ":" + QString::number(url.port()));
    1734     }
    1735     case AnchorPathName:        return String(KURL(anchor.href().string()).path());
    1736     case AnchorPort:            return String(QString::number(KURL(anchor.href().string()).port()));
    1737     case AnchorProtocol:        return String(KURL(anchor.href().string()).protocol()+":");
    1738     case AnchorSearch:          return String(KURL(anchor.href().string()).query());
    1739     case AnchorName:            return String(anchor.name());
    1740     case AnchorRel:             return String(anchor.rel());
    1741     case AnchorRev:             return String(anchor.rev());
    1742     case AnchorShape:           return String(anchor.shape());
    1743     case AnchorTabIndex:        return Number(anchor.tabIndex());
    1744     case AnchorTarget:          return String(anchor.target());
    1745     case AnchorType:            return String(anchor.type());
    1746     case AnchorText:
    1747       if (DocumentImpl* doc = anchor.getDocument())
    1748         doc->updateLayoutIgnorePendingStylesheets();
    1749       return String(anchor.innerText());
    1750     }
    1751   }
    1752   break;
    1753   case ID_IMG: {
    1754     HTMLImageElementImpl &image = static_cast<HTMLImageElementImpl &>(element);
    1755     switch (token) {
    1756     case ImageName:            return String(image.name());
    1757     case ImageAlign:           return String(image.align());
    1758     case ImageAlt:             return String(image.alt());
    1759     case ImageBorder:          return Number(image.border());
    1760     case ImageHeight:          return Number(image.height(true));
    1761     case ImageHspace:          return Number(image.hspace());
    1762     case ImageIsMap:           return Boolean(image.isMap());
    1763     case ImageLongDesc:        return String(image.longDesc());
    1764     case ImageSrc:             return String(image.src());
    1765     case ImageUseMap:          return String(image.useMap());
    1766     case ImageVspace:          return Number(image.vspace());
    1767     case ImageWidth:           return Number(image.width(true));
    1768     case ImageX:               return Number(image.x());
    1769     case ImageY:               return Number(image.y());
    1770     }
    1771   }
    1772   break;
    1773   case ID_OBJECT: {
    1774     HTMLObjectElementImpl &object = static_cast<HTMLObjectElementImpl &>(element);
    1775     switch (token) {
    1776     case ObjectForm:            return getDOMNode(exec,object.form()); // type HTMLFormElement
    1777     case ObjectCode:            return String(object.code());
    1778     case ObjectAlign:           return String(object.align());
    1779     case ObjectArchive:         return String(object.archive());
    1780     case ObjectBorder:          return String(object.border());
    1781     case ObjectCodeBase:        return String(object.codeBase());
    1782     case ObjectCodeType:        return String(object.codeType());
    1783     case ObjectContentDocument: return checkNodeSecurity(exec,object.contentDocument()) ?
    1784                                        getDOMNode(exec, object.contentDocument()) : Undefined();
    1785     case ObjectData:            return String(object.data());
    1786     case ObjectDeclare:         return Boolean(object.declare());
    1787     case ObjectHeight:          return String(object.height());
    1788     case ObjectHspace:          return String(object.hspace());
    1789     case ObjectName:            return String(object.name());
    1790     case ObjectStandby:         return String(object.standby());
    1791     case ObjectTabIndex:        return Number(object.tabIndex());
    1792     case ObjectType:            return String(object.type());
    1793     case ObjectUseMap:          return String(object.useMap());
    1794     case ObjectVspace:          return String(object.vspace());
    1795     case ObjectWidth:           return String(object.width());
    1796     }
    1797   }
    1798   break;
    1799   case ID_PARAM: {
    1800     HTMLParamElementImpl &param = static_cast<HTMLParamElementImpl &>(element);
    1801     switch (token) {
    1802     case ParamName:            return String(param.name());
    1803     case ParamType:            return String(param.type());
    1804     case ParamValue:           return String(param.value());
    1805     case ParamValueType:       return String(param.valueType());
    1806     }
    1807   }
    1808   break;
    1809   case ID_APPLET: {
    1810     HTMLAppletElementImpl &applet = static_cast<HTMLAppletElementImpl &>(element);
    1811     switch (token) {
    1812     case AppletAlign:           return String(applet.align());
    1813     case AppletAlt:             return String(applet.alt());
    1814     case AppletArchive:         return String(applet.archive());
    1815     case AppletCode:            return String(applet.code());
    1816     case AppletCodeBase:        return String(applet.codeBase());
    1817     case AppletHeight:          return String(applet.height());
    1818     case AppletHspace:          return String(applet.hspace());
    1819     case AppletName:            return String(applet.name());
    1820     case AppletObject:          return String(applet.object());
    1821     case AppletVspace:          return String(applet.vspace());
    1822     case AppletWidth:           return String(applet.width());
    1823     }
    1824   }
    1825   break;
    1826   case ID_MAP: {
    1827     HTMLMapElementImpl &map = static_cast<HTMLMapElementImpl &>(element);
    1828     switch (token) {
    1829     case MapAreas:           return getHTMLCollection(exec, map.areas().get()); // type HTMLCollection
    1830     case MapName:            return String(map.name());
    1831     }
    1832   }
    1833   break;
    1834   case ID_AREA: {
    1835     HTMLAreaElementImpl &area = static_cast<HTMLAreaElementImpl &>(element);
    1836     switch (token) {
    1837     case AreaAccessKey:       return String(area.accessKey());
    1838     case AreaAlt:             return String(area.alt());
    1839     case AreaCoords:          return String(area.coords());
    1840     case AreaHref:            return String(area.href());
    1841     case AreaHash:            return String('#'+KURL(area.href().string()).ref());
    1842     case AreaHost:            return String(KURL(area.href().string()).host());
    1843     case AreaHostName: {
    1844       KURL url(area.href().string());
    1845       kdDebug(6070) << "link::hostname uses:" <<url.url()<<endl;
    1846       if (url.port()==0)
    1847         return String(url.host());
    1848       else
    1849         return String(url.host() + ":" + QString::number(url.port()));
    1850     }
    1851     case AreaPathName:        return String(KURL(area.href().string()).path());
    1852     case AreaPort:            return String(QString::number(KURL(area.href().string()).port()));
    1853     case AreaProtocol:        return String(KURL(area.href().string()).protocol()+":");
    1854     case AreaSearch:          return String(KURL(area.href().string()).query());
    1855     case AreaNoHref:          return Boolean(area.noHref());
    1856     case AreaShape:           return String(area.shape());
    1857     case AreaTabIndex:        return Number(area.tabIndex());
    1858     case AreaTarget:          return String(area.target());
    1859     }
    1860   }
    1861   break;
    1862   case ID_SCRIPT: {
    1863     HTMLScriptElementImpl &script = static_cast<HTMLScriptElementImpl &>(element);
    1864     switch (token) {
    1865     case ScriptText:            return String(script.text());
    1866     case ScriptHtmlFor:         return String(script.htmlFor());
    1867     case ScriptEvent:           return String(script.event());
    1868     case ScriptCharset:         return String(script.charset());
    1869     case ScriptDefer:           return Boolean(script.defer());
    1870     case ScriptSrc:             return String(script.src());
    1871     case ScriptType:            return String(script.type());
    1872     }
    1873   }
    1874   break;
    1875   case ID_TABLE: {
    1876     HTMLTableElementImpl &table = static_cast<HTMLTableElementImpl &>(element);
    1877     switch (token) {
    1878     case TableCaption:         return getDOMNode(exec,table.caption()); // type HTMLTableCaptionElement
    1879     case TableTHead:           return getDOMNode(exec,table.tHead()); // type HTMLTableSectionElement
    1880     case TableTFoot:           return getDOMNode(exec,table.tFoot()); // type HTMLTableSectionElement
    1881     case TableRows:            return getHTMLCollection(exec, table.rows().get()); // type HTMLCollection
    1882     case TableTBodies:         return getHTMLCollection(exec, table.tBodies().get()); // type HTMLCollection
    1883     case TableAlign:           return String(table.align());
    1884     case TableBgColor:         return String(table.bgColor());
    1885     case TableBorder:          return String(table.border());
    1886     case TableCellPadding:     return String(table.cellPadding());
    1887     case TableCellSpacing:     return String(table.cellSpacing());
    1888     case TableFrame:           return String(table.frame());
    1889     case TableRules:           return String(table.rules());
    1890     case TableSummary:         return String(table.summary());
    1891     case TableWidth:           return String(table.width());
    1892     }
    1893   }
    1894   break;
    1895   case ID_CAPTION: {
    1896     HTMLTableCaptionElementImpl &tableCaption = static_cast<HTMLTableCaptionElementImpl &>(element);
    1897     switch (token) {
    1898     case TableCaptionAlign:       return String(tableCaption.align());
    1899     }
    1900   }
    1901   break;
    1902   case ID_COL: {
    1903     HTMLTableColElementImpl &tableCol = static_cast<HTMLTableColElementImpl &>(element);
    1904     switch (token) {
    1905     case TableColAlign:           return String(tableCol.align());
    1906     case TableColCh:              return String(tableCol.ch());
    1907     case TableColChOff:           return String(tableCol.chOff());
    1908     case TableColSpan:            return Number(tableCol.span());
    1909     case TableColVAlign:          return String(tableCol.vAlign());
    1910     case TableColWidth:           return String(tableCol.width());
    1911     }
    1912   }
    1913   break;
    1914   case ID_THEAD:
    1915   case ID_TBODY:
    1916   case ID_TFOOT: {
    1917     HTMLTableSectionElementImpl &tableSection = static_cast<HTMLTableSectionElementImpl &>(element);
    1918     switch (token) {
    1919     case TableSectionAlign:           return String(tableSection.align());
    1920     case TableSectionCh:              return String(tableSection.ch());
    1921     case TableSectionChOff:           return String(tableSection.chOff());
    1922     case TableSectionVAlign:          return String(tableSection.vAlign());
    1923     case TableSectionRows:            return getHTMLCollection(exec, tableSection.rows().get()); // type HTMLCollection
    1924     }
    1925   }
    1926   break;
    1927   case ID_TR: {
    1928    HTMLTableRowElementImpl &tableRow = static_cast<HTMLTableRowElementImpl &>(element);
    1929    switch (token) {
    1930    case TableRowRowIndex:        return Number(tableRow.rowIndex());
    1931    case TableRowSectionRowIndex: return Number(tableRow.sectionRowIndex());
    1932    case TableRowCells:           return getHTMLCollection(exec, tableRow.cells().get()); // type HTMLCollection
    1933    case TableRowAlign:           return String(tableRow.align());
    1934    case TableRowBgColor:         return String(tableRow.bgColor());
    1935    case TableRowCh:              return String(tableRow.ch());
    1936    case TableRowChOff:           return String(tableRow.chOff());
    1937    case TableRowVAlign:          return String(tableRow.vAlign());
    1938    }
    1939   }
    1940   break;
    1941   case ID_TH:
    1942   case ID_TD: {
    1943     HTMLTableCellElementImpl &tableCell = static_cast<HTMLTableCellElementImpl &>(element);
    1944     switch (token) {
    1945     case TableCellCellIndex:       return Number(tableCell.cellIndex());
    1946     case TableCellAbbr:            return String(tableCell.abbr());
    1947     case TableCellAlign:           return String(tableCell.align());
    1948     case TableCellAxis:            return String(tableCell.axis());
    1949     case TableCellBgColor:         return String(tableCell.bgColor());
    1950     case TableCellCh:              return String(tableCell.ch());
    1951     case TableCellChOff:           return String(tableCell.chOff());
    1952     case TableCellColSpan:         return Number(tableCell.colSpan());
    1953     case TableCellHeaders:         return String(tableCell.headers());
    1954     case TableCellHeight:          return String(tableCell.height());
    1955     case TableCellNoWrap:          return Boolean(tableCell.noWrap());
    1956     case TableCellRowSpan:         return Number(tableCell.rowSpan());
    1957     case TableCellScope:           return String(tableCell.scope());
    1958     case TableCellVAlign:          return String(tableCell.vAlign());
    1959     case TableCellWidth:           return String(tableCell.width());
    1960     }
    1961   }
    1962   break;
    1963   case ID_FRAMESET: {
    1964     HTMLFrameSetElementImpl &frameSet = static_cast<HTMLFrameSetElementImpl &>(element);
    1965     switch (token) {
    1966     case FrameSetCols:            return String(frameSet.cols());
    1967     case FrameSetRows:            return String(frameSet.rows());
    1968     }
    1969   }
    1970   break;
    1971   case ID_FRAME: {
    1972     HTMLFrameElementImpl &frameElement = static_cast<HTMLFrameElementImpl &>(element);
    1973     switch (token) {
    1974     case FrameContentDocument: return checkNodeSecurity(exec,frameElement.contentDocument()) ?
    1975                                       getDOMNode(exec, frameElement.contentDocument()) : Undefined();
    1976     case FrameContentWindow:   return checkNodeSecurity(exec,frameElement.contentDocument())
    1977                                     ? Window::retrieve(frameElement.contentPart())
    1978                                     : Undefined();
    1979     case FrameFrameBorder:     return String(frameElement.frameBorder());
    1980     case FrameLongDesc:        return String(frameElement.longDesc());
    1981     case FrameMarginHeight:    return String(frameElement.marginHeight());
    1982     case FrameMarginWidth:     return String(frameElement.marginWidth());
    1983     case FrameName:            return String(frameElement.name());
    1984     case FrameNoResize:        return Boolean(frameElement.noResize());
    1985     case FrameScrolling:       return String(frameElement.scrolling());
    1986     case FrameSrc:
    1987     case FrameLocation:        return String(frameElement.src());
    1988     }
    1989   }
    1990   break;
    1991   case ID_IFRAME: {
    1992     HTMLIFrameElementImpl &iFrame = static_cast<HTMLIFrameElementImpl &>(element);
    1993     switch (token) {
    1994     case IFrameAlign:                return String(iFrame.align());
    1995       // ### security check ?
    1996     case IFrameDocument: // non-standard, mapped to contentDocument
    1997     case IFrameContentDocument: return checkNodeSecurity(exec,iFrame.contentDocument()) ?
    1998                                   getDOMNode(exec, iFrame.contentDocument()) : Undefined();
    1999     case IFrameContentWindow:   return checkNodeSecurity(exec,iFrame.contentDocument())
    2000                                     ? Window::retrieve(iFrame.contentPart())
    2001                                     : Undefined();
    2002     case IFrameFrameBorder:     return String(iFrame.frameBorder());
    2003     case IFrameHeight:          return String(iFrame.height());
    2004     case IFrameLongDesc:        return String(iFrame.longDesc());
    2005     case IFrameMarginHeight:    return String(iFrame.marginHeight());
    2006     case IFrameMarginWidth:     return String(iFrame.marginWidth());
    2007     case IFrameName:            return String(iFrame.name());
    2008     case IFrameScrolling:       return String(iFrame.scrolling());
    2009     case IFrameSrc:             return String(iFrame.src());
    2010     case IFrameWidth:           return String(iFrame.width());
    2011     }
    2012     break;
    2013   }
    2014   } // xemacs (or arnt) could be a bit smarter when it comes to indenting switch()es ;)
    2015   // its not arnt to blame - its the original Stroustrup style we like :) (Dirk)
    2016 
    2017   // generic properties
    2018   switch (token) {
    2019   case ElementId:
    2020       // iht.com relies on this value being "" when no id is present.  Other browsers do this as well.
    2021       // So we use String() instead of String() here.
    2022     return String(element.idDOM());
    2023   case ElementTitle:
    2024     return String(element.title());
    2025   case ElementLang:
    2026     return String(element.lang());
    2027   case ElementDir:
    2028     return String(element.dir());
    2029   case ElementClassName:
    2030     return String(element.className());
    2031   case ElementInnerHTML:
    2032     return String(element.innerHTML());
    2033   case ElementInnerText:
    2034     if (DocumentImpl* doc = impl()->getDocument())
    2035       doc->updateLayoutIgnorePendingStylesheets();
    2036     return String(element.innerText());
    2037   case ElementOuterHTML:
    2038     return String(element.outerHTML());
    2039   case ElementOuterText:
    2040     return String(element.outerText());
    2041   case ElementDocument:
    2042     return getDOMNode(exec,element.ownerDocument());
    2043   case ElementChildren:
    2044     return getHTMLCollection(exec, element.children().get());
    2045   case ElementContentEditable:
    2046     return String(element.contentEditable());
    2047   case ElementIsContentEditable:
    2048     return Boolean(element.isContentEditable());
    2049   // ### what about style? or is this used instead for DOM2 stylesheets?
    2050   }
    2051   kdWarning() << "HTMLElement::getValueProperty unhandled token " << token << endl;
    2052   return Undefined();
     1587    if (input.canHaveSelection())
     1588        return Number(input.selectionEnd());
     1589    return Undefined();
     1590}
     1591
     1592Value HTMLElement::inputGetter(ExecState* exec, int token) const
     1593{
     1594    HTMLInputElementImpl& input = *static_cast<HTMLInputElementImpl*>(impl());
     1595    switch (token) {
     1596        case InputDefaultValue:    return String(input.defaultValue());
     1597        case InputDefaultChecked:  return Boolean(input.defaultChecked());
     1598        case InputForm:            return getDOMNode(exec,input.form()); // type HTMLFormElement
     1599        case InputAccept:          return String(input.accept());
     1600        case InputAccessKey:       return String(input.accessKey());
     1601        case InputAlign:           return String(input.align());
     1602        case InputAlt:             return String(input.alt());
     1603        case InputChecked:         return Boolean(input.checked());
     1604        case InputDisabled:        return Boolean(input.disabled());
     1605        case InputMaxLength:       return Number(input.maxLength());
     1606        case InputName:            return String(input.name());
     1607        case InputReadOnly:        return Boolean(input.readOnly());
     1608        case InputSelectionStart:  return getInputSelectionStart(input);
     1609        case InputSelectionEnd:    return getInputSelectionEnd(input);
     1610        case InputSize:            return String(input.sizeDOM());
     1611        case InputSrc:             return String(input.src());
     1612        case InputTabIndex:        return Number(input.tabIndex());
     1613        case InputType:            return String(input.type());
     1614        case InputUseMap:          return String(input.useMap());
     1615        case InputValue:           return String(input.value());
     1616    }
     1617    return Undefined();
     1618}
     1619
     1620Value HTMLElement::textAreaGetter(ExecState* exec, int token) const
     1621{
     1622    HTMLTextAreaElementImpl& textarea = *static_cast<HTMLTextAreaElementImpl*>(impl());
     1623    switch (token) {
     1624        case TextAreaDefaultValue:    return String(textarea.defaultValue());
     1625        case TextAreaForm:            return getDOMNode(exec,textarea.form()); // type HTMLFormElement
     1626        case TextAreaAccessKey:       return String(textarea.accessKey());
     1627        case TextAreaCols:            return Number(textarea.cols());
     1628        case TextAreaDisabled:        return Boolean(textarea.disabled());
     1629        case TextAreaName:            return String(textarea.name());
     1630        case TextAreaReadOnly:        return Boolean(textarea.readOnly());
     1631        case TextAreaRows:            return Number(textarea.rows());
     1632        case TextAreaSelectionStart:  return Number(textarea.selectionStart());
     1633        case TextAreaSelectionEnd:    return Number(textarea.selectionEnd());
     1634        case TextAreaTabIndex:        return Number(textarea.tabIndex());
     1635        case TextAreaType:            return String(textarea.type());
     1636        case TextAreaValue:           return String(textarea.value());
     1637    }
     1638    return Undefined();
     1639}
     1640
     1641Value HTMLElement::buttonGetter(ExecState* exec, int token) const
     1642{
     1643    HTMLButtonElementImpl& button = *static_cast<HTMLButtonElementImpl*>(impl());
     1644    switch (token) {
     1645        case ButtonForm:            return getDOMNode(exec,button.form()); // type HTMLFormElement
     1646        case ButtonAccessKey:       return String(button.accessKey());
     1647        case ButtonDisabled:        return Boolean(button.disabled());
     1648        case ButtonName:            return String(button.name());
     1649        case ButtonTabIndex:        return Number(button.tabIndex());
     1650        case ButtonType:            return String(button.type());
     1651        case ButtonValue:           return String(button.value());
     1652    }
     1653    return Undefined();
     1654}
     1655
     1656Value HTMLElement::labelGetter(ExecState* exec, int token) const
     1657{
     1658    HTMLLabelElementImpl& label = *static_cast<HTMLLabelElementImpl*>(impl());
     1659    switch (token) {
     1660        case LabelForm:            return getDOMNode(exec,label.form()); // type HTMLFormElement
     1661        case LabelAccessKey:       return String(label.accessKey());
     1662        case LabelHtmlFor:         return String(label.htmlFor());
     1663    }
     1664    return Undefined();
     1665}
     1666
     1667Value HTMLElement::fieldSetGetter(ExecState* exec, int token) const
     1668{
     1669    HTMLFieldSetElementImpl& fieldSet = *static_cast<HTMLFieldSetElementImpl*>(impl());
     1670    if (token == FieldSetForm)
     1671        return getDOMNode(exec,fieldSet.form()); // type HTMLFormElement
     1672    return Undefined();
     1673}
     1674
     1675Value HTMLElement::legendGetter(ExecState* exec, int token) const
     1676{
     1677    HTMLLegendElementImpl& legend = *static_cast<HTMLLegendElementImpl*>(impl());
     1678    switch (token) {
     1679        case LegendForm:            return getDOMNode(exec,legend.form()); // type HTMLFormElement
     1680        case LegendAccessKey:       return String(legend.accessKey());
     1681        case LegendAlign:           return String(legend.align());
     1682    }
     1683    return Undefined();
     1684}
     1685
     1686Value HTMLElement::uListGetter(ExecState* exec, int token) const
     1687{
     1688    HTMLUListElementImpl& uList = *static_cast<HTMLUListElementImpl*>(impl());
     1689    switch (token) {
     1690        case UListCompact:         return Boolean(uList.compact());
     1691        case UListType:            return String(uList.type());
     1692    }
     1693    return Undefined();
     1694}
     1695
     1696Value HTMLElement::oListGetter(ExecState* exec, int token) const
     1697{
     1698    HTMLOListElementImpl& oList = *static_cast<HTMLOListElementImpl*>(impl());
     1699    switch (token) {
     1700        case OListCompact:         return Boolean(oList.compact());
     1701        case OListStart:           return Number(oList.start());
     1702        case OListType:            return String(oList.type());
     1703    }
     1704    return Undefined();
     1705}
     1706
     1707Value HTMLElement::dListGetter(ExecState* exec, int token) const
     1708{
     1709    HTMLDListElementImpl& dList = *static_cast<HTMLDListElementImpl*>(impl());
     1710    if (token == DListCompact)
     1711        return Boolean(dList.compact());
     1712    return Undefined();
     1713}
     1714
     1715Value HTMLElement::dirGetter(ExecState* exec, int token) const
     1716{
     1717    HTMLDirectoryElementImpl& dir = *static_cast<HTMLDirectoryElementImpl*>(impl());
     1718    if (token == DirectoryCompact)
     1719        return Boolean(dir.compact());
     1720    return Undefined();
     1721}
     1722
     1723Value HTMLElement::menuGetter(ExecState* exec, int token) const
     1724{
     1725    HTMLMenuElementImpl& menu = *static_cast<HTMLMenuElementImpl*>(impl());
     1726    if (token == MenuCompact)
     1727        return Boolean(menu.compact());
     1728    return Undefined();
     1729}
     1730
     1731Value HTMLElement::liGetter(ExecState* exec, int token) const
     1732{
     1733    HTMLLIElementImpl& li = *static_cast<HTMLLIElementImpl*>(impl());
     1734    switch (token) {
     1735        case LIType:            return String(li.type());
     1736        case LIValue:           return Number(li.value());
     1737    }
     1738    return Undefined();
     1739}
     1740
     1741Value HTMLElement::divGetter(ExecState* exec, int token) const
     1742{
     1743    HTMLDivElementImpl& div = *static_cast<HTMLDivElementImpl*>(impl());
     1744    if (token == DivAlign)
     1745        return String(div.align());
     1746    return Undefined();
     1747}
     1748
     1749Value HTMLElement::paragraphGetter(ExecState* exec, int token) const
     1750{
     1751    HTMLParagraphElementImpl& p = *static_cast<HTMLParagraphElementImpl*>(impl());
     1752    if (token == ParagraphAlign)
     1753        return String(p.align());
     1754    return Undefined();
     1755}
     1756
     1757Value HTMLElement::headingGetter(ExecState* exec, int token) const
     1758{
     1759    HTMLHeadingElementImpl& h = *static_cast<HTMLHeadingElementImpl*>(impl());
     1760    if (token == HeadingAlign)
     1761        return String(h.align());
     1762    return Undefined();
     1763}
     1764
     1765Value HTMLElement::blockQuoteGetter(ExecState* exec, int token) const
     1766{
     1767    HTMLBlockquoteElementImpl& blockQuote = *static_cast<HTMLBlockquoteElementImpl*>(impl());
     1768    if (token == BlockQuoteCite)
     1769        return String(blockQuote.cite());
     1770    return Undefined();
     1771}
     1772
     1773Value HTMLElement::quoteGetter(ExecState* exec, int token) const
     1774{
     1775    HTMLQuoteElementImpl& quote = *static_cast<HTMLQuoteElementImpl*>(impl());
     1776    if (token == QuoteCite)
     1777        return String(quote.cite());
     1778    return Undefined();
     1779}
     1780
     1781Value HTMLElement::preGetter(ExecState* exec, int token) const
     1782{
     1783    // FIXME: Add support for 'wrap' when white-space: pre-wrap is implemented.
     1784    HTMLPreElementImpl& pre = *static_cast<HTMLPreElementImpl*>(impl());
     1785    if (token == PreWidth)
     1786        return Number(pre.width());
     1787    return Undefined();
     1788}
     1789
     1790Value HTMLElement::brGetter(ExecState* exec, int token) const
     1791{
     1792    HTMLBRElementImpl& br = *static_cast<HTMLBRElementImpl*>(impl());
     1793    if (token == BRClear)
     1794        return String(br.clear());
     1795    return Undefined();
     1796}
     1797
     1798Value HTMLElement::baseFontGetter(ExecState* exec, int token) const
     1799{
     1800    HTMLBaseFontElementImpl& baseFont = *static_cast<HTMLBaseFontElementImpl*>(impl());
     1801    switch (token) {
     1802        case BaseFontColor:           return String(baseFont.color());
     1803        case BaseFontFace:            return String(baseFont.face());
     1804        case BaseFontSize:            return String(baseFont.size());
     1805    }
     1806    return Undefined();
     1807}
     1808
     1809Value HTMLElement::fontGetter(ExecState* exec, int token) const
     1810{
     1811    HTMLFontElementImpl& font = *static_cast<HTMLFontElementImpl*>(impl());
     1812    switch (token) {
     1813        case FontColor:           return String(font.color());
     1814        case FontFace:            return String(font.face());
     1815        case FontSize:            return String(font.size());
     1816    }
     1817    return Undefined();
     1818}
     1819
     1820Value HTMLElement::hrGetter(ExecState* exec, int token) const
     1821{
     1822    HTMLHRElementImpl& hr = *static_cast<HTMLHRElementImpl*>(impl());
     1823    switch (token) {
     1824        case HRAlign:           return String(hr.align());
     1825        case HRNoShade:         return Boolean(hr.noShade());
     1826        case HRSize:            return String(hr.size());
     1827        case HRWidth:           return String(hr.width());
     1828    }
     1829    return Undefined();
     1830}
     1831
     1832Value HTMLElement::modGetter(ExecState* exec, int token) const
     1833{
     1834    HTMLModElementImpl& mod = *static_cast<HTMLModElementImpl*>(impl());
     1835    switch (token) {
     1836        case ModCite:            return String(mod.cite());
     1837        case ModDateTime:        return String(mod.dateTime());
     1838    }
     1839    return Undefined();
     1840}
     1841
     1842Value HTMLElement::anchorGetter(ExecState* exec, int token) const
     1843{
     1844    HTMLAnchorElementImpl& anchor = *static_cast<HTMLAnchorElementImpl*>(impl());
     1845    switch (token) {
     1846        case AnchorAccessKey:       return String(anchor.accessKey());
     1847        case AnchorCharset:         return String(anchor.charset());
     1848        case AnchorCoords:          return String(anchor.coords());
     1849        case AnchorHref:            return String(anchor.href());
     1850        case AnchorHrefLang:        return String(anchor.hreflang());
     1851        case AnchorHash:            return String('#'+KURL(anchor.href().string()).ref());
     1852        case AnchorHost:            return String(KURL(anchor.href().string()).host());
     1853        case AnchorHostname: {
     1854            KURL url(anchor.href().string());
     1855            kdDebug(6070) << "anchor::hostname uses:" <<url.url()<<endl;
     1856            if (url.port()==0)
     1857                return String(url.host());
     1858            else
     1859                return String(url.host() + ":" + QString::number(url.port()));
     1860        }
     1861        case AnchorPathName:        return String(KURL(anchor.href().string()).path());
     1862        case AnchorPort:            return String(QString::number(KURL(anchor.href().string()).port()));
     1863        case AnchorProtocol:        return String(KURL(anchor.href().string()).protocol()+":");
     1864        case AnchorSearch:          return String(KURL(anchor.href().string()).query());
     1865        case AnchorName:            return String(anchor.name());
     1866        case AnchorRel:             return String(anchor.rel());
     1867        case AnchorRev:             return String(anchor.rev());
     1868        case AnchorShape:           return String(anchor.shape());
     1869        case AnchorTabIndex:        return Number(anchor.tabIndex());
     1870        case AnchorTarget:          return String(anchor.target());
     1871        case AnchorType:            return String(anchor.type());
     1872        case AnchorText:
     1873            if (DocumentImpl* doc = anchor.getDocument())
     1874                doc->updateLayoutIgnorePendingStylesheets();
     1875            return String(anchor.innerText());
     1876    }
     1877    return Undefined();
     1878}
     1879
     1880Value HTMLElement::imageGetter(ExecState* exec, int token) const
     1881{
     1882    HTMLImageElementImpl& image = *static_cast<HTMLImageElementImpl*>(impl());
     1883    switch (token) {
     1884        case ImageName:            return String(image.name());
     1885        case ImageAlign:           return String(image.align());
     1886        case ImageAlt:             return String(image.alt());
     1887        case ImageBorder:          return Number(image.border());
     1888        case ImageHeight:          return Number(image.height(true));
     1889        case ImageHspace:          return Number(image.hspace());
     1890        case ImageIsMap:           return Boolean(image.isMap());
     1891        case ImageLongDesc:        return String(image.longDesc());
     1892        case ImageSrc:             return String(image.src());
     1893        case ImageUseMap:          return String(image.useMap());
     1894        case ImageVspace:          return Number(image.vspace());
     1895        case ImageWidth:           return Number(image.width(true));
     1896        case ImageX:               return Number(image.x());
     1897        case ImageY:               return Number(image.y());
     1898    }
     1899    return Undefined();
     1900}
     1901
     1902Value HTMLElement::objectGetter(ExecState* exec, int token) const
     1903{
     1904    HTMLObjectElementImpl& object = *static_cast<HTMLObjectElementImpl*>(impl());
     1905    switch (token) {
     1906        case ObjectForm:            return getDOMNode(exec,object.form()); // type HTMLFormElement
     1907        case ObjectCode:            return String(object.code());
     1908        case ObjectAlign:           return String(object.align());
     1909        case ObjectArchive:         return String(object.archive());
     1910        case ObjectBorder:          return String(object.border());
     1911        case ObjectCodeBase:        return String(object.codeBase());
     1912        case ObjectCodeType:        return String(object.codeType());
     1913        case ObjectContentDocument: return checkNodeSecurity(exec,object.contentDocument()) ?
     1914                                           getDOMNode(exec, object.contentDocument()) : Undefined();
     1915        case ObjectData:            return String(object.data());
     1916        case ObjectDeclare:         return Boolean(object.declare());
     1917        case ObjectHeight:          return String(object.height());
     1918        case ObjectHspace:          return String(object.hspace());
     1919        case ObjectName:            return String(object.name());
     1920        case ObjectStandby:         return String(object.standby());
     1921        case ObjectTabIndex:        return Number(object.tabIndex());
     1922        case ObjectType:            return String(object.type());
     1923        case ObjectUseMap:          return String(object.useMap());
     1924        case ObjectVspace:          return String(object.vspace());
     1925        case ObjectWidth:           return String(object.width());
     1926    }
     1927    return Undefined();
     1928}
     1929
     1930Value HTMLElement::paramGetter(ExecState* exec, int token) const
     1931{
     1932    HTMLParamElementImpl& param = *static_cast<HTMLParamElementImpl*>(impl());
     1933    switch (token) {
     1934        case ParamName:            return String(param.name());
     1935        case ParamType:            return String(param.type());
     1936        case ParamValue:           return String(param.value());
     1937        case ParamValueType:       return String(param.valueType());
     1938    }
     1939    return Undefined();
     1940}
     1941
     1942Value HTMLElement::appletGetter(ExecState* exec, int token) const
     1943{
     1944    HTMLAppletElementImpl& applet = *static_cast<HTMLAppletElementImpl*>(impl());
     1945    switch (token) {
     1946        case AppletAlign:           return String(applet.align());
     1947        case AppletAlt:             return String(applet.alt());
     1948        case AppletArchive:         return String(applet.archive());
     1949        case AppletCode:            return String(applet.code());
     1950        case AppletCodeBase:        return String(applet.codeBase());
     1951        case AppletHeight:          return String(applet.height());
     1952        case AppletHspace:          return String(applet.hspace());
     1953        case AppletName:            return String(applet.name());
     1954        case AppletObject:          return String(applet.object());
     1955        case AppletVspace:          return String(applet.vspace());
     1956        case AppletWidth:           return String(applet.width());
     1957    }
     1958    return Undefined();
     1959}
     1960
     1961Value HTMLElement::mapGetter(ExecState* exec, int token) const
     1962{
     1963    HTMLMapElementImpl& map = *static_cast<HTMLMapElementImpl*>(impl());
     1964    switch (token) {
     1965        case MapAreas:           return getHTMLCollection(exec, map.areas().get()); // type HTMLCollection
     1966        case MapName:            return String(map.name());
     1967    }
     1968    return Undefined();
     1969}
     1970
     1971Value HTMLElement::areaGetter(ExecState* exec, int token) const
     1972{
     1973    HTMLAreaElementImpl& area = *static_cast<HTMLAreaElementImpl*>(impl());
     1974    switch (token) {
     1975        case AreaAccessKey:       return String(area.accessKey());
     1976        case AreaAlt:             return String(area.alt());
     1977        case AreaCoords:          return String(area.coords());
     1978        case AreaHref:            return String(area.href());
     1979        case AreaHash:            return String('#'+KURL(area.href().string()).ref());
     1980        case AreaHost:            return String(KURL(area.href().string()).host());
     1981        case AreaHostName: {
     1982            KURL url(area.href().string());
     1983            kdDebug(6070) << "link::hostname uses:" <<url.url()<<endl;
     1984            if (url.port()==0)
     1985                return String(url.host());
     1986            else
     1987                return String(url.host() + ":" + QString::number(url.port()));
     1988        }
     1989        case AreaPathName:        return String(KURL(area.href().string()).path());
     1990        case AreaPort:            return String(QString::number(KURL(area.href().string()).port()));
     1991        case AreaProtocol:        return String(KURL(area.href().string()).protocol()+":");
     1992        case AreaSearch:          return String(KURL(area.href().string()).query());
     1993        case AreaNoHref:          return Boolean(area.noHref());
     1994        case AreaShape:           return String(area.shape());
     1995        case AreaTabIndex:        return Number(area.tabIndex());
     1996        case AreaTarget:          return String(area.target());
     1997    }
     1998    return Undefined();
     1999}
     2000
     2001Value HTMLElement::scriptGetter(ExecState* exec, int token) const
     2002{
     2003    HTMLScriptElementImpl& script = *static_cast<HTMLScriptElementImpl*>(impl());
     2004    switch (token) {
     2005        case ScriptText:            return String(script.text());
     2006        case ScriptHtmlFor:         return String(script.htmlFor());
     2007        case ScriptEvent:           return String(script.event());
     2008        case ScriptCharset:         return String(script.charset());
     2009        case ScriptDefer:           return Boolean(script.defer());
     2010        case ScriptSrc:             return String(script.src());
     2011        case ScriptType:            return String(script.type());
     2012    }
     2013    return Undefined();
     2014}
     2015
     2016Value HTMLElement::tableGetter(ExecState* exec, int token) const
     2017{
     2018    HTMLTableElementImpl& table = *static_cast<HTMLTableElementImpl*>(impl());
     2019    switch (token) {
     2020        case TableCaption:         return getDOMNode(exec,table.caption()); // type HTMLTableCaptionElement
     2021        case TableTHead:           return getDOMNode(exec,table.tHead()); // type HTMLTableSectionElement
     2022        case TableTFoot:           return getDOMNode(exec,table.tFoot()); // type HTMLTableSectionElement
     2023        case TableRows:            return getHTMLCollection(exec, table.rows().get()); // type HTMLCollection
     2024        case TableTBodies:         return getHTMLCollection(exec, table.tBodies().get()); // type HTMLCollection
     2025        case TableAlign:           return String(table.align());
     2026        case TableBgColor:         return String(table.bgColor());
     2027        case TableBorder:          return String(table.border());
     2028        case TableCellPadding:     return String(table.cellPadding());
     2029        case TableCellSpacing:     return String(table.cellSpacing());
     2030        case TableFrame:           return String(table.frame());
     2031        case TableRules:           return String(table.rules());
     2032        case TableSummary:         return String(table.summary());
     2033        case TableWidth:           return String(table.width());
     2034    }
     2035    return Undefined();
     2036}
     2037
     2038Value HTMLElement::tableCaptionGetter(ExecState* exec, int token) const
     2039{
     2040    HTMLTableCaptionElementImpl& tableCaption = *static_cast<HTMLTableCaptionElementImpl*>(impl());
     2041    if (token == TableCaptionAlign)
     2042        return String(tableCaption.align());
     2043    return Undefined();
     2044}
     2045
     2046Value HTMLElement::tableColGetter(ExecState* exec, int token) const
     2047{
     2048    HTMLTableColElementImpl& tableCol = *static_cast<HTMLTableColElementImpl*>(impl());
     2049    switch (token) {
     2050        case TableColAlign:           return String(tableCol.align());
     2051        case TableColCh:              return String(tableCol.ch());
     2052        case TableColChOff:           return String(tableCol.chOff());
     2053        case TableColSpan:            return Number(tableCol.span());
     2054        case TableColVAlign:          return String(tableCol.vAlign());
     2055        case TableColWidth:           return String(tableCol.width());
     2056    }
     2057    return Undefined();
     2058}
     2059
     2060Value HTMLElement::tableSectionGetter(ExecState* exec, int token) const
     2061{
     2062    HTMLTableSectionElementImpl& tableSection = *static_cast<HTMLTableSectionElementImpl*>(impl());
     2063    switch (token) {
     2064        case TableSectionAlign:           return String(tableSection.align());
     2065        case TableSectionCh:              return String(tableSection.ch());
     2066        case TableSectionChOff:           return String(tableSection.chOff());
     2067        case TableSectionVAlign:          return String(tableSection.vAlign());
     2068        case TableSectionRows:            return getHTMLCollection(exec, tableSection.rows().get()); // type HTMLCollection
     2069    }
     2070    return Undefined();
     2071}
     2072
     2073Value HTMLElement::tableRowGetter(ExecState* exec, int token) const
     2074{
     2075    HTMLTableRowElementImpl& tableRow = *static_cast<HTMLTableRowElementImpl*>(impl());
     2076    switch (token) {
     2077        case TableRowRowIndex:        return Number(tableRow.rowIndex());
     2078        case TableRowSectionRowIndex: return Number(tableRow.sectionRowIndex());
     2079        case TableRowCells:           return getHTMLCollection(exec, tableRow.cells().get()); // type HTMLCollection
     2080        case TableRowAlign:           return String(tableRow.align());
     2081        case TableRowBgColor:         return String(tableRow.bgColor());
     2082        case TableRowCh:              return String(tableRow.ch());
     2083        case TableRowChOff:           return String(tableRow.chOff());
     2084        case TableRowVAlign:          return String(tableRow.vAlign());
     2085    }
     2086    return Undefined();
     2087}
     2088
     2089Value HTMLElement::tableCellGetter(ExecState* exec, int token) const
     2090{
     2091    HTMLTableCellElementImpl& tableCell = *static_cast<HTMLTableCellElementImpl*>(impl());
     2092    switch (token) {
     2093        case TableCellCellIndex:       return Number(tableCell.cellIndex());
     2094        case TableCellAbbr:            return String(tableCell.abbr());
     2095        case TableCellAlign:           return String(tableCell.align());
     2096        case TableCellAxis:            return String(tableCell.axis());
     2097        case TableCellBgColor:         return String(tableCell.bgColor());
     2098        case TableCellCh:              return String(tableCell.ch());
     2099        case TableCellChOff:           return String(tableCell.chOff());
     2100        case TableCellColSpan:         return Number(tableCell.colSpan());
     2101        case TableCellHeaders:         return String(tableCell.headers());
     2102        case TableCellHeight:          return String(tableCell.height());
     2103        case TableCellNoWrap:          return Boolean(tableCell.noWrap());
     2104        case TableCellRowSpan:         return Number(tableCell.rowSpan());
     2105        case TableCellScope:           return String(tableCell.scope());
     2106        case TableCellVAlign:          return String(tableCell.vAlign());
     2107        case TableCellWidth:           return String(tableCell.width());
     2108    }
     2109    return Undefined();
     2110}
     2111
     2112Value HTMLElement::frameSetGetter(ExecState* exec, int token) const
     2113{
     2114    HTMLFrameSetElementImpl& frameSet = *static_cast<HTMLFrameSetElementImpl*>(impl());
     2115    switch (token) {
     2116        case FrameSetCols:            return String(frameSet.cols());
     2117        case FrameSetRows:            return String(frameSet.rows());
     2118    }
     2119    return Undefined();
     2120}
     2121
     2122Value HTMLElement::frameGetter(ExecState* exec, int token) const
     2123{
     2124    HTMLFrameElementImpl& frameElement = *static_cast<HTMLFrameElementImpl*>(impl());
     2125    switch (token) {
     2126        case FrameContentDocument: return checkNodeSecurity(exec,frameElement.contentDocument()) ?
     2127                                          getDOMNode(exec, frameElement.contentDocument()) : Undefined();
     2128        case FrameContentWindow:   return checkNodeSecurity(exec,frameElement.contentDocument())
     2129                                        ? Window::retrieve(frameElement.contentPart())
     2130                                        : Undefined();
     2131        case FrameFrameBorder:     return String(frameElement.frameBorder());
     2132        case FrameLongDesc:        return String(frameElement.longDesc());
     2133        case FrameMarginHeight:    return String(frameElement.marginHeight());
     2134        case FrameMarginWidth:     return String(frameElement.marginWidth());
     2135        case FrameName:            return String(frameElement.name());
     2136        case FrameNoResize:        return Boolean(frameElement.noResize());
     2137        case FrameScrolling:       return String(frameElement.scrolling());
     2138        case FrameSrc:
     2139        case FrameLocation:        return String(frameElement.src());
     2140    }
     2141    return Undefined();
     2142}
     2143
     2144Value HTMLElement::iFrameGetter(ExecState* exec, int token) const
     2145{
     2146    HTMLIFrameElementImpl& iFrame = *static_cast<HTMLIFrameElementImpl*>(impl());
     2147    switch (token) {
     2148        case IFrameAlign:                return String(iFrame.align());
     2149          // ### security check ?
     2150        case IFrameDocument: // non-standard, mapped to contentDocument
     2151        case IFrameContentDocument: return checkNodeSecurity(exec,iFrame.contentDocument()) ?
     2152                                      getDOMNode(exec, iFrame.contentDocument()) : Undefined();
     2153        case IFrameContentWindow:       return checkNodeSecurity(exec,iFrame.contentDocument())
     2154                                        ? Window::retrieve(iFrame.contentPart())
     2155                                        : Undefined();
     2156        case IFrameFrameBorder:     return String(iFrame.frameBorder());
     2157        case IFrameHeight:          return String(iFrame.height());
     2158        case IFrameLongDesc:        return String(iFrame.longDesc());
     2159        case IFrameMarginHeight:    return String(iFrame.marginHeight());
     2160        case IFrameMarginWidth:     return String(iFrame.marginWidth());
     2161        case IFrameName:            return String(iFrame.name());
     2162        case IFrameScrolling:       return String(iFrame.scrolling());
     2163        case IFrameSrc:             return String(iFrame.src());
     2164        case IFrameWidth:           return String(iFrame.width());
     2165    }
     2166    return Undefined();
     2167}
     2168
     2169Value HTMLElement::marqueeGetter(ExecState* exec, int token) const
     2170{
     2171    // FIXME: Find out what WinIE exposes as properties and implement this.
     2172    return Undefined();
     2173}
     2174
     2175Value HTMLElement::getValueProperty(ExecState *exec, int token) const
     2176{
     2177    // Check our set of generic properties first.
     2178    HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
     2179    switch (token) {
     2180        case ElementId:
     2181        // iht.com relies on this value being "" when no id is present.  Other browsers do this as well.
     2182        // So we use String() instead of String() here.
     2183        return String(element.id());
     2184        case ElementTitle:
     2185            return String(element.title());
     2186        case ElementLang:
     2187            return String(element.lang());
     2188        case ElementDir:
     2189            return String(element.dir());
     2190        case ElementClassName:
     2191            return String(element.className());
     2192        case ElementInnerHTML:
     2193            return String(element.innerHTML());
     2194        case ElementInnerText:
     2195            if (DocumentImpl* doc = impl()->getDocument())
     2196                doc->updateLayoutIgnorePendingStylesheets();
     2197            return String(element.innerText());
     2198        case ElementOuterHTML:
     2199            return String(element.outerHTML());
     2200        case ElementOuterText:
     2201            return String(element.outerText());
     2202        case ElementDocument:
     2203            return getDOMNode(exec,element.ownerDocument());
     2204        case ElementChildren:
     2205            return getHTMLCollection(exec, element.children().get());
     2206        case ElementContentEditable:
     2207            return String(element.contentEditable());
     2208        case ElementIsContentEditable:
     2209            return Boolean(element.isContentEditable());
     2210    }
     2211
     2212    // Now check the properties specific to our element type.
     2213    const Accessors* info = getSetInfo();
     2214    if (info && info->m_getter)
     2215        return (this->*(info->m_getter))(exec, token);
     2216    return Undefined();
    20532217}
    20542218
     
    20562220{
    20572221#ifdef KJS_VERBOSE
    2058   //kdDebug(6070) << "HTMLElement::hasProperty " << propertyName.qstring() << endl;
     2222    //kdDebug(6070) << "HTMLElement::hasProperty " << propertyName.qstring() << endl;
    20592223#endif
    2060   HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
    2061   // First look at dynamic properties - keep this in sync with tryGet
    2062   switch (element.id()) {
    2063     case ID_FORM: {
    2064       HTMLFormElementImpl &form = static_cast<HTMLFormElementImpl &>(element);
    2065       // Check if we're retrieving an element (by index or by name)
    2066       bool ok;
    2067       uint u = propertyName.toULong(&ok);
    2068       if (ok && form.elements()->item(u))
    2069         return true;
    2070       if (form.elements()->namedItem(propertyName.string()))
    2071         return true;
    2072       break;
    2073     }
    2074     case ID_SELECT: {
    2075       HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
    2076       bool ok;
    2077       uint u = propertyName.toULong(&ok);
    2078       if (ok && select.optionsHTMLCollection()->item(u))
    2079         return true;
    2080       break;
    2081     }
    2082     case ID_INPUT: {
    2083       HTMLInputElementImpl &input = static_cast<HTMLInputElementImpl &>(element);
    2084       const HashTable* table = classInfo()->propHashTable;
    2085       const HashEntry* entry = Lookup::findEntry(table, propertyName);
    2086       if (entry) {
    2087         switch(entry->value) {
    2088           case InputSelectionStart:
    2089           case InputSelectionEnd:
    2090           case InputSetSelectionRange:
    2091             return input.canHaveSelection();
    2092           default:
    2093             break;
    2094         }
    2095       }
    2096       break;
    2097     }
    2098     default:
    2099       break;
    2100   }
    2101 
    2102   return DOMElement::hasOwnProperty(exec, propertyName);
     2224    HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
     2225    // First look at dynamic properties - keep this in sync with tryGet
     2226    if (element.hasLocalName(HTMLNames::form())) {
     2227        HTMLFormElementImpl &form = static_cast<HTMLFormElementImpl &>(element);
     2228        // Check if we're retrieving an element (by index or by name)
     2229        bool ok;
     2230        uint u = propertyName.toULong(&ok);
     2231        if (ok && form.elements()->item(u))
     2232            return true;
     2233        if (form.elements()->namedItem(propertyName.string()))
     2234            return true;
     2235    }
     2236    else if (element.hasLocalName(HTMLNames::select())) {
     2237        HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
     2238        bool ok;
     2239        uint u = propertyName.toULong(&ok);
     2240        if (ok && select.optionsHTMLCollection()->item(u))
     2241            return true;
     2242    }
     2243    else if (element.hasLocalName(HTMLNames::input())) {
     2244        HTMLInputElementImpl &input = static_cast<HTMLInputElementImpl &>(element);
     2245        const HashTable* table = classInfo()->propHashTable;
     2246        const HashEntry* entry = Lookup::findEntry(table, propertyName);
     2247        if (entry) {
     2248            switch(entry->value) {
     2249            case InputSelectionStart:
     2250            case InputSelectionEnd:
     2251            case InputSetSelectionRange:
     2252                return input.canHaveSelection();
     2253            default:
     2254                break;
     2255            }
     2256        }
     2257    }
     2258
     2259    return DOMElement::hasOwnProperty(exec, propertyName);
    21032260}
    21042261
    21052262UString KJS::HTMLElement::toString(ExecState *exec) const
    21062263{
    2107   if (impl()->id() == ID_A)
    2108     return UString(static_cast<const HTMLAnchorElementImpl *>(impl())->href());
    2109   else
    2110     return DOMElement::toString(exec);
     2264    if (impl()->hasTagName(HTMLNames::a()))
     2265        return UString(static_cast<const HTMLAnchorElementImpl *>(impl())->href());
     2266    else
     2267        return DOMElement::toString(exec);
    21112268}
    21122269
    21132270static HTMLFormElementImpl *getForm(HTMLElementImpl *element)
    21142271{
    2115   if (element->isGenericFormElement())
    2116     return static_cast<HTMLGenericFormElementImpl *>(element)->form();
    2117 
    2118   switch (element->id()) {
    2119     case ID_LABEL:
    2120       return static_cast<HTMLLabelElementImpl *>(element)->form();
    2121     case ID_OBJECT:
    2122       return static_cast<HTMLObjectElementImpl *>(element)->form();
    2123   }
    2124 
    2125   return 0;
     2272    if (element->isGenericFormElement())
     2273        return static_cast<HTMLGenericFormElementImpl *>(element)->form();
     2274    if (element->hasTagName(HTMLNames::label()))
     2275        return static_cast<HTMLLabelElementImpl *>(element)->form();
     2276    if (element->hasTagName(HTMLNames::object()))
     2277        return static_cast<HTMLObjectElementImpl *>(element)->form();
     2278
     2279    return 0;
    21262280}
    21272281
     
    21432297  else {
    21442298    NodeImpl *form = element->parentNode();
    2145     while (form && form->id() != ID_FORM)
     2299    while (form && !form->hasTagName(HTMLNames::form()))
    21462300      form = form->parentNode();
    21472301   
     
    21632317Value KJS::HTMLElementFunction::tryCall(ExecState *exec, Object &thisObj, const List &args)
    21642318{
    2165   if (!thisObj.inherits(&KJS::HTMLElement::info)) {
    2166     Object err = Error::create(exec,TypeError);
    2167     exec->setException(err);
    2168     return err;
    2169   }
    2170   kdDebug() << "KJS::HTMLElementFunction::tryCall " << endl;
    2171   DOMExceptionTranslator exception(exec);
    2172   HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(static_cast<HTMLElement *>(thisObj.imp())->impl());
    2173 
    2174   switch (element.id()) {
    2175     case ID_FORM: {
    2176       HTMLFormElementImpl &form = static_cast<HTMLFormElementImpl &>(element);
    2177       if (id == KJS::HTMLElement::FormSubmit) {
    2178         form.submit();
    2179         return Undefined();
    2180       }
    2181       else if (id == KJS::HTMLElement::FormReset) {
    2182         form.reset();
    2183         return Undefined();
    2184       }
    2185     }
    2186     break;
    2187     case ID_SELECT: {
    2188       HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
    2189       if (id == KJS::HTMLElement::SelectAdd) {
    2190         select.add(toHTMLElement(args[0]), toHTMLElement(args[1]));
    2191         return Undefined();
    2192       }
    2193       else if (id == KJS::HTMLElement::SelectRemove) {
    2194         select.remove(int(args[0].toNumber(exec)));
    2195         return Undefined();
    2196       }
    2197       else if (id == KJS::HTMLElement::SelectBlur) {
    2198         select.blur();
    2199         return Undefined();
    2200       }
    2201       else if (id == KJS::HTMLElement::SelectFocus) {
    2202         select.focus();
    2203         return Undefined();
    2204       }
    2205     }
    2206     break;
    2207     case ID_INPUT: {
    2208       HTMLInputElementImpl &input = static_cast<HTMLInputElementImpl &>(element);
    2209       if (id == KJS::HTMLElement::InputBlur) {
    2210         input.blur();
    2211         return Undefined();
    2212       }
    2213       else if (id == KJS::HTMLElement::InputFocus) {
    2214         input.focus();
    2215         return Undefined();
    2216       }
    2217       else if (id == KJS::HTMLElement::InputSelect) {
    2218         input.select();
    2219         return Undefined();
    2220       }
    2221       else if (id == KJS::HTMLElement::InputClick) {
    2222         input.click();
    2223         return Undefined();
    2224       }
    2225       else if (id == KJS::HTMLElement::InputSetSelectionRange) {
    2226         input.setSelectionRange(args[0].toInt32(exec), args[1].toInt32(exec));
    2227         return Undefined();
    2228       }
    2229     }
    2230     break;
    2231     case ID_LABEL: {
    2232       HTMLLabelElementImpl &label = static_cast<HTMLLabelElementImpl &>(element);
    2233      
    2234       if (id == KJS::HTMLElement::LabelFocus) {
    2235           label.focus();
    2236           return Undefined();
    2237       }
    2238     }
    2239     break;
    2240     case ID_LEGEND: {
    2241       HTMLLegendElementImpl &legend = static_cast<HTMLLegendElementImpl &>(element);
    2242        
    2243       if (id == KJS::HTMLElement::LegendFocus) {
    2244           legend.focus();
    2245           return Undefined();
    2246       }
    2247     }
    2248     break;
    2249     case ID_BUTTON: {
    2250       HTMLButtonElementImpl &button = static_cast<HTMLButtonElementImpl &>(element);
    2251      
    2252       if (id == KJS::HTMLElement::ButtonBlur) {
    2253         button.blur();
    2254         return Undefined();
    2255       }
    2256       else if (id == KJS::HTMLElement::ButtonFocus) {
    2257         button.focus();
    2258         return Undefined();
    2259       }
    2260     }
    2261     break;
    2262     case ID_TEXTAREA: {
    2263       HTMLTextAreaElementImpl &textarea = static_cast<HTMLTextAreaElementImpl &>(element);
    2264       if (id == KJS::HTMLElement::TextAreaBlur) {
    2265         textarea.blur();
    2266         return Undefined();
    2267       }
    2268       else if (id == KJS::HTMLElement::TextAreaFocus) {
    2269         textarea.focus();
    2270         return Undefined();
    2271       }
    2272       else if (id == KJS::HTMLElement::TextAreaSelect) {
    2273         textarea.select();
    2274         return Undefined();
    2275       }
    2276       else if (id == KJS::HTMLElement::TextAreaSetSelectionRange) {
    2277         textarea.setSelectionRange(args[0].toInt32(exec), args[1].toInt32(exec));
    2278         return Undefined();
    2279       }
    2280     }
    2281     break;
    2282     case ID_A: {
    2283       HTMLAnchorElementImpl &anchor = static_cast<HTMLAnchorElementImpl &>(element);
    2284       if (id == KJS::HTMLElement::AnchorBlur) {
    2285         anchor.blur();
    2286         return Undefined();
    2287       }
    2288       else if (id == KJS::HTMLElement::AnchorFocus) {
    2289         anchor.focus();
    2290         return Undefined();
    2291       }
    2292       else if (id == KJS::HTMLElement::AnchorToString) {
    2293         return String(thisObj.toString(exec));
    2294       }
    2295     }
    2296     break;
    2297     case ID_TABLE: {
    2298       HTMLTableElementImpl &table = static_cast<HTMLTableElementImpl &>(element);
    2299       if (id == KJS::HTMLElement::TableCreateTHead)
    2300         return getDOMNode(exec,table.createTHead());
    2301       else if (id == KJS::HTMLElement::TableDeleteTHead) {
    2302         table.deleteTHead();
    2303         return Undefined();
    2304       }
    2305       else if (id == KJS::HTMLElement::TableCreateTFoot)
    2306         return getDOMNode(exec,table.createTFoot());
    2307       else if (id == KJS::HTMLElement::TableDeleteTFoot) {
    2308         table.deleteTFoot();
    2309         return Undefined();
    2310       }
    2311       else if (id == KJS::HTMLElement::TableCreateCaption)
    2312         return getDOMNode(exec,table.createCaption());
    2313       else if (id == KJS::HTMLElement::TableDeleteCaption) {
    2314         table.deleteCaption();
    2315         return Undefined();
    2316       }
    2317       else if (id == KJS::HTMLElement::TableInsertRow)
    2318         return getDOMNode(exec,table.insertRow(args[0].toInt32(exec), exception));
    2319       else if (id == KJS::HTMLElement::TableDeleteRow) {
    2320         table.deleteRow(args[0].toInt32(exec), exception);
    2321         return Undefined();
    2322       }
    2323     }
    2324     break;
    2325     case ID_THEAD:
    2326     case ID_TBODY:
    2327     case ID_TFOOT: {
    2328       HTMLTableSectionElementImpl &tableSection = static_cast<HTMLTableSectionElementImpl &>(element);
    2329       if (id == KJS::HTMLElement::TableSectionInsertRow)
    2330         return getDOMNode(exec, tableSection.insertRow(args[0].toInt32(exec), exception));
    2331       else if (id == KJS::HTMLElement::TableSectionDeleteRow) {
    2332         tableSection.deleteRow(args[0].toInt32(exec), exception);
    2333         return Undefined();
    2334       }
    2335     }
    2336     break;
    2337     case ID_TR: {
    2338       HTMLTableRowElementImpl &tableRow = static_cast<HTMLTableRowElementImpl &>(element);
    2339       if (id == KJS::HTMLElement::TableRowInsertCell)
    2340         return getDOMNode(exec,tableRow.insertCell(args[0].toInt32(exec), exception));
    2341       else if (id == KJS::HTMLElement::TableRowDeleteCell) {
    2342         tableRow.deleteCell(args[0].toInt32(exec), exception);
    2343         return Undefined();
    2344       }
    2345     }
    2346     case ID_MARQUEE: {
     2319    if (!thisObj.inherits(&KJS::HTMLElement::info)) {
     2320        Object err = Error::create(exec,TypeError);
     2321        exec->setException(err);
     2322        return err;
     2323    }
     2324    kdDebug() << "KJS::HTMLElementFunction::tryCall " << endl;
     2325    DOMExceptionTranslator exception(exec);
     2326    HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(static_cast<HTMLElement *>(thisObj.imp())->impl());
     2327
     2328    if (element.hasLocalName(HTMLNames::form())) {
     2329        HTMLFormElementImpl &form = static_cast<HTMLFormElementImpl &>(element);
     2330        if (id == KJS::HTMLElement::FormSubmit) {
     2331            form.submit();
     2332            return Undefined();
     2333        }
     2334        else if (id == KJS::HTMLElement::FormReset) {
     2335            form.reset();
     2336            return Undefined();
     2337        }
     2338    }
     2339    else if (element.hasLocalName(HTMLNames::select())) {
     2340        HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
     2341        if (id == KJS::HTMLElement::SelectAdd) {
     2342            select.add(toHTMLElement(args[0]), toHTMLElement(args[1]));
     2343            return Undefined();
     2344        }
     2345        else if (id == KJS::HTMLElement::SelectRemove) {
     2346            select.remove(int(args[0].toNumber(exec)));
     2347            return Undefined();
     2348        }
     2349        else if (id == KJS::HTMLElement::SelectBlur) {
     2350            select.blur();
     2351            return Undefined();
     2352        }
     2353        else if (id == KJS::HTMLElement::SelectFocus) {
     2354            select.focus();
     2355            return Undefined();
     2356        }
     2357    }
     2358    else if (element.hasLocalName(HTMLNames::input())) {
     2359        HTMLInputElementImpl &input = static_cast<HTMLInputElementImpl &>(element);
     2360        if (id == KJS::HTMLElement::InputBlur) {
     2361            input.blur();
     2362            return Undefined();
     2363        }
     2364        else if (id == KJS::HTMLElement::InputFocus) {
     2365            input.focus();
     2366            return Undefined();
     2367        }
     2368        else if (id == KJS::HTMLElement::InputSelect) {
     2369            input.select();
     2370            return Undefined();
     2371        }
     2372        else if (id == KJS::HTMLElement::InputClick) {
     2373            input.click();
     2374            return Undefined();
     2375        }
     2376        else if (id == KJS::HTMLElement::InputSetSelectionRange) {
     2377            input.setSelectionRange(args[0].toInt32(exec), args[1].toInt32(exec));
     2378            return Undefined();
     2379        }
     2380    }
     2381    else if (element.hasLocalName(HTMLNames::button())) {
     2382        HTMLButtonElementImpl &button = static_cast<HTMLButtonElementImpl &>(element);
     2383        if (id == KJS::HTMLElement::ButtonBlur) {
     2384            button.blur();
     2385            return Undefined();
     2386        }
     2387        else if (id == KJS::HTMLElement::ButtonFocus) {
     2388            button.focus();
     2389            return Undefined();
     2390        }
     2391    }
     2392    else if (element.hasLocalName(HTMLNames::label())) {
     2393        HTMLLabelElementImpl &label = static_cast<HTMLLabelElementImpl &>(element);
     2394        if (id == KJS::HTMLElement::LabelFocus) {
     2395            label.focus();
     2396            return Undefined();
     2397        }
     2398    }
     2399    else if (element.hasLocalName(HTMLNames::legend())) {
     2400        HTMLLegendElementImpl &legend = static_cast<HTMLLegendElementImpl &>(element);
     2401        if (id == KJS::HTMLElement::LegendFocus) {
     2402            legend.focus();
     2403            return Undefined();
     2404        }
     2405    }
     2406    else if (element.hasLocalName(HTMLNames::textarea())) {
     2407        HTMLTextAreaElementImpl &textarea = static_cast<HTMLTextAreaElementImpl &>(element);
     2408        if (id == KJS::HTMLElement::TextAreaBlur) {
     2409            textarea.blur();
     2410            return Undefined();
     2411        }
     2412        else if (id == KJS::HTMLElement::TextAreaFocus) {
     2413            textarea.focus();
     2414            return Undefined();
     2415        }
     2416        else if (id == KJS::HTMLElement::TextAreaSelect) {
     2417            textarea.select();
     2418            return Undefined();
     2419        }
     2420        else if (id == KJS::HTMLElement::TextAreaSetSelectionRange) {
     2421            textarea.setSelectionRange(args[0].toInt32(exec), args[1].toInt32(exec));
     2422            return Undefined();
     2423        }
     2424    }
     2425    else if (element.hasLocalName(HTMLNames::a())) {
     2426        HTMLAnchorElementImpl &anchor = static_cast<HTMLAnchorElementImpl &>(element);
     2427        if (id == KJS::HTMLElement::AnchorBlur) {
     2428            anchor.blur();
     2429            return Undefined();
     2430        }
     2431        else if (id == KJS::HTMLElement::AnchorFocus) {
     2432            anchor.focus();
     2433            return Undefined();
     2434        }
     2435        else if (id == KJS::HTMLElement::AnchorToString)
     2436            return String(thisObj.toString(exec));
     2437    }
     2438    else if (element.hasLocalName(HTMLNames::table())) {
     2439        HTMLTableElementImpl &table = static_cast<HTMLTableElementImpl &>(element);
     2440        if (id == KJS::HTMLElement::TableCreateTHead)
     2441            return getDOMNode(exec,table.createTHead());
     2442        else if (id == KJS::HTMLElement::TableDeleteTHead) {
     2443            table.deleteTHead();
     2444            return Undefined();
     2445        }
     2446        else if (id == KJS::HTMLElement::TableCreateTFoot)
     2447            return getDOMNode(exec,table.createTFoot());
     2448        else if (id == KJS::HTMLElement::TableDeleteTFoot) {
     2449            table.deleteTFoot();
     2450            return Undefined();
     2451        }
     2452        else if (id == KJS::HTMLElement::TableCreateCaption)
     2453            return getDOMNode(exec,table.createCaption());
     2454        else if (id == KJS::HTMLElement::TableDeleteCaption) {
     2455            table.deleteCaption();
     2456            return Undefined();
     2457        }
     2458        else if (id == KJS::HTMLElement::TableInsertRow)
     2459            return getDOMNode(exec,table.insertRow(args[0].toInt32(exec), exception));
     2460        else if (id == KJS::HTMLElement::TableDeleteRow) {
     2461            table.deleteRow(args[0].toInt32(exec), exception);
     2462            return Undefined();
     2463        }
     2464    }
     2465    else if (element.hasLocalName(HTMLNames::thead()) ||
     2466             element.hasLocalName(HTMLNames::tbody()) ||
     2467             element.hasLocalName(HTMLNames::tfoot())) {
     2468        HTMLTableSectionElementImpl &tableSection = static_cast<HTMLTableSectionElementImpl &>(element);
     2469        if (id == KJS::HTMLElement::TableSectionInsertRow)
     2470            return getDOMNode(exec, tableSection.insertRow(args[0].toInt32(exec), exception));
     2471        else if (id == KJS::HTMLElement::TableSectionDeleteRow) {
     2472            tableSection.deleteRow(args[0].toInt32(exec), exception);
     2473            return Undefined();
     2474        }
     2475    }
     2476    else if (element.hasLocalName(HTMLNames::tr())) {
     2477        HTMLTableRowElementImpl &tableRow = static_cast<HTMLTableRowElementImpl &>(element);
     2478        if (id == KJS::HTMLElement::TableRowInsertCell)
     2479            return getDOMNode(exec,tableRow.insertCell(args[0].toInt32(exec), exception));
     2480        else if (id == KJS::HTMLElement::TableRowDeleteCell) {
     2481            tableRow.deleteCell(args[0].toInt32(exec), exception);
     2482            return Undefined();
     2483        }
     2484    }
     2485    else if (element.hasLocalName(HTMLNames::marquee())) {
    23472486        if (id == KJS::HTMLElement::MarqueeStart && element.renderer() &&
    23482487            element.renderer()->layer() &&
     
    23522491        }
    23532492        if (id == KJS::HTMLElement::MarqueeStop && element.renderer() &&
    2354                  element.renderer()->layer() &&
    2355                  element.renderer()->layer()->marquee()) {
     2493            element.renderer()->layer() &&
     2494            element.renderer()->layer()->marquee()) {
    23562495            element.renderer()->layer()->marquee()->stop();
    23572496            return Undefined();
    23582497        }
    2359         break;
    2360     }
    2361     case ID_CANVAS: {
     2498    }
     2499#if APPLE_CHANGES
     2500    else if (element.hasLocalName(HTMLNames::canvas())) {
    23622501        if (id == KJS::HTMLElement::GetContext) {
    23632502            if (args.size() == 0 || (args.size() == 1 && args[0].toString(exec).qstring().lower() == "2d")) {
     
    23672506        }
    23682507    }
    2369    
    2370     break;
    2371   }
    2372 
    2373   return Undefined();
     2508#endif
     2509
     2510    return Undefined();
    23742511}
    23752512
     
    23772514{
    23782515#ifdef KJS_VERBOSE
    2379   DOM::DOMString str = value.isA(NullType) ? DOM::DOMString() : value.toString(exec).string();
     2516    DOM::DOMString str = value.isA(NullType) ? DOM::DOMString() : value.toString(exec).string();
    23802517#endif
    2381   HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
     2518    HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
    23822519#ifdef KJS_VERBOSE
    2383   kdDebug(6070) << "KJS::HTMLElement::tryPut " << propertyName.qstring()
    2384                 << " thisTag=" << element.tagName().string()
    2385                 << " str=" << str.string() << endl;
     2520    kdDebug(6070) << "KJS::HTMLElement::tryPut " << propertyName.qstring()
     2521                  << " thisTag=" << element.tagName().string()
     2522                  << " str=" << str.string() << endl;
    23862523#endif
    2387   // First look at dynamic properties
    2388   switch (element.id()) {
    2389     case ID_SELECT: {
    2390       HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
    2391       bool ok;
    2392       /*uint u =*/ propertyName.toULong(&ok);
    2393       if (ok) {
    2394         Object coll = Object::dynamicCast( getSelectHTMLCollection(exec, select.optionsHTMLCollection().get(), &select) );
    2395         if ( !coll.isNull() )
    2396           coll.put(exec,propertyName,value);
    2397         return;
    2398       }
     2524    // First look at dynamic properties
     2525    if (element.hasLocalName(HTMLNames::select())) {
     2526        HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
     2527        bool ok;
     2528        /*uint u =*/ propertyName.toULong(&ok);
     2529        if (ok) {
     2530            Object coll = Object::dynamicCast( getSelectHTMLCollection(exec, select.optionsHTMLCollection().get(), &select) );
     2531            if (!coll.isNull())
     2532                coll.put(exec,propertyName,value);
     2533            return;
     2534        }
    23992535    }
    24002536#if APPLE_CHANGES
    2401     case ID_EMBED:
    2402     case ID_OBJECT:
    2403     case ID_APPLET: {
     2537    else if (element.hasLocalName(HTMLNames::embed()) ||
     2538             element.hasLocalName(HTMLNames::object()) ||
     2539             element.hasLocalName(HTMLNames::applet())) {
    24042540        Value runtimeObject = getRuntimeObject(exec,&element);
    24052541        if (!runtimeObject.isNull()) {
    24062542            ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject.imp());
    2407             if (imp->canPut(exec, propertyName)) {
     2543            if (imp->canPut(exec, propertyName))
    24082544                return imp->put (exec, propertyName, value);
    2409             }
    24102545        }
    24112546    }
    2412       break;
    24132547#endif
    2414     break;
    2415   default:
    2416       break;
    2417   }
    2418 
    2419   const HashTable* table = classInfo()->propHashTable; // get the right hashtable
    2420   const HashEntry* entry = Lookup::findEntry(table, propertyName);
    2421   if (entry) {
    2422     if (entry->attr & Function) // function: put as override property
    2423     {
    2424       ObjectImp::put(exec, propertyName, value, attr);
    2425       return;
    2426     }
    2427     else if ((entry->attr & ReadOnly) == 0) // let DOMObjectLookupPut print the warning if not
    2428     {
    2429       putValue(exec, entry->value, value, attr);
    2430       return;
    2431     }
    2432   }
    2433   DOMObjectLookupPut<KJS::HTMLElement, DOMElement>(exec, propertyName, value, attr, &HTMLElementTable, this);
    2434 }
    2435 
    2436 void HTMLElement::putValue(ExecState *exec, int token, const Value& value, int)
    2437 {
    2438   DOMExceptionTranslator exception(exec);
    2439   DOM::DOMString str = value.isA(NullType) ? DOM::DOMString() : value.toString(exec).string();
    2440   HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
    2441 #ifdef KJS_VERBOSE
    2442   kdDebug(6070) << "KJS::HTMLElement::putValue "
    2443                 << " thisTag=" << element.tagName().string()
    2444                 << " token=" << token << endl;
    2445 #endif
    2446 
    2447   switch (element.id()) {
    2448   case ID_HTML: {
    2449       HTMLHtmlElementImpl &html = static_cast<HTMLHtmlElementImpl &>(element);
    2450       switch (token) {
    2451       case HtmlVersion:         { html.setVersion(str); return; }
    2452       }
    2453   }
    2454   break;
    2455   case ID_HEAD: {
    2456     HTMLHeadElementImpl &head = static_cast<HTMLHeadElementImpl &>(element);
    2457     switch (token) {
    2458     case HeadProfile:         { head.setProfile(str); return; }
    2459     }
    2460   }
    2461   break;
    2462   case ID_LINK: {
    2463     HTMLLinkElementImpl &link = static_cast<HTMLLinkElementImpl &>(element);
    2464     switch (token) {
    2465       case LinkDisabled:        { link.setDisabled(value.toBoolean(exec)); return; }
    2466       case LinkCharset:         { link.setCharset(str); return; }
    2467       case LinkHref:            { link.setHref(str); return; }
    2468       case LinkHrefLang:        { link.setHreflang(str); return; }
    2469       case LinkMedia:           { link.setMedia(str); return; }
    2470       case LinkRel:             { link.setRel(str); return; }
    2471       case LinkRev:             { link.setRev(str); return; }
    2472       case LinkTarget:          { link.setTarget(str); return; }
    2473       case LinkType:            { link.setType(str); return; }
    2474       }
    2475     }
    2476     break;
    2477     case ID_TITLE: {
    2478       HTMLTitleElementImpl &title = static_cast<HTMLTitleElementImpl &>(element);
    2479       switch (token) {
    2480       case TitleText:                 { title.setText(str); return; }
    2481       }
    2482     }
    2483     break;
    2484     case ID_META: {
    2485       HTMLMetaElementImpl &meta = static_cast<HTMLMetaElementImpl &>(element);
    2486       switch (token) {
    2487       case MetaContent:         { meta.setContent(str); return; }
    2488       case MetaHttpEquiv:       { meta.setHttpEquiv(str); return; }
    2489       case MetaName:            { meta.setName(str); return; }
    2490       case MetaScheme:          { meta.setScheme(str); return; }
    2491       }
    2492     }
    2493     break;
    2494     case ID_BASE: {
    2495       HTMLBaseElementImpl &base = static_cast<HTMLBaseElementImpl &>(element);
    2496       switch (token) {
    2497       case BaseHref:            { base.setHref(str); return; }
    2498       case BaseTarget:          { base.setTarget(str); return; }
    2499       }
    2500     }
    2501     break;
    2502     case ID_ISINDEX: {
    2503       HTMLIsIndexElementImpl &isindex = static_cast<HTMLIsIndexElementImpl &>(element);
    2504       switch (token) {
    2505       // read-only: form
    2506       case IsIndexPrompt:               { isindex.setPrompt(str); return; }
    2507       }
    2508     }
    2509     break;
    2510     case ID_STYLE: {
    2511       HTMLStyleElementImpl &style = static_cast<HTMLStyleElementImpl &>(element);
    2512       switch (token) {
    2513       case StyleDisabled:        { style.setDisabled(value.toBoolean(exec)); return; }
    2514       case StyleMedia:           { style.setMedia(str); return; }
    2515       case StyleType:            { style.setType(str); return; }
    2516       }
    2517     }
    2518     break;
    2519     case ID_BODY: {
    2520       HTMLBodyElementImpl &body = static_cast<HTMLBodyElementImpl &>(element);
    2521       switch (token) {
    2522       case BodyALink:           { body.setALink(str); return; }
    2523       case BodyBackground:      { body.setBackground(str); return; }
    2524       case BodyBgColor:         { body.setBgColor(str); return; }
    2525       case BodyLink:            { body.setLink(str); return; }
    2526       case BodyText:            { body.setText(str); return; }
    2527       case BodyVLink:           { body.setVLink(str); return; }
    2528       case BodyScrollLeft:
    2529       case BodyScrollTop: {
    2530           QScrollView* sview = body.ownerDocument()->view();
    2531           if (sview) {
    2532               // Update the document's layout before we compute these attributes.
    2533               if (DocumentImpl* doc = body.getDocument())
    2534                   doc->updateLayoutIgnorePendingStylesheets();
    2535               if (token == BodyScrollLeft)
    2536                   sview->setContentsPos(value.toInt32(exec), sview->contentsY());
    2537               else
    2538                   sview->setContentsPos(sview->contentsX(), value.toInt32(exec));
    2539           }
    2540           return;
    2541         }
    2542       }
    2543     }
    2544     break;
    2545     case ID_FORM: {
    2546       HTMLFormElementImpl &form = static_cast<HTMLFormElementImpl &>(element);
    2547       switch (token) {
    2548       // read-only: elements
    2549       // read-only: length
    2550       case FormName:            { form.setName(str); return; }
    2551       case FormAcceptCharset:   { form.setAcceptCharset(str); return; }
    2552       case FormAction:          { form.setAction(str); return; }
    2553       case FormEncType:         { form.setEnctype(str); return; }
    2554       case FormMethod:          { form.setMethod(str); return; }
    2555       case FormTarget:          { form.setTarget(str); return; }
    2556       }
    2557     }
    2558     break;
    2559     case ID_SELECT: {
    2560       HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
    2561       switch (token) {
    2562       // read-only: type
    2563       case SelectSelectedIndex:   { select.setSelectedIndex(value.toInt32(exec)); return; }
    2564       case SelectValue:           { select.setValue(str); return; }
    2565       case SelectLength:          { // read-only according to the NS spec, but webpages need it writeable
     2548
     2549    const HashTable* table = classInfo()->propHashTable; // get the right hashtable
     2550    const HashEntry* entry = Lookup::findEntry(table, propertyName);
     2551    if (entry) {
     2552        if (entry->attr & Function) { // function: put as override property
     2553            ObjectImp::put(exec, propertyName, value, attr);
     2554            return;
     2555        }
     2556        else if ((entry->attr & ReadOnly) == 0) { // let DOMObjectLookupPut print the warning if not
     2557            putValue(exec, entry->value, value, attr);
     2558            return;
     2559        }
     2560    }
     2561
     2562    DOMObjectLookupPut<KJS::HTMLElement, DOMElement>(exec, propertyName, value, attr, &HTMLElementTable, this);
     2563}
     2564
     2565void HTMLElement::htmlSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2566{
     2567    HTMLHeadElementImpl &head = *static_cast<HTMLHeadElementImpl*>(impl());
     2568    if (token == HeadProfile)
     2569        head.setProfile(str);
     2570}
     2571
     2572void HTMLElement::headSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2573{
     2574    HTMLHeadElementImpl &head = *static_cast<HTMLHeadElementImpl*>(impl());
     2575    if (token == HeadProfile)
     2576        head.setProfile(str);
     2577}
     2578
     2579void HTMLElement::linkSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2580{
     2581    HTMLLinkElementImpl &link = *static_cast<HTMLLinkElementImpl*>(impl());
     2582    switch (token) {
     2583        case LinkDisabled:        { link.setDisabled(value.toBoolean(exec)); return; }
     2584        case LinkCharset:         { link.setCharset(str); return; }
     2585        case LinkHref:            { link.setHref(str); return; }
     2586        case LinkHrefLang:        { link.setHreflang(str); return; }
     2587        case LinkMedia:           { link.setMedia(str); return; }
     2588        case LinkRel:             { link.setRel(str); return; }
     2589        case LinkRev:             { link.setRev(str); return; }
     2590        case LinkTarget:          { link.setTarget(str); return; }
     2591        case LinkType:            { link.setType(str); return; }
     2592    }
     2593}
     2594
     2595void HTMLElement::titleSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2596{
     2597     HTMLTitleElementImpl& title = *static_cast<HTMLTitleElementImpl*>(impl());
     2598     if (token == TitleText)
     2599        title.setText(str);
     2600}
     2601
     2602void HTMLElement::metaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2603{
     2604    HTMLMetaElementImpl& meta = *static_cast<HTMLMetaElementImpl*>(impl());
     2605    switch (token) {
     2606        case MetaContent:         { meta.setContent(str); return; }
     2607        case MetaHttpEquiv:       { meta.setHttpEquiv(str); return; }
     2608        case MetaName:            { meta.setName(str); return; }
     2609        case MetaScheme:          { meta.setScheme(str); return; }
     2610    }
     2611}
     2612
     2613void HTMLElement::baseSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2614{
     2615    HTMLBaseElementImpl& base = *static_cast<HTMLBaseElementImpl*>(impl());
     2616    switch (token) {
     2617        case BaseHref:            { base.setHref(str); return; }
     2618        case BaseTarget:          { base.setTarget(str); return; }
     2619    }
     2620}
     2621
     2622void HTMLElement::isIndexSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2623{
     2624    HTMLIsIndexElementImpl& isindex = *static_cast<HTMLIsIndexElementImpl*>(impl());
     2625    if (token == IsIndexPrompt)
     2626        isindex.setPrompt(str);
     2627}
     2628
     2629void HTMLElement::styleSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2630{
     2631    HTMLStyleElementImpl& style = *static_cast<HTMLStyleElementImpl*>(impl());
     2632    switch (token) {
     2633        case StyleDisabled:        { style.setDisabled(value.toBoolean(exec)); return; }
     2634        case StyleMedia:           { style.setMedia(str); return; }
     2635        case StyleType:            { style.setType(str); return; }
     2636    }
     2637}
     2638
     2639void HTMLElement::bodySetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2640{
     2641    HTMLBodyElementImpl& body = *static_cast<HTMLBodyElementImpl*>(impl());
     2642    switch (token) {
     2643        case BodyALink:           { body.setALink(str); return; }
     2644        case BodyBackground:      { body.setBackground(str); return; }
     2645        case BodyBgColor:         { body.setBgColor(str); return; }
     2646        case BodyLink:            { body.setLink(str); return; }
     2647        case BodyText:            { body.setText(str); return; }
     2648        case BodyVLink:           { body.setVLink(str); return; }
     2649        case BodyScrollLeft:
     2650        case BodyScrollTop: {
     2651            QScrollView* sview = body.ownerDocument()->view();
     2652            if (sview) {
     2653                // Update the document's layout before we compute these attributes.
     2654                if (DocumentImpl* doc = body.getDocument())
     2655                    doc->updateLayoutIgnorePendingStylesheets();
     2656                if (token == BodyScrollLeft)
     2657                    sview->setContentsPos(value.toInt32(exec), sview->contentsY());
     2658                else
     2659                    sview->setContentsPos(sview->contentsX(), value.toInt32(exec));
     2660            }
     2661            return;
     2662        }
     2663    }
     2664}
     2665
     2666void HTMLElement::formSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2667{
     2668    HTMLFormElementImpl& form = *static_cast<HTMLFormElementImpl*>(impl());
     2669    switch (token) {
     2670        // read-only: elements
     2671        // read-only: length
     2672        case FormName:            { form.setName(str); return; }
     2673        case FormAcceptCharset:   { form.setAcceptCharset(str); return; }
     2674        case FormAction:          { form.setAction(str); return; }
     2675        case FormEncType:         { form.setEnctype(str); return; }
     2676        case FormMethod:          { form.setMethod(str); return; }
     2677        case FormTarget:          { form.setTarget(str); return; }
     2678    }
     2679}
     2680
     2681void HTMLElement::selectSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2682{
     2683    HTMLSelectElementImpl& select = *static_cast<HTMLSelectElementImpl*>(impl());
     2684    switch (token) {
     2685        // read-only: type
     2686        case SelectSelectedIndex:   { select.setSelectedIndex(value.toInt32(exec)); return; }
     2687        case SelectValue:           { select.setValue(str); return; }
     2688        case SelectLength:          { // read-only according to the NS spec, but webpages need it writeable
    25662689                                         Object coll = Object::dynamicCast( getSelectHTMLCollection(exec, select.optionsHTMLCollection().get(), &select) );
    25672690                                         if ( !coll.isNull() )
    25682691                                           coll.put(exec,lengthPropertyName,value);
    25692692                                         return;
    2570                                        }
    2571       // read-only: form
    2572       // read-only: options
    2573       case SelectDisabled:        { select.setDisabled(value.toBoolean(exec)); return; }
    2574       case SelectMultiple:        { select.setMultiple(value.toBoolean(exec)); return; }
    2575       case SelectName:            { select.setName(str); return; }
    2576       case SelectSize:            { select.setSize(value.toInt32(exec)); return; }
    2577       case SelectTabIndex:        { select.setTabIndex(value.toInt32(exec)); return; }
    2578       }
    2579     }
    2580     break;
    2581     case ID_OPTGROUP: {
    2582       HTMLOptGroupElementImpl &optgroup = static_cast<HTMLOptGroupElementImpl &>(element);
    2583       switch (token) {
    2584       case OptGroupDisabled:        { optgroup.setDisabled(value.toBoolean(exec)); return; }
    2585       case OptGroupLabel:           { optgroup.setLabel(str); return; }
    2586       }
    2587     }
    2588     break;
    2589     case ID_OPTION: {
    2590       HTMLOptionElementImpl &option = static_cast<HTMLOptionElementImpl &>(element);
    2591       switch (token) {
    2592       // read-only: form
    2593       case OptionDefaultSelected: { option.setDefaultSelected(value.toBoolean(exec)); return; }
    2594       case OptionText:            { option.setText(str, exception); return; }
    2595       // read-only: index
    2596       case OptionDisabled:        { option.setDisabled(value.toBoolean(exec)); return; }
    2597       case OptionLabel:           { option.setLabel(str); return; }
    2598       case OptionSelected:        { option.setSelected(value.toBoolean(exec)); return; }
    2599       case OptionValue:           { option.setValue(str); return; }
    2600       }
    2601     }
    2602     break;
    2603     case ID_INPUT: {
    2604       HTMLInputElementImpl &input = static_cast<HTMLInputElementImpl &>(element);
    2605       switch (token) {
    2606       case InputDefaultValue:    { input.setDefaultValue(str); return; }
    2607       case InputDefaultChecked:  { input.setDefaultChecked(value.toBoolean(exec)); return; }
    2608       // read-only: form
    2609       case InputAccept:          { input.setAccept(str); return; }
    2610       case InputAccessKey:       { input.setAccessKey(str); return; }
    2611       case InputAlign:           { input.setAlign(str); return; }
    2612       case InputAlt:             { input.setAlt(str); return; }
    2613       case InputChecked:         { input.setChecked(value.toBoolean(exec)); return; }
    2614       case InputDisabled:        { input.setDisabled(value.toBoolean(exec)); return; }
    2615       case InputMaxLength:       { input.setMaxLength(value.toInt32(exec)); return; }
    2616       case InputName:            { input.setName(str); return; }
    2617       case InputReadOnly:        { input.setReadOnly(value.toBoolean(exec)); return; }
    2618       case InputSelectionStart:  { input.setSelectionStart(value.toInt32(exec)); return; }
    2619       case InputSelectionEnd:    { input.setSelectionEnd(value.toInt32(exec)); return; }
    2620       case InputSize:            { input.setSize(str); return; }
    2621       case InputSrc:             { input.setSrc(str); return; }
    2622       case InputTabIndex:        { input.setTabIndex(value.toInt32(exec)); return; }
    2623       case InputType:            { input.setType(str); return; }
    2624       case InputUseMap:          { input.setUseMap(str); return; }
    2625       case InputValue:           { input.setValue(str); return; }
    2626       }
    2627     }
    2628     break;
    2629     case ID_TEXTAREA: {
    2630       HTMLTextAreaElementImpl &textarea = static_cast<HTMLTextAreaElementImpl &>(element);
    2631       switch (token) {
    2632       case TextAreaDefaultValue:    { textarea.setDefaultValue(str); return; }
    2633       // read-only: form
    2634       case TextAreaAccessKey:       { textarea.setAccessKey(str); return; }
    2635       case TextAreaCols:            { textarea.setCols(value.toInt32(exec)); return; }
    2636       case TextAreaDisabled:        { textarea.setDisabled(value.toBoolean(exec)); return; }
    2637       case TextAreaName:            { textarea.setName(str); return; }
    2638       case TextAreaReadOnly:        { textarea.setReadOnly(value.toBoolean(exec)); return; }
    2639       case TextAreaRows:            { textarea.setRows(value.toInt32(exec)); return; }
    2640       case TextAreaSelectionStart:  { textarea.setSelectionStart(value.toInt32(exec)); return; }
    2641       case TextAreaSelectionEnd:    { textarea.setSelectionEnd(value.toInt32(exec)); return; }
    2642       case TextAreaTabIndex:        { textarea.setTabIndex(value.toInt32(exec)); return; }
    2643       // read-only: type
    2644       case TextAreaValue:           { textarea.setValue(str); return; }
    2645       }
    2646     }
    2647     break;
    2648     case ID_BUTTON: {
    2649       HTMLButtonElementImpl &button = static_cast<HTMLButtonElementImpl &>(element);
    2650       switch (token) {
    2651       // read-only: form
    2652       case ButtonAccessKey:       { button.setAccessKey(str); return; }
    2653       case ButtonDisabled:        { button.setDisabled(value.toBoolean(exec)); return; }
    2654       case ButtonName:            { button.setName(str); return; }
    2655       case ButtonTabIndex:        { button.setTabIndex(value.toInt32(exec)); return; }
    2656       // read-only: type
    2657       case ButtonValue:           { button.setValue(str); return; }
    2658       }
    2659     }
    2660     break;
    2661     case ID_LABEL: {
    2662       HTMLLabelElementImpl &label = static_cast<HTMLLabelElementImpl &>(element);
    2663       switch (token) {
    2664       // read-only: form
    2665       case LabelAccessKey:       { label.setAccessKey(str); return; }
    2666       case LabelHtmlFor:         { label.setHtmlFor(str); return; }
    2667       }
    2668     }
    2669     break;
    2670     case ID_LEGEND: {
    2671       HTMLLegendElementImpl &legend = static_cast<HTMLLegendElementImpl &>(element);
    2672       switch (token) {
    2673       // read-only: form
    2674       case LegendAccessKey:       { legend.setAccessKey(str); return; }
    2675       case LegendAlign:           { legend.setAlign(str); return; }
    2676       }
    2677     }
    2678     break;
    2679     case ID_UL: {
    2680       HTMLUListElementImpl &uList = static_cast<HTMLUListElementImpl &>(element);
    2681       switch (token) {
    2682       case UListCompact:         { uList.setCompact(value.toBoolean(exec)); return; }
    2683       case UListType:            { uList.setType(str); return; }
    2684       }
    2685     }
    2686     break;
    2687     case ID_OL: {
    2688       HTMLOListElementImpl &oList = static_cast<HTMLOListElementImpl &>(element);
    2689       switch (token) {
    2690       case OListCompact:         { oList.setCompact(value.toBoolean(exec)); return; }
    2691       case OListStart:           { oList.setStart(value.toInt32(exec)); return; }
    2692       case OListType:            { oList.setType(str); return; }
    2693       }
    2694     }
    2695     break;
    2696     case ID_DL: {
    2697       HTMLDListElementImpl &dList = static_cast<HTMLDListElementImpl &>(element);
    2698       switch (token) {
    2699       case DListCompact:         { dList.setCompact(value.toBoolean(exec)); return; }
    2700       }
    2701     }
    2702     break;
    2703     case ID_DIR: {
    2704       HTMLDirectoryElementImpl &directory = static_cast<HTMLDirectoryElementImpl &>(element);
    2705       switch (token) {
    2706       case DirectoryCompact:     { directory.setCompact(value.toBoolean(exec)); return; }
    2707       }
    2708     }
    2709     break;
    2710     case ID_MENU: {
    2711       HTMLMenuElementImpl &menu = static_cast<HTMLMenuElementImpl &>(element);
    2712       switch (token) {
    2713       case MenuCompact:         { menu.setCompact(value.toBoolean(exec)); return; }
    2714       }
    2715     }
    2716     break;
    2717     case ID_LI: {
    2718       HTMLLIElementImpl &li = static_cast<HTMLLIElementImpl &>(element);
    2719       switch (token) {
    2720       case LIType:            { li.setType(str); return; }
    2721       case LIValue:           { li.setValue(value.toInt32(exec)); return; }
    2722       }
    2723     }
    2724     break;
    2725     case ID_DIV: {
    2726       HTMLDivElementImpl &div = static_cast<HTMLDivElementImpl &>(element);
    2727       switch (token) {
    2728       case DivAlign:           { div.setAlign(str); return; }
    2729       }
    2730     }
    2731     break;
    2732     case ID_P: {
    2733       HTMLParagraphElementImpl &paragraph = static_cast<HTMLParagraphElementImpl &>(element);
    2734       switch (token) {
    2735       case ParagraphAlign:     { paragraph.setAlign(str); return; }
    2736       }
    2737     }
    2738     break;
    2739     case ID_H1:
    2740     case ID_H2:
    2741     case ID_H3:
    2742     case ID_H4:
    2743     case ID_H5:
    2744     case ID_H6: {
    2745       HTMLHeadingElementImpl &heading = static_cast<HTMLHeadingElementImpl &>(element);
    2746       switch (token) {
    2747       case HeadingAlign:         { heading.setAlign(str); return; }
    2748       }
    2749     }
    2750     break;
    2751     case ID_BLOCKQUOTE: {
    2752       HTMLBlockquoteElementImpl &blockquote = static_cast<HTMLBlockquoteElementImpl &>(element);
    2753       switch (token) {
    2754       case BlockQuoteCite:       { blockquote.setCite(str); return; }
    2755       }
    2756     }
    2757     break;
    2758     case ID_Q: {
    2759       HTMLQuoteElementImpl &quote = static_cast<HTMLQuoteElementImpl &>(element);
    2760       switch (token) {
    2761       case QuoteCite:            { quote.setCite(str); return; }
    2762       }
    2763     }
    2764     break;
    2765     case ID_PRE: {
    2766       HTMLPreElementImpl &pre = static_cast<HTMLPreElementImpl &>(element);
    2767       switch (token) {
    2768       case PreWidth:           { pre.setWidth(value.toInt32(exec)); return; }
    2769       }
    2770     }
    2771     break;
    2772     case ID_BR: {
    2773       HTMLBRElementImpl &br = static_cast<HTMLBRElementImpl &>(element);
    2774       switch (token) {
    2775       case BRClear:           { br.setClear(str); return; }
    2776       }
    2777     }
    2778     break;
    2779     case ID_BASEFONT: {
    2780       HTMLBaseFontElementImpl &baseFont = static_cast<HTMLBaseFontElementImpl &>(element);
    2781       switch (token) {
    2782       case BaseFontColor:           { baseFont.setColor(str); return; }
    2783       case BaseFontFace:            { baseFont.setFace(str); return; }
    2784       case BaseFontSize:            { baseFont.setSize(str); return; }
    2785       }
    2786     }
    2787     break;
    2788     case ID_FONT: {
    2789       HTMLFontElementImpl &font = static_cast<HTMLFontElementImpl &>(element);
    2790       switch (token) {
    2791       case FontColor:           { font.setColor(str); return; }
    2792       case FontFace:            { font.setFace(str); return; }
    2793       case FontSize:            { font.setSize(str); return; }
    2794       }
    2795     }
    2796     break;
    2797     case ID_HR: {
    2798       HTMLHRElementImpl &hr = static_cast<HTMLHRElementImpl &>(element);
    2799       switch (token) {
    2800       case HRAlign:           { hr.setAlign(str); return; }
    2801       case HRNoShade:         { hr.setNoShade(value.toBoolean(exec)); return; }
    2802       case HRSize:            { hr.setSize(str); return; }
    2803       case HRWidth:           { hr.setWidth(str); return; }
    2804       }
    2805     }
    2806     break;
    2807     case ID_INS:
    2808     case ID_DEL: {
    2809       HTMLModElementImpl &mod = static_cast<HTMLModElementImpl &>(element);
    2810       switch (token) {
    2811       case ModCite:            { mod.setCite(str); return; }
    2812       case ModDateTime:        { mod.setDateTime(str); return; }
    2813       }
    2814     }
    2815     break;
    2816     case ID_A: {
    2817       HTMLAnchorElementImpl &anchor = static_cast<HTMLAnchorElementImpl &>(element);
    2818       switch (token) {
    2819       case AnchorAccessKey:       { anchor.setAccessKey(str); return; }
    2820       case AnchorCharset:         { anchor.setCharset(str); return; }
    2821       case AnchorCoords:          { anchor.setCoords(str); return; }
    2822       case AnchorHref:            { anchor.setHref(str); return; }
    2823       case AnchorHrefLang:        { anchor.setHreflang(str); return; }
    2824       case AnchorName:            { anchor.setName(str); return; }
    2825       case AnchorRel:             { anchor.setRel(str); return; }
    2826       case AnchorRev:             { anchor.setRev(str); return; }
    2827       case AnchorShape:           { anchor.setShape(str); return; }
    2828       case AnchorTabIndex:        { anchor.setTabIndex(value.toInt32(exec)); return; }
    2829       case AnchorTarget:          { anchor.setTarget(str); return; }
    2830       case AnchorType:            { anchor.setType(str); return; }
    2831       }
    2832     }
    2833     break;
    2834     case ID_IMG: {
    2835       HTMLImageElementImpl &image = static_cast<HTMLImageElementImpl &>(element);
    2836       switch (token) {
    2837       case ImageName:            { image.setName(str); return; }
    2838       case ImageAlign:           { image.setAlign(str); return; }
    2839       case ImageAlt:             { image.setAlt(str); return; }
    2840       case ImageBorder:          { image.setBorder(value.toInt32(exec)); return; }
    2841       case ImageHeight:          { image.setHeight(value.toInt32(exec)); return; }
    2842       case ImageHspace:          { image.setHspace(value.toInt32(exec)); return; }
    2843       case ImageIsMap:           { image.setIsMap(value.toBoolean(exec)); return; }
    2844       case ImageLongDesc:        { image.setLongDesc(str); return; }
    2845       case ImageSrc:             { image.setSrc(str); return; }
    2846       case ImageUseMap:          { image.setUseMap(str); return; }
    2847       case ImageVspace:          { image.setVspace(value.toInt32(exec)); return; }
    2848       case ImageWidth:           { image.setWidth(value.toInt32(exec)); return; }
    2849       }
    2850     }
    2851     break;
    2852     case ID_OBJECT: {
    2853       HTMLObjectElementImpl &object = static_cast<HTMLObjectElementImpl &>(element);
    2854       switch (token) {
    2855       // read-only: form
    2856       case ObjectCode:                 { object.setCode(str); return; }
    2857       case ObjectAlign:           { object.setAlign(str); return; }
    2858       case ObjectArchive:         { object.setArchive(str); return; }
    2859       case ObjectBorder:          { object.setBorder(str); return; }
    2860       case ObjectCodeBase:        { object.setCodeBase(str); return; }
    2861       case ObjectCodeType:        { object.setCodeType(str); return; }
    2862       // read-only: ObjectContentDocument
    2863       case ObjectData:            { object.setData(str); return; }
    2864       case ObjectDeclare:         { object.setDeclare(value.toBoolean(exec)); return; }
    2865       case ObjectHeight:          { object.setHeight(str); return; }
    2866       case ObjectHspace:          { object.setHspace(str); return; }
    2867       case ObjectName:            { object.setName(str); return; }
    2868       case ObjectStandby:         { object.setStandby(str); return; }
    2869       case ObjectTabIndex:        { object.setTabIndex(value.toInt32(exec)); return; }
    2870       case ObjectType:            { object.setType(str); return; }
    2871       case ObjectUseMap:          { object.setUseMap(str); return; }
    2872       case ObjectVspace:          { object.setVspace(str); return; }
    2873       case ObjectWidth:           { object.setWidth(str); return; }
    2874       }
    2875     }
    2876     break;
    2877     case ID_PARAM: {
    2878       HTMLParamElementImpl &param = static_cast<HTMLParamElementImpl &>(element);
    2879       switch (token) {
    2880       case ParamName:            { param.setName(str); return; }
    2881       case ParamType:            { param.setType(str); return; }
    2882       case ParamValue:           { param.setValue(str); return; }
    2883       case ParamValueType:       { param.setValueType(str); return; }
    2884       }
    2885     }
    2886     break;
    2887     case ID_APPLET: {
    2888       HTMLAppletElementImpl &applet = static_cast<HTMLAppletElementImpl &>(element);
    2889       switch (token) {
    2890       case AppletAlign:           { applet.setAlign(str); return; }
    2891       case AppletAlt:             { applet.setAlt(str); return; }
    2892       case AppletArchive:         { applet.setArchive(str); return; }
    2893       case AppletCode:            { applet.setCode(str); return; }
    2894       case AppletCodeBase:        { applet.setCodeBase(str); return; }
    2895       case AppletHeight:          { applet.setHeight(str); return; }
    2896       case AppletHspace:          { applet.setHspace(str); return; }
    2897       case AppletName:            { applet.setName(str); return; }
    2898       case AppletObject:          { applet.setObject(str); return; }
    2899       case AppletVspace:          { applet.setVspace(str); return; }
    2900       case AppletWidth:           { applet.setWidth(str); return; }
    2901       }
    2902     }
    2903     break;
    2904     case ID_MAP: {
    2905       HTMLMapElementImpl &map = static_cast<HTMLMapElementImpl &>(element);
    2906       switch (token) {
    2907       // read-only: areas
    2908       case MapName:                 { map.setName(str); return; }
    2909      }
    2910     }
    2911     break;
    2912     case ID_AREA: {
    2913       HTMLAreaElementImpl &area = static_cast<HTMLAreaElementImpl &>(element);
    2914       switch (token) {
    2915       case AreaAccessKey:       { area.setAccessKey(str); return; }
    2916       case AreaAlt:             { area.setAlt(str); return; }
    2917       case AreaCoords:          { area.setCoords(str); return; }
    2918       case AreaHref:            { area.setHref(str); return; }
    2919       case AreaNoHref:          { area.setNoHref(value.toBoolean(exec)); return; }
    2920       case AreaShape:           { area.setShape(str); return; }
    2921       case AreaTabIndex:        { area.setTabIndex(value.toInt32(exec)); return; }
    2922       case AreaTarget:          { area.setTarget(str); return; }
    2923       }
    2924     }
    2925     break;
    2926     case ID_SCRIPT: {
    2927       HTMLScriptElementImpl &script = static_cast<HTMLScriptElementImpl &>(element);
    2928       switch (token) {
    2929       case ScriptText:            { script.setText(str); return; }
    2930       case ScriptHtmlFor:         { script.setHtmlFor(str); return; }
    2931       case ScriptEvent:           { script.setEvent(str); return; }
    2932       case ScriptCharset:         { script.setCharset(str); return; }
    2933       case ScriptDefer:           { script.setDefer(value.toBoolean(exec)); return; }
    2934       case ScriptSrc:             { script.setSrc(str); return; }
    2935       case ScriptType:            { script.setType(str); return; }
    2936       }
    2937     }
    2938     break;
    2939     case ID_TABLE: {
    2940       HTMLTableElementImpl &table = static_cast<HTMLTableElementImpl &>(element);
    2941       switch (token) {
    2942       case TableCaption:         { table.setCaption(toHTMLTableCaptionElement(value)); return; }
    2943       case TableTHead:           { table.setTHead(toHTMLTableSectionElement(value)); return; }
    2944       case TableTFoot:           { table.setTFoot(toHTMLTableSectionElement(value)); return; }
    2945       // read-only: rows
    2946       // read-only: tbodies
    2947       case TableAlign:           { table.setAlign(str); return; }
    2948       case TableBgColor:         { table.setBgColor(str); return; }
    2949       case TableBorder:          { table.setBorder(str); return; }
    2950       case TableCellPadding:     { table.setCellPadding(str); return; }
    2951       case TableCellSpacing:     { table.setCellSpacing(str); return; }
    2952       case TableFrame:           { table.setFrame(str); return; }
    2953       case TableRules:           { table.setRules(str); return; }
    2954       case TableSummary:         { table.setSummary(str); return; }
    2955       case TableWidth:           { table.setWidth(str); return; }
    2956       }
    2957     }
    2958     break;
    2959     case ID_CAPTION: {
    2960       HTMLTableCaptionElementImpl &tableCaption = static_cast<HTMLTableCaptionElementImpl &>(element);
    2961       switch (token) {
    2962       case TableAlign:           { tableCaption.setAlign(str); return; }
    2963       }
    2964     }
    2965     break;
    2966     case ID_COL: {
    2967       HTMLTableColElementImpl &tableCol = static_cast<HTMLTableColElementImpl &>(element);
    2968       switch (token) {
    2969       case TableColAlign:           { tableCol.setAlign(str); return; }
    2970       case TableColCh:              { tableCol.setCh(str); return; }
    2971       case TableColChOff:           { tableCol.setChOff(str); return; }
    2972       case TableColSpan:            { tableCol.setSpan(value.toInt32(exec)); return; }
    2973       case TableColVAlign:          { tableCol.setVAlign(str); return; }
    2974       case TableColWidth:           { tableCol.setWidth(str); return; }
    2975       }
    2976     }
    2977     break;
    2978     case ID_THEAD:
    2979     case ID_TBODY:
    2980     case ID_TFOOT: {
    2981       HTMLTableSectionElementImpl &tableSection = static_cast<HTMLTableSectionElementImpl &>(element);
    2982       switch (token) {
    2983       case TableSectionAlign:           { tableSection.setAlign(str); return; }
    2984       case TableSectionCh:              { tableSection.setCh(str); return; }
    2985       case TableSectionChOff:           { tableSection.setChOff(str); return; }
    2986       case TableSectionVAlign:          { tableSection.setVAlign(str); return; }
    2987       // read-only: rows
    2988       }
    2989     }
    2990     break;
    2991     case ID_TR: {
    2992       HTMLTableRowElementImpl &tableRow = static_cast<HTMLTableRowElementImpl &>(element);
    2993       switch (token) {
    2994       // read-only: rowIndex
    2995       // read-only: sectionRowIndex
    2996       // read-only: cells
    2997       case TableRowAlign:           { tableRow.setAlign(str); return; }
    2998       case TableRowBgColor:         { tableRow.setBgColor(str); return; }
    2999       case TableRowCh:              { tableRow.setCh(str); return; }
    3000       case TableRowChOff:           { tableRow.setChOff(str); return; }
    3001       case TableRowVAlign:          { tableRow.setVAlign(str); return; }
    3002       }
    3003     }
    3004     break;
    3005     case ID_TH:
    3006     case ID_TD: {
    3007       HTMLTableCellElementImpl &tableCell = static_cast<HTMLTableCellElementImpl &>(element);
    3008       switch (token) {
    3009       // read-only: cellIndex
    3010       case TableCellAbbr:            { tableCell.setAbbr(str); return; }
    3011       case TableCellAlign:           { tableCell.setAlign(str); return; }
    3012       case TableCellAxis:            { tableCell.setAxis(str); return; }
    3013       case TableCellBgColor:         { tableCell.setBgColor(str); return; }
    3014       case TableCellCh:              { tableCell.setCh(str); return; }
    3015       case TableCellChOff:           { tableCell.setChOff(str); return; }
    3016       case TableCellColSpan:         { tableCell.setColSpan(value.toInt32(exec)); return; }
    3017       case TableCellHeaders:         { tableCell.setHeaders(str); return; }
    3018       case TableCellHeight:          { tableCell.setHeight(str); return; }
    3019       case TableCellNoWrap:          { tableCell.setNoWrap(value.toBoolean(exec)); return; }
    3020       case TableCellRowSpan:         { tableCell.setRowSpan(value.toInt32(exec)); return; }
    3021       case TableCellScope:           { tableCell.setScope(str); return; }
    3022       case TableCellVAlign:          { tableCell.setVAlign(str); return; }
    3023       case TableCellWidth:           { tableCell.setWidth(str); return; }
    3024       }
    3025     }
    3026     break;
    3027     case ID_FRAMESET: {
    3028       HTMLFrameSetElementImpl &frameSet = static_cast<HTMLFrameSetElementImpl &>(element);
    3029       switch (token) {
    3030       case FrameSetCols:            { frameSet.setCols(str); return; }
    3031       case FrameSetRows:            { frameSet.setRows(str); return; }
    3032       }
    3033     }
    3034     break;
    3035     case ID_FRAME: {
    3036       HTMLFrameElementImpl &frameElement = static_cast<HTMLFrameElementImpl &>(element);
    3037       switch (token) {
    3038        // read-only: FrameContentDocument:
    3039       case FrameFrameBorder:     { frameElement.setFrameBorder(str); return; }
    3040       case FrameLongDesc:        { frameElement.setLongDesc(str); return; }
    3041       case FrameMarginHeight:    { frameElement.setMarginHeight(str); return; }
    3042       case FrameMarginWidth:     { frameElement.setMarginWidth(str); return; }
    3043       case FrameName:            { frameElement.setName(str); return; }
    3044       case FrameNoResize:        { frameElement.setNoResize(value.toBoolean(exec)); return; }
    3045       case FrameScrolling:       { frameElement.setScrolling(str); return; }
    3046       case FrameSrc:             { frameElement.setSrc(str); return; }
    3047       case FrameLocation:        { frameElement.setLocation(str); return; }
    3048       }
    3049     }
    3050     break;
    3051     case ID_IFRAME: {
    3052       HTMLIFrameElementImpl &iFrame = static_cast<HTMLIFrameElementImpl &>(element);
    3053       switch (token) {
    3054       case IFrameAlign:           { iFrame.setAlign(str); return; }
    3055       // read-only: IFrameContentDocument
    3056       case IFrameFrameBorder:     { iFrame.setFrameBorder(str); return; }
    3057       case IFrameHeight:          { iFrame.setHeight(str); return; }
    3058       case IFrameLongDesc:        { iFrame.setLongDesc(str); return; }
    3059       case IFrameMarginHeight:    { iFrame.setMarginHeight(str); return; }
    3060       case IFrameMarginWidth:     { iFrame.setMarginWidth(str); return; }
    3061       case IFrameName:            { iFrame.setName(str); return; }
    3062       case IFrameScrolling:       { iFrame.setScrolling(str); return; }
    3063       case IFrameSrc:             { iFrame.setSrc(str); return; }
    3064       case IFrameWidth:           { iFrame.setWidth(str); return; }
    3065       }
    3066       break;
    3067     }
    3068   }
    3069 
    3070   // generic properties
    3071   switch (token) {
    3072   case ElementId:
    3073     element.setId(str);
    3074     return;
    3075   case ElementTitle:
    3076     element.setTitle(str);
    3077     return;
    3078   case ElementLang:
    3079     element.setLang(str);
    3080     return;
    3081   case ElementDir:
    3082     element.setDir(str);
    3083     return;
    3084   case ElementClassName:
    3085     element.setClassName(str);
    3086     return;
    3087   case ElementInnerHTML:
    3088     element.setInnerHTML(str, exception);
    3089     return;
    3090   case ElementInnerText:
    3091     element.setInnerText(str, exception);
    3092     return;
    3093   case ElementOuterHTML:
    3094     element.setOuterHTML(str, exception);
    3095     return;
    3096   case ElementOuterText:
    3097     element.setOuterText(str, exception);
    3098     return;
    3099   case ElementContentEditable:
    3100     element.setContentEditable(str);
    3101     return;
    3102   default:
    3103     kdWarning() << "KJS::HTMLElement::putValue unhandled token " << token << " thisTag=" << element.tagName().string() << " str=" << str.string() << endl;
    3104   }
     2693                                    }
     2694        // read-only: form
     2695        // read-only: options
     2696        case SelectDisabled:        { select.setDisabled(value.toBoolean(exec)); return; }
     2697        case SelectMultiple:        { select.setMultiple(value.toBoolean(exec)); return; }
     2698        case SelectName:            { select.setName(str); return; }
     2699        case SelectSize:            { select.setSize(value.toInt32(exec)); return; }
     2700        case SelectTabIndex:        { select.setTabIndex(value.toInt32(exec)); return; }
     2701    }
     2702}
     2703
     2704void HTMLElement::optGroupSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2705{
     2706    HTMLOptGroupElementImpl& optgroup = *static_cast<HTMLOptGroupElementImpl*>(impl());
     2707    switch (token) {
     2708        case OptGroupDisabled:        { optgroup.setDisabled(value.toBoolean(exec)); return; }
     2709        case OptGroupLabel:           { optgroup.setLabel(str); return; }
     2710    }
     2711}
     2712
     2713void HTMLElement::optionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2714{
     2715    DOMExceptionTranslator exception(exec);
     2716    HTMLOptionElementImpl& option = *static_cast<HTMLOptionElementImpl*>(impl());
     2717    switch (token) {
     2718        // read-only: form
     2719        case OptionDefaultSelected: { option.setDefaultSelected(value.toBoolean(exec)); return; }
     2720        case OptionText:            { option.setText(str, exception); return; }
     2721        // read-only: index
     2722        case OptionDisabled:        { option.setDisabled(value.toBoolean(exec)); return; }
     2723        case OptionLabel:           { option.setLabel(str); return; }
     2724        case OptionSelected:        { option.setSelected(value.toBoolean(exec)); return; }
     2725        case OptionValue:           { option.setValue(str); return; }
     2726    }
     2727}
     2728
     2729void HTMLElement::inputSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2730{
     2731    HTMLInputElementImpl& input = *static_cast<HTMLInputElementImpl*>(impl());
     2732    switch (token) {
     2733        case InputDefaultValue:    { input.setDefaultValue(str); return; }
     2734        case InputDefaultChecked:  { input.setDefaultChecked(value.toBoolean(exec)); return; }
     2735        // read-only: form
     2736        case InputAccept:          { input.setAccept(str); return; }
     2737        case InputAccessKey:       { input.setAccessKey(str); return; }
     2738        case InputAlign:           { input.setAlign(str); return; }
     2739        case InputAlt:             { input.setAlt(str); return; }
     2740        case InputChecked:         { input.setChecked(value.toBoolean(exec)); return; }
     2741        case InputDisabled:        { input.setDisabled(value.toBoolean(exec)); return; }
     2742        case InputMaxLength:       { input.setMaxLength(value.toInt32(exec)); return; }
     2743        case InputName:            { input.setName(str); return; }
     2744        case InputReadOnly:        { input.setReadOnly(value.toBoolean(exec)); return; }
     2745        case InputSize:            { input.setSize(str); return; }
     2746        case InputSelectionStart:  { input.setSelectionStart(value.toInt32(exec)); return; }
     2747        case InputSelectionEnd:    { input.setSelectionEnd(value.toInt32(exec)); return; }
     2748        case InputSrc:             { input.setSrc(str); return; }
     2749        case InputTabIndex:        { input.setTabIndex(value.toInt32(exec)); return; }
     2750        case InputType:            { input.setType(str); return; }
     2751        case InputUseMap:          { input.setUseMap(str); return; }
     2752        case InputValue:           { input.setValue(str); return; }
     2753    }
     2754}
     2755
     2756void HTMLElement::textAreaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2757{
     2758    HTMLTextAreaElementImpl& textarea = *static_cast<HTMLTextAreaElementImpl*>(impl());
     2759    switch (token) {
     2760        case TextAreaDefaultValue:    { textarea.setDefaultValue(str); return; }
     2761        // read-only: form
     2762        case TextAreaAccessKey:       { textarea.setAccessKey(str); return; }
     2763        case TextAreaCols:            { textarea.setCols(value.toInt32(exec)); return; }
     2764        case TextAreaDisabled:        { textarea.setDisabled(value.toBoolean(exec)); return; }
     2765        case TextAreaName:            { textarea.setName(str); return; }
     2766        case TextAreaReadOnly:        { textarea.setReadOnly(value.toBoolean(exec)); return; }
     2767        case TextAreaRows:            { textarea.setRows(value.toInt32(exec)); return; }
     2768        case TextAreaSelectionStart:  { textarea.setSelectionStart(value.toInt32(exec)); return; }
     2769        case TextAreaSelectionEnd:    { textarea.setSelectionEnd(value.toInt32(exec)); return; }
     2770        case TextAreaTabIndex:        { textarea.setTabIndex(value.toInt32(exec)); return; }
     2771        // read-only: type
     2772        case TextAreaValue:           { textarea.setValue(str); return; }
     2773    }
     2774}
     2775
     2776void HTMLElement::buttonSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2777{
     2778    HTMLButtonElementImpl& button = *static_cast<HTMLButtonElementImpl*>(impl());
     2779    switch (token) {
     2780        // read-only: form
     2781        case ButtonAccessKey:       { button.setAccessKey(str); return; }
     2782        case ButtonDisabled:        { button.setDisabled(value.toBoolean(exec)); return; }
     2783        case ButtonName:            { button.setName(str); return; }
     2784        case ButtonTabIndex:        { button.setTabIndex(value.toInt32(exec)); return; }
     2785        // read-only: type
     2786        case ButtonValue:           { button.setValue(str); return; }
     2787    }
     2788}
     2789
     2790void HTMLElement::labelSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2791{
     2792    HTMLLabelElementImpl& label = *static_cast<HTMLLabelElementImpl*>(impl());
     2793    switch (token) {
     2794        // read-only: form
     2795        case LabelAccessKey:       { label.setAccessKey(str); return; }
     2796        case LabelHtmlFor:         { label.setHtmlFor(str); return; }
     2797    }
     2798}
     2799
     2800void HTMLElement::fieldSetSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2801{
     2802}
     2803
     2804void HTMLElement::legendSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2805{
     2806    HTMLLegendElementImpl& legend = *static_cast<HTMLLegendElementImpl*>(impl());
     2807    switch (token) {
     2808        // read-only: form
     2809        case LegendAccessKey:       { legend.setAccessKey(str); return; }
     2810        case LegendAlign:           { legend.setAlign(str); return; }
     2811    }
     2812}
     2813
     2814void HTMLElement::uListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2815{
     2816    HTMLUListElementImpl& uList = *static_cast<HTMLUListElementImpl*>(impl());
     2817    switch (token) {
     2818        case UListCompact:         { uList.setCompact(value.toBoolean(exec)); return; }
     2819        case UListType:            { uList.setType(str); return; }
     2820    }
     2821}
     2822
     2823void HTMLElement::oListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2824{
     2825    HTMLOListElementImpl& oList = *static_cast<HTMLOListElementImpl*>(impl());
     2826    switch (token) {
     2827        case OListCompact:         { oList.setCompact(value.toBoolean(exec)); return; }
     2828        case OListStart:           { oList.setStart(value.toInt32(exec)); return; }
     2829        case OListType:            { oList.setType(str); return; }
     2830    }
     2831}
     2832
     2833void HTMLElement::dListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2834{
     2835    HTMLDListElementImpl& dList = *static_cast<HTMLDListElementImpl*>(impl());
     2836    if (token == DListCompact)
     2837        dList.setCompact(value.toBoolean(exec));
     2838}
     2839
     2840void HTMLElement::dirSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2841{
     2842    HTMLDirectoryElementImpl& directory = *static_cast<HTMLDirectoryElementImpl*>(impl());
     2843    if (token == DirectoryCompact)
     2844        directory.setCompact(value.toBoolean(exec));
     2845}
     2846
     2847void HTMLElement::menuSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2848{
     2849    HTMLMenuElementImpl& menu = *static_cast<HTMLMenuElementImpl*>(impl());
     2850    if (token == MenuCompact)
     2851        menu.setCompact(value.toBoolean(exec));
     2852}
     2853
     2854void HTMLElement::liSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2855{
     2856    HTMLLIElementImpl& li = *static_cast<HTMLLIElementImpl*>(impl());
     2857    switch (token) {
     2858        case LIType:            { li.setType(str); return; }
     2859        case LIValue:           { li.setValue(value.toInt32(exec)); return; }
     2860    }
     2861}
     2862
     2863void HTMLElement::divSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2864{
     2865    HTMLDivElementImpl& div = *static_cast<HTMLDivElementImpl*>(impl());
     2866    if (token == DivAlign)
     2867        div.setAlign(str);
     2868}
     2869
     2870void HTMLElement::paragraphSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2871{
     2872    HTMLParagraphElementImpl& paragraph = *static_cast<HTMLParagraphElementImpl*>(impl());
     2873    if (token == ParagraphAlign)
     2874        paragraph.setAlign(str);
     2875}
     2876
     2877void HTMLElement::headingSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2878{
     2879    HTMLHeadingElementImpl& heading = *static_cast<HTMLHeadingElementImpl*>(impl());
     2880    if (token == HeadingAlign)
     2881        heading.setAlign(str);
     2882}
     2883
     2884void HTMLElement::blockQuoteSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2885{
     2886    HTMLBlockquoteElementImpl& blockQuote = *static_cast<HTMLBlockquoteElementImpl*>(impl());
     2887    if (token == BlockQuoteCite)
     2888        blockQuote.setCite(str);
     2889}
     2890
     2891void HTMLElement::quoteSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2892{
     2893    HTMLQuoteElementImpl& quote = *static_cast<HTMLQuoteElementImpl*>(impl());
     2894    if (token == QuoteCite)
     2895        quote.setCite(str);
     2896}
     2897
     2898void HTMLElement::preSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2899{
     2900    // FIXME: Add support for 'wrap' when white-space: pre-wrap is implemented.
     2901    HTMLPreElementImpl& pre = *static_cast<HTMLPreElementImpl*>(impl());
     2902    if (token == PreWidth)
     2903        pre.setWidth(value.toInt32(exec));
     2904}
     2905
     2906void HTMLElement::brSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2907{
     2908    HTMLBRElementImpl& br = *static_cast<HTMLBRElementImpl*>(impl());
     2909    if (token == BRClear)
     2910        br.setClear(str);
     2911}
     2912
     2913void HTMLElement::baseFontSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2914{
     2915    HTMLBaseFontElementImpl& baseFont = *static_cast<HTMLBaseFontElementImpl*>(impl());
     2916    switch (token) {
     2917        case BaseFontColor:           { baseFont.setColor(str); return; }
     2918        case BaseFontFace:            { baseFont.setFace(str); return; }
     2919        case BaseFontSize:            { baseFont.setSize(str); return; }
     2920    }
     2921}
     2922
     2923void HTMLElement::fontSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2924{
     2925    HTMLFontElementImpl& font = *static_cast<HTMLFontElementImpl*>(impl());
     2926    switch (token) {
     2927        case FontColor:           { font.setColor(str); return; }
     2928        case FontFace:            { font.setFace(str); return; }
     2929        case FontSize:            { font.setSize(str); return; }
     2930    }
     2931}
     2932
     2933void HTMLElement::hrSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2934{
     2935    HTMLHRElementImpl& hr = *static_cast<HTMLHRElementImpl*>(impl());
     2936    switch (token) {
     2937        case HRAlign:           { hr.setAlign(str); return; }
     2938        case HRNoShade:         { hr.setNoShade(value.toBoolean(exec)); return; }
     2939        case HRSize:            { hr.setSize(str); return; }
     2940        case HRWidth:           { hr.setWidth(str); return; }
     2941    }
     2942}
     2943
     2944void HTMLElement::modSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2945{
     2946    HTMLModElementImpl& mod = *static_cast<HTMLModElementImpl*>(impl());
     2947    switch (token) {
     2948        case ModCite:            { mod.setCite(str); return; }
     2949        case ModDateTime:        { mod.setDateTime(str); return; }
     2950    }
     2951}
     2952
     2953void HTMLElement::anchorSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2954{
     2955    HTMLAnchorElementImpl& anchor = *static_cast<HTMLAnchorElementImpl*>(impl());
     2956    switch (token) {
     2957        case AnchorAccessKey:       { anchor.setAccessKey(str); return; }
     2958        case AnchorCharset:         { anchor.setCharset(str); return; }
     2959        case AnchorCoords:          { anchor.setCoords(str); return; }
     2960        case AnchorHref:            { anchor.setHref(str); return; }
     2961        case AnchorHrefLang:        { anchor.setHreflang(str); return; }
     2962        case AnchorName:            { anchor.setName(str); return; }
     2963        case AnchorRel:             { anchor.setRel(str); return; }
     2964        case AnchorRev:             { anchor.setRev(str); return; }
     2965        case AnchorShape:           { anchor.setShape(str); return; }
     2966        case AnchorTabIndex:        { anchor.setTabIndex(value.toInt32(exec)); return; }
     2967        case AnchorTarget:          { anchor.setTarget(str); return; }
     2968        case AnchorType:            { anchor.setType(str); return; }
     2969    }
     2970}
     2971
     2972void HTMLElement::imageSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2973{
     2974    HTMLImageElementImpl& image = *static_cast<HTMLImageElementImpl*>(impl());
     2975    switch (token) {
     2976        case ImageName:            { image.setName(str); return; }
     2977        case ImageAlign:           { image.setAlign(str); return; }
     2978        case ImageAlt:             { image.setAlt(str); return; }
     2979        case ImageBorder:          { image.setBorder(value.toInt32(exec)); return; }
     2980        case ImageHeight:          { image.setHeight(value.toInt32(exec)); return; }
     2981        case ImageHspace:          { image.setHspace(value.toInt32(exec)); return; }
     2982        case ImageIsMap:           { image.setIsMap(value.toBoolean(exec)); return; }
     2983        case ImageLongDesc:        { image.setLongDesc(str); return; }
     2984        case ImageSrc:             { image.setSrc(str); return; }
     2985        case ImageUseMap:          { image.setUseMap(str); return; }
     2986        case ImageVspace:          { image.setVspace(value.toInt32(exec)); return; }
     2987        case ImageWidth:           { image.setWidth(value.toInt32(exec)); return; }
     2988    }
     2989}
     2990
     2991void HTMLElement::objectSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     2992{
     2993    HTMLObjectElementImpl& object = *static_cast<HTMLObjectElementImpl*>(impl());
     2994    switch (token) {
     2995        // read-only: form
     2996        case ObjectCode:            { object.setCode(str); return; }
     2997        case ObjectAlign:           { object.setAlign(str); return; }
     2998        case ObjectArchive:         { object.setArchive(str); return; }
     2999        case ObjectBorder:          { object.setBorder(str); return; }
     3000        case ObjectCodeBase:        { object.setCodeBase(str); return; }
     3001        case ObjectCodeType:        { object.setCodeType(str); return; }
     3002        // read-only: ObjectContentDocument
     3003        case ObjectData:            { object.setData(str); return; }
     3004        case ObjectDeclare:         { object.setDeclare(value.toBoolean(exec)); return; }
     3005        case ObjectHeight:          { object.setHeight(str); return; }
     3006        case ObjectHspace:          { object.setHspace(str); return; }
     3007        case ObjectName:            { object.setName(str); return; }
     3008        case ObjectStandby:         { object.setStandby(str); return; }
     3009        case ObjectTabIndex:        { object.setTabIndex(value.toInt32(exec)); return; }
     3010        case ObjectType:            { object.setType(str); return; }
     3011        case ObjectUseMap:          { object.setUseMap(str); return; }
     3012        case ObjectVspace:          { object.setVspace(str); return; }
     3013        case ObjectWidth:           { object.setWidth(str); return; }
     3014    }
     3015}
     3016
     3017void HTMLElement::paramSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     3018{
     3019    HTMLParamElementImpl& param = *static_cast<HTMLParamElementImpl*>(impl());
     3020    switch (token) {
     3021        case ParamName:            { param.setName(str); return; }
     3022        case ParamType:            { param.setType(str); return; }
     3023        case ParamValue:           { param.setValue(str); return; }
     3024        case ParamValueType:       { param.setValueType(str); return; }
     3025    }
     3026}
     3027
     3028void HTMLElement::appletSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     3029{
     3030    HTMLAppletElementImpl& applet = *static_cast<HTMLAppletElementImpl*>(impl());
     3031    switch (token) {
     3032        case AppletAlign:           { applet.setAlign(str); return; }
     3033        case AppletAlt:             { applet.setAlt(str); return; }
     3034        case AppletArchive:         { applet.setArchive(str); return; }
     3035        case AppletCode:            { applet.setCode(str); return; }
     3036        case AppletCodeBase:        { applet.setCodeBase(str); return; }
     3037        case AppletHeight:          { applet.setHeight(str); return; }
     3038        case AppletHspace:          { applet.setHspace(str); return; }
     3039        case AppletName:            { applet.setName(str); return; }
     3040        case AppletObject:          { applet.setObject(str); return; }
     3041        case AppletVspace:          { applet.setVspace(str); return; }
     3042        case AppletWidth:           { applet.setWidth(str); return; }
     3043    }
     3044}
     3045
     3046void HTMLElement::mapSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     3047{
     3048    HTMLMapElementImpl& map = *static_cast<HTMLMapElementImpl*>(impl());
     3049    if (token == MapName)
     3050        // read-only: areas
     3051        map.setName(str);
     3052}
     3053
     3054void HTMLElement::areaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     3055{
     3056    HTMLAreaElementImpl& area = *static_cast<HTMLAreaElementImpl*>(impl());
     3057    switch (token) {
     3058        case AreaAccessKey:       { area.setAccessKey(str); return; }
     3059        case AreaAlt:             { area.setAlt(str); return; }
     3060        case AreaCoords:          { area.setCoords(str); return; }
     3061        case AreaHref:            { area.setHref(str); return; }
     3062        case AreaNoHref:          { area.setNoHref(value.toBoolean(exec)); return; }
     3063        case AreaShape:           { area.setShape(str); return; }
     3064        case AreaTabIndex:        { area.setTabIndex(value.toInt32(exec)); return; }
     3065        case AreaTarget:          { area.setTarget(str); return; }
     3066    }
     3067}
     3068
     3069void HTMLElement::scriptSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     3070{
     3071    HTMLScriptElementImpl& script = *static_cast<HTMLScriptElementImpl*>(impl());
     3072    switch (token) {
     3073        case ScriptText:            { script.setText(str); return; }
     3074        case ScriptHtmlFor:         { script.setHtmlFor(str); return; }
     3075        case ScriptEvent:           { script.setEvent(str); return; }
     3076        case ScriptCharset:         { script.setCharset(str); return; }
     3077        case ScriptDefer:           { script.setDefer(value.toBoolean(exec)); return; }
     3078        case ScriptSrc:             { script.setSrc(str); return; }
     3079        case ScriptType:            { script.setType(str); return; }
     3080    }
     3081}
     3082
     3083void HTMLElement::tableSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     3084{
     3085    HTMLTableElementImpl& table = *static_cast<HTMLTableElementImpl*>(impl());
     3086    switch (token) {
     3087        case TableCaption:         { table.setCaption(toHTMLTableCaptionElement(value)); return; }
     3088        case TableTHead:           { table.setTHead(toHTMLTableSectionElement(value)); return; }
     3089        case TableTFoot:           { table.setTFoot(toHTMLTableSectionElement(value)); return; }
     3090        // read-only: rows
     3091        // read-only: tbodies
     3092        case TableAlign:           { table.setAlign(str); return; }
     3093        case TableBgColor:         { table.setBgColor(str); return; }
     3094        case TableBorder:          { table.setBorder(str); return; }
     3095        case TableCellPadding:     { table.setCellPadding(str); return; }
     3096        case TableCellSpacing:     { table.setCellSpacing(str); return; }
     3097        case TableFrame:           { table.setFrame(str); return; }
     3098        case TableRules:           { table.setRules(str); return; }
     3099        case TableSummary:         { table.setSummary(str); return; }
     3100        case TableWidth:           { table.setWidth(str); return; }
     3101    }
     3102}
     3103
     3104void HTMLElement::tableCaptionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     3105{
     3106    HTMLTableCaptionElementImpl& tableCaption = *static_cast<HTMLTableCaptionElementImpl*>(impl());
     3107    if (token == TableCaptionAlign)
     3108        tableCaption.setAlign(str);
     3109}
     3110
     3111void HTMLElement::tableColSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     3112{
     3113    HTMLTableColElementImpl& tableCol = *static_cast<HTMLTableColElementImpl*>(impl());
     3114    switch (token) {
     3115        case TableColAlign:           { tableCol.setAlign(str); return; }
     3116        case TableColCh:              { tableCol.setCh(str); return; }
     3117        case TableColChOff:           { tableCol.setChOff(str); return; }
     3118        case TableColSpan:            { tableCol.setSpan(value.toInt32(exec)); return; }
     3119        case TableColVAlign:          { tableCol.setVAlign(str); return; }
     3120        case TableColWidth:           { tableCol.setWidth(str); return; }
     3121    }
     3122}
     3123
     3124void HTMLElement::tableSectionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     3125{
     3126    HTMLTableSectionElementImpl& tableSection = *static_cast<HTMLTableSectionElementImpl*>(impl());
     3127    switch (token) {
     3128        case TableSectionAlign:           { tableSection.setAlign(str); return; }
     3129        case TableSectionCh:              { tableSection.setCh(str); return; }
     3130        case TableSectionChOff:           { tableSection.setChOff(str); return; }
     3131        case TableSectionVAlign:          { tableSection.setVAlign(str); return; }
     3132        // read-only: rows
     3133    }
     3134}
     3135
     3136void HTMLElement::tableRowSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     3137{
     3138    HTMLTableRowElementImpl& tableRow = *static_cast<HTMLTableRowElementImpl*>(impl());
     3139    switch (token) {
     3140        // read-only: rowIndex
     3141        // read-only: sectionRowIndex
     3142        // read-only: cells
     3143        case TableRowAlign:           { tableRow.setAlign(str); return; }
     3144        case TableRowBgColor:         { tableRow.setBgColor(str); return; }
     3145        case TableRowCh:              { tableRow.setCh(str); return; }
     3146        case TableRowChOff:           { tableRow.setChOff(str); return; }
     3147        case TableRowVAlign:          { tableRow.setVAlign(str); return; }
     3148    }
     3149}
     3150
     3151void HTMLElement::tableCellSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     3152{
     3153    HTMLTableCellElementImpl& tableCell = *static_cast<HTMLTableCellElementImpl*>(impl());
     3154    switch (token) {
     3155        // read-only: cellIndex
     3156        case TableCellAbbr:            { tableCell.setAbbr(str); return; }
     3157        case TableCellAlign:           { tableCell.setAlign(str); return; }
     3158        case TableCellAxis:            { tableCell.setAxis(str); return; }
     3159        case TableCellBgColor:         { tableCell.setBgColor(str); return; }
     3160        case TableCellCh:              { tableCell.setCh(str); return; }
     3161        case TableCellChOff:           { tableCell.setChOff(str); return; }
     3162        case TableCellColSpan:         { tableCell.setColSpan(value.toInt32(exec)); return; }
     3163        case TableCellHeaders:         { tableCell.setHeaders(str); return; }
     3164        case TableCellHeight:          { tableCell.setHeight(str); return; }
     3165        case TableCellNoWrap:          { tableCell.setNoWrap(value.toBoolean(exec)); return; }
     3166        case TableCellRowSpan:         { tableCell.setRowSpan(value.toInt32(exec)); return; }
     3167        case TableCellScope:           { tableCell.setScope(str); return; }
     3168        case TableCellVAlign:          { tableCell.setVAlign(str); return; }
     3169        case TableCellWidth:           { tableCell.setWidth(str); return; }
     3170    }
     3171}
     3172
     3173void HTMLElement::frameSetSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     3174{
     3175    HTMLFrameSetElementImpl& frameSet = *static_cast<HTMLFrameSetElementImpl*>(impl());
     3176    switch (token) {
     3177        case FrameSetCols:            { frameSet.setCols(str); return; }
     3178        case FrameSetRows:            { frameSet.setRows(str); return; }
     3179    }
     3180}
     3181
     3182void HTMLElement::frameSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     3183{
     3184    HTMLFrameElementImpl& frameElement = *static_cast<HTMLFrameElementImpl*>(impl());
     3185    switch (token) {
     3186        // read-only: FrameContentDocument:
     3187        case FrameFrameBorder:     { frameElement.setFrameBorder(str); return; }
     3188        case FrameLongDesc:        { frameElement.setLongDesc(str); return; }
     3189        case FrameMarginHeight:    { frameElement.setMarginHeight(str); return; }
     3190        case FrameMarginWidth:     { frameElement.setMarginWidth(str); return; }
     3191        case FrameName:            { frameElement.setName(str); return; }
     3192        case FrameNoResize:        { frameElement.setNoResize(value.toBoolean(exec)); return; }
     3193        case FrameScrolling:       { frameElement.setScrolling(str); return; }
     3194        case FrameSrc:             { frameElement.setSrc(str); return; }
     3195        case FrameLocation:        { frameElement.setLocation(str); return; }
     3196    }
     3197}
     3198
     3199void HTMLElement::iFrameSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     3200{
     3201    HTMLIFrameElementImpl& iFrame = *static_cast<HTMLIFrameElementImpl*>(impl());
     3202    switch (token) {
     3203        case IFrameAlign:           { iFrame.setAlign(str); return; }
     3204        // read-only: IFrameContentDocument
     3205        case IFrameFrameBorder:     { iFrame.setFrameBorder(str); return; }
     3206        case IFrameHeight:          { iFrame.setHeight(str); return; }
     3207        case IFrameLongDesc:        { iFrame.setLongDesc(str); return; }
     3208        case IFrameMarginHeight:    { iFrame.setMarginHeight(str); return; }
     3209        case IFrameMarginWidth:     { iFrame.setMarginWidth(str); return; }
     3210        case IFrameName:            { iFrame.setName(str); return; }
     3211        case IFrameScrolling:       { iFrame.setScrolling(str); return; }
     3212        case IFrameSrc:             { iFrame.setSrc(str); return; }
     3213        case IFrameWidth:           { iFrame.setWidth(str); return; }
     3214    }
     3215}
     3216
     3217void HTMLElement::marqueeSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
     3218{
     3219    // FIXME: Find out what WinIE supports and implement it.
     3220}
     3221
     3222void HTMLElement::putValue(ExecState *exec, int token, const Value& value, int)
     3223{
     3224    DOMExceptionTranslator exception(exec);
     3225    DOM::DOMString str = value.isA(NullType) ? DOM::DOMString() : value.toString(exec).string();
     3226 
     3227    // Check our set of generic properties first.
     3228    HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
     3229    switch (token) {
     3230        case ElementId:
     3231            element.setId(str);
     3232            return;
     3233        case ElementTitle:
     3234            element.setTitle(str);
     3235            return;
     3236        case ElementLang:
     3237            element.setLang(str);
     3238            return;
     3239        case ElementDir:
     3240            element.setDir(str);
     3241            return;
     3242        case ElementClassName:
     3243            element.setClassName(str);
     3244            return;
     3245        case ElementInnerHTML:
     3246            element.setInnerHTML(str, exception);
     3247            return;
     3248        case ElementInnerText:
     3249            element.setInnerText(str, exception);
     3250            return;
     3251        case ElementOuterHTML:
     3252            element.setOuterHTML(str, exception);
     3253            return;
     3254        case ElementOuterText:
     3255            element.setOuterText(str, exception);
     3256            return;
     3257        case ElementContentEditable:
     3258            element.setContentEditable(str);
     3259            return;
     3260    }
     3261
     3262    // Now check for properties that apply to a specific element type.
     3263    const Accessors* info = getSetInfo();
     3264    if (info && info->m_setter)
     3265        return (this->*(info->m_setter))(exec, token, value, str); 
    31053266}
    31063267
     
    31143275HTMLTableCaptionElementImpl *toHTMLTableCaptionElement(ValueImp *val)
    31153276{
    3116     if (HTMLElementImpl *e = toHTMLElement(val))
    3117         switch (e->id()) {
    3118             case ID_CAPTION:
    3119                 return static_cast<HTMLTableCaptionElementImpl *>(e);
    3120         }
     3277    HTMLElementImpl *e = toHTMLElement(val);
     3278    if (e && e->hasTagName(HTMLNames::caption()))
     3279        return static_cast<HTMLTableCaptionElementImpl *>(e);
    31213280    return 0;
    31223281}
     
    31243283HTMLTableSectionElementImpl *toHTMLTableSectionElement(ValueImp *val)
    31253284{
    3126     if (HTMLElementImpl *e = toHTMLElement(val))
    3127         switch (e->id()) {
    3128             case ID_THEAD:
    3129             case ID_TBODY:
    3130             case ID_TFOOT:
    3131                 return static_cast<HTMLTableSectionElementImpl *>(e);
    3132         }
     3285    HTMLElementImpl *e = toHTMLElement(val);
     3286    if (e && (e->hasTagName(HTMLNames::thead()) || e->hasTagName(HTMLNames::tbody()) || e->hasTagName(HTMLNames::tfoot())))
     3287        return static_cast<HTMLTableSectionElementImpl *>(e);
    31333288    return 0;
    31343289}
     
    31793334    // NON-STANDARD options.selectedIndex
    31803335    NodeImpl *option = collection.item(0);
    3181     if (option->id() == ID_OPTION) {
     3336    if (option->hasTagName(HTMLNames::option())) {
    31823337      NodeImpl *select = option;
    31833338      while ((select = select->parentNode()))
    3184         if (select->id() == ID_SELECT)
     3339        if (select->hasTagName(HTMLNames::select()))
    31853340          return Number(static_cast<HTMLSelectElementImpl *>(select)->selectedIndex());
    31863341    }
     
    33703525  // is v an option element ?
    33713526  NodeImpl *option = toNode(value);
    3372   if (!option || option->id() != ID_OPTION)
     3527  if (!option || !option->hasTagName(HTMLNames::option()))
    33733528    return;
    33743529
  • trunk/WebCore/khtml/ecma/kjs_html.h

    r9582 r9639  
    8585      caption_info, col_info, tablesection_info, tr_info,
    8686      tablecell_info, frameSet_info, frame_info, iFrame_info, marquee_info;
     87
     88    // FIXME: Might make sense to combine this with ClassInfo some day.
     89    typedef Value (HTMLElement::*GetterFunction)(ExecState *exec, int token) const;
     90    typedef void (HTMLElement::*SetterFunction)(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     91    struct Accessors { GetterFunction m_getter; SetterFunction m_setter; };
     92    const Accessors* getSetInfo() const;
     93    static const Accessors html_accessors, head_accessors, link_accessors, title_accessors,
     94      meta_accessors, base_accessors, isIndex_accessors, style_accessors, body_accessors, form_accessors,
     95      select_accessors, optGroup_accessors, option_accessors, input_accessors, textArea_accessors,
     96      button_accessors, label_accessors, fieldSet_accessors, legend_accessors, ul_accessors, ol_accessors,
     97      dl_accessors, dir_accessors, menu_accessors, li_accessors, div_accessors, p_accessors, heading_accessors,
     98      blockQuote_accessors, q_accessors, pre_accessors, br_accessors, baseFont_accessors, font_accessors,
     99      hr_accessors, mod_accessors, a_accessors, canvas_accessors, img_accessors, object_accessors, param_accessors,
     100      applet_accessors, map_accessors, area_accessors, script_accessors, table_accessors,
     101      caption_accessors, col_accessors, tablesection_accessors, tr_accessors,
     102      tablecell_accessors, frameSet_accessors, frame_accessors, iFrame_accessors, marquee_accessors;
     103
     104    Value htmlGetter(ExecState* exec, int token) const;
     105    void  htmlSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     106    Value headGetter(ExecState* exec, int token) const;
     107    void  headSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     108    Value linkGetter(ExecState* exec, int token) const;
     109    void  linkSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     110    Value titleGetter(ExecState* exec, int token) const;
     111    void  titleSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     112    Value metaGetter(ExecState* exec, int token) const;
     113    void  metaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     114    Value baseGetter(ExecState* exec, int token) const;
     115    void  baseSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     116    Value isIndexGetter(ExecState* exec, int token) const;
     117    void  isIndexSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     118    Value styleGetter(ExecState* exec, int token) const;
     119    void  styleSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     120    Value bodyGetter(ExecState* exec, int token) const;
     121    void  bodySetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     122    Value formGetter(ExecState* exec, int token) const;
     123    void  formSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     124    Value selectGetter(ExecState* exec, int token) const;
     125    void  selectSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     126    Value optGroupGetter(ExecState* exec, int token) const;
     127    void  optGroupSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     128    Value optionGetter(ExecState* exec, int token) const;
     129    void  optionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     130    Value inputGetter(ExecState* exec, int token) const;
     131    void  inputSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     132    Value textAreaGetter(ExecState* exec, int token) const;
     133    void  textAreaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     134    Value buttonGetter(ExecState* exec, int token) const;
     135    void  buttonSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     136    Value labelGetter(ExecState* exec, int token) const;
     137    void  labelSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     138    Value fieldSetGetter(ExecState* exec, int token) const;
     139    void  fieldSetSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     140    Value legendGetter(ExecState* exec, int token) const;
     141    void  legendSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     142    Value uListGetter(ExecState* exec, int token) const;
     143    void  uListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     144    Value oListGetter(ExecState* exec, int token) const;
     145    void  oListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     146    Value dListGetter(ExecState* exec, int token) const;
     147    void  dListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     148    Value dirGetter(ExecState* exec, int token) const;
     149    void  dirSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     150    Value menuGetter(ExecState* exec, int token) const;
     151    void  menuSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     152    Value liGetter(ExecState* exec, int token) const;
     153    void  liSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     154    Value divGetter(ExecState* exec, int token) const;
     155    void  divSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     156    Value paragraphGetter(ExecState* exec, int token) const;
     157    void  paragraphSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     158    Value headingGetter(ExecState* exec, int token) const;
     159    void  headingSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     160    Value blockQuoteGetter(ExecState* exec, int token) const;
     161    void  blockQuoteSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     162    Value quoteGetter(ExecState* exec, int token) const;
     163    void  quoteSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     164    Value preGetter(ExecState* exec, int token) const;
     165    void  preSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     166    Value brGetter(ExecState* exec, int token) const;
     167    void  brSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     168    Value baseFontGetter(ExecState* exec, int token) const;
     169    void  baseFontSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     170    Value fontGetter(ExecState* exec, int token) const;
     171    void  fontSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     172    Value hrGetter(ExecState* exec, int token) const;
     173    void  hrSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     174    Value modGetter(ExecState* exec, int token) const;
     175    void  modSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     176    Value anchorGetter(ExecState* exec, int token) const;
     177    void  anchorSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     178    Value imageGetter(ExecState* exec, int token) const;
     179    void  imageSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     180    Value objectGetter(ExecState* exec, int token) const;
     181    void  objectSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     182    Value paramGetter(ExecState* exec, int token) const;
     183    void  paramSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     184    Value appletGetter(ExecState* exec, int token) const;
     185    void  appletSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     186    Value mapGetter(ExecState* exec, int token) const;
     187    void  mapSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     188    Value areaGetter(ExecState* exec, int token) const;
     189    void  areaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     190    Value scriptGetter(ExecState* exec, int token) const;
     191    void  scriptSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     192    Value tableGetter(ExecState* exec, int token) const;
     193    void  tableSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     194    Value tableCaptionGetter(ExecState* exec, int token) const;
     195    void  tableCaptionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     196    Value tableColGetter(ExecState* exec, int token) const;
     197    void  tableColSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     198    Value tableSectionGetter(ExecState* exec, int token) const;
     199    void  tableSectionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     200    Value tableRowGetter(ExecState* exec, int token) const;
     201    void  tableRowSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     202    Value tableCellGetter(ExecState* exec, int token) const;
     203    void  tableCellSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     204    Value frameSetGetter(ExecState* exec, int token) const;
     205    void  frameSetSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     206    Value frameGetter(ExecState* exec, int token) const;
     207    void  frameSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     208    Value iFrameGetter(ExecState* exec, int token) const;
     209    void  iFrameSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
     210    Value marqueeGetter(ExecState* exec, int token) const;
     211    void  marqueeSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
    87212
    88213    enum { HtmlVersion, HeadProfile, LinkHref, LinkRel, LinkMedia,
  • trunk/WebCore/khtml/ecma/kjs_window.cpp

    r9582 r9639  
    6969#include "css/css_ruleimpl.h"
    7070#include "css/css_stylesheetimpl.h"
    71 #include "misc/htmltags.h"
    7271
    7372// Must include <cmath> instead of <math.h> because of a bug in the
  • trunk/WebCore/khtml/editing/SelectionController.cpp

    r9476 r9639  
    3434#include "khtml_part.h"
    3535#include "khtmlview.h"
    36 #include "misc/htmltags.h"
    3736#include "rendering/render_object.h"
    3837#include "rendering/render_style.h"
     
    939938    if (r->node()->isElementNode()) {
    940939        ElementImpl *element = static_cast<ElementImpl *>(r->node());
    941         fprintf(stderr, "%s%s\n", selected ? "==> " : "    ", element->tagName().string().latin1());
     940        fprintf(stderr, "%s%s\n", selected ? "==> " : "    ", element->localName().string().latin1());
    942941    }
    943942    else if (r->isText()) {
  • trunk/WebCore/khtml/editing/apply_style_command.cpp

    r9595 r9639  
    3434#include "dom/dom_string.h"
    3535#include "html/html_elementimpl.h"
    36 #include "misc/htmltags.h"
     36#include "htmlnames.h"
    3737#include "misc/htmlattrs.h"
    3838#include "rendering/render_object.h"
     
    6666using DOM::RangeImpl;
    6767using DOM::TextImpl;
     68using DOM::HTMLNames;
    6869
    6970namespace khtml {
     
    250251
    251252    const HTMLElementImpl *elem = static_cast<const HTMLElementImpl *>(node);
    252     return elem->id() == ID_SPAN && elem->getAttribute(ATTR_CLASS) == styleSpanClassString();
     253    return elem->hasLocalName(HTMLNames::span()) && elem->getAttribute(ATTR_CLASS) == styleSpanClassString();
    253254}
    254255
    255256static bool isEmptyStyleSpan(const NodeImpl *node)
    256257{
    257     if (!node || !node->isHTMLElement() || node->id() != ID_SPAN)
     258    if (!node || !node->isHTMLElement() || !node->hasTagName(HTMLNames::span()))
    258259        return false;
    259260
     
    265266static bool isEmptyFontTag(const NodeImpl *node)
    266267{
    267     if (!node || node->id() != ID_FONT)
     268    if (!node || !node->hasTagName(HTMLNames::font()))
    268269        return false;
    269270
     
    276277{
    277278    int exceptionCode = 0;
    278     ElementImpl *fontNode = document->createHTMLElement("font", exceptionCode);
     279    ElementImpl *fontNode = document->createElementNS(HTMLNames::xhtmlNamespaceURI(), "font", exceptionCode);
    279280    ASSERT(exceptionCode == 0);
    280281    fontNode->setAttribute(ATTR_CLASS, styleSpanClassString());
     
    285286{
    286287    int exceptionCode = 0;
    287     ElementImpl *styleElement = document->createHTMLElement("SPAN", exceptionCode);
     288    ElementImpl *styleElement = document->createElementNS(HTMLNames::xhtmlNamespaceURI(), "span", exceptionCode);
    288289    ASSERT(exceptionCode == 0);
    289290    styleElement->setAttribute(ATTR_CLASS, styleSpanClassString());
     
    587588                    if (node == end.node() ||
    588589                        runStart->parentNode() != next->parentNode() ||
    589                         (next->isHTMLElement() && next->id() != ID_BR) ||
     590                        (next->isElementNode() && !next->hasTagName(HTMLNames::br())) ||
    590591                        (next->renderer() && !next->renderer()->isInline()))
    591592                        break;
     
    612613        switch ((*it).id()) {
    613614            case CSS_PROP_FONT_WEIGHT:
    614                 if (elem->id() == ID_B)
     615                if (elem->hasLocalName(HTMLNames::b()))
    615616                    return true;
    616617                break;
    617618            case CSS_PROP_FONT_STYLE:
    618                 if (elem->id() == ID_I)
     619                if (elem->hasLocalName(HTMLNames::i()))
    619620                    return true;
    620621        }
     
    639640    ASSERT(elem);
    640641
    641     if (elem->id() != ID_FONT)
     642    if (!elem->hasLocalName(HTMLNames::font()))
    642643        return;
    643644
     
    10481049    ElementImpl *secondElement = static_cast<ElementImpl *>(second);
    10491050   
    1050     if (firstElement->id() != secondElement->id())
     1051    if (!firstElement->tagName().matches(secondElement->tagName()))
    10511052        return false;
    10521053
     
    11301131    }
    11311132
    1132     if (!endNode->isElementNode() || endNode->id() == ID_BR)
     1133    if (!endNode->isElementNode() || endNode->hasTagName(HTMLNames::br()))
    11331134        return false;
    11341135
     
    12751276
    12761277    if (styleChange.applyBold()) {
    1277         ElementImpl *boldElement = document()->createHTMLElement("B", exceptionCode);
     1278        ElementImpl *boldElement = document()->createElementNS(HTMLNames::xhtmlNamespaceURI(), "b", exceptionCode);
    12781279        ASSERT(exceptionCode == 0);
    12791280        insertNodeBefore(boldElement, startNode);
     
    12821283
    12831284    if (styleChange.applyItalic()) {
    1284         ElementImpl *italicElement = document()->createHTMLElement("I", exceptionCode);
     1285        ElementImpl *italicElement = document()->createElementNS(HTMLNames::xhtmlNamespaceURI(), "i", exceptionCode);
    12851286        ASSERT(exceptionCode == 0);
    12861287        insertNodeBefore(italicElement, startNode);
  • trunk/WebCore/khtml/editing/break_blockquote_command.cpp

    r9196 r9639  
    2929#include "visible_position.h"
    3030
    31 #include "misc/htmltags.h"
     31#include "htmlnames.h"
    3232#include "xml/dom_elementimpl.h"
    3333#include "xml/dom_textimpl.h"
     
    4444using DOM::Position;
    4545using DOM::TextImpl;
     46using DOM::HTMLNames;
    4647
    4748namespace khtml {
     
    147148        if (startNode != topBlockquote) {
    148149            NodeImpl *n = startNode;
    149             startIsBR = n->id() == ID_BR;
     150            startIsBR = n->hasTagName(HTMLNames::br());
    150151            if (startIsBR)
    151152                n = n->nextSibling();
  • trunk/WebCore/khtml/editing/composite_edit_command.cpp

    r9196 r9639  
    4848
    4949#include "misc/htmlattrs.h"
    50 #include "misc/htmltags.h"
     50#include "htmlnames.h"
    5151#include "rendering/render_text.h"
    5252#include "xml/dom2_rangeimpl.h"
     
    6868using DOM::RangeImpl;
    6969using DOM::TextImpl;
     70using DOM::HTMLNames;
    7071
    7172namespace khtml {
     
    128129void CompositeEditCommand::insertNodeBefore(NodeImpl *insertChild, NodeImpl *refChild)
    129130{
    130     ASSERT(refChild->id() != ID_BODY);
     131    ASSERT(!refChild->hasTagName(HTMLNames::body()));
    131132    EditCommandPtr cmd(new InsertNodeBeforeCommand(document(), insertChild, refChild));
    132133    applyCommandToComposite(cmd);
     
    135136void CompositeEditCommand::insertNodeAfter(NodeImpl *insertChild, NodeImpl *refChild)
    136137{
    137     ASSERT(refChild->id() != ID_BODY);
     138    ASSERT(!refChild->hasTagName(HTMLNames::body()));
    138139    if (refChild->parentNode()->lastChild() == refChild) {
    139140        appendNode(insertChild, refChild->parentNode());
     
    546547    NodeImpl *startBlock = paragraphStart.node()->enclosingBlockFlowElement();
    547548    NodeImpl *newBlock = 0;
    548     if (startBlock->id() == ID_BODY || (isMailBlockquote(startBlock) && paragraphStart.node() != startBlock))
     549    if (startBlock->hasTagName(HTMLNames::body()) || (isMailBlockquote(startBlock) && paragraphStart.node() != startBlock))
    549550        newBlock = createDefaultParagraphElement(document());
    550551    else
     
    556557    NodeImpl *endNode = paragraphEnd.node();
    557558
    558     if (paragraphStart.node()->id() == ID_BODY) {
     559    if (paragraphStart.node()->hasTagName(HTMLNames::body())) {
    559560        insertNodeAt(newBlock, paragraphStart.node(), 0);
    560561    }
    561     else if (paragraphStart.node()->id() == ID_BR) {
     562    else if (paragraphStart.node()->hasTagName(HTMLNames::br())) {
    562563        insertNodeAfter(newBlock, paragraphStart.node());
    563564    }
     
    579580{
    580581    int exceptionCode = 0;
    581     ElementImpl *breakNode = document->createHTMLElement("br", exceptionCode);
     582    ElementImpl *breakNode = document->createElementNS(HTMLNames::xhtmlNamespaceURI(), "br", exceptionCode);
    582583    ASSERT(exceptionCode == 0);
    583584    breakNode->setAttribute(ATTR_CLASS, blockPlaceholderClassString());
  • trunk/WebCore/khtml/editing/delete_selection_command.cpp

    r9595 r9639  
    2929#include "htmlediting.h"
    3030#include "khtml_part.h"
    31 #include "misc/htmltags.h"
     31#include "htmlnames.h"
    3232#include "rendering/render_line.h"
    3333#include "rendering/render_object.h"
     
    5454using DOM::RangeImpl;
    5555using DOM::TextImpl;
     56using DOM::HTMLNames;
    5657
    5758namespace khtml {
     
    6263    // but here we also have to peek at the type of DOM node?
    6364    RenderObject *r = node->renderer();
    64     NodeImpl::Id nodeID = node->id();
    6565    return (r && r->isListItem())
    66         || (nodeID == ID_OL || nodeID == ID_UL || nodeID == ID_DD || nodeID == ID_DT || nodeID == ID_DIR || nodeID == ID_MENU);
     66        || node->hasTagName(HTMLNames::ol())
     67        || node->hasTagName(HTMLNames::ul())
     68        || node->hasTagName(HTMLNames::dd())
     69        || node->hasTagName(HTMLNames::dt())
     70        || node->hasTagName(HTMLNames::dir())
     71        || node->hasTagName(HTMLNames::menu());
    6772}
    6873
     
    278283{
    279284    // Check for special-case where the selection contains only a BR on a line by itself after another BR.
    280     bool upstreamStartIsBR = m_startNode->id() == ID_BR;
    281     bool downstreamStartIsBR = m_downstreamStart.node()->id() == ID_BR;
     285    bool upstreamStartIsBR = m_startNode->hasTagName(HTMLNames::br());
     286    bool downstreamStartIsBR = m_downstreamStart.node()->hasTagName(HTMLNames::br());
    282287    bool isBROnLineByItself = upstreamStartIsBR && downstreamStartIsBR && m_downstreamStart.node() == m_upstreamEnd.node();
    283288    if (isBROnLineByItself) {
     
    327332    // start block, otherwise delete the start block.
    328333    // A similar case is provided to cover selections starting in BR elements.
    329     if (startOffset == 1 && m_startNode && m_startNode->id() == ID_BR) {
     334    if (startOffset == 1 && m_startNode && m_startNode->hasTagName(HTMLNames::br())) {
    330335        setStartNode(m_startNode->traverseNextNode());
    331336        startOffset = 0;
    332337    }
    333     if (m_startBlock != m_endBlock && startOffset == 0 && m_startNode && m_startNode->id() == ID_BR && endAtEndOfBlock) {
     338    if (m_startBlock != m_endBlock && startOffset == 0 && m_startNode && m_startNode->hasTagName(HTMLNames::br()) && endAtEndOfBlock) {
    334339        // Don't delete the BR element
    335340        setStartNode(m_startNode->traverseNextNode());
     
    553558        node = node->nextSibling();
    554559        removeNode(moveNode);
    555         if (moveNode->id() == ID_BR && !moveNode->renderer()) {
     560        if (moveNode->hasTagName(HTMLNames::br()) && !moveNode->renderer()) {
    556561            // Just remove this node, and don't put it back.
    557562            // If the BR was not rendered (since it was at the end of a block, for instance),
     
    564569            insertNodeAfter(moveNode, refNode);
    565570        refNode = moveNode;
    566         if (moveNode->id() == ID_BR)
     571        if (moveNode->hasTagName(HTMLNames::br()))
    567572            break;
    568573    }
  • trunk/WebCore/khtml/editing/htmlediting.cpp

    r9595 r9639  
    4343#include "html_interchange.h"
    4444#include "htmlattrs.h"
    45 #include "htmltags.h"
     45#include "htmlnames.h"
    4646#include "khtml_part.h"
    4747#include "khtml_part.h"
     
    8282using DOM::TextImpl;
    8383using DOM::TreeWalkerImpl;
     84using DOM::HTMLNames;
    8485
    8586#if APPLE_CHANGES
     
    132133        return false;
    133134
    134     if (n->id() == ID_A && n->isLink())
    135         return true;
    136 
    137     if (n->id() == ID_UL || n->id() == ID_OL || n->id() == ID_DL)
     135    if (n->isLink())
     136        return true;
     137
     138    if (n->hasTagName(HTMLNames::ul()) || n->hasTagName(HTMLNames::ol()) || n->hasTagName(HTMLNames::dl()))
    138139        return true;
    139140
     
    268269    // static const DOMString defaultParagraphStyle("margin-top: 0; margin-bottom: 0");   
    269270    int exceptionCode = 0;
    270     ElementImpl *element = document->createHTMLElement("div", exceptionCode);
     271    ElementImpl *element = document->createElementNS(HTMLNames::xhtmlNamespaceURI(), "div", exceptionCode);
    271272    ASSERT(exceptionCode == 0);
    272273    return element;
     
    276277{
    277278    int exceptionCode = 0;
    278     ElementImpl *breakNode = document->createHTMLElement("br", exceptionCode);
     279    ElementImpl *breakNode = document->createElementNS(HTMLNames::xhtmlNamespaceURI(), "br", exceptionCode);
    279280    ASSERT(exceptionCode == 0);
    280281    return breakNode;
     
    304305bool isMailBlockquote(const NodeImpl *node)
    305306{
    306     if (!node || !node->renderer() || !node->isElementNode() && node->id() != ID_BLOCKQUOTE)
     307    if (!node || !node->renderer() || !node->isElementNode() && !node->hasTagName(HTMLNames::blockquote()))
    307308        return false;
    308309       
  • trunk/WebCore/khtml/editing/insert_line_break_command.cpp

    r9196 r9639  
    3030#include "visible_units.h"
    3131
    32 #include "misc/htmltags.h"
     32#include "htmlnames.h"
    3333#include "xml/dom_docimpl.h"
    3434#include "xml/dom_elementimpl.h"
     
    5151using DOM::TextImpl;
    5252using DOM::CSSMutableStyleDeclarationImpl;
     53using DOM::HTMLNames;
    5354
    5455namespace khtml {
     
    112113        // significant side effects (and no real worries either since you can't arrow past
    113114        // this extra one.
    114         if (pos.node()->id() == ID_BR && pos.offset() == 0) {
     115        if (pos.node()->hasTagName(HTMLNames::br()) && pos.offset() == 0) {
    115116            // Already placed in a trailing BR. Insert "real" BR before it and leave the selection alone.
    116117            insertNodeBefore(nodeToInsert, pos.node());
     
    118119        else {
    119120            NodeImpl *next = pos.node()->traverseNextNode();
    120             bool hasTrailingBR = next && next->id() == ID_BR && pos.node()->enclosingBlockFlowElement() == next->enclosingBlockFlowElement();
     121            bool hasTrailingBR = next && next->hasTagName(HTMLNames::br()) && pos.node()->enclosingBlockFlowElement() == next->enclosingBlockFlowElement();
    121122            insertNodeAfterPosition(nodeToInsert, pos);
    122123            if (hasTrailingBR) {
  • trunk/WebCore/khtml/editing/insert_paragraph_separator_command.cpp

    r9196 r9639  
    3232#include "css/css_computedstyle.h"
    3333#include "css/css_valueimpl.h"
    34 #include "misc/htmltags.h"
     34#include "htmlnames.h"
    3535#include "xml/dom_docimpl.h"
    3636#include "xml/dom_elementimpl.h"
     
    5151using DOM::Position;
    5252using DOM::TextImpl;
     53using DOM::HTMLNames;
    5354
    5455namespace khtml {
     
    214215    if (!document()->inStrictMode()) {
    215216        Position upstreamPos = pos.upstream();
    216         if (upstreamPos.node()->id() == ID_BR)
     217        if (upstreamPos.node()->hasTagName(HTMLNames::br()))
    217218            insertNodeAfter(createBreakElement(document()), upstreamPos.node());
    218219    }
  • trunk/WebCore/khtml/editing/markup.cpp

    r9595 r9639  
    3737#include "rendering/render_text.h"
    3838#include "misc/htmlattrs.h"
    39 #include "misc/htmltags.h"
    40 #include "html/dtd.h"
     39#include "htmlnames.h"
    4140
    4241using DOM::AttributeImpl;
     
    4847using DOM::DOMString;
    4948using DOM::ElementImpl;
    50 using DOM::FORBIDDEN;
    51 using DOM::endTagRequirement;
     49using DOM::TagStatusForbidden;
    5250using DOM::HTMLElementImpl;
     51using DOM::HTMLNames;
    5352using DOM::NamedAttrMapImpl;
    5453using DOM::Node;
     
    178177        case Node::TEXT_NODE: {
    179178            if (node->parentNode()) {
    180                 switch (node->parentNode()->id()) {
    181                     case ID_PRE:
    182                     case ID_SCRIPT:
    183                     case ID_STYLE:
    184                     case ID_TEXTAREA:
    185                         return stringValueForRange(node, range);
    186                 }
     179                if (node->parentNode()->hasTagName(HTMLNames::pre()) ||
     180                    node->parentNode()->hasTagName(HTMLNames::script()) ||
     181                    node->parentNode()->hasTagName(HTMLNames::style()) ||
     182                    node->parentNode()->hasTagName(HTMLNames::textarea()))
     183                    return stringValueForRange(node, range);
    187184            }
    188185            QString markup = annotate ? escapeHTML(renderedText(node, range)) : escapeHTML(stringValueForRange(node, range));           
     
    249246static QString endMarkup(const NodeImpl *node)
    250247{
    251     if ((!node->isHTMLElement() || endTagRequirement(node->id()) != FORBIDDEN) && node->nodeType() != Node::TEXT_NODE && node->nodeType() != Node::DOCUMENT_NODE) {
     248    bool hasEndTag = node->isElementNode();
     249    if (node->isHTMLElement()) {
     250        const HTMLElementImpl* htmlElt = static_cast<const HTMLElementImpl*>(node);
     251        hasEndTag = (htmlElt->endTagRequirement() != TagStatusForbidden);
     252    }
     253    if (hasEndTag)
    252254        return "</" + node->nodeName().string() + ">";
    253     }
    254255    return "";
    255256}
     
    266267            }
    267268            me += startMarkup(current, 0, DoNotAnnotateForInterchange, 0);
    268         }       
    269         if (!current->isHTMLElement() || endTagRequirement(current->id()) != FORBIDDEN) {
     269        }
     270       
     271        bool container = true;
     272        if (current->isHTMLElement()) {
     273            const HTMLElementImpl* h = static_cast<const HTMLElementImpl*>(current);
     274            container = h->endTagRequirement() != TagStatusForbidden;
     275        }
     276        if (container) {
    270277            // print children
    271278            if (NodeImpl *n = current->firstChild()) {
     
    415422            bool breakAtEnd = false;
    416423            if (commonAncestorBlock == ancestor) {
    417                 NodeImpl::Id id = ancestor->id();
    418424                // Include ancestors that are required to retain the appearance of the copied markup.
    419                 if (id == ID_PRE || id == ID_TABLE || id == ID_OL || id == ID_UL) {
     425                if (ancestor->hasTagName(HTMLNames::pre()) || ancestor->hasTagName(HTMLNames::table()) ||
     426                    ancestor->hasTagName(HTMLNames::ol()) || ancestor->hasTagName(HTMLNames::ul())) {
    420427                    breakAtEnd = true;
    421428                } else {
     
    540547            if (s.isEmpty() && list.isEmpty()) {
    541548                // For last line, use the "magic BR" rather than a P.
    542                 element = document->createHTMLElement("br", exceptionCode);
     549                element = document->createElementNS(HTMLNames::xhtmlNamespaceURI(), "br", exceptionCode);
    543550                ASSERT(exceptionCode == 0);
    544551                element->ref();
  • trunk/WebCore/khtml/editing/replace_selection_command.cpp

    r9595 r9639  
    2828#include "visible_position.h"
    2929#include "misc/htmlattrs.h"
    30 #include "misc/htmltags.h"
     30#include "htmlnames.h"
    3131#include "xml/dom_docimpl.h"
    3232#include "html_interchange.h"
     
    5959using DOM::CSSMutableStyleDeclarationImpl;
    6060using DOM::Position;
     61using DOM::HTMLNames;
    6162
    6263namespace khtml {
     
    168169        return false;
    169170   
    170     switch (node->id()) {
    171         case ID_BLOCKQUOTE:
    172         case ID_DD:
    173         case ID_DIV:
    174         case ID_DL:
    175         case ID_DT:
    176         case ID_H1:
    177         case ID_H2:
    178         case ID_H3:
    179         case ID_H4:
    180         case ID_H5:
    181         case ID_H6:
    182         case ID_HR:
    183         case ID_LI:
    184         case ID_OL:
    185         case ID_P:
    186         case ID_PRE:
    187         case ID_TD:
    188         case ID_TH:
    189         case ID_UL:
    190             return true;
    191     }
    192    
    193     return false;
     171    // FIXME: This function seems really broken to me.  It isn't even including all the block-level elements.
     172    return (node->hasTagName(HTMLNames::blockquote()) || node->hasTagName(HTMLNames::dd()) || node->hasTagName(HTMLNames::div()) ||
     173            node->hasTagName(HTMLNames::dl()) || node->hasTagName(HTMLNames::dt()) || node->hasTagName(HTMLNames::h1()) ||
     174            node->hasTagName(HTMLNames::h2()) || node->hasTagName(HTMLNames::h3()) || node->hasTagName(HTMLNames::h4()) ||
     175            node->hasTagName(HTMLNames::h5()) || node->hasTagName(HTMLNames::h6()) || node->hasTagName(HTMLNames::hr()) ||
     176            node->hasTagName(HTMLNames::li()) || node->hasTagName(HTMLNames::ol()) || node->hasTagName(HTMLNames::p()) ||
     177            node->hasTagName(HTMLNames::pre()) || node->hasTagName(HTMLNames::td()) || node->hasTagName(HTMLNames::th()) ||
     178            node->hasTagName(HTMLNames::ul()));
    194179}
    195180
     
    215200        return false;
    216201   
    217     switch (node->id()) {
    218         case ID_TABLE:
    219         case ID_TBODY:
    220         case ID_TD:
    221         case ID_TFOOT:
    222         case ID_THEAD:
    223         case ID_TR:
    224             return true;
    225     }
    226     return false;
     202    return (node->hasTagName(HTMLNames::table()) || node->hasTagName(HTMLNames::tbody()) || node->hasTagName(HTMLNames::td()) ||
     203            node->hasTagName(HTMLNames::tfoot()) || node->hasTagName(HTMLNames::thead()) || node->hasTagName(HTMLNames::tr()));
    227204}
    228205
     
    251228{
    252229    static DOMString interchangeNewlineClassString(AppleInterchangeNewline);
    253     return node && node->id() == ID_BR && static_cast<const ElementImpl *>(node)->getAttribute(ATTR_CLASS) == interchangeNewlineClassString;
     230    return node && node->hasTagName(HTMLNames::br()) && static_cast<const ElementImpl *>(node)->getAttribute(ATTR_CLASS) == interchangeNewlineClassString;
    254231}
    255232
     
    508485        // This list of tags change the appearance of content
    509486        // in ways we can add back on later with CSS, if necessary.
    510         if (node->id() == ID_B ||
    511             node->id() == ID_BIG ||
    512             node->id() == ID_CENTER ||
    513             node->id() == ID_FONT ||
    514             node->id() == ID_I ||
    515             node->id() == ID_S ||
    516             node->id() == ID_SMALL ||
    517             node->id() == ID_STRIKE ||
    518             node->id() == ID_SUB ||
    519             node->id() == ID_SUP ||
    520             node->id() == ID_TT ||
    521             node->id() == ID_U ||
     487        //  FIXME: This list is incomplete
     488        if (node->hasTagName(HTMLNames::b()) ||
     489            node->hasTagName(HTMLNames::big()) ||
     490            node->hasTagName(HTMLNames::center()) ||
     491            node->hasTagName(HTMLNames::font()) ||
     492            node->hasTagName(HTMLNames::i()) ||
     493            node->hasTagName(HTMLNames::s()) ||
     494            node->hasTagName(HTMLNames::small()) ||
     495            node->hasTagName(HTMLNames::strike()) ||
     496            node->hasTagName(HTMLNames::sub()) ||
     497            node->hasTagName(HTMLNames::sup()) ||
     498            node->hasTagName(HTMLNames::tt()) ||
     499            node->hasTagName(HTMLNames::u()) ||
    522500            isStyleSpan(node)) {
    523501            removeNodePreservingChildren(node);
     
    745723        Position downstream = startPos.downstream();
    746724        downstream = positionOutsideContainingSpecialElement(downstream);
    747         if (downstream.node()->id() == ID_BR && downstream.offset() == 0 &&
     725        if (downstream.node()->hasTagName(HTMLNames::br()) && downstream.offset() == 0 &&
    748726            m_fragment.hasInterchangeNewlineAtEnd() &&
    749727            isStartOfLine(VisiblePosition(downstream, VP_DEFAULT_AFFINITY)))
     
    907885    }
    908886    else {
    909         if (m_lastNodeInserted && m_lastNodeInserted->id() == ID_BR && !document()->inStrictMode()) {
     887        if (m_lastNodeInserted && m_lastNodeInserted->hasTagName(HTMLNames::br()) && !document()->inStrictMode()) {
    910888            document()->updateLayout();
    911889            VisiblePosition pos(Position(m_lastNodeInserted, 1), DOWNSTREAM);
    912890            if (isEndOfBlock(pos)) {
    913891                NodeImpl *next = m_lastNodeInserted->traverseNextNode();
    914                 bool hasTrailingBR = next && next->id() == ID_BR && m_lastNodeInserted->enclosingBlockFlowElement() == next->enclosingBlockFlowElement();
     892                bool hasTrailingBR = next && next->hasTagName(HTMLNames::br()) && m_lastNodeInserted->enclosingBlockFlowElement() == next->enclosingBlockFlowElement();
    915893                if (!hasTrailingBR) {
    916894                    // Insert an "extra" BR at the end of the block.
     
    939917                refNode = node;
    940918                // We want to move the first BR we see, so check for that here.
    941                 if (node->id() == ID_BR)
     919                if (node->hasTagName(HTMLNames::br()))
    942920                    break;
    943921                node = next;
     
    10871065    // update m_lastNodeInserted
    10881066    NodeImpl *old = m_lastNodeInserted;
    1089     m_lastNodeInserted = node->lastDescendent();
     1067    m_lastNodeInserted = node->lastDescendant();
    10901068    m_lastNodeInserted->ref();
    10911069    if (old)
  • trunk/WebCore/khtml/editing/selection.cpp

    r9476 r9639  
    3434#include "khtml_part.h"
    3535#include "khtmlview.h"
    36 #include "misc/htmltags.h"
    3736#include "rendering/render_object.h"
    3837#include "rendering/render_style.h"
     
    939938    if (r->node()->isElementNode()) {
    940939        ElementImpl *element = static_cast<ElementImpl *>(r->node());
    941         fprintf(stderr, "%s%s\n", selected ? "==> " : "    ", element->tagName().string().latin1());
     940        fprintf(stderr, "%s%s\n", selected ? "==> " : "    ", element->localName().string().latin1());
    942941    }
    943942    else if (r->isText()) {
  • trunk/WebCore/khtml/editing/visible_position.cpp

    r9476 r9639  
    2727#include "visible_units.h"
    2828
    29 #include "misc/htmltags.h"
     29#include "htmlnames.h"
    3030#include "rendering/render_line.h"
    3131#include "rendering/render_object.h"
     
    5151using DOM::RangeImpl;
    5252using DOM::TextImpl;
     53using DOM::HTMLNames;
    5354
    5455namespace khtml {
     
    7576
    7677    // For <br> 0, it's important not to move past the <br>.
    77     if (pos.node() && pos.node()->id() == ID_BR && pos.offset() == 0)
     78    if (pos.node() && pos.node()->hasTagName(HTMLNames::br()) && pos.offset() == 0)
    7879        initUpstream(pos);
    7980    else
     
    275276   
    276277    if (renderer->isBlockFlow() && (!renderer->firstChild() || !pos.node()->firstChild()) &&
    277        (renderer->height() || pos.node()->id() == ID_BODY)) {
     278       (renderer->height() || pos.node()->hasTagName(HTMLNames::body()))) {
    278279        // return true for offset 0 into rendered blocks that are empty of rendered kids, but have a height
    279280        return pos.offset() == 0;
     
    360361bool VisiblePosition::isAtomicNode(const NodeImpl *node)
    361362{
    362     return node && (!node->hasChildNodes() || (node->id() == ID_OBJECT && node->renderer() && node->renderer()->isReplaced()));
     363    return node && (!node->hasChildNodes() || (node->hasTagName(HTMLNames::object()) && node->renderer() && node->renderer()->isReplaced()));
    363364}
    364365
  • trunk/WebCore/khtml/editing/visible_text.cpp

    r9169 r9639  
    2626#include "visible_text.h"
    2727
    28 #include "misc/htmltags.h"
     28#include "htmlnames.h"
    2929#include "rendering/render_text.h"
    3030#include "xml/dom_nodeimpl.h"
     
    3838using DOM::offsetInCharacters;
    3939using DOM::RangeImpl;
     40using DOM::HTMLNames;
    4041
    4142// FIXME: These classes should probably use the render tree and not the DOM tree, since elements could
     
    337338bool TextIterator::handleNonTextNode()
    338339{
    339     switch (m_node->id()) {
    340         case ID_BR: {
    341             emitCharacter('\n', m_node->parentNode(), m_node, 0, 1);
    342             break;
    343         }
    344 
    345         case ID_TD:
    346         case ID_TH:
    347             if (m_lastCharacter != '\n' && m_lastTextNode) {
    348                 emitCharacter('\t', m_lastTextNode->parentNode(), m_lastTextNode, 0, 1);
    349             }
    350             break;
    351 
    352         case ID_BLOCKQUOTE:
    353         case ID_DD:
    354         case ID_DIV:
    355         case ID_DL:
    356         case ID_DT:
    357         case ID_H1:
    358         case ID_H2:
    359         case ID_H3:
    360         case ID_H4:
    361         case ID_H5:
    362         case ID_H6:
    363         case ID_HR:
    364         case ID_LI:
    365         case ID_OL:
    366         case ID_P:
    367         case ID_PRE:
    368         case ID_TR:
    369         case ID_UL:
    370             if (m_lastCharacter != '\n' && m_lastTextNode) {
    371                 emitCharacter('\n', m_lastTextNode->parentNode(), m_lastTextNode, 0, 1);
    372             }
    373             break;
     340    if (m_node->hasTagName(HTMLNames::br())) {
     341        emitCharacter('\n', m_node->parentNode(), m_node, 0, 1);
     342    } else if (m_node->hasTagName(HTMLNames::td()) || m_node->hasTagName(HTMLNames::th())) {
     343        if (m_lastCharacter != '\n' && m_lastTextNode) {
     344            emitCharacter('\t', m_lastTextNode->parentNode(), m_lastTextNode, 0, 1);
     345        }
     346    } else if (m_node->hasTagName(HTMLNames::blockquote()) || m_node->hasTagName(HTMLNames::dd()) ||
     347               m_node->hasTagName(HTMLNames::div()) ||
     348               m_node->hasTagName(HTMLNames::dl()) || m_node->hasTagName(HTMLNames::dt()) ||
     349               m_node->hasTagName(HTMLNames::h1()) || m_node->hasTagName(HTMLNames::h2()) ||
     350               m_node->hasTagName(HTMLNames::h3()) || m_node->hasTagName(HTMLNames::h4()) ||
     351               m_node->hasTagName(HTMLNames::h5()) || m_node->hasTagName(HTMLNames::h6()) ||
     352               m_node->hasTagName(HTMLNames::hr()) || m_node->hasTagName(HTMLNames::li()) ||
     353               m_node->hasTagName(HTMLNames::ol()) || m_node->hasTagName(HTMLNames::p()) ||
     354               m_node->hasTagName(HTMLNames::pre()) || m_node->hasTagName(HTMLNames::tr()) ||
     355               m_node->hasTagName(HTMLNames::ul())) {
     356        if (m_lastCharacter != '\n' && m_lastTextNode) {
     357            emitCharacter('\n', m_lastTextNode->parentNode(), m_lastTextNode, 0, 1);
     358        }
    374359    }
    375360
     
    382367    bool addNewline = false;
    383368
    384     switch (m_node->id()) {
    385         case ID_BLOCKQUOTE:
    386         case ID_DD:
    387         case ID_DIV:
    388         case ID_DL:
    389         case ID_DT:
    390         case ID_HR:
    391         case ID_LI:
    392         case ID_OL:
    393         case ID_PRE:
    394         case ID_TR:
    395         case ID_UL:
    396             endLine = true;
    397             break;
    398 
    399         case ID_H1:
    400         case ID_H2:
    401         case ID_H3:
    402         case ID_H4:
    403         case ID_H5:
    404         case ID_H6:
    405         case ID_P: {
    406             endLine = true;
    407 
    408             // In certain cases, emit a new newline character for this node
    409             // regardless of whether we emit another one.
    410             // FIXME: Some day we could do this for other tags.
    411             // However, doing it just for the tags above makes it more likely
    412             // we'll end up getting the right result without margin collapsing.
    413             // For example: <div><p>text</p></div> will work right even if both
    414             // the <div> and the <p> have bottom margins.
    415             RenderObject *renderer = m_node->renderer();
    416             if (renderer) {
    417                 RenderStyle *style = renderer->style();
    418                 if (style) {
    419                     int bottomMargin = renderer->collapsedMarginBottom();
    420                     int fontSize = style->htmlFont().getFontDef().computedPixelSize();
    421                     if (bottomMargin * 2 >= fontSize) {
    422                         addNewline = true;
    423                     }
     369    if (m_node->hasTagName(HTMLNames::blockquote()) || m_node->hasTagName(HTMLNames::dd()) ||
     370               m_node->hasTagName(HTMLNames::div()) ||
     371               m_node->hasTagName(HTMLNames::dl()) || m_node->hasTagName(HTMLNames::dt()) ||
     372               m_node->hasTagName(HTMLNames::hr()) || m_node->hasTagName(HTMLNames::li()) ||
     373               m_node->hasTagName(HTMLNames::ol()) ||
     374               m_node->hasTagName(HTMLNames::pre()) || m_node->hasTagName(HTMLNames::tr()) ||
     375               m_node->hasTagName(HTMLNames::ul()))
     376        endLine = true;
     377    else if (m_node->hasTagName(HTMLNames::h1()) || m_node->hasTagName(HTMLNames::h2()) ||
     378             m_node->hasTagName(HTMLNames::h3()) || m_node->hasTagName(HTMLNames::h4()) ||
     379             m_node->hasTagName(HTMLNames::h5()) || m_node->hasTagName(HTMLNames::h6()) ||
     380             m_node->hasTagName(HTMLNames::p())) {
     381        endLine = true;
     382
     383        // In certain cases, emit a new newline character for this node
     384        // regardless of whether we emit another one.
     385        // FIXME: Some day we could do this for other tags.
     386        // However, doing it just for the tags above makes it more likely
     387        // we'll end up getting the right result without margin collapsing.
     388        // For example: <div><p>text</p></div> will work right even if both
     389        // the <div> and the <p> have bottom margins.
     390        RenderObject *renderer = m_node->renderer();
     391        if (renderer) {
     392            RenderStyle *style = renderer->style();
     393            if (style) {
     394                int bottomMargin = renderer->collapsedMarginBottom();
     395                int fontSize = style->htmlFont().getFontDef().computedPixelSize();
     396                if (bottomMargin * 2 >= fontSize) {
     397                    addNewline = true;
    424398                }
    425399            }
    426             break;
    427400        }
    428401    }
     
    661634bool SimplifiedBackwardsTextIterator::handleNonTextNode()
    662635{
    663     switch (m_node->id()) {
    664         case ID_BR:
    665             emitNewlineForBROrText();
    666             break;
    667         case ID_TD:
    668         case ID_TH:
    669         case ID_BLOCKQUOTE:
    670         case ID_DD:
    671         case ID_DIV:
    672         case ID_DL:
    673         case ID_DT:
    674         case ID_H1:
    675         case ID_H2:
    676         case ID_H3:
    677         case ID_H4:
    678         case ID_H5:
    679         case ID_H6:
    680         case ID_HR:
    681         case ID_P:
    682         case ID_PRE:
    683         case ID_TR:
    684         case ID_OL:
    685         case ID_UL:
    686         case ID_LI:
    687             // Emit a space to "break up" content. Any word break
    688             // character will do.
    689             emitCharacter(' ', m_node, 0, 0);
    690             break;
     636    if (m_node->hasTagName(HTMLNames::br()))
     637        emitNewlineForBROrText();
     638    else if (m_node->hasTagName(HTMLNames::td ()) || m_node->hasTagName(HTMLNames::th()) ||
     639             m_node->hasTagName(HTMLNames::blockquote()) || m_node->hasTagName(HTMLNames::dd()) ||
     640             m_node->hasTagName(HTMLNames::div()) ||
     641             m_node->hasTagName(HTMLNames::dl()) || m_node->hasTagName(HTMLNames::dt()) ||
     642             m_node->hasTagName(HTMLNames::h1()) || m_node->hasTagName(HTMLNames::h2()) ||
     643             m_node->hasTagName(HTMLNames::h3()) || m_node->hasTagName(HTMLNames::h4()) ||
     644             m_node->hasTagName(HTMLNames::h5()) || m_node->hasTagName(HTMLNames::h6()) ||
     645             m_node->hasTagName(HTMLNames::hr()) || m_node->hasTagName(HTMLNames::li()) ||
     646             m_node->hasTagName(HTMLNames::ol()) || m_node->hasTagName(HTMLNames::p()) ||
     647             m_node->hasTagName(HTMLNames::pre()) || m_node->hasTagName(HTMLNames::tr()) ||
     648             m_node->hasTagName(HTMLNames::ul())) {
     649        // Emit a space to "break up" content. Any word break
     650        // character will do.
     651        emitCharacter(' ', m_node, 0, 0);
    691652    }
    692653
  • trunk/WebCore/khtml/editing/visible_units.cpp

    r9217 r9639  
    2828#include <qstring.h>
    2929
    30 #include "htmltags.h"
     30#include "htmlnames.h"
    3131#include "misc/helper.h"
    3232#include "rendering/render_text.h"
     
    4242using DOM::Position;
    4343using DOM::RangeImpl;
     44using DOM::HTMLNames;
    4445
    4546namespace khtml {
     
    333334
    334335    long endOffset = 1;
    335     if (endNode->id() == ID_BR) {
     336    if (endNode->hasTagName(HTMLNames::br())) {
    336337        endOffset = 0;
    337338    } else if (endBox->isInlineTextBox()) {
  • trunk/WebCore/khtml/html/html_baseimpl.cpp

    r9165 r9639  
    4949
    5050HTMLBodyElementImpl::HTMLBodyElementImpl(DocumentPtr *doc)
    51     : HTMLElementImpl(doc), m_linkDecl(0)
     51    : HTMLElementImpl(HTMLNames::body(), doc), m_linkDecl(0)
    5252{
    5353}
     
    6060        m_linkDecl->deref();
    6161    }
    62 }
    63 
    64 NodeImpl::Id HTMLBodyElementImpl::id() const
    65 {
    66     return ID_BODY;
    6762}
    6863
     
    290285
    291286HTMLFrameElementImpl::HTMLFrameElementImpl(DocumentPtr *doc)
    292     : HTMLElementImpl(doc)
     287    : HTMLElementImpl(HTMLNames::frame(), doc)
     288{
     289    init();
     290}
     291
     292HTMLFrameElementImpl::HTMLFrameElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
     293    : HTMLElementImpl(tagName, doc)
     294{
     295    init();
     296}
     297
     298void HTMLFrameElementImpl::init()
    293299{
    294300    m_frameBorder = true;
     
    302308HTMLFrameElementImpl::~HTMLFrameElementImpl()
    303309{
    304 }
    305 
    306 NodeImpl::Id HTMLFrameElementImpl::id() const
    307 {
    308     return ID_FRAME;
    309310}
    310311
     
    483484    // inherit default settings from parent frameset
    484485    for (NodeImpl *node = parentNode(); node; node = node->parentNode())
    485         if (node->id() == ID_FRAMESET) {
     486        if (node->hasTagName(HTMLNames::frameset())) {
    486487            HTMLFrameSetElementImpl* frameset = static_cast<HTMLFrameSetElementImpl*>(node);
    487488            if (!m_frameBorderSet)
     
    662663
    663664HTMLFrameSetElementImpl::HTMLFrameSetElementImpl(DocumentPtr *doc)
    664     : HTMLElementImpl(doc)
     665    : HTMLElementImpl(HTMLNames::frameset(), doc)
    665666{
    666667    // default value for rows and cols...
     
    686687}
    687688
    688 NodeImpl::Id HTMLFrameSetElementImpl::id() const
    689 {
    690     return ID_FRAMESET;
     689bool HTMLFrameSetElementImpl::checkDTD(const NodeImpl* newChild)
     690{
     691    // FIXME: Old code had adjacent double returns and seemed to want to do something with NOFRAMES (but didn't).
     692    // What is the correct behavior?
     693    return newChild->hasTagName(HTMLNames::frameset()) || newChild->hasTagName(HTMLNames::frame());
    691694}
    692695
     
    753756    while(node)
    754757    {
    755         if(node->id() == ID_FRAMESET)
    756         {
     758        if (node->hasTagName(HTMLNames::frameset())) {
    757759            HTMLFrameSetElementImpl* frameset = static_cast<HTMLFrameSetElementImpl*>(node);
    758760            if(!frameBorderSet)  frameborder = frameset->frameBorder();
     
    818820
    819821HTMLHeadElementImpl::HTMLHeadElementImpl(DocumentPtr *doc)
    820     : HTMLElementImpl(doc)
     822    : HTMLElementImpl(HTMLNames::head(), doc)
    821823{
    822824}
     
    826828}
    827829
    828 NodeImpl::Id HTMLHeadElementImpl::id() const
    829 {
    830     return ID_HEAD;
    831 }
    832 
    833830DOMString HTMLHeadElementImpl::profile() const
    834831{
     
    841838}
    842839
     840bool HTMLHeadElementImpl::checkDTD(const NodeImpl* newChild)
     841{
     842    return newChild->hasTagName(HTMLNames::title()) || newChild->hasTagName(HTMLNames::isindex()) ||
     843           newChild->hasTagName(HTMLNames::base()) || newChild->hasTagName(HTMLNames::script()) ||
     844           newChild->hasTagName(HTMLNames::style()) || newChild->hasTagName(HTMLNames::meta()) ||
     845           newChild->hasTagName(HTMLNames::link()) || newChild->isTextNode();
     846}
     847
    843848// -------------------------------------------------------------------------
    844849
    845850HTMLHtmlElementImpl::HTMLHtmlElementImpl(DocumentPtr *doc)
    846     : HTMLElementImpl(doc)
     851    : HTMLElementImpl(HTMLNames::html(), doc)
    847852{
    848853}
     
    852857}
    853858
    854 NodeImpl::Id HTMLHtmlElementImpl::id() const
    855 {
    856     return ID_HTML;
    857 }
    858 
    859859DOMString HTMLHtmlElementImpl::version() const
    860860{
     
    867867}
    868868
     869bool HTMLHtmlElementImpl::checkDTD(const NodeImpl* newChild)
     870{
     871    // FIXME: Why is <script> allowed here?
     872    return newChild->hasTagName(HTMLNames::head()) || newChild->hasTagName(HTMLNames::body()) ||
     873           newChild->hasTagName(HTMLNames::frameset()) || newChild->hasTagName(HTMLNames::noframes()) ||
     874           newChild->hasTagName(HTMLNames::script());
     875}
     876
    869877// -------------------------------------------------------------------------
    870878
    871 HTMLIFrameElementImpl::HTMLIFrameElementImpl(DocumentPtr *doc) : HTMLFrameElementImpl(doc)
     879HTMLIFrameElementImpl::HTMLIFrameElementImpl(DocumentPtr *doc) : HTMLFrameElementImpl(HTMLNames::iframe(), doc)
    872880{
    873881    m_frameBorder = false;
     
    879887HTMLIFrameElementImpl::~HTMLIFrameElementImpl()
    880888{
    881 }
    882 
    883 NodeImpl::Id HTMLIFrameElementImpl::id() const
    884 {
    885     return ID_IFRAME;
    886889}
    887890
  • trunk/WebCore/khtml/html/html_baseimpl.h

    r9158 r9639  
    2727#define HTML_BASEIMPL_H
    2828
    29 #include "html/dtd.h"
    3029#include "html/html_elementimpl.h"
    3130#include "misc/khtmllayout.h"
     
    5655    ~HTMLBodyElementImpl();
    5756
    58     virtual Id id() const;
    59 
     57    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     58    virtual int tagPriority() const { return 10; }
     59   
    6060    virtual bool mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const;
    6161    virtual void parseMappedAttribute(MappedAttributeImpl *);
     
    9393public:
    9494    HTMLFrameElementImpl(DocumentPtr *doc);
    95 
     95    HTMLFrameElementImpl(const QualifiedName& tagName, DocumentPtr* doc);
    9696    ~HTMLFrameElementImpl();
    9797
    98     virtual Id id() const;
    99 
     98    void init();
     99
     100    virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
     101    virtual int tagPriority() const { return 0; }
     102 
    100103    virtual void parseMappedAttribute(MappedAttributeImpl *);
    101104    virtual void attach();
     
    169172public:
    170173    HTMLFrameSetElementImpl(DocumentPtr *doc);
    171 
    172174    ~HTMLFrameSetElementImpl();
    173175
    174     virtual Id id() const;
     176    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     177    virtual int tagPriority() const { return 10; }
     178    virtual bool checkDTD(const NodeImpl* newChild);
    175179
    176180    virtual void parseMappedAttribute(MappedAttributeImpl *);
     
    217221public:
    218222    HTMLHeadElementImpl(DocumentPtr *doc);
    219 
    220223    ~HTMLHeadElementImpl();
    221224
    222     virtual Id id() const;
     225    virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
     226    virtual int tagPriority() const { return 10; }
     227    virtual bool checkDTD(const NodeImpl* newChild);
    223228
    224229    DOMString profile() const;
     
    234239    ~HTMLHtmlElementImpl();
    235240
    236     virtual Id id() const;
     241    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     242    virtual int tagPriority() const { return 11; }
     243    virtual bool checkDTD(const NodeImpl* newChild);
    237244
    238245    DOMString version() const;
     
    247254public:
    248255    HTMLIFrameElementImpl(DocumentPtr *doc);
    249 
    250256    ~HTMLIFrameElementImpl();
    251257
    252     virtual Id id() const;
     258    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     259    virtual int tagPriority() const { return 1; }
    253260
    254261    virtual bool mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const;
  • trunk/WebCore/khtml/html/html_blockimpl.cpp

    r9625 r9639  
    3838
    3939HTMLBlockquoteElementImpl::HTMLBlockquoteElementImpl(DocumentPtr *doc)
    40     : HTMLElementImpl(doc)
     40    : HTMLElementImpl(HTMLNames::blockquote(), doc)
    4141{
    4242}
     
    4646}
    4747
    48 NodeImpl::Id HTMLBlockquoteElementImpl::id() const
    49 {
    50     return ID_BLOCKQUOTE;
    51 }
    52 
    5348DOMString HTMLBlockquoteElementImpl::cite() const
    5449{
     
    6459
    6560HTMLDivElementImpl::HTMLDivElementImpl(DocumentPtr *doc)
    66     : HTMLElementImpl(doc)
     61    : HTMLElementImpl(HTMLNames::div(), doc)
    6762{
    6863}
     
    7065HTMLDivElementImpl::~HTMLDivElementImpl()
    7166{
    72 }
    73 
    74 NodeImpl::Id HTMLDivElementImpl::id() const
    75 {
    76     return ID_DIV;
    7767}
    7868
     
    121111
    122112HTMLHRElementImpl::HTMLHRElementImpl(DocumentPtr *doc)
    123     : HTMLElementImpl(doc)
     113    : HTMLElementImpl(HTMLNames::hr(), doc)
    124114{
    125115}
     
    127117HTMLHRElementImpl::~HTMLHRElementImpl()
    128118{
    129 }
    130 
    131 NodeImpl::Id HTMLHRElementImpl::id() const
    132 {
    133     return ID_HR;
    134119}
    135120
     
    253238// -------------------------------------------------------------------------
    254239
    255 HTMLHeadingElementImpl::HTMLHeadingElementImpl(DocumentPtr *doc, ushort _tagid)
    256     : HTMLGenericElementImpl(doc, _tagid)
    257 {
     240HTMLHeadingElementImpl::HTMLHeadingElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
     241    : HTMLElementImpl(tagName, doc)
     242{
     243}
     244
     245bool HTMLHeadingElementImpl::checkDTD(const NodeImpl* newChild)
     246{
     247    if (newChild->hasTagName(HTMLNames::h1()) || newChild->hasTagName(HTMLNames::h2()) ||
     248        newChild->hasTagName(HTMLNames::h3()) || newChild->hasTagName(HTMLNames::h4()) ||
     249        newChild->hasTagName(HTMLNames::h5()) || newChild->hasTagName(HTMLNames::h6()))
     250        return false;
     251
     252    return inEitherTagList(newChild);
    258253}
    259254
     
    271266
    272267HTMLParagraphElementImpl::HTMLParagraphElementImpl(DocumentPtr *doc)
    273     : HTMLElementImpl(doc)
    274 {
    275 }
    276 
    277 NodeImpl::Id HTMLParagraphElementImpl::id() const
    278 {
    279     return ID_P;
     268    : HTMLElementImpl(HTMLNames::p(), doc)
     269{
     270}
     271
     272bool HTMLParagraphElementImpl::checkDTD(const NodeImpl* newChild)
     273{
     274    return inInlineTagList(newChild) || (getDocument()->inCompatMode() && newChild->hasTagName(HTMLNames::table()));
    280275}
    281276
     
    323318// -------------------------------------------------------------------------
    324319
    325 HTMLPreElementImpl::HTMLPreElementImpl(DocumentPtr *doc, unsigned short _tagid)
    326     : HTMLGenericElementImpl(doc, _tagid)
     320HTMLPreElementImpl::HTMLPreElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
     321    : HTMLElementImpl(tagName, doc)
    327322{
    328323}
     
    344339
    345340HTMLMarqueeElementImpl::HTMLMarqueeElementImpl(DocumentPtr *doc)
    346 : HTMLElementImpl(doc),
     341: HTMLElementImpl(HTMLNames::marquee(), doc),
    347342  m_minimumDelay(defaultMinimumDelay)
    348343{
    349 }
    350 
    351 NodeImpl::Id HTMLMarqueeElementImpl::id() const
    352 {
    353     return ID_MARQUEE;
    354344}
    355345
     
    438428    }
    439429}
    440 
    441 // ------------------------------------------------------------------------
    442 
    443 HTMLLayerElementImpl::HTMLLayerElementImpl(DocumentPtr *doc)
    444     : HTMLDivElementImpl( doc )
    445 {
    446 }
    447 
    448 HTMLLayerElementImpl::~HTMLLayerElementImpl()
    449 {
    450 }
    451 
    452 NodeImpl::Id HTMLLayerElementImpl::id() const
    453 {
    454     return ID_LAYER;
    455 }
  • trunk/WebCore/khtml/html/html_blockimpl.h

    r9158 r9639  
    2727
    2828#include "html_elementimpl.h"
    29 #include "dtd.h"
    3029
    3130namespace DOM {
     
    4140    ~HTMLBlockquoteElementImpl();
    4241
    43     virtual Id id() const;
    44 
     42    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     43    virtual int tagPriority() const { return 5; }
     44   
    4545    DOMString cite() const;
    4646    void setCite(const DOMString &);
     
    5656    HTMLDivElementImpl(DocumentPtr *doc);
    5757    ~HTMLDivElementImpl();
    58 
    59     virtual Id id() const;
     58   
     59    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     60    virtual int tagPriority() const { return 5; }
    6061   
    6162    virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
     
    7374    HTMLHRElementImpl(DocumentPtr *doc);
    7475    ~HTMLHRElementImpl();
    75 
    76     virtual Id id() const;
     76   
     77    virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
     78    virtual int tagPriority() const { return 0; }
    7779   
    7880    virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
     
    9496// -------------------------------------------------------------------------
    9597
    96 class HTMLHeadingElementImpl : public HTMLGenericElementImpl
     98class HTMLHeadingElementImpl : public HTMLElementImpl
    9799{
    98100public:
    99     HTMLHeadingElementImpl(DocumentPtr *doc, ushort _tagid);
     101    HTMLHeadingElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
     102
     103    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     104    virtual int tagPriority() const { return 5; }
     105    virtual bool checkDTD(const NodeImpl* newChild);
    100106
    101107    DOMString align() const;
     
    105111// -------------------------------------------------------------------------
    106112
    107 /*
    108  * were not using HTMLElementImpl as parent class, since a
    109  * paragraph should be able to flow around aligned objects. Thus
    110  * a <p> element has to be inline, and is rendered by
    111  * HTMLBlockImpl::calcParagraph
    112  */
    113113class HTMLParagraphElementImpl : public HTMLElementImpl
    114114{
     
    116116    HTMLParagraphElementImpl(DocumentPtr *doc);
    117117
     118    virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
     119    virtual int tagPriority() const { return 3; }
     120    virtual bool checkDTD(const NodeImpl* newChild);
     121
    118122    virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
    119123    virtual void parseMappedAttribute(MappedAttributeImpl *attr);
    120    
    121     virtual Id id() const;
    122124
    123125    DOMString align() const;
     
    127129// -------------------------------------------------------------------------
    128130
    129 class HTMLPreElementImpl : public HTMLGenericElementImpl
     131class HTMLPreElementImpl : public HTMLElementImpl
    130132{
    131133public:
    132     HTMLPreElementImpl(DocumentPtr *doc, ushort _tagid);
     134    HTMLPreElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
     135
     136    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     137    virtual int tagPriority() const { return 5; }
    133138
    134139    long width() const;
    135     void setWidth( long w );
     140    void setWidth(long w);
    136141};
    137142
     
    142147public:
    143148    HTMLMarqueeElementImpl(DocumentPtr *doc);
     149   
     150    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     151    virtual int tagPriority() const { return 3; }
    144152
    145     virtual Id id() const;
    146    
    147153    virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
    148154    virtual void parseMappedAttribute(MappedAttributeImpl *token);
     
    154160};
    155161
    156 // -------------------------------------------------------------------------
    157 
    158 class HTMLLayerElementImpl : public HTMLDivElementImpl
    159 {
    160 public:
    161     HTMLLayerElementImpl( DocumentPtr *doc );
    162     ~HTMLLayerElementImpl();
    163 
    164     virtual Id id() const;
    165 
    166     bool fixed;
    167 };
    168 
    169162}; //namespace
    170163#endif
  • trunk/WebCore/khtml/html/html_canvasimpl.cpp

    r9158 r9639  
    5656
    5757HTMLCanvasElementImpl::HTMLCanvasElementImpl(DocumentPtr *doc)
    58     : HTMLImageElementImpl(doc)
     58    : HTMLImageElementImpl(HTMLNames::canvas(), doc)
    5959{
    6060}
     
    6262HTMLCanvasElementImpl::~HTMLCanvasElementImpl()
    6363{
    64 }
    65 
    66 NodeImpl::Id HTMLCanvasElementImpl::id() const
    67 {
    68     return ID_CANVAS;
    6964}
    7065
  • trunk/WebCore/khtml/html/html_canvasimpl.h

    r9158 r9639  
    4444public:
    4545    HTMLCanvasElementImpl(DocumentPtr *doc);
    46 
    4746    ~HTMLCanvasElementImpl();
    48 
    49     virtual Id id() const;
    5047
    5148    virtual bool mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const;
  • trunk/WebCore/khtml/html/html_documentimpl.cpp

    r9156 r9639  
    6161#include "html/html_imageimpl.h"
    6262#include "html/html_formimpl.h"
     63#include "htmlfactory.h"
    6364
    6465#include "khtmlview.h"
     
    247248{
    248249    // ### support comments. etc as a child
    249     return (newChild->id() == ID_HTML || newChild->id() == ID_COMMENT);
    250 }
    251 
    252 ElementImpl *HTMLDocumentImpl::createElement( const DOMString &name, int &exceptioncode )
    253 {
    254     return createHTMLElement(name, exceptioncode);
     250    return (newChild->hasTagName(HTMLNames::html()) || newChild->isCommentNode());
     251}
     252
     253ElementImpl *HTMLDocumentImpl::createElement(const DOMString &name, int &exceptioncode)
     254{
     255    // Do not check name validity.  Other browsers don't, and it takes time.
     256    DOMString lowerName(name.lower());
     257    return HTMLElementFactory::createHTMLElement(AtomicString(lowerName), this, 0, false);
    255258}
    256259
  • trunk/WebCore/khtml/html/html_documentimpl.h

    r9156 r9639  
    3535namespace DOM {
    3636
    37     class HTMLElementImpl;
     37class HTMLElementImpl;
    3838
    3939class HTMLDocumentImpl : public DOM::DocumentImpl, public khtml::CachedObjectClient
  • trunk/WebCore/khtml/html/html_elementimpl.cpp

    r9169 r9639  
    2929//#define UNSUPPORTED_ATTR
    3030
    31 #include "html/dtd.h"
    3231#include "html/html_elementimpl.h"
    3332#include "html/html_documentimpl.h"
    3433#include "html/htmltokenizer.h"
     34#include "htmlfactory.h"
    3535
    3636#include "misc/htmlhashes.h"
     37#include "misc/hashset.h"
    3738#include "editing/visible_text.h"
    3839
     
    5960// ------------------------------------------------------------------
    6061
    61 HTMLElementImpl::HTMLElementImpl(DocumentPtr *doc)
    62     : StyledElementImpl(doc)
     62HTMLElementImpl::HTMLElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
     63    : StyledElementImpl(tagName, doc)
    6364{
    6465}
     
    6869}
    6970
    70 bool HTMLElementImpl::isInline() const
    71 {
    72     if (renderer())
    73         return ElementImpl::isInline();
     71DOMString HTMLElementImpl::nodeName() const
     72{
     73    // FIXME: Would be nice to have an atomicstring lookup based off uppercase chars that does not have to copy
     74    // the string on a hit in the hash.
     75    if (getDocument()->isHTMLDocument())
     76        return m_tagName.localName().implementation()->upper();
     77    return ElementImpl::nodeName();
     78}
    7479   
    75     switch(id()) {
    76         case ID_A:
    77         case ID_FONT:
    78         case ID_TT:
    79         case ID_U:
    80         case ID_B:
    81         case ID_I:
    82         case ID_S:
    83         case ID_STRIKE:
    84         case ID_BIG:
    85         case ID_SMALL:
    86    
    87             // %phrase
    88         case ID_EM:
    89         case ID_STRONG:
    90         case ID_DFN:
    91         case ID_CODE:
    92         case ID_SAMP:
    93         case ID_KBD:
    94         case ID_VAR:
    95         case ID_CITE:
    96         case ID_ABBR:
    97         case ID_ACRONYM:
    98    
    99             // %special
    100         case ID_SUB:
    101         case ID_SUP:
    102         case ID_SPAN:
    103         case ID_NOBR:
    104         case ID_WBR:
    105             return true;
    106            
    107         default:
    108             return ElementImpl::isInline();
    109     }
     80HTMLTagStatus HTMLElementImpl::endTagRequirement() const
     81{
     82    if (hasLocalName(HTMLNames::dt()) || hasLocalName(HTMLNames::dd()))
     83        return TagStatusOptional;
     84
     85    // Same values as <span>.  This way custom tag name elements will behave like inline spans.
     86    return TagStatusRequired;
     87}
     88
     89int HTMLElementImpl::tagPriority() const
     90{
     91    if (hasLocalName(HTMLNames::address()) || hasLocalName(HTMLNames::dd()) || hasLocalName(HTMLNames::dt()) || hasLocalName(HTMLNames::noscript()))
     92        return 3;
     93    if (hasLocalName(HTMLNames::center()) || hasLocalName(HTMLNames::nobr()))
     94        return 5;
     95    if (hasLocalName(HTMLNames::noembed()) || hasLocalName(HTMLNames::noframes()))
     96        return 10;
     97
     98    // Same values as <span>.  This way custom tag name elements will behave like inline spans.
     99    return 1;
    110100}
    111101
    112102NodeImpl *HTMLElementImpl::cloneNode(bool deep)
    113103{
    114     HTMLElementImpl *clone = static_cast<HTMLElementImpl *>(getDocument()->createHTMLElement(localNamePart(id())));
     104    HTMLElementImpl *clone = HTMLElementFactory::createHTMLElement(m_tagName.localName(), getDocument(), 0, false);
    115105    if (!clone)
    116106        return 0;
     
    326316{
    327317    // the following is in accordance with the definition as used by IE
    328     if( endTagRequirement(id()) == FORBIDDEN )
    329         return NULL;
    330     // IE disallows innerHTML on inline elements. I don't see why we should have this restriction, as our
    331     // dhtml engine can cope with it. Lars
    332     //if ( isInline() ) return false;
    333     switch( id() ) {
    334         case ID_COL:
    335         case ID_COLGROUP:
    336         case ID_FRAMESET:
    337         case ID_HEAD:
    338         case ID_STYLE:
    339         case ID_TITLE:
    340             return NULL;
    341         default:
    342             break;
    343     }
    344     if ( !getDocument()->isHTMLDocument() )
    345         return NULL;
    346 
    347     DocumentFragmentImpl *fragment = new DocumentFragmentImpl( docPtr() );
     318    if (endTagRequirement() == TagStatusForbidden)
     319        return 0;
     320
     321    if (hasLocalName(HTMLNames::col()) || hasLocalName(HTMLNames::colgroup()) || hasLocalName(HTMLNames::frameset()) ||
     322        hasLocalName(HTMLNames::head()) || hasLocalName(HTMLNames::style()) || hasLocalName(HTMLNames::title()))
     323        return 0;
     324
     325    if (!getDocument()->isHTMLDocument())
     326        return 0;
     327
     328    DocumentFragmentImpl *fragment = new DocumentFragmentImpl(docPtr());
    348329    fragment->ref();
    349330    {
     
    359340
    360341    // we need to pop <html> and <body> elements and remove <head> to
    361     // accomadate folks passing complete HTML documents to make the
     342    // accommodate folks passing complete HTML documents to make the
    362343    // child of an element.
    363344
     
    366347        nextNode = node->nextSibling();
    367348        node->ref();
    368         if (node->id() == ID_HTML || node->id() == ID_BODY) {
     349        if (node->hasTagName(HTMLNames::html()) || node->hasTagName(HTMLNames::body())) {
    369350            NodeImpl *firstChild = node->firstChild();
    370351            if (firstChild != NULL) {
     
    380361            }
    381362            fragment->removeChild(node, ignoredExceptionCode);
    382         } else if (node->id() == ID_HEAD) {
     363        } else if (node->hasTagName(HTMLNames::head()))
    383364            fragment->removeChild(node, ignoredExceptionCode);
    384         }
     365
    385366        // Important to do this deref after removeChild, because if the only thing
    386367        // keeping a node around is a parent that is non-0, removeChild will not
     
    401382void HTMLElementImpl::setInnerHTML(const DOMString &html, int &exception)
    402383{
    403     DocumentFragmentImpl *fragment = createContextualFragment( html );
     384    DocumentFragmentImpl *fragment = createContextualFragment(html);
    404385    if (fragment == NULL) {
    405386        exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
     
    419400    }
    420401    HTMLElementImpl *parent = static_cast<HTMLElementImpl *>(p);
    421     DocumentFragmentImpl *fragment = parent->createContextualFragment( html );
     402    DocumentFragmentImpl *fragment = parent->createContextualFragment(html);
    422403
    423404    if (!fragment) {
     
    435416{
    436417    // following the IE specs.
    437     if (endTagRequirement(id()) == FORBIDDEN) {
     418    if (endTagRequirement() == TagStatusForbidden) {
    438419        exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
    439420        return;
    440421    }
    441422
    442     // IE disallows innerText on inline elements. I don't see why we should have this restriction, as our
    443     // dhtml engine can cope with it. Lars
    444     //if ( isInline() ) return false;
    445     switch( id() ) {
    446         case ID_COL:
    447         case ID_COLGROUP:
    448         case ID_FRAMESET:
    449         case ID_HEAD:
    450         case ID_HTML:
    451         case ID_TABLE:
    452         case ID_TBODY:
    453         case ID_TFOOT:
    454         case ID_THEAD:
    455         case ID_TR:
    456             exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
    457             return;
    458         default:
    459             break;
     423    if (hasLocalName(HTMLNames::col()) || hasLocalName(HTMLNames::colgroup()) || hasLocalName(HTMLNames::frameset()) ||
     424        hasLocalName(HTMLNames::head()) || hasLocalName(HTMLNames::html()) || hasLocalName(HTMLNames::table()) ||
     425        hasLocalName(HTMLNames::tbody()) || hasLocalName(HTMLNames::tfoot()) || hasLocalName(HTMLNames::thead()) ||
     426        hasLocalName(HTMLNames::tr())) {
     427        exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
     428        return;
    460429    }
    461430
     
    467436{
    468437    // following the IE specs.
    469     if( endTagRequirement(id()) == FORBIDDEN ) {
     438    if (endTagRequirement() == TagStatusForbidden) {
    470439        exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
    471440        return;
    472441    }
    473     switch( id() ) {
    474         case ID_COL:
    475         case ID_COLGROUP:
    476         case ID_FRAMESET:
    477         case ID_HEAD:
    478         case ID_HTML:
    479         case ID_TABLE:
    480         case ID_TBODY:
    481         case ID_TFOOT:
    482         case ID_THEAD:
    483         case ID_TR:
    484             exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
    485             return;
    486         default:
    487             break;
     442
     443    if (hasLocalName(HTMLNames::col()) || hasLocalName(HTMLNames::colgroup()) || hasLocalName(HTMLNames::frameset()) ||
     444        hasLocalName(HTMLNames::head()) || hasLocalName(HTMLNames::html()) || hasLocalName(HTMLNames::table()) ||
     445        hasLocalName(HTMLNames::tbody()) || hasLocalName(HTMLNames::tfoot()) || hasLocalName(HTMLNames::thead()) ||
     446        hasLocalName(HTMLNames::tr())) {
     447        exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
     448        return;
    488449    }
    489450
     
    524485            return;
    525486    }
    526 }
    527 
    528 
    529 DOMString HTMLElementImpl::namespaceURI() const
    530 {
    531     // For HTML documents, we treat HTML elements as having no namespace. But for XML documents
    532     // the elements have the namespace defined in the XHTML spec
    533     if (getDocument()->isHTMLDocument())
    534         return DOMString();
    535     else
    536         return XHTML_NAMESPACE;
    537487}
    538488
     
    683633        result += ">";
    684634
    685         if (endTagRequirement(id()) == REQUIRED) {
     635        if (endTagRequirement() == TagStatusRequired) {
    686636            result += "</";
    687             result += tagName();
     637            result += nodeName();
    688638            result += ">";
    689639        }
     
    695645}
    696646
    697 DOMString HTMLElementImpl::idDOM() const
     647DOMString HTMLElementImpl::id() const
    698648{
    699649    return getAttribute(ATTR_ID);
     
    750700}
    751701
    752 // -------------------------------------------------------------------------
    753 
    754 HTMLGenericElementImpl::HTMLGenericElementImpl(DocumentPtr *doc, ushort i)
    755     : HTMLElementImpl(doc)
    756 {
    757     m_elementId = i;
    758 }
    759 
    760 NodeImpl::Id HTMLGenericElementImpl::id() const
    761 {
    762     return m_elementId;
    763 }
     702// DOM Section 1.1.1
     703bool HTMLElementImpl::childAllowed(NodeImpl *newChild)
     704{
     705    if (!ElementImpl::childAllowed(newChild))
     706        return false;
     707
     708    // For XML documents, we are non-validating and do not check against a DTD, even for HTML elements.
     709    if (!getDocument()->isHTMLDocument())
     710        return true;
     711
     712    // Future-proof for XML content inside HTML documents (we may allow this some day).
     713    if (newChild->isElementNode() && !newChild->isHTMLElement())
     714        return true;
     715
     716    // Elements with forbidden tag status can never have children
     717    if (endTagRequirement() == TagStatusForbidden)
     718        return false;
     719
     720    // Comment nodes are always allowed.
     721    if (newChild->isCommentNode())
     722        return true;
     723
     724    // Now call checkDTD.
     725    return checkDTD(newChild);
     726}
     727
     728// DTD Stuff
     729// This unfortunate function is only needed when checking against the DTD.  Other languages (like SVG) won't need this.
     730bool HTMLElementImpl::isRecognizedTagName(const QualifiedName& tagName)
     731{
     732    static HashSet<DOMStringImpl*, PointerHash<DOMStringImpl*> > tagList;
     733    if (tagList.isEmpty()) {
     734        tagList.insert(HTMLNames::a().localName().implementation());
     735        tagList.insert(HTMLNames::abbr().localName().implementation());
     736        tagList.insert(HTMLNames::acronym().localName().implementation());
     737        tagList.insert(HTMLNames::address().localName().implementation());
     738        tagList.insert(HTMLNames::applet().localName().implementation());
     739        tagList.insert(HTMLNames::area().localName().implementation());
     740        tagList.insert(HTMLNames::b().localName().implementation());
     741        tagList.insert(HTMLNames::base().localName().implementation());
     742        tagList.insert(HTMLNames::basefont().localName().implementation());
     743        tagList.insert(HTMLNames::bdo().localName().implementation());
     744        tagList.insert(HTMLNames::big().localName().implementation());
     745        tagList.insert(HTMLNames::blockquote().localName().implementation());
     746        tagList.insert(HTMLNames::body().localName().implementation());
     747        tagList.insert(HTMLNames::br().localName().implementation());
     748        tagList.insert(HTMLNames::button().localName().implementation());
     749        tagList.insert(HTMLNames::canvas().localName().implementation());
     750        tagList.insert(HTMLNames::caption().localName().implementation());
     751        tagList.insert(HTMLNames::center().localName().implementation());
     752        tagList.insert(HTMLNames::cite().localName().implementation());
     753        tagList.insert(HTMLNames::code().localName().implementation());
     754        tagList.insert(HTMLNames::col().localName().implementation());
     755        tagList.insert(HTMLNames::colgroup().localName().implementation());
     756        tagList.insert(HTMLNames::dd().localName().implementation());
     757        tagList.insert(HTMLNames::del().localName().implementation());
     758        tagList.insert(HTMLNames::dfn().localName().implementation());
     759        tagList.insert(HTMLNames::dir().localName().implementation());
     760        tagList.insert(HTMLNames::div().localName().implementation());
     761        tagList.insert(HTMLNames::dl().localName().implementation());
     762        tagList.insert(HTMLNames::dt().localName().implementation());
     763        tagList.insert(HTMLNames::em().localName().implementation());
     764        tagList.insert(HTMLNames::embed().localName().implementation());
     765        tagList.insert(HTMLNames::fieldset().localName().implementation());
     766        tagList.insert(HTMLNames::font().localName().implementation());
     767        tagList.insert(HTMLNames::form().localName().implementation());
     768        tagList.insert(HTMLNames::frame().localName().implementation());
     769        tagList.insert(HTMLNames::frameset().localName().implementation());
     770        tagList.insert(HTMLNames::head().localName().implementation());
     771        tagList.insert(HTMLNames::h1().localName().implementation());
     772        tagList.insert(HTMLNames::h2().localName().implementation());
     773        tagList.insert(HTMLNames::h3().localName().implementation());
     774        tagList.insert(HTMLNames::h4().localName().implementation());
     775        tagList.insert(HTMLNames::h5().localName().implementation());
     776        tagList.insert(HTMLNames::h6().localName().implementation());
     777        tagList.insert(HTMLNames::hr().localName().implementation());
     778        tagList.insert(HTMLNames::html().localName().implementation());
     779        tagList.insert(HTMLNames::i().localName().implementation());
     780        tagList.insert(HTMLNames::iframe().localName().implementation());
     781        tagList.insert(HTMLNames::img().localName().implementation());
     782        tagList.insert(HTMLNames::input().localName().implementation());
     783        tagList.insert(HTMLNames::ins().localName().implementation());
     784        tagList.insert(HTMLNames::isindex().localName().implementation());
     785        tagList.insert(HTMLNames::kbd().localName().implementation());
     786        tagList.insert(HTMLNames::keygen().localName().implementation());
     787        tagList.insert(HTMLNames::label().localName().implementation());
     788        tagList.insert(HTMLNames::layer().localName().implementation());
     789        tagList.insert(HTMLNames::legend().localName().implementation());
     790        tagList.insert(HTMLNames::li().localName().implementation());
     791        tagList.insert(HTMLNames::link().localName().implementation());
     792        tagList.insert(HTMLNames::map().localName().implementation());
     793        tagList.insert(HTMLNames::marquee().localName().implementation());
     794        tagList.insert(HTMLNames::menu().localName().implementation());
     795        tagList.insert(HTMLNames::meta().localName().implementation());
     796        tagList.insert(HTMLNames::nobr().localName().implementation());
     797        tagList.insert(HTMLNames::noembed().localName().implementation());
     798        tagList.insert(HTMLNames::noframes().localName().implementation());
     799        tagList.insert(HTMLNames::nolayer().localName().implementation());
     800        tagList.insert(HTMLNames::noscript().localName().implementation());
     801        tagList.insert(HTMLNames::object().localName().implementation());
     802        tagList.insert(HTMLNames::ol().localName().implementation());
     803        tagList.insert(HTMLNames::optgroup().localName().implementation());
     804        tagList.insert(HTMLNames::option().localName().implementation());
     805        tagList.insert(HTMLNames::p().localName().implementation());
     806        tagList.insert(HTMLNames::param().localName().implementation());
     807        tagList.insert(HTMLNames::plaintext().localName().implementation());
     808        tagList.insert(HTMLNames::pre().localName().implementation());
     809        tagList.insert(HTMLNames::q().localName().implementation());
     810        tagList.insert(HTMLNames::s().localName().implementation());
     811        tagList.insert(HTMLNames::samp().localName().implementation());
     812        tagList.insert(HTMLNames::script().localName().implementation());
     813        tagList.insert(HTMLNames::select().localName().implementation());
     814        tagList.insert(HTMLNames::small().localName().implementation());
     815        tagList.insert(HTMLNames::span().localName().implementation());
     816        tagList.insert(HTMLNames::strike().localName().implementation());
     817        tagList.insert(HTMLNames::strong().localName().implementation());
     818        tagList.insert(HTMLNames::style().localName().implementation());
     819        tagList.insert(HTMLNames::sub().localName().implementation());
     820        tagList.insert(HTMLNames::sup().localName().implementation());
     821        tagList.insert(HTMLNames::table().localName().implementation());
     822        tagList.insert(HTMLNames::tbody().localName().implementation());
     823        tagList.insert(HTMLNames::td().localName().implementation());
     824        tagList.insert(HTMLNames::textarea().localName().implementation());
     825        tagList.insert(HTMLNames::tfoot().localName().implementation());
     826        tagList.insert(HTMLNames::th().localName().implementation());
     827        tagList.insert(HTMLNames::thead().localName().implementation());
     828        tagList.insert(HTMLNames::title().localName().implementation());
     829        tagList.insert(HTMLNames::tr().localName().implementation());
     830        tagList.insert(HTMLNames::tt().localName().implementation());
     831        tagList.insert(HTMLNames::u().localName().implementation());
     832        tagList.insert(HTMLNames::ul().localName().implementation());
     833        tagList.insert(HTMLNames::var().localName().implementation());
     834        tagList.insert(HTMLNames::wbr().localName().implementation());
     835        tagList.insert(HTMLNames::xmp().localName().implementation());
     836    }
     837
     838    return tagList.contains(tagName.localName().implementation());
     839}
     840
     841// The terms inline and block are used here loosely.  Don't make the mistake of assuming all inlines or all blocks
     842// need to be in these two lists.
     843HashSet<DOMStringImpl*, PointerHash<DOMStringImpl*> >* inlineTagList() {
     844    static HashSet<DOMStringImpl*, PointerHash<DOMStringImpl*> > tagList;
     845    if (tagList.isEmpty()) {
     846        tagList.insert(HTMLNames::tt().localName().implementation());
     847        tagList.insert(HTMLNames::i().localName().implementation());
     848        tagList.insert(HTMLNames::b().localName().implementation());
     849        tagList.insert(HTMLNames::u().localName().implementation());
     850        tagList.insert(HTMLNames::s().localName().implementation());
     851        tagList.insert(HTMLNames::strike().localName().implementation());
     852        tagList.insert(HTMLNames::big().localName().implementation());
     853        tagList.insert(HTMLNames::small().localName().implementation());
     854        tagList.insert(HTMLNames::em().localName().implementation());
     855        tagList.insert(HTMLNames::strong().localName().implementation());
     856        tagList.insert(HTMLNames::dfn().localName().implementation());
     857        tagList.insert(HTMLNames::code().localName().implementation());
     858        tagList.insert(HTMLNames::samp().localName().implementation());
     859        tagList.insert(HTMLNames::kbd().localName().implementation());
     860        tagList.insert(HTMLNames::var().localName().implementation());
     861        tagList.insert(HTMLNames::cite().localName().implementation());
     862        tagList.insert(HTMLNames::abbr().localName().implementation());
     863        tagList.insert(HTMLNames::acronym().localName().implementation());
     864        tagList.insert(HTMLNames::a().localName().implementation());
     865        tagList.insert(HTMLNames::canvas().localName().implementation());
     866        tagList.insert(HTMLNames::img().localName().implementation());
     867        tagList.insert(HTMLNames::applet().localName().implementation());
     868        tagList.insert(HTMLNames::object().localName().implementation());
     869        tagList.insert(HTMLNames::embed().localName().implementation());
     870        tagList.insert(HTMLNames::font().localName().implementation());
     871        tagList.insert(HTMLNames::basefont().localName().implementation());
     872        tagList.insert(HTMLNames::br().localName().implementation());
     873        tagList.insert(HTMLNames::script().localName().implementation());
     874        tagList.insert(HTMLNames::map().localName().implementation());
     875        tagList.insert(HTMLNames::q().localName().implementation());
     876        tagList.insert(HTMLNames::sub().localName().implementation());
     877        tagList.insert(HTMLNames::sup().localName().implementation());
     878        tagList.insert(HTMLNames::span().localName().implementation());
     879        tagList.insert(HTMLNames::bdo().localName().implementation());
     880        tagList.insert(HTMLNames::iframe().localName().implementation());
     881        tagList.insert(HTMLNames::input().localName().implementation());
     882        tagList.insert(HTMLNames::keygen().localName().implementation());
     883        tagList.insert(HTMLNames::select().localName().implementation());
     884        tagList.insert(HTMLNames::textarea().localName().implementation());
     885        tagList.insert(HTMLNames::label().localName().implementation());
     886        tagList.insert(HTMLNames::button().localName().implementation());
     887        tagList.insert(HTMLNames::ins().localName().implementation());
     888        tagList.insert(HTMLNames::del().localName().implementation());
     889        tagList.insert(HTMLNames::nobr().localName().implementation());
     890        tagList.insert(HTMLNames::wbr().localName().implementation());
     891    }
     892    return &tagList;
     893}
     894
     895HashSet<DOMStringImpl*, PointerHash<DOMStringImpl*> >* blockTagList() {
     896    static HashSet<DOMStringImpl*, PointerHash<DOMStringImpl*> > tagList;
     897    if (tagList.isEmpty()) {
     898        tagList.insert(HTMLNames::p().localName().implementation());
     899        tagList.insert(HTMLNames::h1().localName().implementation());
     900        tagList.insert(HTMLNames::h2().localName().implementation());
     901        tagList.insert(HTMLNames::h3().localName().implementation());
     902        tagList.insert(HTMLNames::h4().localName().implementation());
     903        tagList.insert(HTMLNames::h5().localName().implementation());
     904        tagList.insert(HTMLNames::h6().localName().implementation());
     905        tagList.insert(HTMLNames::ul().localName().implementation());
     906        tagList.insert(HTMLNames::ol().localName().implementation());
     907        tagList.insert(HTMLNames::dir().localName().implementation());
     908        tagList.insert(HTMLNames::menu().localName().implementation());
     909        tagList.insert(HTMLNames::pre().localName().implementation());
     910        tagList.insert(HTMLNames::plaintext().localName().implementation());
     911        tagList.insert(HTMLNames::xmp().localName().implementation());
     912        tagList.insert(HTMLNames::dl().localName().implementation());
     913        tagList.insert(HTMLNames::div().localName().implementation());
     914        tagList.insert(HTMLNames::layer().localName().implementation());
     915        tagList.insert(HTMLNames::center().localName().implementation());
     916        tagList.insert(HTMLNames::noscript().localName().implementation());
     917        tagList.insert(HTMLNames::noframes().localName().implementation());
     918        tagList.insert(HTMLNames::blockquote().localName().implementation());
     919        tagList.insert(HTMLNames::form().localName().implementation());
     920        tagList.insert(HTMLNames::isindex().localName().implementation());
     921        tagList.insert(HTMLNames::hr().localName().implementation());
     922        tagList.insert(HTMLNames::table().localName().implementation());
     923        tagList.insert(HTMLNames::fieldset().localName().implementation());
     924        tagList.insert(HTMLNames::address().localName().implementation());
     925        tagList.insert(HTMLNames::li().localName().implementation());
     926        tagList.insert(HTMLNames::dd().localName().implementation());
     927        tagList.insert(HTMLNames::dt().localName().implementation());
     928        tagList.insert(HTMLNames::marquee().localName().implementation());
     929    }
     930    return &tagList;
     931}
     932
     933bool HTMLElementImpl::inEitherTagList(const NodeImpl* newChild)
     934{
     935    if (newChild->isTextNode())
     936        return true;
     937       
     938    if (newChild->isHTMLElement()) {
     939        const HTMLElementImpl* child = static_cast<const HTMLElementImpl*>(newChild);
     940        if (inlineTagList()->contains(child->tagName().localName().implementation()))
     941            return true;
     942        if (blockTagList()->contains(child->tagName().localName().implementation()))
     943            return true;
     944        return !isRecognizedTagName(child->tagName()); // Accept custom html tags
     945    }
     946
     947    return false;
     948}
     949
     950bool HTMLElementImpl::inInlineTagList(const NodeImpl* newChild)
     951{
     952    if (newChild->isTextNode())
     953        return true;
     954
     955    if (newChild->isHTMLElement()) {
     956        const HTMLElementImpl* child = static_cast<const HTMLElementImpl*>(newChild);
     957        if (inlineTagList()->contains(child->tagName().localName().implementation()))
     958            return true;
     959        return !isRecognizedTagName(child->tagName()); // Accept custom html tags
     960    }
     961
     962    return false;
     963}
     964
     965bool HTMLElementImpl::inBlockTagList(const NodeImpl* newChild)
     966{
     967    if (newChild->isTextNode())
     968        return true;
     969           
     970    if (newChild->isHTMLElement()) {
     971        const HTMLElementImpl* child = static_cast<const HTMLElementImpl*>(newChild);
     972        return (blockTagList()->contains(child->tagName().localName().implementation()));
     973    }
     974
     975    return false;
     976}
     977
     978bool HTMLElementImpl::checkDTD(const NodeImpl* newChild)
     979{
     980    if (hasTagName(HTMLNames::address()) && newChild->hasTagName(HTMLNames::p()))
     981        return true;
     982    return inEitherTagList(newChild);
     983}
  • trunk/WebCore/khtml/html/html_elementimpl.h

    r9158 r9639  
    2626
    2727#include "xml/dom_elementimpl.h"
    28 #include <qptrdict.h>
     28#include "htmlnames.h"
    2929
    3030namespace DOM {
     
    3333class DOMString;
    3434class HTMLCollectionImpl;
    35    
     35
     36enum HTMLTagStatus { TagStatusOptional, TagStatusRequired, TagStatusForbidden };
     37                       
    3638class HTMLElementImpl : public StyledElementImpl
    3739{
    3840public:
    39     HTMLElementImpl(DocumentPtr *doc);
    40 
     41    HTMLElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
    4142    virtual ~HTMLElementImpl();
    4243
    4344    virtual bool isHTMLElement() const { return true; }
    4445
    45     virtual bool isInline() const;
    46      
    47     virtual Id id() const = 0;
    48    
     46    virtual DOMString nodeName() const;
     47
    4948    virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
    5049    virtual void parseMappedAttribute(MappedAttributeImpl* attr);
     
    5453    SharedPtr<HTMLCollectionImpl> children();
    5554   
    56     DOMString idDOM() const; // rename to id after eliminating NodeImpl::id some day
     55    DOMString id() const;
    5756    void setId(const DOMString &value);
    5857    DOMString title() const;
     
    7473    void setInnerText(const DOMString &text, int &exception);
    7574    void setOuterText(const DOMString &text, int &exception);
    76 
    77     virtual DOMString namespaceURI() const;
    7875   
    7976    virtual bool isFocusable() const;
     
    9087    virtual DOMString toString() const;
    9188
     89    virtual HTMLTagStatus endTagRequirement() const;
     90    virtual int tagPriority() const;
     91    virtual bool childAllowed(NodeImpl* newChild); // Error-checking during parsing that checks the DTD
     92
     93    // Helper function to check the DTD for a given child node.
     94    virtual bool checkDTD(const NodeImpl* newChild);
     95    static bool inEitherTagList(const NodeImpl* newChild);
     96    static bool inInlineTagList(const NodeImpl* newChild);
     97    static bool inBlockTagList(const NodeImpl* newChild);
     98    static bool isRecognizedTagName(const QualifiedName& tagName);
     99
    92100protected:
    93101
     
    96104};
    97105
    98 class HTMLGenericElementImpl : public HTMLElementImpl
    99 {
    100 public:
    101     HTMLGenericElementImpl(DocumentPtr *doc, ushort elementId);
    102     virtual Id id() const;
    103 
    104 protected:
    105     ushort m_elementId;
    106 };
    107 
    108106} //namespace
    109107
  • trunk/WebCore/khtml/html/html_formimpl.cpp

    r9524 r9639  
    104104
    105105HTMLFormElementImpl::HTMLFormElementImpl(DocumentPtr *doc)
    106     : HTMLElementImpl(doc)
     106    : HTMLElementImpl(HTMLNames::form(), doc)
    107107{
    108108    collectionInfo = 0;
     
    131131}
    132132
    133 NodeImpl::Id HTMLFormElementImpl::id() const
    134 {
    135     return ID_FORM;
    136 }
    137 
    138133#if APPLE_CHANGES
    139134
     
    193188    bool submitFound = false;
    194189    for (unsigned i = 0; i < formElements.count(); ++i) {
    195         if (formElements[i]->id() == ID_INPUT) {
     190        if (formElements[i]->hasLocalName(HTMLNames::input())) {
    196191            HTMLInputElementImpl *element = static_cast<HTMLInputElementImpl *>(formElements[i]);
    197192            if (element->isSuccessfulSubmitButton() && element->renderer()) {
     
    400395                    // if the current type is FILE, then we also need to
    401396                    // include the filename
    402                     if (current->nodeType() == Node::ELEMENT_NODE && current->id() == ID_INPUT &&
     397                    if (current->hasLocalName(HTMLNames::input()) &&
    403398                        static_cast<HTMLInputElementImpl*>(current)->inputType() == HTMLInputElementImpl::FILE)
    404399                    {
     
    548543        // Our app needs to get form values for password fields for doing password autocomplete,
    549544        // so we are more lenient in pushing values, and let the app decide what to save when.
    550         if (current->id() == ID_INPUT) {
     545        if (current->hasLocalName(HTMLNames::input())) {
    551546            HTMLInputElementImpl *input = static_cast<HTMLInputElementImpl*>(current);
    552547            if (input->inputType() == HTMLInputElementImpl::TEXT
     
    710705    for (unsigned i = 0; i < formElements.count(); ++i) {
    711706        HTMLGenericFormElementImpl *current = formElements[i];
    712         if (current->id() == ID_INPUT &&
     707        if (current->hasLocalName(HTMLNames::input()) &&
    713708            static_cast<HTMLInputElementImpl*>(current)->inputType() == HTMLInputElementImpl::RADIO &&
    714709            current != caller && current->form() == caller->form() && current->name() == caller->name()) {
     
    865860// -------------------------------------------------------------------------
    866861
    867 HTMLGenericFormElementImpl::HTMLGenericFormElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
    868     : HTMLElementImpl(doc)
     862HTMLGenericFormElementImpl::HTMLGenericFormElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f)
     863    : HTMLElementImpl(tagName, doc)
    869864{
    870865    m_disabled = m_readOnly = false;
     
    968963{
    969964    NodeImpl *p = parentNode();
    970     while(p)
    971     {
    972         if( p->id() == ID_FORM )
     965    while(p) {
     966        if (p->hasTagName(HTMLNames::form()))
    973967            return static_cast<HTMLFormElementImpl *>(p);
    974968        p = p->parentNode();
     
    11901184
    11911185HTMLButtonElementImpl::HTMLButtonElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
    1192     : HTMLGenericFormElementImpl(doc, f)
     1186    : HTMLGenericFormElementImpl(HTMLNames::button(), doc, f)
    11931187{
    11941188    m_type = SUBMIT;
     
    11991193HTMLButtonElementImpl::~HTMLButtonElementImpl()
    12001194{
    1201 }
    1202 
    1203 NodeImpl::Id HTMLButtonElementImpl::id() const
    1204 {
    1205     return ID_BUTTON;
    12061195}
    12071196
     
    13271316
    13281317HTMLFieldSetElementImpl::HTMLFieldSetElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
    1329    : HTMLGenericFormElementImpl(doc, f)
     1318   : HTMLGenericFormElementImpl(HTMLNames::fieldset(), doc, f)
    13301319{
    13311320}
     
    13351324}
    13361325
     1326bool HTMLFieldSetElementImpl::checkDTD(const NodeImpl* newChild)
     1327{
     1328        return newChild->hasTagName(HTMLNames::legend()) || HTMLElementImpl::checkDTD(newChild);
     1329}
     1330
    13371331bool HTMLFieldSetElementImpl::isFocusable() const
    13381332{
     
    13401334}
    13411335
    1342 NodeImpl::Id HTMLFieldSetElementImpl::id() const
    1343 {
    1344     return ID_FIELDSET;
    1345 }
    1346 
    13471336DOMString HTMLFieldSetElementImpl::type() const
    13481337{
     
    13581347
    13591348HTMLInputElementImpl::HTMLInputElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
    1360     : HTMLGenericFormElementImpl(doc, f), m_imageLoader(0), m_valueMatchesRenderer(false)
    1361 {
     1349    : HTMLGenericFormElementImpl(HTMLNames::input(), doc, f)
     1350{
     1351    init();
     1352}
     1353
     1354HTMLInputElementImpl::HTMLInputElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f)
     1355    : HTMLGenericFormElementImpl(tagName, doc, f)
     1356{
     1357    init();
     1358}
     1359
     1360void HTMLInputElementImpl::init()
     1361{
     1362    m_imageLoader = 0;
     1363    m_valueMatchesRenderer = false;
    13621364    m_type = TEXT;
    13631365    m_maxLen = -1;
     
    13771379    m_maxResults = -1;
    13781380
    1379     if ( m_form )
    1380         m_autocomplete = f->autoComplete();
     1381    if (m_form)
     1382        m_autocomplete = m_form->autoComplete();
    13811383}
    13821384
     
    13851387    if (getDocument()) getDocument()->deregisterMaintainsState(this);
    13861388    delete m_imageLoader;
    1387 }
    1388 
    1389 NodeImpl::Id HTMLInputElementImpl::id() const
    1390 {
    1391     return ID_INPUT;
    13921389}
    13931390
     
    24692466
    24702467HTMLLabelElementImpl::HTMLLabelElementImpl(DocumentPtr *doc)
    2471     : HTMLElementImpl(doc)
     2468    : HTMLElementImpl(HTMLNames::label(), doc)
    24722469{
    24732470}
     
    24802477{
    24812478    return false;
    2482 }
    2483 
    2484 NodeImpl::Id HTMLLabelElementImpl::id() const
    2485 {
    2486     return ID_LABEL;
    24872479}
    24882480
     
    25402532{
    25412533    for (NodeImpl *p = parentNode(); p != 0; p = p->parentNode()) {
    2542         if (p->id() == ID_FORM)
     2534        if (p->hasTagName(HTMLNames::form()))
    25432535            return static_cast<HTMLFormElementImpl *>(p);
    25442536    }
     
    25702562
    25712563HTMLLegendElementImpl::HTMLLegendElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
    2572 : HTMLGenericFormElementImpl(doc, f)
     2564: HTMLGenericFormElementImpl(HTMLNames::legend(), doc, f)
    25732565{
    25742566}
     
    25812573{
    25822574    return false;
    2583 }
    2584 
    2585 NodeImpl::Id HTMLLegendElementImpl::id() const
    2586 {
    2587     return ID_LEGEND;
    25882575}
    25892576
     
    26222609    // Check if there's a fieldset belonging to this legend.
    26232610    NodeImpl *fieldset = parentNode();
    2624     while (fieldset && fieldset->id() != ID_FIELDSET)
     2611    while (fieldset && !fieldset->hasTagName(HTMLNames::fieldset()))
    26252612        fieldset = fieldset->parentNode();
    26262613    if (!fieldset)
     
    26332620        if (node->isHTMLElement()) {
    26342621            HTMLElementImpl *element = static_cast<HTMLElementImpl *>(node);
    2635             if (element->id() != ID_LEGEND && element->isGenericFormElement())
     2622            if (!element->hasLocalName(HTMLNames::legend()) && element->isGenericFormElement())
    26362623                return element;
    26372624        }
     
    26562643
    26572644HTMLSelectElementImpl::HTMLSelectElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
    2658     : HTMLGenericFormElementImpl(doc, f), m_options(0)
    2659 {
     2645    : HTMLGenericFormElementImpl(HTMLNames::select(), doc, f), m_options(0)
     2646{
     2647    init();
     2648}
     2649
     2650HTMLSelectElementImpl::HTMLSelectElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f)
     2651    : HTMLGenericFormElementImpl(tagName, doc, f), m_options(0)
     2652{
     2653    init();
     2654}
     2655
     2656void HTMLSelectElementImpl::init()
     2657{
     2658    m_options = 0;
    26602659    m_multiple = false;
    26612660    m_recalcListItems = false;
     
    26742673}
    26752674
    2676 NodeImpl::Id HTMLSelectElementImpl::id() const
    2677 {
    2678     return ID_SELECT;
     2675bool HTMLSelectElementImpl::checkDTD(const NodeImpl* newChild)
     2676{
     2677        return newChild->isTextNode() || newChild->hasTagName(HTMLNames::option()) || newChild->hasTagName(HTMLNames::optgroup()) ||
     2678                   newChild->hasTagName(HTMLNames::script());
    26792679}
    26802680
     
    27002700    QMemArray<HTMLGenericFormElementImpl*> items = listItems();
    27012701    for (unsigned int i = 0; i < items.size(); i++) {
    2702         if (items[i]->id() == ID_OPTION) {
     2702        if (items[i]->hasLocalName(HTMLNames::option())) {
    27032703            if (static_cast<HTMLOptionElementImpl*>(items[i])->selected())
    27042704                return o;
     
    27162716    int listIndex;
    27172717    for (listIndex = 0; listIndex < int(items.size()); listIndex++) {
    2718         if (items[listIndex]->id() == ID_OPTION)
     2718        if (items[listIndex]->hasLocalName(HTMLNames::option()))
    27192719            static_cast<HTMLOptionElementImpl*>(items[listIndex])->setSelected(false);
    27202720    }
     
    27322732    QMemArray<HTMLGenericFormElementImpl*> items = listItems();
    27332733    for (i = 0; i < items.size(); i++) {
    2734         if (items[i]->id() == ID_OPTION)
     2734        if (items[i]->hasLocalName(HTMLNames::option()))
    27352735            len++;
    27362736    }
     
    27402740void HTMLSelectElementImpl::add( HTMLElementImpl *element, HTMLElementImpl *before )
    27412741{
    2742     if (!element || element->id() != ID_OPTION)
     2742    if (!element || !element->hasLocalName(HTMLNames::option()))
    27432743        return;
    27442744
     
    27742774}
    27752775
    2776 DOMString HTMLSelectElementImpl::value( )
     2776DOMString HTMLSelectElementImpl::value()
    27772777{
    27782778    uint i;
    27792779    QMemArray<HTMLGenericFormElementImpl*> items = listItems();
    27802780    for (i = 0; i < items.size(); i++) {
    2781         if ( items[i]->id() == ID_OPTION
    2782             && static_cast<HTMLOptionElementImpl*>(items[i])->selected())
     2781        if (items[i]->hasLocalName(HTMLNames::option()) && static_cast<HTMLOptionElementImpl*>(items[i])->selected())
    27832782            return static_cast<HTMLOptionElementImpl*>(items[i])->value();
    27842783    }
     
    27942793    QMemArray<HTMLGenericFormElementImpl*> items = listItems();
    27952794    for (unsigned i = 0; i < items.size(); i++)
    2796         if (items[i]->id() == ID_OPTION && static_cast<HTMLOptionElementImpl*>(items[i])->value() == value) {
     2795        if (items[i]->hasLocalName(HTMLNames::option()) && static_cast<HTMLOptionElementImpl*>(items[i])->value() == value) {
    27972796            static_cast<HTMLOptionElementImpl*>(items[i])->setSelected(true);
    27982797            return;
     
    28002799}
    28012800
    2802 QString HTMLSelectElementImpl::state( )
     2801QString HTMLSelectElementImpl::state()
    28032802{
    28042803#if !APPLE_CHANGES
     
    28132812   
    28142813    for(int i = 0; i < l; i++)
    2815         if(items[i]->id() == ID_OPTION && static_cast<HTMLOptionElementImpl*>(items[i])->selected())
     2814        if(items[i]->hasLocalName(HTMLNames::option()) && static_cast<HTMLOptionElementImpl*>(items[i])->selected())
    28162815            stateChars[i] = 'X';
    28172816        else
     
    28502849    int l = items.count();
    28512850    for(int i = 0; i < l; i++) {
    2852         if(items[i]->id() == ID_OPTION) {
     2851        if(items[i]->hasLocalName(HTMLNames::option())) {
    28532852            HTMLOptionElementImpl* oe = static_cast<HTMLOptionElementImpl*>(items[i]);
    28542853            oe->setSelected(state[i] == 'X');
     
    29422941    uint i;
    29432942    for (i = 0; i < items.size(); i++) {
    2944         if (items[i]->id() == ID_OPTION) {
     2943        if (items[i]->hasLocalName(HTMLNames::option())) {
    29452944            HTMLOptionElementImpl *option = static_cast<HTMLOptionElementImpl*>(items[i]);
    29462945            if (option->selected()) {
     
    29552954    // we return the first one if it was a combobox select
    29562955    if (!successful && !m_multiple && m_size <= 1 && items.size() &&
    2957         (items[0]->id() == ID_OPTION) ) {
     2956        (items[0]->hasLocalName(HTMLNames::option()))) {
    29582957        HTMLOptionElementImpl *option = static_cast<HTMLOptionElementImpl*>(items[0]);
    29592958        if (option->value().isNull())
     
    29782977         optionIndex2 < int(items.size()) && optionIndex2 <= optionIndex;
    29792978         listIndex++) { // not a typo!
    2980         if (items[listIndex]->id() == ID_OPTION)
     2979        if (items[listIndex]->hasLocalName(HTMLNames::option()))
    29812980            optionIndex2++;
    29822981    }
     
    29892988    QMemArray<HTMLGenericFormElementImpl*> items = listItems();
    29902989    if (listIndex < 0 || listIndex >= int(items.size()) ||
    2991         items[listIndex]->id() != ID_OPTION)
     2990        !items[listIndex]->hasLocalName(HTMLNames::option()))
    29922991        return -1;
    29932992
     
    29952994    int i;
    29962995    for (i = 0; i < listIndex; i++)
    2997         if (items[i]->id() == ID_OPTION)
     2996        if (items[i]->hasLocalName(HTMLNames::option()))
    29982997            optionIndex++;
    29992998    return optionIndex;
     
    30213020    HTMLOptionElementImpl* foundSelected = 0;
    30223021    while(current) {
    3023         if (current->id() == ID_OPTGROUP && current->firstChild()) {
     3022        if (current->hasTagName(HTMLNames::optgroup()) && current->firstChild()) {
    30243023            // ### what if optgroup contains just comments? don't want one of no options in it...
    30253024            m_listItems.resize(m_listItems.size()+1);
     
    30273026            current = current->firstChild();
    30283027        }
    3029         if (current->id() == ID_OPTION) {
     3028        if (current->hasTagName(HTMLNames::option())) {
    30303029            m_listItems.resize(m_listItems.size()+1);
    30313030            m_listItems[m_listItems.size()-1] = static_cast<HTMLGenericFormElementImpl*>(current);
     
    30693068    uint i;
    30703069    for (i = 0; i < items.size(); i++) {
    3071         if (items[i]->id() == ID_OPTION) {
     3070        if (items[i]->hasLocalName(HTMLNames::option())) {
    30723071            HTMLOptionElementImpl *option = static_cast<HTMLOptionElementImpl*>(items[i]);
    30733072            bool selected = (!option->getAttribute(ATTR_SELECTED).isNull());
     
    30873086        uint i;
    30883087        for (i = 0; i < items.size(); i++) {
    3089             if (items[i]->id() == ID_OPTION)
     3088            if (items[i]->hasLocalName(HTMLNames::option()))
    30903089                static_cast<HTMLOptionElementImpl*>(items[i])->m_selected = (items[i] == selectedOption);
    30913090        }
     
    31343133
    31353134HTMLKeygenElementImpl::HTMLKeygenElementImpl(DocumentPtr* doc, HTMLFormElementImpl* f)
    3136     : HTMLSelectElementImpl(doc, f)
     3135    : HTMLSelectElementImpl(HTMLNames::keygen(), doc, f)
    31373136{
    31383137    QStringList keys = KSSLKeyGen::supportedKeySizes();
     
    31443143}
    31453144
    3146 NodeImpl::Id HTMLKeygenElementImpl::id() const
    3147 {
    3148     return ID_KEYGEN;
    3149 }
    3150 
    31513145DOMString HTMLKeygenElementImpl::type() const
    31523146{
     
    32033197
    32043198HTMLOptGroupElementImpl::HTMLOptGroupElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
    3205     : HTMLGenericFormElementImpl(doc, f)
     3199    : HTMLGenericFormElementImpl(HTMLNames::optgroup(), doc, f)
    32063200{
    32073201}
     
    32143208{
    32153209    return false;
    3216 }
    3217 
    3218 NodeImpl::Id HTMLOptGroupElementImpl::id() const
    3219 {
    3220     return ID_OPTGROUP;
    32213210}
    32223211
     
    32743263{
    32753264    NodeImpl *select = parentNode();
    3276     while (select && select->id() != ID_SELECT)
     3265    while (select && !select->hasTagName(HTMLNames::select()))
    32773266        select = select->parentNode();
    32783267    if (select)
     
    32933282
    32943283HTMLOptionElementImpl::HTMLOptionElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
    3295     : HTMLGenericFormElementImpl(doc, f)
     3284    : HTMLGenericFormElementImpl(HTMLNames::option(), doc, f)
    32963285{
    32973286    m_selected = false;
     
    33013290{
    33023291    return false;
    3303 }
    3304 
    3305 NodeImpl::Id HTMLOptionElementImpl::id() const
    3306 {
    3307     return ID_OPTION;
    33083292}
    33093293
     
    33543338    int optionIndex = 0;
    33553339    for(int i = 0; i < l; i++) {
    3356         if(items[i]->id() == ID_OPTION)
    3357         {
     3340        if (items[i]->hasLocalName(HTMLNames::option())) {
    33583341            if (static_cast<HTMLOptionElementImpl*>(items[i]) == this)
    33593342                return optionIndex;
     
    34203403{
    34213404    NodeImpl *select = parentNode();
    3422     while (select && select->id() != ID_SELECT)
     3405    while (select && !select->hasTagName(HTMLNames::select()))
    34233406        select = select->parentNode();
    34243407    return static_cast<HTMLSelectElementImpl*>(select);
     
    34483431
    34493432HTMLTextAreaElementImpl::HTMLTextAreaElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
    3450     : HTMLGenericFormElementImpl(doc, f), m_valueIsValid(false), m_valueMatchesRenderer(false)
     3433    : HTMLGenericFormElementImpl(HTMLNames::textarea(), doc, f), m_valueIsValid(false), m_valueMatchesRenderer(false)
    34513434{
    34523435    // DTD requires rows & cols be specified, but we will provide reasonable defaults
     
    34593442{
    34603443    if (getDocument()) getDocument()->deregisterMaintainsState(this);
    3461 }
    3462 
    3463 NodeImpl::Id HTMLTextAreaElementImpl::id() const
    3464 {
    3465     return ID_TEXTAREA;
    34663444}
    34673445
     
    37153693
    37163694HTMLIsIndexElementImpl::HTMLIsIndexElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
    3717     : HTMLInputElementImpl(doc, f)
     3695    : HTMLInputElementImpl(HTMLNames::isindex(), doc, f)
    37183696{
    37193697    m_type = TEXT;
    37203698    setOverrideName("isindex");
    3721 }
    3722 
    3723 NodeImpl::Id HTMLIsIndexElementImpl::id() const
    3724 {
    3725     return ID_ISINDEX;
    37263699}
    37273700
  • trunk/WebCore/khtml/html/html_formimpl.h

    r9479 r9639  
    6868    virtual ~HTMLFormElementImpl();
    6969
    70     virtual Id id() const;
     70    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     71    virtual int tagPriority() const { return 3; }
    7172
    7273    virtual void attach();
     
    162163
    163164public:
    164     HTMLGenericFormElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
     165    HTMLGenericFormElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f = 0);
    165166    virtual ~HTMLGenericFormElementImpl();
     167
     168    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     169    virtual int tagPriority() const { return 1; }
    166170
    167171    HTMLFormElementImpl *form() { return m_form; }
     
    236240public:
    237241    HTMLButtonElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
    238 
    239242    virtual ~HTMLButtonElementImpl();
    240243
     
    245248    };
    246249
    247     virtual Id id() const;
    248250    DOMString type() const;
    249251
     
    281283public:
    282284    HTMLFieldSetElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
    283 
    284285    virtual ~HTMLFieldSetElementImpl();
    285 
    286     virtual Id id() const;
    287    
     286   
     287    virtual int tagPriority() const { return 3; }
     288    virtual bool checkDTD(const NodeImpl* newChild);
     289
    288290    virtual bool isFocusable() const;
    289291   
     
    327329
    328330    HTMLInputElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
     331    HTMLInputElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f = 0);
    329332    virtual ~HTMLInputElementImpl();
    330 
    331     virtual Id id() const;
     333    void init();
     334
     335    virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
     336    virtual int tagPriority() const { return 0; }
    332337
    333338    virtual bool isEnumeratable() const { return inputType() != IMAGE; }
     
    460465    virtual ~HTMLLabelElementImpl();
    461466
     467    virtual int tagPriority() const { return 5; }
     468
    462469    virtual bool isFocusable() const;
    463    
    464     virtual Id id() const;
    465470
    466471    virtual void parseMappedAttribute(MappedAttributeImpl *attr);
     
    497502    virtual bool isFocusable() const;
    498503   
    499     virtual Id id() const;
    500504    virtual khtml::RenderObject *createRenderer(RenderArena *, khtml::RenderStyle *);
    501505
     
    526530public:
    527531    HTMLSelectElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
     532    HTMLSelectElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f = 0);
    528533    ~HTMLSelectElementImpl();
    529 
    530     virtual Id id() const;
     534    void init();
     535
     536    virtual int tagPriority() const { return 6; }
     537    virtual bool checkDTD(const NodeImpl* newChild);
     538
    531539    DOMString type() const;
    532540
     
    615623    HTMLKeygenElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
    616624
    617     virtual Id id() const;
     625    virtual int tagPriority() const { return 0; }
    618626
    619627    DOMString type() const;
     
    637645    virtual ~HTMLOptGroupElementImpl();
    638646
    639     virtual Id id() const;
     647    virtual bool checkDTD(const NodeImpl* newChild) { return newChild->hasTagName(HTMLNames::option()); }
     648
    640649    DOMString type() const;
    641650
     
    665674    HTMLOptionElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
    666675
     676    virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
     677    virtual int tagPriority() const { return 2; }
     678    virtual bool checkDTD(const NodeImpl* newChild) { return newChild->isTextNode(); }
     679
    667680    virtual bool isFocusable() const;
    668    
    669     virtual Id id() const;
     681
    670682    DOMString type() const;
    671683
     
    715727    ~HTMLTextAreaElementImpl();
    716728
    717     virtual Id id() const;
     729    virtual bool checkDTD(const NodeImpl* newChild) { return newChild->isTextNode(); }
    718730
    719731    long cols() const { return m_cols; }
    720 
    721732    long rows() const { return m_rows; }
    722733
     
    786797    HTMLIsIndexElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
    787798
    788     virtual Id id() const;
     799    virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
     800    virtual int tagPriority() const { return 0; }
    789801
    790802    virtual void parseMappedAttribute(MappedAttributeImpl *attr);
  • trunk/WebCore/khtml/html/html_headimpl.cpp

    r9466 r9639  
    4747
    4848HTMLBaseElementImpl::HTMLBaseElementImpl(DocumentPtr *doc)
    49     : HTMLElementImpl(doc)
     49    : HTMLElementImpl(HTMLNames::base(), doc)
    5050{
    5151}
     
    5353HTMLBaseElementImpl::~HTMLBaseElementImpl()
    5454{
    55 }
    56 
    57 NodeImpl::Id HTMLBaseElementImpl::id() const
    58 {
    59     return ID_BASE;
    6055}
    6156
     
    120115
    121116HTMLLinkElementImpl::HTMLLinkElementImpl(DocumentPtr *doc)
    122     : HTMLElementImpl(doc)
     117    : HTMLElementImpl(HTMLNames::link(), doc)
    123118{
    124119    m_sheet = 0;
     
    133128    if(m_sheet) m_sheet->deref();
    134129    if(m_cachedSheet) m_cachedSheet->deref(this);
    135 }
    136 
    137 NodeImpl::Id HTMLLinkElementImpl::id() const
    138 {
    139     return ID_LINK;
    140130}
    141131
     
    424414// -------------------------------------------------------------------------
    425415
    426 HTMLMetaElementImpl::HTMLMetaElementImpl(DocumentPtr *doc) : HTMLElementImpl(doc)
     416HTMLMetaElementImpl::HTMLMetaElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::meta(), doc)
    427417{
    428418}
     
    430420HTMLMetaElementImpl::~HTMLMetaElementImpl()
    431421{
    432 }
    433 
    434 NodeImpl::Id HTMLMetaElementImpl::id() const
    435 {
    436     return ID_META;
    437422}
    438423
     
    513498
    514499HTMLScriptElementImpl::HTMLScriptElementImpl(DocumentPtr *doc)
    515     : HTMLElementImpl(doc), m_cachedScript(0), m_createdByParser(false), m_evaluated(false)
     500    : HTMLElementImpl(HTMLNames::script(), doc), m_cachedScript(0), m_createdByParser(false), m_evaluated(false)
    516501{
    517502}
     
    521506    if (m_cachedScript)
    522507        m_cachedScript->deref(this);
    523 }
    524 
    525 NodeImpl::Id HTMLScriptElementImpl::id() const
    526 {
    527     return ID_SCRIPT;
    528508}
    529509
     
    698678// -------------------------------------------------------------------------
    699679
    700 HTMLStyleElementImpl::HTMLStyleElementImpl(DocumentPtr *doc) : HTMLElementImpl(doc)
     680HTMLStyleElementImpl::HTMLStyleElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::style(), doc)
    701681{
    702682    m_sheet = 0;
     
    707687{
    708688    if(m_sheet) m_sheet->deref();
    709 }
    710 
    711 NodeImpl::Id HTMLStyleElementImpl::id() const
    712 {
    713     return ID_STYLE;
    714689}
    715690
     
    825800
    826801HTMLTitleElementImpl::HTMLTitleElementImpl(DocumentPtr *doc)
    827     : HTMLElementImpl(doc), m_title("")
     802    : HTMLElementImpl(HTMLNames::title(), doc), m_title("")
    828803{
    829804}
     
    831806HTMLTitleElementImpl::~HTMLTitleElementImpl()
    832807{
    833 }
    834 
    835 NodeImpl::Id HTMLTitleElementImpl::id() const
    836 {
    837     return ID_TITLE;
    838808}
    839809
  • trunk/WebCore/khtml/html/html_headimpl.h

    r9431 r9639  
    5050    ~HTMLBaseElementImpl();
    5151
     52    virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
     53    virtual int tagPriority() const { return 0; }
     54
    5255    DOMString href() const { return m_href; }
    5356    DOMString target() const { return m_target; }
    5457
    55     virtual Id id() const;
    5658    virtual void parseMappedAttribute(MappedAttributeImpl *attr);
    5759    virtual void insertedIntoDocument();
     
    7880    ~HTMLLinkElementImpl();
    7981
    80     virtual Id id() const;
     82    virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
     83    virtual int tagPriority() const { return 0; }
    8184
    8285    bool disabled() const;
     
    153156public:
    154157    HTMLMetaElementImpl(DocumentPtr *doc);
    155 
    156158    ~HTMLMetaElementImpl();
    157159
    158     virtual Id id() const;
     160    virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
     161    virtual int tagPriority() const { return 0; }
     162
    159163    virtual void parseMappedAttribute(MappedAttributeImpl *attr);
    160164    virtual void insertedIntoDocument();
     
    186190    HTMLScriptElementImpl(DocumentPtr *doc);
    187191    ~HTMLScriptElementImpl();
    188    
     192
     193    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     194    virtual int tagPriority() const { return 1; }
     195    virtual bool checkDTD(const NodeImpl* newChild) { return newChild->isTextNode(); }
     196
    189197    virtual void insertedIntoDocument();
    190198    virtual void removedFromDocument();
    191199    virtual void notifyFinished(khtml::CachedObject *finishedObj);
     200
    192201    virtual void childrenChanged();
    193    
    194     virtual Id id() const;
     202
    195203    virtual bool isURLAttribute(AttributeImpl *attr) const;
    196204
     
    234242    ~HTMLStyleElementImpl();
    235243
    236     virtual Id id() const;
     244    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     245    virtual int tagPriority() const { return 1; }
     246    virtual bool checkDTD(const NodeImpl* newChild) { return newChild->isTextNode(); }
    237247
    238248    StyleSheetImpl *sheet() const { return m_sheet; }
     
    269279public:
    270280    HTMLTitleElementImpl(DocumentPtr *doc);
    271 
    272281    ~HTMLTitleElementImpl();
    273282
    274     virtual Id id() const;
     283    virtual bool checkDTD(const NodeImpl* newChild) { return newChild->isTextNode(); }
    275284
    276285    virtual void insertedIntoDocument();
  • trunk/WebCore/khtml/html/html_imageimpl.cpp

    r9450 r9639  
    5252using namespace khtml;
    5353
    54 //#define INSTRUMENT_LAYOUT_SCHEDULING 1
     54// #define INSTRUMENT_LAYOUT_SCHEDULING 1
    5555
    5656HTMLImageLoader::HTMLImageLoader(ElementImpl* elt)
     
    7676
    7777    AtomicString attr;
    78     if (element()->id() == ID_OBJECT)
     78    if (element()->hasLocalName(HTMLNames::object()))
    7979        attr = element()->getAttribute(ATTR_DATA);
    8080    else
     
    8787
    8888    if (newImage != m_image) {
     89#ifdef INSTRUMENT_LAYOUT_SCHEDULING
     90        if (!document->ownerElement() && newImage)
     91            printf("Image requested at %d\n", element()->getDocument()->elapsedTime());
     92#endif
    8993        m_firedLoad = false;
    9094        m_imageComplete = false;
     
    134138
    135139HTMLImageElementImpl::HTMLImageElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
    136     : HTMLElementImpl(doc), m_imageLoader(this), ismap(false), m_form(f)
     140    : HTMLElementImpl(HTMLNames::img(), doc), m_imageLoader(this), ismap(false), m_form(f)
    137141{
    138142    if (m_form)
     
    140144}
    141145
     146HTMLImageElementImpl::HTMLImageElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
     147    : HTMLElementImpl(tagName, doc), m_imageLoader(this), ismap(false), m_form(0)
     148{
     149}
     150
    142151HTMLImageElementImpl::~HTMLImageElementImpl()
    143152{
    144153    if (m_form)
    145154        m_form->removeImgElement(this);
    146 }
    147 
    148 NodeImpl::Id HTMLImageElementImpl::id() const
    149 {
    150     return ID_IMG;
    151155}
    152156
     
    529533
    530534HTMLMapElementImpl::HTMLMapElementImpl(DocumentPtr *doc)
    531     : HTMLElementImpl(doc)
     535    : HTMLElementImpl(HTMLNames::map(), doc)
    532536{
    533537}
     
    539543}
    540544
    541 NodeImpl::Id HTMLMapElementImpl::id() const
    542 {
    543     return ID_MAP;
     545bool HTMLMapElementImpl::checkDTD(const NodeImpl* newChild)
     546{
     547    // FIXME: This seems really odd, allowing only blocks inside map.
     548    return newChild->hasTagName(HTMLNames::area()) || newChild->hasTagName(HTMLNames::script()) ||
     549           inBlockTagList(newChild);
    544550}
    545551
     
    553559
    554560    NodeImpl *current = firstChild();
    555     while(1)
    556     {
    557         if(!current)
    558         {
     561    while (1) {
     562        if (!current) {
    559563            if(nodeStack.isEmpty()) break;
    560564            current = nodeStack.pop();
     
    562566            continue;
    563567        }
    564         if(current->id()==ID_AREA)
    565         {
     568       
     569        if (current->hasTagName(HTMLNames::area())) {
    566570            //cout << "area found " << endl;
    567             HTMLAreaElementImpl* area=static_cast<HTMLAreaElementImpl*>(current);
     571            HTMLAreaElementImpl* area = static_cast<HTMLAreaElementImpl*>(current);
    568572            if (area->mapMouseEvent(x_,y_,width_,height_, info))
    569573                return true;
    570574        }
     575       
    571576        NodeImpl *child = current->firstChild();
    572         if(child)
    573         {
     577        if (child) {
    574578            nodeStack.push(current);
    575579            current = child;
    576580        }
    577581        else
    578         {
    579582            current = current->nextSibling();
    580         }
    581583    }
    582584
     
    623625
    624626HTMLAreaElementImpl::HTMLAreaElementImpl(DocumentPtr *doc)
    625     : HTMLAnchorElementImpl(doc)
     627    : HTMLAnchorElementImpl(HTMLNames::area(), doc)
    626628{
    627629    m_coords=0;
     
    634636{
    635637    if (m_coords) delete [] m_coords;
    636 }
    637 
    638 NodeImpl::Id HTMLAreaElementImpl::id() const
    639 {
    640     return ID_AREA;
    641638}
    642639
  • trunk/WebCore/khtml/html/html_imageimpl.h

    r9158 r9639  
    7676public:
    7777    HTMLImageElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
     78    HTMLImageElementImpl(const QualifiedName& tagName, DocumentPtr* doc);
    7879    ~HTMLImageElementImpl();
    7980
    80     virtual Id id() const;
     81    virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
     82    virtual int tagPriority() const { return 0; }
    8183
    8284    virtual bool mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const;
     
    162164    ~HTMLAreaElementImpl();
    163165
    164     virtual Id id() const;
     166    virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
     167    virtual int tagPriority() const { return 0; }
    165168
    166169    virtual void parseMappedAttribute(MappedAttributeImpl *attr);
     
    213216public:
    214217    HTMLMapElementImpl(DocumentPtr *doc);
    215 
    216218    ~HTMLMapElementImpl();
    217219
    218     virtual Id id() const;
     220    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     221    virtual int tagPriority() const { return 1; }
     222    virtual bool checkDTD(const NodeImpl* newChild);
    219223
    220224    virtual DOMString getName() const { return m_name; }
  • trunk/WebCore/khtml/html/html_inlineimpl.cpp

    r9158 r9639  
    4646
    4747HTMLAnchorElementImpl::HTMLAnchorElementImpl(DocumentPtr *doc)
    48     : HTMLElementImpl(doc)
     48    : HTMLElementImpl(HTMLNames::a(), doc)
     49{
     50    m_hasTarget = false;
     51}
     52
     53HTMLAnchorElementImpl::HTMLAnchorElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
     54    : HTMLElementImpl(tagName, doc)
    4955{
    5056    m_hasTarget = false;
     
    103109
    104110    return getDocument()->part()->tabsToLinks();
    105 }
    106 
    107 NodeImpl::Id HTMLAnchorElementImpl::id() const
    108 {
    109     return ID_A;
    110111}
    111112
     
    153154            utarget = "_blank";
    154155
    155         if ( evt->target()->id() == ID_IMG ) {
     156        if (evt->target()->hasTagName(HTMLNames::img())) {
    156157            HTMLImageElementImpl* img = static_cast<HTMLImageElementImpl*>( evt->target() );
    157158            if ( img && img->isServerMap() )
     
    383384// -------------------------------------------------------------------------
    384385
    385 HTMLBRElementImpl::HTMLBRElementImpl(DocumentPtr *doc) : HTMLElementImpl(doc)
     386HTMLBRElementImpl::HTMLBRElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::br(), doc)
    386387{
    387388}
     
    389390HTMLBRElementImpl::~HTMLBRElementImpl()
    390391{
    391 }
    392 
    393 NodeImpl::Id HTMLBRElementImpl::id() const
    394 {
    395     return ID_BR;
    396392}
    397393
     
    446442
    447443HTMLFontElementImpl::HTMLFontElementImpl(DocumentPtr *doc)
    448     : HTMLElementImpl(doc)
     444    : HTMLElementImpl(HTMLNames::font(), doc)
    449445{
    450446}
     
    452448HTMLFontElementImpl::~HTMLFontElementImpl()
    453449{
    454 }
    455 
    456 NodeImpl::Id HTMLFontElementImpl::id() const
    457 {
    458     return ID_FONT;
    459450}
    460451
     
    591582// -------------------------------------------------------------------------
    592583
    593 HTMLModElementImpl::HTMLModElementImpl(DocumentPtr *doc, ushort elementId)
    594     : HTMLGenericElementImpl(doc, elementId)
     584HTMLModElementImpl::HTMLModElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
     585    : HTMLElementImpl(tagName, doc)
    595586{
    596587}
     
    619610
    620611HTMLQuoteElementImpl::HTMLQuoteElementImpl(DocumentPtr *doc)
    621     : HTMLElementImpl(doc)
    622 {
    623 }
    624 
    625 NodeImpl::Id HTMLQuoteElementImpl::id() const
    626 {
    627     return ID_Q;
    628 }
    629    
     612    : HTMLElementImpl(HTMLNames::q(), doc)
     613{
     614}
     615
    630616DOMString HTMLQuoteElementImpl::cite() const
    631617{
  • trunk/WebCore/khtml/html/html_inlineimpl.h

    r9158 r9639  
    3535public:
    3636    HTMLAnchorElementImpl(DocumentPtr *doc);
     37    HTMLAnchorElementImpl(const QualifiedName& tagName, DocumentPtr* doc);
    3738    ~HTMLAnchorElementImpl();
     39
     40    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     41    virtual int tagPriority() const { return 1; }
    3842
    3943    virtual bool isMouseFocusable() const;
    4044    virtual bool isKeyboardFocusable() const;
    4145    virtual bool isFocusable() const;
    42     virtual Id id() const;
    4346    virtual void parseMappedAttribute(MappedAttributeImpl *attr);
    4447    virtual void defaultEventHandler(EventImpl *evt);
     
    98101    HTMLBRElementImpl(DocumentPtr *doc);
    99102    ~HTMLBRElementImpl();
     103   
     104    virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
     105    virtual int tagPriority() const { return 0; }
    100106
    101     virtual Id id() const;
    102    
    103107    virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
    104108    virtual void parseMappedAttribute(MappedAttributeImpl *attr);
     
    117121    HTMLFontElementImpl(DocumentPtr *doc);
    118122    ~HTMLFontElementImpl();
     123   
     124    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     125    virtual int tagPriority() const { return 1; }
    119126
    120     virtual Id id() const;
    121    
    122127    virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
    123128    virtual void parseMappedAttribute(MappedAttributeImpl *attr);
     
    135140// -------------------------------------------------------------------------
    136141
    137 class HTMLModElementImpl : public HTMLGenericElementImpl
     142class HTMLModElementImpl : public HTMLElementImpl
    138143{
    139144public:
    140     HTMLModElementImpl(DocumentPtr *doc, ushort elementId);
     145    HTMLModElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
     146
     147    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     148    virtual int tagPriority() const { return 1; }
    141149
    142150    DOMString cite() const;
     
    153161public:
    154162    HTMLQuoteElementImpl(DocumentPtr *doc);
     163   
     164    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     165    virtual int tagPriority() const { return 1; }
    155166
    156     virtual Id id() const;
    157    
    158167    DOMString cite() const;
    159168    void setCite(const DOMString &);
  • trunk/WebCore/khtml/html/html_listimpl.cpp

    r9158 r9639  
    3232
    3333namespace DOM {
    34 
    35 NodeImpl::Id HTMLUListElementImpl::id() const
    36 {
    37     return ID_UL;
    38 }
    3934
    4035bool HTMLUListElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
     
    8580// -------------------------------------------------------------------------
    8681
    87 NodeImpl::Id HTMLDirectoryElementImpl::id() const
    88 {
    89     return ID_DIR;
    90 }
    91 
    9282bool HTMLDirectoryElementImpl::compact() const
    9383{
     
    10292// -------------------------------------------------------------------------
    10393
    104 NodeImpl::Id HTMLMenuElementImpl::id() const
    105 {
    106     return ID_MENU;
    107 }
    108 
    10994bool HTMLMenuElementImpl::compact() const
    11095{
     
    118103
    119104// -------------------------------------------------------------------------
    120 
    121 NodeImpl::Id HTMLOListElementImpl::id() const
    122 {
    123     return ID_OL;
    124 }
    125105
    126106bool HTMLOListElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
     
    154134        break;
    155135    case ATTR_START:
    156             _start = !attr->isNull() ? attr->value().toInt() : 1;
     136        _start = !attr->isNull() ? attr->value().toInt() : 1;
     137        break;
    157138    default:
    158         HTMLUListElementImpl::parseMappedAttribute(attr);
     139        HTMLElementImpl::parseMappedAttribute(attr);
    159140    }
    160141}
     
    186167
    187168// -------------------------------------------------------------------------
    188 
    189 NodeImpl::Id HTMLLIElementImpl::id() const
    190 {
    191     return ID_LI;
    192 }
    193169
    194170bool HTMLLIElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
     
    253229        NodeImpl *n = this;
    254230        while (!listNode && (n = n->parentNode())) {
    255             switch (n->id()) {
    256                 case ID_UL:
    257                 case ID_OL:
    258                     listNode = n;
    259             }
     231            if (n->hasTagName(HTMLNames::ul()) || n->hasTagName(HTMLNames::ol()))
     232                listNode = n;
    260233        }
    261234       
     
    266239
    267240        // If we are first, and the OL has a start attr, set the value.
    268         if (listNode && listNode->id() == ID_OL && !m_render->previousSibling()) {
     241        if (listNode && listNode->hasTagName(HTMLNames::ol()) && !m_render->previousSibling()) {
    269242            HTMLOListElementImpl *ol = static_cast<HTMLOListElementImpl *>(listNode);
    270243            render->setValue(ol->start());
     
    296269    setAttribute(ATTR_VALUE, QString::number(value));
    297270}
    298 // -------------------------------------------------------------------------
    299 
    300 NodeImpl::Id HTMLDListElementImpl::id() const
    301 {
    302     return ID_DL;
    303 }
     271
     272// -------------------------------------------------------------------------
    304273
    305274bool HTMLDListElementImpl::compact() const
  • trunk/WebCore/khtml/html/html_listimpl.h

    r9158 r9639  
    3636{
    3737public:
    38     HTMLUListElementImpl(DocumentPtr *doc) : HTMLElementImpl(doc) {}
     38    HTMLUListElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::ul(), doc) {}
    3939    virtual ~HTMLUListElementImpl() {}
    4040
    41     virtual Id id() const;
     41    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     42    virtual int tagPriority() const { return 5; }
    4243
    4344    virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
     
    5859{
    5960public:
    60     HTMLDirectoryElementImpl(DocumentPtr *doc) : HTMLElementImpl(doc) {}
     61    HTMLDirectoryElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::dir(), doc) {}
    6162
    62     virtual Id id() const;
     63    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     64    virtual int tagPriority() const { return 5; }
    6365
    6466    bool compact() const;
     
    7173{
    7274public:
    73     HTMLMenuElementImpl(DocumentPtr *doc) : HTMLElementImpl(doc) {}
     75    HTMLMenuElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::menu(), doc) {}
    7476
    75     virtual Id id() const;
     77    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     78    virtual int tagPriority() const { return 5; }
    7679
    7780    bool compact() const;
     
    8184// -------------------------------------------------------------------------
    8285
    83 class HTMLOListElementImpl : public HTMLUListElementImpl
     86class HTMLOListElementImpl : public HTMLElementImpl
    8487{
    8588public:
    8689    HTMLOListElementImpl(DocumentPtr *doc)
    87         : HTMLUListElementImpl(doc) { _start = 1; }
     90        : HTMLElementImpl(HTMLNames::ol(), doc) { _start = 1; }
     91   
     92    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     93    virtual int tagPriority() const { return 5; }
    8894
    89     virtual Id id() const;
    90    
    9195    virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
    9296    virtual void parseMappedAttribute(MappedAttributeImpl *);
     
    111115public:
    112116    HTMLLIElementImpl(DocumentPtr *doc)
    113         : HTMLElementImpl(doc) { isValued = false; }
     117        : HTMLElementImpl(HTMLNames::li(), doc) { isValued = false; }
    114118    virtual ~HTMLLIElementImpl() {}
    115119
    116     virtual Id id() const;
     120    virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
     121    virtual int tagPriority() const { return 3; }
    117122
    118123    virtual bool mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const;
     
    137142{
    138143public:
    139     HTMLDListElementImpl(DocumentPtr *doc) : HTMLElementImpl(doc) {}
     144    HTMLDListElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::dl(), doc) {}
    140145    virtual ~HTMLDListElementImpl() {}
    141146
    142     virtual Id id() const;
     147    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     148    virtual int tagPriority() const { return 5; }
    143149
    144150    bool compact() const;
  • trunk/WebCore/khtml/html/html_miscimpl.cpp

    r9360 r9639  
    3636
    3737HTMLBaseFontElementImpl::HTMLBaseFontElementImpl(DocumentPtr *doc)
    38     : HTMLElementImpl(doc)
    39 {
    40 }
    41 
    42 NodeImpl::Id HTMLBaseFontElementImpl::id() const
    43 {
    44     return ID_BASEFONT;
     38    : HTMLElementImpl(HTMLNames::basefont(), doc)
     39{
    4540}
    4641
     
    142137            switch(type) {
    143138            case DOC_IMAGES:
    144                 if(e->id() == ID_IMG)
     139                if (e->hasLocalName(HTMLNames::img()))
    145140                    found = true;
    146141                break;
    147142            case DOC_FORMS:
    148                 if(e->id() == ID_FORM)
     143                if(e->hasLocalName(HTMLNames::form()))
    149144                    found = true;
    150145                break;
    151146            case DOC_NAMEABLE_ITEMS:
    152                 if(e->id() == ID_IMG)
    153                     found = true;
    154                 if(e->id() == ID_FORM)
    155                     found = true;
    156                 if(e->id() == ID_APPLET)
    157                     found = true;
    158                 if(e->id() == ID_EMBED)
    159                     found = true;
    160                 if(e->id() == ID_OBJECT)
     147                if (e->hasLocalName(HTMLNames::img()))
     148                    found = true;
     149                if (e->hasLocalName(HTMLNames::form()))
     150                    found = true;
     151                if (e->hasLocalName(HTMLNames::applet()))
     152                    found = true;
     153                if (e->hasLocalName(HTMLNames::embed()))
     154                    found = true;
     155                if (e->hasLocalName(HTMLNames::object()))
    161156                    found = true;
    162157                break;
    163158            case TABLE_TBODIES:
    164                 if(e->id() == ID_TBODY)
    165                     found = true;
    166                 else if(e->id() == ID_TABLE)
     159                if (e->hasLocalName(HTMLNames::tbody()))
     160                    found = true;
     161                else if (e->hasLocalName(HTMLNames::table()))
    167162                    deep = false;
    168163                break;
    169164            case TR_CELLS:
    170                 if(e->id() == ID_TD || e->id() == ID_TH)
    171                     found = true;
    172                 else if(e->id() == ID_TABLE)
     165                if (e->hasLocalName(HTMLNames::td()) || e->hasLocalName(HTMLNames::th()))
     166                    found = true;
     167                else if (e->hasLocalName(HTMLNames::table()))
    173168                    deep = false;
    174169                break;
    175170            case TABLE_ROWS:
    176171            case TSECTION_ROWS:
    177                 if(e->id() == ID_TR)
    178                     found = true;
    179                 else if(e->id() == ID_TABLE)
     172                if (e->hasLocalName(HTMLNames::tr()))
     173                    found = true;
     174                else if (e->hasLocalName(HTMLNames::table()))
    180175                    deep = false;
    181176                break;
    182177            case SELECT_OPTIONS:
    183                 if(e->id() == ID_OPTION)
     178                if (e->hasLocalName(HTMLNames::option()))
    184179                    found = true;
    185180                break;
    186181            case MAP_AREAS:
    187                 if(e->id() == ID_AREA)
     182                if (e->hasLocalName(HTMLNames::area()))
    188183                    found = true;
    189184                break;
    190185            case DOC_APPLETS:   // all OBJECT and APPLET elements
    191                 if(e->id() == ID_OBJECT || e->id() == ID_APPLET)
     186                if (e->hasLocalName(HTMLNames::object()) || e->hasLocalName(HTMLNames::applet()))
    192187                    found = true;
    193188                break;
    194189            case DOC_EMBEDS:   // all EMBED elements
    195                 if(e->id() == ID_EMBED)
     190                if (e->hasLocalName(HTMLNames::embed()))
    196191                    found = true;
    197192                break;
    198193            case DOC_OBJECTS:   // all OBJECT elements
    199                 if(e->id() == ID_OBJECT)
     194                if (e->hasLocalName(HTMLNames::object()))
    200195                    found = true;
    201196                break;
    202197            case DOC_LINKS:     // all A _and_ AREA elements with a value for href
    203                 if(e->id() == ID_A || e->id() == ID_AREA)
    204                     if(!e->getAttribute(ATTR_HREF).isNull())
     198                if (e->hasLocalName(HTMLNames::a()) || e->hasLocalName(HTMLNames::area()))
     199                    if (!e->getAttribute(ATTR_HREF).isNull())
    205200                        found = true;
    206201                break;
    207202            case DOC_ANCHORS:      // all A elements with a value for name or an id attribute
    208                 if(e->id() == ID_A)
    209                     if(!e->getAttribute(ATTR_NAME).isNull())
     203                if (e->hasLocalName(HTMLNames::a()))
     204                    if (!e->getAttribute(ATTR_NAME).isNull())
    210205                        found = true;
    211206                break;
     
    220215                kdDebug( 6030 ) << "Error in HTMLCollection, wrong tagId!" << endl;
    221216            }
    222             if (found) {
     217
     218            if (found)
    223219                return current;
    224             }
    225220            if (deep) {
    226221                current = current->traverseNextNode(m_base.get());
     
    299294bool HTMLCollectionImpl::checkForNameMatch(NodeImpl *node, bool checkName, const DOMString &name, bool caseSensitive) const
    300295{
    301     ElementImpl *e = static_cast<ElementImpl *>(node);
     296    if (!node->isHTMLElement())
     297        return false;
     298   
     299    HTMLElementImpl *e = static_cast<HTMLElementImpl*>(node);
    302300    if (caseSensitive) {
    303301        if (checkName) {
     
    305303            // by name (though everything by id)
    306304            if (type == DOC_ALL &&
    307                 !(e->id() == ID_IMG || e->id() == ID_FORM ||
    308                   e->id() == ID_APPLET || e->id() == ID_OBJECT ||
    309                   e->id() == ID_EMBED))
     305                !(e->hasLocalName(HTMLNames::img()) || e->hasLocalName(HTMLNames::form()) ||
     306                  e->hasLocalName(HTMLNames::applet()) || e->hasLocalName(HTMLNames::object()) ||
     307                  e->hasLocalName(HTMLNames::embed())))
    310308                return false;
    311309
    312310            return e->getAttribute(ATTR_NAME) == name && e->getAttribute(ATTR_ID) != name;
    313         } else {
     311        } else
    314312            return e->getAttribute(ATTR_ID) == name;
    315         }
    316313    } else {
    317314        if (checkName) {
     
    319316            // by name (though everything by id)
    320317            if (type == DOC_ALL &&
    321                 !(e->id() == ID_IMG || e->id() == ID_FORM ||
    322                   e->id() == ID_APPLET || e->id() == ID_OBJECT ||
    323                   e->id() == ID_EMBED))
     318                !(e->hasLocalName(HTMLNames::img()) || e->hasLocalName(HTMLNames::form()) ||
     319                  e->hasLocalName(HTMLNames::applet()) || e->hasLocalName(HTMLNames::object()) ||
     320                  e->hasLocalName(HTMLNames::embed())))
    324321                return false;
    325322
     
    380377   
    381378    for (NodeImpl *n = traverseNextItem(m_base.get()); n; n = traverseNextItem(n)) {
    382         ElementImpl *e = static_cast<ElementImpl *>(n);
     379        if (!n->isHTMLElement())
     380            continue;
     381        HTMLElementImpl* e = static_cast<HTMLElementImpl*>(n);
    383382        QString idAttr = e->getAttribute(ATTR_ID).string();
    384383        QString nameAttr = e->getAttribute(ATTR_NAME).string();
     
    394393        if (!nameAttr.isEmpty() && idAttr != nameAttr
    395394            && (type != DOC_ALL ||
    396                 (e->id() == ID_IMG || e->id() == ID_FORM ||
    397                  e->id() == ID_APPLET || e->id() == ID_OBJECT ||
    398                  e->id() == ID_EMBED))) {
     395                (e->hasLocalName(HTMLNames::img()) || e->hasLocalName(HTMLNames::form()) ||
     396                 e->hasLocalName(HTMLNames::applet()) || e->hasLocalName(HTMLNames::object()) ||
     397                 e->hasLocalName(HTMLNames::embed())))) {
    399398            // add to name cache
    400399            QPtrVector<NodeImpl> *nameVector = info->nameCache.find(nameAttr);
     
    533532NodeImpl* HTMLFormCollectionImpl::getNamedFormItem(int attr_id, const DOMString& name, int duplicateNumber, bool caseSensitive) const
    534533{
    535     if(m_base->nodeType() == Node::ELEMENT_NODE)
    536     {
     534    if (m_base->nodeType() == Node::ELEMENT_NODE) {
    537535        HTMLElementImpl* baseElement = static_cast<HTMLElementImpl*>(m_base.get());
    538536        bool foundInputElements = false;
    539         if(baseElement->id() == ID_FORM)
    540         {
     537        if (baseElement->hasLocalName(HTMLNames::form())) {
    541538            HTMLFormElementImpl* f = static_cast<HTMLFormElementImpl*>(baseElement);
    542539            for (unsigned i = 0; i < f->formElements.count(); ++i) {
     
    558555        }
    559556
    560         if ( !foundInputElements )
    561         {
     557        if (!foundInputElements) {
    562558            HTMLFormElementImpl* f = static_cast<HTMLFormElementImpl*>(baseElement);
    563559
     
    651647    QDict<char> foundInputElements;
    652648
    653     if (m_base->id() != ID_FORM) {
     649    if (!m_base->hasTagName(HTMLNames::form())) {
    654650        info->hasNameCache = true;
    655651        return;
  • trunk/WebCore/khtml/html/html_miscimpl.h

    r9156 r9639  
    4040    HTMLBaseFontElementImpl(DocumentPtr *doc);
    4141
    42     virtual Id id() const;
     42    virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
     43    virtual int tagPriority() const { return 0; }
    4344
    4445    DOMString color() const;
  • trunk/WebCore/khtml/html/html_objectimpl.cpp

    r9521 r9639  
    5959
    6060HTMLAppletElementImpl::HTMLAppletElementImpl(DocumentPtr *doc)
    61   : HTMLElementImpl(doc)
     61  : HTMLElementImpl(HTMLNames::applet(), doc)
    6262{
    6363    appletInstance = 0;
     
    7070}
    7171
    72 NodeImpl::Id HTMLAppletElementImpl::id() const
    73 {
    74     return ID_APPLET;
     72bool HTMLAppletElementImpl::checkDTD(const NodeImpl* newChild)
     73{
     74    return newChild->hasTagName(HTMLNames::param()) || HTMLElementImpl::checkDTD(newChild);
    7575}
    7676
     
    354354
    355355HTMLEmbedElementImpl::HTMLEmbedElementImpl(DocumentPtr *doc)
    356     : HTMLElementImpl(doc), embedInstance(0)
     356    : HTMLElementImpl(HTMLNames::embed(), doc), embedInstance(0)
    357357{}
    358358
     
    361361}
    362362
    363 NodeImpl::Id HTMLEmbedElementImpl::id() const
    364 {
    365     return ID_EMBED;
     363bool HTMLEmbedElementImpl::checkDTD(const NodeImpl* newChild)
     364{
     365    return newChild->hasTagName(HTMLNames::param()) || HTMLElementImpl::checkDTD(newChild);
    366366}
    367367
     
    480480    if (!part)
    481481        return false;
    482     return part->pluginsEnabled() && parentNode()->id() != ID_OBJECT;
     482    return part->pluginsEnabled() && !parentNode()->hasTagName(HTMLNames::object());
    483483}
    484484
     
    505505HTMLObjectElementImpl::HTMLObjectElementImpl(DocumentPtr *doc)
    506506#if APPLE_CHANGES
    507 : HTMLElementImpl(doc), m_imageLoader(0), objectInstance(0)
     507: HTMLElementImpl(HTMLNames::object(), doc), m_imageLoader(0), objectInstance(0)
    508508#else
    509 : HTMLElementImpl(doc), m_imageLoader(0)
     509: HTMLElementImpl(HTMLNames::object(), doc), m_imageLoader(0)
    510510#endif
    511511{
     
    519519}
    520520
    521 NodeImpl::Id HTMLObjectElementImpl::id() const
    522 {
    523     return ID_OBJECT;
     521bool HTMLObjectElementImpl::checkDTD(const NodeImpl* newChild)
     522{
     523    return newChild->hasTagName(HTMLNames::param()) || HTMLElementImpl::checkDTD(newChild);
    524524}
    525525
     
    556556{
    557557    for (NodeImpl *p = parentNode(); p != 0; p = p->parentNode()) {
    558         if (p->id() == ID_FORM)
     558        if (p->hasTagName(HTMLNames::form()))
    559559            return static_cast<HTMLFormElementImpl *>(p);
    560560    }
     
    951951
    952952HTMLParamElementImpl::HTMLParamElementImpl(DocumentPtr *doc)
    953     : HTMLElementImpl(doc)
     953    : HTMLElementImpl(HTMLNames::param(), doc)
    954954{
    955955}
     
    957957HTMLParamElementImpl::~HTMLParamElementImpl()
    958958{
    959 }
    960 
    961 NodeImpl::Id HTMLParamElementImpl::id() const
    962 {
    963     return ID_PARAM;
    964959}
    965960
  • trunk/WebCore/khtml/html/html_objectimpl.h

    r9158 r9639  
    4343public:
    4444    HTMLAppletElementImpl(DocumentPtr *doc);
    45 
    4645    ~HTMLAppletElementImpl();
    4746
    48     virtual Id id() const;
    49 
     47    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     48    virtual int tagPriority() const { return 1; }
     49    virtual bool checkDTD(const NodeImpl* newChild);
     50       
    5051    virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
    5152    virtual void parseMappedAttribute(MappedAttributeImpl *token);
     
    113114public:
    114115    HTMLEmbedElementImpl(DocumentPtr *doc);
    115 
    116116    ~HTMLEmbedElementImpl();
    117117
    118     virtual Id id() const;
     118    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     119    virtual int tagPriority() const { return 0; }
     120    virtual bool checkDTD(const NodeImpl* newChild);
    119121
    120122    virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
     
    147149public:
    148150    HTMLObjectElementImpl(DocumentPtr *doc);
    149 
    150151    ~HTMLObjectElementImpl();
    151152
    152     virtual Id id() const;
     153    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     154    virtual int tagPriority() const { return 7; }
     155    virtual bool checkDTD(const NodeImpl* newChild);
    153156
    154157    HTMLFormElementImpl *form() const;
     
    248251public:
    249252    HTMLParamElementImpl(DocumentPtr *doc);
    250 
    251253    ~HTMLParamElementImpl();
    252254
    253     virtual Id id() const;
     255    virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
     256    virtual int tagPriority() const { return 0; }
    254257
    255258    virtual void parseMappedAttribute(MappedAttributeImpl *token);
  • trunk/WebCore/khtml/html/html_tableimpl.cpp

    r9420 r9639  
    5252
    5353HTMLTableElementImpl::HTMLTableElementImpl(DocumentPtr *doc)
    54   : HTMLElementImpl(doc)
     54  : HTMLElementImpl(HTMLNames::table(), doc)
    5555{
    5656    tCaption = 0;
     
    7474}
    7575
    76 NodeImpl::Id HTMLTableElementImpl::id() const
    77 {
    78     return ID_TABLE;
     76bool HTMLTableElementImpl::checkDTD(const NodeImpl* newChild)
     77{
     78    return newChild->isTextNode() || newChild->hasTagName(HTMLNames::caption()) ||
     79           newChild->hasTagName(HTMLNames::col()) || newChild->hasTagName(HTMLNames::colgroup()) ||
     80           newChild->hasTagName(HTMLNames::thead()) || newChild->hasTagName(HTMLNames::tfoot()) ||
     81           newChild->hasTagName(HTMLNames::tbody()) || newChild->hasTagName(HTMLNames::form()) ||
     82           newChild->hasTagName(HTMLNames::script());
    7983}
    8084
     
    147151    {
    148152        int exceptioncode = 0;
    149         head = new HTMLTableSectionElementImpl(docPtr(), ID_THEAD, true /* implicit */);
     153        head = new HTMLTableSectionElementImpl(HTMLNames::thead(), docPtr(), true /* implicit */);
    150154        if(foot)
    151155            insertBefore( head, foot, exceptioncode );
     
    172176    {
    173177        int exceptioncode = 0;
    174         foot = new HTMLTableSectionElementImpl(docPtr(), ID_TFOOT, true /*implicit */);
     178        foot = new HTMLTableSectionElementImpl(HTMLNames::tfoot(), docPtr(), true /*implicit */);
    175179        if(firstBody)
    176180            insertBefore( foot, firstBody, exceptioncode );
     
    217221    // <TABLE><TR>)
    218222    if(!firstBody && !head && !foot && !hasChildNodes())
    219         setTBody( new HTMLTableSectionElementImpl(docPtr(), ID_TBODY, true /* implicit */) );
     223        setTBody( new HTMLTableSectionElementImpl(HTMLNames::tbody(), docPtr(), true /* implicit */) );
    220224
    221225    //kdDebug(6030) << k_funcinfo << index << endl;
     
    231235        // there could be 2 tfoot elements in the table. Only the first one is the "foot", that's why we have the more
    232236        // complicated if statement below.
    233         if ( node != foot && (node->id() == ID_THEAD || node->id() == ID_TFOOT || node->id() == ID_TBODY) )
     237        if (node != foot && (node->hasTagName(HTMLNames::thead()) || node->hasTagName(HTMLNames::tfoot()) ||
     238            node->hasTagName(HTMLNames::tbody())))
    234239        {
    235240            section = static_cast<HTMLTableSectionElementImpl *>(node);
     
    277282    for ( ; node ; node = node->nextSibling() )
    278283    {
    279         if ( node != foot && (node->id() == ID_THEAD || node->id() == ID_TFOOT || node->id() == ID_TBODY) )
    280         {
     284        if (node != foot && (node->hasTagName(HTMLNames::thead()) || node->hasTagName(HTMLNames::tfoot()) ||
     285            node->hasTagName(HTMLNames::tbody()))) {
    281286            section = static_cast<HTMLTableSectionElementImpl *>(node);
    282287            lastSection = section;
     
    310315#endif
    311316
    312     if (child->id() == ID_FORM) {
     317    if (child->hasTagName(HTMLNames::form())) {
    313318        // First add the child.
    314319        HTMLElementImpl::addChild(child);
     
    338343    int exceptioncode = 0;
    339344    NodeImpl *retval = appendChild( child, exceptioncode );
    340     if ( retval ) {
    341         switch(child->id()) {
    342         case ID_CAPTION:
    343             if ( !tCaption )
    344                 tCaption = static_cast<HTMLTableCaptionElementImpl *>(child);
    345             break;
    346         case ID_COL:
    347         case ID_COLGROUP:
    348             break;
    349         case ID_THEAD:
    350             if ( !head )
    351                 head = static_cast<HTMLTableSectionElementImpl *>(child);
    352             break;
    353         case ID_TFOOT:
    354             if ( !foot )
    355                 foot = static_cast<HTMLTableSectionElementImpl *>(child);
    356             break;
    357         case ID_TBODY:
    358             if ( !firstBody )
    359                 firstBody = static_cast<HTMLTableSectionElementImpl *>(child);
    360             break;
    361         }
     345    if (retval) {
     346        if (!tCaption && child->hasTagName(HTMLNames::caption()))
     347            tCaption = static_cast<HTMLTableCaptionElementImpl *>(child);
     348        else if (!head && child->hasTagName(HTMLNames::thead()))
     349            head = static_cast<HTMLTableSectionElementImpl *>(child);
     350        else if (!foot && child->hasTagName(HTMLNames::tfoot()))
     351            foot = static_cast<HTMLTableSectionElementImpl *>(child);
     352        else if (!firstBody && child->hasTagName(HTMLNames::tbody()))
     353            firstBody = static_cast<HTMLTableSectionElementImpl *>(child);
    362354    }
    363355    return retval;
     
    803795// -------------------------------------------------------------------------
    804796
    805 HTMLTableSectionElementImpl::HTMLTableSectionElementImpl(DocumentPtr *doc,
    806                                                          ushort tagid, bool implicit)
    807     : HTMLTablePartElementImpl(doc)
    808 {
    809     _id = tagid;
     797HTMLTableSectionElementImpl::HTMLTableSectionElementImpl(const QualifiedName& tagName, DocumentPtr *doc, bool implicit)
     798    : HTMLTablePartElementImpl(tagName, doc)
     799{
    810800    m_implicit = implicit;
    811801}
    812802
    813 NodeImpl::Id HTMLTableSectionElementImpl::id() const
    814 {
    815     return _id;
     803bool HTMLTableSectionElementImpl::checkDTD(const NodeImpl* newChild)
     804{
     805    return newChild->hasTagName(HTMLNames::tr()) || newChild->hasTagName(HTMLNames::form()) ||
     806           newChild->hasTagName(HTMLNames::script());
    816807}
    817808
     
    822813#endif
    823814
    824     if (child->id() == ID_FORM) {
     815    if (child->hasTagName(HTMLNames::form())) {
    825816        // First add the child.
    826817        HTMLElementImpl::addChild(child);
     
    878869    const NodeImpl *n = firstChild();
    879870    while (n) {
    880         if (n->id() == ID_TR)
     871        if (n->hasTagName(HTMLNames::tr()))
    881872            rows++;
    882873        n = n->nextSibling();
     
    933924// -------------------------------------------------------------------------
    934925
    935 NodeImpl::Id HTMLTableRowElementImpl::id() const
    936 {
    937     return ID_TR;
     926bool HTMLTableRowElementImpl::checkDTD(const NodeImpl* newChild)
     927{
     928    return newChild->hasTagName(HTMLNames::td()) || newChild->hasTagName(HTMLNames::th()) ||
     929           newChild->hasTagName(HTMLNames::form()) || newChild->hasTagName(HTMLNames::script());
    938930}
    939931
     
    944936#endif
    945937
    946     if (child->id() == ID_FORM) {
     938    if (child->hasTagName(HTMLNames::form())) {
    947939        // First add the child.
    948940        HTMLElementImpl::addChild(child);
     
    959951
    960952    NodeImpl *table = parentNode();
    961     if ( !table )
     953    if (!table)
    962954        return -1;
    963955    table = table->parentNode();
    964     if ( !table || table->id() != ID_TABLE )
     956    if (!table || !table->hasTagName(HTMLNames::table()))
    965957        return -1;
    966958
    967959    HTMLTableSectionElementImpl *foot = static_cast<HTMLTableElementImpl *>(table)->tFoot();
    968960    NodeImpl *node = table->firstChild();
    969     while ( node ) {
    970         if ( node != foot && (node->id() == ID_THEAD || node->id() == ID_TFOOT || node->id() == ID_TBODY) ) {
     961    while (node) {
     962        if (node != foot && (node->hasTagName(HTMLNames::thead()) || node->hasTagName(HTMLNames::tfoot()) || node->hasTagName(HTMLNames::tbody()))) {
    971963            HTMLTableSectionElementImpl* section = static_cast<HTMLTableSectionElementImpl *>(node);
    972964            const NodeImpl *row = section->firstChild();
     
    997989    do {
    998990        n = n->previousSibling();
    999         if (n && n->isElementNode() && n->id() == ID_TR)
     991        if (n && n->hasTagName(HTMLNames::tr()))
    1000992            rIndex++;
    1001993    }
     
    10141006    else
    10151007    {
    1016         c = new HTMLTableCellElementImpl(docPtr(), ID_TD);
     1008        c = new HTMLTableCellElementImpl(HTMLNames::td(), docPtr());
    10171009        if(numCells == index || index == -1)
    10181010            appendChild(c, exceptioncode);
     
    11041096// -------------------------------------------------------------------------
    11051097
    1106 HTMLTableCellElementImpl::HTMLTableCellElementImpl(DocumentPtr *doc, int tag)
    1107   : HTMLTablePartElementImpl(doc)
    1108 {
    1109   _col = -1;
    1110   _row = -1;
    1111   cSpan = rSpan = 1;
    1112   _id = tag;
    1113   rowHeight = 0;
    1114   m_solid = false;
     1098HTMLTableCellElementImpl::HTMLTableCellElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
     1099  : HTMLTablePartElementImpl(tagName, doc)
     1100{
     1101    _col = -1;
     1102    _row = -1;
     1103    cSpan = rSpan = 1;
     1104    rowHeight = 0;
     1105    m_solid = false;
    11151106}
    11161107
     
    11231114    int index = 0;
    11241115    for (const NodeImpl * node = previousSibling(); node; node = node->previousSibling()) {
    1125         if (node->id() == ID_TD || node->id() == ID_TH)
     1116        if (node->hasTagName(HTMLNames::td()) || node->hasTagName(HTMLNames::th()))
    11261117            index++;
    11271118    }
     
    11901181CSSMutableStyleDeclarationImpl* HTMLTableCellElementImpl::additionalAttributeStyleDecl()
    11911182{
    1192     HTMLElementImpl* p = static_cast<HTMLElementImpl*>(parentNode());
    1193     while(p && p->id() != ID_TABLE)
    1194         p = static_cast<HTMLElementImpl*>(p->parentNode());
     1183    NodeImpl* p = parentNode();
     1184    while (p && !p->hasTagName(HTMLNames::table()))
     1185        p = p->parentNode();
    11951186
    11961187    if (p) {
     
    12021193}
    12031194
    1204 void HTMLTableCellElementImpl::attach()
    1205 {
    1206     HTMLElementImpl* p = static_cast<HTMLElementImpl*>(parentNode());
    1207     while(p && p->id() != ID_TABLE)
    1208         p = static_cast<HTMLElementImpl*>(p->parentNode());
    1209 
    1210     HTMLTablePartElementImpl::attach();
    1211 }
    1212 
    12131195bool HTMLTableCellElementImpl::isURLAttribute(AttributeImpl *attr) const
    12141196{
     
    13481330// -------------------------------------------------------------------------
    13491331
    1350 HTMLTableColElementImpl::HTMLTableColElementImpl(DocumentPtr *doc, ushort i)
    1351     : HTMLTablePartElementImpl(doc)
    1352 {
    1353     _id = i;
    1354     _span = (_id == ID_COLGROUP ? 0 : 1);
    1355 }
    1356 
    1357 NodeImpl::Id HTMLTableColElementImpl::id() const
    1358 {
    1359     return _id;
     1332HTMLTableColElementImpl::HTMLTableColElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
     1333    : HTMLTablePartElementImpl(tagName, doc)
     1334{
     1335    _span = (tagName.matches(HTMLNames::colgroup()) ? 0 : 1);
    13601336}
    13611337
     
    14481424// -------------------------------------------------------------------------
    14491425
    1450 NodeImpl::Id HTMLTableCaptionElementImpl::id() const
    1451 {
    1452     return ID_CAPTION;
    1453 }
    1454 
    14551426bool HTMLTableCaptionElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
    14561427{
  • trunk/WebCore/khtml/html/html_tableimpl.h

    r9420 r9639  
    6363    ~HTMLTableElementImpl();
    6464
    65     virtual Id id() const;
     65    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     66    virtual int tagPriority() const { return 9; }
     67    virtual bool checkDTD(const NodeImpl* newChild);
    6668
    6769    HTMLTableCaptionElementImpl *caption() const { return tCaption; }
     
    148150{
    149151public:
    150     HTMLTablePartElementImpl(DocumentPtr *doc)
    151         : HTMLElementImpl(doc)
     152    HTMLTablePartElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
     153        : HTMLElementImpl(tagName, doc)
    152154        { }
    153155
     
    161163{
    162164public:
    163     HTMLTableSectionElementImpl(DocumentPtr *doc, ushort tagid, bool implicit);
    164 
    165     virtual Id id() const;
     165    HTMLTableSectionElementImpl(const QualifiedName& tagName, DocumentPtr *doc, bool implicit);
     166
     167    virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
     168    virtual int tagPriority() const { return 8; }
     169    virtual bool checkDTD(const NodeImpl* newChild);
    166170
    167171    virtual NodeImpl *addChild(NodeImpl *child);
     
    185189
    186190    khtml::SharedPtr<HTMLCollectionImpl> rows();
    187 
    188 protected:
    189     ushort _id;
    190191};
    191192
     
    196197public:
    197198    HTMLTableRowElementImpl(DocumentPtr *doc)
    198         : HTMLTablePartElementImpl(doc) {}
    199 
    200     virtual Id id() const;
    201 
     199        : HTMLTablePartElementImpl(HTMLNames::tr(), doc) {}
     200
     201    virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
     202    virtual int tagPriority() const { return 7; }
     203    virtual bool checkDTD(const NodeImpl* newChild);
     204       
    202205    virtual NodeImpl *addChild(NodeImpl *child);
    203206   
     
    239242{
    240243public:
    241     HTMLTableCellElementImpl(DocumentPtr *doc, int tagId);
     244    HTMLTableCellElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
    242245    ~HTMLTableCellElementImpl();
    243246
    244     // ### FIX these two...
     247    virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
     248    virtual int tagPriority() const { return 6; }
     249
    245250    long cellIndex() const;
    246251
     
    252257    int colSpan() const { return cSpan; }
    253258    int rowSpan() const { return rSpan; }
    254    
    255     virtual Id id() const { return _id; }
    256    
    257     virtual bool mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const;
    258     virtual void parseMappedAttribute(MappedAttributeImpl *attr);
    259 
    260     virtual void attach();
     259
     260    virtual bool mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const;
     261    virtual void parseMappedAttribute(MappedAttributeImpl *attr);
    261262
    262263    // used by table cells to share style decls created by the enclosing table.
     
    312313    int rSpan;
    313314    int cSpan;
    314     int _id;
    315315    int rowHeight;
    316316    bool m_solid        : 1;
     
    322322{
    323323public:
    324     HTMLTableColElementImpl(DocumentPtr *doc, ushort i);
    325 
    326     virtual Id id() const;
    327 
     324    HTMLTableColElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
     325
     326    virtual HTMLTagStatus endTagRequirement() const { return hasLocalName(HTMLNames::col()) ? TagStatusForbidden : TagStatusOptional; }
     327    virtual int tagPriority() const { return hasLocalName(HTMLNames::col()) ? 0 : 1; }
     328    virtual bool checkDTD(const NodeImpl* newChild) { return hasLocalName(HTMLNames::colgroup()) && newChild->hasTagName(HTMLNames::col()); }
    328329    void setTable(HTMLTableElementImpl *t) { table = t; }
    329330
     
    352353
    353354protected:
    354     // could be ID_COL or ID_COLGROUP ... The DOM is not quite clear on
    355     // this, but since both elements work quite similar, we use one
    356     // DOMElement for them...
    357     ushort _id;
    358355    int _span;
    359356    HTMLTableElementImpl *table;
     
    366363public:
    367364    HTMLTableCaptionElementImpl(DocumentPtr *doc)
    368         : HTMLTablePartElementImpl(doc) {}
    369 
    370     virtual Id id() const;
     365        : HTMLTablePartElementImpl(HTMLNames::caption(), doc) {}
     366
     367    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     368    virtual int tagPriority() const { return 5; }
    371369   
    372370    virtual bool mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const;
  • trunk/WebCore/khtml/html/htmlnames.cpp

    r9402 r9639  
    2121 */
    2222
     23#define KHTML_HTMLNAMES_HIDE_GLOBALS 1
     24
     25#include <qptrdict.h>
    2326#include "htmlnames.h"
    2427#include "dom_qname.h"
     
    2629namespace DOM {
    2730
    28 const AtomicString& HTMLNames::xhtmlNamespaceURI()
     31void* xhtmlNamespaceURIAtom[(sizeof(AtomicString) + sizeof(void*) - 1) / sizeof(void*)];
     32
     33// Define a QualifiedName-sized array of pointers to avoid static initialization.
     34// Use an array of pointers instead of an array of char in case there is some alignment issue.
     35#define DEFINE_GLOBAL(name) \
     36    void* name ## QName[(sizeof(QualifiedName) + sizeof(void*) - 1) / sizeof(void*)];
     37
     38DEFINE_GLOBAL(a)
     39DEFINE_GLOBAL(abbr)
     40DEFINE_GLOBAL(acronym)
     41DEFINE_GLOBAL(address)
     42DEFINE_GLOBAL(applet)
     43DEFINE_GLOBAL(area)
     44DEFINE_GLOBAL(b)
     45DEFINE_GLOBAL(base)
     46DEFINE_GLOBAL(basefont)
     47DEFINE_GLOBAL(bdo)
     48DEFINE_GLOBAL(big)
     49DEFINE_GLOBAL(blockquote)
     50DEFINE_GLOBAL(body)
     51DEFINE_GLOBAL(br)
     52DEFINE_GLOBAL(button)
     53DEFINE_GLOBAL(canvas)
     54DEFINE_GLOBAL(caption)
     55DEFINE_GLOBAL(center)
     56DEFINE_GLOBAL(cite)
     57DEFINE_GLOBAL(code)
     58DEFINE_GLOBAL(col)
     59DEFINE_GLOBAL(colgroup)
     60DEFINE_GLOBAL(dd)
     61DEFINE_GLOBAL(del)
     62DEFINE_GLOBAL(dfn)
     63DEFINE_GLOBAL(dir)
     64DEFINE_GLOBAL(div)
     65DEFINE_GLOBAL(dl)
     66DEFINE_GLOBAL(dt)
     67DEFINE_GLOBAL(em)
     68DEFINE_GLOBAL(embed)
     69DEFINE_GLOBAL(fieldset)
     70DEFINE_GLOBAL(font)
     71DEFINE_GLOBAL(form)
     72DEFINE_GLOBAL(frame)
     73DEFINE_GLOBAL(frameset)
     74DEFINE_GLOBAL(head)
     75DEFINE_GLOBAL(h1)
     76DEFINE_GLOBAL(h2)
     77DEFINE_GLOBAL(h3)
     78DEFINE_GLOBAL(h4)
     79DEFINE_GLOBAL(h5)
     80DEFINE_GLOBAL(h6)
     81DEFINE_GLOBAL(hr)
     82DEFINE_GLOBAL(html)
     83DEFINE_GLOBAL(i)
     84DEFINE_GLOBAL(iframe)
     85DEFINE_GLOBAL(img)
     86DEFINE_GLOBAL(input)
     87DEFINE_GLOBAL(ins)
     88DEFINE_GLOBAL(isindex)
     89DEFINE_GLOBAL(kbd)
     90DEFINE_GLOBAL(keygen)
     91DEFINE_GLOBAL(label)
     92DEFINE_GLOBAL(layer)
     93DEFINE_GLOBAL(legend)
     94DEFINE_GLOBAL(li)
     95DEFINE_GLOBAL(link)
     96DEFINE_GLOBAL(map)
     97DEFINE_GLOBAL(marquee)
     98DEFINE_GLOBAL(menu)
     99DEFINE_GLOBAL(meta)
     100DEFINE_GLOBAL(nobr)
     101DEFINE_GLOBAL(noembed)
     102DEFINE_GLOBAL(noframes)
     103DEFINE_GLOBAL(nolayer)
     104DEFINE_GLOBAL(noscript)
     105DEFINE_GLOBAL(object)
     106DEFINE_GLOBAL(ol)
     107DEFINE_GLOBAL(optgroup)
     108DEFINE_GLOBAL(option)
     109DEFINE_GLOBAL(p)
     110DEFINE_GLOBAL(param)
     111DEFINE_GLOBAL(plaintext)
     112DEFINE_GLOBAL(pre)
     113DEFINE_GLOBAL(q)
     114DEFINE_GLOBAL(s)
     115DEFINE_GLOBAL(samp)
     116DEFINE_GLOBAL(script)
     117DEFINE_GLOBAL(select)
     118DEFINE_GLOBAL(small)
     119DEFINE_GLOBAL(span)
     120DEFINE_GLOBAL(strike)
     121DEFINE_GLOBAL(strong)
     122DEFINE_GLOBAL(style)
     123DEFINE_GLOBAL(sub)
     124DEFINE_GLOBAL(sup)
     125DEFINE_GLOBAL(table)
     126DEFINE_GLOBAL(tbody)
     127DEFINE_GLOBAL(td)
     128DEFINE_GLOBAL(textarea)
     129DEFINE_GLOBAL(tfoot)
     130DEFINE_GLOBAL(th)
     131DEFINE_GLOBAL(thead)
     132DEFINE_GLOBAL(title)
     133DEFINE_GLOBAL(tr)
     134DEFINE_GLOBAL(tt)
     135DEFINE_GLOBAL(u)
     136DEFINE_GLOBAL(ul)
     137DEFINE_GLOBAL(var)
     138DEFINE_GLOBAL(wbr)
     139DEFINE_GLOBAL(xmp)
     140
     141void HTMLNames::init()
    29142{
    30     static AtomicString xhtmlNS("http://www.w3.org/1999/xhtml");
    31     return xhtmlNS;
     143    static bool initialized;
     144    if (!initialized) {
     145        // Use placement new to initialize the globals.
     146        static AtomicString xhtmlNS("http://www.w3.org/1999/xhtml");
     147        new (&xhtmlNamespaceURIAtom) AtomicString(xhtmlNS);
     148        new (&aQName) QualifiedName(nullAtom, "a", xhtmlNS);
     149        new (&abbrQName) QualifiedName(nullAtom, "abbr", xhtmlNS);
     150        new (&acronymQName) QualifiedName(nullAtom, "acronym", xhtmlNS);
     151        new (&addressQName) QualifiedName(nullAtom, "address", xhtmlNS);
     152        new (&appletQName) QualifiedName(nullAtom, "applet", xhtmlNS);
     153        new (&areaQName) QualifiedName(nullAtom, "area", xhtmlNS);
     154        new (&bQName) QualifiedName(nullAtom, "b", xhtmlNS);
     155        new (&baseQName) QualifiedName(nullAtom, "base", xhtmlNS);
     156        new (&basefontQName) QualifiedName(nullAtom, "basefont", xhtmlNS);
     157        new (&bdoQName) QualifiedName(nullAtom, "bdo", xhtmlNS);
     158        new (&bigQName) QualifiedName(nullAtom, "big", xhtmlNS);
     159        new (&blockquoteQName) QualifiedName(nullAtom, "blockquote", xhtmlNS);
     160        new (&bodyQName) QualifiedName(nullAtom, "body", xhtmlNS);
     161        new (&brQName) QualifiedName(nullAtom, "br", xhtmlNS);
     162        new (&buttonQName) QualifiedName(nullAtom, "button", xhtmlNS);
     163        new (&canvasQName) QualifiedName(nullAtom, "canvas", xhtmlNS);
     164        new (&captionQName) QualifiedName(nullAtom, "caption", xhtmlNS);
     165        new (&centerQName) QualifiedName(nullAtom, "center", xhtmlNS);
     166        new (&citeQName) QualifiedName(nullAtom, "cite", xhtmlNS);
     167        new (&codeQName) QualifiedName(nullAtom, "code", xhtmlNS);
     168        new (&colQName) QualifiedName(nullAtom, "col", xhtmlNS);
     169        new (&colgroupQName) QualifiedName(nullAtom, "colgroup", xhtmlNS);
     170        new (&ddQName) QualifiedName(nullAtom, "dd", xhtmlNS);
     171        new (&delQName) QualifiedName(nullAtom, "del", xhtmlNS);
     172        new (&dfnQName) QualifiedName(nullAtom, "dfn", xhtmlNS);
     173        new (&dirQName) QualifiedName(nullAtom, "dir", xhtmlNS);
     174        new (&divQName) QualifiedName(nullAtom, "div", xhtmlNS);
     175        new (&dlQName) QualifiedName(nullAtom, "dl", xhtmlNS);
     176        new (&dtQName) QualifiedName(nullAtom, "dt", xhtmlNS);
     177        new (&emQName) QualifiedName(nullAtom, "em", xhtmlNS);
     178        new (&embedQName) QualifiedName(nullAtom, "embed", xhtmlNS);
     179        new (&fieldsetQName) QualifiedName(nullAtom, "fieldset", xhtmlNS);
     180        new (&fontQName) QualifiedName(nullAtom, "font", xhtmlNS);
     181        new (&formQName) QualifiedName(nullAtom, "form", xhtmlNS);
     182        new (&frameQName) QualifiedName(nullAtom, "frame", xhtmlNS);
     183        new (&framesetQName) QualifiedName(nullAtom, "frameset", xhtmlNS);
     184        new (&headQName) QualifiedName(nullAtom, "head", xhtmlNS);
     185        new (&h1QName) QualifiedName(nullAtom, "h1", xhtmlNS);
     186        new (&h2QName) QualifiedName(nullAtom, "h2", xhtmlNS);
     187        new (&h3QName) QualifiedName(nullAtom, "h3", xhtmlNS);
     188        new (&h4QName) QualifiedName(nullAtom, "h4", xhtmlNS);
     189        new (&h5QName) QualifiedName(nullAtom, "h5", xhtmlNS);
     190        new (&h6QName) QualifiedName(nullAtom, "h6", xhtmlNS);
     191        new (&hrQName) QualifiedName(nullAtom, "hr", xhtmlNS);
     192        new (&htmlQName) QualifiedName(nullAtom, "html", xhtmlNS);
     193        new (&iQName) QualifiedName(nullAtom, "i", xhtmlNS);
     194        new (&iframeQName) QualifiedName(nullAtom, "iframe", xhtmlNS);
     195        new (&imgQName) QualifiedName(nullAtom, "img", xhtmlNS);
     196        new (&inputQName) QualifiedName(nullAtom, "input", xhtmlNS);
     197        new (&insQName) QualifiedName(nullAtom, "ins", xhtmlNS);
     198        new (&isindexQName) QualifiedName(nullAtom, "isindex", xhtmlNS);
     199        new (&kbdQName) QualifiedName(nullAtom, "kbd", xhtmlNS);
     200        new (&keygenQName) QualifiedName(nullAtom, "keygen", xhtmlNS);
     201        new (&labelQName) QualifiedName(nullAtom, "label", xhtmlNS);
     202        new (&layerQName) QualifiedName(nullAtom, "layer", xhtmlNS);
     203        new (&legendQName) QualifiedName(nullAtom, "legend", xhtmlNS);
     204        new (&liQName) QualifiedName(nullAtom, "li", xhtmlNS);
     205        new (&linkQName) QualifiedName(nullAtom, "link", xhtmlNS);
     206        new (&mapQName) QualifiedName(nullAtom, "map", xhtmlNS);
     207        new (&marqueeQName) QualifiedName(nullAtom, "marquee", xhtmlNS);
     208        new (&menuQName) QualifiedName(nullAtom, "menu", xhtmlNS);
     209        new (&metaQName) QualifiedName(nullAtom, "meta", xhtmlNS);
     210        new (&nobrQName) QualifiedName(nullAtom, "nobr", xhtmlNS);
     211        new (&noembedQName) QualifiedName(nullAtom, "noembed", xhtmlNS);
     212        new (&noframesQName) QualifiedName(nullAtom, "noframes", xhtmlNS);
     213        new (&nolayerQName) QualifiedName(nullAtom, "nolayer", xhtmlNS);
     214        new (&noscriptQName) QualifiedName(nullAtom, "noscript", xhtmlNS);
     215        new (&objectQName) QualifiedName(nullAtom, "object", xhtmlNS);
     216        new (&olQName) QualifiedName(nullAtom, "ol", xhtmlNS);
     217        new (&optgroupQName) QualifiedName(nullAtom, "optgroup", xhtmlNS);
     218        new (&optionQName) QualifiedName(nullAtom, "option", xhtmlNS);
     219        new (&pQName) QualifiedName(nullAtom, "p", xhtmlNS);
     220        new (&paramQName) QualifiedName(nullAtom, "param", xhtmlNS);
     221        new (&plaintextQName) QualifiedName(nullAtom, "plaintext", xhtmlNS);
     222        new (&preQName) QualifiedName(nullAtom, "pre", xhtmlNS);
     223        new (&qQName) QualifiedName(nullAtom, "q", xhtmlNS);
     224        new (&sQName) QualifiedName(nullAtom, "s", xhtmlNS);
     225        new (&sampQName) QualifiedName(nullAtom, "samp", xhtmlNS);
     226        new (&scriptQName) QualifiedName(nullAtom, "script", xhtmlNS);
     227        new (&selectQName) QualifiedName(nullAtom, "select", xhtmlNS);
     228        new (&smallQName) QualifiedName(nullAtom, "small", xhtmlNS);
     229        new (&spanQName) QualifiedName(nullAtom, "span", xhtmlNS);
     230        new (&strikeQName) QualifiedName(nullAtom, "strike", xhtmlNS);
     231        new (&strongQName) QualifiedName(nullAtom, "strong", xhtmlNS);
     232        new (&styleQName) QualifiedName(nullAtom, "style", xhtmlNS);
     233        new (&subQName) QualifiedName(nullAtom, "sub", xhtmlNS);
     234        new (&supQName) QualifiedName(nullAtom, "sup", xhtmlNS);
     235        new (&tableQName) QualifiedName(nullAtom, "table", xhtmlNS);
     236        new (&tbodyQName) QualifiedName(nullAtom, "tbody", xhtmlNS);
     237        new (&tdQName) QualifiedName(nullAtom, "td", xhtmlNS);
     238        new (&textareaQName) QualifiedName(nullAtom, "textarea", xhtmlNS);
     239        new (&tfootQName) QualifiedName(nullAtom, "tfoot", xhtmlNS);
     240        new (&thQName) QualifiedName(nullAtom, "th", xhtmlNS);
     241        new (&theadQName) QualifiedName(nullAtom, "thead", xhtmlNS);
     242        new (&titleQName) QualifiedName(nullAtom, "title", xhtmlNS);
     243        new (&trQName) QualifiedName(nullAtom, "tr", xhtmlNS);
     244        new (&ttQName) QualifiedName(nullAtom, "tt", xhtmlNS);
     245        new (&uQName) QualifiedName(nullAtom, "u", xhtmlNS);
     246        new (&ulQName) QualifiedName(nullAtom, "ul", xhtmlNS);
     247        new (&varQName) QualifiedName(nullAtom, "var", xhtmlNS);
     248        new (&wbrQName) QualifiedName(nullAtom, "wbr", xhtmlNS);
     249        new (&xmpQName) QualifiedName(nullAtom, "xmp", xhtmlNS);
     250        initialized = true;
     251    }
    32252}
    33253
    34 
    35 // Tag names.
    36 const QualifiedName& HTMLNames::a()
    37 {
    38     static QualifiedName a(nullAtom, "a", xhtmlNamespaceURI());
    39     return a;
    40254}
    41 
    42 const QualifiedName& HTMLNames::address()
    43 {
    44     static QualifiedName address(nullAtom, "address", xhtmlNamespaceURI());
    45     return address;
    46 }
    47 
    48 const QualifiedName& HTMLNames::applet()
    49 {
    50     static QualifiedName applet(nullAtom, "applet", xhtmlNamespaceURI());
    51     return applet;
    52 }
    53 
    54 const QualifiedName& HTMLNames::area()
    55 {
    56     static QualifiedName area(nullAtom, "area", xhtmlNamespaceURI());
    57     return area;
    58 }
    59 
    60 const QualifiedName& HTMLNames::b()
    61 {
    62     static QualifiedName b(nullAtom, "b", xhtmlNamespaceURI());
    63     return b;
    64 }
    65 
    66 const QualifiedName& HTMLNames::base()
    67 {
    68     static QualifiedName base(nullAtom, "base", xhtmlNamespaceURI());
    69     return base;
    70 }
    71 
    72 const QualifiedName& HTMLNames::basefont()
    73 {
    74     static QualifiedName basefont(nullAtom, "basefont", xhtmlNamespaceURI());
    75     return basefont;
    76 }
    77 
    78 const QualifiedName& HTMLNames::big()
    79 {
    80     static QualifiedName big(nullAtom, "big", xhtmlNamespaceURI());
    81     return big;
    82 }
    83 
    84 const QualifiedName& HTMLNames::blockquote()
    85 {
    86     static QualifiedName blockquote(nullAtom, "blockquote", xhtmlNamespaceURI());
    87     return blockquote;
    88 }
    89 
    90 const QualifiedName& HTMLNames::body()
    91 {
    92     static QualifiedName body(nullAtom, "body", xhtmlNamespaceURI());
    93     return body;
    94 }
    95 
    96 const QualifiedName& HTMLNames::br()
    97 {
    98     static QualifiedName br(nullAtom, "br", xhtmlNamespaceURI());
    99     return br;
    100 }
    101 
    102 const QualifiedName& HTMLNames::button()
    103 {
    104     static QualifiedName button(nullAtom, "button", xhtmlNamespaceURI());
    105     return button;
    106 }
    107 
    108 const QualifiedName& HTMLNames::canvas()
    109 {
    110     static QualifiedName canvas(nullAtom, "canvas", xhtmlNamespaceURI());
    111     return canvas;
    112 }
    113 
    114 const QualifiedName& HTMLNames::caption()
    115 {
    116     static QualifiedName caption(nullAtom, "caption", xhtmlNamespaceURI());
    117     return caption;
    118 }
    119 
    120 const QualifiedName& HTMLNames::center()
    121 {
    122     static QualifiedName center(nullAtom, "center", xhtmlNamespaceURI());
    123     return center;
    124 }
    125 
    126 const QualifiedName& HTMLNames::code()
    127 {
    128     static QualifiedName code(nullAtom, "code", xhtmlNamespaceURI());
    129     return code;
    130 }
    131 
    132 const QualifiedName& HTMLNames::col()
    133 {
    134     static QualifiedName col(nullAtom, "col", xhtmlNamespaceURI());
    135     return col;
    136 }
    137 
    138 const QualifiedName& HTMLNames::colgroup()
    139 {
    140     static QualifiedName colgroup(nullAtom, "colgroup", xhtmlNamespaceURI());
    141     return colgroup;
    142 }
    143 
    144 const QualifiedName& HTMLNames::dd()
    145 {
    146     static QualifiedName dd(nullAtom, "dd", xhtmlNamespaceURI());
    147     return dd;
    148 }
    149 
    150 const QualifiedName& HTMLNames::del()
    151 {
    152     static QualifiedName del(nullAtom, "del", xhtmlNamespaceURI());
    153     return del;
    154 }
    155 
    156 const QualifiedName& HTMLNames::dfn()
    157 {
    158     static QualifiedName dfn(nullAtom, "dfn", xhtmlNamespaceURI());
    159     return dfn;
    160 }
    161 
    162 const QualifiedName& HTMLNames::dir()
    163 {
    164     static QualifiedName dir(nullAtom, "dir", xhtmlNamespaceURI());
    165     return dir;
    166 }
    167 
    168 const QualifiedName& HTMLNames::div()
    169 {
    170     static QualifiedName div(nullAtom, "div", xhtmlNamespaceURI());
    171     return div;
    172 }
    173 
    174 const QualifiedName& HTMLNames::dl()
    175 {
    176     static QualifiedName dl(nullAtom, "dl", xhtmlNamespaceURI());
    177     return dl;
    178 }
    179 
    180 const QualifiedName& HTMLNames::dt()
    181 {
    182     static QualifiedName dt(nullAtom, "dt", xhtmlNamespaceURI());
    183     return dt;
    184 }
    185 
    186 const QualifiedName& HTMLNames::em()
    187 {
    188     static QualifiedName em(nullAtom, "em", xhtmlNamespaceURI());
    189     return em;
    190 }
    191 
    192 const QualifiedName& HTMLNames::embed()
    193 {
    194     static QualifiedName embed(nullAtom, "embed", xhtmlNamespaceURI());
    195     return embed;
    196 }
    197 
    198 const QualifiedName& HTMLNames::fieldset()
    199 {
    200     static QualifiedName fieldset(nullAtom, "fieldset", xhtmlNamespaceURI());
    201     return fieldset;
    202 }
    203 
    204 const QualifiedName& HTMLNames::font()
    205 {
    206     static QualifiedName font(nullAtom, "font", xhtmlNamespaceURI());
    207     return font;
    208 }
    209 
    210 const QualifiedName& HTMLNames::form()
    211 {
    212     static QualifiedName form(nullAtom, "form", xhtmlNamespaceURI());
    213     return form;
    214 }
    215 
    216 const QualifiedName& HTMLNames::frame()
    217 {
    218     static QualifiedName frame(nullAtom, "frame", xhtmlNamespaceURI());
    219     return frame;
    220 }
    221 
    222 const QualifiedName& HTMLNames::frameset()
    223 {
    224     static QualifiedName frameset(nullAtom, "frameset", xhtmlNamespaceURI());
    225     return frameset;
    226 }
    227 
    228 const QualifiedName& HTMLNames::head()
    229 {
    230     static QualifiedName head(nullAtom, "head", xhtmlNamespaceURI());
    231     return head;
    232 }
    233 
    234 const QualifiedName& HTMLNames::h1()
    235 {
    236     static QualifiedName h1(nullAtom, "h1", xhtmlNamespaceURI());
    237     return h1;
    238 }
    239 
    240 const QualifiedName& HTMLNames::h2()
    241 {
    242     static QualifiedName h2(nullAtom, "h2", xhtmlNamespaceURI());
    243     return h2;
    244 }
    245 
    246 const QualifiedName& HTMLNames::h3()
    247 {
    248     static QualifiedName h3(nullAtom, "h3", xhtmlNamespaceURI());
    249     return h3;
    250 }
    251 
    252 const QualifiedName& HTMLNames::h4()
    253 {
    254     static QualifiedName h4(nullAtom, "h4", xhtmlNamespaceURI());
    255     return h4;
    256 }
    257 
    258 const QualifiedName& HTMLNames::h5()
    259 {
    260     static QualifiedName h5(nullAtom, "h5", xhtmlNamespaceURI());
    261     return h5;
    262 }
    263 
    264 const QualifiedName& HTMLNames::h6()
    265 {
    266     static QualifiedName h6(nullAtom, "h6", xhtmlNamespaceURI());
    267     return h6;
    268 }
    269 
    270 const QualifiedName& HTMLNames::hr()
    271 {
    272     static QualifiedName hr(nullAtom, "hr", xhtmlNamespaceURI());
    273     return hr;
    274 }
    275 
    276 const QualifiedName& HTMLNames::html()
    277 {
    278     static QualifiedName html(nullAtom, "html", xhtmlNamespaceURI());
    279     return html;
    280 }
    281 
    282 const QualifiedName& HTMLNames::i()
    283 {
    284     static QualifiedName i(nullAtom, "i", xhtmlNamespaceURI());
    285     return i;
    286 }
    287 
    288 const QualifiedName& HTMLNames::iframe()
    289 {
    290     static QualifiedName iframe(nullAtom, "iframe", xhtmlNamespaceURI());
    291     return iframe;
    292 }
    293 
    294 const QualifiedName& HTMLNames::img()
    295 {
    296     static QualifiedName img(nullAtom, "img", xhtmlNamespaceURI());
    297     return img;
    298 }
    299 
    300 const QualifiedName& HTMLNames::input()
    301 {
    302     static QualifiedName input(nullAtom, "input", xhtmlNamespaceURI());
    303     return input;
    304 }
    305 
    306 const QualifiedName& HTMLNames::ins()
    307 {
    308     static QualifiedName ins(nullAtom, "ins", xhtmlNamespaceURI());
    309     return ins;
    310 }
    311 
    312 const QualifiedName& HTMLNames::isindex()
    313 {
    314     static QualifiedName isindex(nullAtom, "isindex", xhtmlNamespaceURI());
    315     return isindex;
    316 }
    317 
    318 const QualifiedName& HTMLNames::kbd()
    319 {
    320     static QualifiedName kbd(nullAtom, "kbd", xhtmlNamespaceURI());
    321     return kbd;
    322 }
    323 
    324 const QualifiedName& HTMLNames::keygen()
    325 {
    326     static QualifiedName keygen(nullAtom, "keygen", xhtmlNamespaceURI());
    327     return keygen;
    328 }
    329 
    330 const QualifiedName& HTMLNames::label()
    331 {
    332     static QualifiedName label(nullAtom, "label", xhtmlNamespaceURI());
    333     return label;
    334 }
    335 
    336 const QualifiedName& HTMLNames::legend()
    337 {
    338     static QualifiedName legend(nullAtom, "legend", xhtmlNamespaceURI());
    339     return legend;
    340 }
    341 
    342 const QualifiedName& HTMLNames::li()
    343 {
    344     static QualifiedName li(nullAtom, "li", xhtmlNamespaceURI());
    345     return li;
    346 }
    347 
    348 const QualifiedName& HTMLNames::link()
    349 {
    350     static QualifiedName link(nullAtom, "link", xhtmlNamespaceURI());
    351     return link;
    352 }
    353 
    354 const QualifiedName& HTMLNames::map()
    355 {
    356     static QualifiedName map(nullAtom, "map", xhtmlNamespaceURI());
    357     return map;
    358 }
    359 
    360 const QualifiedName& HTMLNames::marquee()
    361 {
    362     static QualifiedName marquee(nullAtom, "marquee", xhtmlNamespaceURI());
    363     return marquee;
    364 }
    365 
    366 const QualifiedName& HTMLNames::menu()
    367 {
    368     static QualifiedName menu(nullAtom, "menu", xhtmlNamespaceURI());
    369     return menu;
    370 }
    371 
    372 const QualifiedName& HTMLNames::meta()
    373 {
    374     static QualifiedName meta(nullAtom, "meta", xhtmlNamespaceURI());
    375     return meta;
    376 }
    377 
    378 const QualifiedName& HTMLNames::noembed()
    379 {
    380     static QualifiedName noembed(nullAtom, "noembed", xhtmlNamespaceURI());
    381     return noembed;
    382 }
    383 
    384 const QualifiedName& HTMLNames::noframes()
    385 {
    386     static QualifiedName noframes(nullAtom, "noframes", xhtmlNamespaceURI());
    387     return noframes;
    388 }
    389 
    390 const QualifiedName& HTMLNames::noscript()
    391 {
    392     static QualifiedName noscript(nullAtom, "noscript", xhtmlNamespaceURI());
    393     return noscript;
    394 }
    395 
    396 const QualifiedName& HTMLNames::object()
    397 {
    398     static QualifiedName object(nullAtom, "object", xhtmlNamespaceURI());
    399     return object;
    400 }
    401 
    402 const QualifiedName& HTMLNames::ol()
    403 {
    404     static QualifiedName ol(nullAtom, "ol", xhtmlNamespaceURI());
    405     return ol;
    406 }
    407 
    408 const QualifiedName& HTMLNames::optgroup()
    409 {
    410     static QualifiedName optgroup(nullAtom, "optgroup", xhtmlNamespaceURI());
    411     return optgroup;
    412 }
    413 
    414 const QualifiedName& HTMLNames::p()
    415 {
    416     static QualifiedName p(nullAtom, "p", xhtmlNamespaceURI());
    417     return p;
    418 }
    419 
    420 const QualifiedName& HTMLNames::param()
    421 {
    422     static QualifiedName param(nullAtom, "param", xhtmlNamespaceURI());
    423     return param;
    424 }
    425 
    426 const QualifiedName& HTMLNames::pre()
    427 {
    428     static QualifiedName pre(nullAtom, "pre", xhtmlNamespaceURI());
    429     return pre;
    430 }
    431 
    432 const QualifiedName& HTMLNames::q()
    433 {
    434     static QualifiedName q(nullAtom, "q", xhtmlNamespaceURI());
    435     return q;
    436 }
    437 
    438 const QualifiedName& HTMLNames::s()
    439 {
    440     static QualifiedName s(nullAtom, "s", xhtmlNamespaceURI());
    441     return s;
    442 }
    443 
    444 const QualifiedName& HTMLNames::samp()
    445 {
    446     static QualifiedName samp(nullAtom, "samp", xhtmlNamespaceURI());
    447     return samp;
    448 }
    449 
    450 const QualifiedName& HTMLNames::script()
    451 {
    452     static QualifiedName script(nullAtom, "script", xhtmlNamespaceURI());
    453     return script;
    454 }
    455 
    456 const QualifiedName& HTMLNames::select()
    457 {
    458     static QualifiedName select(nullAtom, "select", xhtmlNamespaceURI());
    459     return select;
    460 }
    461 
    462 const QualifiedName& HTMLNames::small()
    463 {
    464     static QualifiedName small(nullAtom, "small", xhtmlNamespaceURI());
    465     return small;
    466 }
    467 
    468 const QualifiedName& HTMLNames::strike()
    469 {
    470     static QualifiedName strike(nullAtom, "strike", xhtmlNamespaceURI());
    471     return strike;
    472 }
    473 
    474 const QualifiedName& HTMLNames::strong()
    475 {
    476     static QualifiedName strong(nullAtom, "strong", xhtmlNamespaceURI());
    477     return strong;
    478 }
    479 
    480 const QualifiedName& HTMLNames::style()
    481 {
    482     static QualifiedName style(nullAtom, "style", xhtmlNamespaceURI());
    483     return style;
    484 }
    485 
    486 const QualifiedName& HTMLNames::table()
    487 {
    488     static QualifiedName table(nullAtom, "table", xhtmlNamespaceURI());
    489     return table;
    490 }
    491 
    492 const QualifiedName& HTMLNames::tbody()
    493 {
    494     static QualifiedName tbody(nullAtom, "tbody", xhtmlNamespaceURI());
    495     return tbody;
    496 }
    497 
    498 const QualifiedName& HTMLNames::td()
    499 {
    500     static QualifiedName td(nullAtom, "td", xhtmlNamespaceURI());
    501     return td;
    502 }
    503 
    504 const QualifiedName& HTMLNames::textarea()
    505 {
    506     static QualifiedName textarea(nullAtom, "textarea", xhtmlNamespaceURI());
    507     return textarea;
    508 }
    509 
    510 const QualifiedName& HTMLNames::tfoot()
    511 {
    512     static QualifiedName tfoot(nullAtom, "tfoot", xhtmlNamespaceURI());
    513     return tfoot;
    514 }
    515 
    516 const QualifiedName& HTMLNames::th()
    517 {
    518     static QualifiedName th(nullAtom, "th", xhtmlNamespaceURI());
    519     return th;
    520 }
    521 
    522 const QualifiedName& HTMLNames::thead()
    523 {
    524     static QualifiedName thead(nullAtom, "thead", xhtmlNamespaceURI());
    525     return thead;
    526 }
    527 
    528 const QualifiedName& HTMLNames::title()
    529 {
    530     static QualifiedName title(nullAtom, "title", xhtmlNamespaceURI());
    531     return title;
    532 }
    533 
    534 const QualifiedName& HTMLNames::tr()
    535 {
    536     static QualifiedName tr(nullAtom, "tr", xhtmlNamespaceURI());
    537     return tr;
    538 }
    539 
    540 const QualifiedName& HTMLNames::tt()
    541 {
    542     static QualifiedName tt(nullAtom, "tt", xhtmlNamespaceURI());
    543     return tt;
    544 }
    545 
    546 const QualifiedName& HTMLNames::u()
    547 {
    548     static QualifiedName u(nullAtom, "u", xhtmlNamespaceURI());
    549     return u;
    550 }
    551 
    552 const QualifiedName& HTMLNames::ul()
    553 {
    554     static QualifiedName ul(nullAtom, "ul", xhtmlNamespaceURI());
    555     return ul;
    556 }
    557 
    558 const QualifiedName& HTMLNames::var()
    559 {
    560     static QualifiedName var(nullAtom, "var", xhtmlNamespaceURI());
    561     return var;
    562 }
    563 
    564 const QualifiedName& HTMLNames::xmp()
    565 {
    566     static QualifiedName xmp(nullAtom, "xmp", xhtmlNamespaceURI());
    567     return xmp;
    568 }
    569 
    570 }
  • trunk/WebCore/khtml/html/htmlnames.h

    r9402 r9639  
    2323#define HTMLNAMES_H
    2424
    25 #include "xml/dom_elementimpl.h"
     25#include "dom_qname.h"
    2626
    2727namespace DOM
     
    3030class QualifiedName;
    3131
     32// The globals.
     33// Define external global variables for all HTML names above.
     34#if !KHTML_HTMLNAMES_HIDE_GLOBALS
     35    extern const AtomicString  xhtmlNamespaceURIAtom;
     36    extern const QualifiedName aQName;
     37    extern const QualifiedName abbrQName;
     38    extern const QualifiedName acronymQName;
     39    extern const QualifiedName addressQName;
     40    extern const QualifiedName appletQName;
     41    extern const QualifiedName areaQName;
     42    extern const QualifiedName bQName;
     43    extern const QualifiedName baseQName;
     44    extern const QualifiedName basefontQName;
     45    extern const QualifiedName bdoQName;
     46    extern const QualifiedName bigQName;
     47    extern const QualifiedName blockquoteQName;
     48    extern const QualifiedName bodyQName;
     49    extern const QualifiedName brQName;
     50    extern const QualifiedName buttonQName;
     51    extern const QualifiedName canvasQName;
     52    extern const QualifiedName captionQName;
     53    extern const QualifiedName centerQName;
     54    extern const QualifiedName citeQName;
     55    extern const QualifiedName codeQName;
     56    extern const QualifiedName colQName;
     57    extern const QualifiedName colgroupQName;
     58    extern const QualifiedName ddQName;
     59    extern const QualifiedName delQName;
     60    extern const QualifiedName dfnQName;
     61    extern const QualifiedName dirQName;
     62    extern const QualifiedName divQName;
     63    extern const QualifiedName dlQName;
     64    extern const QualifiedName dtQName;
     65    extern const QualifiedName emQName;
     66    extern const QualifiedName embedQName;
     67    extern const QualifiedName fieldsetQName;
     68    extern const QualifiedName fontQName;
     69    extern const QualifiedName formQName;
     70    extern const QualifiedName frameQName;
     71    extern const QualifiedName framesetQName;
     72    extern const QualifiedName headQName;
     73    extern const QualifiedName h1QName;
     74    extern const QualifiedName h2QName;
     75    extern const QualifiedName h3QName;
     76    extern const QualifiedName h4QName;
     77    extern const QualifiedName h5QName;
     78    extern const QualifiedName h6QName;
     79    extern const QualifiedName hrQName;
     80    extern const QualifiedName htmlQName;
     81    extern const QualifiedName iQName;
     82    extern const QualifiedName iframeQName;
     83    extern const QualifiedName imgQName;
     84    extern const QualifiedName inputQName;
     85    extern const QualifiedName insQName;
     86    extern const QualifiedName isindexQName;
     87    extern const QualifiedName kbdQName;
     88    extern const QualifiedName keygenQName;
     89    extern const QualifiedName labelQName;
     90    extern const QualifiedName layerQName;
     91    extern const QualifiedName legendQName;
     92    extern const QualifiedName liQName;
     93    extern const QualifiedName linkQName;
     94    extern const QualifiedName mapQName;
     95    extern const QualifiedName marqueeQName;
     96    extern const QualifiedName menuQName;
     97    extern const QualifiedName metaQName;
     98    extern const QualifiedName nobrQName;
     99    extern const QualifiedName noembedQName;
     100    extern const QualifiedName noframesQName;
     101    extern const QualifiedName nolayerQName;
     102    extern const QualifiedName noscriptQName;
     103    extern const QualifiedName objectQName;
     104    extern const QualifiedName olQName;
     105    extern const QualifiedName optgroupQName;
     106    extern const QualifiedName optionQName;
     107    extern const QualifiedName pQName;
     108    extern const QualifiedName paramQName;
     109    extern const QualifiedName plaintextQName;
     110    extern const QualifiedName preQName;
     111    extern const QualifiedName qQName;
     112    extern const QualifiedName sQName;
     113    extern const QualifiedName sampQName;
     114    extern const QualifiedName scriptQName;
     115    extern const QualifiedName selectQName;
     116    extern const QualifiedName smallQName;
     117    extern const QualifiedName spanQName;
     118    extern const QualifiedName strikeQName;
     119    extern const QualifiedName strongQName;
     120    extern const QualifiedName styleQName;
     121    extern const QualifiedName subQName;
     122    extern const QualifiedName supQName;
     123    extern const QualifiedName tableQName;
     124    extern const QualifiedName tbodyQName;
     125    extern const QualifiedName tdQName;
     126    extern const QualifiedName textareaQName;
     127    extern const QualifiedName tfootQName;
     128    extern const QualifiedName thQName;
     129    extern const QualifiedName theadQName;
     130    extern const QualifiedName titleQName;
     131    extern const QualifiedName trQName;
     132    extern const QualifiedName ttQName;
     133    extern const QualifiedName uQName;
     134    extern const QualifiedName ulQName;
     135    extern const QualifiedName varQName;
     136    extern const QualifiedName wbrQName;
     137    extern const QualifiedName xmpQName;
     138
     139#endif
     140
     141// FIXME: Make this a namespace instead of a class.
    32142class HTMLNames
    33143{
    34144public:
     145#if !KHTML_HTMLNAMES_HIDE_GLOBALS
    35146    // The namespace URI.
    36     static const AtomicString& xhtmlNamespaceURI();
     147    static const AtomicString& xhtmlNamespaceURI() { return xhtmlNamespaceURIAtom; }
    37148   
    38     // Full tag names.
    39     static const QualifiedName& a();
    40     static const QualifiedName& address();
    41     static const QualifiedName& applet();
    42     static const QualifiedName& area();
    43     static const QualifiedName& b();
    44     static const QualifiedName& base();
    45     static const QualifiedName& basefont();
    46     static const QualifiedName& big();
    47     static const QualifiedName& blockquote();
    48     static const QualifiedName& body();
    49     static const QualifiedName& br();
    50     static const QualifiedName& button();
    51     static const QualifiedName& canvas();
    52     static const QualifiedName& caption();
    53     static const QualifiedName& center();
    54     static const QualifiedName& code();
    55     static const QualifiedName& col();
    56     static const QualifiedName& colgroup();
    57     static const QualifiedName& dd();
    58     static const QualifiedName& del();
    59     static const QualifiedName& dfn();
    60     static const QualifiedName& dir();
    61     static const QualifiedName& div();
    62     static const QualifiedName& dl();
    63     static const QualifiedName& dt();
    64     static const QualifiedName& em();
    65     static const QualifiedName& embed();
    66     static const QualifiedName& fieldset();
    67     static const QualifiedName& font();
    68     static const QualifiedName& form();
    69     static const QualifiedName& frame();
    70     static const QualifiedName& frameset();
    71     static const QualifiedName& head();
    72     static const QualifiedName& h1();
    73     static const QualifiedName& h2();
    74     static const QualifiedName& h3();
    75     static const QualifiedName& h4();
    76     static const QualifiedName& h5();
    77     static const QualifiedName& h6();
    78     static const QualifiedName& hr();
    79     static const QualifiedName& html();
    80     static const QualifiedName& i();
    81     static const QualifiedName& iframe();
    82     static const QualifiedName& img();
    83     static const QualifiedName& input();
    84     static const QualifiedName& ins();
    85     static const QualifiedName& isindex();
    86     static const QualifiedName& kbd();
    87     static const QualifiedName& keygen();
    88     static const QualifiedName& label();
    89     static const QualifiedName& legend();
    90     static const QualifiedName& li();
    91     static const QualifiedName& link();
    92     static const QualifiedName& map();
    93     static const QualifiedName& marquee();
    94     static const QualifiedName& menu();
    95     static const QualifiedName& meta();
    96     static const QualifiedName& noembed();
    97     static const QualifiedName& noframes();
    98     static const QualifiedName& noscript();
    99     static const QualifiedName& object();
    100     static const QualifiedName& ol();
    101     static const QualifiedName& optgroup();
    102     static const QualifiedName& option();
    103     static const QualifiedName& p();
    104     static const QualifiedName& param();
    105     static const QualifiedName& pre();
    106     static const QualifiedName& q();
    107     static const QualifiedName& s();
    108     static const QualifiedName& samp();
    109     static const QualifiedName& script();
    110     static const QualifiedName& select();
    111     static const QualifiedName& small();
    112     static const QualifiedName& strike();
    113     static const QualifiedName& strong();
    114     static const QualifiedName& style();
    115     static const QualifiedName& table();
    116     static const QualifiedName& tbody();
    117     static const QualifiedName& td();
    118     static const QualifiedName& textarea();
    119     static const QualifiedName& tfoot();
    120     static const QualifiedName& th();
    121     static const QualifiedName& thead();
    122     static const QualifiedName& title();
    123     static const QualifiedName& tr();
    124     static const QualifiedName& tt();
    125     static const QualifiedName& u();
    126     static const QualifiedName& ul();
    127     static const QualifiedName& var();
    128     static const QualifiedName& xmp();
     149// Full tag names.
     150#define DEFINE_GETTER(name) \
     151    static const QualifiedName& name() { return name ## QName; }
     152
     153    DEFINE_GETTER(a)
     154    DEFINE_GETTER(abbr)
     155    DEFINE_GETTER(acronym)
     156    DEFINE_GETTER(address)
     157    DEFINE_GETTER(applet)
     158    DEFINE_GETTER(area)
     159    DEFINE_GETTER(b)
     160    DEFINE_GETTER(base)
     161    DEFINE_GETTER(basefont)
     162    DEFINE_GETTER(bdo)
     163    DEFINE_GETTER(big)
     164    DEFINE_GETTER(blockquote)
     165    DEFINE_GETTER(body)
     166    DEFINE_GETTER(br)
     167    DEFINE_GETTER(button)
     168    DEFINE_GETTER(canvas)
     169    DEFINE_GETTER(caption)
     170    DEFINE_GETTER(center)
     171    DEFINE_GETTER(cite)
     172    DEFINE_GETTER(code)
     173    DEFINE_GETTER(col)
     174    DEFINE_GETTER(colgroup)
     175    DEFINE_GETTER(dd)
     176    DEFINE_GETTER(del)
     177    DEFINE_GETTER(dfn)
     178    DEFINE_GETTER(dir)
     179    DEFINE_GETTER(div)
     180    DEFINE_GETTER(dl)
     181    DEFINE_GETTER(dt)
     182    DEFINE_GETTER(em)
     183    DEFINE_GETTER(embed)
     184    DEFINE_GETTER(fieldset)
     185    DEFINE_GETTER(font)
     186    DEFINE_GETTER(form)
     187    DEFINE_GETTER(frame)
     188    DEFINE_GETTER(frameset)
     189    DEFINE_GETTER(head)
     190    DEFINE_GETTER(h1)
     191    DEFINE_GETTER(h2)
     192    DEFINE_GETTER(h3)
     193    DEFINE_GETTER(h4)
     194    DEFINE_GETTER(h5)
     195    DEFINE_GETTER(h6)
     196    DEFINE_GETTER(hr)
     197    DEFINE_GETTER(html)
     198    DEFINE_GETTER(i)
     199    DEFINE_GETTER(iframe)
     200    DEFINE_GETTER(img)
     201    DEFINE_GETTER(input)
     202    DEFINE_GETTER(ins)
     203    DEFINE_GETTER(isindex)
     204    DEFINE_GETTER(kbd)
     205    DEFINE_GETTER(keygen)
     206    DEFINE_GETTER(label)
     207    DEFINE_GETTER(layer)
     208    DEFINE_GETTER(legend)
     209    DEFINE_GETTER(li)
     210    DEFINE_GETTER(link)
     211    DEFINE_GETTER(map)
     212    DEFINE_GETTER(marquee)
     213    DEFINE_GETTER(menu)
     214    DEFINE_GETTER(meta)
     215    DEFINE_GETTER(nobr)
     216    DEFINE_GETTER(noembed)
     217    DEFINE_GETTER(noframes)
     218    DEFINE_GETTER(nolayer)
     219    DEFINE_GETTER(noscript)
     220    DEFINE_GETTER(object)
     221    DEFINE_GETTER(ol)
     222    DEFINE_GETTER(optgroup)
     223    DEFINE_GETTER(option)
     224    DEFINE_GETTER(p)
     225    DEFINE_GETTER(param)
     226    DEFINE_GETTER(plaintext)
     227    DEFINE_GETTER(pre)
     228    DEFINE_GETTER(q)
     229    DEFINE_GETTER(s)
     230    DEFINE_GETTER(samp)
     231    DEFINE_GETTER(script)
     232    DEFINE_GETTER(select)
     233    DEFINE_GETTER(small)
     234    DEFINE_GETTER(span)
     235    DEFINE_GETTER(strike)
     236    DEFINE_GETTER(strong)
     237    DEFINE_GETTER(style)
     238    DEFINE_GETTER(sub)
     239    DEFINE_GETTER(sup)
     240    DEFINE_GETTER(table)
     241    DEFINE_GETTER(tbody)
     242    DEFINE_GETTER(td)
     243    DEFINE_GETTER(textarea)
     244    DEFINE_GETTER(tfoot)
     245    DEFINE_GETTER(th)
     246    DEFINE_GETTER(thead)
     247    DEFINE_GETTER(title)
     248    DEFINE_GETTER(tr)
     249    DEFINE_GETTER(tt)
     250    DEFINE_GETTER(u)
     251    DEFINE_GETTER(ul)
     252    DEFINE_GETTER(var)
     253    DEFINE_GETTER(wbr)
     254    DEFINE_GETTER(xmp)
    129255
    130256    // Attribute names.
     257#endif
     258
     259    // Init routine
     260    static void init();
    131261};
    132262
  • trunk/WebCore/khtml/html/htmlparser.cpp

    r9156 r9639  
    4545#include "html/html_tableimpl.h"
    4646#include "html/html_objectimpl.h"
     47#include "htmlfactory.h"
    4748#include "xml/dom_textimpl.h"
    4849#include "xml/dom_nodeimpl.h"
    4950#include "misc/htmlhashes.h"
     51#include "misc/main_thread_malloc.h"
     52#include "misc/hashset.h"
    5053#include "html/htmltokenizer.h"
    5154#include "khtmlview.h"
     
    5659#include "rendering/render_object.h"
    5760
     61#include "misc/pointerhash.h"
     62
    5863#include <kdebug.h>
    5964#include <klocale.h>
     
    7075{
    7176public:
    72     HTMLStackElem( int _id,
    73                    int _level,
    74                    DOM::NodeImpl *_node,
    75                    HTMLStackElem * _next
     77    HTMLStackElem(const AtomicString& _tagName,
     78                  int _level,
     79                  DOM::NodeImpl *_node,
     80                  HTMLStackElem * _next
    7681        )
    7782        :
    78         id(_id),
     83        tagName(_tagName),
    7984        level(_level),
    8085        strayTableContent(false),
     
    8388        { }
    8489
    85     int       id;
    86     int       level;
    87     bool      strayTableContent;
    88     NodeImpl *node;
    89     HTMLStackElem *next;
     90    MAIN_THREAD_ALLOCATED;
     91
     92    AtomicString tagName;
     93    int level;
     94    bool strayTableContent;
     95    NodeImpl* node;
     96    HTMLStackElem* next;
    9097};
    9198
     
    113120 *
    114121 */
    115 KHTMLParser::KHTMLParser(KHTMLView *_parent, DocumentPtr *doc, bool includesComments)
     122HTMLParser::HTMLParser(KHTMLView *_parent, DocumentPtr *doc, bool includesComments)
    116123    : current(0), currentIsReferenced(false), includesCommentsInDOM(includesComments)
    117124{
    118     //kdDebug( 6035 ) << "parser constructor" << endl;
    119 #if SPEED_DEBUG > 0
    120     qt.start();
    121 #endif
    122 
    123125    HTMLWidget    = _parent;
    124126    document      = doc;
     
    130132}
    131133
    132 KHTMLParser::KHTMLParser(DOM::DocumentFragmentImpl *i, DocumentPtr *doc, bool includesComments)
     134HTMLParser::HTMLParser(DOM::DocumentFragmentImpl *i, DocumentPtr *doc, bool includesComments)
    133135    : current(0), currentIsReferenced(false), includesCommentsInDOM(includesComments)
    134136{
     
    144146}
    145147
    146 KHTMLParser::~KHTMLParser()
    147 {
    148 #if SPEED_DEBUG > 0
    149     kdDebug( ) << "TIME: parsing time was = " << qt.elapsed() << endl;
    150 #endif
    151 
     148HTMLParser::~HTMLParser()
     149{
    152150    freeBlock();
    153151
     
    160158}
    161159
    162 void KHTMLParser::reset()
     160void HTMLParser::reset()
    163161{
    164162    setCurrent(doc());
    165163
    166164    freeBlock();
    167 
    168     // before parsing, no tags are forbidden
    169     memset(forbiddenTag, 0, sizeof(forbiddenTag));
    170165
    171166    inBody = false;
     
    181176    isindex = 0;
    182177   
    183     discard_until = 0;
    184 }
    185 
    186 void KHTMLParser::setCurrent(DOM::NodeImpl *newCurrent)
     178    discard_until = nullAtom;
     179}
     180
     181void HTMLParser::setCurrent(DOM::NodeImpl *newCurrent)
    187182{
    188183    bool newCurrentIsReferenced = newCurrent && newCurrent != doc();
     
    195190}
    196191
    197 void KHTMLParser::parseToken(Token *t)
    198 {
    199     if(discard_until) {
    200         if(t->id == discard_until)
    201             discard_until = 0;
     192void HTMLParser::parseToken(Token *t)
     193{
     194    if (!discard_until.isNull()) {
     195        if (t->tagName == discard_until && !t->beginTag)
     196            discard_until = nullAtom;
    202197
    203198        // do not skip </iframe>
    204         if ( discard_until || current->id() + ID_CLOSE_TAG != t->id )
     199        if (!discard_until.isNull() || (current->localName() != t->tagName))
    205200            return;
    206201    }
    207202
    208 #ifdef PARSER_DEBUG
    209     kdDebug( 6035 ) << "\n\n==> parser: processing token " << getTagName(t->id).string() << "(" << t->id << ")"
    210                     << " current = " << getTagName(current->id()).string() << "(" << current->id() << ")" << endl;
    211     kdDebug(6035) << " inBody=" << inBody << " haveFrameSet=" << haveFrameSet << endl;
    212 #endif
    213 
    214     // holy shit. apparently some sites use </br> instead of <br>
    215     // be compatible with IE and NS
    216     if (t->id == ID_BR + ID_CLOSE_TAG && doc()->inCompatMode())
    217         t->id = ID_BR;
    218 
    219     if (t->id > ID_CLOSE_TAG)
    220     {
     203    // Apparently some sites use </br> instead of <br>.  Be compatible with IE and Firefox and treat this like <br>.
     204    if (t->isCloseTag(HTMLNames::br()) && doc()->inCompatMode())
     205        t->beginTag = true;
     206
     207    if (!t->beginTag) {
    221208        processCloseTag(t);
    222209        return;
     
    224211
    225212    // ignore spaces, if we're not inside a paragraph or other inline code
    226     if( t->id == ID_TEXT && t->text ) {
    227         if(inBody && !skipMode() && current->id() != ID_STYLE
    228             && current->id() != ID_TITLE && current->id() != ID_SCRIPT &&
    229             !t->text->containsOnlyWhitespace())
     213    if (t->tagName == textAtom && t->text) {
     214        if (inBody && !skipMode() && current->localName() != HTMLNames::style() && current->localName() != HTMLNames::title() &&
     215            current->localName() != HTMLNames::script() && !t->text->containsOnlyWhitespace())
    230216            haveContent = true;
    231 #ifdef PARSER_DEBUG
    232         kdDebug(6035) << "length="<< t->text->l << " text='" << QConstString(t->text->s, t->text->l).string() << "'" << endl;
    233 #endif
    234     }
    235 
    236     NodeImpl *n = getElement(t);
     217    }
     218
     219    NodeImpl *n = getNode(t);
    237220    // just to be sure, and to catch currently unimplemented stuff
    238     if(!n)
     221    if (!n)
    239222        return;
    240223
     
    242225
    243226    // set attributes
    244     if(n->isElementNode())
    245     {
    246         ElementImpl *e = static_cast<ElementImpl *>(n);
     227    if (n->isHTMLElement()) {
     228        HTMLElementImpl *e = static_cast<HTMLElementImpl*>(n);
    247229        e->setAttributeMap(t->attrs);
    248230
    249231        // take care of optional close tags
    250         if(endTagRequirement(e->id()) == DOM::OPTIONAL)
    251             popBlock(t->id);
     232        if (e->endTagRequirement() == TagStatusOptional)
     233            popBlock(t->tagName);
    252234           
    253         if (isHeaderTag(t->id))
     235        if (isHeaderTag(t->tagName))
    254236            // Do not allow two header tags to be nested if the intervening tags are inlines.
    255237            popNestedHeaderTag();
    256238    }
    257239
    258     // if this tag is forbidden inside the current context, pop
    259     // blocks until we are allowed to add it...
    260     while (blockStack && t->id <= ID_LAST_TAG && forbiddenTag[t->id]) {
    261 #ifdef PARSER_DEBUG
    262         kdDebug( 6035 ) << "t->id: " << t->id << " is forbidden :-( " << endl;
    263 #endif
    264         popOneBlock();
    265     }
    266 
    267     if (!insertNode(n, t->flat))
    268     {
     240    if (!insertNode(n, t->flat)) {
    269241        // we couldn't insert the node...
     242        if (n->isElementNode()) {
     243            ElementImpl* e = static_cast<ElementImpl*>(n);
     244            e->setAttributeMap(0);
     245        }
     246           
     247        if (map == n)
     248            map = 0;
     249
     250        if (form == n)
     251            form = 0;
     252    }
     253}
     254
     255static bool isTableSection(NodeImpl* n)
     256{
     257    return n->hasTagName(HTMLNames::tbody()) || n->hasTagName(HTMLNames::tfoot()) || n->hasTagName(HTMLNames::thead());
     258}
     259
     260static bool isTablePart(NodeImpl* n)
     261{
     262    return n->hasTagName(HTMLNames::tr()) || n->hasTagName(HTMLNames::td()) || n->hasTagName(HTMLNames::th()) ||
     263           isTableSection(n);
     264}
     265
     266static bool isTableRelated(NodeImpl* n)
     267{
     268    return n->hasTagName(HTMLNames::table()) || isTablePart(n);
     269}
     270
     271bool HTMLParser::insertNode(NodeImpl *n, bool flat)
     272{
     273    SharedPtr<NodeImpl> protectNode(n);
     274
     275    const AtomicString& localName = n->localName();
     276    int tagPriority = n->isHTMLElement() ? static_cast<HTMLElementImpl*>(n)->tagPriority() : 0;
    270277       
    271         if(n->isElementNode())
    272         {
    273             ElementImpl *e = static_cast<ElementImpl *>(n);
    274             e->setAttributeMap(0);
    275         }
    276            
    277 #ifdef PARSER_DEBUG
    278         kdDebug( 6035 ) << "insertNode failed current=" << current->id() << ", new=" << n->id() << "!" << endl;
    279 #endif
    280         if (map == n)
    281         {
    282 #ifdef PARSER_DEBUG
    283             kdDebug( 6035 ) << "  --> resetting map!" << endl;
    284 #endif
    285             map = 0;
    286         }
    287         if (form == n)
    288         {
    289 #ifdef PARSER_DEBUG
    290             kdDebug( 6035 ) << "   --> resetting form!" << endl;
    291 #endif
    292             form = 0;
    293         }
    294     }
    295 }
    296 
    297 static bool isTableRelatedTag(int id)
    298 {
    299     return (id == ID_TR || id == ID_TD || id == ID_TABLE || id == ID_TBODY || id == ID_TFOOT || id == ID_THEAD ||
    300             id == ID_TH);
    301 }
    302 
    303 bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
    304 {
    305     SharedPtr<NodeImpl> protectNode(n);
    306 
    307     int id = n->id();
    308 
    309278    // let's be stupid and just try to insert it.
    310     // this should work if the document is wellformed
    311 #ifdef PARSER_DEBUG
    312     NodeImpl *tmp = current;
    313 #endif
     279    // this should work if the document is well-formed
    314280    NodeImpl *newNode = current->addChild(n);
    315     if ( newNode ) {
    316 #ifdef PARSER_DEBUG
    317         kdDebug( 6035 ) << "added " << n->nodeName().string() << " to " << tmp->nodeName().string() << ", new current=" << newNode->nodeName().string() << endl;
    318 #endif
    319         // don't push elements without end tag on the stack
    320         if(tagPriority(id) != 0 && !flat)
    321         {
    322             pushBlock(id, tagPriority(id));
     281    if (newNode) {
     282        // don't push elements without end tags (e.g., <img>) on the stack
     283        if (tagPriority > 0 && !flat) {
     284            pushBlock(localName, tagPriority);
    323285            if (newNode == current)
    324                 popBlock(id);
     286                popBlock(localName);
    325287            else
    326288                setCurrent(newNode);
    327 #if SPEED_DEBUG < 2
    328             if(!n->attached() && HTMLWidget)
     289            if (!n->attached() && HTMLWidget)
    329290                n->attach();
    330 #endif
    331291        }
    332292        else {
    333 #if SPEED_DEBUG < 2
    334             if(!n->attached() && HTMLWidget)
     293            if (!n->attached() && HTMLWidget)
    335294                n->attach();
    336295            if (n->maintainsState()) {
     
    341300            }
    342301            n->closeRenderer();
    343 #endif
    344302        }
    345303
    346304        return true;
    347     } else {
    348 #ifdef PARSER_DEBUG
    349         kdDebug( 6035 ) << "ADDING NODE FAILED!!!! current = " << current->nodeName().string() << ", new = " << n->nodeName().string() << endl;
    350 #endif
    351         // error handling...
    352         HTMLElementImpl *e;
    353         bool handled = false;
    354 
    355         // switch according to the element to insert
    356         switch(id)
    357         {
    358         case ID_TR:
    359         case ID_TH:
    360         case ID_TD:
    361             if (inStrayTableContent && !isTableRelatedTag(current->id())) {
     305    } else
     306        return handleError(n, flat, localName, tagPriority); // Try to handle the error.
     307}
     308
     309bool HTMLParser::handleError(NodeImpl* n, bool flat, const AtomicString& localName, int tagPriority)
     310{
     311    // Error handling code.  This is just ad hoc handling of specific parent/child combinations.
     312    HTMLElementImpl *e;
     313    bool handled = false;
     314
     315    // 1. Check out the element's tag name to decide how to deal with errors.
     316    if (n->isTextNode()) {
     317        if (current->hasTagName(HTMLNames::select()))
     318            return false;
     319    } else if (n->isHTMLElement()) {
     320        HTMLElementImpl* h = static_cast<HTMLElementImpl*>(n);
     321        if (h->hasLocalName(HTMLNames::tr()) || h->hasLocalName(HTMLNames::th()) ||
     322            h->hasLocalName(HTMLNames::td())) {
     323            if (inStrayTableContent && !isTableRelated(current)) {
    362324                // pop out to the nearest enclosing table-related tag.
    363                 while (blockStack && !isTableRelatedTag(current->id()))
     325                while (blockStack && !isTableRelated(current))
    364326                    popOneBlock();
    365327                return insertNode(n);
    366328            }
    367             break;
    368         case ID_COMMENT:
    369             break;
    370         case ID_HEAD:
    371             // ### alllow not having <HTML> in at all, as per HTML spec
    372             if (!current->isDocumentNode() && current->id() != ID_HTML )
     329        } else if (h->hasLocalName(HTMLNames::head())) {
     330            if (!current->isDocumentNode() && !current->hasTagName(HTMLNames::html()))
    373331                return false;
    374             break;
    375             // We can deal with a base, meta and link element in the body, by just adding the element to head.
    376         case ID_META:
    377         case ID_LINK:
    378         case ID_BASE:
    379             if( !head )
     332        } else if (h->hasLocalName(HTMLNames::meta()) || h->hasLocalName(HTMLNames::link()) || h->hasLocalName(HTMLNames::base())) {
     333            if (!head)
    380334                createHead();
    381             if( head ) {
    382                 if ( head->addChild(n) ) {
    383 #if SPEED_DEBUG < 2
    384                     if(!n->attached() && HTMLWidget)
     335            if (head) {
     336                if (head->addChild(n)) {
     337                    if (!n->attached() && HTMLWidget)
    385338                        n->attach();
    386 #endif
    387339                    return true;
    388                 } else {
    389                     return false;
    390                 }
    391             }
    392             break;
    393         case ID_HTML:
     340                } else
     341                    return false;
     342            }
     343        } else if (h->hasLocalName(HTMLNames::html())) {
    394344            if (!current->isDocumentNode() ) {
    395                 if ( doc()->firstChild()->id() == ID_HTML) {
    396                     // we have another <HTML> element.... apply attributes to existing one
    397                     // make sure we don't overwrite already existing attributes
    398                     NamedAttrMapImpl *map = static_cast<ElementImpl*>(n)->attributes(true);
    399                     NamedAttrMapImpl *bmap = static_cast<ElementImpl*>(doc()->firstChild())->attributes(false);
    400                     bool changed = false;
    401                     for (unsigned long l = 0; map && l < map->length(); ++l) {
    402                         AttributeImpl* it = map->attributeItem(l);
    403                         changed = !bmap->getAttributeItem(it->id());
    404                         bmap->insertAttribute(it->clone(false));
    405                     }
    406                     if ( changed )
    407                         doc()->recalcStyle( NodeImpl::Inherit );
    408                 }
     345                if (doc()->firstChild()->hasTagName(HTMLNames::html())) {
     346                    // we have another <HTML> element.... apply attributes to existing one
     347                    // make sure we don't overwrite already existing attributes
     348                    NamedAttrMapImpl *map = static_cast<ElementImpl*>(n)->attributes(true);
     349                    NamedAttrMapImpl *bmap = static_cast<ElementImpl*>(doc()->firstChild())->attributes(false);
     350                    bool changed = false;
     351                    for (unsigned long l = 0; map && l < map->length(); ++l) {
     352                        AttributeImpl* it = map->attributeItem(l);
     353                        changed = !bmap->getAttributeItem(it->id());
     354                        bmap->insertAttribute(it->clone(false));
     355                    }
     356                    if (changed)
     357                        doc()->recalcStyle(NodeImpl::Inherit);
     358                }
    409359                return false;
    410             }
    411             break;
    412         case ID_TITLE:
    413         case ID_STYLE:
    414             if ( !head )
     360            }
     361        } else if (h->hasLocalName(HTMLNames::title()) || h->hasLocalName(HTMLNames::style())) {
     362            if (!head)
    415363                createHead();
    416             if ( head ) {
     364            if (head) {
    417365                DOM::NodeImpl *newNode = head->addChild(n);
    418                 if ( newNode ) {
    419                     pushBlock(id, tagPriority(id));
     366                if (newNode) {
     367                    pushBlock(localName, tagPriority);
    420368                    setCurrent(newNode);
    421 #if SPEED_DEBUG < 2
    422                     if(!n->attached() && HTMLWidget)
     369                    if (!n->attached() && HTMLWidget)
    423370                        n->attach();
    424 #endif
    425371                } else {
    426 #ifdef PARSER_DEBUG
    427                     kdDebug( 6035 ) << "adding style before to body failed!!!!" << endl;
    428 #endif
    429                     discard_until = ID_STYLE + ID_CLOSE_TAG;
     372                    setSkipMode(HTMLNames::style());
    430373                    return false;
    431374                }
    432375                return true;
    433376            } else if(inBody) {
    434                 discard_until = ID_STYLE + ID_CLOSE_TAG;
     377                setSkipMode(HTMLNames::style());
    435378                return false;
    436379            }
    437             break;
    438             // SCRIPT and OBJECT are allowed in the body.
    439         case ID_BODY:
    440             if(inBody && doc()->body()) {
     380        } else if (h->hasLocalName(HTMLNames::body())) {
     381            if (inBody && doc()->body()) {
    441382                // we have another <BODY> element.... apply attributes to existing one
    442383                // make sure we don't overwrite already existing attributes
     
    450391                    bmap->insertAttribute(it->clone(false));
    451392                }
    452                 if ( changed )
    453                     doc()->recalcStyle( NodeImpl::Inherit );
    454             } else if ( current->isDocumentNode() )
    455                 break;
    456             return false;
    457             break;
    458 
    459             // the following is a hack to move non rendered elements
    460             // outside of tables.
    461             // needed for broken constructs like <table><form ...><tr>....
    462         case ID_INPUT:
    463         {
    464             ElementImpl *e = static_cast<ElementImpl *>(n);
    465             DOMString type = e->getAttribute(ATTR_TYPE);
    466 
    467             if ( strcasecmp( type, "hidden" ) == 0 && form) {
     393                if (changed)
     394                    doc()->recalcStyle(NodeImpl::Inherit);
     395                return false;
     396            }
     397            else if (!current->isDocumentNode())
     398                return false;
     399        } else if (h->hasLocalName(HTMLNames::input())) {
     400            DOMString type = h->getAttribute(ATTR_TYPE);
     401            if (strcasecmp(type, "hidden") == 0 && form) {
    468402                form->addChild(n);
    469 #if SPEED_DEBUG < 2
    470                 if(!n->attached() && HTMLWidget)
     403                if (!n->attached() && HTMLWidget)
    471404                    n->attach();
    472 #endif
    473405                return true;
    474406            }
    475             break;
    476         }
    477         case ID_TEXT:
    478             // ignore text inside the following elements.
    479             switch(current->id())
    480             {
    481             case ID_SELECT:
    482                 return false;
    483             default:
    484                 ;
    485                 // fall through!!
    486             };
    487             break;
    488         case ID_DD:
    489         case ID_DT:
     407        } else if (h->hasLocalName(HTMLNames::dd()) || h->hasLocalName(HTMLNames::dt())) {
    490408            e = new HTMLDListElementImpl(document);
    491             if ( insertNode(e) ) {
     409            if (insertNode(e)) {
    492410                insertNode(n);
    493411                return true;
    494412            }
    495             break;
    496         case ID_AREA:
    497         {
    498             if(map)
    499             {
     413        } else if (h->hasLocalName(HTMLNames::area())) {
     414            if (map) {
    500415                map->addChild(n);
    501 #if SPEED_DEBUG < 2
    502                 if(!n->attached() && HTMLWidget)
     416                if (!n->attached() && HTMLWidget)
    503417                    n->attach();
    504 #endif
    505418                handled = true;
    506419            }
     
    508421                return false;
    509422            return true;
    510         }
    511         case ID_CAPTION: {
    512             switch (current->id()) {
    513                 case ID_THEAD:
    514                 case ID_TBODY:
    515                 case ID_TFOOT:
    516                 case ID_TR:
    517                 case ID_TH:
    518                 case ID_TD: {
    519                     NodeImpl* tsection = current;
    520                     if (current->id() == ID_TR)
    521                         tsection = current->parent();
    522                     else if (current->id() == ID_TD || current->id() == ID_TH)
    523                         tsection = current->parent()->parent();
    524                     NodeImpl* table = tsection->parent();
    525                     int exceptioncode = 0;
    526                     table->insertBefore(n, tsection, exceptioncode);
    527                     pushBlock(id, tagPriority(id));
    528                     setCurrent(n);
    529                     inStrayTableContent++;
    530                     blockStack->strayTableContent = true;
    531                     return true;
    532                 }
    533                 default:
    534                     break;
    535             }
    536             break;
    537         }
    538         case ID_THEAD:
    539         case ID_TBODY:
    540         case ID_TFOOT:
    541         case ID_COLGROUP: {
    542             if (isTableRelatedTag(current->id())) {
    543                 while (blockStack && current->id() != ID_TABLE && isTableRelatedTag(current->id()))
     423        } else if (h->hasLocalName(HTMLNames::caption())) {
     424            if (isTablePart(current)) {
     425                NodeImpl* tsection = current;
     426                if (current->hasTagName(HTMLNames::tr()))
     427                    tsection = current->parent();
     428                else if (current->hasTagName(HTMLNames::td()) || current->hasTagName(HTMLNames::th()))
     429                    tsection = current->parent()->parent();
     430                NodeImpl* table = tsection->parent();
     431                int exceptioncode = 0;
     432                table->insertBefore(n, tsection, exceptioncode);
     433                pushBlock(localName, tagPriority);
     434                setCurrent(n);
     435                inStrayTableContent++;
     436                blockStack->strayTableContent = true;
     437                return true;
     438            }
     439        } else if (h->hasLocalName(HTMLNames::thead()) || h->hasLocalName(HTMLNames::tbody()) ||
     440                   h->hasLocalName(HTMLNames::tfoot()) || h->hasLocalName(HTMLNames::colgroup())) {
     441            if (isTableRelated(current)) {
     442                while (blockStack && isTablePart(current))
    544443                    popOneBlock();
    545444                return insertNode(n);
    546445            }
    547446        }
    548         default:
    549             break;
    550         }
    551 
    552         // switch on the currently active element
    553         switch(current->id())
    554         {
    555         case ID_HTML:
    556             switch(id)
    557             {
    558             case ID_SCRIPT:
    559             case ID_STYLE:
    560             case ID_META:
    561             case ID_LINK:
    562             case ID_OBJECT:
    563             case ID_EMBED:
    564             case ID_TITLE:
    565             case ID_ISINDEX:
    566             case ID_BASE:
    567                 if(!head) {
     447    }
     448   
     449    // 2. Next we examine our currently active element to do some further error handling.
     450    if (current->isHTMLElement()) {
     451        HTMLElementImpl* h = static_cast<HTMLElementImpl*>(current);
     452        const AtomicString& currentTagName = current->localName();
     453        if (h->hasLocalName(HTMLNames::html())) {
     454            HTMLElementImpl* elt = n->isHTMLElement() ? static_cast<HTMLElementImpl*>(n) : 0;
     455            if (elt && (elt->hasLocalName(HTMLNames::script()) || elt->hasLocalName(HTMLNames::style()) ||
     456                elt->hasLocalName(HTMLNames::meta()) || elt->hasLocalName(HTMLNames::link()) ||
     457                elt->hasLocalName(HTMLNames::object()) || elt->hasLocalName(HTMLNames::embed()) ||
     458                elt->hasLocalName(HTMLNames::title()) || elt->hasLocalName(HTMLNames::isindex()) ||
     459                elt->hasLocalName(HTMLNames::base()))) {
     460                if (!head) {
    568461                    head = new HTMLHeadElementImpl(document);
    569462                    e = head;
     
    571464                    handled = true;
    572465                }
    573                 break;
    574             case ID_TEXT: {
    575                 TextImpl *t = static_cast<TextImpl *>(n);
    576                 if (t->containsOnlyWhitespace())
    577                     return false;
    578                 /* Fall through to default */
    579             }
    580             default:
    581                 if ( haveFrameSet ) break;
    582                 e = new HTMLBodyElementImpl(document);
    583                 startBody();
    584                 insertNode(e);
    585                 handled = true;
    586                 break;
    587             }
    588             break;
    589         case ID_HEAD:
    590             // we can get here only if the element is not allowed in head.
    591             if (id == ID_HTML)
     466            } else {
     467                if (n->isTextNode()) {
     468                    TextImpl *t = static_cast<TextImpl *>(n);
     469                    if (t->containsOnlyWhitespace())
     470                        return false;
     471                                }
     472                                if (!haveFrameSet) {
     473                                        e = new HTMLBodyElementImpl(document);
     474                                        startBody();
     475                                        insertNode(e);
     476                                        handled = true;
     477                                }
     478            }
     479        } else if (h->hasLocalName(HTMLNames::head())) {
     480            if (n->hasTagName(HTMLNames::html()))
    592481                return false;
    593482            else {
    594483                // This means the body starts here...
    595                 if ( haveFrameSet ) break;
    596                 popBlock(ID_HEAD);
    597                 e = new HTMLBodyElementImpl(document);
    598                 startBody();
    599                 insertNode(e);
    600                 handled = true;
    601             }
    602             break;
    603         case ID_BODY:
    604             break;
    605         case ID_CAPTION:
     484                if (!haveFrameSet) {
     485                    popBlock(currentTagName);
     486                    e = new HTMLBodyElementImpl(document);
     487                    startBody();
     488                    insertNode(e);
     489                    handled = true;
     490                }
     491            }
     492        } else if (h->hasLocalName(HTMLNames::caption())) {
    606493            // Illegal content in a caption. Close the caption and try again.
    607             popBlock(ID_CAPTION);
    608             switch( id ) {
    609             case ID_THEAD:
    610             case ID_TFOOT:
    611             case ID_TBODY:
    612             case ID_TR:
    613             case ID_TD:
    614             case ID_TH:
     494            popBlock(currentTagName);
     495            if (isTablePart(n))
    615496                return insertNode(n, flat);
    616             }
    617             break;
    618         case ID_TABLE:
    619         case ID_THEAD:
    620         case ID_TFOOT:
    621         case ID_TBODY:
    622         case ID_TR:
    623             switch(id)
    624             {
    625             case ID_TABLE:
    626                 popBlock(ID_TABLE); // end the table
     497        } else if (h->hasLocalName(HTMLNames::table()) || h->hasLocalName(HTMLNames::tr()) || isTableSection(h)) {
     498            if (n->hasTagName(HTMLNames::table())) {
     499                popBlock(localName); // end the table
    627500                handled = true;      // ...and start a new one
    628                 break;
    629             case ID_TEXT:
    630             {
    631                 TextImpl *t = static_cast<TextImpl *>(n);
    632                 if (t->containsOnlyWhitespace())
    633                     return false;
    634                 DOMStringImpl *i = t->string();
    635                 unsigned int pos = 0;
    636                 while(pos < i->l && ( *(i->s+pos) == QChar(' ') ||
    637                                       *(i->s+pos) == QChar(0xa0))) pos++;
    638                 if(pos == i->l)
    639                     break;
    640             }
    641             default:
    642             {
    643                 NodeImpl *node = current;
    644                 NodeImpl *parent = node->parentNode();
    645 
    646                 NodeImpl *parentparent = parent->parentNode();
    647 
    648                 if (n->isTextNode() ||
    649                     ( node->id() == ID_TR &&
    650                      ( parent->id() == ID_THEAD ||
    651                       parent->id() == ID_TBODY ||
    652                       parent->id() == ID_TFOOT ) && parentparent->id() == ID_TABLE ) ||
    653                     ( !checkChild(ID_TR, id, !doc()->inCompatMode()) && ( node->id() == ID_THEAD || node->id() == ID_TBODY || node->id() == ID_TFOOT ) &&
    654                      parent->id() == ID_TABLE ))
    655                 {
    656                     node = (node->id() == ID_TABLE) ? node :
    657                             ((node->id() == ID_TR) ? parentparent : parent);
     501            } else {
     502                bool possiblyMoveStrayContent = true;
     503                int exceptionCode = 0;
     504                if (n->isTextNode()) {
     505                    TextImpl *t = static_cast<TextImpl *>(n);
     506                    if (t->containsOnlyWhitespace())
     507                        return false;
     508                    DOMStringImpl *i = t->string();
     509                    unsigned int pos = 0;
     510                    while (pos < i->l && (*(i->s+pos) == QChar(' ') ||
     511                                          *(i->s+pos) == QChar(0xa0))) pos++;
     512                    if (pos == i->l)
     513                        possiblyMoveStrayContent = false;
     514                }
     515                if (possiblyMoveStrayContent) {
     516                    NodeImpl *node = current;
    658517                    NodeImpl *parent = node->parentNode();
    659                     int exceptioncode = 0;
    660                     parent->insertBefore( n, node, exceptioncode );
    661                     if ( exceptioncode ) {
    662 #ifdef PARSER_DEBUG
    663                         kdDebug( 6035 ) << "adding content before table failed!" << endl;
    664 #endif
    665                         break;
     518                    NodeImpl *grandparent = parent->parentNode();
     519
     520                    if (n->isTextNode() ||
     521                        (h->hasLocalName(HTMLNames::tr()) &&
     522                         isTableSection(parent) && grandparent->hasTagName(HTMLNames::table())) ||
     523                         ((!n->hasTagName(HTMLNames::td()) && !n->hasTagName(HTMLNames::th()) &&
     524                           !n->hasTagName(HTMLNames::form()) && !n->hasTagName(HTMLNames::script())) && isTableSection(node) &&
     525                         parent->hasTagName(HTMLNames::table()))) {
     526                        node = (node->hasTagName(HTMLNames::table())) ? node :
     527                                ((node->hasTagName(HTMLNames::tr())) ? grandparent : parent);
     528                        NodeImpl *parent = node->parentNode();
     529                        parent->insertBefore(n, node, exceptionCode);
     530                        if (!exceptionCode) {
     531                            if (n->isHTMLElement() && tagPriority > 0 &&
     532                                !flat && static_cast<HTMLElementImpl*>(n)->endTagRequirement() != TagStatusForbidden)
     533                            {
     534                                pushBlock(localName, tagPriority);
     535                                setCurrent(n);
     536                                inStrayTableContent++;
     537                                blockStack->strayTableContent = true;
     538                            }
     539                            return true;
     540                        }
    666541                    }
    667                     if (n->isElementNode() && tagPriority(id) != 0 &&
    668                         !flat && endTagRequirement(id) != DOM::FORBIDDEN)
    669                     {
    670                         pushBlock(id, tagPriority(id));
    671                         setCurrent(n);
    672                         inStrayTableContent++;
    673                         blockStack->strayTableContent = true;
     542
     543                    if (!exceptionCode) {
     544                        if (current->hasTagName(HTMLNames::tr()))
     545                            e = new HTMLTableCellElementImpl(HTMLNames::td(), document);
     546                        else if (current->hasTagName(HTMLNames::table()))
     547                            e = new HTMLTableSectionElementImpl(HTMLNames::tbody(), document, true); // implicit
     548                        else
     549                            e = new HTMLTableRowElementImpl(document);
     550                       
     551                        insertNode(e);
     552                        handled = true;
    674553                    }
    675                     return true;
    676554                }
    677 
    678                 if ( current->id() == ID_TR )
    679                     e = new HTMLTableCellElementImpl(document, ID_TD);
    680                 else if ( current->id() == ID_TABLE )
    681                     e = new HTMLTableSectionElementImpl( document, ID_TBODY, true /* implicit */ );
    682                 else
    683                     e = new HTMLTableRowElementImpl( document );
    684                
    685                 insertNode(e);
    686                 handled = true;
    687                 break;
    688             } // end default
    689             } // end switch
    690             break;
    691         case ID_OBJECT:
    692             discard_until = ID_OBJECT + ID_CLOSE_TAG;
     555            }
     556        }
     557        else if (h->hasLocalName(HTMLNames::object())) {
     558            setSkipMode(HTMLNames::object());
    693559            return false;
    694         case ID_UL:
    695         case ID_OL:
    696         case ID_DIR:
    697         case ID_MENU:
     560        } else if (h->hasLocalName(HTMLNames::ul()) || h->hasLocalName(HTMLNames::ol()) ||
     561                 h->hasLocalName(HTMLNames::dir()) || h->hasLocalName(HTMLNames::menu())) {
    698562            e = new HTMLDivElementImpl(document);
    699563            insertNode(e);
    700564            handled = true;
    701             break;
    702             case ID_DL:
    703                 popBlock(ID_DL);
     565        } else if (h->hasLocalName(HTMLNames::dl()) || h->hasLocalName(HTMLNames::dt())) {
     566            popBlock(currentTagName);
     567            handled = true;
     568        } else if (h->hasLocalName(HTMLNames::select())) {
     569            if (isInline(n))
     570                return false;
     571        } else if (h->hasLocalName(HTMLNames::p()) || isHeaderTag(currentTagName)) {
     572            if (!isInline(n)) {
     573                popBlock(currentTagName);
    704574                handled = true;
    705                 break;
    706             case ID_DT:
    707                 popBlock(ID_DT);
     575            }
     576        } else if (h->hasLocalName(HTMLNames::option()) || h->hasLocalName(HTMLNames::optgroup())) {
     577            if (localName == HTMLNames::optgroup()) {
     578                popBlock(currentTagName);
    708579                handled = true;
    709                 break;
    710         case ID_SELECT:
    711             if( n->isInline() )
    712                 return false;
    713             break;
    714         case ID_P:
    715         case ID_H1:
    716         case ID_H2:
    717         case ID_H3:
    718         case ID_H4:
    719         case ID_H5:
    720         case ID_H6:
    721             if(!n->isInline())
    722             {
    723                 popBlock(current->id());
     580            }
     581            else if (localName == HTMLNames::select()) {
     582                // IE treats a nested select as </select>. Let's do the same
     583                popBlock(localName);
     584            }
     585        } else if (h->hasLocalName(HTMLNames::address())) {
     586            popBlock(currentTagName);
     587            handled = true;
     588        } else if (h->hasLocalName(HTMLNames::colgroup())) {
     589            if (!n->isTextNode()) {
     590                popBlock(currentTagName);
    724591                handled = true;
    725592            }
    726             break;
    727         case ID_OPTION:
    728         case ID_OPTGROUP:
    729             if (id == ID_OPTGROUP)
    730             {
    731                 popBlock(current->id());
    732                 handled = true;
    733             }
    734             else if(id == ID_SELECT)
    735             {
    736                 // IE treats a nested select as </select>. Let's do the same
    737                 popBlock( ID_SELECT );
    738                 break;
    739             }
    740             break;
    741             // head elements in the body should be ignored.
    742         case ID_ADDRESS:
    743             popBlock(ID_ADDRESS);
     593        } else if (h->hasLocalName(HTMLNames::font())) {
     594            popBlock(currentTagName);
    744595            handled = true;
    745             break;
    746         case ID_COLGROUP:
    747             if (id != ID_TEXT) {
    748                 popBlock(ID_COLGROUP);
    749                 handled = true;
    750             }
    751             break;
    752         case ID_FONT:
    753             popBlock(ID_FONT);
    754             handled = true;
    755             break;
    756         default:
    757             if(current->isDocumentNode())
    758             {
    759                 if(current->firstChild() == 0) {
    760                     e = new HTMLHtmlElementImpl(document);
    761                     insertNode(e);
    762                     handled = true;
    763                 }
    764             }
    765             else if(current->isInline())
    766             {
     596        } else if (!h->hasLocalName(HTMLNames::body())) {
     597            if (isInline(current)) {
    767598                popInlineBlocks();
    768599                handled = true;
    769600            }
    770601        }
    771 
    772         // if we couldn't handle the error, just rethrow the exception...
    773         if(!handled)
    774         {
    775             //kdDebug( 6035 ) << "Exception handler failed in HTMLPArser::insertNode()" << endl;
    776             return false;
    777         }
    778 
    779         return insertNode(n);
    780     }
    781 }
    782 
    783 NodeImpl *KHTMLParser::getElement(Token* t)
    784 {
    785     switch (t->id)
    786     {
    787     case ID_HEAD:
    788         if (!head && current->id() == ID_HTML) {
    789             head = new HTMLHeadElementImpl(document);
    790             return head;
    791         }
    792         return 0;
    793     case ID_BODY:
    794         // body no longer allowed if we have a frameset
    795         if (haveFrameSet)
    796             return 0;
    797         popBlock(ID_HEAD);
    798         startBody();
    799         return new HTMLBodyElementImpl(document);
    800 
    801 // frames
    802     case ID_FRAMESET:
    803         popBlock(ID_HEAD);
    804         if (inBody && !haveFrameSet && !haveContent) {
    805             popBlock(ID_BODY);
    806             // ### actually for IE document.body returns the now hidden "body" element
    807             // we can't implement that behaviour now because it could cause too many
    808             // regressions and the headaches are not worth the work as long as there is
    809             // no site actually relying on that detail (Dirk)
    810             if (doc()->body())
    811                 doc()->body()->setAttribute(ATTR_STYLE, "display:none");
    812             inBody = false;
    813         }
    814         if ((haveContent || haveFrameSet) && current->id() == ID_HTML)
    815             return 0;
    816         haveFrameSet = true;
    817         startBody();
    818         return new HTMLFrameSetElementImpl(document);
    819 
     602    }
     603    else if (current->isDocumentNode()) {
     604        if (current->firstChild() == 0) {
     605            e = new HTMLHtmlElementImpl(document);
     606            insertNode(e);
     607            handled = true;
     608        }
     609    }
     610
     611    // 3. If we couldn't handle the error, just return false and attempt to error-correct again.
     612    if (!handled)
     613        return false;
     614    return insertNode(n);
     615}
     616
     617typedef bool (HTMLParser::*CreateErrorCheckFunc)(Token* t, NodeImpl*&);
     618typedef HashMap<DOMStringImpl *, CreateErrorCheckFunc, PointerHash<DOMStringImpl *> > FunctionMap;
     619
     620bool HTMLParser::textCreateErrorCheck(Token* t, NodeImpl*& result)
     621{
     622    result = new TextImpl(document, t->text);
     623    return false;
     624}
     625
     626bool HTMLParser::commentCreateErrorCheck(Token* t, NodeImpl*& result)
     627{
     628    if (includesCommentsInDOM)
     629        result = new CommentImpl(document, t->text);
     630    return false;
     631}
     632
     633bool HTMLParser::headCreateErrorCheck(Token* t, NodeImpl*& result)
     634{
     635    return (!head || current->localName() == HTMLNames::html());
     636}
     637
     638bool HTMLParser::bodyCreateErrorCheck(Token* t, NodeImpl*& result)
     639{
     640    // body no longer allowed if we have a frameset
     641    if (haveFrameSet)
     642        return false;
     643    popBlock(HTMLNames::head());
     644    startBody();
     645    return true;
     646}
     647
     648bool HTMLParser::framesetCreateErrorCheck(Token* t, NodeImpl*& result)
     649{
     650    popBlock(HTMLNames::head());
     651    if (inBody && !haveFrameSet && !haveContent) {
     652        popBlock(HTMLNames::body());
     653        // ### actually for IE document.body returns the now hidden "body" element
     654        // we can't implement that behaviour now because it could cause too many
     655        // regressions and the headaches are not worth the work as long as there is
     656        // no site actually relying on that detail (Dirk)
     657        if (doc()->body())
     658            doc()->body()->setAttribute(ATTR_STYLE, "display:none");
     659        inBody = false;
     660    }
     661    if ((haveContent || haveFrameSet) && current->localName() == HTMLNames::html())
     662        return false;
     663    haveFrameSet = true;
     664    startBody();
     665    return true;
     666}
     667
     668bool HTMLParser::iframeCreateErrorCheck(Token* t, NodeImpl*& result)
     669{
    820670    // a bit of a special case, since the frame is inlined
    821     case ID_IFRAME:
    822         discard_until = ID_IFRAME + ID_CLOSE_TAG;
    823         break;
    824 
    825 // form elements
    826     case ID_FORM:
    827         // Only create a new form if we're not already inside one.
    828         // This is consistent with other browsers' behavior.
    829         if (form)
    830             return 0;
    831         form = new HTMLFormElementImpl(document);
    832         return form;
    833     case ID_BUTTON:
    834         return new HTMLButtonElementImpl(document, form);
    835     case ID_FIELDSET:
    836         return new HTMLFieldSetElementImpl(document, form);
    837     case ID_INPUT:
    838         return new HTMLInputElementImpl(document, form);
    839     case ID_ISINDEX: {
    840         NodeImpl *n = handleIsindex(t);
    841         if (!inBody) {
    842             if (isindex)
    843                 isindex->deref();
    844             isindex = n;
    845             isindex->ref();
    846             return 0;
    847         }
     671    setSkipMode(HTMLNames::iframe());
     672    return true;
     673}
     674
     675bool HTMLParser::formCreateErrorCheck(Token* t, NodeImpl*& result)
     676{
     677    // Only create a new form if we're not already inside one.
     678    // This is consistent with other browsers' behavior.
     679    return !form;
     680}
     681
     682bool HTMLParser::isindexCreateErrorCheck(Token* t, NodeImpl*& result)
     683{
     684    NodeImpl *n = handleIsindex(t);
     685    if (!inBody) {
     686        if (isindex)
     687            isindex->deref();
     688        isindex = n;
     689        isindex->ref();
     690    } else {
    848691        t->flat = true;
    849         return n;
    850     }
    851     case ID_KEYGEN:
    852         return new HTMLKeygenElementImpl(document, form);
    853     case ID_LEGEND:
    854         return new HTMLLegendElementImpl(document, form);
    855     case ID_OPTGROUP:
    856         return new HTMLOptGroupElementImpl(document, form);
    857     case ID_OPTION:
    858         return new HTMLOptionElementImpl(document, form);
    859     case ID_SELECT:
    860         inSelect = true;
    861         return new HTMLSelectElementImpl(document, form);
    862     case ID_TEXTAREA:
    863         return new HTMLTextAreaElementImpl(document, form);
    864 
    865 // lists
    866     case ID_DD:
    867         popBlock(ID_DT);
    868         popBlock(ID_DD);
    869         break;
    870     case ID_DT:
    871         popBlock(ID_DD);
    872         popBlock(ID_DT);
    873         break;
    874     case ID_LI:
    875         popBlock(ID_LI);
    876         break;
    877 
    878 // anchor
    879     case ID_A:
    880         // Never allow nested <a>s.
    881         popBlock(ID_A);
    882         break;
    883 
    884 // images
    885     case ID_IMG:
    886         return new HTMLImageElementImpl(document, form);
    887     case ID_MAP:
    888         map = new HTMLMapElementImpl(document);
    889         return map;
    890 
    891 // tables
    892     case ID_TR:
    893         popBlock(ID_TR);
    894         break;
    895     case ID_TD:
    896     case ID_TH:
    897         popBlock(ID_TH);
    898         popBlock(ID_TD);
    899         break;
    900     case ID_TBODY:
    901     case ID_THEAD:
    902     case ID_TFOOT:
    903         popBlock(ID_THEAD);
    904         popBlock(ID_TBODY);
    905         popBlock(ID_TFOOT);
    906         break;
    907 
    908 // elements with no special representation in the DOM
    909     case ID_TT:
    910     case ID_U:
    911     case ID_B:
    912     case ID_I:
    913     case ID_S:
    914     case ID_STRIKE:
    915     case ID_BIG:
    916     case ID_SMALL:
    917         if (!allowNestedRedundantTag(t->id))
    918             return 0;
    919         break;
    920 
    921     case ID_NOBR:
    922     case ID_WBR:
    923         popBlock(t->id); // Don't allow nested <nobr> or <wbr>
    924         break;
    925 
    926 // these are special, and normally not rendered
    927     case ID_NOEMBED:
    928         discard_until = ID_NOEMBED + ID_CLOSE_TAG;
    929         return 0;
    930     case ID_NOFRAMES:
    931         discard_until = ID_NOFRAMES + ID_CLOSE_TAG;
    932         return 0;
    933     case ID_NOSCRIPT:
    934         if (HTMLWidget && HTMLWidget->part()->jScriptEnabled())
    935             discard_until = ID_NOSCRIPT + ID_CLOSE_TAG;
    936         return 0;
    937     case ID_NOLAYER:
    938         //discard_until = ID_NOLAYER + ID_CLOSE_TAG;
    939         return 0;
    940     case ID_TEXT:
    941         return new TextImpl(document, t->text);
    942     case ID_COMMENT:
    943         if (!includesCommentsInDOM)
    944             return 0;
    945         break;
    946 
    947     case ID_SCRIPT:
    948         {
    949             HTMLScriptElementImpl *scriptElement = new HTMLScriptElementImpl(document);
    950             scriptElement->setCreatedByParser(true);
    951             return scriptElement;
    952         }
    953     }
    954 
    955     return document->document()->createHTMLElement(t->id);
     692        result = n;
     693    }
     694    return false;
     695}
     696
     697bool HTMLParser::selectCreateErrorCheck(Token* t, NodeImpl*& result)
     698{
     699    inSelect = true;
     700    return true;
     701}
     702
     703bool HTMLParser::ddCreateErrorCheck(Token* t, NodeImpl*& result)
     704{
     705    popBlock(HTMLNames::dt());
     706    popBlock(HTMLNames::dd());
     707    return true;
     708}
     709
     710bool HTMLParser::dtCreateErrorCheck(Token* t, NodeImpl*& result)
     711{
     712    popBlock(HTMLNames::dd());
     713    popBlock(HTMLNames::dt());
     714    return true;
     715}
     716
     717bool HTMLParser::nestedCreateErrorCheck(Token* t, NodeImpl*& result)
     718{
     719    popBlock(t->tagName);
     720    return true;
     721}
     722
     723bool HTMLParser::nestedStyleCreateErrorCheck(Token* t, NodeImpl*& result)
     724{
     725    return allowNestedRedundantTag(t->tagName);
     726}
     727
     728bool HTMLParser::tableCellCreateErrorCheck(Token* t, NodeImpl*& result)
     729{
     730    popBlock(HTMLNames::td());
     731    popBlock(HTMLNames::th());
     732    return true;
     733}
     734
     735bool HTMLParser::tableSectionCreateErrorCheck(Token* t, NodeImpl*& result)
     736{
     737    popBlock(HTMLNames::thead());
     738    popBlock(HTMLNames::tbody());
     739    popBlock(HTMLNames::tfoot());
     740    return true;
     741}
     742
     743bool HTMLParser::noembedCreateErrorCheck(Token* t, NodeImpl*& result)
     744{
     745    setSkipMode(HTMLNames::noembed());
     746    return false;
     747}
     748
     749bool HTMLParser::noframesCreateErrorCheck(Token* t, NodeImpl*& result)
     750{
     751    setSkipMode(HTMLNames::noframes());
     752    return false;
     753}
     754
     755bool HTMLParser::noscriptCreateErrorCheck(Token* t, NodeImpl*& result)
     756{
     757    if (HTMLWidget && HTMLWidget->part()->jScriptEnabled())
     758        setSkipMode(HTMLNames::noscript());
     759    return false;
     760}
     761
     762bool HTMLParser::nolayerCreateErrorCheck(Token* t, NodeImpl*& result)
     763{
     764    return false;
     765}
     766
     767NodeImpl *HTMLParser::getNode(Token* t)
     768{
     769    // Init our error handling table.
     770    static FunctionMap gFunctionMap;
     771    if (gFunctionMap.isEmpty()) {
     772        gFunctionMap.insert(textAtom.implementation(), &HTMLParser::textCreateErrorCheck);
     773        gFunctionMap.insert(commentAtom.implementation(), &HTMLParser::commentCreateErrorCheck);
     774        gFunctionMap.insert(HTMLNames::head().localName().implementation(), &HTMLParser::headCreateErrorCheck);
     775        gFunctionMap.insert(HTMLNames::body().localName().implementation(), &HTMLParser::bodyCreateErrorCheck);
     776        gFunctionMap.insert(HTMLNames::frameset().localName().implementation(), &HTMLParser::framesetCreateErrorCheck);
     777        gFunctionMap.insert(HTMLNames::iframe().localName().implementation(), &HTMLParser::iframeCreateErrorCheck);
     778        gFunctionMap.insert(HTMLNames::form().localName().implementation(), &HTMLParser::formCreateErrorCheck);
     779        gFunctionMap.insert(HTMLNames::isindex().localName().implementation(), &HTMLParser::isindexCreateErrorCheck);
     780        gFunctionMap.insert(HTMLNames::select().localName().implementation(), &HTMLParser::selectCreateErrorCheck);
     781        gFunctionMap.insert(HTMLNames::dd().localName().implementation(), &HTMLParser::ddCreateErrorCheck);
     782        gFunctionMap.insert(HTMLNames::dt().localName().implementation(), &HTMLParser::dtCreateErrorCheck);
     783        gFunctionMap.insert(HTMLNames::li().localName().implementation(), &HTMLParser::nestedCreateErrorCheck);
     784        gFunctionMap.insert(HTMLNames::a().localName().implementation(), &HTMLParser::nestedCreateErrorCheck);
     785        gFunctionMap.insert(HTMLNames::nobr().localName().implementation(), &HTMLParser::nestedCreateErrorCheck);
     786        gFunctionMap.insert(HTMLNames::wbr().localName().implementation(), &HTMLParser::nestedCreateErrorCheck);
     787        gFunctionMap.insert(HTMLNames::tr().localName().implementation(), &HTMLParser::nestedCreateErrorCheck);
     788        gFunctionMap.insert(HTMLNames::td().localName().implementation(), &HTMLParser::tableCellCreateErrorCheck);
     789        gFunctionMap.insert(HTMLNames::th().localName().implementation(), &HTMLParser::tableCellCreateErrorCheck);
     790        gFunctionMap.insert(HTMLNames::tbody().localName().implementation(), &HTMLParser::tableSectionCreateErrorCheck);
     791        gFunctionMap.insert(HTMLNames::thead().localName().implementation(), &HTMLParser::tableSectionCreateErrorCheck);
     792        gFunctionMap.insert(HTMLNames::tfoot().localName().implementation(), &HTMLParser::tableSectionCreateErrorCheck);
     793        gFunctionMap.insert(HTMLNames::tt().localName().implementation(), &HTMLParser::nestedStyleCreateErrorCheck);
     794        gFunctionMap.insert(HTMLNames::u().localName().implementation(), &HTMLParser::nestedStyleCreateErrorCheck);
     795        gFunctionMap.insert(HTMLNames::b().localName().implementation(), &HTMLParser::nestedStyleCreateErrorCheck);
     796        gFunctionMap.insert(HTMLNames::i().localName().implementation(), &HTMLParser::nestedStyleCreateErrorCheck);
     797        gFunctionMap.insert(HTMLNames::s().localName().implementation(), &HTMLParser::nestedStyleCreateErrorCheck);
     798        gFunctionMap.insert(HTMLNames::strike().localName().implementation(), &HTMLParser::nestedStyleCreateErrorCheck);
     799        gFunctionMap.insert(HTMLNames::big().localName().implementation(), &HTMLParser::nestedStyleCreateErrorCheck);
     800        gFunctionMap.insert(HTMLNames::small().localName().implementation(), &HTMLParser::nestedStyleCreateErrorCheck);
     801        gFunctionMap.insert(HTMLNames::noembed().localName().implementation(), &HTMLParser::noembedCreateErrorCheck);
     802        gFunctionMap.insert(HTMLNames::noframes().localName().implementation(), &HTMLParser::noframesCreateErrorCheck);
     803        gFunctionMap.insert(HTMLNames::noscript().localName().implementation(), &HTMLParser::noscriptCreateErrorCheck);
     804        gFunctionMap.insert(HTMLNames::nolayer().localName().implementation(), &HTMLParser::nolayerCreateErrorCheck);
     805    }
     806
     807    bool proceed = true;
     808    NodeImpl* result = 0;
     809    CreateErrorCheckFunc errorCheckFunc = gFunctionMap.get(t->tagName.implementation());
     810    if (errorCheckFunc)
     811        proceed = (this->*(errorCheckFunc))(t, result);
     812
     813    if (proceed) {
     814        result = HTMLElementFactory::createHTMLElement(t->tagName, doc(), form);
     815        if (t->tagName == HTMLNames::form())
     816            form = static_cast<HTMLFormElementImpl*>(result);
     817    }
     818    return result;
    956819}
    957820
    958821#define MAX_REDUNDANT 20
    959822
    960 bool KHTMLParser::allowNestedRedundantTag(int _id)
     823bool HTMLParser::allowNestedRedundantTag(const AtomicString& _tagName)
    961824{
    962825    // www.liceo.edu.mx is an example of a site that achieves a level of nesting of
     
    965828    int i = 0;
    966829    for (HTMLStackElem* curr = blockStack;
    967          i < MAX_REDUNDANT && curr && curr->id == _id;
     830         i < MAX_REDUNDANT && curr && curr->tagName == _tagName;
    968831         curr = curr->next, i++);
    969832    return i != MAX_REDUNDANT;
    970833}
    971834
    972 void KHTMLParser::processCloseTag(Token *t)
    973 {
    974     // support for really broken html. Can't believe I'm supporting such crap (lars)
    975     switch(t->id)
    976     {
    977     case ID_HTML+ID_CLOSE_TAG:
    978     case ID_BODY+ID_CLOSE_TAG:
    979         // we never close the body tag, since some stupid web pages close it before the actual end of the doc.
    980         // let's rely on the end() call to close things.
     835void HTMLParser::processCloseTag(Token *t)
     836{
     837    // Support for really broken html.
     838    // we never close the body tag, since some stupid web pages close it before the actual end of the doc.
     839    // let's rely on the end() call to close things.
     840    if (t->tagName == HTMLNames::html() || t->tagName == HTMLNames::body())
    981841        return;
    982     case ID_FORM+ID_CLOSE_TAG:
     842   
     843    if (t->tagName == HTMLNames::form())
    983844        form = 0;
    984         // this one is to get the right style on the body element
    985         break;
    986     case ID_MAP+ID_CLOSE_TAG:
     845    else if (t->tagName == HTMLNames::map())
    987846        map = 0;
    988         break;
    989     case ID_SELECT+ID_CLOSE_TAG:
     847    else if (t->tagName == HTMLNames::select())
    990848        inSelect = false;
    991         break;
    992     default:
    993         break;
    994     }
    995 
    996 #ifdef PARSER_DEBUG
    997     kdDebug( 6035 ) << "added the following childs to " << current->nodeName().string() << endl;
    998     NodeImpl *child = current->firstChild();
    999     while(child != 0)
    1000     {
    1001         kdDebug( 6035 ) << "    " << child->nodeName().string() << endl;
    1002         child = child->nextSibling();
    1003     }
    1004 #endif
     849       
    1005850    HTMLStackElem* oldElem = blockStack;
    1006     popBlock(t->id-ID_CLOSE_TAG);
    1007     if (oldElem == blockStack && t->id == ID_P+ID_CLOSE_TAG) {
     851    popBlock(t->tagName);
     852    if (oldElem == blockStack && t->tagName == HTMLNames::p()) {
    1008853        // We encountered a stray </p>.  Amazingly Gecko, WinIE, and MacIE all treat
    1009854        // this as a valid break, i.e., <p></p>.  So go ahead and make the empty
    1010855        // paragraph.
    1011         t->id-=ID_CLOSE_TAG;
     856        t->beginTag = true;
    1012857        parseToken(t);
    1013         popBlock(ID_P);
     858        popBlock(t->tagName);
    1014859    }
    1015860#ifdef PARSER_DEBUG
     
    1018863}
    1019864
    1020 bool KHTMLParser::isHeaderTag(int _id)
    1021 {
    1022     switch (_id) {
    1023         case ID_H1:
    1024         case ID_H2:
    1025         case ID_H3:
    1026         case ID_H4:
    1027         case ID_H5:
    1028         case ID_H6:
    1029             return true;
    1030         default:
    1031             return false;
    1032     }
    1033 }
    1034 
    1035 void KHTMLParser::popNestedHeaderTag()
     865bool HTMLParser::isHeaderTag(const AtomicString& tagName)
     866{
     867    static HashSet<DOMStringImpl*, PointerHash<DOMStringImpl*> > headerTags;
     868    if (headerTags.isEmpty()) {
     869        headerTags.insert(HTMLNames::h1().localName().implementation());
     870        headerTags.insert(HTMLNames::h2().localName().implementation());
     871        headerTags.insert(HTMLNames::h3().localName().implementation());
     872        headerTags.insert(HTMLNames::h4().localName().implementation());
     873        headerTags.insert(HTMLNames::h5().localName().implementation());
     874        headerTags.insert(HTMLNames::h6().localName().implementation());
     875    }
     876   
     877    return headerTags.contains(tagName.implementation());
     878}
     879
     880void HTMLParser::popNestedHeaderTag()
    1036881{
    1037882    // This function only cares about checking for nested headers that have only inlines in between them.
    1038883    NodeImpl* currNode = current;
    1039884    for (HTMLStackElem* curr = blockStack; curr; curr = curr->next) {
    1040         if (isHeaderTag(curr->id)) {
    1041             popBlock(curr->id);
     885        if (isHeaderTag(curr->tagName)) {
     886            popBlock(curr->tagName);
    1042887            return;
    1043888        }
    1044         if (currNode && !currNode->isInline())
     889        if (currNode && !isInline(currNode))
    1045890            return;
    1046891        currNode = curr->node;
     
    1048893}
    1049894
    1050 bool KHTMLParser::isResidualStyleTag(int _id)
    1051 {
    1052     switch (_id) {
    1053         case ID_A:
    1054         case ID_FONT:
    1055         case ID_TT:
    1056         case ID_U:
    1057         case ID_B:
    1058         case ID_I:
    1059         case ID_S:
    1060         case ID_STRIKE:
    1061         case ID_BIG:
    1062         case ID_SMALL:
    1063         case ID_EM:
    1064         case ID_STRONG:
    1065         case ID_DFN:
    1066         case ID_CODE:
    1067         case ID_SAMP:
    1068         case ID_KBD:
    1069         case ID_VAR:
     895bool HTMLParser::isInline(DOM::NodeImpl* node) const
     896{
     897    if (node->isTextNode())
     898        return true;
     899
     900    if (node->isHTMLElement()) {
     901        HTMLElementImpl* e = static_cast<HTMLElementImpl*>(node);
     902        if (e->hasLocalName(HTMLNames::a()) || e->hasLocalName(HTMLNames::font()) || e->hasLocalName(HTMLNames::tt()) ||
     903            e->hasLocalName(HTMLNames::u()) || e->hasLocalName(HTMLNames::b()) || e->hasLocalName(HTMLNames::i()) ||
     904            e->hasLocalName(HTMLNames::s()) || e->hasLocalName(HTMLNames::strike()) || e->hasLocalName(HTMLNames::big()) ||
     905            e->hasLocalName(HTMLNames::small()) || e->hasLocalName(HTMLNames::em()) || e->hasLocalName(HTMLNames::strong()) ||
     906            e->hasLocalName(HTMLNames::dfn()) || e->hasLocalName(HTMLNames::code()) || e->hasLocalName(HTMLNames::samp()) ||
     907            e->hasLocalName(HTMLNames::kbd()) || e->hasLocalName(HTMLNames::var()) || e->hasLocalName(HTMLNames::cite()) ||
     908            e->hasLocalName(HTMLNames::abbr()) || e->hasLocalName(HTMLNames::acronym()) || e->hasLocalName(HTMLNames::sub()) ||
     909            e->hasLocalName(HTMLNames::sup()) || e->hasLocalName(HTMLNames::span()) || e->hasLocalName(HTMLNames::nobr()) ||
     910            e->hasLocalName(HTMLNames::wbr()))
    1070911            return true;
    1071         default:
    1072             return false;
    1073     }
    1074 }
    1075 
    1076 bool KHTMLParser::isAffectedByResidualStyle(int _id)
    1077 {
    1078     if (isResidualStyleTag(_id))
     912    }
     913   
     914    return false;
     915}
     916
     917bool HTMLParser::isResidualStyleTag(const AtomicString& tagName)
     918{
     919    static HashSet<DOMStringImpl*, PointerHash<DOMStringImpl*> > residualStyleTags;
     920    if (residualStyleTags.isEmpty()) {
     921        residualStyleTags.insert(HTMLNames::a().localName().implementation());
     922        residualStyleTags.insert(HTMLNames::font().localName().implementation());
     923        residualStyleTags.insert(HTMLNames::tt().localName().implementation());
     924        residualStyleTags.insert(HTMLNames::u().localName().implementation());
     925        residualStyleTags.insert(HTMLNames::b().localName().implementation());
     926        residualStyleTags.insert(HTMLNames::i().localName().implementation());
     927        residualStyleTags.insert(HTMLNames::s().localName().implementation());
     928        residualStyleTags.insert(HTMLNames::strike().localName().implementation());
     929        residualStyleTags.insert(HTMLNames::big().localName().implementation());
     930        residualStyleTags.insert(HTMLNames::small().localName().implementation());
     931        residualStyleTags.insert(HTMLNames::em().localName().implementation());
     932        residualStyleTags.insert(HTMLNames::strong().localName().implementation());
     933        residualStyleTags.insert(HTMLNames::dfn().localName().implementation());
     934        residualStyleTags.insert(HTMLNames::code().localName().implementation());
     935        residualStyleTags.insert(HTMLNames::samp().localName().implementation());
     936        residualStyleTags.insert(HTMLNames::kbd().localName().implementation());
     937        residualStyleTags.insert(HTMLNames::var().localName().implementation());
     938    }
     939   
     940    return residualStyleTags.contains(tagName.implementation());
     941}
     942
     943bool HTMLParser::isAffectedByResidualStyle(const AtomicString& tagName)
     944{
     945    if (isResidualStyleTag(tagName))
    1079946        return true;
    1080    
    1081     switch (_id) {
    1082         case ID_P:
    1083         case ID_DIV:
    1084         case ID_BLOCKQUOTE:
    1085         case ID_ADDRESS:
    1086         case ID_H1:
    1087         case ID_H2:
    1088         case ID_H3:
    1089         case ID_H4:
    1090         case ID_H5:
    1091         case ID_H6:
    1092         case ID_CENTER:
    1093         case ID_UL:
    1094         case ID_OL:
    1095         case ID_LI:
    1096         case ID_DL:
    1097         case ID_DT:
    1098         case ID_DD:
    1099         case ID_PRE:
    1100             return true;
    1101         default:
    1102             return false;
    1103     }
    1104 }
    1105 
    1106 void KHTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem)
     947
     948    static HashSet<DOMStringImpl*, PointerHash<DOMStringImpl*> > affectedBlockTags;
     949    if (affectedBlockTags.isEmpty()) {
     950        affectedBlockTags.insert(HTMLNames::h1().localName().implementation());
     951        affectedBlockTags.insert(HTMLNames::h2().localName().implementation());
     952        affectedBlockTags.insert(HTMLNames::h3().localName().implementation());
     953        affectedBlockTags.insert(HTMLNames::h4().localName().implementation());
     954        affectedBlockTags.insert(HTMLNames::h5().localName().implementation());
     955        affectedBlockTags.insert(HTMLNames::h6().localName().implementation());
     956        affectedBlockTags.insert(HTMLNames::p().localName().implementation());
     957        affectedBlockTags.insert(HTMLNames::div().localName().implementation());
     958        affectedBlockTags.insert(HTMLNames::blockquote().localName().implementation());
     959        affectedBlockTags.insert(HTMLNames::address().localName().implementation());
     960        affectedBlockTags.insert(HTMLNames::center().localName().implementation());
     961        affectedBlockTags.insert(HTMLNames::ul().localName().implementation());
     962        affectedBlockTags.insert(HTMLNames::ol().localName().implementation());
     963        affectedBlockTags.insert(HTMLNames::li().localName().implementation());
     964        affectedBlockTags.insert(HTMLNames::dl().localName().implementation());
     965        affectedBlockTags.insert(HTMLNames::dt().localName().implementation());
     966        affectedBlockTags.insert(HTMLNames::dd().localName().implementation());
     967        affectedBlockTags.insert(HTMLNames::pre().localName().implementation());
     968    }
     969   
     970    return affectedBlockTags.contains(tagName.implementation());
     971}
     972
     973void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem)
    1107974{
    1108975    // Find the element that crosses over to a higher level.   For now, if there is more than
     
    1126993    }
    1127994
    1128     if (!curr || !maxElem || !isAffectedByResidualStyle(maxElem->id)) return;
     995    if (!curr || !maxElem || !isAffectedByResidualStyle(maxElem->tagName)) return;
    1129996
    1130997    NodeImpl* residualElem = prev->node;
     
    11481015        while (currElem != elem) {
    11491016            HTMLStackElem* nextElem = currElem->next;
    1150             if (!isResidualStyleTag(currElem->id)) {
     1017            if (!isResidualStyleTag(currElem->tagName)) {
    11511018                prevElem->next = nextElem;
    11521019                prevElem->node = currElem->node;
     
    11701037        currElem = maxElem;
    11711038        while (currElem->node != residualElem) {
    1172             if (isResidualStyleTag(currElem->node->id())) {
     1039            if (isResidualStyleTag(currElem->node->localName())) {
    11731040                // Create a clone of this element.
    11741041                currNode = currElem->node->cloneNode(false);
     
    12461113        // after we complete the close of this entire block.
    12471114        NodeImpl* currNode = current;
    1248         if (isResidualStyleTag(curr->id)) {
     1115        if (isResidualStyleTag(curr->tagName)) {
    12491116            // We've overloaded the use of stack elements and are just reusing the
    12501117            // struct with a slightly different meaning to the variables.  Instead of chaining
     
    12701137}
    12711138
    1272 void KHTMLParser::reopenResidualStyleTags(HTMLStackElem* elem, DOM::NodeImpl* malformedTableParent)
     1139void HTMLParser::reopenResidualStyleTags(HTMLStackElem* elem, DOM::NodeImpl* malformedTableParent)
    12731140{
    12741141    // Loop for each tag that needs to be reopened.
     
    12871154
    12881155        // Now push a new stack element for this node we just created.
    1289         pushBlock(elem->id, elem->level);
     1156        pushBlock(elem->tagName, elem->level);
    12901157
    12911158        // Set our strayTableContent boolean if needed, so that the reopened tag also knows
     
    13081175}
    13091176
    1310 void KHTMLParser::pushBlock(int _id, int _level)
    1311 {
    1312     HTMLStackElem *Elem = new HTMLStackElem(_id, _level, current, blockStack);
    1313 
     1177void HTMLParser::pushBlock(const AtomicString& tagName, int _level)
     1178{
     1179    HTMLStackElem *Elem = new HTMLStackElem(tagName, _level, current, blockStack);
    13141180    blockStack = Elem;
    1315     addForbidden(_id, forbiddenTag);
    1316 }
    1317 
    1318 void KHTMLParser::popBlock( int _id )
     1181}
     1182
     1183void HTMLParser::popBlock(const AtomicString& _tagName)
    13191184{
    13201185    HTMLStackElem *Elem = blockStack;
     
    13221187    int maxLevel = 0;
    13231188
    1324 #ifdef PARSER_DEBUG
    1325     kdDebug( 6035 ) << "popBlock(" << getTagName(_id).string() << ")" << endl;
    1326     while(Elem) {
    1327         kdDebug( 6035) << "   > " << getTagName(Elem->id).string() << endl;
    1328         Elem = Elem->next;
    1329     }
    1330     Elem = blockStack;
    1331 #endif
    1332 
    1333     while( Elem && (Elem->id != _id))
    1334     {
     1189    while (Elem && (Elem->tagName != _tagName)) {
    13351190        if (maxLevel < Elem->level)
    1336         {
    13371191            maxLevel = Elem->level;
    1338         }
    13391192        Elem = Elem->next;
    13401193    }
     
    13461199        // We didn't match because the tag is in a different scope, e.g.,
    13471200        // <b><p>Foo</b>.  Try to correct the problem.
    1348         if (!isResidualStyleTag(_id))
     1201        if (!isResidualStyleTag(_tagName))
    13491202            return;
    13501203        return handleResidualStyleCloseTagAcrossBlocks(Elem);
    13511204    }
    13521205
    1353     bool isAffectedByStyle = isAffectedByResidualStyle(Elem->id);
     1206    bool isAffectedByStyle = isAffectedByResidualStyle(Elem->tagName);
    13541207    HTMLStackElem* residualStyleStack = 0;
    13551208    NodeImpl* malformedTableParent = 0;
    13561209   
    13571210    Elem = blockStack;
    1358     while (Elem)
    1359     {
    1360         if (Elem->id == _id)
    1361         {
     1211    while (Elem) {
     1212        if (Elem->tagName == _tagName) {
    13621213            int strayTable = inStrayTableContent;
    13631214            popOneBlock();
     
    13701221            if (strayTable && (inStrayTableContent < strayTable) && residualStyleStack) {
    13711222                NodeImpl* curr = current;
    1372                 while (curr && curr->id() != ID_TABLE)
     1223                while (curr && !curr->hasTagName(HTMLNames::table()))
    13731224                    curr = curr->parentNode();
    13741225                malformedTableParent = curr ? curr->parentNode() : 0;
    13751226            }
    13761227        }
    1377         else
    1378         {
    1379             if (Elem->id == ID_FORM && form)
     1228        else {
     1229            if (form && Elem->tagName == HTMLNames::form())
    13801230                // A <form> is being closed prematurely (and this is
    13811231                // malformed HTML).  Set an attribute on the form to clear out its
     
    13861236            // after we complete the close of this entire block.
    13871237            NodeImpl* currNode = current;
    1388             if (isAffectedByStyle && isResidualStyleTag(Elem->id)) {
     1238            if (isAffectedByStyle && isResidualStyleTag(Elem->tagName)) {
    13891239                // We've overloaded the use of stack elements and are just reusing the
    13901240                // struct with a slightly different meaning to the variables.  Instead of chaining
     
    14091259}
    14101260
    1411 void KHTMLParser::popOneBlock(bool delBlock)
     1261void HTMLParser::popOneBlock(bool delBlock)
    14121262{
    14131263    HTMLStackElem *Elem = blockStack;
    14141264
    14151265    // we should never get here, but some bad html might cause it.
    1416 #ifndef PARSER_DEBUG
    1417     if(!Elem) return;
    1418 #else
    1419     kdDebug( 6035 ) << "popping block: " << getTagName(Elem->id).string() << "(" << Elem->id << ")" << endl;
    1420 #endif
    1421 
    1422 #if SPEED_DEBUG < 1
    1423     if((Elem->node != current)) {
     1266    if (!Elem) return;
     1267   
     1268    if ((Elem->node != current)) {
    14241269        if (current->maintainsState() && doc()){
    14251270            doc()->registerMaintainsState(current);
     
    14321277        current->closeRenderer();
    14331278    }
    1434 #endif
    1435 
    1436     removeForbidden(Elem->id, forbiddenTag);
    14371279
    14381280    blockStack = Elem->next;
     
    14461288}
    14471289
    1448 void KHTMLParser::popInlineBlocks()
    1449 {
    1450     while (blockStack && current->isInline())
     1290void HTMLParser::popInlineBlocks()
     1291{
     1292    while (blockStack && isInline(current))
    14511293        popOneBlock();
    14521294}
    14531295
    1454 void KHTMLParser::freeBlock()
     1296void HTMLParser::freeBlock()
    14551297{
    14561298    while (blockStack)
     
    14581300}
    14591301
    1460 void KHTMLParser::createHead()
     1302void HTMLParser::createHead()
    14611303{
    14621304    if(head || !doc()->firstChild())
     
    14751317}
    14761318
    1477 NodeImpl *KHTMLParser::handleIsindex( Token *t )
     1319NodeImpl *HTMLParser::handleIsindex( Token *t )
    14781320{
    14791321    NodeImpl *n;
     
    15051347}
    15061348
    1507 void KHTMLParser::startBody()
     1349void HTMLParser::startBody()
    15081350{
    15091351    if(inBody) return;
     
    15171359}
    15181360
    1519 void KHTMLParser::finished()
     1361void HTMLParser::finished()
    15201362{
    15211363    // In the case of a completely empty document, here's the place to create the HTML element.
  • trunk/WebCore/khtml/html/htmlparser.h

    r8311 r9639  
    3030#define HTMLPARSER_H
    3131
    32 // 0 all
    33 // 1 domtree + rendertree + styleForElement, no layouting
    34 // 2 domtree only
    35 #define SPEED_DEBUG 0
    36 
    37 #ifdef SPEED_DEBUG
    38 #include <qdatetime.h>
    39 #endif
    40 
    4132#include "dom/dom_string.h"
    4233#include "xml/dom_nodeimpl.h"
    4334#include "html/html_documentimpl.h"
    44 #include "misc/htmltags.h"
    4535
    4636class KHTMLView;
     
    6252};
    6353
    64 class KHTMLParser;
    65 
    6654/**
    6755 * The parser for html. It receives a stream of tokens from the HTMLTokenizer, and
    6856 * builds up the Document structure form it.
    6957 */
    70 class KHTMLParser
     58class HTMLParser
    7159{
    7260public:
    73     KHTMLParser(KHTMLView *w, DOM::DocumentPtr *i, bool includesComments=false);
    74     KHTMLParser(DOM::DocumentFragmentImpl *frag, DOM::DocumentPtr *doc, bool includesComments=false);
    75     virtual ~KHTMLParser();
     61    HTMLParser(KHTMLView *w, DOM::DocumentPtr *i, bool includesComments=false);
     62    HTMLParser(DOM::DocumentFragmentImpl *frag, DOM::DocumentPtr *doc, bool includesComments=false);
     63    virtual ~HTMLParser();
    7664
    7765    /**
     
    9078    void reset();
    9179
    92     bool skipMode() const { return (discard_until != 0); }
     80    bool skipMode() const { return !discard_until.isNull(); }
    9381    bool noSpaces() const { return !inBody; }
    9482    bool selectMode() const { return inSelect; }
     
    9886
    9987protected:
    100     void setCurrent(DOM::NodeImpl *newCurrent);
     88    void setCurrent(DOM::NodeImpl* newCurrent);
     89    void setSkipMode(const DOM::QualifiedName& qName) { discard_until = qName.localName(); }
    10190
    10291    KHTMLView *HTMLWidget;
     
    10493
    10594    /*
    106      * generate an element from the token
     95     * generate a node from the token
    10796     */
    108     DOM::NodeImpl *getElement(khtml::Token *);
     97    DOM::NodeImpl *getNode(khtml::Token *);
     98    bool textCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     99    bool commentCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     100    bool headCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     101    bool bodyCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     102    bool framesetCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     103    bool iframeCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     104    bool formCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     105    bool isindexCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     106    bool selectCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     107    bool ddCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     108    bool dtCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     109    bool nestedCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     110    bool nestedStyleCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     111    bool tableCellCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     112    bool tableSectionCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     113    bool noembedCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     114    bool noscriptCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     115    bool noframesCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
     116    bool nolayerCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
    109117
    110118    void processCloseTag(khtml::Token *);
    111119
    112120    bool insertNode(DOM::NodeImpl *n, bool flat = false);
     121    bool handleError(DOM::NodeImpl* n, bool flat, const DOM::AtomicString& localName, int tagPriority);
     122   
     123    // The currently active element (the one new elements will be added to).  Can be a DocumentFragment, a Document or an Element.
     124    DOM::NodeImpl* current;
    113125
    114     /*
    115      * The currently active element (the one new elements will be added to)
    116      */
    117     DOM::NodeImpl *current;
    118126    bool currentIsReferenced;
    119127
    120128    HTMLStackElem *blockStack;
    121129
    122     void pushBlock( int _id, int _level);
    123 
    124     void popBlock( int _id );
     130    void pushBlock(const DOM::AtomicString& tagName, int _level);
     131    void popBlock(const DOM::AtomicString& tagName);
     132    void popBlock(const DOM::QualifiedName& qName) { return popBlock(qName.localName()); } // Convenience function for readability.
    125133    void popOneBlock(bool delBlock = true);
    126134    void popInlineBlocks();
    127135
    128     void freeBlock( void);
     136    void freeBlock();
    129137
    130138    void createHead();
    131139
    132     bool isResidualStyleTag(int _id);
    133     bool isAffectedByResidualStyle(int _id);
     140    bool isResidualStyleTag(const DOM::AtomicString& tagName);
     141    bool isAffectedByResidualStyle(const DOM::AtomicString& tagName);
    134142    void handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem);
    135143    void reopenResidualStyleTags(HTMLStackElem* elem, DOM::NodeImpl* malformedTableParent);
    136144
    137     bool allowNestedRedundantTag(int _id);
     145    bool allowNestedRedundantTag(const DOM::AtomicString& tagName);
    138146   
    139     static bool isHeaderTag(int _id);
     147    static bool isHeaderTag(const DOM::AtomicString& tagName);
    140148    void popNestedHeaderTag();
    141149
     150    bool isInline(DOM::NodeImpl* node) const;
     151   
    142152    /*
    143153     * currently active form
     
    176186     * tells the parser to discard all tags, until it reaches the one specified
    177187     */
    178     int discard_until;
     188    DOM::AtomicString discard_until;
    179189
    180190    bool headLoaded;
     
    182192
    183193    bool includesCommentsInDOM;
     194};
    184195   
    185     ushort forbiddenTag[ID_LAST_TAG + 1];
    186    
    187 #if SPEED_DEBUG > 0
    188     QTime qt;
    189 #endif
    190 };
    191 
    192196#endif // HTMLPARSER_H
  • trunk/WebCore/khtml/html/htmltokenizer.cpp

    r9595 r9639  
    4040#include "html/html_documentimpl.h"
    4141#include "html/htmlparser.h"
    42 #include "html/dtd.h"
    4342
    4443#include "misc/loader.h"
     
    6463using DOM::DocumentImpl;
    6564using DOM::emptyAtom;
    66 using DOM::endTagRequirement;
     65using DOM::commentAtom;
     66using DOM::nullAtom;
     67using DOM::textAtom;
     68using DOM::HTMLNames;
    6769
    6870// turn off inlining to void warning with newer gcc
     
    240242    scriptCodeSize = scriptCodeMaxSize = scriptCodeResync = 0;
    241243    charsets = KGlobal::charsets();
    242     parser = new KHTMLParser(_view, _doc, includesComments);
     244    parser = new HTMLParser(_view, _doc, includesComments);
    243245    m_executingScript = 0;
    244246    loadingExtScript = false;
     
    260262    scriptCodeSize = scriptCodeMaxSize = scriptCodeResync = 0;
    261263    charsets = KGlobal::charsets();
    262     parser = new KHTMLParser(i, _doc, includesComments);
     264    parser = new HTMLParser(i, _doc, includesComments);
    263265    m_executingScript = 0;
    264266    loadingExtScript = false;
     
    452454                processListing(TokenizerString(scriptCode, scriptCodeSize));
    453455                processToken();
    454                 if ( style )         { currToken.id = ID_STYLE + ID_CLOSE_TAG; }
    455                 else if ( textarea ) { currToken.id = ID_TEXTAREA + ID_CLOSE_TAG; }
    456                 else if ( title ) { currToken.id = ID_TITLE + ID_CLOSE_TAG; }
    457                 else if ( xmp )  { currToken.id = ID_XMP + ID_CLOSE_TAG; }
     456                if ( style )         { currToken.tagName = HTMLNames::style().localName(); currToken.beginTag = false; }
     457                else if ( textarea ) { currToken.tagName = HTMLNames::textarea().localName(); currToken.beginTag = false; }
     458                else if ( title ) { currToken.tagName = HTMLNames::title().localName(); currToken.beginTag = false; }
     459                else if ( xmp )  { currToken.tagName = HTMLNames::xmp().localName(); currToken.beginTag = false; }
    458460                processToken();
    459461                style = script = style = textarea = title = xmp = false;
     
    525527    QString exScript( buffer, dest-buffer );
    526528    processToken();
    527     currToken.id = ID_SCRIPT + ID_CLOSE_TAG;
     529    currToken.tagName = HTMLNames::script().localName();
     530    currToken.beginTag = false;
    528531    processToken();
    529532
     
    702705                        scriptCode[ scriptCodeSize ] = 0;
    703706                        scriptCode[ scriptCodeSize + 1 ] = 0;
    704                         currToken.id = ID_COMMENT;
     707                        currToken.tagName = commentAtom;
     708                        currToken.beginTag = true;
    705709                        processListing(TokenizerString(scriptCode, scriptCodeSize - endCharsCount));
    706710                        processToken();
    707                         currToken.id = ID_COMMENT + ID_CLOSE_TAG;
     711                        currToken.tagName = commentAtom;
     712                        currToken.beginTag = false;
    708713                        processToken();
    709714                    }
     
    10231028                    break;
    10241029                }
    1025                 // Use tolower() instead of | 0x20 to lowercase the char because there is no
    1026                 // performance gain in using | 0x20 since tolower() is optimized and
    1027                 // | 0x20 turns characters such as '_' into junk.
    1028                 cBuffer[cBufferPos++] = tolower(curchar);
     1030               
     1031                // tolower() shows up on profiles. This is faster!
     1032                if (curchar >= 'A' && curchar <= 'Z')
     1033                    cBuffer[cBufferPos++] = curchar + ('a' - 'A');
     1034                else
     1035                    cBuffer[cBufferPos++] = curchar;
    10291036                ++src;
    10301037            }
     
    10481055                    beginTag = true;
    10491056
    1050                 // Accept empty xml tags like <br/>.  We trim off the "/" so that when we call
    1051                 // getTagID, we'll look up "br" as the tag name and not "br/".
     1057                // Ignore the / in fake xml tags like <br/>.  We trim off the "/" so that we'll get "br" as the tag name and not "br/".
    10521058                if(len > 1 && ptr[len-1] == '/' )
    10531059                    ptr[--len] = '\0';
    10541060
    1055                 // Look up the tagID for the specified tag name (now that we've shaved off any
    1056                 // invalid / that might have followed the name).
    1057                 unsigned short tagID = getTagID(ptr, len);
    1058                 if (!tagID) {
    1059                     DOMString tagName(ptr);
    1060                     DocumentImpl *doc = parser->docPtr()->document();
    1061                     if (doc->isValidName(tagName))
    1062                         tagID = parser->docPtr()->document()->tagId(0, tagName.implementation(), false);
    1063                 }
    1064                 if (tagID) {
    1065 #ifdef TOKEN_DEBUG
    1066                     QCString tmp(ptr, len+1);
    1067                     kdDebug( 6036 ) << "found tag id=" << tagID << ": " << tmp.data() << endl;
    1068 #endif
    1069                     currToken.id = beginTag ? tagID : tagID + ID_CLOSE_TAG;
    1070                 }
     1061                // Now that we've shaved off any invalid / that might have followed the name), make the tag.
     1062                currToken.tagName = AtomicString(ptr);
     1063                currToken.beginTag = beginTag;
    10711064                dest = buffer;
    10721065                tag = SearchAttribute;
     
    11191112                            attrName = QString::fromLatin1(QCString(cBuffer, cBufferPos+1).data());
    11201113                            attrNamePresent = !attrName.isEmpty();
    1121 
    1122                             // This is a deliberate quirk to match Mozilla and Opera.  We have to do this
    1123                             // since sites that use the "standards-compliant" path sometimes send
    1124                             // <script src="foo.js"/>.  Both Moz and Opera will honor this, despite it
    1125                             // being bogus HTML.  They do not honor the "/" for other tags.  This behavior
    1126                             // also deviates from WinIE, but in this case we'll just copy Moz and Opera.
    1127                             if (currToken.id == ID_SCRIPT && curchar == '>' &&
    1128                                 attrName == "/")
    1129                                 currToken.flat = true;
    11301114                        }
    11311115                       
     
    11431127                    }
    11441128                }
    1145                 // Use tolower() instead of | 0x20 to lowercase the char because there is no
    1146                 // performance gain in using | 0x20 since tolower() is optimized and
    1147                 // | 0x20 turns characters such as '_' into junk.
    1148                 cBuffer[cBufferPos++] = tolower(curchar);
     1129               
     1130                // tolower() shows up on profiles. This is faster!
     1131                if (curchar >= 'A' && curchar <= 'Z')
     1132                    cBuffer[cBufferPos++] = curchar + ('a' - 'A');
     1133                else
     1134                    cBuffer[cBufferPos++] = curchar;
    11491135                ++src;
    11501136            }
     
    13291315                ++src;
    13301316
    1331             if ( !currToken.id ) //stop if tag is unknown
     1317            if (currToken.tagName == nullAtom) //stop if tag is unknown
    13321318                return;
    13331319
    1334             uint tagID = currToken.id;
     1320            AtomicString tagName = currToken.tagName;
    13351321#if defined(TOKEN_DEBUG) && TOKEN_DEBUG > 0
    13361322            kdDebug( 6036 ) << "appending Tag: " << tagID << endl;
    13371323#endif
    1338             bool beginTag = !currToken.flat && (tagID <= ID_CLOSE_TAG);
    1339 
    1340             if (tagID > ID_CLOSE_TAG)
    1341                 tagID -= ID_CLOSE_TAG;
    1342             else if (tagID == ID_SCRIPT) {
     1324            bool beginTag = !currToken.flat && currToken.beginTag;
     1325            if (beginTag && currToken.tagName == HTMLNames::script()) {
    13431326                AttributeImpl* a = 0;
    13441327                bool foundTypeAttribute = false;
     
    14151398            processToken();
    14161399
    1417             // we have to take care to close the pre block in
    1418             // case we encounter an unallowed element....
    1419             if(pre && beginTag && !DOM::checkChild(ID_PRE, tagID, !parser->doc()->inCompatMode())) {
    1420                 kdDebug(6036) << " not allowed in <pre> " << (int)tagID << endl;
    1421                 pre = false;
    1422             }
    1423 
    1424             switch( tagID ) {
    1425             case ID_PRE:
     1400            if (tagName == HTMLNames::pre()) {
    14261401                prePos = 0;
    14271402                pre = beginTag;
    14281403                discard = LFDiscard; // Discard the first LF after we open a pre.
    1429                 break;
    1430             case ID_SCRIPT:
     1404            } else if (tagName == HTMLNames::script()) {
    14311405                if (beginTag) {
    14321406                    searchStopper = scriptEnd;
     
    14351409                    parseSpecial(src);
    14361410                }
    1437                 else if (tagID <= ID_CLOSE_TAG) { // Handle <script src="foo"/>
    1438                     script = true;
    1439                     scriptHandler();
    1440                 }
    1441                 break;
    1442             case ID_STYLE:
     1411            } else if (tagName == HTMLNames::style()) {
    14431412                if (beginTag) {
    14441413                    searchStopper = styleEnd;
     
    14471416                    parseSpecial(src);
    14481417                }
    1449                 break;
    1450             case ID_TEXTAREA:
     1418            } else if (tagName == HTMLNames::textarea()) {
    14511419                if(beginTag) {
    14521420                    searchStopper = textareaEnd;
     
    14551423                    parseSpecial(src);
    14561424                }
    1457                 break;
    1458             case ID_TITLE:
    1459                 if (beginTag) {
     1425            } else if (tagName == HTMLNames::title()) {
     1426                 if (beginTag) {
    14601427                    searchStopper = titleEnd;
    14611428                    searchStopperLen = 7;
     
    14631430                    parseSpecial(src);
    14641431                }
    1465                 break;
    1466             case ID_XMP:
     1432            } else if (tagName == HTMLNames::xmp()) {
    14671433                if (beginTag) {
    14681434                    searchStopper = xmpEnd;
     
    14711437                    parseSpecial(src);
    14721438                }
    1473                 break;
    1474             case ID_SELECT:
     1439            } else if (tagName == HTMLNames::select())
    14751440                select = beginTag;
    1476                 break;
    1477             case ID_PLAINTEXT:
     1441            else if (tagName == HTMLNames::plaintext())
    14781442                plaintext = beginTag;
    1479                 break;
    1480             }
    1481 
    14821443            return; // Finished parsing tag!
    14831444        }
     
    19901951        currToken.text = new DOMStringImpl( buffer, dest - buffer );
    19911952        currToken.text->ref();
    1992         if (currToken.id != ID_COMMENT)
    1993             currToken.id = ID_TEXT;
    1994     }
    1995     else if(!currToken.id) {
     1953        if (currToken.tagName != commentAtom)
     1954            currToken.tagName = textAtom;
     1955    }
     1956    else if (currToken.tagName == nullAtom) {
    19961957        currToken.reset();
    19971958        if (jsProxy)
  • trunk/WebCore/khtml/html/htmltokenizer.h

    r9595 r9639  
    3535
    3636#include "misc/loader_client.h"
    37 #include "misc/htmltags.h"
    38 #include "xml/dom_stringimpl.h"
    3937#include "xml/xml_tokenizer.h"
    4038#include "html/html_elementimpl.h"
     
    4846
    4947class KCharsets;
    50 class KHTMLParser;
     48class HTMLParser;
    5149class KHTMLView;
    5250
     
    7169public:
    7270    Token() {
    73         id = 0;
    7471        attrs = 0;
    7572        text = 0;
     73        beginTag = true;
    7674        flat = false;
    7775        //qDebug("new token, creating %08lx", attrs);
    7876    }
     77
    7978    ~Token() {
    80         if(attrs) attrs->deref();
    81         if(text) text->deref();
    82     }
     79        if (attrs) attrs->deref();
     80        if (text) text->deref();
     81    }
     82
    8383    void addAttribute(DOM::DocumentImpl* doc, QChar* buffer, const QString& attrName, const DOM::AtomicString& v)
    8484    {
    8585        DOM::AttributeImpl* a = 0;
    86         if(buffer->unicode())
     86        if (buffer->unicode())
    8787            a = new DOM::MappedAttributeImpl(buffer->unicode(), v);
    88         else if ( !attrName.isEmpty() && attrName != "/" )
     88        else if (!attrName.isEmpty() && attrName != "/")
    8989            a = new DOM::MappedAttributeImpl(doc->attrId(0, DOM::DOMString(attrName).implementation(), false),
    9090                                             v);
     
    9898        }
    9999    }
     100
     101    bool isOpenTag(const DOM::QualifiedName& fullName) const { return beginTag && fullName.localName() == tagName; }
     102    bool isCloseTag(const DOM::QualifiedName& fullName) const { return !beginTag && fullName.localName() == tagName; }
     103
    100104    void reset()
    101105    {
    102         if(attrs) {
     106        if (attrs) {
    103107            attrs->deref();
    104108            attrs = 0;
    105109        }
    106         id = 0;
    107         if(text) {
     110       
     111        tagName = DOM::nullAtom;
     112       
     113        if (text) {
    108114            text->deref();
    109115            text = 0;
    110116        }
     117       
     118        beginTag = true;
    111119        flat = false;
    112120    }
     121
    113122    DOM::NamedMappedAttrMapImpl* attrs;
    114123    DOM::DOMStringImpl* text;
    115     ushort id;
    116     bool flat;
     124    DOM::AtomicString tagName;
     125    bool beginTag : 1;
     126    bool flat : 1;
    117127};
    118128
     
    369379
    370380    KCharsets *charsets;
    371     KHTMLParser *parser;
     381    HTMLParser *parser;
    372382
    373383    QGuardedPtr<KHTMLView> view;
  • trunk/WebCore/khtml/khtml_part.cpp

    r9517 r9639  
    209209{
    210210  AtomicString::init();
     211  HTMLNames::init(); // FIXME: We should make this happen only when HTML is used.
    211212  if ( prof == DefaultGUI )
    212213    setXMLFile( "khtml.rc" );
     
    57255726
    57265727    if (d->m_typingStyle) {
    5727         styleElement = xmlDocImpl()->createHTMLElement("span", exceptionCode);
     5728        styleElement = xmlDocImpl()->createElementNS(HTMLNames::xhtmlNamespaceURI(), "span", exceptionCode);
    57285729        assert(exceptionCode == 0);
    57295730
  • trunk/WebCore/khtml/khtmlview.cpp

    r9156 r9639  
    608608        NodeImpl *body = static_cast<HTMLDocumentImpl*>(document)->body();
    609609        if (body && body->renderer()) {
    610             if (body->id() == ID_FRAMESET) {
     610            if (body->hasTagName(HTMLNames::frameset())) {
    611611                body->renderer()->setNeedsLayout(true);
    612612                vMode = AlwaysOff;
    613613                hMode = AlwaysOff;
    614614            }
    615             else if (body->id() == ID_BODY) {
     615            else if (body->hasTagName(HTMLNames::body())) {
    616616                RenderObject* o = (rootRenderer->style()->overflow() == OVISIBLE) ? body->renderer() : rootRenderer;
    617617                applyOverflowToViewport(o, hMode, vMode); // Only applies to HTML UAs, not to XML/XHTML UAs
     
    878878static bool isSubmitImage(DOM::NodeImpl *node)
    879879{
    880     return node
    881         && node->isHTMLElement()
    882         && node->id() == ID_INPUT
    883         && static_cast<HTMLInputElementImpl*>(node)->inputType() == HTMLInputElementImpl::IMAGE;
     880    return node && node->hasTagName(HTMLNames::input()) && static_cast<HTMLInputElementImpl*>(node)->inputType() == HTMLInputElementImpl::IMAGE;
    884881}
    885882
  • trunk/WebCore/khtml/misc/decoder.cpp

    r9513 r9639  
    4141#include <kdebug.h>
    4242#include <klocale.h>
     43
     44#include "htmlnames.h"
     45
     46using DOM::AtomicString;
     47using DOM::HTMLNames;
     48using DOM::nullAtom;
    4349
    4450class KanjiCode
     
    527533                    }
    528534                    tmp[len] = 0;
    529                     int id = khtml::getTagID(tmp, len);
    530                     if(end) id += ID_CLOSE_TAG;
    531 
    532                     switch( id ) {
    533                     case ID_META:
    534                     {
     535                    AtomicString tag(tmp);
     536                    if (!end && tag == HTMLNames::meta()) {
    535537                        // found a meta tag...
    536538                        //ptr += 5;
     
    571573                            pos = endpos + 1;
    572574                        }
    573                     }
    574                     case (ID_META+ID_CLOSE_TAG):
    575                     case ID_SCRIPT:
    576                     case (ID_SCRIPT+ID_CLOSE_TAG):
    577                     case ID_NOSCRIPT:
    578                     case (ID_NOSCRIPT+ID_CLOSE_TAG):
    579                     case ID_STYLE:
    580                     case (ID_STYLE+ID_CLOSE_TAG):
    581                     case ID_LINK:
    582                     case (ID_LINK+ID_CLOSE_TAG):
    583                     case ID_OBJECT:
    584                     case (ID_OBJECT+ID_CLOSE_TAG):
    585                     case ID_TITLE:
    586                     case (ID_TITLE+ID_CLOSE_TAG):
    587                     case ID_BASE:
    588                     case (ID_BASE+ID_CLOSE_TAG):
    589                     case ID_HTML:
    590                     case ID_HEAD:
    591                     case 0:
    592                     case (0 + ID_CLOSE_TAG ):
    593                         break;
    594                     default:
     575                    } else if (tag != HTMLNames::script() && tag != HTMLNames::noscript() && tag != HTMLNames::style() &&
     576                               tag != HTMLNames::link() && tag != HTMLNames::meta() && tag != HTMLNames::object() &&
     577                               tag != HTMLNames::title() && tag != HTMLNames::base() &&
     578                               (end || tag != HTMLNames::html()) &&
     579                               (end || tag != HTMLNames::head()) && isalpha(tmp[0])) {
    595580                        body = true;
    596581#ifdef DECODE_DEBUG
  • trunk/WebCore/khtml/misc/hashmap.h

    r9597 r9639  
    7676
    7777template<typename Key, typename Mapped, typename HashFunctions, typename KeyTraits, typename MappedTraits>
    78 int HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::size() const
     78inline int HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::size() const
    7979{
    80     return m_impl.count();
     80    return m_impl.size();
    8181}
    8282
     
    8888
    8989template<typename Key, typename Mapped, typename HashFunctions, typename KeyTraits, typename MappedTraits>
    90 bool HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::isEmpty() const
     90inline bool HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::isEmpty() const
    9191{
    9292    return size() == 0;
     
    9494
    9595template<typename Key, typename Mapped, typename HashFunctions, typename KeyTraits, typename MappedTraits>
    96 typename HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::iterator HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::begin()
     96inline typename HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::iterator HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::begin()
    9797{
    9898    return m_impl.begin();
     
    100100
    101101template<typename Key, typename Mapped, typename HashFunctions, typename KeyTraits, typename MappedTraits>
    102 typename HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::iterator HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::end()
     102inline typename HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::iterator HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::end()
    103103{
    104104    return m_impl.end();
     
    106106
    107107template<typename Key, typename Mapped, typename HashFunctions, typename KeyTraits, typename MappedTraits>
    108 typename HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::const_iterator HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::begin() const
     108inline typename HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::const_iterator HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::begin() const
    109109{
    110110    return m_impl.begin();
     
    112112
    113113template<typename Key, typename Mapped, typename HashFunctions, typename KeyTraits, typename MappedTraits>
    114 typename HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::const_iterator HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::end() const
     114inline typename HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::const_iterator HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::end() const
    115115{
    116116    return m_impl.end();
     
    149149
    150150template<typename Key, typename Mapped, typename HashFunctions, typename KeyTraits, typename MappedTraits>
    151 Mapped HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::get(const KeyType &key) const
     151inline Mapped HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::get(const KeyType &key) const
    152152{
    153153    const_iterator it = find(key);
  • trunk/WebCore/khtml/misc/hashset.h

    r9605 r9639  
    8383
    8484template<typename Value, typename HashFunctions, typename Traits>
    85 int HashSet<Value, HashFunctions, Traits>::size() const
     85inline int HashSet<Value, HashFunctions, Traits>::size() const
    8686{
    8787    return m_impl.size();
     
    9595
    9696template<typename Value, typename HashFunctions, typename Traits>
    97 bool HashSet<Value, HashFunctions, Traits>::isEmpty() const
     97inline bool HashSet<Value, HashFunctions, Traits>::isEmpty() const
    9898{
    9999    return size() == 0;
     
    101101
    102102template<typename Value, typename HashFunctions, typename Traits>
    103 typename HashSet<Value, HashFunctions, Traits>::iterator HashSet<Value, HashFunctions, Traits>::begin()
     103inline typename HashSet<Value, HashFunctions, Traits>::iterator HashSet<Value, HashFunctions, Traits>::begin()
    104104{
    105105    return m_impl.begin();
     
    107107
    108108template<typename Value, typename HashFunctions, typename Traits>
    109 typename HashSet<Value, HashFunctions, Traits>::iterator HashSet<Value, HashFunctions, Traits>::end()
     109inline typename HashSet<Value, HashFunctions, Traits>::iterator HashSet<Value, HashFunctions, Traits>::end()
    110110{
    111111    return m_impl.end();
     
    113113
    114114template<typename Value, typename HashFunctions, typename Traits>
    115 typename HashSet<Value, HashFunctions, Traits>::const_iterator HashSet<Value, HashFunctions, Traits>::begin() const
     115inline typename HashSet<Value, HashFunctions, Traits>::const_iterator HashSet<Value, HashFunctions, Traits>::begin() const
    116116{
    117117    return m_impl.begin();
     
    119119
    120120template<typename Value, typename HashFunctions, typename Traits>
    121 typename HashSet<Value, HashFunctions, Traits>::const_iterator HashSet<Value, HashFunctions, Traits>::end() const
     121inline typename HashSet<Value, HashFunctions, Traits>::const_iterator HashSet<Value, HashFunctions, Traits>::end() const
    122122{
    123123    return m_impl.end();
     
    137137
    138138template<typename Value, typename HashFunctions, typename Traits>
    139 bool HashSet<Value, HashFunctions, Traits>::contains(const ValueType& value) const
     139inline bool HashSet<Value, HashFunctions, Traits>::contains(const ValueType& value) const
    140140{
    141141    return m_impl.contains(value);
  • trunk/WebCore/khtml/misc/hashtable.h

    r9617 r9639  
    6767    friend class HashTable<Key, Value, ExtractKey, HashFunctions, Traits>;
    6868   
     69    void skipEmptyBuckets()
     70    {
     71        while (m_position != m_endPosition && (HashTableType::isEmptyOrDeletedBucket(*m_position))) {
     72            ++m_position;
     73        }
     74    }
     75
    6976    HashTableIterator(PointerType position, PointerType endPosition)
    7077        : m_position(position), m_endPosition(endPosition)
     
    100107    }
    101108
    102 private:
    103     void skipEmptyBuckets()
    104     {
    105         while (m_position != m_endPosition && (HashTableType::isEmptyOrDeletedBucket(*m_position))) {
    106             ++m_position;
    107         }
    108     }
    109 
     109 private:
    110110    PointerType m_position;
    111111    PointerType m_endPosition;
     
    272272inline typename HashTable<Key, Value, ExtractKey, HashFunctions, Traits>::FullLookupType HashTable<Key, Value, ExtractKey, HashFunctions, Traits>::lookup(const T& key)
    273273{
    274     if (!m_table)
    275         return makeLookupResult(0, false, 0);
     274    assert(m_table);
    276275   
    277276    unsigned h = HashT(key);
    278     int i = h & m_tableSizeMask;
     277    int sizeMask = m_tableSizeMask;
     278    int i = h & sizeMask;
    279279    int k = 0;
    280280
     
    284284#endif
    285285   
     286    ValueType *table = m_table;
    286287    ValueType *entry;
    287288    ValueType *deletedEntry = 0;
    288     while (!isEmptyBucket(*(entry = m_table + i))) {
     289    while (!isEmptyBucket(*(entry = table + i))) {
    289290        if (isDeletedBucket(*entry))
    290291            deletedEntry = entry;
     
    296297#endif
    297298        if (k == 0)
    298             k = 1 | (h % m_tableSizeMask);
    299         i = (i + k) & m_tableSizeMask;
     299            k = 1 | (h % sizeMask);
     300        i = (i + k) & sizeMask;
    300301    }
    301302
     
    356357inline typename HashTable<Key, Value, ExtractKey, HashFunctions, Traits>::iterator HashTable<Key, Value, ExtractKey, HashFunctions, Traits>::find(const Key& key)
    357358{
     359    if (!m_table)
     360        return end();
     361
    358362    LookupType result = lookup(key);
    359363    if (!result.second)
     
    365369inline typename HashTable<Key, Value, ExtractKey, HashFunctions, Traits>::const_iterator HashTable<Key, Value, ExtractKey, HashFunctions, Traits>::find(const Key& key) const
    366370{
     371    if (!m_table)
     372        return end();
     373
    367374    LookupType result = const_cast<HashTable *>(this)->lookup(key);
    368375    if (!result.second)
     
    374381inline bool HashTable<Key, Value, ExtractKey, HashFunctions, Traits>::contains(const KeyType& key) const
    375382{
     383    if (!m_table)
     384        return false;
     385
    376386    return const_cast<HashTable *>(this)->lookup(key).second;
    377387}
     
    399409inline void HashTable<Key, Value, ExtractKey, HashFunctions, Traits>::remove(const KeyType& key)
    400410{
     411    if (!m_table)
     412        return;
     413
    401414    remove(lookup(key).first);
    402415}
  • trunk/WebCore/khtml/misc/htmlhashes.cpp

    r8306 r9639  
    2626#undef __inline
    2727#define __inline
    28 #include "htmltags.c"
    2928#include "htmlattrs.c"
    3029#undef __inline
    3130
    32 unsigned short khtml::getTagID(const char *tagStr, int len)
     31unsigned short khtml::getAttrID(const char *attrStr, int len)
    3332{
    34     const struct tags *tagPtr = findTag(tagStr, len);
    35     if (!tagPtr)
     33    const struct attrs *attrPtr = findAttr(attrStr, len);
     34    if (!attrPtr)
    3635        return 0;
    37     return tagPtr->id;
     36    return attrPtr->id;
    3837}
    39 
    40 unsigned short khtml::getAttrID(const char *tagStr, int len)
    41 {
    42     const struct attrs *tagPtr = findAttr(tagStr, len);
    43     if (!tagPtr)
    44         return 0;
    45     return tagPtr->id;
    46 }
  • trunk/WebCore/khtml/misc/htmlhashes.h

    r8306 r9639  
    2424#define HTMLHASHES_H
    2525
    26 #include "htmltags.h"
    2726#include "htmlattrs.h"
    2827
    2928namespace khtml
    3029{
    31   unsigned short getTagID(const char *tagStr, int len);
    3230  unsigned short getAttrID(const char *tagStr, int len);
    3331}
  • trunk/WebCore/khtml/rendering/bidi.cpp

    r9596 r9639  
    361361        return QChar::DirON;
    362362
    363     RenderText *renderTxt = static_cast<RenderText *>( obj );
    364     if ( pos >= renderTxt->stringLength() )
     363    RenderText *renderTxt = static_cast<RenderText *>(obj);
     364    if (pos >= renderTxt->stringLength())
    365365        return QChar::DirON;
    366        
    367366    return renderTxt->text()[pos].direction();
    368367}
  • trunk/WebCore/khtml/rendering/break_lines.cpp

    r9595 r9639  
    113113        return true;
    114114
    115     return c->direction() == QChar::DirWS;
     115    // No other ascii chars are breakable.
     116    return false;
    116117#endif   
    117118}
  • trunk/WebCore/khtml/rendering/render_applet.cpp

    r9151 r9639  
    3737
    3838#include "java/kjavaappletwidget.h"
    39 #include "misc/htmltags.h"
    4039#include "html/html_objectimpl.h"
    4140
     
    104103            NodeImpl *child = element()->firstChild();
    105104            while (child) {
    106                 if (child->id() == ID_PARAM) {
     105                if (child->hasTagName(HTMLNames::param())) {
    107106                    HTMLParamElementImpl *p = static_cast<HTMLParamElementImpl *>(child);
    108107                    m_args.insert(p->name().string(), p->value().string());
  • trunk/WebCore/khtml/rendering/render_block.cpp

    r9595 r9639  
    4141#include "khtmlview.h"
    4242#include "khtml_part.h"
    43 #include "htmltags.h"
    4443
    4544using namespace DOM;
     
    476475        m_bottomMarginQuirk = style()->marginBottom().quirk;
    477476
    478         if (element() && element()->id() == ID_FORM && element()->isMalformed())
     477        if (element() && element()->hasTagName(HTMLNames::form()) && element()->isMalformed())
    479478            // See if this form is malformed (i.e., unclosed). If so, don't give the form
    480479            // a bottom margin.
  • trunk/WebCore/khtml/rendering/render_box.cpp

    r9357 r9639  
    257257        // render object very easily via the DOM.
    258258        HTMLElementImpl* body = document()->body();
    259         RenderObject* bodyObject = (body && body->id() == ID_BODY) ? body->renderer() : 0;
     259        RenderObject* bodyObject = (body && body->hasLocalName(HTMLNames::body())) ? body->renderer() : 0;
    260260        if (bodyObject) {
    261261            bgLayer = bodyObject->style()->backgroundLayers();
     
    370370        DOM::NodeImpl* elt = document()->ownerElement();
    371371        if (elt) {
    372             if (elt->id() == ID_FRAME)
     372            if (elt->hasTagName(HTMLNames::frame()))
    373373                isTransparent = false;
    374374            else {
     
    378378                // render object very easily via the DOM.
    379379                HTMLElementImpl* body = document()->body();
    380                 isTransparent = !body || body->id() != ID_FRAMESET; // Can't scroll a frameset document anyway.
     380                isTransparent = !body || !body->hasLocalName(HTMLNames::frameset()); // Can't scroll a frameset document anyway.
    381381            }
    382382        } else
  • trunk/WebCore/khtml/rendering/render_canvasimage.cpp

    r9608 r9639  
    3838#include "misc/helper.h"
    3939#include "misc/htmlattrs.h"
    40 #include "misc/htmltags.h"
    4140#include "html/html_formimpl.h"
    4241#include "html/html_canvasimpl.h"
    43 #include "html/dtd.h"
    4442#include "xml/dom2_eventsimpl.h"
    4543#include "html/html_documentimpl.h"
     
    192190   
    193191    if (drawnImage()) {
    194         HTMLCanvasElementImpl* i = (element() && element()->id() == ID_CANVAS) ? static_cast<HTMLCanvasElementImpl*>(element()) : 0;
     192        HTMLCanvasElementImpl* i = (element() && element()->hasTagName(HTMLNames::canvas())) ? static_cast<HTMLCanvasElementImpl*>(element()) : 0;
    195193        int oldOperation = 0;
    196194        if (i && !i->compositeOperator().isNull()){
  • trunk/WebCore/khtml/rendering/render_canvasimage.h

    r7457 r9639  
    2727#define RENDER_CANVASIMAGE_H
    2828
    29 #include "html/dtd.h"
    3029#include "html/html_elementimpl.h"
    3130#include "rendering/render_image.h"
  • trunk/WebCore/khtml/rendering/render_container.cpp

    r8589 r9639  
    227227    // For <q><p/></q>, if this object is the inline continuation of the <q>, we only want to generate
    228228    // :after content and not :before content.
    229     if (type == RenderStyle::BEFORE && isInlineContinuation())
     229    if (newContentWanted && type == RenderStyle::BEFORE && isInlineContinuation())
    230230        newContentWanted = false;
    231231
    232232    // Similarly, if we're the beginning of a <q>, and there's an inline continuation for our object,
    233233    // then we don't generate the :after content.
    234     if (type == RenderStyle::AFTER && isRenderInline() && continuation())
     234    if (newContentWanted && type == RenderStyle::AFTER && isRenderInline() && continuation())
    235235        newContentWanted = false;
    236236   
  • trunk/WebCore/khtml/rendering/render_flow.cpp

    r9157 r9639  
    4141
    4242#include "khtmlview.h"
    43 #include "htmltags.h"
    4443
    4544using namespace DOM;
     
    655654    // But skip the body element if it is outermost.
    656655    if (element() && element()->isContentEditable()) {
    657         if (element()->parentNode() && !element()->parentNode()->isContentEditable() && element()->id() != ID_BODY)
     656        if (element()->parentNode() && !element()->parentNode()->isContentEditable() && !element()->hasTagName(HTMLNames::body()))
    658657            p->addFocusRingRect(_tx, _ty, width(), height());
    659658        return;
  • trunk/WebCore/khtml/rendering/render_form.cpp

    r9479 r9639  
    798798    for (RenderObject* legend = firstChild(); legend; legend = legend->nextSibling()) {
    799799      if (!legend->isFloatingOrPositioned() && legend->element() &&
    800           legend->element()->id() == ID_LEGEND)
     800          legend->element()->hasTagName(HTMLNames::legend()))
    801801        return legend;
    802802    }
     
    11921192
    11931193        for (listIndex = 0; listIndex < int(listItems.size()); listIndex++) {
    1194             if (listItems[listIndex]->id() == ID_OPTGROUP) {
     1194            if (listItems[listIndex]->hasTagName(HTMLNames::optgroup())) {
    11951195                QString label = listItems[listIndex]->getAttribute(ATTR_LABEL).string();
    11961196                label.replace(QChar('\\'), backslashAsCurrencySymbol());
     
    12161216#endif
    12171217            }
    1218             else if (listItems[listIndex]->id() == ID_OPTION) {
     1218            else if (listItems[listIndex]->hasTagName(HTMLNames::option())) {
    12191219                QString itemText = static_cast<HTMLOptionElementImpl*>(listItems[listIndex])->text().string();
    12201220                itemText.replace(QChar('\\'), backslashAsCurrencySymbol());
     
    12231223                itemText = itemText.stripWhiteSpace();
    12241224               
    1225                 if (listItems[listIndex]->parentNode()->id() == ID_OPTGROUP)
     1225                if (listItems[listIndex]->parentNode()->hasTagName(HTMLNames::optgroup()))
    12261226                    itemText.prepend("    ");
    12271227
     
    13491349    bool foundOption = false;
    13501350    for (uint i = 0; i < listItems.size() && !foundOption; i++)
    1351         foundOption = (listItems[i]->id() == ID_OPTION);
     1351        foundOption = (listItems[i]->hasTagName(HTMLNames::option()));
    13521352
    13531353    m_widget->setEnabled(foundOption && ! element()->disabled());
     
    13631363    if(index >= 0 && index < int(listItems.size()))
    13641364    {
    1365         bool found = ( listItems[index]->id() == ID_OPTION );
     1365        bool found = (listItems[index]->hasTagName(HTMLNames::option()));
    13661366
    13671367        if ( !found ) {
    13681368            // this one is not selectable,  we need to find an option element
    13691369            while ( ( unsigned ) index < listItems.size() ) {
    1370                 if ( listItems[index]->id() == ID_OPTION ) {
     1370                if (listItems[index]->hasTagName(HTMLNames::option())) {
    13711371                    found = true;
    13721372                    break;
     
    13771377            if ( !found ) {
    13781378                while ( index >= 0 ) {
    1379                     if ( listItems[index]->id() == ID_OPTION ) {
     1379                    if (listItems[index]->hasTagName(HTMLNames::option())) {
    13801380                        found = true;
    13811381                        break;
     
    13911391
    13921392            for ( unsigned int i = 0; i < listItems.size(); ++i )
    1393                 if ( listItems[i]->id() == ID_OPTION && i != (unsigned int) index )
     1393                if (listItems[i]->hasTagName(HTMLNames::option()) && i != (unsigned int) index)
    13941394                    static_cast<HTMLOptionElementImpl*>( listItems[i] )->m_selected = false;
    13951395
     
    14121412        // don't use setSelected() here because it will cause us to be called
    14131413        // again with updateSelection.
    1414         if ( listItems[i]->id() == ID_OPTION )
     1414        if (listItems[i]->hasTagName(HTMLNames::option()))
    14151415            static_cast<HTMLOptionElementImpl*>( listItems[i] )
    14161416                ->m_selected = static_cast<KListBox*>( m_widget )->isSelected( i );
     
    14541454        KListBox *listBox = static_cast<KListBox*>(m_widget);
    14551455        for (i = 0; i < int(listItems.size()); i++)
    1456             listBox->setSelected(i,listItems[i]->id() == ID_OPTION &&
     1456            listBox->setSelected(i, listItems[i]->hasTagName(HTMLNames::option()) &&
    14571457                                static_cast<HTMLOptionElementImpl*>(listItems[i])->selected());
    14581458    }
     
    14621462        i = listItems.size();
    14631463        while (i--)
    1464             if (listItems[i]->id() == ID_OPTION) {
     1464            if (listItems[i]->hasTagName(HTMLNames::option())) {
    14651465                if (found)
    14661466                    static_cast<HTMLOptionElementImpl*>(listItems[i])->m_selected = false;
  • trunk/WebCore/khtml/rendering/render_frames.cpp

    r9151 r9639  
    3535#include "xml/dom2_eventsimpl.h"
    3636#include "xml/dom_docimpl.h"
    37 #include "misc/htmltags.h"
    3837#include "khtmlview.h"
    3938#include "khtml_part.h"
     
    670669  setNeedsLayoutAndMinMaxRecalc();
    671670
    672   if (element()->id() == ID_OBJECT) {
     671  if (element()->hasTagName(HTMLNames::object())) {
    673672
    674673      HTMLObjectElementImpl *o = static_cast<HTMLObjectElementImpl *>(element());
     
    677676      HTMLEmbedElementImpl *embed = 0;
    678677      for (NodeImpl *child = o->firstChild(); child; ) {
    679           if (child->id() == ID_EMBED) {
     678          if (child->hasTagName(HTMLNames::embed())) {
    680679              embed = static_cast<HTMLEmbedElementImpl *>( child );
    681680              break;
    682           } else if (child->id() == ID_OBJECT) {
     681          } else if (child->hasTagName(HTMLNames::object())) {
    683682              child = child->nextSibling();         // Don't descend into nested OBJECT tags
    684683          } else {
     
    720719      NodeImpl *child = o->firstChild();
    721720      while (child && (url.isEmpty() || serviceType.isEmpty() || !embed)) {
    722           if (child->id() == ID_PARAM) {
     721          if (child->hasTagName(HTMLNames::param())) {
    723722              HTMLParamElementImpl *p = static_cast<HTMLParamElementImpl *>( child );
    724723              QString name = p->name().string().lower();
     
    811810      m_hasFallbackContent = false;
    812811      for (NodeImpl *child = o->firstChild(); child && !m_hasFallbackContent; child = child->nextSibling()) {
    813           if ((!child->isTextNode() && child->id() != ID_EMBED && child->id() != ID_PARAM) || // Discount <embed> and <param>
     812          if ((!child->isTextNode() && !child->hasTagName(HTMLNames::embed()) && !child->hasTagName(HTMLNames::param())) || // Discount <embed> and <param>
    814813              (child->isTextNode() && !child->containsOnlyWhitespace()))
    815814              m_hasFallbackContent = true;
     
    818817      if (!success && m_hasFallbackContent)
    819818          o->renderFallbackContent();
    820   } else if ( element()->id() == ID_EMBED ) {
     819  } else if (element()->hasTagName(HTMLNames::embed())) {
    821820
    822821      HTMLEmbedElementImpl *o = static_cast<HTMLEmbedElementImpl *>(element());
     
    845844      part->requestObject( this, url, serviceType, paramNames, paramValues );
    846845  } else {
    847       assert(element()->id() == ID_IFRAME);
     846      assert(element()->hasTagName(HTMLNames::iframe()));
    848847      HTMLIFrameElementImpl *o = static_cast<HTMLIFrameElementImpl *>(element());
    849848      url = o->m_URL.string();
     
    891890      int marginw = -1;
    892891      int marginh = -1;
    893       if ( element()->id() == ID_IFRAME) {
     892      if (element()->hasTagName(HTMLNames::iframe())) {
    894893          HTMLIFrameElementImpl *frame = static_cast<HTMLIFrameElementImpl *>(element());
    895894          if(frame->m_frameBorder)
     
    911910#endif
    912911          KHTMLView *htmlView = static_cast<KHTMLView *>(view);
    913           htmlView->setIgnoreWheelEvents( element()->id() == ID_IFRAME );
     912          htmlView->setIgnoreWheelEvents(element()->hasTagName(HTMLNames::iframe()));
    914913          if(marginw != -1) htmlView->setMarginWidth(marginw);
    915914          if(marginh != -1) htmlView->setMarginHeight(marginh);
  • trunk/WebCore/khtml/rendering/render_image.cpp

    r9608 r9639  
    3838#include "misc/helper.h"
    3939#include "misc/htmlattrs.h"
    40 #include "misc/htmltags.h"
    4140#include "html/html_formimpl.h"
    4241#include "html/html_imageimpl.h"
    43 #include "html/dtd.h"
    4442#include "xml/dom2_eventsimpl.h"
    4543#include "html/html_documentimpl.h"
     
    425423
    426424//             p->drawPixmap( offs.x(), y, pix, rect.x(), rect.y(), rect.width(), rect.height() );
    427              HTMLImageElementImpl* i = (element() && element()->id() == ID_IMG) ? static_cast<HTMLImageElementImpl*>(element()) : 0;
     425             HTMLImageElementImpl* i = (element() && element()->hasTagName(HTMLNames::img())) ? static_cast<HTMLImageElementImpl*>(element()) : 0;
    428426             if (i && !i->compositeOperator().isNull()){
    429427                p->drawPixmap (offs, pix, rect, i->compositeOperator());
     
    492490HTMLMapElementImpl* RenderImage::imageMap()
    493491{
    494     HTMLImageElementImpl* i = element()->id() == ID_IMG ? static_cast<HTMLImageElementImpl*>(element()) : 0;
     492    HTMLImageElementImpl* i = element()->hasTagName(HTMLNames::img()) ? static_cast<HTMLImageElementImpl*>(element()) : 0;
    495493    return i ? i->getDocument()->getImageMap(i->imageMap()) : 0;
    496494}
     
    518516void RenderImage::updateAltText()
    519517{
    520     if (element()->id() == ID_INPUT)
     518    if (element()->hasTagName(HTMLNames::input()))
    521519        alt = static_cast<HTMLInputElementImpl*>(element())->altText();
    522     else if (element()->id() == ID_IMG)
     520    else if (element()->hasTagName(HTMLNames::img()))
    523521        alt = static_cast<HTMLImageElementImpl*>(element())->altText();
    524522}
  • trunk/WebCore/khtml/rendering/render_image.h

    r8687 r9639  
    2424#define RENDER_IMAGE_H
    2525
    26 #include "html/dtd.h"
    2726#include "html/html_elementimpl.h"
    2827#include "rendering/render_replaced.h"
  • trunk/WebCore/khtml/rendering/render_layer.cpp

    r9155 r9639  
    5050#include "xml/dom_docimpl.h"
    5151#include "xml/dom2_eventsimpl.h"
    52 #include "misc/htmltags.h"
    5352#include "html/html_blockimpl.h"
    5453
     
    14681467    int result = m_layer->renderer()->style()->marqueeSpeed();
    14691468    DOM::NodeImpl* elt = m_layer->renderer()->element();
    1470     if (elt && elt->id() == ID_MARQUEE) {
     1469    if (elt && elt->hasTagName(HTMLNames::marquee())) {
    14711470        HTMLMarqueeElementImpl* marqueeElt = static_cast<HTMLMarqueeElementImpl*>(elt);
    14721471        result = kMax(result, marqueeElt->minimumDelay());
  • trunk/WebCore/khtml/rendering/render_line.cpp

    r9595 r9639  
    3838
    3939#include "khtmlview.h"
    40 #include "htmltags.h"
    4140
    4241using namespace DOM;
  • trunk/WebCore/khtml/rendering/render_list.cpp

    r9595 r9639  
    2727
    2828#include "xml/dom_docimpl.h"
    29 #include "misc/htmltags.h"
     29
     30#include "htmlnames.h"
    3031
    3132#include <qpainter.h>
     
    3839
    3940using DOM::DocumentImpl;
     41using DOM::HTMLNames;
    4042using namespace khtml;
    4143
     
    214216       
    215217        if (currChild->style()->htmlHacks() && currChild->element() &&
    216             (currChild->element()->id() == ID_UL || currChild->element()->id() == ID_OL))
     218            (currChild->element()->hasTagName(HTMLNames::ul())|| currChild->element()->hasTagName(HTMLNames::ol())))
    217219            break;
    218220           
  • trunk/WebCore/khtml/rendering/render_object.cpp

    r9595 r9639  
    4444#include "render_block.h"
    4545#include "render_flexbox.h"
     46#include "htmlnames.h"
    4647
    4748#if APPLE_CHANGES
     
    176177bool RenderObject::isBody() const
    177178{
    178     return element() && element()->renderer() == this && element()->id() == ID_BODY;
     179    return element() && element()->renderer() == this && element()->hasTagName(HTMLNames::body());
    179180}
    180181
    181182bool RenderObject::isHR() const
    182183{
    183     return element() && element()->id() == ID_HR;
     184    return element() && element()->hasTagName(HTMLNames::hr());
    184185}
    185186
    186187bool RenderObject::isHTMLMarquee() const
    187188{
    188     return element() && element()->renderer() == this && element()->id() == ID_MARQUEE;
     189    return element() && element()->renderer() == this && element()->hasTagName(HTMLNames::marquee());
    189190}
    190191
     
    738739    if (isFloating() || (isCompact() && isInline()) ||
    739740        (isInlineBlockOrInlineTable() && !isHTMLMarquee()) ||
    740         (element() && (element()->id() == ID_BUTTON || element()->id() == ID_LEGEND)))
     741        (element() && (element()->hasTagName(HTMLNames::button()) || element()->hasTagName(HTMLNames::legend()))))
    741742        return true;
    742743   
     
    13271328    if (element() && element()->isLink()) ts << "anchor ";
    13281329    if (element() && element()->focused()) ts << "focus ";
    1329     if (element()) ts << " <" <<  getTagName(element()->id()).string() << ">";
     1330    if (element()) ts << " <" <<  element()->localName().string() << ">";
    13301331    ts << " (" << xPos() << "," << yPos() << "," << width() << "," << height() << ")"
    13311332        << (isTableCell() ?
     
    15571558        // the canvas.  Just dirty the entire canvas when our style changes substantially.
    15581559        if (d >= RenderStyle::Repaint && element() &&
    1559             (element()->id() == ID_HTML || element()->id() == ID_BODY))
     1560            (element()->hasTagName(HTMLNames::html()) || element()->hasTagName(HTMLNames::body())))
    15601561            canvas()->repaint();
    15611562        else if (m_parent && !isText()) {
     
    21892190            curr = curr->continuation();
    21902191    } while (curr && decorations && (!quirksMode || !curr->element() ||
    2191                                      (curr->element()->id() != ID_A && curr->element()->id() != ID_FONT)));
     2192                                     (!curr->element()->hasTagName(HTMLNames::a()) && !curr->element()->hasTagName(HTMLNames::font()))));
    21922193
    21932194    // If we bailed out, use the element we bailed out at (typically a <font> or <a> element).
     
    23232324
    23242325    if (image && image->pixmap_size() == image->valid_rect().size() && parent()) {
    2325         if (canvas() && element() && (element()->id() == ID_HTML || element()->id() == ID_BODY))
     2326        if (canvas() && element() && (element()->hasTagName(HTMLNames::html()) || element()->hasTagName(HTMLNames::body())))
    23262327            canvas()->repaint();    // repaint the entire canvas since the background gets propagated up
    23272328        else
  • trunk/WebCore/khtml/rendering/render_style.cpp

    r9356 r9639  
    608608RenderStyle* RenderStyle::getPseudoStyle(PseudoId pid)
    609609{
     610    if (!pseudoStyle)
     611        return 0;
     612
    610613    RenderStyle *ps = 0;
    611614    if (noninherited_flags._styleType==NOPSEUDO) {
  • trunk/WebCore/khtml/rendering/render_style.h

    r9165 r9639  
    300300public:
    301301    StyleSurroundData();
    302 
    303     StyleSurroundData(const StyleSurroundData& o );
     302    StyleSurroundData(const StyleSurroundData& o);
     303   
     304    MAIN_THREAD_ALLOCATED;
     305
    304306    bool operator==(const StyleSurroundData& o) const;
    305307    bool operator!=(const StyleSurroundData& o) const {
     
    321323public:
    322324    StyleBoxData();
    323 
    324     StyleBoxData(const StyleBoxData& o );
    325 
     325    StyleBoxData(const StyleBoxData& o);
     326
     327    MAIN_THREAD_ALLOCATED;
    326328
    327329    // copy and assignment
     
    400402public:
    401403    StyleVisualData();
    402 
    403404    ~StyleVisualData();
    404 
    405405    StyleVisualData(const StyleVisualData& o );
     406
     407    MAIN_THREAD_ALLOCATED;
    406408
    407409    bool operator==( const StyleVisualData &o ) const {
     
    522524    StyleBackgroundData(const StyleBackgroundData& o );
    523525
     526    MAIN_THREAD_ALLOCATED;
     527
    524528    bool operator==(const StyleBackgroundData& o) const;
    525529    bool operator!=(const StyleBackgroundData &o) const {
     
    544548    StyleMarqueeData(const StyleMarqueeData& o);
    545549   
     550    MAIN_THREAD_ALLOCATED;
     551
    546552    bool operator==(const StyleMarqueeData& o) const;
    547553    bool operator!=(const StyleMarqueeData& o) const {
     
    571577    StyleFlexibleBoxData();
    572578    StyleFlexibleBoxData(const StyleFlexibleBoxData& o);
     579
     580    MAIN_THREAD_ALLOCATED;
    573581
    574582    bool operator==(const StyleFlexibleBoxData& o) const;
     
    677685    ~StyleCSS3NonInheritedData();
    678686    StyleCSS3NonInheritedData(const StyleCSS3NonInheritedData& o);
     687
     688    MAIN_THREAD_ALLOCATED;
    679689
    680690#ifndef KHTML_NO_XBL
     
    716726    StyleCSS3InheritedData(const StyleCSS3InheritedData& o);
    717727
     728    MAIN_THREAD_ALLOCATED;
     729
    718730    bool operator==(const StyleCSS3InheritedData& o) const;
    719731    bool operator!=(const StyleCSS3InheritedData &o) const {
     
    770782    StyleInheritedData(const StyleInheritedData& o );
    771783
     784    MAIN_THREAD_ALLOCATED;
     785   
    772786    bool operator==(const StyleInheritedData& o) const;
    773787    bool operator != ( const StyleInheritedData &o ) const {
  • trunk/WebCore/khtml/rendering/render_table.cpp

    r9157 r9639  
    3232#include "rendering/table_layout.h"
    3333#include "html/html_tableimpl.h"
    34 #include "misc/htmltags.h"
    3534#include "misc/htmlattrs.h"
     35#include "htmlnames.h"
    3636#include "xml/dom_docimpl.h"
    3737
     
    113113    RenderObject *o = child;
    114114
    115     if (child->element() && child->element()->id() == ID_FORM) {
     115    if (child->element() && child->element()->hasTagName(HTMLNames::form())) {
    116116        RenderContainer::addChild(child,beforeChild);
    117117        return;
     
    263263    RenderObject *child = firstChild();
    264264    while( child ) {
    265         if ( child->needsLayout() && !(child->element() && child->element()->id() == ID_FORM))
     265        if ( child->needsLayout() && !(child->element() && child->element()->hasTagName(HTMLNames::form())))
    266266            child->layout();
    267267        if ( child->isTableSection() ) {
     
    850850    RenderObject *row = child;
    851851
    852     if (child->element() && child->element()->id() == ID_FORM) {
     852    if (child->element() && child->element()->hasTagName(HTMLNames::form())) {
    853853        RenderContainer::addChild(child,beforeChild);
    854854        return;
     
    14961496                       (beforeChild ? beforeChild->renderName() : "0") << " )" << endl;
    14971497#endif
    1498     if (child->element() && child->element()->id() == ID_FORM) {
     1498    if (child->element() && child->element()->hasTagName(HTMLNames::form())) {
    14991499        RenderContainer::addChild(child,beforeChild);
    15001500        return;
     
    16071607    int oldCSpan = cSpan;
    16081608    DOM::NodeImpl* node = element();
    1609     if (node && (node->id() == ID_TD || node->id() == ID_TH)) {
     1609    if (node && (node->hasTagName(HTMLNames::td()) || node->hasTagName(HTMLNames::th()))) {
    16101610        DOM::HTMLTableCellElementImpl *tc = static_cast<DOM::HTMLTableCellElementImpl *>(node);
    16111611        cSpan = tc->colSpan();
     
    22912291    int oldSpan = _span;
    22922292    DOM::NodeImpl *node = element();
    2293     if (node && (node->id() == ID_COL || node->id() == ID_COLGROUP)) {
     2293    if (node && (node->hasTagName(HTMLNames::col()) || node->hasTagName(HTMLNames::colgroup()))) {
    22942294        DOM::HTMLTableColElementImpl *tc = static_cast<DOM::HTMLTableColElementImpl *>(node);
    22952295        _span = tc->span();
  • trunk/WebCore/khtml/xml/dom2_rangeimpl.cpp

    r9169 r9639  
    3030#include "dom_xmlimpl.h"
    3131#include "html/html_elementimpl.h"
    32 #include "misc/htmltags.h"
    3332#include "editing/markup.h"
    3433#include "editing/visible_position.h"
  • trunk/WebCore/khtml/xml/dom2_traversalimpl.cpp

    r9153 r9639  
    2727#include "xml/dom_docimpl.h"
    2828
    29 #include "htmltags.h"
    30 
    3129namespace DOM {
    3230
  • trunk/WebCore/khtml/xml/dom_atomicstring.cpp

    r9616 r9639  
    2727// runs at init time.
    2828
    29 #if APPLE_CHANGES
    30 #define AVOID_STATIC_CONSTRUCTORS 1
    31 #endif
    32 
    33 #if AVOID_STATIC_CONSTRUCTORS
    3429#define KHTML_ATOMICSTRING_HIDE_GLOBALS 1
    35 #endif
    3630
    3731#include "dom_atomicstring.h"
     
    5246inline bool equal(DOMStringImpl* const& r, const char* const& s)
    5347{
    54     if (!r && !s) return true;
    55     if (!r || !s) return false;
    56 
    5748    int length = r->l;
    5849    const QChar *d = r->s;
     
    10192inline bool equal(DOMStringImpl* const& str, const QCharBuffer &buf)
    10293{
    103     const uint32_t *strChars = reinterpret_cast<const uint32_t *>(str->s);
    104     const uint32_t *bufChars = reinterpret_cast<const uint32_t *>(buf.s);
    105 
    106     if (!strChars && !bufChars) return true;
    107     if (!strChars || !bufChars) return false;
    108    
    10994    uint strLength = str->l;
    11095    uint bufLength = buf.length;
     
    11297        return false;
    11398
     99    const uint32_t *strChars = reinterpret_cast<const uint32_t *>(str->s);
     100    const uint32_t *bufChars = reinterpret_cast<const uint32_t *>(buf.s);
    114101   
    115102    uint halfLength = strLength >> 1;
     
    166153}
    167154
    168 // Global constants for property name strings.
    169 
    170 #if !AVOID_STATIC_CONSTRUCTORS
    171     // Define an AtomicString in the normal way.
    172     #define DEFINE_GLOBAL(name, string) extern const AtomicString name ## Atom(string);
    173 
    174     extern const AtomicString nullAtom;
    175     extern const AtomicString emptyAtom;
    176 #else
    177     // Define an AtomicString-sized array of pointers to avoid static initialization.
    178     // Use an array of pointers instead of an array of char in case there is some alignment issue.
    179     #define DEFINE_GLOBAL(name, string) \
    180         void * name ## Atom[(sizeof(AtomicString) + sizeof(void *) - 1) / sizeof(void *)];
    181 
    182     DEFINE_GLOBAL(null, ignored)
    183     DEFINE_GLOBAL(empty, ignored)
    184 #endif
    185 
    186 #define CALL_DEFINE_GLOBAL(name) DEFINE_GLOBAL(name, #name)
    187 KHTML_ATOMICSTRING_EACH_GLOBAL(CALL_DEFINE_GLOBAL)
     155// Define an AtomicString-sized array of pointers to avoid static initialization.
     156// Use an array of pointers instead of an array of char in case there is some alignment issue.
     157#define DEFINE_GLOBAL(name) \
     158    void* name ## Atom[(sizeof(AtomicString) + sizeof(void*) - 1) / sizeof(void*)];
     159
     160DEFINE_GLOBAL(null)
     161DEFINE_GLOBAL(empty)
     162DEFINE_GLOBAL(text)
     163DEFINE_GLOBAL(comment)
     164DEFINE_GLOBAL(star)
    188165
    189166void AtomicString::init()
    190167{
    191 #if AVOID_STATIC_CONSTRUCTORS
    192168    static bool initialized;
    193169    if (!initialized) {
     
    195171        new (&nullAtom) AtomicString;
    196172        new (&emptyAtom) AtomicString("");
    197        
    198         #define PLACEMENT_NEW_GLOBAL(name, string) new (&name ## PropertyName) AtomicString(string);
    199         #define CALL_PLACEMENT_NEW_GLOBAL(name) PLACEMENT_NEW_GLOBAL(name, #name)
    200         KHTML_ATOMICSTRING_EACH_GLOBAL(CALL_PLACEMENT_NEW_GLOBAL)
     173        new (&textAtom) AtomicString("#text");
     174        new (&commentAtom) AtomicString("#comment");
     175        new (&starAtom) AtomicString("*");
     176
    201177        initialized = true;
    202178    }
    203 #endif
    204179}
    205180
  • trunk/WebCore/khtml/xml/dom_atomicstring.h

    r9509 r9639  
    5656    khtml::Length* toLengthArray(int& len) const { return m_string.toLengthArray(len); }
    5757    khtml::Length* toCoordsArray(int& len) const { return m_string.toCoordsArray(len); }
    58    
     58
    5959    bool isNull() const { return m_string.isNull(); }
    6060    bool isEmpty() const { return m_string.isEmpty(); }
     
    110110// List of property names, passed to a macro so we can do set them up various
    111111// ways without repeating the list.
    112 #define KHTML_ATOMICSTRING_EACH_GLOBAL(macro)
    113112
    114     // Define external global variables for all property names above (and one more).
     113// Define external global variables for the commonly used atomic strings.
    115114#if !KHTML_ATOMICSTRING_HIDE_GLOBALS
    116115    extern const AtomicString nullAtom;
    117116    extern const AtomicString emptyAtom;
    118 #define KHTML_ATOMICSTRING_DECLARE_GLOBAL(name) extern const AtomicString name ## PropertyName;
    119     KHTML_ATOMICSTRING_EACH_GLOBAL(KHTML_ATOMICSTRING_DECLARE_GLOBAL)
    120     KHTML_ATOMICSTRING_DECLARE_GLOBAL(specialPrototype)
    121 #undef KHTML_ATOMICSTRING_DECLARE_GLOBAL
     117    extern const AtomicString textAtom;
     118    extern const AtomicString commentAtom;
     119    extern const AtomicString starAtom;
    122120#endif
    123121       
  • trunk/WebCore/khtml/xml/dom_docimpl.cpp

    r9613 r9639  
    3535#include "xml/xml_tokenizer.h"
    3636
    37 #include "xml_namespace_table.h"
    38 
    3937#include "css/csshelper.h"
    4038#include "css/cssstyleselector.h"
     
    6664#include "khtmlpart_p.h"
    6765
    68 #include "html/html_baseimpl.h"
    69 #include "html/html_blockimpl.h"
    70 #include "html/html_canvasimpl.h"
     66// FIXME: We want to cut the remaining HTML dependencies so that we don't need to include these files.
    7167#include "html/html_documentimpl.h"
    72 #include "html/html_formimpl.h"
    7368#include "html/html_headimpl.h"
    7469#include "html/html_imageimpl.h"
    75 #include "html/html_listimpl.h"
    76 #include "html/html_miscimpl.h"
    77 #include "html/html_tableimpl.h"
    78 #include "html/html_objectimpl.h"
     70#include "htmlfactory.h"
    7971
    8072#include "cssvalues.h"
     
    505497}
    506498
    507 ElementImpl *DocumentImpl::createElement( const DOMString &name, int &exceptioncode )
    508 {
    509     return new XMLElementImpl( document, name.implementation() );
     499ElementImpl *DocumentImpl::createElement(const DOMString &name, int &exceptionCode)
     500{
     501    return createElementNS(emptyAtom, name, exceptionCode);
    510502}
    511503
     
    574566        case Node::ELEMENT_NODE: {
    575567            ElementImpl *oldElement = static_cast<ElementImpl *>(importedNode);
    576             DocumentImpl *oldDoc = oldElement->getDocument();
    577             static DOMString HTMLNamespace(XHTML_NAMESPACE);
    578             DOMString elementNamespace = oldElement->isHTMLElement() ? HTMLNamespace : oldElement->namespaceURI();
    579             ElementImpl *newElement = createElementNS(elementNamespace.implementation(), oldElement->tagName(), exceptioncode);
     568            // FIXME: Prefix is lost.  Is that right?
     569            ElementImpl *newElement = createElementNS(oldElement->namespaceURI(), oldElement->localName(), exceptioncode);
    580570            if (exceptioncode != 0)
    581571                return 0;
     
    598588                    }
    599589
    600                     NodeImpl::Id nodeId = attrId(oldDoc->namespaceURI(attr->attrImpl()->id()), localName.implementation(), false /* allocate */);
     590                    // FIXME: Lose the namespace here for now.  This code will change soon anyway.
     591                    NodeImpl::Id nodeId = attrId(0, localName.implementation(), false /* allocate */);
    601592                    newElement->setAttribute(nodeId, value.implementation(), exceptioncode);
    602593                    if (exceptioncode != 0) {
     
    637628ElementImpl *DocumentImpl::createElementNS( const DOMString &_namespaceURI, const DOMString &_qualifiedName, int &exceptioncode)
    638629{
    639     ElementImpl *e = 0;
    640     QString qName = _qualifiedName.string();
    641     int colonPos = qName.find(':',0);
    642 
    643     if (_namespaceURI == XHTML_NAMESPACE) {
    644         // User requested an element in the XHTML namespace - this means we create a specific element
    645         // (elements not in this namespace are treated as normal XML elements)
    646         e = createHTMLElement(qName.mid(colonPos+1), exceptioncode);
    647         if (exceptioncode)
     630    // Split the name.
     631    int exceptionCode = 0;
     632    ElementImpl* e = 0;
     633    DOMString prefix, localName;
     634    int colonPos = _qualifiedName.find(':');
     635    if (colonPos >= 0) {
     636        prefix = _qualifiedName.substring(0, colonPos);
     637        localName = _qualifiedName.substring(colonPos+1, _qualifiedName.length() - colonPos);
     638    }
     639    else
     640        localName = _qualifiedName;
     641   
     642    // FIXME: Use registered namespaces and look up in a hash to find the right factory.
     643    if (_namespaceURI == HTMLNames::xhtmlNamespaceURI()) {
     644        // FIXME: Really should only be done from the public DOM API.  Internal callers know the name is valid.
     645        if (!isValidName(localName)) {
     646            exceptioncode = DOMException::INVALID_CHARACTER_ERR;
    648647            return 0;
    649         if (e && colonPos >= 0) {
    650             e->setPrefix(qName.left(colonPos), exceptioncode);
    651             if (exceptioncode) {
    652                 delete e;
     648        }
     649        e = HTMLElementFactory::createHTMLElement(AtomicString(localName), this, 0, false);
     650        if (e && !prefix.isNull()) {
     651            e->setPrefix(AtomicString(prefix), exceptionCode);
     652            if (exceptionCode)
    653653                return 0;
    654             }
    655         }
    656     }
    657 
     654        }
     655    }
     656   
    658657    if (!e)
    659         e = new XMLElementImpl( document, _qualifiedName.implementation(), _namespaceURI.implementation() );
    660 
     658        e = new ElementImpl(QualifiedName(AtomicString(prefix), AtomicString(localName), AtomicString(_namespaceURI)), document);
     659   
    661660    return e;
    662661}
     
    812811}
    813812
    814 ElementImpl *DocumentImpl::createHTMLElement( const DOMString &name, int &exceptioncode )
    815 {
    816     if (!isValidName(name)) {
    817         exceptioncode = DOMException::INVALID_CHARACTER_ERR;
    818         return 0;
    819     }
    820     return createHTMLElement(tagId(0, name.implementation(), false));
    821 }
    822 
    823 ElementImpl *DocumentImpl::createHTMLElement(unsigned short tagID)
    824 {
    825     switch (tagID)
    826     {
    827     case ID_HTML:
    828         return new HTMLHtmlElementImpl(docPtr());
    829     case ID_HEAD:
    830         return new HTMLHeadElementImpl(docPtr());
    831     case ID_BODY:
    832         return new HTMLBodyElementImpl(docPtr());
    833 
    834 // head elements
    835     case ID_BASE:
    836         return new HTMLBaseElementImpl(docPtr());
    837     case ID_LINK:
    838         return new HTMLLinkElementImpl(docPtr());
    839     case ID_META:
    840         return new HTMLMetaElementImpl(docPtr());
    841     case ID_STYLE:
    842         return new HTMLStyleElementImpl(docPtr());
    843     case ID_TITLE:
    844         return new HTMLTitleElementImpl(docPtr());
    845 
    846 // frames
    847     case ID_FRAME:
    848         return new HTMLFrameElementImpl(docPtr());
    849     case ID_FRAMESET:
    850         return new HTMLFrameSetElementImpl(docPtr());
    851     case ID_IFRAME:
    852         return new HTMLIFrameElementImpl(docPtr());
    853 
    854 // form elements
    855 // ### FIXME: we need a way to set form dependency after we have made the form elements
    856     case ID_FORM:
    857         return new HTMLFormElementImpl(docPtr());
    858     case ID_BUTTON:
    859         return new HTMLButtonElementImpl(docPtr());
    860     case ID_FIELDSET:
    861         return new HTMLFieldSetElementImpl(docPtr());
    862     case ID_INPUT:
    863         return new HTMLInputElementImpl(docPtr());
    864     case ID_ISINDEX:
    865         return new HTMLIsIndexElementImpl(docPtr());
    866     case ID_LABEL:
    867         return new HTMLLabelElementImpl(docPtr());
    868     case ID_LEGEND:
    869         return new HTMLLegendElementImpl(docPtr());
    870     case ID_OPTGROUP:
    871         return new HTMLOptGroupElementImpl(docPtr());
    872     case ID_OPTION:
    873         return new HTMLOptionElementImpl(docPtr());
    874     case ID_SELECT:
    875         return new HTMLSelectElementImpl(docPtr());
    876     case ID_TEXTAREA:
    877         return new HTMLTextAreaElementImpl(docPtr());
    878 
    879 // lists
    880     case ID_DL:
    881         return new HTMLDListElementImpl(docPtr());
    882     case ID_DD:
    883         return new HTMLGenericElementImpl(docPtr(), tagID);
    884     case ID_DT:
    885         return new HTMLGenericElementImpl(docPtr(), tagID);
    886     case ID_UL:
    887         return new HTMLUListElementImpl(docPtr());
    888     case ID_OL:
    889         return new HTMLOListElementImpl(docPtr());
    890     case ID_DIR:
    891         return new HTMLDirectoryElementImpl(docPtr());
    892     case ID_MENU:
    893         return new HTMLMenuElementImpl(docPtr());
    894     case ID_LI:
    895         return new HTMLLIElementImpl(docPtr());
    896 
    897 // formatting elements (block)
    898     case ID_BLOCKQUOTE:
    899         return new HTMLBlockquoteElementImpl(docPtr());
    900     case ID_DIV:
    901         return new HTMLDivElementImpl(docPtr());
    902     case ID_H1:
    903     case ID_H2:
    904     case ID_H3:
    905     case ID_H4:
    906     case ID_H5:
    907     case ID_H6:
    908         return new HTMLHeadingElementImpl(docPtr(), tagID);
    909     case ID_HR:
    910         return new HTMLHRElementImpl(docPtr());
    911     case ID_P:
    912         return new HTMLParagraphElementImpl(docPtr());
    913     case ID_PRE:
    914     case ID_XMP:
    915     case ID_PLAINTEXT:
    916         return new HTMLPreElementImpl(docPtr(), tagID);
    917     case ID_LAYER:
    918         return new HTMLLayerElementImpl(docPtr());
    919 
    920 // font stuff
    921     case ID_BASEFONT:
    922         return new HTMLBaseFontElementImpl(docPtr());
    923     case ID_FONT:
    924         return new HTMLFontElementImpl(docPtr());
    925 
    926 // ins/del
    927     case ID_DEL:
    928     case ID_INS:
    929         return new HTMLModElementImpl(docPtr(), tagID);
    930 
    931 // anchor
    932     case ID_A:
    933         return new HTMLAnchorElementImpl(docPtr());
    934 
    935 // images
    936     case ID_IMG:
    937         return new HTMLImageElementImpl(docPtr());
    938     case ID_MAP:
    939         return new HTMLMapElementImpl(docPtr());
    940     case ID_AREA:
    941         return new HTMLAreaElementImpl(docPtr());
    942     case ID_CANVAS:
    943         return new HTMLCanvasElementImpl(docPtr());
    944 
    945 // objects, applets and scripts
    946     case ID_APPLET:
    947         return new HTMLAppletElementImpl(docPtr());
    948     case ID_EMBED:
    949         return new HTMLEmbedElementImpl(docPtr());
    950     case ID_OBJECT:
    951         return new HTMLObjectElementImpl(docPtr());
    952     case ID_PARAM:
    953         return new HTMLParamElementImpl(docPtr());
    954     case ID_SCRIPT:
    955         return new HTMLScriptElementImpl(docPtr());
    956 
    957 // tables
    958     case ID_TABLE:
    959         return new HTMLTableElementImpl(docPtr());
    960     case ID_CAPTION:
    961         return new HTMLTableCaptionElementImpl(docPtr());
    962     case ID_COLGROUP:
    963     case ID_COL:
    964         return new HTMLTableColElementImpl(docPtr(), tagID);
    965     case ID_TR:
    966         return new HTMLTableRowElementImpl(docPtr());
    967     case ID_TD:
    968     case ID_TH:
    969         return new HTMLTableCellElementImpl(docPtr(), tagID);
    970     case ID_THEAD:
    971     case ID_TBODY:
    972     case ID_TFOOT:
    973         return new HTMLTableSectionElementImpl(docPtr(), tagID, false);
    974 
    975 // inline elements
    976     case ID_BR:
    977         return new HTMLBRElementImpl(docPtr());
    978     case ID_Q:
    979         return new HTMLQuoteElementImpl(docPtr());
    980 
    981     case ID_MARQUEE:
    982         return new HTMLMarqueeElementImpl(docPtr());
    983    
    984 // elements with no special representation in the DOM
    985 
    986 // block:
    987     case ID_ADDRESS:
    988     case ID_CENTER:
    989 
    990 // inline
    991         // %fontstyle
    992     case ID_TT:
    993     case ID_U:
    994     case ID_B:
    995     case ID_I:
    996     case ID_S:
    997     case ID_STRIKE:
    998     case ID_BIG:
    999     case ID_SMALL:
    1000 
    1001         // %phrase
    1002     case ID_EM:
    1003     case ID_STRONG:
    1004     case ID_DFN:
    1005     case ID_CODE:
    1006     case ID_SAMP:
    1007     case ID_KBD:
    1008     case ID_VAR:
    1009     case ID_CITE:
    1010     case ID_ABBR:
    1011     case ID_ACRONYM:
    1012 
    1013         // %special
    1014     case ID_SUB:
    1015     case ID_SUP:
    1016     case ID_SPAN:
    1017     case ID_NOBR:
    1018     case ID_WBR:
    1019 
    1020     case ID_BDO:
    1021     default:
    1022         return new HTMLGenericElementImpl(docPtr(), tagID);
    1023     }
    1024 
    1025     return 0;
    1026 }
    1027 
    1028813QString DocumentImpl::nextState()
    1029814{
     
    14661251    NodeImpl* body = 0;
    14671252    for (NodeImpl* i = de->firstChild(); i; i = i->nextSibling()) {
    1468         if (i->id() == ID_FRAMESET)
     1253        if (i->hasTagName(HTMLNames::frameset()))
    14691254            return static_cast<HTMLElementImpl*>(i);
    14701255       
    1471         if (i->id() == ID_BODY)
     1256        if (i->hasTagName(HTMLNames::body()))
    14721257            body = i;
    14731258    }
     
    15991384    return (renderer() && renderer()->needsLayout() && haveStylesheetsLoaded() &&
    16001385            documentElement() && documentElement()->renderer() &&
    1601             (documentElement()->id() != ID_HTML || body()));
     1386            (!documentElement()->hasTagName(HTMLNames::html()) || body()));
    16021387}
    16031388
     
    17211506    hMode = XHtml;
    17221507    kdDebug(6020) << " using strict parseMode" << endl;
    1723 }
    1724 
    1725 // Please see if there`s a possibility to merge that code
    1726 // with the next function and getElementByID().
    1727 NodeImpl *DocumentImpl::findElement( Id id )
    1728 {
    1729     QPtrStack<NodeImpl> nodeStack;
    1730     NodeImpl *current = _first;
    1731 
    1732     while(1)
    1733     {
    1734         if(!current)
    1735         {
    1736             if(nodeStack.isEmpty()) break;
    1737             current = nodeStack.pop();
    1738             current = current->nextSibling();
    1739         }
    1740         else
    1741         {
    1742             if(current->id() == id)
    1743                 return current;
    1744 
    1745             NodeImpl *child = current->firstChild();
    1746             if(child)
    1747             {
    1748                 nodeStack.push(current);
    1749                 current = child;
    1750             }
    1751             else
    1752             {
    1753                 current = current->nextSibling();
    1754             }
    1755         }
    1756     }
    1757 
    1758     return 0;
    17591508}
    17601509
     
    21391888    // First see if it's a HTML attribute name
    21401889    QConstString n(_name->s, _name->l);
    2141     if (!_namespaceURI || !strcasecmp(_namespaceURI, XHTML_NAMESPACE)) {
     1890    if (!_namespaceURI) {
    21421891        // we're in HTML namespace if we know the tag.
    21431892        // xhtml is lower case - case sensitive, easy to implement
     
    21531902    // now lets find out the namespace
    21541903    Q_UINT16 ns = noNamespace;
     1904    /* FIXME: Just break namespaced attributes for now.  Will fix in next stage of QualifiedName conversion.
    21551905    if (_namespaceURI) {
    21561906        DOMString nsU(_namespaceURI);
     
    21581908        if (nsID != -1)
    21591909            ns = (Q_UINT16)nsID;
    2160     }
     1910    }*/
    21611911   
    21621912    // Look in the m_attrNames array for the name
     
    22071957
    22081958    return result;
    2209 }
    2210 
    2211 NodeImpl::Id DocumentImpl::tagId(DOMStringImpl* _namespaceURI, DOMStringImpl *_name, bool readonly)
    2212 {
    2213     if (!_name) return 0;
    2214     // Each document maintains a mapping of tag name -> id for every tag name encountered
    2215     // in the document.
    2216     NodeImpl::Id id = 0;
    2217 
    2218     // First see if it's a HTML element name
    2219     QConstString n(_name->s, _name->l);
    2220     if (!_namespaceURI || !strcasecmp(_namespaceURI, XHTML_NAMESPACE)) {
    2221         // we're in HTML namespace if we know the tag.
    2222         // xhtml is lower case - case sensitive, easy to implement
    2223         if ( htmlMode() == XHtml && (id = getTagID(n.string().ascii(), _name->l)) )
    2224             return id;
    2225         // compatibility: upper case - case insensitive
    2226         if ( htmlMode() != XHtml && (id = getTagID(n.string().lower().ascii(), _name->l )) )
    2227             return id;
    2228 
    2229         // ok, the fast path didn't work out, we need the full check
    2230     }
    2231 
    2232     // now lets find out the namespace
    2233     Q_UINT16 ns = noNamespace;
    2234     if (_namespaceURI) {
    2235         DOMString nsU(_namespaceURI);
    2236         int nsID = XmlNamespaceTable::getNamespaceID(nsU, readonly);
    2237         if (nsID != -1)
    2238             ns = (Q_UINT16)nsID;
    2239     }
    2240 
    2241     // Look in the m_elementNames array for the name
    2242     // ### yeah, this is lame. use a dictionary / map instead
    2243     DOMString nme(n.string());
    2244     // compatibility mode has to store upper case
    2245     if (htmlMode() != XHtml) nme = nme.upper();
    2246     for (id = 0; id < m_elementNameCount; id++)
    2247         if (DOMString(m_elementNames[id]) == nme)
    2248             return makeId(ns, ID_LAST_TAG + 1 + id);
    2249 
    2250     // unknown
    2251     if (readonly) return 0;
    2252 
    2253     // Name not found in m_elementNames, so let's add it
    2254     if (m_elementNameCount+1 > m_elementNameAlloc) {
    2255         m_elementNameAlloc += 100;
    2256         DOMStringImpl **newNames = new DOMStringImpl* [m_elementNameAlloc];
    2257         // ### yeah, this is lame. use a dictionary / map instead
    2258         if (m_elementNames) {
    2259             unsigned short i;
    2260             for (i = 0; i < m_elementNameCount; i++)
    2261                 newNames[i] = m_elementNames[i];
    2262             delete [] m_elementNames;
    2263         }
    2264         m_elementNames = newNames;
    2265     }
    2266 
    2267     id = m_elementNameCount++;
    2268     m_elementNames[id] = nme.implementation();
    2269     m_elementNames[id]->ref();
    2270 
    2271     return makeId(ns, ID_LAST_TAG + 1 + id);
    2272 }
    2273 
    2274 DOMString DocumentImpl::tagName(NodeImpl::Id _id) const
    2275 {
    2276     if (localNamePart(_id) > ID_LAST_TAG)
    2277         return m_elementNames[localNamePart(_id) - (ID_LAST_TAG + 1)];
    2278     else {
    2279         // ### put them in a cache
    2280         if (htmlMode() == XHtml)
    2281             return getTagName(_id).lower();
    2282         else
    2283             return getTagName(_id);
    2284     }
    2285 }
    2286 
    2287 
    2288 DOMStringImpl* DocumentImpl::namespaceURI(NodeImpl::Id _id) const
    2289 {
    2290     if (_id <= ID_LAST_TAG)
    2291         return htmlMode() == XHtml ? XmlNamespaceTable::getNamespaceURI(xhtmlNamespace).implementation() : 0;
    2292 
    2293     unsigned short ns = _id >> 16;
    2294 
    2295     if (!ns) return 0;
    2296 
    2297     return XmlNamespaceTable::getNamespaceURI(ns).implementation();
    22981959}
    22991960
     
    24212082
    24222083        }
    2423         else if (n->isHTMLElement() && (n->id() == ID_LINK || n->id() == ID_STYLE)) {
    2424             ElementImpl *e = static_cast<ElementImpl *>(n);
     2084        else if (n->isHTMLElement() && (n->hasTagName(HTMLNames::link()) || n->hasTagName(HTMLNames::style()))) {
     2085            HTMLElementImpl *e = static_cast<HTMLElementImpl *>(n);
    24252086            QString title = e->getAttribute( ATTR_TITLE ).string();
    24262087            bool enabledViaScript = false;
    2427             if (n->id() == ID_LINK) {
     2088            if (e->hasLocalName(HTMLNames::link())) {
    24282089                // <LINK> element
    24292090                HTMLLinkElementImpl* l = static_cast<HTMLLinkElementImpl*>(n);
     
    24372098            // Get the current preferred styleset.  This is the
    24382099            // set of sheets that will be enabled.
    2439             if ( n->id() == ID_LINK )
     2100            if (e->hasLocalName(HTMLNames::link()))
    24402101                sheet = static_cast<HTMLLinkElementImpl*>(n)->sheet();
    24412102            else
     
    24542115                    // this sheet.
    24552116                    QString rel = e->getAttribute( ATTR_REL ).string();
    2456                     if (n->id() == ID_STYLE || !rel.contains("alternate"))
     2117                    if (e->hasLocalName(HTMLNames::style()) || !rel.contains("alternate"))
    24572118                        m_preferredStylesheetSet = view()->part()->d->m_sheetUsed = title;
    24582119                }
     
    24732134        // For HTML documents, stylesheets are not allowed within/after the <BODY> tag. So we
    24742135        // can stop searching here.
    2475         if (isHTMLDocument() && n->id() == ID_BODY)
     2136        if (isHTMLDocument() && n->hasTagName(HTMLNames::body()))
    24762137            break;
    24772138    }
  • trunk/WebCore/khtml/xml/dom_docimpl.h

    r9466 r9639  
    178178    DOMImplementationImpl *implementation() const;
    179179    virtual ElementImpl *documentElement() const;
    180     virtual ElementImpl *createElement ( const DOMString &tagName, int &exceptioncode );
     180    virtual ElementImpl *createElement(const DOMString &tagName, int &exceptioncode);
    181181    DocumentFragmentImpl *createDocumentFragment ();
    182182    TextImpl *createTextNode ( const DOMString &data );
     
    189189    EntityReferenceImpl *createEntityReference ( const DOMString &name );
    190190    NodeImpl *importNode( NodeImpl *importedNode, bool deep, int &exceptioncode );
    191     virtual ElementImpl *createElementNS ( const DOMString &_namespaceURI, const DOMString &_qualifiedName, int &exceptioncode );
     191    virtual ElementImpl *createElementNS(const DOMString &_namespaceURI, const DOMString &_qualifiedName, int &exceptioncode);
    192192    ElementImpl *getElementById ( const DOMString &elementId ) const;
    193193    ElementImpl *elementFromPoint ( const int _x, const int _y ) const;
     
    218218    virtual bool isDocumentNode() const { return true; }
    219219    virtual bool isHTMLDocument() const { return false; }
    220 
    221     ElementImpl *createHTMLElement(const DOMString &tagName, int &exceptioncode);
    222     ElementImpl *createHTMLElement(unsigned short tagID);
    223220
    224221    khtml::CSSStyleSelector *styleSelector() { return m_styleSelector; }
     
    388385    void resetActiveLinkColor();
    389386   
    390     // internal
    391     NodeImpl *findElement( Id id );
    392 
    393387    bool prepareMouseEvent( bool readonly, int x, int y, MouseEvent *ev );
    394388
     
    400394    // in order to be able to reassign those that are no longer in use
    401395    // (could make problems when it is still kept somewhere around, i.e. styleselector)
    402     NodeImpl::Id tagId(DOMStringImpl* _namespaceURI, DOMStringImpl *_name, bool readonly);
    403     DOMString tagName(NodeImpl::Id _id) const;
    404 
    405396    NodeImpl::Id attrId(DOMStringImpl* _namespaceURI, DOMStringImpl *_name, bool readonly);
    406397    DOMString attrName(NodeImpl::Id _id) const;
    407 
    408     // the namespace uri is mapped to the same id for both
    409     // tagnames as well as attributes.
    410     DOMStringImpl* namespaceURI(NodeImpl::Id _id) const;
    411398
    412399    StyleSheetListImpl* styleSheets();
  • trunk/WebCore/khtml/xml/dom_elementimpl.cpp

    r9158 r9639  
    3434#include "khtml_part.h"
    3535
    36 #include "html/dtd.h"
    3736#include "html/htmlparser.h"
    3837
     
    9190}
    9291
    93 DOMString AttrImpl::prefix() const
     92const AtomicString& AttrImpl::prefix() const
    9493{
    9594    return m_attribute->prefix();
    9695}
    9796
    98 void AttrImpl::setPrefix(const DOMString &_prefix, int &exceptioncode )
     97void AttrImpl::setPrefix(const AtomicString &_prefix, int &exceptioncode )
    9998{
    10099    checkSetPrefix(_prefix, exceptioncode);
     
    102101        return;
    103102
    104     m_attribute->setPrefix(_prefix.implementation());
     103    m_attribute->setPrefix(_prefix);
    105104}
    106105
     
    203202// -------------------------------------------------------------------------
    204203
    205 ElementImpl::ElementImpl(DocumentPtr *doc)
    206     : ContainerNodeImpl(doc)
     204ElementImpl::ElementImpl(const QualifiedName& qName, DocumentPtr *doc)
     205    : ContainerNodeImpl(doc), m_tagName(qName)
    207206{
    208207    namedAttrMap = 0;
    209     m_prefix = 0;
    210208}
    211209
     
    216214        namedAttrMap->deref();
    217215    }
    218 
    219     if (m_prefix)
    220         m_prefix->deref();
     216}
     217
     218NodeImpl *ElementImpl::cloneNode(bool deep)
     219{
     220    int exceptionCode = 0;
     221    ElementImpl *clone = getDocument()->createElementNS(namespaceURI(), nodeName(), exceptionCode);
     222    assert(!exceptionCode);
     223   
     224    // clone attributes
     225    if (namedAttrMap)
     226        *clone->attributes() = *namedAttrMap;
     227
     228    if (deep)
     229        cloneChildNodes(clone);
     230
     231    return clone;
    221232}
    222233
     
    352363{
    353364    updateStyleAttributeIfNeeded();
    354 
    355365    return namedAttrMap && namedAttrMap->length() > 0;
    356366}
     
    358368DOMString ElementImpl::nodeName() const
    359369{
    360     return tagName();
    361 }
    362 
    363 DOMString ElementImpl::tagName() const
    364 {
    365     DOMString tn = getDocument()->tagName(id());
    366 
    367     if (m_prefix)
    368         return DOMString(m_prefix) + ":" + tn;
    369 
     370    DOMString tn = m_tagName.localName();
     371    if (m_tagName.hasPrefix())
     372        return DOMString(m_tagName.prefix()) + ":" + tn;
    370373    return tn;
    371374}
    372375
    373 void ElementImpl::setPrefix( const DOMString &_prefix, int &exceptioncode )
     376void ElementImpl::setPrefix(const AtomicString &_prefix, int &exceptioncode)
    374377{
    375378    checkSetPrefix(_prefix, exceptioncode);
     
    377380        return;
    378381
    379     if (m_prefix)
    380         m_prefix->deref();
    381     m_prefix = _prefix.implementation();
    382     if (m_prefix)
    383         m_prefix->ref();
     382    m_tagName.setPrefix(_prefix);
    384383}
    385384
     
    522521}
    523522
    524 // DOM Section 1.1.1
    525 bool ElementImpl::childAllowed( NodeImpl *newChild )
    526 {
    527     if (!childTypeAllowed(newChild->nodeType()))
    528         return false;
    529 
    530     // For XML documents, we are non-validating and do not check against a DTD, even for HTML elements.
    531     if (getDocument()->isHTMLDocument())
    532         return checkChild(id(), newChild->id(), !getDocument()->inCompatMode());
    533     return true;
    534 }
    535 
    536523bool ElementImpl::childTypeAllowed( unsigned short type )
    537524{
     
    570557DOMString ElementImpl::openTagStartToString() const
    571558{
    572     DOMString result = DOMString("<") + tagName();
     559    DOMString result = DOMString("<") + nodeName();
    573560
    574561    NamedAttrMapImpl *attrMap = attributes(true);
     
    611598
    612599        result += "</";
    613         result += tagName();
     600        result += nodeName();
    614601        result += ">";
    615602    } else {
     
    760747// -------------------------------------------------------------------------
    761748
    762 XMLElementImpl::XMLElementImpl(DocumentPtr *doc, DOMStringImpl *_tagName)
    763     : ElementImpl(doc)
    764 {
    765     m_id = doc->document()->tagId(0 /* no namespace */, _tagName,  false /* allocate */);
    766 }
    767 
     749/*
    768750XMLElementImpl::XMLElementImpl(DocumentPtr *doc, DOMStringImpl *_qualifiedName, DOMStringImpl *_namespaceURI)
    769751    : ElementImpl(doc)
     
    781763        localName->ref();
    782764        localName->remove(0,colonpos+1);
    783         m_id = doc->document()->tagId(_namespaceURI, localName, false /* allocate */);
     765        m_id = doc->document()->tagId(_namespaceURI, localName, false);
    784766        localName->deref();
    785         m_prefix = _qualifiedName->copy();
    786         m_prefix->ref();
    787         m_prefix->truncate(colonpos);
    788     }
    789     else {
     767       
     768        // FIXME: This is a temporary situation for stage one of the QualifiedName patch.  This is also a really stupid way to
     769        // have to handle the prefix.  Way too much copying.  We should make sure the XML tokenizer has done the split
     770        // already into prefix and localName.
     771        DOMStringImpl* prefix = _qualifiedName->copy();
     772        prefix->ref();
     773        prefix->truncate(colonpos);
     774        m_tagName = QualifiedName(prefix, nullAtom, nullAtom);
     775        prefix->deref();
     776    }
     777    else
    790778        // no prefix
    791         m_id = doc->document()->tagId(_namespaceURI, _qualifiedName, false /* allocate */);
    792         m_prefix = 0;
    793     }
    794 }
    795 
    796 XMLElementImpl::~XMLElementImpl()
    797 {
    798 }
    799 
    800 DOMString XMLElementImpl::localName() const
    801 {
    802     return getDocument()->tagName(m_id);
    803 }
    804 
    805 DOMString XMLElementImpl::namespaceURI() const
    806 {
    807     return getDocument()->namespaceURI(m_id);
    808 }
    809 
    810 NodeImpl *XMLElementImpl::cloneNode ( bool deep )
    811 {
    812     // ### we lose namespace here FIXME
    813     // should pass id around
    814     XMLElementImpl *clone = new XMLElementImpl(docPtr(), getDocument()->tagName(m_id).implementation());
    815     clone->m_id = m_id;
    816 
    817     // clone attributes
    818     if (namedAttrMap)
    819         *clone->attributes(false) = *namedAttrMap;
    820 
    821     if (deep)
    822         cloneChildNodes(clone);
    823 
    824     return clone;
    825 }
     779        m_id = doc->document()->tagId(_namespaceURI, _qualifiedName, false);
     780}
     781
     782*/
    826783
    827784// -------------------------------------------------------------------------
     
    12711228}
    12721229
    1273 StyledElementImpl::StyledElementImpl(DocumentPtr *doc)
    1274     : ElementImpl(doc)
     1230StyledElementImpl::StyledElementImpl(const QualifiedName& name, DocumentPtr *doc)
     1231    : ElementImpl(name, doc)
    12751232{
    12761233    m_inlineStyleDecl = 0;
  • trunk/WebCore/khtml/xml/dom_elementimpl.h

    r9625 r9639  
    2424 *
    2525 */
    26 #ifndef _DOM_ELEMENTImpl_h_
    27 #define _DOM_ELEMENTImpl_h_
     26#ifndef _DOM_ELEMENTIMPL_h_
     27#define _DOM_ELEMENTIMPL_h_
    2828
    2929#include "dom_nodeimpl.h"
     
    3131#include "misc/shared.h"
    3232#include "css/css_valueimpl.h"
     33#include "dom_qname.h"
    3334
    3435#if APPLE_CHANGES
     
    129130    virtual DOMString nodeName() const;
    130131    virtual unsigned short nodeType() const;
    131     virtual DOMString prefix() const;
    132     virtual void setPrefix(const DOMString &_prefix, int &exceptioncode );
     132    virtual const AtomicString& prefix() const;
     133    virtual void setPrefix(const AtomicString &_prefix, int &exceptioncode );
    133134
    134135    virtual DOMString nodeValue() const;
     
    157158    friend class khtml::CSSStyleSelector;
    158159public:
    159     ElementImpl(DocumentPtr *doc);
     160    ElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
    160161    ~ElementImpl();
    161162
     
    187188    SharedPtr<AttrImpl> removeAttributeNode(AttrImpl *oldAttr, int &exception);
    188189   
    189     DOMString prefix() const { return m_prefix; }
    190     void setPrefix(const DOMString &_prefix, int &exceptioncode );
    191 
    192190    virtual CSSStyleDeclarationImpl *style();
    193191
     192    virtual const QualifiedName& tagName() const { return m_tagName; }
     193    virtual bool hasTagName(const QualifiedName& tagName) const { return m_tagName.matches(tagName); }
     194   
     195    // A fast function for checking the local name against another atomic string.
     196    bool hasLocalName(const AtomicString& other) const { return m_tagName.localName() == other; }
     197    bool hasLocalName(const QualifiedName& other) const { return m_tagName.localName() == other.localName(); }
     198
     199    virtual const AtomicString& localName() const { return m_tagName.localName(); }
     200    virtual const AtomicString& prefix() const { return m_tagName.prefix(); }
     201    virtual void setPrefix(const AtomicString &_prefix, int &exceptioncode);
     202    virtual const AtomicString& namespaceURI() const { return m_tagName.namespaceURI(); }
     203   
    194204    // DOM methods overridden from  parent classes
    195     virtual DOMString tagName() const;
    196205    virtual unsigned short nodeType() const;
    197     virtual NodeImpl *cloneNode ( bool deep ) = 0;
     206    virtual NodeImpl *cloneNode(bool deep);
    198207    virtual DOMString nodeName() const;
    199208    virtual bool isElementNode() const { return true; }
     
    222231
    223232    virtual void mouseEventHandler( MouseEvent */*ev*/, bool /*inside*/ ) {};
    224     virtual bool childAllowed( NodeImpl *newChild );
    225233    virtual bool childTypeAllowed( unsigned short type );
    226234 
     
    255263protected: // member variables
    256264    mutable NamedAttrMapImpl *namedAttrMap;
    257     DOMStringImpl *m_prefix;
    258 };
    259 
    260 
    261 class XMLElementImpl : public ElementImpl
    262 {
    263 
    264 public:
    265     XMLElementImpl(DocumentPtr *doc, DOMStringImpl *_tagName);
    266     XMLElementImpl(DocumentPtr *doc, DOMStringImpl *_qualifiedName, DOMStringImpl *_namespaceURI);
    267     ~XMLElementImpl();
    268 
    269     // DOM methods overridden from  parent classes
    270     virtual DOMString namespaceURI() const;
    271     virtual DOMString localName() const;
    272     virtual NodeImpl *cloneNode ( bool deep );
    273 
    274     // Other methods (not part of DOM)
    275     virtual bool isXMLElementNode() const { return true; }
    276     virtual Id id() const { return m_id; }
    277 
    278 protected:
    279     Id m_id;
     265    QualifiedName m_tagName;
    280266};
    281267
     
    415401{
    416402public:
    417     StyledElementImpl(DocumentPtr *doc);
     403    StyledElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
    418404    virtual ~StyledElementImpl();
    419405
  • trunk/WebCore/khtml/xml/dom_nodeimpl.cpp

    r9476 r9639  
    2828#include "dom/dom2_events.h"
    2929#include "misc/htmlattrs.h"
    30 #include "misc/htmltags.h"
    3130#include "xml/dom_elementimpl.h"
    3231#include "xml/dom_textimpl.h"
     
    5150#include "khtml_part.h"
    5251
    53 #include "html/dtd.h"
     52// FIXME: Should not have to include this.  Cut the HTML dependency!
     53#include "htmlnames.h"
    5454
    5555#ifndef KHTML_NO_XBL
     
    6565#endif
    6666
    67 using namespace DOM;
    6867using namespace khtml;
     68
     69namespace DOM {
     70/**
     71 * NodeList which lists all Nodes in a document with a given tag name
     72 */
     73class TagNodeListImpl : public NodeListImpl
     74{
     75public:
     76    TagNodeListImpl(NodeImpl *n, const AtomicString& namespaceURI, const AtomicString& localName);
     77
     78    // DOM methods overridden from  parent classes
     79    virtual unsigned long length() const;
     80    virtual NodeImpl *item (unsigned long index) const;
     81
     82    // Other methods (not part of DOM)
     83
     84protected:
     85    virtual bool nodeMatches(NodeImpl *testNode) const;
     86
     87    AtomicString m_namespaceURI;
     88    AtomicString m_localName;
     89};
    6990
    7091NodeImpl::NodeImpl(DocumentPtr *doc)
     
    155176}
    156177
    157 NodeImpl *NodeImpl::lastDescendent() const
     178NodeImpl *NodeImpl::lastDescendant() const
    158179{
    159180    NodeImpl *n = const_cast<NodeImpl *>(this);
     
    240261}
    241262
    242 DOMString NodeImpl::prefix() const
     263const AtomicString& NodeImpl::prefix() const
    243264{
    244265    // For nodes other than elements and attributes, the prefix is always null
    245     return DOMString();
    246 }
    247 
    248 void NodeImpl::setPrefix(const DOMString &/*_prefix*/, int &exceptioncode )
     266    return nullAtom;
     267}
     268
     269void NodeImpl::setPrefix(const AtomicString &/*_prefix*/, int &exceptioncode )
    249270{
    250271    // The spec says that for nodes other than elements and attributes, prefix is always null.
     
    254275}
    255276
    256 DOMString NodeImpl::localName() const
    257 {
    258     return DOMString();
    259 }
    260 
    261 DOMString NodeImpl::namespaceURI() const
    262 {
    263     return DOMString();
     277const AtomicString& NodeImpl::localName() const
     278{
     279    return emptyAtom;
     280}
     281
     282const AtomicString& NodeImpl::namespaceURI() const
     283{
     284    return emptyAtom;
    264285}
    265286
     
    305326        getDocument()->setDocumentChanged(true);
    306327    }
    307 }
    308 
    309 bool NodeImpl::isInline() const
    310 {
    311     if (m_render) return m_render->style()->display() == khtml::INLINE;
    312     return !isElementNode();
    313328}
    314329
     
    10071022}
    10081023
    1009 void NodeImpl::checkSetPrefix(const DOMString &_prefix, int &exceptioncode)
     1024void NodeImpl::checkSetPrefix(const AtomicString &_prefix, int &exceptioncode)
    10101025{
    10111026    // Perform error checking as required by spec for setting Node.prefix. Used by
    10121027    // ElementImpl::setPrefix() and AttrImpl::setPrefix()
    10131028
    1014 #if 0
    1015     // FIXME: Add this check (but not in a way that depends on the C++ DOM!)
    1016     // INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character.
    1017     if (!Element::khtmlValidPrefix(_prefix)) {
    1018         exceptioncode = DOMException::INVALID_CHARACTER_ERR;
    1019         return;
    1020     }
    1021 #endif
    1022 
     1029    // FIXME: Implement support for INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character.
     1030   
    10231031    // NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
    10241032    if (isReadOnly()) {
     
    10271035    }
    10281036
    1029     // NAMESPACE_ERR: - Raised if the specified prefix is malformed
     1037    // FIXME: Implement NAMESPACE_ERR: - Raised if the specified prefix is malformed
     1038    // We have to comment this out, since it's used for attributes and tag names, and we've only
     1039    // switched one over.
     1040    /*
    10301041    // - if the namespaceURI of this node is null,
    10311042    // - if the specified prefix is "xml" and the namespaceURI of this node is different from
     
    10341045    //   the namespaceURI of this node is different from "http://www.w3.org/2000/xmlns/",
    10351046    // - or if this node is an attribute and the qualifiedName of this node is "xmlns" [Namespaces].
    1036     if (
    1037 #if 0
    1038         // FIXME: Add this check (but not in a way that depends on the C++ DOM!)
    1039         Element::khtmlMalformedPrefix(_prefix) ||
    1040 #endif
    1041         (namespacePart(id()) == noNamespace && id() > ID_LAST_TAG) ||
     1047    if ((namespacePart(id()) == noNamespace && id() > ID_LAST_TAG) ||
    10421048        (_prefix == "xml" && DOMString(getDocument()->namespaceURI(id())) != "http://www.w3.org/XML/1998/namespace")) {
    10431049        exceptioncode = DOMException::NAMESPACE_ERR;
    10441050        return;
    1045     }
     1051    }*/
    10461052}
    10471053
     
    12841290}
    12851291
     1292// FIXME: This code is used by editing.  Seems like it could move over there and not pollute NodeImpl.
    12861293bool NodeImpl::isAtomicNode() const
    12871294{
    1288     return !hasChildNodes() || (id() == ID_OBJECT && renderer() && renderer()->isReplaced());
     1295    return !hasChildNodes() || (renderer() && renderer()->isWidget());
    12891296}
    12901297
     
    14031410}
    14041411
     1412// FIXME: Shouldn't these functions be in the editing code?  Code that asks questions about HTML in the core DOM class
     1413// is obviously misplaced.
    14051414// method for editing madness, which allows BR,1 as a position, though that is incorrect
    14061415long NodeImpl::maxDeepOffset() const
     
    14091418        return static_cast<const TextImpl*>(this)->length();
    14101419       
    1411     if (id() == ID_BR || (renderer() && renderer()->isReplaced()))
     1420    if (hasTagName(HTMLNames::br()) || (renderer() && renderer()->isReplaced()))
    14121421        return 1;
    14131422
     
    14651474        if (!n)
    14661475            break;
    1467         if (n->isBlockFlowOrTable() || n->id() == ID_BODY)
     1476        if (n->isBlockFlowOrTable() || n->hasTagName(HTMLNames::body()))
    14681477            return static_cast<ElementImpl *>(n);
    14691478    }
     
    14811490        if (!n)
    14821491            break;
    1483         if (n->isBlockFlow() || n->id() == ID_BODY)
     1492        if (n->isBlockFlow() || n->hasTagName(HTMLNames::body()))
    14841493            return static_cast<ElementImpl *>(n);
    14851494    }
     
    14941503    while (1) {
    14951504        p = n->parentNode();
    1496         if (!p || p->isBlockFlow() || p->id() == ID_BODY)
     1505        if (!p || p->isBlockFlow() || p->hasTagName(HTMLNames::body()))
    14971506            return static_cast<ElementImpl *>(n);
    14981507        // Also stop if any previous sibling is a block
     
    15131522
    15141523    NodeImpl *n = const_cast<NodeImpl *>(this);
    1515     if (n->id() == ID_BODY)
     1524    if (n->hasTagName(HTMLNames::body()))
    15161525        return static_cast<ElementImpl *>(n);
    15171526
     
    15211530        if (!n || !n->isContentEditable())
    15221531            break;
    1523         if (n->id() == ID_BODY) {
     1532        if (n->hasTagName(HTMLNames::body())) {
    15241533            result = n;
    15251534            break;
     
    15411550}
    15421551
     1552// FIXME: End of obviously misplaced HTML editing functions.  Try to move these out of NodeImpl.
     1553
    15431554void NodeImpl::addEventListener(const DOMString &type, EventListener *listener, bool useCapture)
    15441555{
     
    15511562}
    15521563
    1553 SharedPtr<NodeListImpl> NodeImpl::getElementsByTagNameNS ( const DOMString &namespaceURI, const DOMString &localName )
    1554 {
    1555     if (localName.isNull())
    1556         return SharedPtr<NodeListImpl>();
    1557 
    1558     Id idMask = namespaceMask | localNameMask;
    1559     if (localName[0] == '*')
    1560         idMask &= ~localNameMask;
    1561     if (namespaceURI.isNull() || namespaceURI[0] == '*')
    1562         idMask &= ~namespaceMask;
    1563 
    1564     Id id = 0; // 0 means "all items"
    1565     if ((idMask & localNameMask) || !namespaceURI.isNull()) { // not getElementsByTagName("*")
    1566         id = getDocument()->tagId(namespaceURI.implementation(), localName.implementation(), true);
    1567         if ( !id ) // not found -> we want to return an empty list, not "all items"
    1568             id = (Id)-1; // HACK. HEAD has a cleaner implementation of TagNodeListImpl it seems.
    1569     }
    1570 
    1571     return SharedPtr<NodeListImpl>(new TagNodeListImpl(this, id, idMask));
     1564SharedPtr<NodeListImpl> NodeImpl::getElementsByTagNameNS(const DOMString &namespaceURI, const DOMString &localName)
     1565{
     1566    if (namespaceURI.isNull() || localName.isNull())
     1567        return SharedPtr<NodeListImpl>(); // FIXME: Who cares about this additional check?
     1568   
     1569    DOMString name = localName;
     1570    if (getDocument()->isHTMLDocument())
     1571        name = localName.lower();
     1572    return SharedPtr<NodeListImpl>(new TagNodeListImpl(this, AtomicString(namespaceURI), AtomicString(name)));
    15721573}
    15731574
     
    15921593    return 0;
    15931594}
    1594 
    1595 #if APPLE_CHANGES
    1596 NodeImpl::Id NodeImpl::identifier() const
    1597 {
    1598     return id();
    1599 }
    1600 #endif
    16011595
    16021596#ifndef NDEBUG
     
    16391633    NodeImpl *rootNode;
    16401634    NodeImpl *node = (NodeImpl *)this;
    1641     while(node->parentNode() != NULL && node->id() != ID_BODY)
     1635    while (node->parentNode() && !node->hasTagName(HTMLNames::body()))
    16421636        node = node->parentNode();
    16431637    rootNode = node;
     
    20952089
    20962090    // short check for consistency with DTD
    2097     if(!isXMLElementNode() && !newChild->isXMLElementNode() && !childAllowed(newChild))
    2098     {
    2099         //kdDebug( 6020 ) << "AddChild failed! id=" << id() << ", child->id=" << newChild->id() << endl;
     2091    if (getDocument()->isHTMLDocument() && !childAllowed(newChild))
    21002092        return 0;
    2101     }
    21022093
    21032094    // just add it...
     
    25372528}
    25382529
    2539 TagNodeListImpl::TagNodeListImpl(NodeImpl *n, NodeImpl::Id _id, NodeImpl::Id _idMask )
     2530TagNodeListImpl::TagNodeListImpl(NodeImpl *n, const AtomicString& namespaceURI, const AtomicString& localName)
    25402531    : NodeListImpl(n),
    2541       m_id(_id & _idMask),
    2542       m_idMask(_idMask)
     2532      m_namespaceURI(namespaceURI),
     2533      m_localName(localName)
    25432534{
    25442535}
     
    25492540}
    25502541
    2551 NodeImpl *TagNodeListImpl::item ( unsigned long index ) const
    2552 {
    2553     return recursiveItem( index );
    2554 }
    2555 
    2556 bool TagNodeListImpl::nodeMatches( NodeImpl *testNode ) const
    2557 {
    2558     return ( testNode->isElementNode() &&
    2559              (testNode->id() & m_idMask) == m_id);
     2542NodeImpl *TagNodeListImpl::item(unsigned long index) const
     2543{
     2544    return recursiveItem(index);
     2545}
     2546
     2547bool TagNodeListImpl::nodeMatches(NodeImpl *testNode) const
     2548{
     2549    if (!testNode->isElementNode())
     2550        return false;
     2551
     2552    if (m_namespaceURI != starAtom && m_namespaceURI != testNode->namespaceURI())
     2553        return false;
     2554   
     2555    return m_localName == starAtom || m_localName == testNode->localName();
    25602556}
    25612557
     
    25962592}
    25972593
    2598 // ----------------------------------------------------------------------------
    2599 
    2600 // ### unused
    2601 #if 0
    2602 GenericRONamedNodeMapImpl::GenericRONamedNodeMapImpl(DocumentPtr* doc)
    2603     : NamedNodeMapImpl()
    2604 {
    2605     m_doc = doc->document();
    2606     m_contents = new QPtrList<NodeImpl>;
    2607 }
    2608 
    2609 GenericRONamedNodeMapImpl::~GenericRONamedNodeMapImpl()
    2610 {
    2611     while (m_contents->count() > 0)
    2612         m_contents->take(0)->deref();
    2613 
    2614     delete m_contents;
    2615 }
    2616 
    2617 NodeImpl *GenericRONamedNodeMapImpl::getNamedItem ( const DOMString &name, int &/*exceptioncode*/ ) const
    2618 {
    2619     QPtrListIterator<NodeImpl> it(*m_contents);
    2620     for (; it.current(); ++it)
    2621         if (it.current()->nodeName() == name)
    2622             return it.current();
    2623     return 0;
    2624 }
    2625 
    2626 Node GenericRONamedNodeMapImpl::setNamedItem ( const Node &/*arg*/, int &exceptioncode )
    2627 {
    2628     // can't modify this list through standard DOM functions
    2629     // NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly
    2630     exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR;
    2631     return 0;
    2632 }
    2633 
    2634 Node GenericRONamedNodeMapImpl::removeNamedItem ( const DOMString &/*name*/, int &exceptioncode )
    2635 {
    2636     // can't modify this list through standard DOM functions
    2637     // NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly
    2638     exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR;
    2639     return 0;
    2640 }
    2641 
    2642 NodeImpl *GenericRONamedNodeMapImpl::item ( unsigned long index ) const
    2643 {
    2644     // ### check this when calling from javascript using -1 = 2^sizeof(int)-1
    2645     // (also for other similar methods)
    2646     if (index >= m_contents->count())
    2647         return 0;
    2648 
    2649     return m_contents->at(index);
    2650 }
    2651 
    2652 unsigned long GenericRONamedNodeMapImpl::length(  ) const
    2653 {
    2654     return m_contents->count();
    2655 }
    2656 
    2657 NodeImpl *GenericRONamedNodeMapImpl::getNamedItemNS( const DOMString &namespaceURI,
    2658                                                      const DOMString &localName,
    2659                                                      int &/*exceptioncode*/ ) const
    2660 {
    2661     NodeImpl::Id searchId = m_doc->tagId(namespaceURI.implementation(),
    2662                                                    localName.implementation(), true);
    2663 
    2664     QPtrListIterator<NodeImpl> it(*m_contents);
    2665     for (; it.current(); ++it)
    2666         if (it.current()->id() == searchId)
    2667             return it.current();
    2668 
    2669     return 0;
    2670 }
    2671 
    2672 NodeImpl *GenericRONamedNodeMapImpl::setNamedItemNS( NodeImpl */*arg*/, int &exceptioncode )
    2673 {
    2674     // can't modify this list through standard DOM functions
    2675     // NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly
    2676     exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR;
    2677     return 0;
    2678 }
    2679 
    2680 NodeImpl *GenericRONamedNodeMapImpl::removeNamedItemNS( const DOMString &/*namespaceURI*/,
    2681                                                         const DOMString &/*localName*/,
    2682                                                         int &exceptioncode )
    2683 {
    2684     // can't modify this list through standard DOM functions
    2685     exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR;
    2686     return 0;
    2687 }
    2688 
    2689 void GenericRONamedNodeMapImpl::addNode(NodeImpl *n)
    2690 {
    2691     // The spec says that in the case of duplicates we only keep the first one
    2692     int exceptioncode = 0;
    2693     if (getNamedItem(n->nodeName(),exceptioncode))
    2694         return;
    2695 
    2696     n->ref();
    2697     m_contents->append(n);
    2698 }
    2699 
    2700 #endif
     2594}
  • trunk/WebCore/khtml/xml/dom_nodeimpl.h

    r9476 r9639  
    6060class NodeListImpl;
    6161class NamedAttrMapImpl;
     62class QualifiedName;
    6263class RegisteredEventListener;
    63 
    64 // The namespace used for XHTML elements
    65 #define XHTML_NAMESPACE "http://www.w3.org/1999/xhtml"
    6664
    6765const Q_UINT16 noNamespace = 0;
     
    103101
    104102    // DOM methods & attributes for Node
     103    virtual bool hasTagName(const QualifiedName& tagName) const { return false; }
    105104    virtual DOMString nodeName() const = 0;
    106105    virtual DOMString nodeValue() const;
     
    123122    virtual bool hasChildNodes (  ) const;
    124123    virtual NodeImpl *cloneNode ( bool deep ) = 0;
    125     virtual DOMString localName() const;
    126     virtual DOMString namespaceURI() const;
    127     virtual DOMString prefix() const;
    128     virtual void setPrefix(const DOMString &_prefix, int &exceptioncode );
     124    virtual const AtomicString& localName() const;
     125    virtual const AtomicString& namespaceURI() const;
     126    virtual const AtomicString& prefix() const;
     127    virtual void setPrefix(const AtomicString &_prefix, int &exceptioncode);
    129128    void normalize ();
    130129    static bool isSupported(const DOMString &feature, const DOMString &version);
    131130
    132     NodeImpl *lastDescendent() const;
     131    NodeImpl *lastDescendant() const;
    133132
    134133    // Other methods (not part of DOM)
     
    138137    virtual bool isAttributeNode() const { return false; }
    139138    virtual bool isTextNode() const { return false; }
     139    virtual bool isCommentNode() const { return false; }
    140140    virtual bool isDocumentNode() const { return false; }
    141     virtual bool isXMLElementNode() const { return false; }
    142141    bool isBlockFlow() const;
    143142    bool isBlockFlowOrTable() const;
     
    189188    bool inSameContainingBlockFlowElement(NodeImpl *);
    190189   
    191     // used by the parser. Doesn't do as many error checkings as
    192     // appendChild(), and returns the node into which will be parsed next.
     190    // used by the parser. Checks against the DTD, unlike DOM operations like
     191    // appendChild(), and returns the new container node for future insertions as you parse.
    193192    virtual NodeImpl *addChild(NodeImpl *newChild);
    194193   
     
    197196    // This is only needed for <applet> and <object> elements, which can't lay themselves out
    198197    // until they know all of their nested <param>s. [3603191, 4040848]
    199     virtual void closeRenderer() { }
    200 
    201     typedef Q_UINT32 Id;
    202     // id() is used to easily and exactly identify a node. It
    203     // is optimized for quick comparison and low memory consumption.
    204     // its value depends on the owner document of the node and is
    205     // categorized in the following way:
    206     // 1..ID_LAST_TAG: the node inherits HTMLElementImpl and is
    207     //                 part of the HTML namespace.
    208     //                 The HTML namespace is either the global
    209     //                 one (no namespace) or the XHTML namespace
    210     //                 depending on the owner document's doctype
    211     // ID_LAST_TAG+1..0xffff: non-HTML elements in the global namespace
    212     // others       non-HTML elements in a namespace.
    213     //                 the upper 16 bit identify the namespace
    214     //                 the lower 16 bit identify the local part of the
    215     //                 qualified element name.
    216     virtual Id id() const { return 0; };
    217 #if APPLE_CHANGES
    218     Id identifier() const;
    219 #endif
     198    virtual void closeRenderer() {}
     199
     200    typedef Q_UINT32 Id; // FIXME: Yank this once attributes are also switched over.
     201
    220202    enum MouseEventType {
    221203        MousePress,
     
    279261    virtual bool isMouseFocusable() const;
    280262   
    281     virtual bool isInline() const;
    282    
    283263    virtual bool isContentEditable() const;
    284264    virtual QRect getRect() const;
     
    370350    void setRenderer(khtml::RenderObject* renderer) { m_render = renderer; }
    371351   
    372     void checkSetPrefix(const DOMString &_prefix, int &exceptioncode);
    373     void checkAddChild(NodeImpl *newChild, int &exceptioncode);
     352    void checkSetPrefix(const AtomicString &_prefix, int &exceptioncode);
    374353    bool isAncestor(const NodeImpl *) const;
    375     virtual bool childAllowed( NodeImpl *newChild );
    376 
     354
     355        // These two methods are mutually exclusive.  The former is used to do strict error-checking
     356        // when adding children via the public DOM API (e.g., appendChild()).  The latter is called only when parsing,
     357        // to sanity-check against the DTD for error recovery.
     358        void checkAddChild(NodeImpl *newChild, int &exceptioncode);    // Error-checking when adding via the DOM API
     359        virtual bool childAllowed(NodeImpl *newChild);                             // Error-checking during parsing that checks the DTD
     360       
    377361    virtual long maxOffset() const;
    378362    long maxDeepOffset() const;
     
    482466    void notifyLocalNodeListsSubtreeModified();
    483467
    484     SharedPtr<NodeListImpl> getElementsByTagName(const DOMString &name) { return getElementsByTagNameNS(DOMString(), name); }
     468    SharedPtr<NodeListImpl> getElementsByTagName(const DOMString &name) { return getElementsByTagNameNS("*", name); }
    485469    SharedPtr<NodeListImpl> getElementsByTagNameNS(const DOMString &namespaceURI, const DOMString &localName);
    486470
     
    618602    virtual bool nodeMatches( NodeImpl *testNode ) const;
    619603};
    620 
    621 
    622 /**
    623  * NodeList which lists all Nodes in a document with a given tag name
    624  */
    625 class TagNodeListImpl : public NodeListImpl
    626 {
    627 public:
    628     TagNodeListImpl( NodeImpl *n, NodeImpl::Id tagId, NodeImpl::Id tagIdMask );
    629 
    630     // DOM methods overridden from  parent classes
    631 
    632     virtual unsigned long length() const;
    633     virtual NodeImpl *item ( unsigned long index ) const;
    634 
    635     // Other methods (not part of DOM)
    636 
    637 protected:
    638     virtual bool nodeMatches( NodeImpl *testNode ) const;
    639 
    640     NodeImpl::Id m_id;
    641     NodeImpl::Id m_idMask;
    642 };
    643 
    644604
    645605/**
  • trunk/WebCore/khtml/xml/dom_position.cpp

    r9447 r9639  
    3636#include "dom2_viewsimpl.h"
    3737#include "helper.h"
    38 #include "htmltags.h"
    3938#include "text_affinity.h"
    4039#include "visible_position.h"
     
    4645#include "rendering/render_text.h"
    4746#include "editing/visible_text.h"
     47#include "htmlnames.h"
    4848
    4949#if APPLE_CHANGES
     
    441441        // stop before going above the body, up into the head
    442442        // return the last visible streamer position
    443         if (currentNode->id() == ID_BODY && currentOffset >= (int) currentNode->childNodeCount())
     443        if (currentNode->hasTagName(HTMLNames::body()) && currentOffset >= (int) currentNode->childNodeCount())
    444444            break;
    445445           
     
    695695   
    696696    if (node() == pos.node()) {
    697         if (node()->id() == ID_BR)
     697        if (node()->hasTagName(HTMLNames::br()))
    698698            return false;
    699699
     
    707707    }
    708708   
    709     if (node()->id() == ID_BR && pos.inRenderedContent())
     709    if (node()->hasTagName(HTMLNames::br()) && pos.inRenderedContent())
    710710        return true;
    711711               
    712     if (pos.node()->id() == ID_BR && inRenderedContent())
     712    if (pos.node()->hasTagName(HTMLNames::br()) && inRenderedContent())
    713713        return true;
    714714               
     
    765765        return Position();
    766766   
    767     if (upstream().node()->id() == ID_BR)
     767    if (upstream().node()->hasTagName(HTMLNames::br()))
    768768        return Position();
    769769
     
    795795    }
    796796
    797     if (downstream().node()->id() == ID_BR)
     797    if (downstream().node()->hasTagName(HTMLNames::br()))
    798798        return Position();
    799799
  • trunk/WebCore/khtml/xml/dom_qname.cpp

    r9403 r9639  
    2020 */
    2121
    22 #include <qptrdict.h>
    2322#include "dom_qname.h"
     23#include "misc/hashset.h"
     24
     25using khtml::HashSet;
    2426
    2527namespace DOM {
    2628
    27 static QPtrDict<QPtrDict<QPtrDict<QualifiedName::QualifiedNameImpl> > >* gNameCache = 0;
     29struct QualifiedNameComponents {
     30    DOMStringImpl *m_prefix;
     31    DOMStringImpl *m_localName;
     32    DOMStringImpl *m_namespace;
     33};
     34
     35// Golden ratio - arbitrary start value to avoid mapping all 0's to all 0's
     36static const unsigned PHI = 0x9e3779b9U;
     37   
     38inline unsigned hashComponents(const QualifiedNameComponents& buf)
     39{
     40    unsigned l = sizeof(QualifiedNameComponents) / sizeof(uint16_t);
     41    const uint16_t *s = reinterpret_cast<const uint16_t*>(&buf);
     42    uint32_t hash = PHI;
     43    uint32_t tmp;
     44       
     45    int rem = l & 1;
     46    l >>= 1;
     47       
     48    // Main loop
     49    for (; l > 0; l--) {
     50        hash += s[0];
     51        tmp = (s[1] << 11) ^ hash;
     52        hash = (hash << 16) ^ tmp;
     53        s += 2;
     54        hash += hash >> 11;
     55    }
     56   
     57    // Handle end case
     58    if (rem) {
     59        hash += s[0];
     60        hash ^= hash << 11;
     61        hash += hash >> 17;
     62    }
     63       
     64    // Force "avalanching" of final 127 bits
     65    hash ^= hash << 3;
     66    hash += hash >> 5;
     67    hash ^= hash << 2;
     68    hash += hash >> 15;
     69    hash ^= hash << 10;
     70       
     71    // this avoids ever returning a hash code of 0, since that is used to
     72    // signal "hash not computed yet", using a value that is likely to be
     73    // effectively the same as 0 when the low bits are masked
     74    if (hash == 0)
     75        hash = 0x80000000;
     76       
     77    return hash;
     78}
     79
     80struct QNameHash {
     81    static unsigned hash(const QualifiedName::QualifiedNameImpl *name) {   
     82        QualifiedNameComponents components = { name->m_prefix.implementation(),
     83                                               name->m_localName.implementation(),
     84                                               name->m_namespace.implementation() };
     85        return hashComponents(components);
     86    }
     87    static bool equal(const QualifiedName::QualifiedNameImpl *a, const QualifiedName::QualifiedNameImpl *b) { return a == b; }
     88};
     89
     90typedef HashSet<QualifiedName::QualifiedNameImpl*, QNameHash> QNameSet;
     91
     92static QNameSet *gNameCache;
     93
     94inline bool equalComponents(QualifiedName::QualifiedNameImpl* const& name, const QualifiedNameComponents &components)
     95{
     96    return components.m_localName == name->m_localName.implementation() &&
     97           components.m_namespace == name->m_namespace.implementation() &&
     98           components.m_prefix == name->m_prefix.implementation();
     99}
     100
     101inline QualifiedName::QualifiedNameImpl *convertComponents(const QualifiedNameComponents& components, unsigned hash)
     102{
     103    return new QualifiedName::QualifiedNameImpl(components.m_prefix, components.m_localName, components.m_namespace);
     104}
     105
    28106
    29107QualifiedName::QualifiedName(const AtomicString& p, const AtomicString& l, const AtomicString& n)
     108    : m_impl(0)
    30109{
    31     // Obtain an appropriate inner from our dictionary.
    32     QPtrDict<QPtrDict<QualifiedNameImpl> >* namespaceDict = 0;
    33     QPtrDict<QualifiedNameImpl>* prefixDict = 0;
    34     if (gNameCache) {
    35         namespaceDict = gNameCache->find((void*)(n.implementation()));
    36         if (namespaceDict) {
    37             prefixDict = namespaceDict->find((void*)p.implementation());
    38             if (prefixDict)
    39                 m_impl = prefixDict->find((void*)l.implementation());
    40         }
    41     }
    42 
    43     if (!m_impl) {
    44         m_impl = new QualifiedNameImpl(p, l, n);
    45 
    46         // Put the object into the hash.
    47         if (!gNameCache)
    48             gNameCache = new QPtrDict<QPtrDict<QPtrDict<QualifiedNameImpl> > >;
    49        
    50         if (!namespaceDict) {
    51             namespaceDict = new QPtrDict<QPtrDict<QualifiedNameImpl> >;
    52             namespaceDict->setAutoDelete(true);
    53             gNameCache->insert((void*)n.implementation(), namespaceDict);
    54         }
    55        
    56         if (!prefixDict) {
    57             prefixDict = new QPtrDict<QualifiedNameImpl>;
    58             namespaceDict->insert((void*)p.implementation(), prefixDict);
    59         }
    60        
    61         prefixDict->insert((void*)l.implementation(), m_impl);
    62     }
    63    
     110    if (!gNameCache)
     111        gNameCache = new QNameSet;
     112    QualifiedNameComponents components = { p.implementation(), l.implementation(), n.implementation() };
     113    m_impl = *gNameCache->insert<QualifiedNameComponents, hashComponents, equalComponents, convertComponents>(components).first;   
    64114    ref();
    65115}
     
    89139void QualifiedName::deref()
    90140{
    91     if (m_impl->refCount() == 1) {
    92         // Before decrementing the ref to 0, remove ourselves from the hash table.
    93         QPtrDict<QPtrDict<QualifiedNameImpl> >* namespaceDict = 0;
    94         QPtrDict<QualifiedNameImpl>* prefixDict = 0;
    95         if (gNameCache) {
    96             namespaceDict = gNameCache->find((void*)(namespaceURI().implementation()));
    97             if (namespaceDict) {
    98                 prefixDict = namespaceDict->find((void*)prefix().implementation());
    99                 if (prefixDict)
    100                     prefixDict->remove((void*)localName().implementation());
    101             }
    102         }
    103     }
    104    
     141    if (m_impl->hasOneRef())
     142        gNameCache->remove(m_impl);
     143       
    105144    m_impl->deref();
    106145}
    107146
    108 bool operator==(const AtomicString& a, const QualifiedName& q)
    109 {
    110     return a == q.localName();
    111 }
    112 
    113 bool operator==(const QualifiedName& q, const AtomicString& a)
     147void QualifiedName::setPrefix(const AtomicString& prefix)
    114148{
    115     return a == q.localName();
     149    QualifiedName other(prefix, localName(), namespaceURI());
     150    *this = other;
    116151}
    117152
  • trunk/WebCore/khtml/xml/dom_qname.h

    r9403 r9639  
    3333        QualifiedNameImpl(const AtomicString& p, const AtomicString& l, const AtomicString& n) :m_prefix(p), m_localName(l), m_namespace(n) {}
    3434
    35         friend class QualifiedName;
    36 
    37     private:
    3835        AtomicString m_prefix;
    3936        AtomicString m_localName;
     
    4845    const QualifiedName& operator=(const QualifiedName& other);
    4946
    50     DOMStringImpl* localNamePtr() const { return localName().implementation(); }
    51    
    5247    bool operator==(const QualifiedName& other) const { return m_impl == other.m_impl; }
    5348    bool operator!=(const QualifiedName& other) const { return !(*this == other); }
    5449
    5550    bool matches(const QualifiedName& other) const { return m_impl == other.m_impl || (localName() == other.localName() && namespaceURI() == other.namespaceURI()); }
     51
     52    bool hasPrefix() const { return m_impl->m_prefix != nullAtom; }
     53    void setPrefix(const AtomicString& prefix);
    5654
    5755    const AtomicString& prefix() const { return m_impl->m_prefix; }
     
    6765};
    6866
    69 bool operator==(const AtomicString& a, const QualifiedName& q);
     67inline bool operator==(const AtomicString& a, const QualifiedName& q) { return a == q.localName(); }
    7068inline bool operator!=(const AtomicString& a, const QualifiedName& q) { return a != q.localName(); }
    71 bool operator==(const QualifiedName& q, const AtomicString& a);
     69inline bool operator==(const QualifiedName& q, const AtomicString& a) { return a == q.localName(); }
    7270inline bool operator!=(const QualifiedName& q, const AtomicString& a) { return a != q.localName(); }
    73 
    7471
    7572}
  • trunk/WebCore/khtml/xml/dom_textimpl.cpp

    r7861 r9639  
    305305}
    306306
     307const AtomicString& CommentImpl::localName() const
     308{
     309    return commentAtom;
     310}
     311
    307312DOMString CommentImpl::nodeName() const
    308313{
    309     return "#comment";
     314    return commentAtom.string();
    310315}
    311316
     
    318323{
    319324    return getDocument()->createComment( str );
    320 }
    321 
    322 NodeImpl::Id CommentImpl::id() const
    323 {
    324     return ID_COMMENT;
    325325}
    326326
     
    395395}
    396396
     397const AtomicString& TextImpl::localName() const
     398{
     399    return textAtom;
     400}
     401
    397402DOMString TextImpl::nodeName() const
    398403{
    399   return "#text";
     404    return textAtom.string();
    400405}
    401406
     
    463468}
    464469
    465 NodeImpl::Id TextImpl::id() const
    466 {
    467     return ID_TEXT;
    468 }
    469 
    470470void TextImpl::recalcStyle( StyleChange change )
    471471{
  • trunk/WebCore/khtml/xml/dom_textimpl.h

    r9153 r9639  
    9696
    9797    // DOM methods overridden from  parent classes
     98    const AtomicString& localName() const;
    9899    virtual DOMString nodeName() const;
    99100    virtual unsigned short nodeType() const;
     
    101102
    102103    // Other methods (not part of DOM)
    103 
    104     virtual Id id() const;
     104    virtual bool isCommentNode() const { return true; }
    105105    virtual bool childTypeAllowed( unsigned short type );
    106106
     
    122122
    123123    // DOM methods overridden from  parent classes
     124    const AtomicString& localName() const;
    124125    virtual DOMString nodeName() const;
    125126    virtual unsigned short nodeType() const;
     
    129130
    130131    virtual bool isTextNode() const { return true; }
    131     virtual Id id() const;
    132132    virtual void attach();
    133133    virtual bool rendererIsNeeded(khtml::RenderStyle *);
  • trunk/WebCore/khtml/xml/xml_tokenizer.cpp

    r9105 r9639  
    2727#include "html/html_headimpl.h"
    2828#include "html/html_tableimpl.h"
    29 #include "misc/htmltags.h"
     29#include "htmlnames.h"
    3030#include "misc/htmlattrs.h"
    3131#include "misc/loader.h"
     
    4545using DOM::DOMString;
    4646using DOM::ElementImpl;
     47using DOM::HTMLNames;
    4748using DOM::HTMLScriptElementImpl;
    4849using DOM::HTMLTableSectionElementImpl;
     
    323324    // We want to consolidate this with the HTML parser and HTML DOM code at some point.
    324325    // For now, it's too risky to rip that code up.
    325     if (m_currentNode->id() == ID_TABLE &&
    326         newElement->id() == ID_TR &&
     326    if (m_currentNode->hasTagName(HTMLNames::table()) &&
     327        newElement->hasTagName(HTMLNames::tr()) &&
    327328        m_currentNode->isHTMLElement() && newElement->isHTMLElement()) {
    328329        NodeImpl* implicitTBody =
    329            new HTMLTableSectionElementImpl( m_doc, ID_TBODY, true /* implicit */ );
     330           new HTMLTableSectionElementImpl(HTMLNames::tbody(), m_doc, true /* implicit */);
    330331        m_currentNode->addChild(implicitTBody);
    331332        if (m_view && !implicitTBody->attached())
     
    334335    }
    335336
    336     if (newElement->id() == ID_SCRIPT)
     337    if (newElement->hasTagName(HTMLNames::script()))
    337338        static_cast<HTMLScriptElementImpl *>(newElement)->setCreatedByParser(true);
    338339
     
    612613    NodeImpl* root = doc->documentElement();
    613614    if (!root) {
    614         root = doc->createElementNS(XHTML_NAMESPACE, "html", exceptioncode);
    615         NodeImpl* body = doc->createElementNS(XHTML_NAMESPACE, "body", exceptioncode);
     615        root = doc->createElementNS(HTMLNames::xhtmlNamespaceURI(), "html", exceptioncode);
     616        NodeImpl* body = doc->createElementNS(HTMLNames::xhtmlNamespaceURI(), "body", exceptioncode);
    616617        root->appendChild(body, exceptioncode);
    617618        doc->appendChild(root, exceptioncode);
     
    619620    }
    620621
    621     ElementImpl* reportElement = doc->createElementNS(XHTML_NAMESPACE, "parsererror", exceptioncode);
     622    ElementImpl* reportElement = doc->createElementNS(HTMLNames::xhtmlNamespaceURI(), "parsererror", exceptioncode);
    622623    reportElement->setAttribute(ATTR_STYLE, "white-space: pre; border: 2px solid #c77; padding: 0 1em 0 1em; margin: 1em; background-color: #fdd; color: black");
    623     ElementImpl* h3 = doc->createElementNS(XHTML_NAMESPACE, "h3", exceptioncode);
     624    ElementImpl* h3 = doc->createElementNS(HTMLNames::xhtmlNamespaceURI(), "h3", exceptioncode);
    624625    h3->appendChild(doc->createTextNode("This page contains the following errors:"), exceptioncode);
    625626    reportElement->appendChild(h3, exceptioncode);
    626     ElementImpl* fixed = doc->createElementNS(XHTML_NAMESPACE, "div", exceptioncode);
     627    ElementImpl* fixed = doc->createElementNS(HTMLNames::xhtmlNamespaceURI(), "div", exceptioncode);
    627628    fixed->setAttribute(ATTR_STYLE, "font-family:monospace;font-size:12px");
    628629    NodeImpl* textNode = doc->createTextNode(m_errorMessages);
    629630    fixed->appendChild(textNode, exceptioncode);
    630631    reportElement->appendChild(fixed, exceptioncode);
    631     h3 = doc->createElementNS(XHTML_NAMESPACE, "h3", exceptioncode);
     632    h3 = doc->createElementNS(HTMLNames::xhtmlNamespaceURI(), "h3", exceptioncode);
    632633    reportElement->appendChild(h3, exceptioncode);
    633634   
     
    635636#ifdef KHTML_XSLT
    636637    if (doc->transformSourceDocument()) {
    637         ElementImpl* par = doc->createElementNS(XHTML_NAMESPACE, "p", exceptioncode);
     638        ElementImpl* par = doc->createElementNS(HTMLNames::xhtmlNamespaceURI(), "p", exceptioncode);
    638639        reportElement->appendChild(par, exceptioncode);
    639640        par->setAttribute(ATTR_STYLE, "white-space: normal");
     
    651652    // that is found, add it to the m_scripts list from which they will be executed
    652653
    653     if (n->id() == ID_SCRIPT) {
     654    if (n->hasTagName(HTMLNames::script())) {
    654655        m_scripts.append(static_cast<HTMLScriptElementImpl*>(n));
    655656    }
  • trunk/WebCore/kwq/DOM.mm

    r9181 r9639  
    4545#import "dom_xmlimpl.h"
    4646#import "html_elementimpl.h"
    47 #import "htmltags.h"
    4847
    4948#import "khtml_part.h"
     
    7372using DOM::FilterNode;
    7473using DOM::HTMLElementImpl;
     74using DOM::HTMLNames;
    7575using DOM::NamedNodeMapImpl;
    7676using DOM::Node;
     
    339339
    340340    int exceptionCode = 0;
    341     [self _nodeImpl]->setPrefix(prefix, exceptionCode);
     341    DOMString prefixStr(prefix);
     342    [self _nodeImpl]->setPrefix(prefixStr.implementation(), exceptionCode);
    342343    raiseOnDOMError(exceptionCode);
    343344}
     
    400401        case Node::ELEMENT_NODE:
    401402            if (impl->isHTMLElement()) {
    402                 // FIXME: There are no identifiers for HTMLHeadingElement, HTMLModElement,
    403                 // HTMLTableCaptionElement, HTMLTableColElement, HTMLTableSectionElement.
    404                 // Find other ways to identify them.
    405                 switch (impl->identifier()) {
    406                     case ID_HTML:
    407                         wrapperClass = [DOMHTMLHtmlElement class];
    408                         break;
    409                     case ID_HEAD:
    410                         wrapperClass = [DOMHTMLHeadElement class];
    411                         break;
    412                     case ID_LINK:
    413                         wrapperClass = [DOMHTMLLinkElement class];
    414                         break;
    415                     case ID_TITLE:
    416                         wrapperClass = [DOMHTMLTitleElement class];
    417                         break;
    418                     case ID_META:
    419                         wrapperClass = [DOMHTMLMetaElement class];
    420                         break;
    421                     case ID_BASE:
    422                         wrapperClass = [DOMHTMLBaseElement class];
    423                         break;
    424                     case ID_ISINDEX:
    425                         wrapperClass = [DOMHTMLIsIndexElement class];
    426                         break;
    427                     case ID_STYLE:
    428                         wrapperClass = [DOMHTMLStyleElement class];
    429                         break;
    430                     case ID_BODY:
    431                         wrapperClass = [DOMHTMLBodyElement class];
    432                         break;
    433                     case ID_FORM:
    434                         wrapperClass = [DOMHTMLFormElement class];
    435                         break;
    436                     case ID_SELECT:
    437                         wrapperClass = [DOMHTMLSelectElement class];
    438                         break;
    439                     case ID_OPTGROUP:
    440                         wrapperClass = [DOMHTMLOptGroupElement class];
    441                         break;
    442                     case ID_OPTION:
    443                         wrapperClass = [DOMHTMLOptionElement class];
    444                         break;
    445                     case ID_INPUT:
    446                         wrapperClass = [DOMHTMLInputElement class];
    447                         break;
    448                     case ID_TEXTAREA:
    449                         wrapperClass = [DOMHTMLTextAreaElement class];
    450                         break;
    451                     case ID_BUTTON:
    452                         wrapperClass = [DOMHTMLButtonElement class];
    453                         break;
    454                     case ID_LABEL:
    455                         wrapperClass = [DOMHTMLLabelElement class];
    456                         break; 
    457                     case ID_FIELDSET:
    458                         wrapperClass = [DOMHTMLFieldSetElement class];
    459                         break;     
    460                     case ID_LEGEND:
    461                         wrapperClass = [DOMHTMLLegendElement class];
    462                         break;
    463                     case ID_UL:
    464                         wrapperClass = [DOMHTMLUListElement class];
    465                         break;
    466                     case ID_OL:
    467                         wrapperClass = [DOMHTMLOListElement class];
    468                         break;
    469                     case ID_DL:
    470                         wrapperClass = [DOMHTMLDListElement class];
    471                         break;
    472                     case ID_DIR:
    473                         wrapperClass = [DOMHTMLDirectoryElement class];
    474                         break;
    475                     case ID_MENU:
    476                         wrapperClass = [DOMHTMLMenuElement class];
    477                         break;
    478                     case ID_LI:
    479                         wrapperClass = [DOMHTMLLIElement class];
    480                         break;
    481                     case ID_DIV:
    482                         wrapperClass = [DOMHTMLDivElement class];
    483                         break;
    484                     case ID_P:
    485                         wrapperClass = [DOMHTMLParagraphElement class];
    486                         break;
    487                     case ID_Q:
    488                         wrapperClass = [DOMHTMLQuoteElement class];
    489                         break;
    490                     case ID_PRE:
    491                         wrapperClass = [DOMHTMLPreElement class];
    492                         break;
    493                     case ID_BR:
    494                         wrapperClass = [DOMHTMLBRElement class];
    495                         break;
    496                     case ID_BASEFONT:
    497                         wrapperClass = [DOMHTMLFontElement class];
    498                         break;
    499                     case ID_FONT:
    500                         wrapperClass = [DOMHTMLFontElement class];
    501                         break;
    502                     case ID_HR:
    503                         wrapperClass = [DOMHTMLHRElement class];
    504                         break;
    505                     case ID_A:
    506                         wrapperClass = [DOMHTMLAnchorElement class];
    507                         break;
    508                     case ID_IMG:
    509                         wrapperClass = [DOMHTMLImageElement class];
    510                         break;
    511                     case ID_OBJECT:
    512                         wrapperClass = [DOMHTMLObjectElement class];
    513                         break;
    514                     case ID_PARAM:
    515                         wrapperClass = [DOMHTMLParamElement class];
    516                         break;
    517                     case ID_APPLET:
    518                         wrapperClass = [DOMHTMLAppletElement class];
    519                         break;
    520                     case ID_MAP:
    521                         wrapperClass = [DOMHTMLMapElement class];
    522                         break;
    523                     case ID_AREA:
    524                         wrapperClass = [DOMHTMLAreaElement class];
    525                         break;
    526                     case ID_SCRIPT:
    527                         wrapperClass = [DOMHTMLScriptElement class];
    528                         break;
    529                     case ID_TABLE:
    530                         wrapperClass = [DOMHTMLTableElement class];
    531                         break;
    532                     case ID_TD:
    533                         wrapperClass = [DOMHTMLTableCellElement class];
    534                         break;
    535                     case ID_TR:
    536                         wrapperClass = [DOMHTMLTableRowElement class];
    537                         break;
    538                     case ID_FRAMESET:
    539                         wrapperClass = [DOMHTMLFrameSetElement class];
    540                         break;
    541                     case ID_FRAME:
    542                         wrapperClass = [DOMHTMLFrameElement class];
    543                         break;
    544                     case ID_IFRAME:
    545                         wrapperClass = [DOMHTMLIFrameElement class];
    546                         break;
    547                     default:
    548                         wrapperClass = [DOMHTMLElement class];
    549                 }
     403                // FIXME: Reflect marquee once the API has been determined.
     404                // FIXME: We could make the HTML classes hand back their class names and then use that to make
     405                // the appropriate Obj-C class from the string.
     406                HTMLElementImpl* htmlElt = static_cast<HTMLElementImpl*>(impl);
     407                if (htmlElt->hasLocalName(HTMLNames::html()))
     408                    wrapperClass = [DOMHTMLHtmlElement class];
     409                else if (htmlElt->hasLocalName(HTMLNames::head()))
     410                    wrapperClass = [DOMHTMLHeadElement class];
     411                else if (htmlElt->hasLocalName(HTMLNames::link()))
     412                    wrapperClass = [DOMHTMLLinkElement class];
     413                else if (htmlElt->hasLocalName(HTMLNames::title()))
     414                    wrapperClass = [DOMHTMLTitleElement class];
     415                else if (htmlElt->hasLocalName(HTMLNames::meta()))
     416                    wrapperClass = [DOMHTMLMetaElement class];
     417                else if (htmlElt->hasLocalName(HTMLNames::base()))
     418                    wrapperClass = [DOMHTMLBaseElement class];
     419                else if (htmlElt->hasLocalName(HTMLNames::isindex()))
     420                    wrapperClass = [DOMHTMLIsIndexElement class];
     421                else if (htmlElt->hasLocalName(HTMLNames::style()))
     422                    wrapperClass = [DOMHTMLStyleElement class];
     423                else if (htmlElt->hasLocalName(HTMLNames::body()))
     424                    wrapperClass = [DOMHTMLBodyElement class];
     425                else if (htmlElt->hasLocalName(HTMLNames::form()))
     426                    wrapperClass = [DOMHTMLFormElement class];
     427                else if (htmlElt->hasLocalName(HTMLNames::select()))
     428                    wrapperClass = [DOMHTMLSelectElement class];
     429                else if (htmlElt->hasLocalName(HTMLNames::optgroup()))
     430                    wrapperClass = [DOMHTMLOptGroupElement class];
     431                else if (htmlElt->hasLocalName(HTMLNames::option()))
     432                    wrapperClass = [DOMHTMLOptionElement class];
     433                else if (htmlElt->hasLocalName(HTMLNames::input()))
     434                    wrapperClass = [DOMHTMLInputElement class];
     435                else if (htmlElt->hasLocalName(HTMLNames::textarea()))
     436                    wrapperClass = [DOMHTMLTextAreaElement class];
     437                else if (htmlElt->hasLocalName(HTMLNames::button()))
     438                    wrapperClass = [DOMHTMLButtonElement class];
     439                else if (htmlElt->hasLocalName(HTMLNames::label()))
     440                    wrapperClass = [DOMHTMLLabelElement class];
     441                else if (htmlElt->hasLocalName(HTMLNames::fieldset()))
     442                    wrapperClass = [DOMHTMLFieldSetElement class];
     443                else if (htmlElt->hasLocalName(HTMLNames::legend()))
     444                    wrapperClass = [DOMHTMLLegendElement class];
     445                else if (htmlElt->hasLocalName(HTMLNames::ul()))
     446                    wrapperClass = [DOMHTMLUListElement class];
     447                else if (htmlElt->hasLocalName(HTMLNames::ol()))                       
     448                    wrapperClass = [DOMHTMLOListElement class];
     449                else if (htmlElt->hasLocalName(HTMLNames::dl()))
     450                    wrapperClass = [DOMHTMLDListElement class];
     451                else if (htmlElt->hasLocalName(HTMLNames::dir()))
     452                    wrapperClass = [DOMHTMLDirectoryElement class];
     453                else if (htmlElt->hasLocalName(HTMLNames::menu()))
     454                    wrapperClass = [DOMHTMLMenuElement class];
     455                else if (htmlElt->hasLocalName(HTMLNames::li()))
     456                    wrapperClass = [DOMHTMLLIElement class];
     457                else if (htmlElt->hasLocalName(HTMLNames::div()))
     458                    wrapperClass = [DOMHTMLDivElement class];
     459                else if (htmlElt->hasLocalName(HTMLNames::p()))
     460                    wrapperClass = [DOMHTMLParagraphElement class];
     461                else if (htmlElt->hasLocalName(HTMLNames::h1()) ||
     462                         htmlElt->hasLocalName(HTMLNames::h2()) ||
     463                         htmlElt->hasLocalName(HTMLNames::h3()) ||
     464                         htmlElt->hasLocalName(HTMLNames::h4()) ||
     465                         htmlElt->hasLocalName(HTMLNames::h5()) ||
     466                         htmlElt->hasLocalName(HTMLNames::h6()))
     467                    wrapperClass = [DOMHTMLHeadingElement class];
     468                else if (htmlElt->hasLocalName(HTMLNames::q()))
     469                    wrapperClass = [DOMHTMLQuoteElement class];
     470                else if (htmlElt->hasLocalName(HTMLNames::pre()))
     471                    wrapperClass = [DOMHTMLPreElement class];
     472                else if (htmlElt->hasLocalName(HTMLNames::br()))
     473                    wrapperClass = [DOMHTMLBRElement class];
     474                else if (htmlElt->hasLocalName(HTMLNames::basefont()))
     475                    wrapperClass = [DOMHTMLBaseFontElement class];
     476                else if (htmlElt->hasLocalName(HTMLNames::font()))
     477                    wrapperClass = [DOMHTMLFontElement class];
     478                else if (htmlElt->hasLocalName(HTMLNames::hr()))
     479                    wrapperClass = [DOMHTMLHRElement class];
     480                else if (htmlElt->hasLocalName(HTMLNames::a()))
     481                    wrapperClass = [DOMHTMLAnchorElement class];
     482                else if (htmlElt->hasLocalName(HTMLNames::img()) ||
     483                         htmlElt->hasLocalName(HTMLNames::canvas()))
     484                    wrapperClass = [DOMHTMLImageElement class];
     485                else if (htmlElt->hasLocalName(HTMLNames::object()))
     486                    wrapperClass = [DOMHTMLObjectElement class];
     487                else if (htmlElt->hasLocalName(HTMLNames::param()))
     488                    wrapperClass = [DOMHTMLParamElement class];
     489                else if (htmlElt->hasLocalName(HTMLNames::applet()))
     490                    wrapperClass = [DOMHTMLAppletElement class];
     491                else if (htmlElt->hasLocalName(HTMLNames::map()))
     492                    wrapperClass = [DOMHTMLMapElement class];
     493                else if (htmlElt->hasLocalName(HTMLNames::area()))
     494                    wrapperClass = [DOMHTMLAreaElement class];
     495                else if (htmlElt->hasLocalName(HTMLNames::script()))
     496                    wrapperClass = [DOMHTMLScriptElement class];
     497                else if (htmlElt->hasLocalName(HTMLNames::table()))
     498                    wrapperClass = [DOMHTMLTableElement class];
     499                else if (htmlElt->hasLocalName(HTMLNames::thead()) ||
     500                         htmlElt->hasLocalName(HTMLNames::tbody()) ||
     501                         htmlElt->hasLocalName(HTMLNames::tfoot()))
     502                    wrapperClass = [DOMHTMLTableSectionElement class];
     503                else if (htmlElt->hasLocalName(HTMLNames::td()))
     504                    wrapperClass = [DOMHTMLTableCellElement class];
     505                else if (htmlElt->hasLocalName(HTMLNames::tr()))
     506                    wrapperClass = [DOMHTMLTableRowElement class];
     507                else if (htmlElt->hasLocalName(HTMLNames::col()) ||
     508                         htmlElt->hasLocalName(HTMLNames::colgroup()))
     509                    wrapperClass = [DOMHTMLTableColElement class];
     510                else if (htmlElt->hasLocalName(HTMLNames::caption()))
     511                    wrapperClass = [DOMHTMLTableCaptionElement class];
     512                else if (htmlElt->hasLocalName(HTMLNames::frameset()))
     513                    wrapperClass = [DOMHTMLFrameSetElement class];
     514                else if (htmlElt->hasLocalName(HTMLNames::frame()))
     515                    wrapperClass = [DOMHTMLFrameElement class];
     516                else if (htmlElt->hasLocalName(HTMLNames::iframe()))
     517                    wrapperClass = [DOMHTMLIFrameElement class];
     518                else
     519                    wrapperClass = [DOMHTMLElement class];
    550520            } else {
    551521                wrapperClass = [DOMElement class];
     
    12691239- (NSString *)tagName
    12701240{
    1271     return [self _elementImpl]->tagName();
     1241    return [self _elementImpl]->nodeName();
    12721242}
    12731243
  • trunk/WebCore/kwq/DOMHTML.mm

    r9169 r9639  
    7575using DOM::HTMLFrameElementImpl;
    7676using DOM::HTMLFrameSetElementImpl;
    77 using DOM::HTMLGenericElementImpl;
    7877using DOM::HTMLGenericFormElementImpl;
    7978using DOM::HTMLHeadElementImpl;
     
    19061905@implementation DOMHTMLQuoteElement
    19071906
    1908 - (HTMLGenericElementImpl *)_quoteElementImpl
    1909 {
    1910     return static_cast<HTMLGenericElementImpl *>(DOM_cast<NodeImpl *>(_internal));
     1907- (HTMLElementImpl *)_quoteElementImpl
     1908{
     1909    return static_cast<HTMLElementImpl *>(DOM_cast<NodeImpl *>(_internal));
    19111910}
    19121911
  • trunk/WebCore/kwq/KWQAccObject.mm

    r9611 r9639  
    4949#import "dom2_range.h"
    5050#import "htmlattrs.h"
    51 #import "htmltags.h"
    5251#import "khtmlview.h"
    5352#import "khtml_part.h"
     
    7877using DOM::HTMLInputElementImpl;
    7978using DOM::HTMLMapElementImpl;
     79using DOM::HTMLNames;
    8080using DOM::Node;
    8181using DOM::NodeImpl;
     
    367367    if (m_renderer->isListMarker())
    368368        return @"AXListMarker";
    369     if (m_renderer->element() && m_renderer->element()->identifier() == ID_BUTTON)
     369    if (m_renderer->element() && m_renderer->element()->hasTagName(HTMLNames::button()))
    370370        return NSAccessibilityButtonRole;
    371371    if (m_renderer->isText())
     
    533533        return nil;
    534534   
    535     if (m_renderer->element()->isHTMLElement() && m_renderer->element()->identifier() == ID_BUTTON)
     535    if (m_renderer->element()->isHTMLElement() && m_renderer->element()->hasTagName(HTMLNames::button()))
    536536        return [self textUnderElement];
    537537    if (m_renderer->element()->isLink())
     
    623623            !m_renderer->isImage() &&
    624624            !(m_renderer->element() && m_renderer->element()->isHTMLElement() &&
    625               m_renderer->element()->identifier() == ID_BUTTON));
     625              m_renderer->element()->hasTagName(HTMLNames::button())));
    626626}
    627627
  • trunk/WebCore/kwq/KWQFont.h

    r4024 r9639  
    3838public:
    3939    enum Weight { Normal = 50, Bold = 63 };
     40    enum Pitch { Unknown, Fixed, Variable };
    4041
    4142    QFont();
     
    6263    int pixelSize() const { return (int)_size; }
    6364
    64     bool isFixedPitch() const;
     65    bool isFixedPitch() const { if (_pitch == Unknown) determinePitch(); return _pitch == Fixed; };
     66    void determinePitch() const;
    6567   
    6668    void setPrinterFont(bool);
     
    8082    int _trait;
    8183    float _size;
    82     bool _isPrinterFont;
     84    bool _isPrinterFont : 1;
     85    mutable Pitch _pitch : 2;
    8386    mutable NSFont *_NSFont;
    8487};
  • trunk/WebCore/kwq/KWQFont.mm

    r8836 r9639  
    3535    , _size(12.0)
    3636    , _isPrinterFont(false)
     37    , _pitch(Unknown)
    3738    , _NSFont(0)
    3839{
     
    4950    , _size(other._size)
    5051    , _isPrinterFont(other._isPrinterFont)
     52    , _pitch(other._pitch)
    5153    , _NSFont(KWQRetain(other._NSFont))
    5254{
     
    5961    _size = other._size;
    6062    _isPrinterFont = other._isPrinterFont;
     63    _pitch = other._pitch;
    6164    KWQRetain(other._NSFont);
    6265    KWQRelease(_NSFont);
     
    147150}
    148151
    149 bool QFont::isFixedPitch() const
     152void QFont::determinePitch() const
    150153{
    151154    KWQ_BLOCK_EXCEPTIONS;
    152     return [[WebCoreTextRendererFactory sharedFactory] isFontFixedPitch: getNSFont()];
     155    if ([[WebCoreTextRendererFactory sharedFactory] isFontFixedPitch: getNSFont()])
     156        _pitch = Fixed;
     157    else
     158        _pitch = Variable;
    153159    KWQ_UNBLOCK_EXCEPTIONS;
    154     return false;
    155160}
    156 
    157161
    158162bool QFont::operator==(const QFont &compareFont) const
     
    161165        && _trait == compareFont._trait
    162166        && _size == compareFont._size
    163         && _isPrinterFont == compareFont._isPrinterFont;
     167        && _isPrinterFont == compareFont._isPrinterFont
     168        && _pitch == compareFont._pitch;
    164169}
    165170
  • trunk/WebCore/kwq/KWQKHTMLPart.cpp

    r3930 r9639  
    3333using DOM::DocumentImpl;
    3434using DOM::HTMLDocumentImpl;
     35using DOM::HTMLNames;
    3536using DOM::NodeImpl;
    3637
     38// FIXME: What on earth is this single tiny file with only this method doing here?
    3739bool KWQKHTMLPart::isFrameSet() const
    3840{
     
    4143        return false;
    4244    NodeImpl *body = static_cast<HTMLDocumentImpl *>(document)->body();
    43     return body && body->renderer() && body->id() == ID_FRAMESET;
     45    return body && body->renderer() && body->hasTagName(HTMLNames::frameset());
    4446}
  • trunk/WebCore/kwq/KWQKHTMLPart.mm

    r9619 r9639  
    2929
    3030#import "KWQClipboard.h"
    31 #import "KWQDOMNode.h"
    3231#import "KWQDummyView.h"
    3332#import "KWQEditCommand.h"
     
    101100using DOM::HTMLFrameElementImpl;
    102101using DOM::HTMLGenericFormElementImpl;
     102using DOM::HTMLNames;
    103103using DOM::HTMLTableCellElementImpl;
    104104using DOM::Node;
     
    365365    NodeImpl *n;
    366366    for (n = start; n; n = n->traverseNextNode()) {
    367         NodeImpl::Id nodeID = idFromNode(n);
    368         if (nodeID == ID_FORM) {
     367        if (n->hasTagName(HTMLNames::form())) {
    369368            return static_cast<HTMLFormElementImpl *>(n);
    370369        } else if (n->isHTMLElement()
    371370                   && static_cast<HTMLElementImpl *>(n)->isGenericFormElement()) {
    372371            return static_cast<HTMLGenericFormElementImpl *>(n)->form();
    373         } else if (nodeID == ID_FRAME || nodeID == ID_IFRAME) {
     372        } else if (n->hasTagName(HTMLNames::frame()) || n->hasTagName(HTMLNames::iframe())) {
    374373            NodeImpl *childDoc = static_cast<HTMLFrameElementImpl *>(n)->contentDocument();
    375374            HTMLFormElementImpl *frameResult = scanForForm(childDoc);
     
    394393    NodeImpl *n;
    395394    for (n = start; n; n = n->parentNode()) {
    396         if (idFromNode(n) == ID_FORM) {
     395        if (n->hasTagName(HTMLNames::form())) {
    397396            return static_cast<HTMLFormElementImpl *>(n);
    398397        } else if (n->isHTMLElement()
     
    493492            // search within the above cell we found for a match
    494493            for (NodeImpl *n = aboveCell->firstChild(); n; n = n->traverseNextNode(aboveCell)) {
    495                 if (idFromNode(n) == ID_TEXT
    496                     && n->renderer() && n->renderer()->style()->visibility() == VISIBLE)
     494                if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE)
    497495                {
    498496                    // For each text chunk, run the regexp
     
    529527         n = n->traversePreviousNode())
    530528    {
    531         NodeImpl::Id nodeID = idFromNode(n);
    532         if (nodeID == ID_FORM
     529        if (n->hasTagName(HTMLNames::form())
    533530            || (n->isHTMLElement()
    534531                && static_cast<HTMLElementImpl *>(n)->isGenericFormElement()))
     
    536533            // We hit another form element or the start of the form - bail out
    537534            break;
    538         } else if (nodeID == ID_TD && !startingTableCell) {
     535        } else if (n->hasTagName(HTMLNames::td()) && !startingTableCell) {
    539536            startingTableCell = static_cast<HTMLTableCellElementImpl *>(n);
    540         } else if (nodeID == ID_TR && startingTableCell) {
     537        } else if (n->hasTagName(HTMLNames::tr()) && startingTableCell) {
    541538            NSString *result = searchForLabelsAboveCell(regExp, startingTableCell);
    542539            if (result) {
     
    544541            }
    545542            searchedCellAbove = true;
    546         } else if (nodeID == ID_TEXT
    547                    && n->renderer() && n->renderer()->style()->visibility() == VISIBLE)
     543        } else if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE)
    548544        {
    549545            // For each text chunk, run the regexp
     
    28522848static ElementImpl *listParent(ElementImpl *item)
    28532849{
    2854     // Ick!  Avoid use of item->id() which confuses ObjC++.
    2855     unsigned short _id = item->identifier();
    2856    
    2857     while (_id != ID_UL && _id != ID_OL) {
     2850    while (!item->hasTagName(HTMLNames::ul()) && !item->hasTagName(HTMLNames::ol())) {
    28582851        item = static_cast<ElementImpl *>(item->parentNode());
    28592852        if (!item)
    28602853            break;
    2861         _id = item->identifier();
    28622854    }
    28632855    return item;
     
    28722864        if (par->firstChild() != e)
    28732865            return 0;
    2874         if (par->identifier() == ID_LI)
     2866        if (par->hasTagName(HTMLNames::li()))
    28752867            return par;
    28762868        e = par;
     
    30263018                // This is our simple HTML -> ASCII transformation:
    30273019                QString text;
    3028                 NodeImpl::Id _id = n->identifier();
    3029                 switch(_id) {
    3030                     case ID_A:
    3031                         // Note the start of the <a> element.  We will add the NSLinkAttributeName
    3032                         // attribute to the attributed string when navigating to the next sibling
    3033                         // of this node.
    3034                         linkStartLocation = [result length];
    3035                         linkStartNode = static_cast<ElementImpl*>(n);
    3036                         break;
    3037 
    3038                     case ID_BR:
    3039                         text += "\n";
    3040                         hasNewLine = true;
    3041                         break;
    3042    
    3043                     case ID_LI:
    3044                         {
    3045                             QString listText;
    3046                             ElementImpl *itemParent = listParent(static_cast<ElementImpl *>(n));
    3047                            
    3048                             if (!hasNewLine)
    3049                                 listText += '\n';
    3050                             hasNewLine = true;
    3051    
    3052                             listItems.append(static_cast<ElementImpl*>(n));
    3053                             ListItemInfo info;
    3054                             info.start = [result length];
    3055                             info.end = 0;
    3056                             listItemLocations.append (info);
    3057                            
    3058                             listText += '\t';
    3059                             if (itemParent && renderer->isListItem()) {
    3060                                 RenderListItem *listRenderer = static_cast<RenderListItem*>(renderer);
    3061 
    3062                                 maxMarkerWidth = MAX([font pointSize], maxMarkerWidth);
    3063                                 switch(style->listStyleType()) {
    3064                                     case khtml::DISC:
    3065                                         listText += ((QChar)BULLET_CHAR);
    3066                                         break;
    3067                                     case khtml::CIRCLE:
    3068                                         listText += ((QChar)CIRCLE_CHAR);
    3069                                         break;
    3070                                     case khtml::SQUARE:
    3071                                         listText += ((QChar)SQUARE_CHAR);
    3072                                         break;
    3073                                     case khtml::LNONE:
    3074                                         break;
    3075                                     default:
    3076                                         QString marker = listRenderer->markerStringValue();
    3077                                         listText += marker;
    3078                                         // Use AppKit metrics.  Will be rendered by AppKit.
    3079                                         float markerWidth = [font widthOfString: marker.getNSString()];
    3080                                         maxMarkerWidth = MAX(markerWidth, maxMarkerWidth);
    3081                                 }
    3082 
    3083                                 listText += ' ';
    3084                                 listText += '\t';
    3085    
    3086                                 NSMutableDictionary *attrs;
    3087            
    3088                                 attrs = [[NSMutableDictionary alloc] init];
    3089                                 [attrs setObject:font forKey:NSFontAttributeName];
    3090                                 if (style && style->color().isValid())
    3091                                     [attrs setObject:nsColor(style->color()) forKey:NSForegroundColorAttributeName];
    3092                                 if (style && style->backgroundColor().isValid())
    3093                                     [attrs setObject:nsColor(style->backgroundColor()) forKey:NSBackgroundColorAttributeName];
    3094            
    3095                                 NSAttributedString *partialString = [[NSAttributedString alloc] initWithString:listText.getNSString() attributes:attrs];
    3096                                 [attrs release];
    3097                                 [result appendAttributedString: partialString];               
    3098                                 [partialString release];
    3099                             }
     3020                if (n->hasTagName(HTMLNames::a())) {
     3021                    // Note the start of the <a> element.  We will add the NSLinkAttributeName
     3022                    // attribute to the attributed string when navigating to the next sibling
     3023                    // of this node.
     3024                    linkStartLocation = [result length];
     3025                    linkStartNode = static_cast<ElementImpl*>(n);
     3026                } else if (n->hasTagName(HTMLNames::br())) {
     3027                    text += "\n";
     3028                    hasNewLine = true;
     3029                } else if (n->hasTagName(HTMLNames::li())) {
     3030                    QString listText;
     3031                    ElementImpl *itemParent = listParent(static_cast<ElementImpl *>(n));
     3032                   
     3033                    if (!hasNewLine)
     3034                        listText += '\n';
     3035                    hasNewLine = true;
     3036
     3037                    listItems.append(static_cast<ElementImpl*>(n));
     3038                    ListItemInfo info;
     3039                    info.start = [result length];
     3040                    info.end = 0;
     3041                    listItemLocations.append (info);
     3042                   
     3043                    listText += '\t';
     3044                    if (itemParent && renderer->isListItem()) {
     3045                        RenderListItem *listRenderer = static_cast<RenderListItem*>(renderer);
     3046
     3047                        maxMarkerWidth = MAX([font pointSize], maxMarkerWidth);
     3048                        switch(style->listStyleType()) {
     3049                            case khtml::DISC:
     3050                                listText += ((QChar)BULLET_CHAR);
     3051                                break;
     3052                            case khtml::CIRCLE:
     3053                                listText += ((QChar)CIRCLE_CHAR);
     3054                                break;
     3055                            case khtml::SQUARE:
     3056                                listText += ((QChar)SQUARE_CHAR);
     3057                                break;
     3058                            case khtml::LNONE:
     3059                                break;
     3060                            default:
     3061                                QString marker = listRenderer->markerStringValue();
     3062                                listText += marker;
     3063                                // Use AppKit metrics.  Will be rendered by AppKit.
     3064                                float markerWidth = [font widthOfString: marker.getNSString()];
     3065                                maxMarkerWidth = MAX(markerWidth, maxMarkerWidth);
    31003066                        }
    3101                         break;
    3102 
    3103                     case ID_OL:
    3104                     case ID_UL:
     3067
     3068                        listText += ' ';
     3069                        listText += '\t';
     3070
     3071                        NSMutableDictionary *attrs = [[NSMutableDictionary alloc] init];
     3072                        [attrs setObject:font forKey:NSFontAttributeName];
     3073                        if (style && style->color().isValid())
     3074                            [attrs setObject:nsColor(style->color()) forKey:NSForegroundColorAttributeName];
     3075                        if (style && style->backgroundColor().isValid())
     3076                            [attrs setObject:nsColor(style->backgroundColor()) forKey:NSBackgroundColorAttributeName];
     3077
     3078                        NSAttributedString *partialString = [[NSAttributedString alloc] initWithString:listText.getNSString() attributes:attrs];
     3079                        [attrs release];
     3080                        [result appendAttributedString: partialString];               
     3081                        [partialString release];
     3082                    }
     3083                    else if (n->hasTagName(HTMLNames::ol()) || n->hasTagName(HTMLNames::ul())) {
    31053084                        if (!hasNewLine)
    31063085                            text += "\n";
    31073086                        hasNewLine = true;
    3108                         break;
    3109 
    3110                     case ID_TD:
    3111                     case ID_TH:
    3112                     case ID_HR:
    3113                     case ID_DD:
    3114                     case ID_DL:
    3115                     case ID_DT:
    3116                     case ID_PRE:
    3117                     case ID_BLOCKQUOTE:
    3118                     case ID_DIV:
     3087                    } else if (n->hasTagName(HTMLNames::td()) ||
     3088                               n->hasTagName(HTMLNames::th()) ||
     3089                               n->hasTagName(HTMLNames::hr()) ||
     3090                               n->hasTagName(HTMLNames::dd()) ||
     3091                               n->hasTagName(HTMLNames::dl()) ||
     3092                               n->hasTagName(HTMLNames::dt()) ||
     3093                               n->hasTagName(HTMLNames::pre()) ||
     3094                               n->hasTagName(HTMLNames::blockquote()) ||
     3095                               n->hasTagName(HTMLNames::div())) {
    31193096                        if (!hasNewLine)
    31203097                            text += '\n';
    31213098                        hasNewLine = true;
    3122                         break;
    3123                     case ID_P:
    3124                     case ID_TR:
    3125                     case ID_H1:
    3126                     case ID_H2:
    3127                     case ID_H3:
    3128                     case ID_H4:
    3129                     case ID_H5:
    3130                     case ID_H6: {
     3099                    } else if (n->hasTagName(HTMLNames::p()) ||
     3100                               n->hasTagName(HTMLNames::tr()) ||
     3101                               n->hasTagName(HTMLNames::h1()) ||
     3102                               n->hasTagName(HTMLNames::h2()) ||
     3103                               n->hasTagName(HTMLNames::h3()) ||
     3104                               n->hasTagName(HTMLNames::h4()) ||
     3105                               n->hasTagName(HTMLNames::h5()) ||
     3106                               n->hasTagName(HTMLNames::h6())) {
    31313107                        if (!hasNewLine)
    31323108                            text += '\n';
     
    31433119                       
    31443120                        hasNewLine = true;
    3145                         break;
    31463121                    }
    3147                        
    3148                     case ID_IMG:
     3122                    else if (n->hasTagName(HTMLNames::img())) {
    31493123                        if (pendingStyledSpace != nil) {
    31503124                            if (linkStartLocation == [result length]) {
     
    31603134                        [result appendAttributedString: iString];
    31613135                        [attachment release];
    3162                         break;
     3136                    }
    31633137                }
     3138
    31643139                NSAttributedString *partialString = [[NSAttributedString alloc] initWithString:text.getNSString()];
    31653140                [result appendAttributedString: partialString];
     
    31833158            next = n->nextSibling();
    31843159
    3185             NodeImpl::Id _id = n->identifier();
    3186             switch(_id) {
    3187                 case ID_A:
    3188                     // End of a <a> element.  Create an attributed string NSLinkAttributeName attribute
    3189                     // for the range of the link.  Note that we create the attributed string from the DOM, which
    3190                     // will have corrected any illegally nested <a> elements.
    3191                     if (linkStartNode && n == linkStartNode){
    3192                         DOMString href = parseURL(linkStartNode->getAttribute(ATTR_HREF));
    3193                         KURL kURL = KWQ(linkStartNode->getDocument()->part())->completeURL(href.string());
    3194                        
    3195                         NSURL *URL = kURL.getNSURL();
    3196                         [result addAttribute:NSLinkAttributeName value:URL range:NSMakeRange(linkStartLocation, [result length]-linkStartLocation)];
    3197                         linkStartNode = 0;
     3160            if (n->hasTagName(HTMLNames::a())) {
     3161                // End of a <a> element.  Create an attributed string NSLinkAttributeName attribute
     3162                // for the range of the link.  Note that we create the attributed string from the DOM, which
     3163                // will have corrected any illegally nested <a> elements.
     3164                if (linkStartNode && n == linkStartNode) {
     3165                    DOMString href = parseURL(linkStartNode->getAttribute(ATTR_HREF));
     3166                    KURL kURL = KWQ(linkStartNode->getDocument()->part())->completeURL(href.string());
     3167                   
     3168                    NSURL *URL = kURL.getNSURL();
     3169                    [result addAttribute:NSLinkAttributeName value:URL range:NSMakeRange(linkStartLocation, [result length]-linkStartLocation)];
     3170                    linkStartNode = 0;
     3171                }
     3172            }
     3173            else if (n->hasTagName(HTMLNames::ol()) || n->hasTagName(HTMLNames::ul())) {
     3174                if (!hasNewLine)
     3175                    text += '\n';
     3176                hasNewLine = true;
     3177            } else if (n->hasTagName(HTMLNames::li())) {
     3178               
     3179                int i, count = listItems.count();
     3180                for (i = 0; i < count; i++){
     3181                    if (listItems.at(i) == n){
     3182                        listItemLocations[i].end = [result length];
     3183                        break;
    31983184                    }
    3199                     break;
    3200                
    3201                 case ID_OL:
    3202                 case ID_UL:
    3203                     if (!hasNewLine)
    3204                         text += '\n';
    3205                     hasNewLine = true;
    3206                     break;
    3207 
    3208                 case ID_LI:
    3209                     {
    3210                         int i, count = listItems.count();
    3211                         for (i = 0; i < count; i++){
    3212                             if (listItems.at(i) == n){
    3213                                 listItemLocations[i].end = [result length];
    3214                                 break;
    3215                             }
    3216                         }
    3217                     }
    3218                     if (!hasNewLine)
    3219                         text += '\n';
    3220                     hasNewLine = true;
    3221                     break;
    3222 
    3223                 case ID_TD:
    3224                 case ID_TH:
    3225                 case ID_HR:
    3226                 case ID_DD:
    3227                 case ID_DL:
    3228                 case ID_DT:
    3229                 case ID_PRE:
    3230                 case ID_BLOCKQUOTE:
    3231                 case ID_DIV:
    3232                     if (!hasNewLine)
    3233                         text += '\n';
    3234                     hasNewLine = true;
    3235                     break;
    3236                 case ID_P:
    3237                 case ID_TR:
    3238                 case ID_H1:
    3239                 case ID_H2:
    3240                 case ID_H3:
    3241                 case ID_H4:
    3242                 case ID_H5:
    3243                 case ID_H6:
    3244                     if (!hasNewLine)
    3245                         text += '\n';
    3246                     // An extra newline is needed at the start, not the end, of these types of tags,
    3247                     // so don't add another here.
    3248                     hasNewLine = true;
    3249                     break;
     3185                }
     3186                if (!hasNewLine)
     3187                    text += '\n';
     3188                hasNewLine = true;
     3189            } else if (n->hasTagName(HTMLNames::td()) ||
     3190                       n->hasTagName(HTMLNames::th()) ||
     3191                       n->hasTagName(HTMLNames::hr()) ||
     3192                       n->hasTagName(HTMLNames::dd()) ||
     3193                       n->hasTagName(HTMLNames::dl()) ||
     3194                       n->hasTagName(HTMLNames::dt()) ||
     3195                       n->hasTagName(HTMLNames::pre()) ||
     3196                       n->hasTagName(HTMLNames::blockquote()) ||
     3197                       n->hasTagName(HTMLNames::div())) {
     3198                if (!hasNewLine)
     3199                    text += '\n';
     3200                hasNewLine = true;
     3201            } else if (n->hasTagName(HTMLNames::p()) ||
     3202                       n->hasTagName(HTMLNames::tr()) ||
     3203                       n->hasTagName(HTMLNames::h1()) ||
     3204                       n->hasTagName(HTMLNames::h2()) ||
     3205                       n->hasTagName(HTMLNames::h3()) ||
     3206                       n->hasTagName(HTMLNames::h4()) ||
     3207                       n->hasTagName(HTMLNames::h5()) ||
     3208                       n->hasTagName(HTMLNames::h6())) {
     3209                if (!hasNewLine)
     3210                    text += '\n';
     3211                // An extra newline is needed at the start, not the end, of these types of tags,
     3212                // so don't add another here.
     3213                hasNewLine = true;
    32503214            }
    32513215           
     
    34803444
    34813445    int exceptionCode = 0;
    3482     ElementImpl *styleElement = xmlDocImpl()->createHTMLElement("span", exceptionCode);
     3446    ElementImpl *styleElement = xmlDocImpl()->createElementNS(HTMLNames::xhtmlNamespaceURI(), "span", exceptionCode);
    34833447    ASSERT(exceptionCode == 0);
    34843448
     
    37073671            // Look for a block flow, but skip over the HTML element, since we really
    37083672            // want to get at least as far as the the BODY element in a document.
    3709             if (node->isBlockFlow() && node->identifier() != ID_HTML)
     3673            if (node->isBlockFlow() && node->hasTagName(HTMLNames::html()))
    37103674                break;
    37113675            node = node->traverseNextNode();
  • trunk/WebCore/kwq/KWQRenderTreeDebug.cpp

    r9174 r9639  
    2828#include "dom_docimpl.h"
    2929#include "dom_position.h"
    30 #include "htmltags.h"
    3130#include "jsediting.h"
    3231#include "khtmlview.h"
     
    117116    if (n->isDocumentNode())
    118117        return "";
    119     if (n->id() <= ID_LAST_TAG)
    120         return getTagName(n->id()).string();
    121     return n->nodeName().string();
     118    if (n->isTextNode())
     119        return "TEXT"; // FIXME: Remove once the layout tests are ready to change.
     120    if (n->isCommentNode())
     121        return "COMMENT";
     122    if (n->isHTMLElement())
     123        return n->nodeName().upper().string(); // FIXME: We want to dump the real DOM name, not an uppercase name.
     124    return n->nodeName().string();
    122125}
    123126
  • trunk/WebCore/kwq/WebCoreBridge.mm

    r9611 r9639  
    4040#import "htmlattrs.h"
    4141#import "htmlediting.h"
    42 #import "htmltags.h"
    4342#import "khtml_part.h"
    4443#import "khtmlview.h"
     
    6867#import "KWQCharsets.h"
    6968#import "KWQClipboard.h"
    70 #import "KWQDOMNode.h"
    7169#import "KWQEditCommand.h"
    7270#import "KWQFont.h"
     
    10199using DOM::HTMLImageElementImpl;
    102100using DOM::HTMLInputElementImpl;
     101using DOM::HTMLNames;
    103102using DOM::NodeImpl;
    104103using DOM::Position;
     
    914913{
    915914    NodeImpl *node = [element _nodeImpl];
    916     if (node && idFromNode(node) == ID_INPUT) {
     915    if (node->hasTagName(HTMLNames::input())) {
    917916        return static_cast<HTMLInputElementImpl *>(node);
    918917    }
     
    927926    // that contains <form> elements that aren't in any namespace, so
    928927    // they come out as generic CML elements
    929     if (node && node->isHTMLElement() && idFromNode(node) == ID_FORM) {
     928    if (node && node->hasTagName(HTMLNames::form())) {
    930929        return static_cast<HTMLFormElementImpl *>(node);
    931930    }
     
    10971096            // FIXME: Code copied from RenderImage::updateFromElement; should share.
    10981097            DOMString attr;
    1099             if (idFromNode(i) == ID_OBJECT) {
     1098            if (i->hasTagName(HTMLNames::object())) {
    11001099                attr = i->getAttribute(ATTR_DATA);
    11011100            } else {
     
    11091108            // FIXME: Code copied from RenderImage::updateFromElement; should share.
    11101109            DOMString alt;
    1111             if (idFromNode(i) == ID_INPUT)
     1110            if (i->hasTagName(HTMLNames::input()))
    11121111                alt = static_cast<HTMLInputElementImpl *>(i)->altText();
    1113             else if (idFromNode(i) == ID_IMG)
     1112            else if (i->hasTagName(HTMLNames::img()))
    11141113                alt = static_cast<HTMLImageElementImpl *>(i)->altText();
    11151114            if (!alt.isNull()) {
Note: See TracChangeset for help on using the changeset viewer.