[webkit-changes] cvs commit: WebCore/layout-tests/fast/tokenizer
002-expected.txt external-script-document-write-expected.txt
script_extra_close-expected.txt script_quirk-expected.txt
script_quirk.html
David
hyatt at opensource.apple.com
Sat Jul 9 13:19:30 PDT 2005
hyatt 05/07/09 13:19:28
Modified: . ChangeLog
WebCore.pbproj project.pbxproj
khtml khtml_part.cpp khtmlview.cpp
khtml/css css_base.cpp css_base.h css_ruleimpl.cpp
css_ruleimpl.h css_stylesheetimpl.cpp
css_stylesheetimpl.h cssparser.cpp cssparser.h
cssstyleselector.cpp cssstyleselector.h parser.y
khtml/dom css_stylesheet.cpp dom_element.cpp dom_node.cpp
dom_node.h html_base.cpp html_block.cpp
html_element.cpp html_element.h html_form.cpp
html_head.cpp html_image.cpp html_inline.cpp
html_inline.h html_list.cpp html_misc.cpp
html_object.cpp html_table.cpp
khtml/ecma kjs_css.cpp kjs_dom.cpp kjs_html.cpp kjs_html.h
kjs_window.cpp
khtml/editing apply_style_command.cpp
break_blockquote_command.cpp
composite_edit_command.cpp
delete_selection_command.cpp htmlediting.cpp
insert_line_break_command.cpp
insert_paragraph_separator_command.cpp markup.cpp
replace_selection_command.cpp selection.cpp
visible_position.cpp visible_text.cpp
visible_units.cpp
khtml/html html_baseimpl.cpp html_baseimpl.h
html_blockimpl.cpp html_blockimpl.h
html_canvasimpl.cpp html_canvasimpl.h
html_documentimpl.cpp html_documentimpl.h
html_elementimpl.cpp html_elementimpl.h
html_formimpl.cpp html_formimpl.h html_headimpl.cpp
html_headimpl.h html_imageimpl.cpp html_imageimpl.h
html_inlineimpl.cpp html_inlineimpl.h
html_listimpl.cpp html_listimpl.h html_miscimpl.cpp
html_miscimpl.h html_objectimpl.cpp
html_objectimpl.h html_tableimpl.cpp
html_tableimpl.h htmlnames.cpp htmlnames.h
htmlparser.cpp htmlparser.h htmltokenizer.cpp
htmltokenizer.h
khtml/misc decoder.cpp hashmap.h hashset.h hashtable.h
htmlhashes.cpp htmlhashes.h
khtml/rendering bidi.cpp break_lines.cpp render_applet.cpp
render_block.cpp render_box.cpp
render_canvasimage.cpp render_canvasimage.h
render_container.cpp render_flow.cpp
render_form.cpp render_frames.cpp render_image.cpp
render_image.h render_layer.cpp render_line.cpp
render_list.cpp render_object.cpp render_style.cpp
render_style.h render_table.cpp
khtml/xml dom2_rangeimpl.cpp dom2_traversalimpl.cpp
dom_atomicstring.cpp dom_atomicstring.h
dom_docimpl.cpp dom_docimpl.h dom_elementimpl.cpp
dom_elementimpl.h dom_nodeimpl.cpp dom_nodeimpl.h
dom_position.cpp dom_qname.cpp dom_qname.h
dom_textimpl.cpp dom_textimpl.h xml_tokenizer.cpp
kwq DOM.mm DOMHTML.mm KWQAccObject.mm KWQFont.h
KWQFont.mm KWQKHTMLPart.cpp KWQKHTMLPart.mm
KWQRenderTreeDebug.cpp WebCoreBridge.mm
layout-tests/fast/dom css-dom-read-expected.txt
layout-tests/fast/overflow 003-expected.txt
layout-tests/fast/tokenizer 002-expected.txt
external-script-document-write-expected.txt
script_extra_close-expected.txt
Added: khtml/html htmlfactory.cpp htmlfactory.h
Removed: khtml/html dtd.cpp dtd.h
kwq KWQDOMNode.cpp KWQDOMNode.h
layout-tests/fast/tokenizer script_quirk-expected.txt
script_quirk.html
Log:
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.
Revision Changes Path
1.4397 +958 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4396
retrieving revision 1.4397
diff -u -r1.4396 -r1.4397
--- ChangeLog 9 Jul 2005 06:53:04 -0000 1.4396
+++ ChangeLog 9 Jul 2005 20:18:54 -0000 1.4397
@@ -1,3 +1,961 @@
+2005-07-09 David Hyatt <hyatt at apple.com>
+
+ 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.
+
2005-07-08 Eric Seidel <eseidel at apple.com>
Reviewed by mjs/hyatt (just approved the changelog).
1.563 +34 -106 WebCore/WebCore.pbproj/project.pbxproj
Index: project.pbxproj
===================================================================
RCS file: /cvs/root/WebCore/WebCore.pbproj/project.pbxproj,v
retrieving revision 1.562
retrieving revision 1.563
diff -u -r1.562 -r1.563
--- project.pbxproj 9 Jul 2005 06:53:11 -0000 1.562
+++ project.pbxproj 9 Jul 2005 20:18:58 -0000 1.563
@@ -220,32 +220,6 @@
//2D2
//2D3
//2D4
-//350
-//351
-//352
-//353
-//354
- 354F248902EE28590ACA2ACA = {
- fileEncoding = 30;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.c.h;
- path = KWQDOMNode.h;
- refType = 4;
- sourceTree = "<group>";
- };
- 354F248A02EE28590ACA2ACA = {
- fileEncoding = 30;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.cpp.cpp;
- path = KWQDOMNode.cpp;
- refType = 4;
- sourceTree = "<group>";
- };
-//350
-//351
-//352
-//353
-//354
//510
//511
//512
@@ -2491,7 +2465,6 @@
93F198DC08245E59001E9ABC,
93F198DE08245E59001E9ABC,
93F198E008245E59001E9ABC,
- 93F198E208245E59001E9ABC,
93F198E308245E59001E9ABC,
93F198E408245E59001E9ABC,
93F198E508245E59001E9ABC,
@@ -2568,7 +2541,6 @@
93F1992E08245E59001E9ABC,
93F1992F08245E59001E9ABC,
93F1993008245E59001E9ABC,
- 93F1993108245E59001E9ABC,
93F1993208245E59001E9ABC,
93F1993308245E59001E9ABC,
93F1993408245E59001E9ABC,
@@ -2723,7 +2695,6 @@
93F199C908245E59001E9ABC,
93F199CA08245E59001E9ABC,
93F199CB08245E59001E9ABC,
- 93F199CC08245E59001E9ABC,
93F199CE08245E59001E9ABC,
93F199CF08245E59001E9ABC,
93F199D008245E59001E9ABC,
@@ -2804,6 +2775,8 @@
65F3782B0870D958000B2F94,
65DE852908765FC30011428A,
65DE852A08765FC30011428A,
+ A85D7C19087A6ED9006A9172,
+ BCEF3435087B563E00BBF833,
A8FD8B87087CB45700DC3707,
);
isa = PBXHeadersBuildPhase;
@@ -3049,12 +3022,6 @@
settings = {
};
};
- 93F198E208245E59001E9ABC = {
- fileRef = F523D23602DE4396018635CA;
- isa = PBXBuildFile;
- settings = {
- };
- };
93F198E308245E59001E9ABC = {
fileRef = F523D23802DE4396018635CA;
isa = PBXBuildFile;
@@ -3511,12 +3478,6 @@
settings = {
};
};
- 93F1993108245E59001E9ABC = {
- fileRef = 354F248902EE28590ACA2ACA;
- isa = PBXBuildFile;
- settings = {
- };
- };
93F1993208245E59001E9ABC = {
fileRef = F587868502DE3B8601EA4122;
isa = PBXBuildFile;
@@ -4479,12 +4440,6 @@
settings = {
};
};
- 93F199CC08245E59001E9ABC = {
- fileRef = BC7FDE3205C1D9AB0070A902;
- isa = PBXBuildFile;
- settings = {
- };
- };
93F199CE08245E59001E9ABC = {
fileRef = BC3B364605C9D5E200E42902;
isa = PBXBuildFile;
@@ -5019,7 +4974,6 @@
93F19A8B08245E59001E9ABC,
93F19A8C08245E59001E9ABC,
93F19A8D08245E59001E9ABC,
- 93F19A8E08245E59001E9ABC,
93F19A8F08245E59001E9ABC,
93F19A9008245E59001E9ABC,
93F19A9108245E59001E9ABC,
@@ -5072,7 +5026,6 @@
93F19AC008245E59001E9ABC,
93F19AC108245E59001E9ABC,
93F19AC208245E59001E9ABC,
- 93F19AC308245E59001E9ABC,
93F19AC408245E59001E9ABC,
93F19AC508245E59001E9ABC,
93F19AC608245E59001E9ABC,
@@ -5114,7 +5067,6 @@
93F19AEC08245E59001E9ABC,
93F19AED08245E59001E9ABC,
93F19AEE08245E59001E9ABC,
- 93F19AEF08245E59001E9ABC,
93F19AF008245E59001E9ABC,
93F19AF108245E59001E9ABC,
93F19AF208245E59001E9ABC,
@@ -5179,6 +5131,8 @@
550A0BC9085F6039007353D6,
550A0BCD085F604D007353D6,
65F3782A0870D958000B2F94,
+ A85D7C18087A6ED9006A9172,
+ BCEF3434087B563E00BBF833,
A8FD8B86087CB44C00DC3707,
);
isa = PBXSourcesBuildPhase;
@@ -5820,12 +5774,6 @@
settings = {
};
};
- 93F19A8E08245E59001E9ABC = {
- fileRef = F523D23502DE4396018635CA;
- isa = PBXBuildFile;
- settings = {
- };
- };
93F19A8F08245E59001E9ABC = {
fileRef = F523D23702DE4396018635CA;
isa = PBXBuildFile;
@@ -6138,12 +6086,6 @@
settings = {
};
};
- 93F19AC308245E59001E9ABC = {
- fileRef = 354F248A02EE28590ACA2ACA;
- isa = PBXBuildFile;
- settings = {
- };
- };
93F19AC408245E59001E9ABC = {
fileRef = F5117BCA02F9FFEF018635CE;
isa = PBXBuildFile;
@@ -6390,12 +6332,6 @@
settings = {
};
};
- 93F19AEF08245E59001E9ABC = {
- fileRef = BC7FDE3105C1D9AB0070A902;
- isa = PBXBuildFile;
- settings = {
- };
- };
93F19AF008245E59001E9ABC = {
fileRef = BC3B364505C9D5E200E42902;
isa = PBXBuildFile;
@@ -30438,22 +30374,6 @@
refType = 4;
sourceTree = "<group>";
};
- BC7FDE3105C1D9AB0070A902 = {
- fileEncoding = 30;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.cpp.cpp;
- path = xml_namespace_table.cpp;
- refType = 4;
- sourceTree = "<group>";
- };
- BC7FDE3205C1D9AB0070A902 = {
- fileEncoding = 30;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.c.h;
- path = xml_namespace_table.h;
- refType = 4;
- sourceTree = "<group>";
- };
BC80A6930468B78100DBCC9C = {
fileEncoding = 30;
isa = PBXFileReference;
@@ -30599,6 +30519,34 @@
refType = 4;
sourceTree = "<group>";
};
+ BCEF3432087B563E00BBF833 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.cpp.cpp;
+ path = htmlfactory.cpp;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ BCEF3433087B563E00BBF833 = {
+ fileEncoding = 30;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = htmlfactory.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ BCEF3434087B563E00BBF833 = {
+ fileRef = BCEF3432087B563E00BBF833;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ BCEF3435087B563E00BBF833 = {
+ fileRef = BCEF3433087B563E00BBF833;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
BCF0192403D3802200B2D04D = {
fileEncoding = 30;
isa = PBXFileReference;
@@ -31014,8 +30962,6 @@
2D90660C0665D937006B6F1A,
F58784CD02DE375901EA4122,
F58784DA02DE375901EA4122,
- 354F248902EE28590ACA2ACA,
- 354F248A02EE28590ACA2ACA,
931C8A160380288B008635CE,
931C8A170380288B008635CE,
BEF7EEA005FF8F0D009717EE,
@@ -31984,22 +31930,6 @@
refType = 4;
sourceTree = "<group>";
};
- F523D23502DE4396018635CA = {
- fileEncoding = 30;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.cpp.cpp;
- path = dtd.cpp;
- refType = 4;
- sourceTree = "<group>";
- };
- F523D23602DE4396018635CA = {
- fileEncoding = 30;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.c.h;
- path = dtd.h;
- refType = 4;
- sourceTree = "<group>";
- };
F523D23702DE4396018635CA = {
fileEncoding = 30;
isa = PBXFileReference;
@@ -32226,10 +32156,10 @@
};
F523D27702DE4398018635CA = {
children = (
+ BCEF3432087B563E00BBF833,
+ BCEF3433087B563E00BBF833,
550A0BCB085F604D007353D6,
550A0BCC085F604D007353D6,
- F523D23502DE4396018635CA,
- F523D23602DE4396018635CA,
F523D23702DE4396018635CA,
F523D23802DE4396018635CA,
F523D23902DE4396018635CA,
@@ -32941,8 +32871,6 @@
F523D30602DE4476018635CA,
F523D30702DE4476018635CA,
F523D30802DE4476018635CA,
- BC7FDE3105C1D9AB0070A902,
- BC7FDE3205C1D9AB0070A902,
F523D30902DE4476018635CA,
F523D30A02DE4476018635CA,
);
1.326 +2 -1 WebCore/khtml/khtml_part.cpp
Index: khtml_part.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/khtml_part.cpp,v
retrieving revision 1.325
retrieving revision 1.326
diff -u -r1.325 -r1.326
--- khtml_part.cpp 28 Jun 2005 23:22:16 -0000 1.325
+++ khtml_part.cpp 9 Jul 2005 20:18:59 -0000 1.326
@@ -208,6 +208,7 @@
void KHTMLPart::init( KHTMLView *view, GUIProfile prof )
{
AtomicString::init();
+ HTMLNames::init(); // FIXME: We should make this happen only when HTML is used.
if ( prof == DefaultGUI )
setXMLFile( "khtml.rc" );
else if ( prof == BrowserViewGUI )
@@ -5724,7 +5725,7 @@
int exceptionCode = 0;
if (d->m_typingStyle) {
- styleElement = xmlDocImpl()->createHTMLElement("span", exceptionCode);
+ styleElement = xmlDocImpl()->createElementNS(HTMLNames::xhtmlNamespaceURI(), "span", exceptionCode);
assert(exceptionCode == 0);
styleElement->ref();
1.134 +3 -6 WebCore/khtml/khtmlview.cpp
Index: khtmlview.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/khtmlview.cpp,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -r1.133 -r1.134
--- khtmlview.cpp 11 May 2005 00:58:27 -0000 1.133
+++ khtmlview.cpp 9 Jul 2005 20:18:59 -0000 1.134
@@ -607,12 +607,12 @@
if (document->isHTMLDocument()) {
NodeImpl *body = static_cast<HTMLDocumentImpl*>(document)->body();
if (body && body->renderer()) {
- if (body->id() == ID_FRAMESET) {
+ if (body->hasTagName(HTMLNames::frameset())) {
body->renderer()->setNeedsLayout(true);
vMode = AlwaysOff;
hMode = AlwaysOff;
}
- else if (body->id() == ID_BODY) {
+ else if (body->hasTagName(HTMLNames::body())) {
RenderObject* o = (rootRenderer->style()->overflow() == OVISIBLE) ? body->renderer() : rootRenderer;
applyOverflowToViewport(o, hMode, vMode); // Only applies to HTML UAs, not to XML/XHTML UAs
}
@@ -877,10 +877,7 @@
static bool isSubmitImage(DOM::NodeImpl *node)
{
- return node
- && node->isHTMLElement()
- && node->id() == ID_INPUT
- && static_cast<HTMLInputElementImpl*>(node)->inputType() == HTMLInputElementImpl::IMAGE;
+ return node && node->hasTagName(HTMLNames::input()) && static_cast<HTMLInputElementImpl*>(node)->inputType() == HTMLInputElementImpl::IMAGE;
}
void KHTMLView::viewportMouseMoveEvent( QMouseEvent * _mouse )
1.16 +22 -17 WebCore/khtml/css/css_base.cpp
Index: css_base.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_base.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- css_base.cpp 12 Jun 2005 04:07:30 -0000 1.15
+++ css_base.cpp 9 Jul 2005 20:19:00 -0000 1.16
@@ -93,9 +93,15 @@
// --------------------------------------------------------------------------------
+const QualifiedName& CSSSelector::anyTagName()
+{
+ static QualifiedName anyName(nullAtom, starAtom, starAtom);
+ return anyName;
+}
+
void CSSSelector::print(void)
{
- kdDebug( 6080 ) << "[Selector: tag = " << tag << ", attr = \"" << attr << "\", match = \"" << match
+ kdDebug( 6080 ) << "[Selector: tag = " << tag.localName().string() << ", attr = \"" << attr << "\", match = \"" << match
<< "\" value = \"" << value.string().latin1() << "\" relation = " << (int)relation
<< "]" << endl;
if ( tagHistory )
@@ -107,7 +113,7 @@
{
// FIXME: Pseudo-elements and pseudo-classes do not have the same specificity. This function
// isn't quite correct.
- int s = ((localNamePart(tag) == anyLocalName) ? 0 : 1);
+ int s = (tag.localName() == starAtom ? 0 : 1);
switch(match)
{
case Id:
@@ -240,60 +246,59 @@
DOMString CSSSelector::selectorText() const
{
- // FIXME: Support namespaces when dumping the selector text. This requires preserving
- // the original namespace prefix used. Ugh. -dwh
+ // FIXME: Support namespaces when dumping the selector text. -dwh
DOMString str;
const CSSSelector* cs = this;
- Q_UINT16 tag = localNamePart(cs->tag);
- if ( tag == anyLocalName && cs->attr == ATTR_ID && cs->match == CSSSelector::Exact )
+ const AtomicString& localName = cs->tag.localName();
+ if (localName == starAtom && cs->attr == ATTR_ID && cs->match == CSSSelector::Exact)
{
str = "#";
str += cs->value.string();
}
- else if ( tag == anyLocalName && cs->attr == ATTR_CLASS && cs->match == CSSSelector::Class )
+ else if (localName == starAtom && cs->attr == ATTR_CLASS && cs->match == CSSSelector::Class)
{
str = ".";
str += cs->value.string();
}
- else if ( tag == anyLocalName && cs->match == CSSSelector::PseudoClass )
+ else if (localName == starAtom && cs->match == CSSSelector::PseudoClass)
{
str = ":";
str += cs->value.string();
}
- else if ( tag == anyLocalName && cs->match == CSSSelector::PseudoElement )
+ else if (localName == starAtom && cs->match == CSSSelector::PseudoElement)
{
str = "::";
str += cs->value.string();
}
else
{
- if ( tag == anyLocalName )
+ if (localName == starAtom)
str = "*";
else
- str = getTagName( cs->tag );
- if ( cs->attr == ATTR_ID && cs->match == CSSSelector::Exact )
+ str = localName;
+ if (cs->attr == ATTR_ID && cs->match == CSSSelector::Exact)
{
str += "#";
str += cs->value.string();
}
- else if ( cs->attr == ATTR_CLASS && cs->match == CSSSelector::Class )
+ else if (cs->attr == ATTR_CLASS && cs->match == CSSSelector::Class)
{
str += ".";
str += cs->value.string();
}
- else if ( cs->match == CSSSelector::PseudoClass )
+ else if (cs->match == CSSSelector::PseudoClass)
{
str += ":";
str += cs->value.string();
}
- else if ( cs->match == CSSSelector::PseudoElement )
+ else if (cs->match == CSSSelector::PseudoElement)
{
str += "::";
str += cs->value.string();
}
// optional attribute
- if ( cs->attr ) {
- DOMString attrName = getAttrName( cs->attr );
+ if (cs->attr) {
+ DOMString attrName = getAttrName(cs->attr);
str += "[";
str += attrName;
switch (cs->match) {
1.13 +21 -9 WebCore/khtml/css/css_base.h
Index: css_base.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_base.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- css_base.h 12 Jun 2005 04:07:30 -0000 1.12
+++ css_base.h 9 Jul 2005 20:19:00 -0000 1.13
@@ -27,6 +27,7 @@
#include "dom/dom_string.h"
#include "dom/dom_misc.h"
#include "xml/dom_nodeimpl.h"
+#include "dom_qname.h"
#include "misc/shared.h"
#include <qdatetime.h>
#include <qptrlist.h>
@@ -46,20 +47,20 @@
class DocumentImpl;
struct CSSNamespace {
- DOMString m_prefix;
- DOMString m_uri;
+ AtomicString m_prefix;
+ AtomicString m_uri;
CSSNamespace* m_parent;
MAIN_THREAD_ALLOCATED;
- CSSNamespace(const DOMString& p, const DOMString& u, CSSNamespace* parent)
+ CSSNamespace(const AtomicString& p, const AtomicString& u, CSSNamespace* parent)
:m_prefix(p), m_uri(u), m_parent(parent) {}
~CSSNamespace() { delete m_parent; }
- const DOMString& uri() { return m_uri; }
- const DOMString& prefix() { return m_prefix; }
+ const AtomicString& uri() { return m_uri; }
+ const AtomicString& prefix() { return m_prefix; }
- CSSNamespace* namespaceForPrefix(const DOMString& prefix) {
+ CSSNamespace* namespaceForPrefix(const AtomicString& prefix) {
if (prefix == m_prefix)
return this;
if (m_parent)
@@ -72,8 +73,14 @@
class CSSSelector
{
public:
- CSSSelector()
- : tagHistory(0), simpleSelector(0), nextSelector(0), attr(0), tag(anyQName),
+ CSSSelector()
+ : tagHistory(0), simpleSelector(0), nextSelector(0), attr(0), tag(anyTagName()),
+ relation( Descendant ), match( None ),
+ pseudoId( 0 ), _pseudoType(PseudoNotParsed)
+ {}
+
+ CSSSelector(const QualifiedName& qName)
+ : tagHistory(0), simpleSelector(0), nextSelector(0), attr(0), tag(qName),
relation( Descendant ), match( None ),
pseudoId( 0 ), _pseudoType(PseudoNotParsed)
{}
@@ -167,12 +174,17 @@
return _pseudoType;
}
+ static const QualifiedName& anyTagName();
+
+ bool hasTag() const { return tag != anyTagName(); }
+
mutable DOM::AtomicString value;
CSSSelector* tagHistory;
CSSSelector* simpleSelector; // Used for :not.
CSSSelector* nextSelector; // used for ,-chained selectors
Q_UINT32 attr;
- Q_UINT32 tag;
+
+ QualifiedName tag;
Relation relation : 3;
mutable Match match : 4;
1.19 +0 -1 WebCore/khtml/css/css_ruleimpl.cpp
Index: css_ruleimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_ruleimpl.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- css_ruleimpl.cpp 11 May 2005 05:49:34 -0000 1.18
+++ css_ruleimpl.cpp 9 Jul 2005 20:19:00 -0000 1.19
@@ -31,7 +31,6 @@
#include "css/css_ruleimpl.h"
#include "misc/loader.h"
-#include "misc/htmltags.h"
#include "misc/htmlattrs.h"
#include "xml/dom_docimpl.h"
1.15 +18 -6 WebCore/khtml/css/css_ruleimpl.h
Index: css_ruleimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_ruleimpl.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- css_ruleimpl.h 10 May 2005 18:42:02 -0000 1.14
+++ css_ruleimpl.h 9 Jul 2005 20:19:00 -0000 1.15
@@ -20,7 +20,7 @@
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
- * $Id: css_ruleimpl.h,v 1.14 2005/05/10 18:42:02 darin Exp $
+ * $Id: css_ruleimpl.h,v 1.15 2005/07/09 20:19:00 hyatt Exp $
*/
#ifndef _CSS_css_ruleimpl_h_
#define _CSS_css_ruleimpl_h_
@@ -30,6 +30,7 @@
#include "css/css_base.h"
#include "misc/loader_client.h"
#include "misc/shared.h"
+#include "misc/main_thread_malloc.h"
#include "css_valueimpl.h"
namespace khtml {
@@ -50,6 +51,8 @@
CSSRuleImpl(StyleBaseImpl *parent)
: StyleBaseImpl(parent), m_type(CSSRule::UNKNOWN_RULE) {}
+ MAIN_THREAD_ALLOCATED;
+
virtual bool isRule() { return true; }
unsigned short type() const { return m_type; }
@@ -71,6 +74,8 @@
CSSCharsetRuleImpl(StyleBaseImpl *parent)
: CSSRuleImpl(parent) { m_type = CSSRule::CHARSET_RULE; }
+ MAIN_THREAD_ALLOCATED;
+
virtual bool isCharsetRule() { return true; }
DOMString encoding() const { return m_encoding; }
@@ -85,9 +90,10 @@
{
public:
CSSFontFaceRuleImpl(StyleBaseImpl *parent);
-
virtual ~CSSFontFaceRuleImpl();
+ MAIN_THREAD_ALLOCATED;
+
CSSMutableStyleDeclarationImpl *style() const { return m_style; }
virtual bool isFontFaceRule() { return true; }
@@ -104,9 +110,10 @@
const DOM::DOMString &media );
CSSImportRuleImpl( StyleBaseImpl *parent, const DOM::DOMString &href,
MediaListImpl *media );
-
virtual ~CSSImportRuleImpl();
+ MAIN_THREAD_ALLOCATED;
+
DOM::DOMString href() const { return m_strHref; }
MediaListImpl *media() const { return m_lstMedia; }
CSSStyleSheetImpl *styleSheet() const { return m_styleSheet; }
@@ -156,9 +163,10 @@
CSSMediaRuleImpl( StyleBaseImpl *parent );
CSSMediaRuleImpl( StyleBaseImpl *parent, const DOM::DOMString &media );
CSSMediaRuleImpl( StyleBaseImpl *parent, MediaListImpl *mediaList, CSSRuleListImpl *ruleList );
-
virtual ~CSSMediaRuleImpl();
+ MAIN_THREAD_ALLOCATED;
+
MediaListImpl *media() const { return m_lstMedia; }
CSSRuleListImpl *cssRules() { return m_lstCSSRules; }
@@ -179,9 +187,10 @@
{
public:
CSSPageRuleImpl(StyleBaseImpl *parent);
-
virtual ~CSSPageRuleImpl();
+ MAIN_THREAD_ALLOCATED;
+
CSSMutableStyleDeclarationImpl *style() const { return m_style; }
virtual bool isPageRule() { return true; }
@@ -199,9 +208,10 @@
{
public:
CSSStyleRuleImpl(StyleBaseImpl *parent);
-
virtual ~CSSStyleRuleImpl();
+ MAIN_THREAD_ALLOCATED;
+
CSSMutableStyleDeclarationImpl *style() const { return m_style; }
virtual bool isStyleRule() { return true; }
@@ -227,6 +237,8 @@
public:
CSSUnknownRuleImpl(StyleBaseImpl *parent) : CSSRuleImpl(parent) {}
+ MAIN_THREAD_ALLOCATED;
+
virtual bool isUnknownRule() { return true; }
};
1.13 +10 -17 WebCore/khtml/css/css_stylesheetimpl.cpp
Index: css_stylesheetimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_stylesheetimpl.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- css_stylesheetimpl.cpp 11 May 2005 00:58:27 -0000 1.12
+++ css_stylesheetimpl.cpp 9 Jul 2005 20:19:00 -0000 1.13
@@ -19,7 +19,7 @@
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
- * $Id: css_stylesheetimpl.cpp,v 1.12 2005/05/11 00:58:27 darin Exp $
+ * $Id: css_stylesheetimpl.cpp,v 1.13 2005/07/09 20:19:00 hyatt Exp $
*/
//#define CSS_STYLESHEET_DEBUG
@@ -38,8 +38,6 @@
#include "html/html_documentimpl.h"
#include "misc/loader.h"
-#include "xml_namespace_table.h"
-
#include <kdebug.h>
using namespace DOM;
@@ -210,7 +208,7 @@
b->deref();
}
-void CSSStyleSheetImpl::addNamespace(CSSParser* p, const DOM::DOMString& prefix, const DOM::DOMString& uri)
+void CSSStyleSheetImpl::addNamespace(CSSParser* p, const AtomicString& prefix, const AtomicString& uri)
{
if (uri.isEmpty())
return;
@@ -220,26 +218,21 @@
if (prefix.isEmpty())
// Set the default namespace on the parser so that selectors that omit namespace info will
// be able to pick it up easily.
- p->defaultNamespace = XmlNamespaceTable::getNamespaceID(uri, false);
+ p->defaultNamespace = uri;
}
-void CSSStyleSheetImpl::determineNamespace(Q_UINT32& id, const DOM::DOMString& prefix)
+const AtomicString& CSSStyleSheetImpl::determineNamespace(const AtomicString& prefix)
{
- // If the stylesheet has no namespaces we can just return. There won't be any need to ever check
- // namespace values in selectors.
- if (!m_namespaces)
- return;
-
if (prefix.isEmpty())
- id = makeId(noNamespace, localNamePart(id)); // No namespace. If an element/attribute has a namespace, we won't match it.
- else if (prefix == "*")
- id = makeId(anyNamespace, localNamePart(id)); // We'll match any namespace.
- else {
+ return emptyAtom; // No namespace. If an element/attribute has a namespace, we won't match it.
+ else if (prefix == starAtom)
+ return starAtom; // We'll match any namespace.
+ else if (m_namespaces) {
CSSNamespace* ns = m_namespaces->namespaceForPrefix(prefix);
if (ns)
- // Look up the id for this namespace URI.
- id = makeId(XmlNamespaceTable::getNamespaceID(ns->uri(), false), localNamePart(id));
+ return ns->uri();
}
+ return emptyAtom; // Assume we wont match any namespaces.
}
bool CSSStyleSheetImpl::parseString(const DOMString &string, bool strict)
1.12 +3 -3 WebCore/khtml/css/css_stylesheetimpl.h
Index: css_stylesheetimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_stylesheetimpl.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- css_stylesheetimpl.h 11 May 2005 00:58:27 -0000 1.11
+++ css_stylesheetimpl.h 9 Jul 2005 20:19:00 -0000 1.12
@@ -19,7 +19,7 @@
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
- * $Id: css_stylesheetimpl.h,v 1.11 2005/05/11 00:58:27 darin Exp $
+ * $Id: css_stylesheetimpl.h,v 1.12 2005/07/09 20:19:00 hyatt Exp $
*/
#ifndef _CSS_css_stylesheetimpl_h_
#define _CSS_css_stylesheetimpl_h_
@@ -104,8 +104,8 @@
void deleteRule ( unsigned long index, int &exceptioncode );
unsigned long addRule ( const DOMString &selector, const DOMString &style, long index, int &exceptioncode );
- void addNamespace(CSSParser* p, const DOM::DOMString& prefix, const DOM::DOMString& uri);
- void determineNamespace(Q_UINT32& id, const DOM::DOMString& prefix);
+ void addNamespace(CSSParser* p, const AtomicString& prefix, const AtomicString& uri);
+ const AtomicString& determineNamespace(const AtomicString& prefix);
virtual bool parseString( const DOMString &string, bool strict = true );
1.99 +2 -2 WebCore/khtml/css/cssparser.cpp
Index: cssparser.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/cssparser.cpp,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -r1.98 -r1.99
--- cssparser.cpp 11 May 2005 02:10:09 -0000 1.98
+++ cssparser.cpp 9 Jul 2005 20:19:00 -0000 1.99
@@ -102,7 +102,7 @@
important = false;
inParseShortHand = false;
- defaultNamespace = anyNamespace;
+ defaultNamespace = starAtom;
yy_start = 1;
@@ -161,7 +161,7 @@
void CSSParser::parseSheet( CSSStyleSheetImpl *sheet, const DOMString &string )
{
styleElement = sheet;
- defaultNamespace = anyNamespace; // Reset the default namespace.
+ defaultNamespace = starAtom; // Reset the default namespace.
setupParser ("", string, "");
1.31 +1 -1 WebCore/khtml/css/cssparser.h
Index: cssparser.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/cssparser.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- cssparser.h 19 Nov 2004 00:12:20 -0000 1.30
+++ cssparser.h 9 Jul 2005 20:19:00 -0000 1.31
@@ -164,7 +164,7 @@
int maxParsedProperties;
bool inParseShortHand;
- Q_UINT16 defaultNamespace;
+ AtomicString defaultNamespace;
static CSSParser *currentParser;
1.189 +23 -42 WebCore/khtml/css/cssstyleselector.cpp
Index: cssstyleselector.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/cssstyleselector.cpp,v
retrieving revision 1.188
retrieving revision 1.189
diff -u -r1.188 -r1.189
--- cssstyleselector.cpp 6 Jul 2005 01:28:41 -0000 1.188
+++ cssstyleselector.cpp 9 Jul 2005 20:19:00 -0000 1.189
@@ -339,7 +339,7 @@
matchRulesForList(rules->getClassRules(singleClass->string().implementation()),
firstRuleIndex, lastRuleIndex);
}
- matchRulesForList(rules->getTagRules(localNamePart(element->id())),
+ matchRulesForList(rules->getTagRules(element->localName().implementation()),
firstRuleIndex, lastRuleIndex);
matchRulesForList(rules->getUniversalRules(), firstRuleIndex, lastRuleIndex);
@@ -360,9 +360,9 @@
if (!rules) return;
for (CSSRuleData* d = rules->first(); d; d = d->next()) {
CSSStyleRuleImpl* rule = d->rule();
- Q_UINT16 cssTagId = localNamePart(element->id());
- Q_UINT16 tag = localNamePart(d->selector()->tag);
- if ((cssTagId == tag || tag == anyLocalName) && checkSelector(d->selector(), element)) {
+ const AtomicString& localName = element->localName();
+ const AtomicString& selectorLocalName = d->selector()->tag.localName();
+ if ((localName == selectorLocalName || selectorLocalName == starAtom) && checkSelector(d->selector(), element)) {
// If the rule has no properties to apply, then ignore it.
CSSMutableStyleDeclarationImpl* decl = rule->declaration();
if (!decl || !decl->length()) continue;
@@ -609,7 +609,7 @@
if (n->isStyledElement()) {
bool mouseInside = element->renderer() ? element->renderer()->mouseInside() : false;
StyledElementImpl* s = static_cast<StyledElementImpl*>(n);
- if (s->renderer() && (s->id() == element->id()) && !s->hasID() &&
+ if (s->renderer() && (s->tagName() == element->tagName()) && !s->hasID() &&
(s->hasClass() == element->hasClass()) && !s->inlineStyleDecl() &&
(s->hasMappedAttributes() == styledElement->hasMappedAttributes()) &&
(s->isLink() == element->isLink()) &&
@@ -885,23 +885,23 @@
// Sites also commonly use display:inline/block on <td>s and <table>s. In quirks mode we force
// these tags to retain their display types.
if (!strictParsing && e) {
- if (e->id() == ID_TD) {
+ if (e->hasTagName(HTMLNames::td())) {
style->setDisplay(TABLE_CELL);
style->setFloating(FNONE);
}
- else if (e->id() == ID_TABLE)
+ else if (e->hasTagName(HTMLNames::table()))
style->setDisplay(style->isDisplayInlineType() ? INLINE_TABLE : TABLE);
}
// Frames and framesets never honor position:relative or position:absolute. This is necessary to
// fix a crash where a site tries to position these objects. They also never honor display.
- if (e && (e->id() == ID_FRAME || e->id() == ID_FRAMESET)) {
+ if (e && (e->hasTagName(HTMLNames::frame()) || e->hasTagName(HTMLNames::frameset()))) {
style->setPosition(STATIC);
style->setDisplay(BLOCK);
}
// Table headers with a text-align of auto will change the text-align to center.
- if (e && e->id() == ID_TH && style->textAlign() == TAAUTO)
+ if (e && e->hasTagName(HTMLNames::th()) && style->textAlign() == TAAUTO)
style->setTextAlign(CENTER);
// Mutate the display to BLOCK or TABLE for certain cases, e.g., if someone attempts to
@@ -979,7 +979,7 @@
// We track whether or not the rule contains only :hover and :active in a simple selector. If
// so, we can't allow that to apply to every element on the page. We assume the author intended
// to apply the rules only to links.
- bool onlyHoverActive = (sel->tag == anyQName &&
+ bool onlyHoverActive = (!sel->hasTag() &&
(sel->match == CSSSelector::PseudoClass &&
(sel->pseudoType() == CSSSelector::PseudoHover ||
sel->pseudoType() == CSSSelector::PseudoActive)));
@@ -1096,19 +1096,14 @@
if(!e)
return false;
- if (sel->tag != anyQName) {
- int eltID = e->id();
- Q_UINT16 localName = localNamePart(eltID);
- Q_UINT16 ns = namespacePart(eltID);
- Q_UINT16 selLocalName = localNamePart(sel->tag);
- Q_UINT16 selNS = namespacePart(sel->tag);
-
- if (localName <= ID_LAST_TAG && e->isHTMLElement())
- ns = xhtmlNamespace; // FIXME: Really want to move away from this complicated hackery and just
- // switch tags and attr names over to AtomicStrings.
-
- if ((selLocalName != anyLocalName && localName != selLocalName) ||
- (selNS != anyNamespace && ns != selNS))
+ if (sel->hasTag()) {
+ const AtomicString& localName = e->localName();
+ const AtomicString& ns = e->namespaceURI();
+ const AtomicString& selLocalName = sel->tag.localName();
+ const AtomicString& selNS = sel->tag.namespaceURI();
+
+ if ((selLocalName != starAtom && localName != selLocalName) ||
+ (selNS != starAtom && ns != selNS))
return false;
}
@@ -1295,7 +1290,7 @@
case CSSSelector::PseudoHover: {
// If we're in quirks mode, then hover should never match anchors with no
// href. This is important for sites like wsj.com.
- if (strictParsing || e->id() != ID_A || e->isLink()) {
+ if (strictParsing || !e->hasTagName(HTMLNames::a()) || e->isLink()) {
if (element == e && style)
style->setAffectedByHoverRules(true);
if (e->renderer()) {
@@ -1326,7 +1321,7 @@
case CSSSelector::PseudoActive:
// If we're in quirks mode, then :active should never match anchors with no
// href.
- if (strictParsing || e->id() != ID_A || e->isLink()) {
+ if (strictParsing || !e->hasTagName(HTMLNames::a()) || e->isLink()) {
if (element == e && style)
style->setAffectedByActiveRules(true);
else if (e->renderer())
@@ -1420,19 +1415,6 @@
rules->append(m_ruleCount++, rule, sel);
}
-void CSSRuleSet::addToRuleSet(int key, IntRuleMap& map,
- CSSStyleRuleImpl* rule, CSSSelector* sel)
-{
- assert(key);
- assert(key != -1);
- CSSRuleDataList* rules = map.get(key);
- if (!rules) {
- rules = new CSSRuleDataList(m_ruleCount++, rule, sel);
- map.insert(key, rules);
- } else
- rules->append(m_ruleCount++, rule, sel);
-}
-
void CSSRuleSet::addRule(CSSStyleRuleImpl* rule, CSSSelector* sel)
{
if (sel->match == CSSSelector::Id) {
@@ -1444,10 +1426,9 @@
return;
}
- Q_UINT16 localName = localNamePart(sel->tag);
- if (localName != anyLocalName) {
- // FIXME: maybe it would be better to just use an int-keyed HashMap here
- addToRuleSet(localName, m_tagRules, rule, sel);
+ const AtomicString& localName = sel->tag.localName();
+ if (localName != starAtom) {
+ addToRuleSet(localName.implementation(), m_tagRules, rule, sel);
return;
}
1.35 +2 -6 WebCore/khtml/css/cssstyleselector.h
Index: cssstyleselector.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/cssstyleselector.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- cssstyleselector.h 6 Jul 2005 01:28:42 -0000 1.34
+++ cssstyleselector.h 9 Jul 2005 20:19:00 -0000 1.35
@@ -24,7 +24,6 @@
#define _CSS_cssstyleselector_h_
#include <qptrvector.h>
-#include <qptrdict.h>
#include "misc/pointerhash.h"
#include "rendering/render_style.h"
@@ -274,25 +273,22 @@
MAIN_THREAD_ALLOCATED;
typedef HashMap<DOM::DOMStringImpl *, CSSRuleDataList *, PointerHash<DOM::DOMStringImpl *> > AtomRuleMap;
- typedef HashMap<int, CSSRuleDataList *, PointerHash<int> > IntRuleMap;
void addRulesFromSheet(DOM::CSSStyleSheetImpl* sheet, const DOM::DOMString &medium = "screen");
void addRule(DOM::CSSStyleRuleImpl* rule, DOM::CSSSelector* sel);
void addToRuleSet(DOM::DOMStringImpl* key, AtomRuleMap& map,
DOM::CSSStyleRuleImpl* rule, DOM::CSSSelector* sel);
- void addToRuleSet(int key, IntRuleMap& map,
- DOM::CSSStyleRuleImpl* rule, DOM::CSSSelector* sel);
CSSRuleDataList* getIDRules(DOM::DOMStringImpl* key) { return m_idRules.get(key); }
CSSRuleDataList* getClassRules(DOM::DOMStringImpl* key) { return m_classRules.get(key); }
- CSSRuleDataList* getTagRules(int key) { return m_tagRules.get(key); }
+ CSSRuleDataList* getTagRules(DOM::DOMStringImpl* key) { return m_tagRules.get(key); }
CSSRuleDataList* getUniversalRules() { return m_universalRules; }
public:
AtomRuleMap m_idRules;
AtomRuleMap m_classRules;
- IntRuleMap m_tagRules;
+ AtomRuleMap m_tagRules;
CSSRuleDataList* m_universalRules;
uint m_ruleCount;
1.41 +49 -40 WebCore/khtml/css/parser.y
Index: parser.y
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/parser.y,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- parser.y 7 Jul 2005 07:33:16 -0000 1.40
+++ parser.y 9 Jul 2005 20:19:00 -0000 1.41
@@ -34,9 +34,7 @@
#include <css/css_valueimpl.h>
#include <misc/htmlhashes.h>
#include "cssparser.h"
-
-#include "xml_namespace_table.h"
-
+
#include <assert.h>
#include <kdebug.h>
// #define CSS_DEBUG
@@ -130,7 +128,6 @@
float val;
int prop_id;
int attribute;
- int element;
CSSSelector::Relation relation;
bool b;
int i;
@@ -176,6 +173,8 @@
%token '.'
%token '['
+%token <string> '*'
+
%token IMPORT_SYM
%token PAGE_SYM
%token MEDIA_SYM
@@ -265,7 +264,7 @@
%type <value> unary_term
%type <value> function
-%type <element> element_name
+%type <string> element_name
%type <attribute> attrib_id
@@ -405,7 +404,7 @@
#endif
CSSParser *p = static_cast<CSSParser *>(parser);
if (p->styleElement && p->styleElement->isCSSStyleSheet())
- static_cast<CSSStyleSheetImpl*>(p->styleElement)->addNamespace(p, domString($3), domString($4));
+ static_cast<CSSStyleSheetImpl*>(p->styleElement)->addNamespace(p, atomicString($3), atomicString($4));
}
| NAMESPACE_SYM error invalid_block
| NAMESPACE_SYM error ';'
@@ -624,65 +623,71 @@
simple_selector:
element_name maybe_space {
- $$ = new CSSSelector();
- $$->tag = $1;
+ CSSParser *p = static_cast<CSSParser *>(parser);
+ $$ = new CSSSelector(QualifiedName(nullAtom, atomicString($1), p->defaultNamespace));
}
| element_name specifier_list maybe_space {
- $$ = $2;
- if ( $$ )
- $$->tag = $1;
+ $$ = $2;
+ if ($$) {
+ CSSParser *p = static_cast<CSSParser *>(parser);
+ $$->tag = QualifiedName(nullAtom, atomicString($1), p->defaultNamespace);
+ }
}
| specifier_list maybe_space {
$$ = $1;
- if ($$)
- $$->tag = makeId(static_cast<CSSParser*>(parser)->defaultNamespace, anyLocalName);;
+ CSSParser *p = static_cast<CSSParser *>(parser);
+ if ($$ && p->defaultNamespace != starAtom)
+ $$->tag = QualifiedName(nullAtom, starAtom, p->defaultNamespace);
}
| namespace_selector '|' element_name maybe_space {
- $$ = new CSSSelector();
- $$->tag = $3;
+ AtomicString namespacePrefix = atomicString($1);
CSSParser *p = static_cast<CSSParser *>(parser);
if (p->styleElement && p->styleElement->isCSSStyleSheet())
- static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace($$->tag, domString($1));
+ $$ = new CSSSelector(QualifiedName(namespacePrefix,
+ atomicString($3),
+ static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace(namespacePrefix)));
+ else // FIXME: Shouldn't this case be an error?
+ $$ = new CSSSelector(QualifiedName(nullAtom, atomicString($3), p->defaultNamespace));
}
| namespace_selector '|' element_name specifier_list maybe_space {
$$ = $4;
if ($$) {
- $$->tag = $3;
+ AtomicString namespacePrefix = atomicString($1);
CSSParser *p = static_cast<CSSParser *>(parser);
if (p->styleElement && p->styleElement->isCSSStyleSheet())
- static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace($$->tag, domString($1));
+ $$->tag = QualifiedName(namespacePrefix,
+ atomicString($3),
+ static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace(namespacePrefix));
+ else // FIXME: Shouldn't this case be an error?
+ $$->tag = QualifiedName(nullAtom, atomicString($3), p->defaultNamespace);
}
}
| namespace_selector '|' specifier_list maybe_space {
$$ = $3;
if ($$) {
- $$->tag = makeId(anyNamespace, anyLocalName);
+ AtomicString namespacePrefix = atomicString($1);
CSSParser *p = static_cast<CSSParser *>(parser);
if (p->styleElement && p->styleElement->isCSSStyleSheet())
- static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace($$->tag, domString($1));
+ $$->tag = QualifiedName(namespacePrefix,
+ starAtom,
+ static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace(namespacePrefix));
}
}
;
element_name:
IDENT {
- CSSParser *p = static_cast<CSSParser *>(parser);
+ ParseString& str = $1;
+ CSSParser *p = static_cast<CSSParser *>(parser);
DOM::DocumentImpl *doc = p->document();
- QString tag = qString($1);
- if ( doc ) {
- if (doc->isHTMLDocument())
- tag = tag.lower();
- const DOMString dtag(tag);
- $$ = makeId(p->defaultNamespace, doc->tagId(0, dtag.implementation(), false));
- } else {
- $$ = makeId(p->defaultNamespace, khtml::getTagID(tag.lower().ascii(), tag.length()));
- // this case should never happen - only when loading
- // the default stylesheet - which must not contain unknown tags
-// assert($$ != 0);
- }
+ if (doc && doc->isHTMLDocument())
+ str.lower();
+ $$ = str;
}
| '*' {
- $$ = makeId(static_cast<CSSParser*>(parser)->defaultNamespace, anyLocalName);
+ static unsigned short star = '*';
+ $$.string = ☆
+ $$.length = 1;
}
;
@@ -769,18 +774,22 @@
$$ = new CSSSelector();
$$->attr = $5;
$$->match = CSSSelector::Set;
- CSSParser *p = static_cast<CSSParser *>(parser);
- if (p->styleElement && p->styleElement->isCSSStyleSheet())
- static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace($$->attr, domString($3));
+ // FIXME: For now we're breaking namespace support on attributes. When we switch to atomicstring, then we can make
+ // it work again.
+ //CSSParser *p = static_cast<CSSParser *>(parser);
+ //if (p->styleElement && p->styleElement->isCSSStyleSheet())
+ // static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace($$->attr, domString($3));
}
| '[' maybe_space namespace_selector '|' attrib_id match maybe_space ident_or_string maybe_space ']' {
$$ = new CSSSelector();
$$->attr = $5;
$$->match = (CSSSelector::Match)$6;
$$->value = atomicString($8);
- CSSParser *p = static_cast<CSSParser *>(parser);
- if (p->styleElement && p->styleElement->isCSSStyleSheet())
- static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace($$->attr, domString($3));
+ // FIXME: For now we're breaking namespace support on attributes. When we switch to atomicstring, then we can make
+ // it work again.
+ //CSSParser *p = static_cast<CSSParser *>(parser);
+ //if (p->styleElement && p->styleElement->isCSSStyleSheet())
+ // static_cast<CSSStyleSheetImpl*>(p->styleElement)->determineNamespace($$->attr, domString($3));
}
;
1.9 +6 -4 WebCore/khtml/dom/css_stylesheet.cpp
Index: css_stylesheet.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/css_stylesheet.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- css_stylesheet.cpp 20 May 2004 15:09:32 -0000 1.8
+++ css_stylesheet.cpp 9 Jul 2005 20:19:02 -0000 1.9
@@ -385,7 +385,7 @@
// ### check link is really linking a style sheet
if( n && n->isElementNode() &&
- (n->id() == ID_STYLE || n->id() == ID_LINK) ) {
+ (n->hasTagName(HTMLNames::style()) || n->hasTagName(HTMLNames::link()))) {
node = n;
if(node) node->ref();
}
@@ -399,12 +399,14 @@
StyleSheet LinkStyle::sheet()
{
- int id = node ? node->id() : 0;
+ if (!node)
+ return StyleSheet();
+
// ### add PI
return
- ( id == ID_STYLE) ?
+ (node->hasTagName(HTMLNames::style())) ?
static_cast<HTMLStyleElementImpl *>(node)->sheet()
- : ( (id == ID_LINK) ?
+ : ( node->hasTagName(HTMLNames::link()) ?
static_cast<HTMLLinkElementImpl *>(node)->sheet()
: StyleSheet() );
}
1.13 +1 -1 WebCore/khtml/dom/dom_element.cpp
Index: dom_element.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/dom_element.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- dom_element.cpp 12 May 2005 17:11:21 -0000 1.12
+++ dom_element.cpp 9 Jul 2005 20:19:02 -0000 1.13
@@ -141,7 +141,7 @@
DOMString Element::tagName() const
{
if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
- return static_cast<ElementImpl*>(impl)->tagName();
+ return static_cast<ElementImpl*>(impl)->nodeName();
}
DOMString Element::getAttribute( const DOMString &name )
1.13 +2 -9 WebCore/khtml/dom/dom_node.cpp
Index: dom_node.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/dom_node.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- dom_node.cpp 11 May 2005 00:58:28 -0000 1.12
+++ dom_node.cpp 9 Jul 2005 20:19:02 -0000 1.13
@@ -324,7 +324,7 @@
DOMString Node::namespaceURI( ) const
{
if (!impl) return DOMString();
- return impl->getDocument()->namespaceURI(impl->id());
+ return impl->namespaceURI();
}
DOMString Node::prefix( ) const
@@ -337,7 +337,7 @@
{
if (!impl) throw DOMException(DOMException::NOT_FOUND_ERR);
int exceptioncode = 0;
- impl->setPrefix(prefix,exceptioncode);
+ impl->setPrefix(prefix.implementation(),exceptioncode);
if (exceptioncode)
throw DOMException(exceptioncode);
}
@@ -376,13 +376,6 @@
return r;
}
-
-unsigned int Node::elementId() const
-{
- if (!impl) return 0;
- return impl->id();
-}
-
unsigned long Node::index() const
{
if (!impl) return 0;
1.13 +0 -7 WebCore/khtml/dom/dom_node.h
Index: dom_node.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/dom_node.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- dom_node.h 18 May 2005 21:10:24 -0000 1.12
+++ dom_node.h 9 Jul 2005 20:19:02 -0000 1.13
@@ -855,13 +855,6 @@
bool dispatchEvent(const Event &evt);
/**
- * @internal
- * not part of the DOM.
- * @returns the element id, in case this is an element, 0 otherwise
- */
- Q_UINT32 elementId() const;
-
- /**
* tests if this Node is 0. Useful especially, if casting to a derived
* class:
*
1.7 +6 -6 WebCore/khtml/dom/html_base.cpp
Index: html_base.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/html_base.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- html_base.cpp 3 Nov 2003 06:32:04 -0000 1.6
+++ html_base.cpp 9 Jul 2005 20:19:02 -0000 1.7
@@ -41,7 +41,7 @@
HTMLBodyElement &HTMLBodyElement::operator = (const Node &other)
{
- assignOther( other, ID_BODY );
+ assignOther( other, HTMLNames::body() );
return *this;
}
@@ -135,7 +135,7 @@
HTMLFrameElement &HTMLFrameElement::operator = (const Node &other)
{
- assignOther( other, ID_FRAME );
+ assignOther( other, HTMLNames::frame() );
return *this;
}
@@ -265,7 +265,7 @@
HTMLIFrameElement &HTMLIFrameElement::operator = (const Node &other)
{
- assignOther( other, ID_IFRAME );
+ assignOther( other, HTMLNames::iframe() );
return *this;
}
@@ -414,7 +414,7 @@
HTMLFrameSetElement &HTMLFrameSetElement::operator = (const Node &other)
{
- assignOther( other, ID_FRAMESET );
+ assignOther( other, HTMLNames::frameset() );
return *this;
}
@@ -466,7 +466,7 @@
HTMLHeadElement &HTMLHeadElement::operator = (const Node &other)
{
- assignOther( other, ID_HEAD );
+ assignOther( other, HTMLNames::head() );
return *this;
}
@@ -507,7 +507,7 @@
HTMLHtmlElement &HTMLHtmlElement::operator = (const Node &other)
{
- assignOther( other, ID_HTML );
+ assignOther( other, HTMLNames::html() );
return *this;
}
1.5 +12 -11 WebCore/khtml/dom/html_block.cpp
Index: html_block.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/html_block.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- html_block.cpp 10 Jun 2002 20:07:34 -0000 1.4
+++ html_block.cpp 9 Jul 2005 20:19:02 -0000 1.5
@@ -43,7 +43,7 @@
HTMLBlockquoteElement &HTMLBlockquoteElement::operator = (const Node &other)
{
- assignOther( other, ID_BLOCKQUOTE );
+ assignOther( other, HTMLNames::blockquote() );
return *this;
}
@@ -84,7 +84,7 @@
HTMLDivElement &HTMLDivElement::operator = (const Node &other)
{
- assignOther( other, ID_DIV );
+ assignOther( other, HTMLNames::div() );
return *this;
}
@@ -125,7 +125,7 @@
HTMLHRElement &HTMLHRElement::operator = (const Node &other)
{
- assignOther( other, ID_HR );
+ assignOther( other, HTMLNames::hr() );
return *this;
}
@@ -205,16 +205,17 @@
HTMLHeadingElement &HTMLHeadingElement::operator = (const Node &other)
{
- if(other.elementId() != ID_H1 ||
- other.elementId() != ID_H2 ||
- other.elementId() != ID_H3 ||
- other.elementId() != ID_H4 ||
- other.elementId() != ID_H5 ||
- other.elementId() != ID_H6 )
+ if (!other.handle()->hasTagName(HTMLNames::h1()) &&
+ !other.handle()->hasTagName(HTMLNames::h2()) &&
+ !other.handle()->hasTagName(HTMLNames::h3()) &&
+ !other.handle()->hasTagName(HTMLNames::h4()) &&
+ !other.handle()->hasTagName(HTMLNames::h5()) &&
+ !other.handle()->hasTagName(HTMLNames::h6()))
{
if ( impl ) impl->deref();
impl = 0;
} else {
+
Node::operator = (other);
}
return *this;
@@ -257,7 +258,7 @@
HTMLParagraphElement &HTMLParagraphElement::operator = (const Node &other)
{
- assignOther( other, ID_P );
+ assignOther( other, HTMLNames::p() );
return *this;
}
@@ -298,7 +299,7 @@
HTMLPreElement &HTMLPreElement::operator = (const Node &other)
{
- assignOther( other, ID_PRE );
+ assignOther( other, HTMLNames::pre() );
return *this;
}
1.15 +2 -2 WebCore/khtml/dom/html_element.cpp
Index: html_element.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/html_element.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- html_element.cpp 11 May 2005 00:58:28 -0000 1.14
+++ html_element.cpp 9 Jul 2005 20:19:02 -0000 1.15
@@ -182,9 +182,9 @@
return HTMLCollection(impl, HTMLCollectionImpl::NODE_CHILDREN);
}
-void HTMLElement::assignOther( const Node &other, int elementId )
+void HTMLElement::assignOther( const Node &other, const QualifiedName& tagName )
{
- if((int)other.elementId() != elementId) {
+ if (!other.handle()->hasTagName(tagName)) {
if ( impl ) impl->deref();
impl = 0;
} else {
1.9 +3 -1 WebCore/khtml/dom/html_element.h
Index: html_element.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/html_element.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- html_element.h 22 May 2004 01:50:48 -0000 1.8
+++ html_element.h 9 Jul 2005 20:19:02 -0000 1.9
@@ -30,6 +30,8 @@
#define HTML_ELEMENT_H
#include <dom/dom_element.h>
+#include "dom_qname.h"
+
class KHTMLView;
namespace DOM {
@@ -225,7 +227,7 @@
/*
* @internal
*/
- void assignOther( const Node &other, int elementId );
+ void assignOther( const Node &other, const QualifiedName& tagName );
};
}; //namespace
1.12 +11 -11 WebCore/khtml/dom/html_form.cpp
Index: html_form.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/html_form.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- html_form.cpp 11 May 2005 00:58:28 -0000 1.11
+++ html_form.cpp 9 Jul 2005 20:19:02 -0000 1.12
@@ -47,7 +47,7 @@
HTMLButtonElement &HTMLButtonElement::operator = (const Node &other)
{
- assignOther( other, ID_BUTTON );
+ assignOther( other, HTMLNames::button() );
return *this;
}
@@ -157,7 +157,7 @@
HTMLFieldSetElement &HTMLFieldSetElement::operator = (const Node &other)
{
- assignOther( other, ID_FIELDSET );
+ assignOther( other, HTMLNames::fieldset() );
return *this;
}
@@ -193,7 +193,7 @@
HTMLFormElement &HTMLFormElement::operator = (const Node &other)
{
- assignOther( other, ID_FORM );
+ assignOther( other, HTMLNames::form() );
return *this;
}
@@ -311,7 +311,7 @@
HTMLInputElement &HTMLInputElement::operator = (const Node &other)
{
- assignOther( other, ID_INPUT );
+ assignOther( other, HTMLNames::input() );
return *this;
}
@@ -574,7 +574,7 @@
HTMLLabelElement &HTMLLabelElement::operator = (const Node &other)
{
- assignOther( other, ID_LABEL );
+ assignOther( other, HTMLNames::label() );
return *this;
}
@@ -633,7 +633,7 @@
HTMLLegendElement &HTMLLegendElement::operator = (const Node &other)
{
- assignOther( other, ID_LEGEND );
+ assignOther( other, HTMLNames::legend() );
return *this;
}
@@ -691,7 +691,7 @@
HTMLOptGroupElement &HTMLOptGroupElement::operator = (const Node &other)
{
- assignOther( other, ID_OPTGROUP );
+ assignOther( other, HTMLNames::optgroup() );
return *this;
}
@@ -744,7 +744,7 @@
HTMLSelectElement &HTMLSelectElement::operator = (const Node &other)
{
- assignOther( other, ID_SELECT );
+ assignOther( other, HTMLNames::select() );
return *this;
}
@@ -906,7 +906,7 @@
HTMLTextAreaElement &HTMLTextAreaElement::operator = (const Node &other)
{
- assignOther( other, ID_TEXTAREA );
+ assignOther( other, HTMLNames::textarea() );
return *this;
}
@@ -1074,7 +1074,7 @@
HTMLOptionElement &HTMLOptionElement::operator = (const Node &other)
{
- assignOther( other, ID_OPTION );
+ assignOther( other, HTMLNames::option() );
return *this;
}
@@ -1182,7 +1182,7 @@
HTMLIsIndexElement &HTMLIsIndexElement::operator = (const Node &other)
{
- assignOther( other, ID_ISINDEX );
+ assignOther( other, HTMLNames::isindex() );
return *this;
}
1.11 +6 -6 WebCore/khtml/dom/html_head.cpp
Index: html_head.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/html_head.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- html_head.cpp 22 Jun 2005 18:22:01 -0000 1.10
+++ html_head.cpp 9 Jul 2005 20:19:02 -0000 1.11
@@ -42,7 +42,7 @@
HTMLBaseElement &HTMLBaseElement::operator = (const Node &other)
{
- assignOther( other, ID_BASE );
+ assignOther( other, HTMLNames::base() );
return *this;
}
@@ -97,7 +97,7 @@
HTMLLinkElement &HTMLLinkElement::operator = (const Node &other)
{
- assignOther( other, ID_LINK );
+ assignOther( other, HTMLNames::link() );
return *this;
}
@@ -238,7 +238,7 @@
HTMLMetaElement &HTMLMetaElement::operator = (const Node &other)
{
- assignOther( other, ID_META );
+ assignOther( other, HTMLNames::meta() );
return *this;
}
@@ -312,7 +312,7 @@
HTMLScriptElement &HTMLScriptElement::operator = (const Node &other)
{
- assignOther( other, ID_SCRIPT );
+ assignOther( other, HTMLNames::script() );
return *this;
}
@@ -424,7 +424,7 @@
HTMLStyleElement &HTMLStyleElement::operator = (const Node &other)
{
- assignOther( other, ID_STYLE );
+ assignOther( other, HTMLNames::style() );
return *this;
}
@@ -496,7 +496,7 @@
HTMLTitleElement &HTMLTitleElement::operator = (const Node &other)
{
- assignOther( other, ID_TITLE );
+ assignOther( other, HTMLNames::title() );
return *this;
}
1.10 +3 -3 WebCore/khtml/dom/html_image.cpp
Index: html_image.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/html_image.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- html_image.cpp 3 Nov 2003 06:32:04 -0000 1.9
+++ html_image.cpp 9 Jul 2005 20:19:02 -0000 1.10
@@ -46,7 +46,7 @@
HTMLAreaElement &HTMLAreaElement::operator = (const Node &other)
{
- assignOther( other, ID_AREA );
+ assignOther( other, HTMLNames::area() );
return *this;
}
@@ -176,7 +176,7 @@
HTMLImageElement &HTMLImageElement::operator = (const Node &other)
{
- assignOther( other, ID_IMG );
+ assignOther( other, HTMLNames::img() );
return *this;
}
@@ -372,7 +372,7 @@
HTMLMapElement &HTMLMapElement::operator = (const Node &other)
{
- assignOther( other, ID_MAP );
+ assignOther( other, HTMLNames::map() );
return *this;
}
1.8 +9 -13 WebCore/khtml/dom/html_inline.cpp
Index: html_inline.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/html_inline.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- html_inline.cpp 11 May 2005 00:58:28 -0000 1.7
+++ html_inline.cpp 9 Jul 2005 20:19:03 -0000 1.8
@@ -45,7 +45,7 @@
HTMLAnchorElement &HTMLAnchorElement::operator = (const Node &other)
{
- assignOther( other, ID_A );
+ assignOther( other, HTMLNames::a() );
return *this;
}
@@ -217,7 +217,7 @@
HTMLBRElement &HTMLBRElement::operator = (const Node &other)
{
- assignOther( other, ID_BR );
+ assignOther( other, HTMLNames::br() );
return *this;
}
@@ -258,7 +258,7 @@
HTMLFontElement &HTMLFontElement::operator = (const Node &other)
{
- assignOther( other, ID_FONT );
+ assignOther( other, HTMLNames::font() );
return *this;
}
@@ -319,7 +319,7 @@
HTMLModElement::HTMLModElement(HTMLElementImpl *_impl)
: HTMLElement()
{
- if (_impl && (_impl->id() == ID_INS || _impl->id() == ID_DEL))
+ if (_impl && (_impl->hasTagName(HTMLNames::ins()) || _impl->hasTagName(HTMLNames::del())))
impl = _impl;
else
impl = 0;
@@ -328,9 +328,8 @@
HTMLModElement &HTMLModElement::operator = (const Node &other)
{
- if( other.elementId() != ID_INS &&
- other.elementId() != ID_DEL )
- {
+ if (!other.handle()->hasTagName(HTMLNames::ins()) &&
+ !other.handle()->hasTagName(HTMLNames::del())) {
if ( impl ) impl->deref();
impl = 0;
} else {
@@ -381,19 +380,16 @@
{
}
-HTMLQuoteElement::HTMLQuoteElement(HTMLGenericElementImpl *_impl)
+HTMLQuoteElement::HTMLQuoteElement(HTMLQuoteElementImpl *_impl)
: HTMLElement()
{
- if (_impl && _impl->id() == ID_Q)
- impl = _impl;
- else
- impl = 0;
+ impl = _impl;
if ( impl ) impl->ref();
}
HTMLQuoteElement &HTMLQuoteElement::operator = (const Node &other)
{
- assignOther( other, ID_Q );
+ assignOther( other, HTMLNames::q() );
return *this;
}
1.4 +1 -1 WebCore/khtml/dom/html_inline.h
Index: html_inline.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/html_inline.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- html_inline.h 15 Apr 2002 23:42:01 -0000 1.3
+++ html_inline.h 9 Jul 2005 20:19:03 -0000 1.4
@@ -425,7 +425,7 @@
HTMLQuoteElement(const Node &other) : HTMLElement()
{(*this)=other;}
protected:
- HTMLQuoteElement(HTMLGenericElementImpl *impl);
+ HTMLQuoteElement(HTMLQuoteElementImpl *impl);
public:
HTMLQuoteElement & operator = (const HTMLQuoteElement &other);
1.5 +6 -6 WebCore/khtml/dom/html_list.cpp
Index: html_list.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/html_list.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- html_list.cpp 10 Jun 2002 20:07:36 -0000 1.4
+++ html_list.cpp 9 Jul 2005 20:19:03 -0000 1.5
@@ -41,7 +41,7 @@
HTMLDListElement &HTMLDListElement::operator = (const Node &other)
{
- assignOther( other, ID_DL );
+ assignOther( other, HTMLNames::dl() );
return *this;
}
@@ -88,7 +88,7 @@
HTMLDirectoryElement &HTMLDirectoryElement::operator = (const Node &other)
{
- assignOther( other, ID_DIR );
+ assignOther( other, HTMLNames::dir() );
return *this;
}
@@ -135,7 +135,7 @@
HTMLLIElement &HTMLLIElement::operator = (const Node &other)
{
- assignOther( other, ID_LI );
+ assignOther( other, HTMLNames::li() );
return *this;
}
@@ -190,7 +190,7 @@
HTMLMenuElement &HTMLMenuElement::operator = (const Node &other)
{
- assignOther( other, ID_MENU );
+ assignOther( other, HTMLNames::menu() );
return *this;
}
@@ -237,7 +237,7 @@
HTMLOListElement &HTMLOListElement::operator = (const Node &other)
{
- assignOther( other, ID_OL );
+ assignOther( other, HTMLNames::ol() );
return *this;
}
@@ -310,7 +310,7 @@
HTMLUListElement &HTMLUListElement::operator = (const Node &other)
{
- assignOther( other, ID_UL );
+ assignOther( other, HTMLNames::ul() );
return *this;
}
1.8 +1 -1 WebCore/khtml/dom/html_misc.cpp
Index: html_misc.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/html_misc.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- html_misc.cpp 11 May 2005 00:58:28 -0000 1.7
+++ html_misc.cpp 9 Jul 2005 20:19:03 -0000 1.8
@@ -41,7 +41,7 @@
HTMLBaseFontElement &HTMLBaseFontElement::operator = (const Node &other)
{
- assignOther( other, ID_BASEFONT );
+ assignOther( other, HTMLNames::basefont() );
return *this;
}
1.6 +3 -3 WebCore/khtml/dom/html_object.cpp
Index: html_object.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/html_object.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- html_object.cpp 1 Mar 2004 17:04:24 -0000 1.5
+++ html_object.cpp 9 Jul 2005 20:19:03 -0000 1.6
@@ -43,7 +43,7 @@
HTMLAppletElement &HTMLAppletElement::operator = (const Node &other)
{
- assignOther( other, ID_APPLET );
+ assignOther( other, HTMLNames::applet() );
return *this;
}
@@ -194,7 +194,7 @@
HTMLObjectElement &HTMLObjectElement::operator = (const Node &other)
{
- assignOther( other, ID_OBJECT );
+ assignOther( other, HTMLNames::object() );
return *this;
}
@@ -432,7 +432,7 @@
HTMLParamElement &HTMLParamElement::operator = (const Node &other)
{
- assignOther( other, ID_PARAM );
+ assignOther( other, HTMLNames::param() );
return *this;
}
1.7 +10 -13 WebCore/khtml/dom/html_table.cpp
Index: html_table.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/html_table.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- html_table.cpp 31 Oct 2003 00:47:16 -0000 1.6
+++ html_table.cpp 9 Jul 2005 20:19:03 -0000 1.7
@@ -45,7 +45,7 @@
HTMLTableCaptionElement &HTMLTableCaptionElement::operator = (const Node &other)
{
- assignOther( other, ID_CAPTION );
+ assignOther( other, HTMLNames::caption() );
return *this;
}
@@ -86,9 +86,8 @@
HTMLTableCellElement &HTMLTableCellElement::operator = (const Node &other)
{
- if( other.elementId() != ID_TD &&
- other.elementId() != ID_TH )
- {
+ if (!other.handle()->hasTagName(HTMLNames::td()) ||
+ !other.handle()->hasTagName(HTMLNames::th())) {
if ( impl ) impl->deref();
impl = 0;
} else {
@@ -295,9 +294,8 @@
HTMLTableColElement &HTMLTableColElement::operator = (const Node &other)
{
- if( other.elementId() != ID_COL &&
- other.elementId() != ID_COLGROUP )
- {
+ if (!other.handle()->hasTagName(HTMLNames::col()) &&
+ !other.handle()->hasTagName(HTMLNames::colgroup())) {
if ( impl ) impl->deref();
impl = 0;
} else {
@@ -401,7 +399,7 @@
HTMLTableElement &HTMLTableElement::operator = (const Node &other)
{
- assignOther( other, ID_TABLE );
+ assignOther( other, HTMLNames::table() );
return *this;
}
@@ -638,7 +636,7 @@
HTMLTableRowElement &HTMLTableRowElement::operator = (const Node &other)
{
- assignOther( other, ID_TR );
+ assignOther( other, HTMLNames::tr() );
return *this;
}
@@ -775,10 +773,9 @@
HTMLTableSectionElement &HTMLTableSectionElement::operator = (const Node &other)
{
- if(other.elementId() != ID_TBODY &&
- other.elementId() != ID_THEAD &&
- other.elementId() != ID_TFOOT )
- {
+ if (!other.handle()->hasTagName(HTMLNames::tbody()) &&
+ !other.handle()->hasTagName(HTMLNames::thead()) &&
+ !other.handle()->hasTagName(HTMLNames::tfoot())) {
if ( impl ) impl->deref();
impl = 0;
} else {
1.28 +3 -2 WebCore/khtml/ecma/kjs_css.cpp
Index: kjs_css.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_css.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- kjs_css.cpp 3 Jul 2005 10:47:55 -0000 1.27
+++ kjs_css.cpp 9 Jul 2005 20:19:05 -0000 1.28
@@ -29,7 +29,7 @@
#include "xml/dom_docimpl.h"
#include "html/html_headimpl.h" // for HTMLStyleElement
#include "kjs_dom.h"
-#include "misc/htmltags.h"
+#include "htmlnames.h"
#include <kdebug.h>
@@ -55,6 +55,7 @@
using DOM::DocumentImpl;
using DOM::DOMString;
using DOM::ElementImpl;
+using DOM::HTMLNames;
using DOM::HTMLStyleElementImpl;
using DOM::MediaListImpl;
using DOM::RectImpl;
@@ -404,7 +405,7 @@
// and doesn't look for name attribute (see implementation above).
// But unicity of stylesheet ids is good practice anyway ;)
ElementImpl *element = m_doc->getElementById(p.string());
- if (element && element->id() == ID_STYLE)
+ if (element && element->hasTagName(HTMLNames::style()))
return getDOMStyleSheet(exec, static_cast<HTMLStyleElementImpl *>(element)->sheet());
return DOMObject::tryGet(exec, p);
1.78 +18 -24 WebCore/khtml/ecma/kjs_dom.cpp
Index: kjs_dom.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_dom.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- kjs_dom.cpp 3 Jul 2005 10:47:55 -0000 1.77
+++ kjs_dom.cpp 9 Jul 2005 20:19:05 -0000 1.78
@@ -47,8 +47,6 @@
#include "html_objectimpl.h"
-#include "misc/htmltags.h"
-
#if APPLE_CHANGES
#include <JavaScriptCore/runtime_object.h>
#endif
@@ -67,6 +65,7 @@
using DOM::HTMLDocumentImpl;
using DOM::HTMLElementImpl;
using DOM::HTMLEmbedElementImpl;
+using DOM::HTMLNames;
using DOM::HTMLObjectElementImpl;
using DOM::NamedNodeMapImpl;
using DOM::Node;
@@ -462,7 +461,7 @@
node.setNodeValue(value.toString(exec).string(), exception);
break;
case Prefix:
- node.setPrefix(value.toString(exec).string(), exception);
+ node.setPrefix(value.toString(exec).string().implementation(), exception);
break;
case OnAbort:
setListener(exec,DOM::EventImpl::ABORT_EVENT,value);
@@ -1187,7 +1186,7 @@
{
switch( entry->value ) {
case TagName:
- return getStringOrNull(element.tagName());
+ return getStringOrNull(element.nodeName());
case Style:
return getDOMCSSStyleDeclaration(exec,element.style());
default:
@@ -1710,26 +1709,21 @@
if (!n)
return 0;
- switch (n->id()) {
- case ID_APPLET: {
- HTMLAppletElementImpl *appletElement = static_cast<HTMLAppletElementImpl *>(n);
- if (appletElement->getAppletInstance())
- // The instance is owned by the applet element.
- return new RuntimeObjectImp(appletElement->getAppletInstance(), false);
- break;
- }
- case ID_EMBED: {
- HTMLEmbedElementImpl *embedElement = static_cast<HTMLEmbedElementImpl *>(n);
- if (embedElement->getEmbedInstance())
- return new RuntimeObjectImp(embedElement->getEmbedInstance(), false);
- break;
- }
- case ID_OBJECT: {
- HTMLObjectElementImpl *objectElement = static_cast<HTMLObjectElementImpl *>(n);
- if (objectElement->getObjectInstance())
- return new RuntimeObjectImp(objectElement->getObjectInstance(), false);
- break;
- }
+ if (n->hasTagName(HTMLNames::applet())) {
+ HTMLAppletElementImpl *appletElement = static_cast<HTMLAppletElementImpl *>(n);
+ if (appletElement->getAppletInstance())
+ // The instance is owned by the applet element.
+ return new RuntimeObjectImp(appletElement->getAppletInstance(), false);
+ }
+ else if (n->hasTagName(HTMLNames::embed())) {
+ HTMLEmbedElementImpl *embedElement = static_cast<HTMLEmbedElementImpl *>(n);
+ if (embedElement->getEmbedInstance())
+ return new RuntimeObjectImp(embedElement->getEmbedInstance(), false);
+ }
+ else if (n->hasTagName(HTMLNames::object())) {
+ HTMLObjectElementImpl *objectElement = static_cast<HTMLObjectElementImpl *>(n);
+ if (objectElement->getObjectInstance())
+ return new RuntimeObjectImp(objectElement->getObjectInstance(), false);
}
// If we don't have a runtime object return 0.
1.122 +1936 -1781WebCore/khtml/ecma/kjs_html.cpp
Index: kjs_html.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_html.cpp,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -r1.121 -r1.122
--- kjs_html.cpp 3 Jul 2005 10:47:56 -0000 1.121
+++ kjs_html.cpp 9 Jul 2005 20:19:05 -0000 1.122
@@ -46,8 +46,6 @@
#include "kjs_events.h"
#include "kjs_proxy.h"
-#include "misc/htmltags.h"
-
#include "rendering/render_canvasimage.h"
#include "rendering/render_object.h"
#include "rendering/render_layer.h"
@@ -109,6 +107,7 @@
using DOM::HTMLMenuElementImpl;
using DOM::HTMLMetaElementImpl;
using DOM::HTMLModElementImpl;
+using DOM::HTMLNames;
using DOM::HTMLOListElementImpl;
using DOM::HTMLObjectElementImpl;
using DOM::HTMLOptGroupElementImpl;
@@ -353,7 +352,7 @@
if (val)
return Value(val);
- HTMLBodyElementImpl *bodyElement = (body && body->id() == ID_BODY) ? static_cast<HTMLBodyElementImpl *>(body) : 0;
+ HTMLBodyElementImpl *bodyElement = (body && body->hasTagName(HTMLNames::body())) ? static_cast<HTMLBodyElementImpl *>(body) : 0;
if (entry) {
switch (entry->value) {
@@ -429,7 +428,7 @@
DOMExceptionTranslator exception(exec);
HTMLDocumentImpl &doc = *static_cast<HTMLDocumentImpl *>(impl());
HTMLElementImpl *body = doc.body();
- HTMLBodyElementImpl *bodyElement = (body && body->id() == ID_BODY) ? static_cast<HTMLBodyElementImpl *>(body) : 0;
+ HTMLBodyElementImpl *bodyElement = (body && body->hasTagName(HTMLNames::body())) ? static_cast<HTMLBodyElementImpl *>(body) : 0;
switch (token) {
case Title:
@@ -583,133 +582,218 @@
const ClassInfo* KJS::HTMLElement::classInfo() const
{
- switch (impl()->id()) {
- case ID_HTML:
- return &html_info;
- case ID_HEAD:
- return &head_info;
- case ID_LINK:
- return &link_info;
- case ID_TITLE:
- return &title_info;
- case ID_META:
- return &meta_info;
- case ID_BASE:
- return &base_info;
- case ID_ISINDEX:
- return &isIndex_info;
- case ID_STYLE:
- return &style_info;
- case ID_BODY:
- return &body_info;
- case ID_FORM:
- return &form_info;
- case ID_SELECT:
- return &select_info;
- case ID_OPTGROUP:
- return &optGroup_info;
- case ID_OPTION:
- return &option_info;
- case ID_INPUT:
- return &input_info;
- case ID_TEXTAREA:
- return &textArea_info;
- case ID_BUTTON:
- return &button_info;
- case ID_LABEL:
- return &label_info;
- case ID_FIELDSET:
- return &fieldSet_info;
- case ID_LEGEND:
- return &legend_info;
- case ID_UL:
- return &ul_info;
- case ID_OL:
- return &ol_info;
- case ID_DL:
- return &dl_info;
- case ID_DIR:
- return &dir_info;
- case ID_MENU:
- return &menu_info;
- case ID_LI:
- return &li_info;
- case ID_DIV:
- return &div_info;
- case ID_P:
- return &p_info;
- case ID_H1:
- case ID_H2:
- case ID_H3:
- case ID_H4:
- case ID_H5:
- case ID_H6:
- return &heading_info;
- case ID_BLOCKQUOTE:
- return &blockQuote_info;
- case ID_Q:
- return &q_info;
- case ID_PRE:
- return &pre_info;
- case ID_BR:
- return &br_info;
- case ID_BASEFONT:
- return &baseFont_info;
- case ID_FONT:
- return &font_info;
- case ID_HR:
- return &hr_info;
- case ID_INS:
- case ID_DEL:
- return &mod_info;
- case ID_A:
- return &a_info;
- case ID_CANVAS:
- return &canvas_info;
- case ID_IMG:
- return &img_info;
- case ID_OBJECT:
- return &object_info;
- case ID_PARAM:
- return ¶m_info;
- case ID_APPLET:
- return &applet_info;
- case ID_MAP:
- return &map_info;
- case ID_AREA:
- return &area_info;
- case ID_SCRIPT:
- return &script_info;
- case ID_TABLE:
- return &table_info;
- case ID_CAPTION:
- return &caption_info;
- case ID_COL:
- return &col_info;
- case ID_THEAD:
- return &tablesection_info;
- case ID_TBODY:
- return &tablesection_info;
- case ID_TFOOT:
- return &tablesection_info;
- case ID_TR:
- return &tr_info;
- case ID_TH:
- return &tablecell_info;
- case ID_TD:
- return &tablecell_info;
- case ID_FRAMESET:
- return &frameSet_info;
- case ID_FRAME:
- return &frame_info;
- case ID_IFRAME:
- return &iFrame_info;
- case ID_MARQUEE:
- return &marquee_info;
- default:
+ // FIXME: We want to use HashMap here, but there are compiler issues to deal with.
+ static QPtrDict<const ClassInfo> classInfoDict;
+ if (classInfoDict.isEmpty()) {
+ classInfoDict.insert(HTMLNames::a().localName().implementation(), &a_info);
+ classInfoDict.insert(HTMLNames::applet().localName().implementation(), &applet_info);
+ classInfoDict.insert(HTMLNames::area().localName().implementation(), &area_info);
+ classInfoDict.insert(HTMLNames::base().localName().implementation(), &base_info);
+ classInfoDict.insert(HTMLNames::basefont().localName().implementation(), &baseFont_info);
+ classInfoDict.insert(HTMLNames::blockquote().localName().implementation(), &blockQuote_info);
+ classInfoDict.insert(HTMLNames::body().localName().implementation(), &body_info);
+ classInfoDict.insert(HTMLNames::br().localName().implementation(), &br_info);
+ classInfoDict.insert(HTMLNames::button().localName().implementation(), &button_info);
+ classInfoDict.insert(HTMLNames::canvas().localName().implementation(), &canvas_info);
+ classInfoDict.insert(HTMLNames::caption().localName().implementation(), &caption_info);
+ classInfoDict.insert(HTMLNames::col().localName().implementation(), &col_info);
+ classInfoDict.insert(HTMLNames::colgroup().localName().implementation(), &col_info);
+ classInfoDict.insert(HTMLNames::del().localName().implementation(), &mod_info);
+ classInfoDict.insert(HTMLNames::dir().localName().implementation(), &dir_info);
+ classInfoDict.insert(HTMLNames::div().localName().implementation(), &div_info);
+ classInfoDict.insert(HTMLNames::dl().localName().implementation(), &dl_info);
+ classInfoDict.insert(HTMLNames::fieldset().localName().implementation(), &fieldSet_info);
+ classInfoDict.insert(HTMLNames::font().localName().implementation(), &font_info);
+ classInfoDict.insert(HTMLNames::form().localName().implementation(), &form_info);
+ classInfoDict.insert(HTMLNames::frame().localName().implementation(), &frame_info);
+ classInfoDict.insert(HTMLNames::frameset().localName().implementation(), &frameSet_info);
+ classInfoDict.insert(HTMLNames::h1().localName().implementation(), &heading_info);
+ classInfoDict.insert(HTMLNames::h2().localName().implementation(), &heading_info);
+ classInfoDict.insert(HTMLNames::h3().localName().implementation(), &heading_info);
+ classInfoDict.insert(HTMLNames::h4().localName().implementation(), &heading_info);
+ classInfoDict.insert(HTMLNames::h5().localName().implementation(), &heading_info);
+ classInfoDict.insert(HTMLNames::h6().localName().implementation(), &heading_info);
+ classInfoDict.insert(HTMLNames::head().localName().implementation(), &head_info);
+ classInfoDict.insert(HTMLNames::hr().localName().implementation(), &hr_info);
+ classInfoDict.insert(HTMLNames::html().localName().implementation(), &html_info);
+ classInfoDict.insert(HTMLNames::iframe().localName().implementation(), &iFrame_info);
+ classInfoDict.insert(HTMLNames::img().localName().implementation(), &img_info);
+ classInfoDict.insert(HTMLNames::input().localName().implementation(), &input_info);
+ classInfoDict.insert(HTMLNames::ins().localName().implementation(), &mod_info);
+ classInfoDict.insert(HTMLNames::isindex().localName().implementation(), &isIndex_info);
+ classInfoDict.insert(HTMLNames::label().localName().implementation(), &label_info);
+ classInfoDict.insert(HTMLNames::legend().localName().implementation(), &legend_info);
+ classInfoDict.insert(HTMLNames::li().localName().implementation(), &li_info);
+ classInfoDict.insert(HTMLNames::link().localName().implementation(), &link_info);
+ classInfoDict.insert(HTMLNames::map().localName().implementation(), &map_info);
+ classInfoDict.insert(HTMLNames::marquee().localName().implementation(), &marquee_info);
+ classInfoDict.insert(HTMLNames::menu().localName().implementation(), &menu_info);
+ classInfoDict.insert(HTMLNames::meta().localName().implementation(), &meta_info);
+ classInfoDict.insert(HTMLNames::object().localName().implementation(), &object_info);
+ classInfoDict.insert(HTMLNames::ol().localName().implementation(), &ol_info);
+ classInfoDict.insert(HTMLNames::option().localName().implementation(), &option_info);
+ classInfoDict.insert(HTMLNames::optgroup().localName().implementation(), &optGroup_info);
+ classInfoDict.insert(HTMLNames::p().localName().implementation(), &p_info);
+ classInfoDict.insert(HTMLNames::param().localName().implementation(), ¶m_info);
+ classInfoDict.insert(HTMLNames::pre().localName().implementation(), &pre_info);
+ classInfoDict.insert(HTMLNames::q().localName().implementation(), &q_info);
+ classInfoDict.insert(HTMLNames::script().localName().implementation(), &script_info);
+ classInfoDict.insert(HTMLNames::select().localName().implementation(), &select_info);
+ classInfoDict.insert(HTMLNames::style().localName().implementation(), &style_info);
+ classInfoDict.insert(HTMLNames::table().localName().implementation(), &table_info);
+ classInfoDict.insert(HTMLNames::tbody().localName().implementation(), &tablesection_info);
+ classInfoDict.insert(HTMLNames::td().localName().implementation(), &tablecell_info);
+ classInfoDict.insert(HTMLNames::textarea().localName().implementation(), &textArea_info);
+ classInfoDict.insert(HTMLNames::th().localName().implementation(), &tablecell_info);
+ classInfoDict.insert(HTMLNames::thead().localName().implementation(), &tablesection_info);
+ classInfoDict.insert(HTMLNames::tfoot().localName().implementation(), &tablesection_info);
+ classInfoDict.insert(HTMLNames::title().localName().implementation(), &title_info);
+ classInfoDict.insert(HTMLNames::tr().localName().implementation(), &tr_info);
+ classInfoDict.insert(HTMLNames::ul().localName().implementation(), &ul_info);
+ }
+
+ HTMLElementImpl* element = static_cast<HTMLElementImpl*>(impl());
+ const ClassInfo* result = classInfoDict.find(element->localName().implementation());
+ if (result)
+ return result;
return &info;
- }
}
+
+const HTMLElement::Accessors HTMLElement::html_accessors = { &HTMLElement::htmlGetter, &HTMLElement::htmlSetter };
+const HTMLElement::Accessors HTMLElement::head_accessors = { &HTMLElement::headGetter, &HTMLElement::headSetter };
+const HTMLElement::Accessors HTMLElement::link_accessors = { &HTMLElement::linkGetter, &HTMLElement::linkSetter };
+const HTMLElement::Accessors HTMLElement::title_accessors = { &HTMLElement::titleGetter, &HTMLElement::titleSetter };
+const HTMLElement::Accessors HTMLElement::meta_accessors = { &HTMLElement::metaGetter, &HTMLElement::metaSetter };
+const HTMLElement::Accessors HTMLElement::base_accessors = { &HTMLElement::baseGetter, &HTMLElement::baseSetter };
+const HTMLElement::Accessors HTMLElement::isIndex_accessors = { &HTMLElement::isIndexGetter, &HTMLElement::isIndexSetter };
+const HTMLElement::Accessors HTMLElement::style_accessors = { &HTMLElement::styleGetter, &HTMLElement::styleSetter };
+const HTMLElement::Accessors HTMLElement::body_accessors = { &HTMLElement::bodyGetter, &HTMLElement::bodySetter };
+const HTMLElement::Accessors HTMLElement::form_accessors = { &HTMLElement::formGetter, &HTMLElement::formSetter };
+const HTMLElement::Accessors HTMLElement::select_accessors = { &HTMLElement::selectGetter, &HTMLElement::selectSetter };
+const HTMLElement::Accessors HTMLElement::optGroup_accessors = { &HTMLElement::optGroupGetter, &HTMLElement::optGroupSetter };
+const HTMLElement::Accessors HTMLElement::option_accessors = { &HTMLElement::optionGetter, &HTMLElement::optionSetter };
+const HTMLElement::Accessors HTMLElement::input_accessors = { &HTMLElement::inputGetter, &HTMLElement::inputSetter };
+const HTMLElement::Accessors HTMLElement::textArea_accessors = { &HTMLElement::textAreaGetter, &HTMLElement::textAreaSetter };
+const HTMLElement::Accessors HTMLElement::button_accessors = { &HTMLElement::buttonGetter, &HTMLElement::buttonSetter };
+const HTMLElement::Accessors HTMLElement::label_accessors = { &HTMLElement::labelGetter, &HTMLElement::labelSetter };
+const HTMLElement::Accessors HTMLElement::fieldSet_accessors = { &HTMLElement::fieldSetGetter, &HTMLElement::fieldSetSetter };
+const HTMLElement::Accessors HTMLElement::legend_accessors = { &HTMLElement::legendGetter, &HTMLElement::legendSetter };
+const HTMLElement::Accessors HTMLElement::ul_accessors = { &HTMLElement::uListGetter, &HTMLElement::uListSetter };
+const HTMLElement::Accessors HTMLElement::ol_accessors = { &HTMLElement::oListGetter, &HTMLElement::oListSetter };
+const HTMLElement::Accessors HTMLElement::dl_accessors = { &HTMLElement::dListGetter, &HTMLElement::dListSetter };
+const HTMLElement::Accessors HTMLElement::dir_accessors = { &HTMLElement::dirGetter, &HTMLElement::dirSetter };
+const HTMLElement::Accessors HTMLElement::menu_accessors = { &HTMLElement::menuGetter, &HTMLElement::menuSetter };
+const HTMLElement::Accessors HTMLElement::li_accessors = { &HTMLElement::liGetter, &HTMLElement::liSetter };
+const HTMLElement::Accessors HTMLElement::div_accessors = { &HTMLElement::divGetter, &HTMLElement::divSetter };
+const HTMLElement::Accessors HTMLElement::p_accessors = { &HTMLElement::paragraphGetter, &HTMLElement::paragraphSetter };
+const HTMLElement::Accessors HTMLElement::heading_accessors = { &HTMLElement::headingGetter, &HTMLElement::headingSetter };
+const HTMLElement::Accessors HTMLElement::blockQuote_accessors = { &HTMLElement::blockQuoteGetter, &HTMLElement::blockQuoteSetter };
+const HTMLElement::Accessors HTMLElement::q_accessors = { &HTMLElement::quoteGetter, &HTMLElement::quoteSetter };
+const HTMLElement::Accessors HTMLElement::pre_accessors = { &HTMLElement::preGetter, &HTMLElement::preSetter };
+const HTMLElement::Accessors HTMLElement::br_accessors = { &HTMLElement::brGetter, &HTMLElement::brSetter };
+const HTMLElement::Accessors HTMLElement::baseFont_accessors = { &HTMLElement::baseFontGetter, &HTMLElement::baseFontSetter };
+const HTMLElement::Accessors HTMLElement::font_accessors = { &HTMLElement::fontGetter, &HTMLElement::fontSetter };
+const HTMLElement::Accessors HTMLElement::hr_accessors = { &HTMLElement::hrGetter, &HTMLElement::hrSetter };
+const HTMLElement::Accessors HTMLElement::mod_accessors = { &HTMLElement::modGetter, &HTMLElement::modSetter };
+const HTMLElement::Accessors HTMLElement::a_accessors = { &HTMLElement::anchorGetter, &HTMLElement::anchorSetter };
+const HTMLElement::Accessors HTMLElement::canvas_accessors = { &HTMLElement::imageGetter, &HTMLElement::imageSetter };
+const HTMLElement::Accessors HTMLElement::img_accessors = { &HTMLElement::imageGetter, &HTMLElement::imageSetter };
+const HTMLElement::Accessors HTMLElement::object_accessors = { &HTMLElement::objectGetter, &HTMLElement::objectSetter };
+const HTMLElement::Accessors HTMLElement::param_accessors = { &HTMLElement::paramGetter, &HTMLElement::paramSetter };
+const HTMLElement::Accessors HTMLElement::applet_accessors = { &HTMLElement::appletGetter, &HTMLElement::appletSetter };
+const HTMLElement::Accessors HTMLElement::map_accessors = { &HTMLElement::mapGetter, &HTMLElement::mapSetter };
+const HTMLElement::Accessors HTMLElement::area_accessors = { &HTMLElement::areaGetter, &HTMLElement::areaSetter };
+const HTMLElement::Accessors HTMLElement::script_accessors = { &HTMLElement::scriptGetter, &HTMLElement::scriptSetter };
+const HTMLElement::Accessors HTMLElement::table_accessors = { &HTMLElement::tableGetter, &HTMLElement::tableSetter };
+const HTMLElement::Accessors HTMLElement::caption_accessors = { &HTMLElement::tableCaptionGetter, &HTMLElement::tableCaptionSetter };
+const HTMLElement::Accessors HTMLElement::col_accessors = { &HTMLElement::tableColGetter, &HTMLElement::tableColSetter };
+const HTMLElement::Accessors HTMLElement::tablesection_accessors = { &HTMLElement::tableSectionGetter, &HTMLElement::tableSectionSetter };
+const HTMLElement::Accessors HTMLElement::tr_accessors = { &HTMLElement::tableRowGetter, &HTMLElement::tableRowSetter };
+const HTMLElement::Accessors HTMLElement::tablecell_accessors = { &HTMLElement::tableCellGetter, &HTMLElement::tableCellSetter };
+const HTMLElement::Accessors HTMLElement::frameSet_accessors = { &HTMLElement::frameSetGetter, &HTMLElement::frameSetSetter };
+const HTMLElement::Accessors HTMLElement::frame_accessors = { &HTMLElement::frameGetter, &HTMLElement::frameSetter };
+const HTMLElement::Accessors HTMLElement::iFrame_accessors = { &HTMLElement::iFrameGetter, &HTMLElement::iFrameSetter };
+const HTMLElement::Accessors HTMLElement::marquee_accessors = { &HTMLElement::marqueeGetter, &HTMLElement::marqueeSetter };
+
+const HTMLElement::Accessors* HTMLElement::getSetInfo() const
+{
+ // FIXME: We want to use HashMap here, but there are compiler issues to deal with.
+ static QPtrDict<const HTMLElement::Accessors> getSetInfoDict;
+ if (getSetInfoDict.isEmpty()) {
+ getSetInfoDict.insert(HTMLNames::a().localName().implementation(), &a_accessors);
+ getSetInfoDict.insert(HTMLNames::applet().localName().implementation(), &applet_accessors);
+ getSetInfoDict.insert(HTMLNames::area().localName().implementation(), &area_accessors);
+ getSetInfoDict.insert(HTMLNames::base().localName().implementation(), &base_accessors);
+ getSetInfoDict.insert(HTMLNames::basefont().localName().implementation(), &baseFont_accessors);
+ getSetInfoDict.insert(HTMLNames::blockquote().localName().implementation(), &blockQuote_accessors);
+ getSetInfoDict.insert(HTMLNames::body().localName().implementation(), &body_accessors);
+ getSetInfoDict.insert(HTMLNames::br().localName().implementation(), &br_accessors);
+ getSetInfoDict.insert(HTMLNames::button().localName().implementation(), &button_accessors);
+ getSetInfoDict.insert(HTMLNames::canvas().localName().implementation(), &canvas_accessors);
+ getSetInfoDict.insert(HTMLNames::caption().localName().implementation(), &caption_accessors);
+ getSetInfoDict.insert(HTMLNames::col().localName().implementation(), &col_accessors);
+ getSetInfoDict.insert(HTMLNames::colgroup().localName().implementation(), &col_accessors);
+ getSetInfoDict.insert(HTMLNames::del().localName().implementation(), &mod_accessors);
+ getSetInfoDict.insert(HTMLNames::dir().localName().implementation(), &dir_accessors);
+ getSetInfoDict.insert(HTMLNames::div().localName().implementation(), &div_accessors);
+ getSetInfoDict.insert(HTMLNames::dl().localName().implementation(), &dl_accessors);
+ getSetInfoDict.insert(HTMLNames::fieldset().localName().implementation(), &fieldSet_accessors);
+ getSetInfoDict.insert(HTMLNames::font().localName().implementation(), &font_accessors);
+ getSetInfoDict.insert(HTMLNames::form().localName().implementation(), &form_accessors);
+ getSetInfoDict.insert(HTMLNames::frame().localName().implementation(), &frame_accessors);
+ getSetInfoDict.insert(HTMLNames::frameset().localName().implementation(), &frameSet_accessors);
+ getSetInfoDict.insert(HTMLNames::h1().localName().implementation(), &heading_accessors);
+ getSetInfoDict.insert(HTMLNames::h2().localName().implementation(), &heading_accessors);
+ getSetInfoDict.insert(HTMLNames::h3().localName().implementation(), &heading_accessors);
+ getSetInfoDict.insert(HTMLNames::h4().localName().implementation(), &heading_accessors);
+ getSetInfoDict.insert(HTMLNames::h5().localName().implementation(), &heading_accessors);
+ getSetInfoDict.insert(HTMLNames::h6().localName().implementation(), &heading_accessors);
+ getSetInfoDict.insert(HTMLNames::head().localName().implementation(), &head_accessors);
+ getSetInfoDict.insert(HTMLNames::hr().localName().implementation(), &hr_accessors);
+ getSetInfoDict.insert(HTMLNames::html().localName().implementation(), &html_accessors);
+ getSetInfoDict.insert(HTMLNames::iframe().localName().implementation(), &iFrame_accessors);
+ getSetInfoDict.insert(HTMLNames::img().localName().implementation(), &img_accessors);
+ getSetInfoDict.insert(HTMLNames::input().localName().implementation(), &input_accessors);
+ getSetInfoDict.insert(HTMLNames::ins().localName().implementation(), &mod_accessors);
+ getSetInfoDict.insert(HTMLNames::isindex().localName().implementation(), &isIndex_accessors);
+ getSetInfoDict.insert(HTMLNames::label().localName().implementation(), &label_accessors);
+ getSetInfoDict.insert(HTMLNames::legend().localName().implementation(), &legend_accessors);
+ getSetInfoDict.insert(HTMLNames::li().localName().implementation(), &li_accessors);
+ getSetInfoDict.insert(HTMLNames::link().localName().implementation(), &link_accessors);
+ getSetInfoDict.insert(HTMLNames::map().localName().implementation(), &map_accessors);
+ getSetInfoDict.insert(HTMLNames::marquee().localName().implementation(), &marquee_accessors);
+ getSetInfoDict.insert(HTMLNames::menu().localName().implementation(), &menu_accessors);
+ getSetInfoDict.insert(HTMLNames::meta().localName().implementation(), &meta_accessors);
+ getSetInfoDict.insert(HTMLNames::object().localName().implementation(), &object_accessors);
+ getSetInfoDict.insert(HTMLNames::ol().localName().implementation(), &ol_accessors);
+ getSetInfoDict.insert(HTMLNames::option().localName().implementation(), &option_accessors);
+ getSetInfoDict.insert(HTMLNames::optgroup().localName().implementation(), &optGroup_accessors);
+ getSetInfoDict.insert(HTMLNames::p().localName().implementation(), &p_accessors);
+ getSetInfoDict.insert(HTMLNames::param().localName().implementation(), ¶m_accessors);
+ getSetInfoDict.insert(HTMLNames::pre().localName().implementation(), &pre_accessors);
+ getSetInfoDict.insert(HTMLNames::q().localName().implementation(), &q_accessors);
+ getSetInfoDict.insert(HTMLNames::script().localName().implementation(), &script_accessors);
+ getSetInfoDict.insert(HTMLNames::select().localName().implementation(), &select_accessors);
+ getSetInfoDict.insert(HTMLNames::style().localName().implementation(), &style_accessors);
+ getSetInfoDict.insert(HTMLNames::table().localName().implementation(), &table_accessors);
+ getSetInfoDict.insert(HTMLNames::tbody().localName().implementation(), &tablesection_accessors);
+ getSetInfoDict.insert(HTMLNames::td().localName().implementation(), &tablecell_accessors);
+ getSetInfoDict.insert(HTMLNames::textarea().localName().implementation(), &textArea_accessors);
+ getSetInfoDict.insert(HTMLNames::th().localName().implementation(), &tablecell_accessors);
+ getSetInfoDict.insert(HTMLNames::thead().localName().implementation(), &tablesection_accessors);
+ getSetInfoDict.insert(HTMLNames::tfoot().localName().implementation(), &tablesection_accessors);
+ getSetInfoDict.insert(HTMLNames::title().localName().implementation(), &title_accessors);
+ getSetInfoDict.insert(HTMLNames::tr().localName().implementation(), &tr_accessors);
+ getSetInfoDict.insert(HTMLNames::ul().localName().implementation(), &ul_accessors);
+ }
+
+ HTMLElementImpl* element = static_cast<HTMLElementImpl*>(impl());
+ const HTMLElement::Accessors* result = getSetInfoDict.find(element->localName().implementation());
+ if (result)
+ return result;
+ return 0;
+}
+
/*
@begin HTMLElementTable 14
id KJS::HTMLElement::ElementId DontDelete
@@ -1184,7 +1268,7 @@
@end
@begin HTMLCanvasElementTable 1
- getContext KJS::HTMLElement::GetContext DontDelete|Function 0
+ getContext KJS::HTMLElement::GetContext DontDelete|Function 1
@end
*/
@@ -1195,35 +1279,32 @@
Value KJS::HTMLElement::tryGet(ExecState *exec, const Identifier &propertyName) const
{
- HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
+ HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
#ifdef KJS_VERBOSE
- kdDebug(6070) << "KJS::HTMLElement::tryGet " << propertyName.qstring() << " thisTag=" << element.tagName().string() << endl;
+ kdDebug(6070) << "KJS::HTMLElement::tryGet " << propertyName.qstring() << " thisTag=" << element.tagName().string() << endl;
#endif
- // First look at dynamic properties
- switch (element.id()) {
- case ID_FORM: {
- HTMLFormElementImpl &form = static_cast<HTMLFormElementImpl &>(element);
- // Check if we're retrieving an element (by index or by name)
- bool ok;
- uint u = propertyName.toULong(&ok);
- if (ok)
- return getDOMNode(exec, form.elements()->item(u));
- ValueImp *namedItems = HTMLCollection(exec, form.elements().get()).getNamedItems(exec, propertyName);
- if (!namedItems->isUndefined())
- return namedItems;
- }
- break;
- case ID_SELECT: {
- HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
- bool ok;
- uint u = propertyName.toULong(&ok);
- if (ok)
- return getDOMNode(exec, select.optionsHTMLCollection()->item(u)); // not specified by DOM(?) but supported in netscape/IE
+ // First look at dynamic properties
+ if (element.hasLocalName(HTMLNames::form())) {
+ HTMLFormElementImpl &form = static_cast<HTMLFormElementImpl &>(element);
+ // Check if we're retrieving an element (by index or by name)
+ bool ok;
+ uint u = propertyName.toULong(&ok);
+ if (ok)
+ return getDOMNode(exec, form.elements()->item(u));
+ ValueImp *namedItems = HTMLCollection(exec, form.elements().get()).getNamedItems(exec, propertyName);
+ if (!namedItems->isUndefined())
+ return namedItems;
+ }
+ else if (element.hasLocalName(HTMLNames::select())) {
+ HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
+ bool ok;
+ uint u = propertyName.toULong(&ok);
+ if (ok)
+ return getDOMNode(exec, select.optionsHTMLCollection()->item(u)); // not specified by DOM(?) but supported in netscape/IE
}
- break;
- case ID_FRAMESET: {
+ else if (element.hasLocalName(HTMLNames::frameset())) {
NodeImpl *frame = element.children()->namedItem(propertyName.string());
- if (frame && frame->id() == ID_FRAME) {
+ if (frame && frame->hasTagName(HTMLNames::frame())) {
DocumentImpl* doc = static_cast<HTMLFrameElementImpl *>(frame)->contentDocument();
if (doc) {
KHTMLPart* part = doc->part();
@@ -1236,73 +1317,57 @@
}
}
}
- break;
- case ID_FRAME:
- case ID_IFRAME: {
+ else if (element.hasLocalName(HTMLNames::frame()) || element.hasLocalName(HTMLNames::iframe())) {
DocumentImpl* doc = static_cast<HTMLFrameElementImpl &>(element).contentDocument();
- if ( doc ) {
+ if (doc) {
KHTMLPart* part = doc->part();
- if ( part ) {
+ if (part) {
Window *window = Window::retrieveWindow(part);
if (window && window->hasProperty(exec, propertyName))
return window->get(exec, propertyName);
}
}
}
- break;
#if APPLE_CHANGES
- case ID_EMBED:
- case ID_OBJECT:
- case ID_APPLET: {
- if (propertyName == "__apple_runtime_object") {
+ else if (element.hasLocalName(HTMLNames::embed()) || element.hasLocalName(HTMLNames::object()) ||
+ element.hasLocalName(HTMLNames::applet())) {
+ if (propertyName == "__apple_runtime_object")
return getRuntimeObject(exec,&element);
- }
-
Value runtimeObject = getRuntimeObject(exec,&element);
if (!runtimeObject.isNull()) {
ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject.imp());
- if (imp->hasProperty(exec, propertyName)) {
+ if (imp->hasProperty(exec, propertyName))
return imp->get (exec, propertyName);
- }
}
}
- break;
#endif
- default:
- break;
- }
- const HashTable* table = classInfo()->propHashTable; // get the right hashtable
- const HashEntry* entry = Lookup::findEntry(table, propertyName);
- if (entry) {
- if (entry->attr & Function)
- return lookupOrCreateFunction<KJS::HTMLElementFunction>(exec, propertyName, this, entry->value, entry->params, entry->attr);
- return getValueProperty(exec, entry->value);
- }
+ const HashTable* table = classInfo()->propHashTable; // get the right hashtable
+ const HashEntry* entry = Lookup::findEntry(table, propertyName);
+ if (entry) {
+ if (entry->attr & Function)
+ return lookupOrCreateFunction<KJS::HTMLElementFunction>(exec, propertyName, this, entry->value, entry->params, entry->attr);
+ return getValueProperty(exec, entry->value);
+ }
- // Base HTMLElement stuff or parent class forward, as usual
- return DOMObjectLookupGet<KJS::HTMLElementFunction, KJS::HTMLElement, DOMElement>(exec, propertyName, &HTMLElementTable, this);
+ // Base HTMLElement stuff or parent class forward, as usual
+ return DOMObjectLookupGet<KJS::HTMLElementFunction, KJS::HTMLElement, DOMElement>(exec, propertyName, &HTMLElementTable, this);
}
bool KJS::HTMLElement::implementsCall() const
{
HTMLElementImpl *element = static_cast<HTMLElementImpl *>(impl());
- switch (element->id()) {
- case ID_EMBED:
- case ID_OBJECT:
- case ID_APPLET: {
- DocumentImpl* doc = element->getDocument();
- KJSProxy *proxy = KJSProxy::proxy(doc->part());
- ExecState *exec = proxy->interpreter()->globalExec();
- Value runtimeObject = getRuntimeObject(exec,element);
- if (!runtimeObject.isNull()) {
- ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject.imp());
- return imp->implementsCall ();
- }
- }
- break;
- default:
- break;
+ if (element->hasTagName(HTMLNames::embed()) ||
+ element->hasTagName(HTMLNames::object()) ||
+ element->hasTagName(HTMLNames::applet())) {
+ DocumentImpl* doc = element->getDocument();
+ KJSProxy *proxy = KJSProxy::proxy(doc->part());
+ ExecState *exec = proxy->interpreter()->globalExec();
+ Value runtimeObject = getRuntimeObject(exec,element);
+ if (!runtimeObject.isNull()) {
+ ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject.imp());
+ return imp->implementsCall ();
+ }
}
return false;
}
@@ -1310,827 +1375,916 @@
Value KJS::HTMLElement::call(ExecState *exec, Object &thisObj, const List&args)
{
HTMLElementImpl *element = static_cast<HTMLElementImpl *>(impl());
- switch (element->id()) {
- case ID_EMBED:
- case ID_OBJECT:
- case ID_APPLET: {
- Value runtimeObject = getRuntimeObject(exec,element);
- if (!runtimeObject.isNull()) {
- ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject.imp());
- return imp->call (exec, thisObj, args);
- }
- }
- break;
- default:
- break;
+ if (element->hasTagName(HTMLNames::embed()) ||
+ element->hasTagName(HTMLNames::object()) ||
+ element->hasTagName(HTMLNames::applet())) {
+ Value runtimeObject = getRuntimeObject(exec,element);
+ if (!runtimeObject.isNull()) {
+ ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject.imp());
+ return imp->call (exec, thisObj, args);
+ }
}
return Undefined();
}
-static Value getInputSelectionStart(HTMLInputElementImpl &input)
+Value HTMLElement::htmlGetter(ExecState* exec, int token) const
{
- if (input.canHaveSelection()) {
- return Number(input.selectionStart());
- }
- return Undefined();
+ HTMLHtmlElementImpl& html = *static_cast<HTMLHtmlElementImpl*>(impl());
+ if (token == HtmlVersion)
+ return String(html.version());
+ return Undefined();
}
-static Value getInputSelectionEnd(HTMLInputElementImpl &input)
+Value HTMLElement::headGetter(ExecState* exec, int token) const
{
- if (input.canHaveSelection()) {
- return Number(input.selectionEnd());
- }
- return Undefined();
+ HTMLHeadElementImpl &head = *static_cast<HTMLHeadElementImpl*>(impl());
+ if (token == HeadProfile)
+ return String(head.profile());
+ return Undefined();
}
-Value KJS::HTMLElement::getValueProperty(ExecState *exec, int token) const
+Value HTMLElement::linkGetter(ExecState* exec, int token) const
{
- HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
- switch (element.id()) {
- case ID_HTML: {
- HTMLHtmlElementImpl &html = static_cast<HTMLHtmlElementImpl &>(element);
- if (token == HtmlVersion) return String(html.version());
- }
- break;
- case ID_HEAD: {
- HTMLHeadElementImpl &head = static_cast<HTMLHeadElementImpl &>(element);
- if (token == HeadProfile) return String(head.profile());
- }
- break;
- case ID_LINK: {
- HTMLLinkElementImpl &link = static_cast<HTMLLinkElementImpl &>(element);
- switch (token) {
- case LinkDisabled: return Boolean(link.disabled());
- case LinkCharset: return String(link.charset());
- case LinkHref: return String(link.href());
- case LinkHrefLang: return String(link.hreflang());
- case LinkMedia: return String(link.media());
- case LinkRel: return String(link.rel());
- case LinkRev: return String(link.rev());
- case LinkTarget: return String(link.target());
- case LinkType: return String(link.type());
- case LinkSheet: return getDOMStyleSheet(exec, link.sheet());
- }
- }
- break;
- case ID_TITLE: {
- HTMLTitleElementImpl &title = static_cast<HTMLTitleElementImpl &>(element);
- switch (token) {
- case TitleText: return String(title.text());
- }
- }
- break;
- case ID_META: {
- HTMLMetaElementImpl &meta = static_cast<HTMLMetaElementImpl &>(element);
- switch (token) {
- case MetaContent: return String(meta.content());
- case MetaHttpEquiv: return String(meta.httpEquiv());
- case MetaName: return String(meta.name());
- case MetaScheme: return String(meta.scheme());
- }
- }
- break;
- case ID_BASE: {
- HTMLBaseElementImpl &base = static_cast<HTMLBaseElementImpl &>(element);
+ HTMLLinkElementImpl &link = *static_cast<HTMLLinkElementImpl*>(impl());
switch (token) {
- case BaseHref: return String(base.href());
- case BaseTarget: return String(base.target());
+ case LinkDisabled:
+ return Boolean(link.disabled());
+ case LinkCharset:
+ return String(link.charset());
+ case LinkHref:
+ return String(link.href());
+ case LinkHrefLang:
+ return String(link.hreflang());
+ case LinkMedia:
+ return String(link.media());
+ case LinkRel:
+ return String(link.rel());
+ case LinkRev:
+ return String(link.rev());
+ case LinkTarget:
+ return String(link.target());
+ case LinkType:
+ return String(link.type());
+ case LinkSheet:
+ return getDOMStyleSheet(exec, link.sheet());
}
- }
- break;
- case ID_ISINDEX: {
- HTMLIsIndexElementImpl &isindex = static_cast<HTMLIsIndexElementImpl &>(element);
- switch (token) {
- case IsIndexForm: return getDOMNode(exec, isindex.form()); // type HTMLFormElement
- case IsIndexPrompt: return String(isindex.prompt());
- }
- }
- break;
- case ID_STYLE: {
- HTMLStyleElementImpl &style = static_cast<HTMLStyleElementImpl &>(element);
- switch (token) {
- case StyleDisabled: return Boolean(style.disabled());
- case StyleMedia: return String(style.media());
- case StyleType: return String(style.type());
- case StyleSheet: return getDOMStyleSheet(exec, style.sheet());
- }
- }
- break;
- case ID_BODY: {
- HTMLBodyElementImpl &body = static_cast<HTMLBodyElementImpl &>(element);
- switch (token) {
- case BodyALink: return String(body.aLink());
- case BodyBackground: return String(body.background());
- case BodyBgColor: return String(body.bgColor());
- case BodyLink: return String(body.link());
- case BodyText: return String(body.text());
- case BodyVLink: return String(body.vLink());
- default:
- // Update the document's layout before we compute these attributes.
- DocumentImpl *doc = body.getDocument();
- if (doc)
- doc->updateLayoutIgnorePendingStylesheets();
- KHTMLView *view = doc ? doc->view() : 0;
- switch (token) {
- case BodyScrollLeft:
- return Number(view ? view->contentsX() : 0);
- case BodyScrollTop:
- return Number(view ? view->contentsY() : 0);
- case BodyScrollHeight: return Number(view ? view->contentsHeight() : 0);
- case BodyScrollWidth: return Number(view ? view->contentsWidth() : 0);
- }
- }
- }
- break;
+ return Undefined();
+}
- case ID_FORM: {
- HTMLFormElementImpl &form = static_cast<HTMLFormElementImpl &>(element);
- switch (token) {
- case FormElements: return getHTMLCollection(exec, form.elements().get());
- case FormLength: return Number(form.length());
- case FormName: return String(form.name());
- case FormAcceptCharset: return String(form.acceptCharset());
- case FormAction: return String(form.action());
- case FormEncType: return String(form.enctype());
- case FormMethod: return String(form.method());
- case FormTarget: return String(form.target());
- }
- }
- break;
- case ID_SELECT: {
- HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
- switch (token) {
- case SelectType: return String(select.type());
- case SelectSelectedIndex: return Number(select.selectedIndex());
- case SelectValue: return String(select.value());
- case SelectLength: return Number(select.length());
- case SelectForm: return getDOMNode(exec, select.form()); // type HTMLFormElement
- case SelectOptions: return getSelectHTMLCollection(exec, select.optionsHTMLCollection().get(), &select); // type HTMLCollection
- case SelectDisabled: return Boolean(select.disabled());
- case SelectMultiple: return Boolean(select.multiple());
- case SelectName: return String(select.name());
- case SelectSize: return Number(select.size());
- case SelectTabIndex: return Number(select.tabIndex());
- }
- }
- break;
- case ID_OPTGROUP: {
- HTMLOptGroupElementImpl &optgroup = static_cast<HTMLOptGroupElementImpl &>(element);
- switch (token) {
- case OptGroupDisabled: return Boolean(optgroup.disabled());
- case OptGroupLabel: return String(optgroup.label());
- }
- }
- break;
- case ID_OPTION: {
- HTMLOptionElementImpl &option = static_cast<HTMLOptionElementImpl &>(element);
- switch (token) {
- case OptionForm: return getDOMNode(exec,option.form()); // type HTMLFormElement
- case OptionDefaultSelected: return Boolean(option.defaultSelected());
- case OptionText: return String(option.text());
- case OptionIndex: return Number(option.index());
- case OptionDisabled: return Boolean(option.disabled());
- case OptionLabel: return String(option.label());
- case OptionSelected: return Boolean(option.selected());
- case OptionValue: return String(option.value());
- }
- }
- break;
- case ID_INPUT: {
- HTMLInputElementImpl &input = static_cast<HTMLInputElementImpl &>(element);
- switch (token) {
- case InputDefaultValue: return String(input.defaultValue());
- case InputDefaultChecked: return Boolean(input.defaultChecked());
- case InputForm: return getDOMNode(exec,input.form()); // type HTMLFormElement
- case InputAccept: return String(input.accept());
- case InputAccessKey: return String(input.accessKey());
- case InputAlign: return String(input.align());
- case InputAlt: return String(input.alt());
- case InputChecked: return Boolean(input.checked());
- case InputDisabled: return Boolean(input.disabled());
- case InputMaxLength: return Number(input.maxLength());
- case InputName: return String(input.name());
- case InputReadOnly: return Boolean(input.readOnly());
- case InputSelectionStart: return getInputSelectionStart(input);
- case InputSelectionEnd: return getInputSelectionEnd(input);
- case InputSize: return String(input.sizeDOM());
- case InputSrc: return String(input.src());
- case InputTabIndex: return Number(input.tabIndex());
- case InputType: return String(input.type());
- case InputUseMap: return String(input.useMap());
- case InputValue: return String(input.value());
- }
- }
- break;
- case ID_TEXTAREA: {
- HTMLTextAreaElementImpl &textarea = static_cast<HTMLTextAreaElementImpl &>(element);
- switch (token) {
- case TextAreaDefaultValue: return String(textarea.defaultValue());
- case TextAreaForm: return getDOMNode(exec,textarea.form()); // type HTMLFormElement
- case TextAreaAccessKey: return String(textarea.accessKey());
- case TextAreaCols: return Number(textarea.cols());
- case TextAreaDisabled: return Boolean(textarea.disabled());
- case TextAreaName: return String(textarea.name());
- case TextAreaReadOnly: return Boolean(textarea.readOnly());
- case TextAreaRows: return Number(textarea.rows());
- case TextAreaSelectionStart: return Number(textarea.selectionStart());
- case TextAreaSelectionEnd: return Number(textarea.selectionEnd());
- case TextAreaTabIndex: return Number(textarea.tabIndex());
- case TextAreaType: return String(textarea.type());
- case TextAreaValue: return String(textarea.value());
- }
- }
- break;
- case ID_BUTTON: {
- HTMLButtonElementImpl &button = static_cast<HTMLButtonElementImpl &>(element);
- switch (token) {
- case ButtonForm: return getDOMNode(exec,button.form()); // type HTMLFormElement
- case ButtonAccessKey: return String(button.accessKey());
- case ButtonDisabled: return Boolean(button.disabled());
- case ButtonName: return String(button.name());
- case ButtonTabIndex: return Number(button.tabIndex());
- case ButtonType: return String(button.type());
- case ButtonValue: return String(button.value());
- }
- }
- break;
- case ID_LABEL: {
- HTMLLabelElementImpl &label = static_cast<HTMLLabelElementImpl &>(element);
- switch (token) {
- case LabelForm: return getDOMNode(exec,label.form()); // type HTMLFormElement
- case LabelAccessKey: return String(label.accessKey());
- case LabelHtmlFor: return String(label.htmlFor());
- }
- }
- break;
- case ID_FIELDSET: {
- HTMLFieldSetElementImpl &fieldSet = static_cast<HTMLFieldSetElementImpl &>(element);
- switch (token) {
- case FieldSetForm: return getDOMNode(exec,fieldSet.form()); // type HTMLFormElement
- }
- }
- break;
- case ID_LEGEND: {
- HTMLLegendElementImpl &legend = static_cast<HTMLLegendElementImpl &>(element);
- switch (token) {
- case LegendForm: return getDOMNode(exec,legend.form()); // type HTMLFormElement
- case LegendAccessKey: return String(legend.accessKey());
- case LegendAlign: return String(legend.align());
- }
- }
- break;
- case ID_UL: {
- HTMLUListElementImpl &uList = static_cast<HTMLUListElementImpl &>(element);
- switch (token) {
- case UListCompact: return Boolean(uList.compact());
- case UListType: return String(uList.type());
- }
- }
- break;
- case ID_OL: {
- HTMLOListElementImpl &oList = static_cast<HTMLOListElementImpl &>(element);
- switch (token) {
- case OListCompact: return Boolean(oList.compact());
- case OListStart: return Number(oList.start());
- case OListType: return String(oList.type());
- }
- }
- break;
- case ID_DL: {
- HTMLDListElementImpl &dList = static_cast<HTMLDListElementImpl &>(element);
+Value HTMLElement::titleGetter(ExecState* exec, int token) const
+{
+ HTMLTitleElementImpl& title = *static_cast<HTMLTitleElementImpl*>(impl());
+ if (token == TitleText)
+ return String(title.text());
+ return Undefined();
+}
+
+Value HTMLElement::metaGetter(ExecState* exec, int token) const
+{
+ HTMLMetaElementImpl& meta = *static_cast<HTMLMetaElementImpl*>(impl());
switch (token) {
- case DListCompact: return Boolean(dList.compact());
+ case MetaContent: return String(meta.content());
+ case MetaHttpEquiv: return String(meta.httpEquiv());
+ case MetaName: return String(meta.name());
+ case MetaScheme: return String(meta.scheme());
}
- }
- break;
- case ID_DIR: {
- HTMLDirectoryElementImpl &directory = static_cast<HTMLDirectoryElementImpl &>(element);
+ return Undefined();
+}
+
+Value HTMLElement::baseGetter(ExecState* exec, int token) const
+{
+ HTMLBaseElementImpl& base = *static_cast<HTMLBaseElementImpl*>(impl());
switch (token) {
- case DirectoryCompact: return Boolean(directory.compact());
+ case BaseHref: return String(base.href());
+ case BaseTarget: return String(base.target());
}
- }
- break;
- case ID_MENU: {
- HTMLMenuElementImpl &menu = static_cast<HTMLMenuElementImpl &>(element);
+ return Undefined();
+}
+
+Value HTMLElement::isIndexGetter(ExecState* exec, int token) const
+{
+ HTMLIsIndexElementImpl& isindex = *static_cast<HTMLIsIndexElementImpl*>(impl());
switch (token) {
- case MenuCompact: return Boolean(menu.compact());
+ case IsIndexForm: return getDOMNode(exec, isindex.form()); // type HTMLFormElement
+ case IsIndexPrompt: return String(isindex.prompt());
}
- }
- break;
- case ID_LI: {
- HTMLLIElementImpl &li = static_cast<HTMLLIElementImpl &>(element);
+ return Undefined();
+}
+
+Value HTMLElement::styleGetter(ExecState* exec, int token) const
+{
+ HTMLStyleElementImpl& style = *static_cast<HTMLStyleElementImpl*>(impl());
switch (token) {
- case LIType: return String(li.type());
- case LIValue: return Number(li.value());
+ case StyleDisabled: return Boolean(style.disabled());
+ case StyleMedia: return String(style.media());
+ case StyleType: return String(style.type());
+ case StyleSheet: return getDOMStyleSheet(exec, style.sheet());
}
- }
- break;
- case ID_DIV: {
- HTMLDivElementImpl &div = static_cast<HTMLDivElementImpl &>(element);
+ return Undefined();
+}
+
+Value HTMLElement::bodyGetter(ExecState* exec, int token) const
+{
+ HTMLBodyElementImpl& body = *static_cast<HTMLBodyElementImpl*>(impl());
switch (token) {
- case DivAlign: return String(div.align());
+ case BodyALink: return String(body.aLink());
+ case BodyBackground: return String(body.background());
+ case BodyBgColor: return String(body.bgColor());
+ case BodyLink: return String(body.link());
+ case BodyText: return String(body.text());
+ case BodyVLink: return String(body.vLink());
+ default: {
+ // Update the document's layout before we compute these attributes.
+ DocumentImpl *doc = body.getDocument();
+ if (doc)
+ doc->updateLayoutIgnorePendingStylesheets();
+ KHTMLView *view = doc ? doc->view() : 0;
+ switch (token) {
+ case BodyScrollLeft:
+ return Number(view ? view->contentsX() : 0);
+ case BodyScrollTop:
+ return Number(view ? view->contentsY() : 0);
+ case BodyScrollHeight:
+ return Number(view ? view->contentsHeight() : 0);
+ case BodyScrollWidth:
+ return Number(view ? view->contentsWidth() : 0);
+ }
+ }
}
- }
- break;
- case ID_P: {
- HTMLParagraphElementImpl ¶graph = static_cast<HTMLParagraphElementImpl &>(element);
+ return Undefined();
+}
+
+Value HTMLElement::formGetter(ExecState* exec, int token) const
+{
+ HTMLFormElementImpl& form = *static_cast<HTMLFormElementImpl*>(impl());
switch (token) {
- case ParagraphAlign: return String(paragraph.align());
+ case FormElements: return getHTMLCollection(exec, form.elements().get());
+ case FormLength: return Number(form.length());
+ case FormName: return String(form.name());
+ case FormAcceptCharset: return String(form.acceptCharset());
+ case FormAction: return String(form.action());
+ case FormEncType: return String(form.enctype());
+ case FormMethod: return String(form.method());
+ case FormTarget: return String(form.target());
}
- }
- break;
- case ID_H1:
- case ID_H2:
- case ID_H3:
- case ID_H4:
- case ID_H5:
- case ID_H6: {
- HTMLHeadingElementImpl &heading = static_cast<HTMLHeadingElementImpl &>(element);
+ return Undefined();
+}
+
+Value HTMLElement::selectGetter(ExecState* exec, int token) const
+{
+ HTMLSelectElementImpl& select = *static_cast<HTMLSelectElementImpl*>(impl());
switch (token) {
- case HeadingAlign: return String(heading.align());
+ case SelectType: return String(select.type());
+ case SelectSelectedIndex: return Number(select.selectedIndex());
+ case SelectValue: return String(select.value());
+ case SelectLength: return Number(select.length());
+ case SelectForm: return getDOMNode(exec, select.form()); // type HTMLFormElement
+ case SelectOptions: return getSelectHTMLCollection(exec, select.optionsHTMLCollection().get(), &select); // type HTMLCollection
+ case SelectDisabled: return Boolean(select.disabled());
+ case SelectMultiple: return Boolean(select.multiple());
+ case SelectName: return String(select.name());
+ case SelectSize: return Number(select.size());
+ case SelectTabIndex: return Number(select.tabIndex());
}
- }
- break;
- case ID_BLOCKQUOTE: {
- HTMLBlockquoteElementImpl &blockquote = static_cast<HTMLBlockquoteElementImpl &>(element);
+ return Undefined();
+}
+
+Value HTMLElement::optGroupGetter(ExecState* exec, int token) const
+{
+ HTMLOptGroupElementImpl& optgroup = *static_cast<HTMLOptGroupElementImpl*>(impl());
switch (token) {
- case BlockQuoteCite: return String(blockquote.cite());
+ case OptGroupDisabled: return Boolean(optgroup.disabled());
+ case OptGroupLabel: return String(optgroup.label());
}
- }
- case ID_Q: {
- HTMLQuoteElementImpl "e = static_cast<HTMLQuoteElementImpl &>(element);
+ return Undefined();
+}
+
+Value HTMLElement::optionGetter(ExecState* exec, int token) const
+{
+ HTMLOptionElementImpl& option = *static_cast<HTMLOptionElementImpl*>(impl());
switch (token) {
- case QuoteCite: return String(quote.cite());
+ case OptionForm: return getDOMNode(exec,option.form()); // type HTMLFormElement
+ case OptionDefaultSelected: return Boolean(option.defaultSelected());
+ case OptionText: return String(option.text());
+ case OptionIndex: return Number(option.index());
+ case OptionDisabled: return Boolean(option.disabled());
+ case OptionLabel: return String(option.label());
+ case OptionSelected: return Boolean(option.selected());
+ case OptionValue: return String(option.value());
}
- }
- case ID_PRE: {
- HTMLPreElementImpl &pre = static_cast<HTMLPreElementImpl &>(element);
+ return Undefined();
+}
+
+static Value getInputSelectionStart(HTMLInputElementImpl &input)
+{
+ if (input.canHaveSelection())
+ return Number(input.selectionStart());
+ return Undefined();
+}
+
+static Value getInputSelectionEnd(HTMLInputElementImpl &input)
+{
+ if (input.canHaveSelection())
+ return Number(input.selectionEnd());
+ return Undefined();
+}
+
+Value HTMLElement::inputGetter(ExecState* exec, int token) const
+{
+ HTMLInputElementImpl& input = *static_cast<HTMLInputElementImpl*>(impl());
switch (token) {
- case PreWidth: return Number(pre.width());
+ case InputDefaultValue: return String(input.defaultValue());
+ case InputDefaultChecked: return Boolean(input.defaultChecked());
+ case InputForm: return getDOMNode(exec,input.form()); // type HTMLFormElement
+ case InputAccept: return String(input.accept());
+ case InputAccessKey: return String(input.accessKey());
+ case InputAlign: return String(input.align());
+ case InputAlt: return String(input.alt());
+ case InputChecked: return Boolean(input.checked());
+ case InputDisabled: return Boolean(input.disabled());
+ case InputMaxLength: return Number(input.maxLength());
+ case InputName: return String(input.name());
+ case InputReadOnly: return Boolean(input.readOnly());
+ case InputSelectionStart: return getInputSelectionStart(input);
+ case InputSelectionEnd: return getInputSelectionEnd(input);
+ case InputSize: return String(input.sizeDOM());
+ case InputSrc: return String(input.src());
+ case InputTabIndex: return Number(input.tabIndex());
+ case InputType: return String(input.type());
+ case InputUseMap: return String(input.useMap());
+ case InputValue: return String(input.value());
}
- }
- break;
- case ID_BR: {
- HTMLBRElementImpl &br = static_cast<HTMLBRElementImpl &>(element);
+ return Undefined();
+}
+
+Value HTMLElement::textAreaGetter(ExecState* exec, int token) const
+{
+ HTMLTextAreaElementImpl& textarea = *static_cast<HTMLTextAreaElementImpl*>(impl());
switch (token) {
- case BRClear: return String(br.clear());
- }
- }
- break;
- case ID_BASEFONT: {
- HTMLBaseFontElementImpl &baseFont = static_cast<HTMLBaseFontElementImpl &>(element);
- switch (token) {
- case BaseFontColor: return String(baseFont.color());
- case BaseFontFace: return String(baseFont.face());
- case BaseFontSize: return String(baseFont.size());
- }
- }
- break;
- case ID_FONT: {
- HTMLFontElementImpl &font = static_cast<HTMLFontElementImpl &>(element);
- switch (token) {
- case FontColor: return String(font.color());
- case FontFace: return String(font.face());
- case FontSize: return String(font.size());
+ case TextAreaDefaultValue: return String(textarea.defaultValue());
+ case TextAreaForm: return getDOMNode(exec,textarea.form()); // type HTMLFormElement
+ case TextAreaAccessKey: return String(textarea.accessKey());
+ case TextAreaCols: return Number(textarea.cols());
+ case TextAreaDisabled: return Boolean(textarea.disabled());
+ case TextAreaName: return String(textarea.name());
+ case TextAreaReadOnly: return Boolean(textarea.readOnly());
+ case TextAreaRows: return Number(textarea.rows());
+ case TextAreaSelectionStart: return Number(textarea.selectionStart());
+ case TextAreaSelectionEnd: return Number(textarea.selectionEnd());
+ case TextAreaTabIndex: return Number(textarea.tabIndex());
+ case TextAreaType: return String(textarea.type());
+ case TextAreaValue: return String(textarea.value());
}
- }
- break;
- case ID_HR: {
- HTMLHRElementImpl &hr = static_cast<HTMLHRElementImpl &>(element);
- switch (token) {
- case HRAlign: return String(hr.align());
- case HRNoShade: return Boolean(hr.noShade());
- case HRSize: return String(hr.size());
- case HRWidth: return String(hr.width());
- }
- }
- break;
- case ID_INS:
- case ID_DEL: {
- HTMLModElementImpl &mod = static_cast<HTMLModElementImpl &>(element);
+ return Undefined();
+}
+
+Value HTMLElement::buttonGetter(ExecState* exec, int token) const
+{
+ HTMLButtonElementImpl& button = *static_cast<HTMLButtonElementImpl*>(impl());
switch (token) {
- case ModCite: return String(mod.cite());
- case ModDateTime: return String(mod.dateTime());
- }
- }
- break;
- case ID_A: {
- HTMLAnchorElementImpl &anchor = static_cast<HTMLAnchorElementImpl &>(element);
- switch (token) {
- case AnchorAccessKey: return String(anchor.accessKey());
- case AnchorCharset: return String(anchor.charset());
- case AnchorCoords: return String(anchor.coords());
- case AnchorHref: return String(anchor.href());
- case AnchorHrefLang: return String(anchor.hreflang());
- case AnchorHash: return String('#'+KURL(anchor.href().string()).ref());
- case AnchorHost: return String(KURL(anchor.href().string()).host());
- case AnchorHostname: {
- KURL url(anchor.href().string());
- kdDebug(6070) << "anchor::hostname uses:" <<url.url()<<endl;
- if (url.port()==0)
- return String(url.host());
- else
- return String(url.host() + ":" + QString::number(url.port()));
- }
- case AnchorPathName: return String(KURL(anchor.href().string()).path());
- case AnchorPort: return String(QString::number(KURL(anchor.href().string()).port()));
- case AnchorProtocol: return String(KURL(anchor.href().string()).protocol()+":");
- case AnchorSearch: return String(KURL(anchor.href().string()).query());
- case AnchorName: return String(anchor.name());
- case AnchorRel: return String(anchor.rel());
- case AnchorRev: return String(anchor.rev());
- case AnchorShape: return String(anchor.shape());
- case AnchorTabIndex: return Number(anchor.tabIndex());
- case AnchorTarget: return String(anchor.target());
- case AnchorType: return String(anchor.type());
- case AnchorText:
- if (DocumentImpl* doc = anchor.getDocument())
- doc->updateLayoutIgnorePendingStylesheets();
- return String(anchor.innerText());
- }
- }
- break;
- case ID_IMG: {
- HTMLImageElementImpl &image = static_cast<HTMLImageElementImpl &>(element);
- switch (token) {
- case ImageName: return String(image.name());
- case ImageAlign: return String(image.align());
- case ImageAlt: return String(image.alt());
- case ImageBorder: return Number(image.border());
- case ImageHeight: return Number(image.height(true));
- case ImageHspace: return Number(image.hspace());
- case ImageIsMap: return Boolean(image.isMap());
- case ImageLongDesc: return String(image.longDesc());
- case ImageSrc: return String(image.src());
- case ImageUseMap: return String(image.useMap());
- case ImageVspace: return Number(image.vspace());
- case ImageWidth: return Number(image.width(true));
- case ImageX: return Number(image.x());
- case ImageY: return Number(image.y());
- }
- }
- break;
- case ID_OBJECT: {
- HTMLObjectElementImpl &object = static_cast<HTMLObjectElementImpl &>(element);
- switch (token) {
- case ObjectForm: return getDOMNode(exec,object.form()); // type HTMLFormElement
- case ObjectCode: return String(object.code());
- case ObjectAlign: return String(object.align());
- case ObjectArchive: return String(object.archive());
- case ObjectBorder: return String(object.border());
- case ObjectCodeBase: return String(object.codeBase());
- case ObjectCodeType: return String(object.codeType());
- case ObjectContentDocument: return checkNodeSecurity(exec,object.contentDocument()) ?
- getDOMNode(exec, object.contentDocument()) : Undefined();
- case ObjectData: return String(object.data());
- case ObjectDeclare: return Boolean(object.declare());
- case ObjectHeight: return String(object.height());
- case ObjectHspace: return String(object.hspace());
- case ObjectName: return String(object.name());
- case ObjectStandby: return String(object.standby());
- case ObjectTabIndex: return Number(object.tabIndex());
- case ObjectType: return String(object.type());
- case ObjectUseMap: return String(object.useMap());
- case ObjectVspace: return String(object.vspace());
- case ObjectWidth: return String(object.width());
- }
- }
- break;
- case ID_PARAM: {
- HTMLParamElementImpl ¶m = static_cast<HTMLParamElementImpl &>(element);
- switch (token) {
- case ParamName: return String(param.name());
- case ParamType: return String(param.type());
- case ParamValue: return String(param.value());
- case ParamValueType: return String(param.valueType());
- }
- }
- break;
- case ID_APPLET: {
- HTMLAppletElementImpl &applet = static_cast<HTMLAppletElementImpl &>(element);
- switch (token) {
- case AppletAlign: return String(applet.align());
- case AppletAlt: return String(applet.alt());
- case AppletArchive: return String(applet.archive());
- case AppletCode: return String(applet.code());
- case AppletCodeBase: return String(applet.codeBase());
- case AppletHeight: return String(applet.height());
- case AppletHspace: return String(applet.hspace());
- case AppletName: return String(applet.name());
- case AppletObject: return String(applet.object());
- case AppletVspace: return String(applet.vspace());
- case AppletWidth: return String(applet.width());
+ case ButtonForm: return getDOMNode(exec,button.form()); // type HTMLFormElement
+ case ButtonAccessKey: return String(button.accessKey());
+ case ButtonDisabled: return Boolean(button.disabled());
+ case ButtonName: return String(button.name());
+ case ButtonTabIndex: return Number(button.tabIndex());
+ case ButtonType: return String(button.type());
+ case ButtonValue: return String(button.value());
}
- }
- break;
- case ID_MAP: {
- HTMLMapElementImpl &map = static_cast<HTMLMapElementImpl &>(element);
+ return Undefined();
+}
+
+Value HTMLElement::labelGetter(ExecState* exec, int token) const
+{
+ HTMLLabelElementImpl& label = *static_cast<HTMLLabelElementImpl*>(impl());
switch (token) {
- case MapAreas: return getHTMLCollection(exec, map.areas().get()); // type HTMLCollection
- case MapName: return String(map.name());
- }
- }
- break;
- case ID_AREA: {
- HTMLAreaElementImpl &area = static_cast<HTMLAreaElementImpl &>(element);
- switch (token) {
- case AreaAccessKey: return String(area.accessKey());
- case AreaAlt: return String(area.alt());
- case AreaCoords: return String(area.coords());
- case AreaHref: return String(area.href());
- case AreaHash: return String('#'+KURL(area.href().string()).ref());
- case AreaHost: return String(KURL(area.href().string()).host());
- case AreaHostName: {
- KURL url(area.href().string());
- kdDebug(6070) << "link::hostname uses:" <<url.url()<<endl;
- if (url.port()==0)
- return String(url.host());
- else
- return String(url.host() + ":" + QString::number(url.port()));
- }
- case AreaPathName: return String(KURL(area.href().string()).path());
- case AreaPort: return String(QString::number(KURL(area.href().string()).port()));
- case AreaProtocol: return String(KURL(area.href().string()).protocol()+":");
- case AreaSearch: return String(KURL(area.href().string()).query());
- case AreaNoHref: return Boolean(area.noHref());
- case AreaShape: return String(area.shape());
- case AreaTabIndex: return Number(area.tabIndex());
- case AreaTarget: return String(area.target());
- }
- }
- break;
- case ID_SCRIPT: {
- HTMLScriptElementImpl &script = static_cast<HTMLScriptElementImpl &>(element);
- switch (token) {
- case ScriptText: return String(script.text());
- case ScriptHtmlFor: return String(script.htmlFor());
- case ScriptEvent: return String(script.event());
- case ScriptCharset: return String(script.charset());
- case ScriptDefer: return Boolean(script.defer());
- case ScriptSrc: return String(script.src());
- case ScriptType: return String(script.type());
- }
- }
- break;
- case ID_TABLE: {
- HTMLTableElementImpl &table = static_cast<HTMLTableElementImpl &>(element);
- switch (token) {
- case TableCaption: return getDOMNode(exec,table.caption()); // type HTMLTableCaptionElement
- case TableTHead: return getDOMNode(exec,table.tHead()); // type HTMLTableSectionElement
- case TableTFoot: return getDOMNode(exec,table.tFoot()); // type HTMLTableSectionElement
- case TableRows: return getHTMLCollection(exec, table.rows().get()); // type HTMLCollection
- case TableTBodies: return getHTMLCollection(exec, table.tBodies().get()); // type HTMLCollection
- case TableAlign: return String(table.align());
- case TableBgColor: return String(table.bgColor());
- case TableBorder: return String(table.border());
- case TableCellPadding: return String(table.cellPadding());
- case TableCellSpacing: return String(table.cellSpacing());
- case TableFrame: return String(table.frame());
- case TableRules: return String(table.rules());
- case TableSummary: return String(table.summary());
- case TableWidth: return String(table.width());
+ case LabelForm: return getDOMNode(exec,label.form()); // type HTMLFormElement
+ case LabelAccessKey: return String(label.accessKey());
+ case LabelHtmlFor: return String(label.htmlFor());
}
- }
- break;
- case ID_CAPTION: {
- HTMLTableCaptionElementImpl &tableCaption = static_cast<HTMLTableCaptionElementImpl &>(element);
+ return Undefined();
+}
+
+Value HTMLElement::fieldSetGetter(ExecState* exec, int token) const
+{
+ HTMLFieldSetElementImpl& fieldSet = *static_cast<HTMLFieldSetElementImpl*>(impl());
+ if (token == FieldSetForm)
+ return getDOMNode(exec,fieldSet.form()); // type HTMLFormElement
+ return Undefined();
+}
+
+Value HTMLElement::legendGetter(ExecState* exec, int token) const
+{
+ HTMLLegendElementImpl& legend = *static_cast<HTMLLegendElementImpl*>(impl());
switch (token) {
- case TableCaptionAlign: return String(tableCaption.align());
- }
- }
- break;
- case ID_COL: {
- HTMLTableColElementImpl &tableCol = static_cast<HTMLTableColElementImpl &>(element);
- switch (token) {
- case TableColAlign: return String(tableCol.align());
- case TableColCh: return String(tableCol.ch());
- case TableColChOff: return String(tableCol.chOff());
- case TableColSpan: return Number(tableCol.span());
- case TableColVAlign: return String(tableCol.vAlign());
- case TableColWidth: return String(tableCol.width());
- }
- }
- break;
- case ID_THEAD:
- case ID_TBODY:
- case ID_TFOOT: {
- HTMLTableSectionElementImpl &tableSection = static_cast<HTMLTableSectionElementImpl &>(element);
- switch (token) {
- case TableSectionAlign: return String(tableSection.align());
- case TableSectionCh: return String(tableSection.ch());
- case TableSectionChOff: return String(tableSection.chOff());
- case TableSectionVAlign: return String(tableSection.vAlign());
- case TableSectionRows: return getHTMLCollection(exec, tableSection.rows().get()); // type HTMLCollection
- }
- }
- break;
- case ID_TR: {
- HTMLTableRowElementImpl &tableRow = static_cast<HTMLTableRowElementImpl &>(element);
- switch (token) {
- case TableRowRowIndex: return Number(tableRow.rowIndex());
- case TableRowSectionRowIndex: return Number(tableRow.sectionRowIndex());
- case TableRowCells: return getHTMLCollection(exec, tableRow.cells().get()); // type HTMLCollection
- case TableRowAlign: return String(tableRow.align());
- case TableRowBgColor: return String(tableRow.bgColor());
- case TableRowCh: return String(tableRow.ch());
- case TableRowChOff: return String(tableRow.chOff());
- case TableRowVAlign: return String(tableRow.vAlign());
- }
- }
- break;
- case ID_TH:
- case ID_TD: {
- HTMLTableCellElementImpl &tableCell = static_cast<HTMLTableCellElementImpl &>(element);
- switch (token) {
- case TableCellCellIndex: return Number(tableCell.cellIndex());
- case TableCellAbbr: return String(tableCell.abbr());
- case TableCellAlign: return String(tableCell.align());
- case TableCellAxis: return String(tableCell.axis());
- case TableCellBgColor: return String(tableCell.bgColor());
- case TableCellCh: return String(tableCell.ch());
- case TableCellChOff: return String(tableCell.chOff());
- case TableCellColSpan: return Number(tableCell.colSpan());
- case TableCellHeaders: return String(tableCell.headers());
- case TableCellHeight: return String(tableCell.height());
- case TableCellNoWrap: return Boolean(tableCell.noWrap());
- case TableCellRowSpan: return Number(tableCell.rowSpan());
- case TableCellScope: return String(tableCell.scope());
- case TableCellVAlign: return String(tableCell.vAlign());
- case TableCellWidth: return String(tableCell.width());
+ case LegendForm: return getDOMNode(exec,legend.form()); // type HTMLFormElement
+ case LegendAccessKey: return String(legend.accessKey());
+ case LegendAlign: return String(legend.align());
}
- }
- break;
- case ID_FRAMESET: {
- HTMLFrameSetElementImpl &frameSet = static_cast<HTMLFrameSetElementImpl &>(element);
+ return Undefined();
+}
+
+Value HTMLElement::uListGetter(ExecState* exec, int token) const
+{
+ HTMLUListElementImpl& uList = *static_cast<HTMLUListElementImpl*>(impl());
switch (token) {
- case FrameSetCols: return String(frameSet.cols());
- case FrameSetRows: return String(frameSet.rows());
- }
- }
- break;
- case ID_FRAME: {
- HTMLFrameElementImpl &frameElement = static_cast<HTMLFrameElementImpl &>(element);
- switch (token) {
- case FrameContentDocument: return checkNodeSecurity(exec,frameElement.contentDocument()) ?
- getDOMNode(exec, frameElement.contentDocument()) : Undefined();
- case FrameContentWindow: return checkNodeSecurity(exec,frameElement.contentDocument())
- ? Window::retrieve(frameElement.contentPart())
- : Undefined();
- case FrameFrameBorder: return String(frameElement.frameBorder());
- case FrameLongDesc: return String(frameElement.longDesc());
- case FrameMarginHeight: return String(frameElement.marginHeight());
- case FrameMarginWidth: return String(frameElement.marginWidth());
- case FrameName: return String(frameElement.name());
- case FrameNoResize: return Boolean(frameElement.noResize());
- case FrameScrolling: return String(frameElement.scrolling());
- case FrameSrc:
- case FrameLocation: return String(frameElement.src());
- }
- }
- break;
- case ID_IFRAME: {
- HTMLIFrameElementImpl &iFrame = static_cast<HTMLIFrameElementImpl &>(element);
- switch (token) {
- case IFrameAlign: return String(iFrame.align());
- // ### security check ?
- case IFrameDocument: // non-standard, mapped to contentDocument
- case IFrameContentDocument: return checkNodeSecurity(exec,iFrame.contentDocument()) ?
- getDOMNode(exec, iFrame.contentDocument()) : Undefined();
- case IFrameContentWindow: return checkNodeSecurity(exec,iFrame.contentDocument())
- ? Window::retrieve(iFrame.contentPart())
- : Undefined();
- case IFrameFrameBorder: return String(iFrame.frameBorder());
- case IFrameHeight: return String(iFrame.height());
- case IFrameLongDesc: return String(iFrame.longDesc());
- case IFrameMarginHeight: return String(iFrame.marginHeight());
- case IFrameMarginWidth: return String(iFrame.marginWidth());
- case IFrameName: return String(iFrame.name());
- case IFrameScrolling: return String(iFrame.scrolling());
- case IFrameSrc: return String(iFrame.src());
- case IFrameWidth: return String(iFrame.width());
+ case UListCompact: return Boolean(uList.compact());
+ case UListType: return String(uList.type());
}
- break;
- }
- } // xemacs (or arnt) could be a bit smarter when it comes to indenting switch()es ;)
- // its not arnt to blame - its the original Stroustrup style we like :) (Dirk)
-
- // generic properties
- switch (token) {
- case ElementId:
- // iht.com relies on this value being "" when no id is present. Other browsers do this as well.
- // So we use String() instead of String() here.
- return String(element.idDOM());
- case ElementTitle:
- return String(element.title());
- case ElementLang:
- return String(element.lang());
- case ElementDir:
- return String(element.dir());
- case ElementClassName:
- return String(element.className());
- case ElementInnerHTML:
- return String(element.innerHTML());
- case ElementInnerText:
- if (DocumentImpl* doc = impl()->getDocument())
- doc->updateLayoutIgnorePendingStylesheets();
- return String(element.innerText());
- case ElementOuterHTML:
- return String(element.outerHTML());
- case ElementOuterText:
- return String(element.outerText());
- case ElementDocument:
- return getDOMNode(exec,element.ownerDocument());
- case ElementChildren:
- return getHTMLCollection(exec, element.children().get());
- case ElementContentEditable:
- return String(element.contentEditable());
- case ElementIsContentEditable:
- return Boolean(element.isContentEditable());
- // ### what about style? or is this used instead for DOM2 stylesheets?
- }
- kdWarning() << "HTMLElement::getValueProperty unhandled token " << token << endl;
- return Undefined();
+ return Undefined();
}
-bool KJS::HTMLElement::hasOwnProperty(ExecState *exec, const Identifier &propertyName) const
+Value HTMLElement::oListGetter(ExecState* exec, int token) const
{
-#ifdef KJS_VERBOSE
- //kdDebug(6070) << "HTMLElement::hasProperty " << propertyName.qstring() << endl;
-#endif
- HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
- // First look at dynamic properties - keep this in sync with tryGet
- switch (element.id()) {
- case ID_FORM: {
- HTMLFormElementImpl &form = static_cast<HTMLFormElementImpl &>(element);
- // Check if we're retrieving an element (by index or by name)
- bool ok;
- uint u = propertyName.toULong(&ok);
- if (ok && form.elements()->item(u))
- return true;
- if (form.elements()->namedItem(propertyName.string()))
- return true;
- break;
- }
- case ID_SELECT: {
- HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
- bool ok;
- uint u = propertyName.toULong(&ok);
- if (ok && select.optionsHTMLCollection()->item(u))
- return true;
- break;
- }
- case ID_INPUT: {
- HTMLInputElementImpl &input = static_cast<HTMLInputElementImpl &>(element);
- const HashTable* table = classInfo()->propHashTable;
- const HashEntry* entry = Lookup::findEntry(table, propertyName);
- if (entry) {
- switch(entry->value) {
- case InputSelectionStart:
- case InputSelectionEnd:
- case InputSetSelectionRange:
- return input.canHaveSelection();
- default:
- break;
- }
- }
- break;
+ HTMLOListElementImpl& oList = *static_cast<HTMLOListElementImpl*>(impl());
+ switch (token) {
+ case OListCompact: return Boolean(oList.compact());
+ case OListStart: return Number(oList.start());
+ case OListType: return String(oList.type());
}
- default:
- break;
- }
-
- return DOMElement::hasOwnProperty(exec, propertyName);
+ return Undefined();
}
-UString KJS::HTMLElement::toString(ExecState *exec) const
+Value HTMLElement::dListGetter(ExecState* exec, int token) const
{
- if (impl()->id() == ID_A)
- return UString(static_cast<const HTMLAnchorElementImpl *>(impl())->href());
- else
- return DOMElement::toString(exec);
+ HTMLDListElementImpl& dList = *static_cast<HTMLDListElementImpl*>(impl());
+ if (token == DListCompact)
+ return Boolean(dList.compact());
+ return Undefined();
}
-static HTMLFormElementImpl *getForm(HTMLElementImpl *element)
+Value HTMLElement::dirGetter(ExecState* exec, int token) const
{
- if (element->isGenericFormElement())
- return static_cast<HTMLGenericFormElementImpl *>(element)->form();
-
- switch (element->id()) {
- case ID_LABEL:
- return static_cast<HTMLLabelElementImpl *>(element)->form();
- case ID_OBJECT:
- return static_cast<HTMLObjectElementImpl *>(element)->form();
- }
-
- return 0;
+ HTMLDirectoryElementImpl& dir = *static_cast<HTMLDirectoryElementImpl*>(impl());
+ if (token == DirectoryCompact)
+ return Boolean(dir.compact());
+ return Undefined();
}
-void KJS::HTMLElement::pushEventHandlerScope(ExecState *exec, ScopeChain &scope) const
+Value HTMLElement::menuGetter(ExecState* exec, int token) const
{
- HTMLElementImpl *element = static_cast<HTMLElementImpl *>(impl());
+ HTMLMenuElementImpl& menu = *static_cast<HTMLMenuElementImpl*>(impl());
+ if (token == MenuCompact)
+ return Boolean(menu.compact());
+ return Undefined();
+}
- // The document is put on first, fall back to searching it only after the element and form.
- scope.push(static_cast<ObjectImp *>(getDOMNode(exec, element->ownerDocument())));
+Value HTMLElement::liGetter(ExecState* exec, int token) const
+{
+ HTMLLIElementImpl& li = *static_cast<HTMLLIElementImpl*>(impl());
+ switch (token) {
+ case LIType: return String(li.type());
+ case LIValue: return Number(li.value());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::divGetter(ExecState* exec, int token) const
+{
+ HTMLDivElementImpl& div = *static_cast<HTMLDivElementImpl*>(impl());
+ if (token == DivAlign)
+ return String(div.align());
+ return Undefined();
+}
+
+Value HTMLElement::paragraphGetter(ExecState* exec, int token) const
+{
+ HTMLParagraphElementImpl& p = *static_cast<HTMLParagraphElementImpl*>(impl());
+ if (token == ParagraphAlign)
+ return String(p.align());
+ return Undefined();
+}
+
+Value HTMLElement::headingGetter(ExecState* exec, int token) const
+{
+ HTMLHeadingElementImpl& h = *static_cast<HTMLHeadingElementImpl*>(impl());
+ if (token == HeadingAlign)
+ return String(h.align());
+ return Undefined();
+}
+
+Value HTMLElement::blockQuoteGetter(ExecState* exec, int token) const
+{
+ HTMLBlockquoteElementImpl& blockQuote = *static_cast<HTMLBlockquoteElementImpl*>(impl());
+ if (token == BlockQuoteCite)
+ return String(blockQuote.cite());
+ return Undefined();
+}
+
+Value HTMLElement::quoteGetter(ExecState* exec, int token) const
+{
+ HTMLQuoteElementImpl& quote = *static_cast<HTMLQuoteElementImpl*>(impl());
+ if (token == QuoteCite)
+ return String(quote.cite());
+ return Undefined();
+}
+
+Value HTMLElement::preGetter(ExecState* exec, int token) const
+{
+ // FIXME: Add support for 'wrap' when white-space: pre-wrap is implemented.
+ HTMLPreElementImpl& pre = *static_cast<HTMLPreElementImpl*>(impl());
+ if (token == PreWidth)
+ return Number(pre.width());
+ return Undefined();
+}
+
+Value HTMLElement::brGetter(ExecState* exec, int token) const
+{
+ HTMLBRElementImpl& br = *static_cast<HTMLBRElementImpl*>(impl());
+ if (token == BRClear)
+ return String(br.clear());
+ return Undefined();
+}
+
+Value HTMLElement::baseFontGetter(ExecState* exec, int token) const
+{
+ HTMLBaseFontElementImpl& baseFont = *static_cast<HTMLBaseFontElementImpl*>(impl());
+ switch (token) {
+ case BaseFontColor: return String(baseFont.color());
+ case BaseFontFace: return String(baseFont.face());
+ case BaseFontSize: return String(baseFont.size());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::fontGetter(ExecState* exec, int token) const
+{
+ HTMLFontElementImpl& font = *static_cast<HTMLFontElementImpl*>(impl());
+ switch (token) {
+ case FontColor: return String(font.color());
+ case FontFace: return String(font.face());
+ case FontSize: return String(font.size());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::hrGetter(ExecState* exec, int token) const
+{
+ HTMLHRElementImpl& hr = *static_cast<HTMLHRElementImpl*>(impl());
+ switch (token) {
+ case HRAlign: return String(hr.align());
+ case HRNoShade: return Boolean(hr.noShade());
+ case HRSize: return String(hr.size());
+ case HRWidth: return String(hr.width());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::modGetter(ExecState* exec, int token) const
+{
+ HTMLModElementImpl& mod = *static_cast<HTMLModElementImpl*>(impl());
+ switch (token) {
+ case ModCite: return String(mod.cite());
+ case ModDateTime: return String(mod.dateTime());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::anchorGetter(ExecState* exec, int token) const
+{
+ HTMLAnchorElementImpl& anchor = *static_cast<HTMLAnchorElementImpl*>(impl());
+ switch (token) {
+ case AnchorAccessKey: return String(anchor.accessKey());
+ case AnchorCharset: return String(anchor.charset());
+ case AnchorCoords: return String(anchor.coords());
+ case AnchorHref: return String(anchor.href());
+ case AnchorHrefLang: return String(anchor.hreflang());
+ case AnchorHash: return String('#'+KURL(anchor.href().string()).ref());
+ case AnchorHost: return String(KURL(anchor.href().string()).host());
+ case AnchorHostname: {
+ KURL url(anchor.href().string());
+ kdDebug(6070) << "anchor::hostname uses:" <<url.url()<<endl;
+ if (url.port()==0)
+ return String(url.host());
+ else
+ return String(url.host() + ":" + QString::number(url.port()));
+ }
+ case AnchorPathName: return String(KURL(anchor.href().string()).path());
+ case AnchorPort: return String(QString::number(KURL(anchor.href().string()).port()));
+ case AnchorProtocol: return String(KURL(anchor.href().string()).protocol()+":");
+ case AnchorSearch: return String(KURL(anchor.href().string()).query());
+ case AnchorName: return String(anchor.name());
+ case AnchorRel: return String(anchor.rel());
+ case AnchorRev: return String(anchor.rev());
+ case AnchorShape: return String(anchor.shape());
+ case AnchorTabIndex: return Number(anchor.tabIndex());
+ case AnchorTarget: return String(anchor.target());
+ case AnchorType: return String(anchor.type());
+ case AnchorText:
+ if (DocumentImpl* doc = anchor.getDocument())
+ doc->updateLayoutIgnorePendingStylesheets();
+ return String(anchor.innerText());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::imageGetter(ExecState* exec, int token) const
+{
+ HTMLImageElementImpl& image = *static_cast<HTMLImageElementImpl*>(impl());
+ switch (token) {
+ case ImageName: return String(image.name());
+ case ImageAlign: return String(image.align());
+ case ImageAlt: return String(image.alt());
+ case ImageBorder: return Number(image.border());
+ case ImageHeight: return Number(image.height(true));
+ case ImageHspace: return Number(image.hspace());
+ case ImageIsMap: return Boolean(image.isMap());
+ case ImageLongDesc: return String(image.longDesc());
+ case ImageSrc: return String(image.src());
+ case ImageUseMap: return String(image.useMap());
+ case ImageVspace: return Number(image.vspace());
+ case ImageWidth: return Number(image.width(true));
+ case ImageX: return Number(image.x());
+ case ImageY: return Number(image.y());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::objectGetter(ExecState* exec, int token) const
+{
+ HTMLObjectElementImpl& object = *static_cast<HTMLObjectElementImpl*>(impl());
+ switch (token) {
+ case ObjectForm: return getDOMNode(exec,object.form()); // type HTMLFormElement
+ case ObjectCode: return String(object.code());
+ case ObjectAlign: return String(object.align());
+ case ObjectArchive: return String(object.archive());
+ case ObjectBorder: return String(object.border());
+ case ObjectCodeBase: return String(object.codeBase());
+ case ObjectCodeType: return String(object.codeType());
+ case ObjectContentDocument: return checkNodeSecurity(exec,object.contentDocument()) ?
+ getDOMNode(exec, object.contentDocument()) : Undefined();
+ case ObjectData: return String(object.data());
+ case ObjectDeclare: return Boolean(object.declare());
+ case ObjectHeight: return String(object.height());
+ case ObjectHspace: return String(object.hspace());
+ case ObjectName: return String(object.name());
+ case ObjectStandby: return String(object.standby());
+ case ObjectTabIndex: return Number(object.tabIndex());
+ case ObjectType: return String(object.type());
+ case ObjectUseMap: return String(object.useMap());
+ case ObjectVspace: return String(object.vspace());
+ case ObjectWidth: return String(object.width());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::paramGetter(ExecState* exec, int token) const
+{
+ HTMLParamElementImpl& param = *static_cast<HTMLParamElementImpl*>(impl());
+ switch (token) {
+ case ParamName: return String(param.name());
+ case ParamType: return String(param.type());
+ case ParamValue: return String(param.value());
+ case ParamValueType: return String(param.valueType());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::appletGetter(ExecState* exec, int token) const
+{
+ HTMLAppletElementImpl& applet = *static_cast<HTMLAppletElementImpl*>(impl());
+ switch (token) {
+ case AppletAlign: return String(applet.align());
+ case AppletAlt: return String(applet.alt());
+ case AppletArchive: return String(applet.archive());
+ case AppletCode: return String(applet.code());
+ case AppletCodeBase: return String(applet.codeBase());
+ case AppletHeight: return String(applet.height());
+ case AppletHspace: return String(applet.hspace());
+ case AppletName: return String(applet.name());
+ case AppletObject: return String(applet.object());
+ case AppletVspace: return String(applet.vspace());
+ case AppletWidth: return String(applet.width());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::mapGetter(ExecState* exec, int token) const
+{
+ HTMLMapElementImpl& map = *static_cast<HTMLMapElementImpl*>(impl());
+ switch (token) {
+ case MapAreas: return getHTMLCollection(exec, map.areas().get()); // type HTMLCollection
+ case MapName: return String(map.name());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::areaGetter(ExecState* exec, int token) const
+{
+ HTMLAreaElementImpl& area = *static_cast<HTMLAreaElementImpl*>(impl());
+ switch (token) {
+ case AreaAccessKey: return String(area.accessKey());
+ case AreaAlt: return String(area.alt());
+ case AreaCoords: return String(area.coords());
+ case AreaHref: return String(area.href());
+ case AreaHash: return String('#'+KURL(area.href().string()).ref());
+ case AreaHost: return String(KURL(area.href().string()).host());
+ case AreaHostName: {
+ KURL url(area.href().string());
+ kdDebug(6070) << "link::hostname uses:" <<url.url()<<endl;
+ if (url.port()==0)
+ return String(url.host());
+ else
+ return String(url.host() + ":" + QString::number(url.port()));
+ }
+ case AreaPathName: return String(KURL(area.href().string()).path());
+ case AreaPort: return String(QString::number(KURL(area.href().string()).port()));
+ case AreaProtocol: return String(KURL(area.href().string()).protocol()+":");
+ case AreaSearch: return String(KURL(area.href().string()).query());
+ case AreaNoHref: return Boolean(area.noHref());
+ case AreaShape: return String(area.shape());
+ case AreaTabIndex: return Number(area.tabIndex());
+ case AreaTarget: return String(area.target());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::scriptGetter(ExecState* exec, int token) const
+{
+ HTMLScriptElementImpl& script = *static_cast<HTMLScriptElementImpl*>(impl());
+ switch (token) {
+ case ScriptText: return String(script.text());
+ case ScriptHtmlFor: return String(script.htmlFor());
+ case ScriptEvent: return String(script.event());
+ case ScriptCharset: return String(script.charset());
+ case ScriptDefer: return Boolean(script.defer());
+ case ScriptSrc: return String(script.src());
+ case ScriptType: return String(script.type());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::tableGetter(ExecState* exec, int token) const
+{
+ HTMLTableElementImpl& table = *static_cast<HTMLTableElementImpl*>(impl());
+ switch (token) {
+ case TableCaption: return getDOMNode(exec,table.caption()); // type HTMLTableCaptionElement
+ case TableTHead: return getDOMNode(exec,table.tHead()); // type HTMLTableSectionElement
+ case TableTFoot: return getDOMNode(exec,table.tFoot()); // type HTMLTableSectionElement
+ case TableRows: return getHTMLCollection(exec, table.rows().get()); // type HTMLCollection
+ case TableTBodies: return getHTMLCollection(exec, table.tBodies().get()); // type HTMLCollection
+ case TableAlign: return String(table.align());
+ case TableBgColor: return String(table.bgColor());
+ case TableBorder: return String(table.border());
+ case TableCellPadding: return String(table.cellPadding());
+ case TableCellSpacing: return String(table.cellSpacing());
+ case TableFrame: return String(table.frame());
+ case TableRules: return String(table.rules());
+ case TableSummary: return String(table.summary());
+ case TableWidth: return String(table.width());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::tableCaptionGetter(ExecState* exec, int token) const
+{
+ HTMLTableCaptionElementImpl& tableCaption = *static_cast<HTMLTableCaptionElementImpl*>(impl());
+ if (token == TableCaptionAlign)
+ return String(tableCaption.align());
+ return Undefined();
+}
+
+Value HTMLElement::tableColGetter(ExecState* exec, int token) const
+{
+ HTMLTableColElementImpl& tableCol = *static_cast<HTMLTableColElementImpl*>(impl());
+ switch (token) {
+ case TableColAlign: return String(tableCol.align());
+ case TableColCh: return String(tableCol.ch());
+ case TableColChOff: return String(tableCol.chOff());
+ case TableColSpan: return Number(tableCol.span());
+ case TableColVAlign: return String(tableCol.vAlign());
+ case TableColWidth: return String(tableCol.width());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::tableSectionGetter(ExecState* exec, int token) const
+{
+ HTMLTableSectionElementImpl& tableSection = *static_cast<HTMLTableSectionElementImpl*>(impl());
+ switch (token) {
+ case TableSectionAlign: return String(tableSection.align());
+ case TableSectionCh: return String(tableSection.ch());
+ case TableSectionChOff: return String(tableSection.chOff());
+ case TableSectionVAlign: return String(tableSection.vAlign());
+ case TableSectionRows: return getHTMLCollection(exec, tableSection.rows().get()); // type HTMLCollection
+ }
+ return Undefined();
+}
+
+Value HTMLElement::tableRowGetter(ExecState* exec, int token) const
+{
+ HTMLTableRowElementImpl& tableRow = *static_cast<HTMLTableRowElementImpl*>(impl());
+ switch (token) {
+ case TableRowRowIndex: return Number(tableRow.rowIndex());
+ case TableRowSectionRowIndex: return Number(tableRow.sectionRowIndex());
+ case TableRowCells: return getHTMLCollection(exec, tableRow.cells().get()); // type HTMLCollection
+ case TableRowAlign: return String(tableRow.align());
+ case TableRowBgColor: return String(tableRow.bgColor());
+ case TableRowCh: return String(tableRow.ch());
+ case TableRowChOff: return String(tableRow.chOff());
+ case TableRowVAlign: return String(tableRow.vAlign());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::tableCellGetter(ExecState* exec, int token) const
+{
+ HTMLTableCellElementImpl& tableCell = *static_cast<HTMLTableCellElementImpl*>(impl());
+ switch (token) {
+ case TableCellCellIndex: return Number(tableCell.cellIndex());
+ case TableCellAbbr: return String(tableCell.abbr());
+ case TableCellAlign: return String(tableCell.align());
+ case TableCellAxis: return String(tableCell.axis());
+ case TableCellBgColor: return String(tableCell.bgColor());
+ case TableCellCh: return String(tableCell.ch());
+ case TableCellChOff: return String(tableCell.chOff());
+ case TableCellColSpan: return Number(tableCell.colSpan());
+ case TableCellHeaders: return String(tableCell.headers());
+ case TableCellHeight: return String(tableCell.height());
+ case TableCellNoWrap: return Boolean(tableCell.noWrap());
+ case TableCellRowSpan: return Number(tableCell.rowSpan());
+ case TableCellScope: return String(tableCell.scope());
+ case TableCellVAlign: return String(tableCell.vAlign());
+ case TableCellWidth: return String(tableCell.width());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::frameSetGetter(ExecState* exec, int token) const
+{
+ HTMLFrameSetElementImpl& frameSet = *static_cast<HTMLFrameSetElementImpl*>(impl());
+ switch (token) {
+ case FrameSetCols: return String(frameSet.cols());
+ case FrameSetRows: return String(frameSet.rows());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::frameGetter(ExecState* exec, int token) const
+{
+ HTMLFrameElementImpl& frameElement = *static_cast<HTMLFrameElementImpl*>(impl());
+ switch (token) {
+ case FrameContentDocument: return checkNodeSecurity(exec,frameElement.contentDocument()) ?
+ getDOMNode(exec, frameElement.contentDocument()) : Undefined();
+ case FrameContentWindow: return checkNodeSecurity(exec,frameElement.contentDocument())
+ ? Window::retrieve(frameElement.contentPart())
+ : Undefined();
+ case FrameFrameBorder: return String(frameElement.frameBorder());
+ case FrameLongDesc: return String(frameElement.longDesc());
+ case FrameMarginHeight: return String(frameElement.marginHeight());
+ case FrameMarginWidth: return String(frameElement.marginWidth());
+ case FrameName: return String(frameElement.name());
+ case FrameNoResize: return Boolean(frameElement.noResize());
+ case FrameScrolling: return String(frameElement.scrolling());
+ case FrameSrc:
+ case FrameLocation: return String(frameElement.src());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::iFrameGetter(ExecState* exec, int token) const
+{
+ HTMLIFrameElementImpl& iFrame = *static_cast<HTMLIFrameElementImpl*>(impl());
+ switch (token) {
+ case IFrameAlign: return String(iFrame.align());
+ // ### security check ?
+ case IFrameDocument: // non-standard, mapped to contentDocument
+ case IFrameContentDocument: return checkNodeSecurity(exec,iFrame.contentDocument()) ?
+ getDOMNode(exec, iFrame.contentDocument()) : Undefined();
+ case IFrameContentWindow: return checkNodeSecurity(exec,iFrame.contentDocument())
+ ? Window::retrieve(iFrame.contentPart())
+ : Undefined();
+ case IFrameFrameBorder: return String(iFrame.frameBorder());
+ case IFrameHeight: return String(iFrame.height());
+ case IFrameLongDesc: return String(iFrame.longDesc());
+ case IFrameMarginHeight: return String(iFrame.marginHeight());
+ case IFrameMarginWidth: return String(iFrame.marginWidth());
+ case IFrameName: return String(iFrame.name());
+ case IFrameScrolling: return String(iFrame.scrolling());
+ case IFrameSrc: return String(iFrame.src());
+ case IFrameWidth: return String(iFrame.width());
+ }
+ return Undefined();
+}
+
+Value HTMLElement::marqueeGetter(ExecState* exec, int token) const
+{
+ // FIXME: Find out what WinIE exposes as properties and implement this.
+ return Undefined();
+}
+
+Value HTMLElement::getValueProperty(ExecState *exec, int token) const
+{
+ // Check our set of generic properties first.
+ HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
+ switch (token) {
+ case ElementId:
+ // iht.com relies on this value being "" when no id is present. Other browsers do this as well.
+ // So we use String() instead of String() here.
+ return String(element.id());
+ case ElementTitle:
+ return String(element.title());
+ case ElementLang:
+ return String(element.lang());
+ case ElementDir:
+ return String(element.dir());
+ case ElementClassName:
+ return String(element.className());
+ case ElementInnerHTML:
+ return String(element.innerHTML());
+ case ElementInnerText:
+ if (DocumentImpl* doc = impl()->getDocument())
+ doc->updateLayoutIgnorePendingStylesheets();
+ return String(element.innerText());
+ case ElementOuterHTML:
+ return String(element.outerHTML());
+ case ElementOuterText:
+ return String(element.outerText());
+ case ElementDocument:
+ return getDOMNode(exec,element.ownerDocument());
+ case ElementChildren:
+ return getHTMLCollection(exec, element.children().get());
+ case ElementContentEditable:
+ return String(element.contentEditable());
+ case ElementIsContentEditable:
+ return Boolean(element.isContentEditable());
+ }
+
+ // Now check the properties specific to our element type.
+ const Accessors* info = getSetInfo();
+ if (info && info->m_getter)
+ return (this->*(info->m_getter))(exec, token);
+ return Undefined();
+}
+
+bool KJS::HTMLElement::hasOwnProperty(ExecState *exec, const Identifier &propertyName) const
+{
+#ifdef KJS_VERBOSE
+ //kdDebug(6070) << "HTMLElement::hasProperty " << propertyName.qstring() << endl;
+#endif
+ HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
+ // First look at dynamic properties - keep this in sync with tryGet
+ if (element.hasLocalName(HTMLNames::form())) {
+ HTMLFormElementImpl &form = static_cast<HTMLFormElementImpl &>(element);
+ // Check if we're retrieving an element (by index or by name)
+ bool ok;
+ uint u = propertyName.toULong(&ok);
+ if (ok && form.elements()->item(u))
+ return true;
+ if (form.elements()->namedItem(propertyName.string()))
+ return true;
+ }
+ else if (element.hasLocalName(HTMLNames::select())) {
+ HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
+ bool ok;
+ uint u = propertyName.toULong(&ok);
+ if (ok && select.optionsHTMLCollection()->item(u))
+ return true;
+ }
+ else if (element.hasLocalName(HTMLNames::input())) {
+ HTMLInputElementImpl &input = static_cast<HTMLInputElementImpl &>(element);
+ const HashTable* table = classInfo()->propHashTable;
+ const HashEntry* entry = Lookup::findEntry(table, propertyName);
+ if (entry) {
+ switch(entry->value) {
+ case InputSelectionStart:
+ case InputSelectionEnd:
+ case InputSetSelectionRange:
+ return input.canHaveSelection();
+ default:
+ break;
+ }
+ }
+ }
+
+ return DOMElement::hasOwnProperty(exec, propertyName);
+}
+
+UString KJS::HTMLElement::toString(ExecState *exec) const
+{
+ if (impl()->hasTagName(HTMLNames::a()))
+ return UString(static_cast<const HTMLAnchorElementImpl *>(impl())->href());
+ else
+ return DOMElement::toString(exec);
+}
+
+static HTMLFormElementImpl *getForm(HTMLElementImpl *element)
+{
+ if (element->isGenericFormElement())
+ return static_cast<HTMLGenericFormElementImpl *>(element)->form();
+ if (element->hasTagName(HTMLNames::label()))
+ return static_cast<HTMLLabelElementImpl *>(element)->form();
+ if (element->hasTagName(HTMLNames::object()))
+ return static_cast<HTMLObjectElementImpl *>(element)->form();
+
+ return 0;
+}
+
+void KJS::HTMLElement::pushEventHandlerScope(ExecState *exec, ScopeChain &scope) const
+{
+ HTMLElementImpl *element = static_cast<HTMLElementImpl *>(impl());
+
+ // The document is put on first, fall back to searching it only after the element and form.
+ scope.push(static_cast<ObjectImp *>(getDOMNode(exec, element->ownerDocument())));
// The form is next, searched before the document, but after the element itself.
@@ -2142,7 +2296,7 @@
scope.push(static_cast<ObjectImp *>(getDOMNode(exec, form)));
else {
NodeImpl *form = element->parentNode();
- while (form && form->id() != ID_FORM)
+ while (form && !form->hasTagName(HTMLNames::form()))
form = form->parentNode();
if (form)
@@ -2162,188 +2316,173 @@
Value KJS::HTMLElementFunction::tryCall(ExecState *exec, Object &thisObj, const List &args)
{
- if (!thisObj.inherits(&KJS::HTMLElement::info)) {
- Object err = Error::create(exec,TypeError);
- exec->setException(err);
- return err;
- }
- kdDebug() << "KJS::HTMLElementFunction::tryCall " << endl;
- DOMExceptionTranslator exception(exec);
- HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(static_cast<HTMLElement *>(thisObj.imp())->impl());
-
- switch (element.id()) {
- case ID_FORM: {
- HTMLFormElementImpl &form = static_cast<HTMLFormElementImpl &>(element);
- if (id == KJS::HTMLElement::FormSubmit) {
- form.submit();
- return Undefined();
- }
- else if (id == KJS::HTMLElement::FormReset) {
- form.reset();
- return Undefined();
- }
+ if (!thisObj.inherits(&KJS::HTMLElement::info)) {
+ Object err = Error::create(exec,TypeError);
+ exec->setException(err);
+ return err;
}
- break;
- case ID_SELECT: {
- HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
- if (id == KJS::HTMLElement::SelectAdd) {
- select.add(toHTMLElement(args[0]), toHTMLElement(args[1]));
- return Undefined();
- }
- else if (id == KJS::HTMLElement::SelectRemove) {
- select.remove(int(args[0].toNumber(exec)));
- return Undefined();
- }
- else if (id == KJS::HTMLElement::SelectBlur) {
- select.blur();
- return Undefined();
- }
- else if (id == KJS::HTMLElement::SelectFocus) {
- select.focus();
- return Undefined();
- }
+ kdDebug() << "KJS::HTMLElementFunction::tryCall " << endl;
+ DOMExceptionTranslator exception(exec);
+ HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(static_cast<HTMLElement *>(thisObj.imp())->impl());
+
+ if (element.hasLocalName(HTMLNames::form())) {
+ HTMLFormElementImpl &form = static_cast<HTMLFormElementImpl &>(element);
+ if (id == KJS::HTMLElement::FormSubmit) {
+ form.submit();
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::FormReset) {
+ form.reset();
+ return Undefined();
+ }
}
- break;
- case ID_INPUT: {
- HTMLInputElementImpl &input = static_cast<HTMLInputElementImpl &>(element);
- if (id == KJS::HTMLElement::InputBlur) {
- input.blur();
- return Undefined();
- }
- else if (id == KJS::HTMLElement::InputFocus) {
- input.focus();
- return Undefined();
- }
- else if (id == KJS::HTMLElement::InputSelect) {
- input.select();
- return Undefined();
- }
- else if (id == KJS::HTMLElement::InputClick) {
- input.click();
- return Undefined();
- }
- else if (id == KJS::HTMLElement::InputSetSelectionRange) {
- input.setSelectionRange(args[0].toInt32(exec), args[1].toInt32(exec));
- return Undefined();
- }
+ else if (element.hasLocalName(HTMLNames::select())) {
+ HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
+ if (id == KJS::HTMLElement::SelectAdd) {
+ select.add(toHTMLElement(args[0]), toHTMLElement(args[1]));
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::SelectRemove) {
+ select.remove(int(args[0].toNumber(exec)));
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::SelectBlur) {
+ select.blur();
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::SelectFocus) {
+ select.focus();
+ return Undefined();
+ }
}
- break;
- case ID_LABEL: {
- HTMLLabelElementImpl &label = static_cast<HTMLLabelElementImpl &>(element);
-
- if (id == KJS::HTMLElement::LabelFocus) {
- label.focus();
- return Undefined();
- }
+ else if (element.hasLocalName(HTMLNames::input())) {
+ HTMLInputElementImpl &input = static_cast<HTMLInputElementImpl &>(element);
+ if (id == KJS::HTMLElement::InputBlur) {
+ input.blur();
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::InputFocus) {
+ input.focus();
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::InputSelect) {
+ input.select();
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::InputClick) {
+ input.click();
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::InputSetSelectionRange) {
+ input.setSelectionRange(args[0].toInt32(exec), args[1].toInt32(exec));
+ return Undefined();
+ }
}
- break;
- case ID_LEGEND: {
- HTMLLegendElementImpl &legend = static_cast<HTMLLegendElementImpl &>(element);
-
- if (id == KJS::HTMLElement::LegendFocus) {
- legend.focus();
- return Undefined();
- }
+ else if (element.hasLocalName(HTMLNames::button())) {
+ HTMLButtonElementImpl &button = static_cast<HTMLButtonElementImpl &>(element);
+ if (id == KJS::HTMLElement::ButtonBlur) {
+ button.blur();
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::ButtonFocus) {
+ button.focus();
+ return Undefined();
+ }
}
- break;
- case ID_BUTTON: {
- HTMLButtonElementImpl &button = static_cast<HTMLButtonElementImpl &>(element);
-
- if (id == KJS::HTMLElement::ButtonBlur) {
- button.blur();
- return Undefined();
- }
- else if (id == KJS::HTMLElement::ButtonFocus) {
- button.focus();
- return Undefined();
- }
+ else if (element.hasLocalName(HTMLNames::label())) {
+ HTMLLabelElementImpl &label = static_cast<HTMLLabelElementImpl &>(element);
+ if (id == KJS::HTMLElement::LabelFocus) {
+ label.focus();
+ return Undefined();
+ }
}
- break;
- case ID_TEXTAREA: {
- HTMLTextAreaElementImpl &textarea = static_cast<HTMLTextAreaElementImpl &>(element);
- if (id == KJS::HTMLElement::TextAreaBlur) {
- textarea.blur();
- return Undefined();
- }
- else if (id == KJS::HTMLElement::TextAreaFocus) {
- textarea.focus();
- return Undefined();
- }
- else if (id == KJS::HTMLElement::TextAreaSelect) {
- textarea.select();
- return Undefined();
- }
- else if (id == KJS::HTMLElement::TextAreaSetSelectionRange) {
- textarea.setSelectionRange(args[0].toInt32(exec), args[1].toInt32(exec));
- return Undefined();
- }
+ else if (element.hasLocalName(HTMLNames::legend())) {
+ HTMLLegendElementImpl &legend = static_cast<HTMLLegendElementImpl &>(element);
+ if (id == KJS::HTMLElement::LegendFocus) {
+ legend.focus();
+ return Undefined();
+ }
}
- break;
- case ID_A: {
- HTMLAnchorElementImpl &anchor = static_cast<HTMLAnchorElementImpl &>(element);
- if (id == KJS::HTMLElement::AnchorBlur) {
- anchor.blur();
- return Undefined();
- }
- else if (id == KJS::HTMLElement::AnchorFocus) {
- anchor.focus();
- return Undefined();
- }
- else if (id == KJS::HTMLElement::AnchorToString) {
- return String(thisObj.toString(exec));
- }
+ else if (element.hasLocalName(HTMLNames::textarea())) {
+ HTMLTextAreaElementImpl &textarea = static_cast<HTMLTextAreaElementImpl &>(element);
+ if (id == KJS::HTMLElement::TextAreaBlur) {
+ textarea.blur();
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::TextAreaFocus) {
+ textarea.focus();
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::TextAreaSelect) {
+ textarea.select();
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::TextAreaSetSelectionRange) {
+ textarea.setSelectionRange(args[0].toInt32(exec), args[1].toInt32(exec));
+ return Undefined();
+ }
}
- break;
- case ID_TABLE: {
- HTMLTableElementImpl &table = static_cast<HTMLTableElementImpl &>(element);
- if (id == KJS::HTMLElement::TableCreateTHead)
- return getDOMNode(exec,table.createTHead());
- else if (id == KJS::HTMLElement::TableDeleteTHead) {
- table.deleteTHead();
- return Undefined();
- }
- else if (id == KJS::HTMLElement::TableCreateTFoot)
- return getDOMNode(exec,table.createTFoot());
- else if (id == KJS::HTMLElement::TableDeleteTFoot) {
- table.deleteTFoot();
- return Undefined();
- }
- else if (id == KJS::HTMLElement::TableCreateCaption)
- return getDOMNode(exec,table.createCaption());
- else if (id == KJS::HTMLElement::TableDeleteCaption) {
- table.deleteCaption();
- return Undefined();
- }
- else if (id == KJS::HTMLElement::TableInsertRow)
- return getDOMNode(exec,table.insertRow(args[0].toInt32(exec), exception));
- else if (id == KJS::HTMLElement::TableDeleteRow) {
- table.deleteRow(args[0].toInt32(exec), exception);
- return Undefined();
- }
+ else if (element.hasLocalName(HTMLNames::a())) {
+ HTMLAnchorElementImpl &anchor = static_cast<HTMLAnchorElementImpl &>(element);
+ if (id == KJS::HTMLElement::AnchorBlur) {
+ anchor.blur();
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::AnchorFocus) {
+ anchor.focus();
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::AnchorToString)
+ return String(thisObj.toString(exec));
}
- break;
- case ID_THEAD:
- case ID_TBODY:
- case ID_TFOOT: {
- HTMLTableSectionElementImpl &tableSection = static_cast<HTMLTableSectionElementImpl &>(element);
- if (id == KJS::HTMLElement::TableSectionInsertRow)
- return getDOMNode(exec, tableSection.insertRow(args[0].toInt32(exec), exception));
- else if (id == KJS::HTMLElement::TableSectionDeleteRow) {
- tableSection.deleteRow(args[0].toInt32(exec), exception);
- return Undefined();
- }
+ else if (element.hasLocalName(HTMLNames::table())) {
+ HTMLTableElementImpl &table = static_cast<HTMLTableElementImpl &>(element);
+ if (id == KJS::HTMLElement::TableCreateTHead)
+ return getDOMNode(exec,table.createTHead());
+ else if (id == KJS::HTMLElement::TableDeleteTHead) {
+ table.deleteTHead();
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::TableCreateTFoot)
+ return getDOMNode(exec,table.createTFoot());
+ else if (id == KJS::HTMLElement::TableDeleteTFoot) {
+ table.deleteTFoot();
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::TableCreateCaption)
+ return getDOMNode(exec,table.createCaption());
+ else if (id == KJS::HTMLElement::TableDeleteCaption) {
+ table.deleteCaption();
+ return Undefined();
+ }
+ else if (id == KJS::HTMLElement::TableInsertRow)
+ return getDOMNode(exec,table.insertRow(args[0].toInt32(exec), exception));
+ else if (id == KJS::HTMLElement::TableDeleteRow) {
+ table.deleteRow(args[0].toInt32(exec), exception);
+ return Undefined();
+ }
}
- break;
- case ID_TR: {
- HTMLTableRowElementImpl &tableRow = static_cast<HTMLTableRowElementImpl &>(element);
- if (id == KJS::HTMLElement::TableRowInsertCell)
- return getDOMNode(exec,tableRow.insertCell(args[0].toInt32(exec), exception));
- else if (id == KJS::HTMLElement::TableRowDeleteCell) {
- tableRow.deleteCell(args[0].toInt32(exec), exception);
- return Undefined();
- }
+ else if (element.hasLocalName(HTMLNames::thead()) ||
+ element.hasLocalName(HTMLNames::tbody()) ||
+ element.hasLocalName(HTMLNames::tfoot())) {
+ HTMLTableSectionElementImpl &tableSection = static_cast<HTMLTableSectionElementImpl &>(element);
+ if (id == KJS::HTMLElement::TableSectionInsertRow)
+ return getDOMNode(exec, tableSection.insertRow(args[0].toInt32(exec), exception));
+ else if (id == KJS::HTMLElement::TableSectionDeleteRow) {
+ tableSection.deleteRow(args[0].toInt32(exec), exception);
+ return Undefined();
+ }
+ }
+ else if (element.hasLocalName(HTMLNames::tr())) {
+ HTMLTableRowElementImpl &tableRow = static_cast<HTMLTableRowElementImpl &>(element);
+ if (id == KJS::HTMLElement::TableRowInsertCell)
+ return getDOMNode(exec,tableRow.insertCell(args[0].toInt32(exec), exception));
+ else if (id == KJS::HTMLElement::TableRowDeleteCell) {
+ tableRow.deleteCell(args[0].toInt32(exec), exception);
+ return Undefined();
+ }
}
- case ID_MARQUEE: {
+ else if (element.hasLocalName(HTMLNames::marquee())) {
if (id == KJS::HTMLElement::MarqueeStart && element.renderer() &&
element.renderer()->layer() &&
element.renderer()->layer()->marquee()) {
@@ -2351,14 +2490,14 @@
return Undefined();
}
if (id == KJS::HTMLElement::MarqueeStop && element.renderer() &&
- element.renderer()->layer() &&
- element.renderer()->layer()->marquee()) {
+ element.renderer()->layer() &&
+ element.renderer()->layer()->marquee()) {
element.renderer()->layer()->marquee()->stop();
return Undefined();
}
- break;
}
- case ID_CANVAS: {
+#if APPLE_CHANGES
+ else if (element.hasLocalName(HTMLNames::canvas())) {
if (id == KJS::HTMLElement::GetContext) {
if (args.size() == 0 || (args.size() == 1 && args[0].toString(exec).qstring().lower() == "2d")) {
return Object(new Context2D(&element));
@@ -2366,742 +2505,764 @@
return Undefined();
}
}
-
- break;
- }
+#endif
- return Undefined();
+ return Undefined();
}
void KJS::HTMLElement::tryPut(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
{
#ifdef KJS_VERBOSE
- DOM::DOMString str = value.isA(NullType) ? DOM::DOMString() : value.toString(exec).string();
+ DOM::DOMString str = value.isA(NullType) ? DOM::DOMString() : value.toString(exec).string();
#endif
- HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
+ HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
#ifdef KJS_VERBOSE
- kdDebug(6070) << "KJS::HTMLElement::tryPut " << propertyName.qstring()
- << " thisTag=" << element.tagName().string()
- << " str=" << str.string() << endl;
+ kdDebug(6070) << "KJS::HTMLElement::tryPut " << propertyName.qstring()
+ << " thisTag=" << element.tagName().string()
+ << " str=" << str.string() << endl;
#endif
- // First look at dynamic properties
- switch (element.id()) {
- case ID_SELECT: {
- HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
- bool ok;
- /*uint u =*/ propertyName.toULong(&ok);
- if (ok) {
- Object coll = Object::dynamicCast( getSelectHTMLCollection(exec, select.optionsHTMLCollection().get(), &select) );
- if ( !coll.isNull() )
- coll.put(exec,propertyName,value);
- return;
- }
+ // First look at dynamic properties
+ if (element.hasLocalName(HTMLNames::select())) {
+ HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
+ bool ok;
+ /*uint u =*/ propertyName.toULong(&ok);
+ if (ok) {
+ Object coll = Object::dynamicCast( getSelectHTMLCollection(exec, select.optionsHTMLCollection().get(), &select) );
+ if (!coll.isNull())
+ coll.put(exec,propertyName,value);
+ return;
+ }
}
#if APPLE_CHANGES
- case ID_EMBED:
- case ID_OBJECT:
- case ID_APPLET: {
+ else if (element.hasLocalName(HTMLNames::embed()) ||
+ element.hasLocalName(HTMLNames::object()) ||
+ element.hasLocalName(HTMLNames::applet())) {
Value runtimeObject = getRuntimeObject(exec,&element);
if (!runtimeObject.isNull()) {
ObjectImp *imp = static_cast<ObjectImp *>(runtimeObject.imp());
- if (imp->canPut(exec, propertyName)) {
+ if (imp->canPut(exec, propertyName))
return imp->put (exec, propertyName, value);
- }
}
}
- break;
#endif
- break;
- default:
- break;
- }
- const HashTable* table = classInfo()->propHashTable; // get the right hashtable
- const HashEntry* entry = Lookup::findEntry(table, propertyName);
- if (entry) {
- if (entry->attr & Function) // function: put as override property
- {
- ObjectImp::put(exec, propertyName, value, attr);
- return;
- }
- else if ((entry->attr & ReadOnly) == 0) // let DOMObjectLookupPut print the warning if not
- {
- putValue(exec, entry->value, value, attr);
- return;
+ const HashTable* table = classInfo()->propHashTable; // get the right hashtable
+ const HashEntry* entry = Lookup::findEntry(table, propertyName);
+ if (entry) {
+ if (entry->attr & Function) { // function: put as override property
+ ObjectImp::put(exec, propertyName, value, attr);
+ return;
+ }
+ else if ((entry->attr & ReadOnly) == 0) { // let DOMObjectLookupPut print the warning if not
+ putValue(exec, entry->value, value, attr);
+ return;
+ }
}
- }
- DOMObjectLookupPut<KJS::HTMLElement, DOMElement>(exec, propertyName, value, attr, &HTMLElementTable, this);
+
+ DOMObjectLookupPut<KJS::HTMLElement, DOMElement>(exec, propertyName, value, attr, &HTMLElementTable, this);
}
-void HTMLElement::putValue(ExecState *exec, int token, const Value& value, int)
+void HTMLElement::htmlSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
{
- DOMExceptionTranslator exception(exec);
- DOM::DOMString str = value.isA(NullType) ? DOM::DOMString() : value.toString(exec).string();
- HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
-#ifdef KJS_VERBOSE
- kdDebug(6070) << "KJS::HTMLElement::putValue "
- << " thisTag=" << element.tagName().string()
- << " token=" << token << endl;
-#endif
+ HTMLHeadElementImpl &head = *static_cast<HTMLHeadElementImpl*>(impl());
+ if (token == HeadProfile)
+ head.setProfile(str);
+}
- switch (element.id()) {
- case ID_HTML: {
- HTMLHtmlElementImpl &html = static_cast<HTMLHtmlElementImpl &>(element);
- switch (token) {
- case HtmlVersion: { html.setVersion(str); return; }
- }
- }
- break;
- case ID_HEAD: {
- HTMLHeadElementImpl &head = static_cast<HTMLHeadElementImpl &>(element);
+void HTMLElement::headSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLHeadElementImpl &head = *static_cast<HTMLHeadElementImpl*>(impl());
+ if (token == HeadProfile)
+ head.setProfile(str);
+}
+
+void HTMLElement::linkSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLLinkElementImpl &link = *static_cast<HTMLLinkElementImpl*>(impl());
switch (token) {
- case HeadProfile: { head.setProfile(str); return; }
- }
- }
- break;
- case ID_LINK: {
- HTMLLinkElementImpl &link = static_cast<HTMLLinkElementImpl &>(element);
- switch (token) {
- case LinkDisabled: { link.setDisabled(value.toBoolean(exec)); return; }
- case LinkCharset: { link.setCharset(str); return; }
- case LinkHref: { link.setHref(str); return; }
- case LinkHrefLang: { link.setHreflang(str); return; }
- case LinkMedia: { link.setMedia(str); return; }
- case LinkRel: { link.setRel(str); return; }
- case LinkRev: { link.setRev(str); return; }
- case LinkTarget: { link.setTarget(str); return; }
- case LinkType: { link.setType(str); return; }
- }
- }
- break;
- case ID_TITLE: {
- HTMLTitleElementImpl &title = static_cast<HTMLTitleElementImpl &>(element);
- switch (token) {
- case TitleText: { title.setText(str); return; }
- }
- }
- break;
- case ID_META: {
- HTMLMetaElementImpl &meta = static_cast<HTMLMetaElementImpl &>(element);
- switch (token) {
- case MetaContent: { meta.setContent(str); return; }
- case MetaHttpEquiv: { meta.setHttpEquiv(str); return; }
- case MetaName: { meta.setName(str); return; }
- case MetaScheme: { meta.setScheme(str); return; }
- }
- }
- break;
- case ID_BASE: {
- HTMLBaseElementImpl &base = static_cast<HTMLBaseElementImpl &>(element);
- switch (token) {
- case BaseHref: { base.setHref(str); return; }
- case BaseTarget: { base.setTarget(str); return; }
- }
- }
- break;
- case ID_ISINDEX: {
- HTMLIsIndexElementImpl &isindex = static_cast<HTMLIsIndexElementImpl &>(element);
- switch (token) {
- // read-only: form
- case IsIndexPrompt: { isindex.setPrompt(str); return; }
- }
- }
- break;
- case ID_STYLE: {
- HTMLStyleElementImpl &style = static_cast<HTMLStyleElementImpl &>(element);
- switch (token) {
- case StyleDisabled: { style.setDisabled(value.toBoolean(exec)); return; }
- case StyleMedia: { style.setMedia(str); return; }
- case StyleType: { style.setType(str); return; }
- }
- }
- break;
- case ID_BODY: {
- HTMLBodyElementImpl &body = static_cast<HTMLBodyElementImpl &>(element);
- switch (token) {
- case BodyALink: { body.setALink(str); return; }
- case BodyBackground: { body.setBackground(str); return; }
- case BodyBgColor: { body.setBgColor(str); return; }
- case BodyLink: { body.setLink(str); return; }
- case BodyText: { body.setText(str); return; }
- case BodyVLink: { body.setVLink(str); return; }
- case BodyScrollLeft:
- case BodyScrollTop: {
- QScrollView* sview = body.ownerDocument()->view();
- if (sview) {
- // Update the document's layout before we compute these attributes.
- if (DocumentImpl* doc = body.getDocument())
- doc->updateLayoutIgnorePendingStylesheets();
- if (token == BodyScrollLeft)
- sview->setContentsPos(value.toInt32(exec), sview->contentsY());
- else
- sview->setContentsPos(sview->contentsX(), value.toInt32(exec));
- }
- return;
- }
- }
- }
- break;
- case ID_FORM: {
- HTMLFormElementImpl &form = static_cast<HTMLFormElementImpl &>(element);
- switch (token) {
- // read-only: elements
- // read-only: length
- case FormName: { form.setName(str); return; }
- case FormAcceptCharset: { form.setAcceptCharset(str); return; }
- case FormAction: { form.setAction(str); return; }
- case FormEncType: { form.setEnctype(str); return; }
- case FormMethod: { form.setMethod(str); return; }
- case FormTarget: { form.setTarget(str); return; }
- }
- }
- break;
- case ID_SELECT: {
- HTMLSelectElementImpl &select = static_cast<HTMLSelectElementImpl &>(element);
- switch (token) {
- // read-only: type
- case SelectSelectedIndex: { select.setSelectedIndex(value.toInt32(exec)); return; }
- case SelectValue: { select.setValue(str); return; }
- case SelectLength: { // read-only according to the NS spec, but webpages need it writeable
- Object coll = Object::dynamicCast( getSelectHTMLCollection(exec, select.optionsHTMLCollection().get(), &select) );
- if ( !coll.isNull() )
- coll.put(exec,lengthPropertyName,value);
- return;
- }
- // read-only: form
- // read-only: options
- case SelectDisabled: { select.setDisabled(value.toBoolean(exec)); return; }
- case SelectMultiple: { select.setMultiple(value.toBoolean(exec)); return; }
- case SelectName: { select.setName(str); return; }
- case SelectSize: { select.setSize(value.toInt32(exec)); return; }
- case SelectTabIndex: { select.setTabIndex(value.toInt32(exec)); return; }
- }
- }
- break;
- case ID_OPTGROUP: {
- HTMLOptGroupElementImpl &optgroup = static_cast<HTMLOptGroupElementImpl &>(element);
- switch (token) {
- case OptGroupDisabled: { optgroup.setDisabled(value.toBoolean(exec)); return; }
- case OptGroupLabel: { optgroup.setLabel(str); return; }
- }
- }
- break;
- case ID_OPTION: {
- HTMLOptionElementImpl &option = static_cast<HTMLOptionElementImpl &>(element);
- switch (token) {
- // read-only: form
- case OptionDefaultSelected: { option.setDefaultSelected(value.toBoolean(exec)); return; }
- case OptionText: { option.setText(str, exception); return; }
- // read-only: index
- case OptionDisabled: { option.setDisabled(value.toBoolean(exec)); return; }
- case OptionLabel: { option.setLabel(str); return; }
- case OptionSelected: { option.setSelected(value.toBoolean(exec)); return; }
- case OptionValue: { option.setValue(str); return; }
- }
+ case LinkDisabled: { link.setDisabled(value.toBoolean(exec)); return; }
+ case LinkCharset: { link.setCharset(str); return; }
+ case LinkHref: { link.setHref(str); return; }
+ case LinkHrefLang: { link.setHreflang(str); return; }
+ case LinkMedia: { link.setMedia(str); return; }
+ case LinkRel: { link.setRel(str); return; }
+ case LinkRev: { link.setRev(str); return; }
+ case LinkTarget: { link.setTarget(str); return; }
+ case LinkType: { link.setType(str); return; }
}
- break;
- case ID_INPUT: {
- HTMLInputElementImpl &input = static_cast<HTMLInputElementImpl &>(element);
- switch (token) {
- case InputDefaultValue: { input.setDefaultValue(str); return; }
- case InputDefaultChecked: { input.setDefaultChecked(value.toBoolean(exec)); return; }
- // read-only: form
- case InputAccept: { input.setAccept(str); return; }
- case InputAccessKey: { input.setAccessKey(str); return; }
- case InputAlign: { input.setAlign(str); return; }
- case InputAlt: { input.setAlt(str); return; }
- case InputChecked: { input.setChecked(value.toBoolean(exec)); return; }
- case InputDisabled: { input.setDisabled(value.toBoolean(exec)); return; }
- case InputMaxLength: { input.setMaxLength(value.toInt32(exec)); return; }
- case InputName: { input.setName(str); return; }
- case InputReadOnly: { input.setReadOnly(value.toBoolean(exec)); return; }
- case InputSelectionStart: { input.setSelectionStart(value.toInt32(exec)); return; }
- case InputSelectionEnd: { input.setSelectionEnd(value.toInt32(exec)); return; }
- case InputSize: { input.setSize(str); return; }
- case InputSrc: { input.setSrc(str); return; }
- case InputTabIndex: { input.setTabIndex(value.toInt32(exec)); return; }
- case InputType: { input.setType(str); return; }
- case InputUseMap: { input.setUseMap(str); return; }
- case InputValue: { input.setValue(str); return; }
- }
- }
- break;
- case ID_TEXTAREA: {
- HTMLTextAreaElementImpl &textarea = static_cast<HTMLTextAreaElementImpl &>(element);
- switch (token) {
- case TextAreaDefaultValue: { textarea.setDefaultValue(str); return; }
- // read-only: form
- case TextAreaAccessKey: { textarea.setAccessKey(str); return; }
- case TextAreaCols: { textarea.setCols(value.toInt32(exec)); return; }
- case TextAreaDisabled: { textarea.setDisabled(value.toBoolean(exec)); return; }
- case TextAreaName: { textarea.setName(str); return; }
- case TextAreaReadOnly: { textarea.setReadOnly(value.toBoolean(exec)); return; }
- case TextAreaRows: { textarea.setRows(value.toInt32(exec)); return; }
- case TextAreaSelectionStart: { textarea.setSelectionStart(value.toInt32(exec)); return; }
- case TextAreaSelectionEnd: { textarea.setSelectionEnd(value.toInt32(exec)); return; }
- case TextAreaTabIndex: { textarea.setTabIndex(value.toInt32(exec)); return; }
- // read-only: type
- case TextAreaValue: { textarea.setValue(str); return; }
- }
- }
- break;
- case ID_BUTTON: {
- HTMLButtonElementImpl &button = static_cast<HTMLButtonElementImpl &>(element);
- switch (token) {
- // read-only: form
- case ButtonAccessKey: { button.setAccessKey(str); return; }
- case ButtonDisabled: { button.setDisabled(value.toBoolean(exec)); return; }
- case ButtonName: { button.setName(str); return; }
- case ButtonTabIndex: { button.setTabIndex(value.toInt32(exec)); return; }
- // read-only: type
- case ButtonValue: { button.setValue(str); return; }
- }
- }
- break;
- case ID_LABEL: {
- HTMLLabelElementImpl &label = static_cast<HTMLLabelElementImpl &>(element);
- switch (token) {
- // read-only: form
- case LabelAccessKey: { label.setAccessKey(str); return; }
- case LabelHtmlFor: { label.setHtmlFor(str); return; }
- }
- }
- break;
- case ID_LEGEND: {
- HTMLLegendElementImpl &legend = static_cast<HTMLLegendElementImpl &>(element);
- switch (token) {
- // read-only: form
- case LegendAccessKey: { legend.setAccessKey(str); return; }
- case LegendAlign: { legend.setAlign(str); return; }
- }
+}
+
+void HTMLElement::titleSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLTitleElementImpl& title = *static_cast<HTMLTitleElementImpl*>(impl());
+ if (token == TitleText)
+ title.setText(str);
+}
+
+void HTMLElement::metaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLMetaElementImpl& meta = *static_cast<HTMLMetaElementImpl*>(impl());
+ switch (token) {
+ case MetaContent: { meta.setContent(str); return; }
+ case MetaHttpEquiv: { meta.setHttpEquiv(str); return; }
+ case MetaName: { meta.setName(str); return; }
+ case MetaScheme: { meta.setScheme(str); return; }
}
- break;
- case ID_UL: {
- HTMLUListElementImpl &uList = static_cast<HTMLUListElementImpl &>(element);
- switch (token) {
- case UListCompact: { uList.setCompact(value.toBoolean(exec)); return; }
- case UListType: { uList.setType(str); return; }
- }
+}
+
+void HTMLElement::baseSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLBaseElementImpl& base = *static_cast<HTMLBaseElementImpl*>(impl());
+ switch (token) {
+ case BaseHref: { base.setHref(str); return; }
+ case BaseTarget: { base.setTarget(str); return; }
}
- break;
- case ID_OL: {
- HTMLOListElementImpl &oList = static_cast<HTMLOListElementImpl &>(element);
- switch (token) {
- case OListCompact: { oList.setCompact(value.toBoolean(exec)); return; }
- case OListStart: { oList.setStart(value.toInt32(exec)); return; }
- case OListType: { oList.setType(str); return; }
- }
+}
+
+void HTMLElement::isIndexSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLIsIndexElementImpl& isindex = *static_cast<HTMLIsIndexElementImpl*>(impl());
+ if (token == IsIndexPrompt)
+ isindex.setPrompt(str);
+}
+
+void HTMLElement::styleSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLStyleElementImpl& style = *static_cast<HTMLStyleElementImpl*>(impl());
+ switch (token) {
+ case StyleDisabled: { style.setDisabled(value.toBoolean(exec)); return; }
+ case StyleMedia: { style.setMedia(str); return; }
+ case StyleType: { style.setType(str); return; }
}
- break;
- case ID_DL: {
- HTMLDListElementImpl &dList = static_cast<HTMLDListElementImpl &>(element);
- switch (token) {
- case DListCompact: { dList.setCompact(value.toBoolean(exec)); return; }
- }
+}
+
+void HTMLElement::bodySetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLBodyElementImpl& body = *static_cast<HTMLBodyElementImpl*>(impl());
+ switch (token) {
+ case BodyALink: { body.setALink(str); return; }
+ case BodyBackground: { body.setBackground(str); return; }
+ case BodyBgColor: { body.setBgColor(str); return; }
+ case BodyLink: { body.setLink(str); return; }
+ case BodyText: { body.setText(str); return; }
+ case BodyVLink: { body.setVLink(str); return; }
+ case BodyScrollLeft:
+ case BodyScrollTop: {
+ QScrollView* sview = body.ownerDocument()->view();
+ if (sview) {
+ // Update the document's layout before we compute these attributes.
+ if (DocumentImpl* doc = body.getDocument())
+ doc->updateLayoutIgnorePendingStylesheets();
+ if (token == BodyScrollLeft)
+ sview->setContentsPos(value.toInt32(exec), sview->contentsY());
+ else
+ sview->setContentsPos(sview->contentsX(), value.toInt32(exec));
+ }
+ return;
+ }
}
- break;
- case ID_DIR: {
- HTMLDirectoryElementImpl &directory = static_cast<HTMLDirectoryElementImpl &>(element);
- switch (token) {
- case DirectoryCompact: { directory.setCompact(value.toBoolean(exec)); return; }
- }
+}
+
+void HTMLElement::formSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLFormElementImpl& form = *static_cast<HTMLFormElementImpl*>(impl());
+ switch (token) {
+ // read-only: elements
+ // read-only: length
+ case FormName: { form.setName(str); return; }
+ case FormAcceptCharset: { form.setAcceptCharset(str); return; }
+ case FormAction: { form.setAction(str); return; }
+ case FormEncType: { form.setEnctype(str); return; }
+ case FormMethod: { form.setMethod(str); return; }
+ case FormTarget: { form.setTarget(str); return; }
}
- break;
- case ID_MENU: {
- HTMLMenuElementImpl &menu = static_cast<HTMLMenuElementImpl &>(element);
- switch (token) {
- case MenuCompact: { menu.setCompact(value.toBoolean(exec)); return; }
- }
+}
+
+void HTMLElement::selectSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLSelectElementImpl& select = *static_cast<HTMLSelectElementImpl*>(impl());
+ switch (token) {
+ // read-only: type
+ case SelectSelectedIndex: { select.setSelectedIndex(value.toInt32(exec)); return; }
+ case SelectValue: { select.setValue(str); return; }
+ case SelectLength: { // read-only according to the NS spec, but webpages need it writeable
+ Object coll = Object::dynamicCast( getSelectHTMLCollection(exec, select.optionsHTMLCollection().get(), &select) );
+ if ( !coll.isNull() )
+ coll.put(exec,lengthPropertyName,value);
+ return;
+ }
+ // read-only: form
+ // read-only: options
+ case SelectDisabled: { select.setDisabled(value.toBoolean(exec)); return; }
+ case SelectMultiple: { select.setMultiple(value.toBoolean(exec)); return; }
+ case SelectName: { select.setName(str); return; }
+ case SelectSize: { select.setSize(value.toInt32(exec)); return; }
+ case SelectTabIndex: { select.setTabIndex(value.toInt32(exec)); return; }
}
- break;
- case ID_LI: {
- HTMLLIElementImpl &li = static_cast<HTMLLIElementImpl &>(element);
- switch (token) {
- case LIType: { li.setType(str); return; }
- case LIValue: { li.setValue(value.toInt32(exec)); return; }
- }
+}
+
+void HTMLElement::optGroupSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLOptGroupElementImpl& optgroup = *static_cast<HTMLOptGroupElementImpl*>(impl());
+ switch (token) {
+ case OptGroupDisabled: { optgroup.setDisabled(value.toBoolean(exec)); return; }
+ case OptGroupLabel: { optgroup.setLabel(str); return; }
}
- break;
- case ID_DIV: {
- HTMLDivElementImpl &div = static_cast<HTMLDivElementImpl &>(element);
- switch (token) {
- case DivAlign: { div.setAlign(str); return; }
- }
+}
+
+void HTMLElement::optionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ DOMExceptionTranslator exception(exec);
+ HTMLOptionElementImpl& option = *static_cast<HTMLOptionElementImpl*>(impl());
+ switch (token) {
+ // read-only: form
+ case OptionDefaultSelected: { option.setDefaultSelected(value.toBoolean(exec)); return; }
+ case OptionText: { option.setText(str, exception); return; }
+ // read-only: index
+ case OptionDisabled: { option.setDisabled(value.toBoolean(exec)); return; }
+ case OptionLabel: { option.setLabel(str); return; }
+ case OptionSelected: { option.setSelected(value.toBoolean(exec)); return; }
+ case OptionValue: { option.setValue(str); return; }
}
- break;
- case ID_P: {
- HTMLParagraphElementImpl ¶graph = static_cast<HTMLParagraphElementImpl &>(element);
- switch (token) {
- case ParagraphAlign: { paragraph.setAlign(str); return; }
- }
+}
+
+void HTMLElement::inputSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLInputElementImpl& input = *static_cast<HTMLInputElementImpl*>(impl());
+ switch (token) {
+ case InputDefaultValue: { input.setDefaultValue(str); return; }
+ case InputDefaultChecked: { input.setDefaultChecked(value.toBoolean(exec)); return; }
+ // read-only: form
+ case InputAccept: { input.setAccept(str); return; }
+ case InputAccessKey: { input.setAccessKey(str); return; }
+ case InputAlign: { input.setAlign(str); return; }
+ case InputAlt: { input.setAlt(str); return; }
+ case InputChecked: { input.setChecked(value.toBoolean(exec)); return; }
+ case InputDisabled: { input.setDisabled(value.toBoolean(exec)); return; }
+ case InputMaxLength: { input.setMaxLength(value.toInt32(exec)); return; }
+ case InputName: { input.setName(str); return; }
+ case InputReadOnly: { input.setReadOnly(value.toBoolean(exec)); return; }
+ case InputSize: { input.setSize(str); return; }
+ case InputSelectionStart: { input.setSelectionStart(value.toInt32(exec)); return; }
+ case InputSelectionEnd: { input.setSelectionEnd(value.toInt32(exec)); return; }
+ case InputSrc: { input.setSrc(str); return; }
+ case InputTabIndex: { input.setTabIndex(value.toInt32(exec)); return; }
+ case InputType: { input.setType(str); return; }
+ case InputUseMap: { input.setUseMap(str); return; }
+ case InputValue: { input.setValue(str); return; }
}
- break;
- case ID_H1:
- case ID_H2:
- case ID_H3:
- case ID_H4:
- case ID_H5:
- case ID_H6: {
- HTMLHeadingElementImpl &heading = static_cast<HTMLHeadingElementImpl &>(element);
- switch (token) {
- case HeadingAlign: { heading.setAlign(str); return; }
- }
+}
+
+void HTMLElement::textAreaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLTextAreaElementImpl& textarea = *static_cast<HTMLTextAreaElementImpl*>(impl());
+ switch (token) {
+ case TextAreaDefaultValue: { textarea.setDefaultValue(str); return; }
+ // read-only: form
+ case TextAreaAccessKey: { textarea.setAccessKey(str); return; }
+ case TextAreaCols: { textarea.setCols(value.toInt32(exec)); return; }
+ case TextAreaDisabled: { textarea.setDisabled(value.toBoolean(exec)); return; }
+ case TextAreaName: { textarea.setName(str); return; }
+ case TextAreaReadOnly: { textarea.setReadOnly(value.toBoolean(exec)); return; }
+ case TextAreaRows: { textarea.setRows(value.toInt32(exec)); return; }
+ case TextAreaSelectionStart: { textarea.setSelectionStart(value.toInt32(exec)); return; }
+ case TextAreaSelectionEnd: { textarea.setSelectionEnd(value.toInt32(exec)); return; }
+ case TextAreaTabIndex: { textarea.setTabIndex(value.toInt32(exec)); return; }
+ // read-only: type
+ case TextAreaValue: { textarea.setValue(str); return; }
}
- break;
- case ID_BLOCKQUOTE: {
- HTMLBlockquoteElementImpl &blockquote = static_cast<HTMLBlockquoteElementImpl &>(element);
- switch (token) {
- case BlockQuoteCite: { blockquote.setCite(str); return; }
- }
+}
+
+void HTMLElement::buttonSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLButtonElementImpl& button = *static_cast<HTMLButtonElementImpl*>(impl());
+ switch (token) {
+ // read-only: form
+ case ButtonAccessKey: { button.setAccessKey(str); return; }
+ case ButtonDisabled: { button.setDisabled(value.toBoolean(exec)); return; }
+ case ButtonName: { button.setName(str); return; }
+ case ButtonTabIndex: { button.setTabIndex(value.toInt32(exec)); return; }
+ // read-only: type
+ case ButtonValue: { button.setValue(str); return; }
}
- break;
- case ID_Q: {
- HTMLQuoteElementImpl "e = static_cast<HTMLQuoteElementImpl &>(element);
- switch (token) {
- case QuoteCite: { quote.setCite(str); return; }
- }
+}
+
+void HTMLElement::labelSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLLabelElementImpl& label = *static_cast<HTMLLabelElementImpl*>(impl());
+ switch (token) {
+ // read-only: form
+ case LabelAccessKey: { label.setAccessKey(str); return; }
+ case LabelHtmlFor: { label.setHtmlFor(str); return; }
}
- break;
- case ID_PRE: {
- HTMLPreElementImpl &pre = static_cast<HTMLPreElementImpl &>(element);
- switch (token) {
- case PreWidth: { pre.setWidth(value.toInt32(exec)); return; }
- }
+}
+
+void HTMLElement::fieldSetSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+}
+
+void HTMLElement::legendSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLLegendElementImpl& legend = *static_cast<HTMLLegendElementImpl*>(impl());
+ switch (token) {
+ // read-only: form
+ case LegendAccessKey: { legend.setAccessKey(str); return; }
+ case LegendAlign: { legend.setAlign(str); return; }
}
- break;
- case ID_BR: {
- HTMLBRElementImpl &br = static_cast<HTMLBRElementImpl &>(element);
- switch (token) {
- case BRClear: { br.setClear(str); return; }
- }
+}
+
+void HTMLElement::uListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLUListElementImpl& uList = *static_cast<HTMLUListElementImpl*>(impl());
+ switch (token) {
+ case UListCompact: { uList.setCompact(value.toBoolean(exec)); return; }
+ case UListType: { uList.setType(str); return; }
}
- break;
- case ID_BASEFONT: {
- HTMLBaseFontElementImpl &baseFont = static_cast<HTMLBaseFontElementImpl &>(element);
- switch (token) {
- case BaseFontColor: { baseFont.setColor(str); return; }
- case BaseFontFace: { baseFont.setFace(str); return; }
- case BaseFontSize: { baseFont.setSize(str); return; }
- }
+}
+
+void HTMLElement::oListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLOListElementImpl& oList = *static_cast<HTMLOListElementImpl*>(impl());
+ switch (token) {
+ case OListCompact: { oList.setCompact(value.toBoolean(exec)); return; }
+ case OListStart: { oList.setStart(value.toInt32(exec)); return; }
+ case OListType: { oList.setType(str); return; }
}
- break;
- case ID_FONT: {
- HTMLFontElementImpl &font = static_cast<HTMLFontElementImpl &>(element);
- switch (token) {
- case FontColor: { font.setColor(str); return; }
- case FontFace: { font.setFace(str); return; }
- case FontSize: { font.setSize(str); return; }
- }
+}
+
+void HTMLElement::dListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLDListElementImpl& dList = *static_cast<HTMLDListElementImpl*>(impl());
+ if (token == DListCompact)
+ dList.setCompact(value.toBoolean(exec));
+}
+
+void HTMLElement::dirSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLDirectoryElementImpl& directory = *static_cast<HTMLDirectoryElementImpl*>(impl());
+ if (token == DirectoryCompact)
+ directory.setCompact(value.toBoolean(exec));
+}
+
+void HTMLElement::menuSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLMenuElementImpl& menu = *static_cast<HTMLMenuElementImpl*>(impl());
+ if (token == MenuCompact)
+ menu.setCompact(value.toBoolean(exec));
+}
+
+void HTMLElement::liSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLLIElementImpl& li = *static_cast<HTMLLIElementImpl*>(impl());
+ switch (token) {
+ case LIType: { li.setType(str); return; }
+ case LIValue: { li.setValue(value.toInt32(exec)); return; }
}
- break;
- case ID_HR: {
- HTMLHRElementImpl &hr = static_cast<HTMLHRElementImpl &>(element);
- switch (token) {
- case HRAlign: { hr.setAlign(str); return; }
- case HRNoShade: { hr.setNoShade(value.toBoolean(exec)); return; }
- case HRSize: { hr.setSize(str); return; }
- case HRWidth: { hr.setWidth(str); return; }
- }
+}
+
+void HTMLElement::divSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLDivElementImpl& div = *static_cast<HTMLDivElementImpl*>(impl());
+ if (token == DivAlign)
+ div.setAlign(str);
+}
+
+void HTMLElement::paragraphSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLParagraphElementImpl& paragraph = *static_cast<HTMLParagraphElementImpl*>(impl());
+ if (token == ParagraphAlign)
+ paragraph.setAlign(str);
+}
+
+void HTMLElement::headingSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLHeadingElementImpl& heading = *static_cast<HTMLHeadingElementImpl*>(impl());
+ if (token == HeadingAlign)
+ heading.setAlign(str);
+}
+
+void HTMLElement::blockQuoteSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLBlockquoteElementImpl& blockQuote = *static_cast<HTMLBlockquoteElementImpl*>(impl());
+ if (token == BlockQuoteCite)
+ blockQuote.setCite(str);
+}
+
+void HTMLElement::quoteSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLQuoteElementImpl& quote = *static_cast<HTMLQuoteElementImpl*>(impl());
+ if (token == QuoteCite)
+ quote.setCite(str);
+}
+
+void HTMLElement::preSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ // FIXME: Add support for 'wrap' when white-space: pre-wrap is implemented.
+ HTMLPreElementImpl& pre = *static_cast<HTMLPreElementImpl*>(impl());
+ if (token == PreWidth)
+ pre.setWidth(value.toInt32(exec));
+}
+
+void HTMLElement::brSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLBRElementImpl& br = *static_cast<HTMLBRElementImpl*>(impl());
+ if (token == BRClear)
+ br.setClear(str);
+}
+
+void HTMLElement::baseFontSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLBaseFontElementImpl& baseFont = *static_cast<HTMLBaseFontElementImpl*>(impl());
+ switch (token) {
+ case BaseFontColor: { baseFont.setColor(str); return; }
+ case BaseFontFace: { baseFont.setFace(str); return; }
+ case BaseFontSize: { baseFont.setSize(str); return; }
}
- break;
- case ID_INS:
- case ID_DEL: {
- HTMLModElementImpl &mod = static_cast<HTMLModElementImpl &>(element);
- switch (token) {
- case ModCite: { mod.setCite(str); return; }
- case ModDateTime: { mod.setDateTime(str); return; }
- }
+}
+
+void HTMLElement::fontSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLFontElementImpl& font = *static_cast<HTMLFontElementImpl*>(impl());
+ switch (token) {
+ case FontColor: { font.setColor(str); return; }
+ case FontFace: { font.setFace(str); return; }
+ case FontSize: { font.setSize(str); return; }
}
- break;
- case ID_A: {
- HTMLAnchorElementImpl &anchor = static_cast<HTMLAnchorElementImpl &>(element);
- switch (token) {
- case AnchorAccessKey: { anchor.setAccessKey(str); return; }
- case AnchorCharset: { anchor.setCharset(str); return; }
- case AnchorCoords: { anchor.setCoords(str); return; }
- case AnchorHref: { anchor.setHref(str); return; }
- case AnchorHrefLang: { anchor.setHreflang(str); return; }
- case AnchorName: { anchor.setName(str); return; }
- case AnchorRel: { anchor.setRel(str); return; }
- case AnchorRev: { anchor.setRev(str); return; }
- case AnchorShape: { anchor.setShape(str); return; }
- case AnchorTabIndex: { anchor.setTabIndex(value.toInt32(exec)); return; }
- case AnchorTarget: { anchor.setTarget(str); return; }
- case AnchorType: { anchor.setType(str); return; }
- }
+}
+
+void HTMLElement::hrSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLHRElementImpl& hr = *static_cast<HTMLHRElementImpl*>(impl());
+ switch (token) {
+ case HRAlign: { hr.setAlign(str); return; }
+ case HRNoShade: { hr.setNoShade(value.toBoolean(exec)); return; }
+ case HRSize: { hr.setSize(str); return; }
+ case HRWidth: { hr.setWidth(str); return; }
}
- break;
- case ID_IMG: {
- HTMLImageElementImpl &image = static_cast<HTMLImageElementImpl &>(element);
- switch (token) {
- case ImageName: { image.setName(str); return; }
- case ImageAlign: { image.setAlign(str); return; }
- case ImageAlt: { image.setAlt(str); return; }
- case ImageBorder: { image.setBorder(value.toInt32(exec)); return; }
- case ImageHeight: { image.setHeight(value.toInt32(exec)); return; }
- case ImageHspace: { image.setHspace(value.toInt32(exec)); return; }
- case ImageIsMap: { image.setIsMap(value.toBoolean(exec)); return; }
- case ImageLongDesc: { image.setLongDesc(str); return; }
- case ImageSrc: { image.setSrc(str); return; }
- case ImageUseMap: { image.setUseMap(str); return; }
- case ImageVspace: { image.setVspace(value.toInt32(exec)); return; }
- case ImageWidth: { image.setWidth(value.toInt32(exec)); return; }
- }
+}
+
+void HTMLElement::modSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLModElementImpl& mod = *static_cast<HTMLModElementImpl*>(impl());
+ switch (token) {
+ case ModCite: { mod.setCite(str); return; }
+ case ModDateTime: { mod.setDateTime(str); return; }
}
- break;
- case ID_OBJECT: {
- HTMLObjectElementImpl &object = static_cast<HTMLObjectElementImpl &>(element);
- switch (token) {
- // read-only: form
- case ObjectCode: { object.setCode(str); return; }
- case ObjectAlign: { object.setAlign(str); return; }
- case ObjectArchive: { object.setArchive(str); return; }
- case ObjectBorder: { object.setBorder(str); return; }
- case ObjectCodeBase: { object.setCodeBase(str); return; }
- case ObjectCodeType: { object.setCodeType(str); return; }
- // read-only: ObjectContentDocument
- case ObjectData: { object.setData(str); return; }
- case ObjectDeclare: { object.setDeclare(value.toBoolean(exec)); return; }
- case ObjectHeight: { object.setHeight(str); return; }
- case ObjectHspace: { object.setHspace(str); return; }
- case ObjectName: { object.setName(str); return; }
- case ObjectStandby: { object.setStandby(str); return; }
- case ObjectTabIndex: { object.setTabIndex(value.toInt32(exec)); return; }
- case ObjectType: { object.setType(str); return; }
- case ObjectUseMap: { object.setUseMap(str); return; }
- case ObjectVspace: { object.setVspace(str); return; }
- case ObjectWidth: { object.setWidth(str); return; }
- }
+}
+
+void HTMLElement::anchorSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLAnchorElementImpl& anchor = *static_cast<HTMLAnchorElementImpl*>(impl());
+ switch (token) {
+ case AnchorAccessKey: { anchor.setAccessKey(str); return; }
+ case AnchorCharset: { anchor.setCharset(str); return; }
+ case AnchorCoords: { anchor.setCoords(str); return; }
+ case AnchorHref: { anchor.setHref(str); return; }
+ case AnchorHrefLang: { anchor.setHreflang(str); return; }
+ case AnchorName: { anchor.setName(str); return; }
+ case AnchorRel: { anchor.setRel(str); return; }
+ case AnchorRev: { anchor.setRev(str); return; }
+ case AnchorShape: { anchor.setShape(str); return; }
+ case AnchorTabIndex: { anchor.setTabIndex(value.toInt32(exec)); return; }
+ case AnchorTarget: { anchor.setTarget(str); return; }
+ case AnchorType: { anchor.setType(str); return; }
}
- break;
- case ID_PARAM: {
- HTMLParamElementImpl ¶m = static_cast<HTMLParamElementImpl &>(element);
- switch (token) {
- case ParamName: { param.setName(str); return; }
- case ParamType: { param.setType(str); return; }
- case ParamValue: { param.setValue(str); return; }
- case ParamValueType: { param.setValueType(str); return; }
- }
+}
+
+void HTMLElement::imageSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLImageElementImpl& image = *static_cast<HTMLImageElementImpl*>(impl());
+ switch (token) {
+ case ImageName: { image.setName(str); return; }
+ case ImageAlign: { image.setAlign(str); return; }
+ case ImageAlt: { image.setAlt(str); return; }
+ case ImageBorder: { image.setBorder(value.toInt32(exec)); return; }
+ case ImageHeight: { image.setHeight(value.toInt32(exec)); return; }
+ case ImageHspace: { image.setHspace(value.toInt32(exec)); return; }
+ case ImageIsMap: { image.setIsMap(value.toBoolean(exec)); return; }
+ case ImageLongDesc: { image.setLongDesc(str); return; }
+ case ImageSrc: { image.setSrc(str); return; }
+ case ImageUseMap: { image.setUseMap(str); return; }
+ case ImageVspace: { image.setVspace(value.toInt32(exec)); return; }
+ case ImageWidth: { image.setWidth(value.toInt32(exec)); return; }
}
- break;
- case ID_APPLET: {
- HTMLAppletElementImpl &applet = static_cast<HTMLAppletElementImpl &>(element);
- switch (token) {
- case AppletAlign: { applet.setAlign(str); return; }
- case AppletAlt: { applet.setAlt(str); return; }
- case AppletArchive: { applet.setArchive(str); return; }
- case AppletCode: { applet.setCode(str); return; }
- case AppletCodeBase: { applet.setCodeBase(str); return; }
- case AppletHeight: { applet.setHeight(str); return; }
- case AppletHspace: { applet.setHspace(str); return; }
- case AppletName: { applet.setName(str); return; }
- case AppletObject: { applet.setObject(str); return; }
- case AppletVspace: { applet.setVspace(str); return; }
- case AppletWidth: { applet.setWidth(str); return; }
- }
+}
+
+void HTMLElement::objectSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLObjectElementImpl& object = *static_cast<HTMLObjectElementImpl*>(impl());
+ switch (token) {
+ // read-only: form
+ case ObjectCode: { object.setCode(str); return; }
+ case ObjectAlign: { object.setAlign(str); return; }
+ case ObjectArchive: { object.setArchive(str); return; }
+ case ObjectBorder: { object.setBorder(str); return; }
+ case ObjectCodeBase: { object.setCodeBase(str); return; }
+ case ObjectCodeType: { object.setCodeType(str); return; }
+ // read-only: ObjectContentDocument
+ case ObjectData: { object.setData(str); return; }
+ case ObjectDeclare: { object.setDeclare(value.toBoolean(exec)); return; }
+ case ObjectHeight: { object.setHeight(str); return; }
+ case ObjectHspace: { object.setHspace(str); return; }
+ case ObjectName: { object.setName(str); return; }
+ case ObjectStandby: { object.setStandby(str); return; }
+ case ObjectTabIndex: { object.setTabIndex(value.toInt32(exec)); return; }
+ case ObjectType: { object.setType(str); return; }
+ case ObjectUseMap: { object.setUseMap(str); return; }
+ case ObjectVspace: { object.setVspace(str); return; }
+ case ObjectWidth: { object.setWidth(str); return; }
}
- break;
- case ID_MAP: {
- HTMLMapElementImpl &map = static_cast<HTMLMapElementImpl &>(element);
- switch (token) {
- // read-only: areas
- case MapName: { map.setName(str); return; }
- }
+}
+
+void HTMLElement::paramSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLParamElementImpl& param = *static_cast<HTMLParamElementImpl*>(impl());
+ switch (token) {
+ case ParamName: { param.setName(str); return; }
+ case ParamType: { param.setType(str); return; }
+ case ParamValue: { param.setValue(str); return; }
+ case ParamValueType: { param.setValueType(str); return; }
}
- break;
- case ID_AREA: {
- HTMLAreaElementImpl &area = static_cast<HTMLAreaElementImpl &>(element);
- switch (token) {
- case AreaAccessKey: { area.setAccessKey(str); return; }
- case AreaAlt: { area.setAlt(str); return; }
- case AreaCoords: { area.setCoords(str); return; }
- case AreaHref: { area.setHref(str); return; }
- case AreaNoHref: { area.setNoHref(value.toBoolean(exec)); return; }
- case AreaShape: { area.setShape(str); return; }
- case AreaTabIndex: { area.setTabIndex(value.toInt32(exec)); return; }
- case AreaTarget: { area.setTarget(str); return; }
- }
+}
+
+void HTMLElement::appletSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLAppletElementImpl& applet = *static_cast<HTMLAppletElementImpl*>(impl());
+ switch (token) {
+ case AppletAlign: { applet.setAlign(str); return; }
+ case AppletAlt: { applet.setAlt(str); return; }
+ case AppletArchive: { applet.setArchive(str); return; }
+ case AppletCode: { applet.setCode(str); return; }
+ case AppletCodeBase: { applet.setCodeBase(str); return; }
+ case AppletHeight: { applet.setHeight(str); return; }
+ case AppletHspace: { applet.setHspace(str); return; }
+ case AppletName: { applet.setName(str); return; }
+ case AppletObject: { applet.setObject(str); return; }
+ case AppletVspace: { applet.setVspace(str); return; }
+ case AppletWidth: { applet.setWidth(str); return; }
}
- break;
- case ID_SCRIPT: {
- HTMLScriptElementImpl &script = static_cast<HTMLScriptElementImpl &>(element);
- switch (token) {
- case ScriptText: { script.setText(str); return; }
- case ScriptHtmlFor: { script.setHtmlFor(str); return; }
- case ScriptEvent: { script.setEvent(str); return; }
- case ScriptCharset: { script.setCharset(str); return; }
- case ScriptDefer: { script.setDefer(value.toBoolean(exec)); return; }
- case ScriptSrc: { script.setSrc(str); return; }
- case ScriptType: { script.setType(str); return; }
- }
+}
+
+void HTMLElement::mapSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLMapElementImpl& map = *static_cast<HTMLMapElementImpl*>(impl());
+ if (token == MapName)
+ // read-only: areas
+ map.setName(str);
+}
+
+void HTMLElement::areaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLAreaElementImpl& area = *static_cast<HTMLAreaElementImpl*>(impl());
+ switch (token) {
+ case AreaAccessKey: { area.setAccessKey(str); return; }
+ case AreaAlt: { area.setAlt(str); return; }
+ case AreaCoords: { area.setCoords(str); return; }
+ case AreaHref: { area.setHref(str); return; }
+ case AreaNoHref: { area.setNoHref(value.toBoolean(exec)); return; }
+ case AreaShape: { area.setShape(str); return; }
+ case AreaTabIndex: { area.setTabIndex(value.toInt32(exec)); return; }
+ case AreaTarget: { area.setTarget(str); return; }
}
- break;
- case ID_TABLE: {
- HTMLTableElementImpl &table = static_cast<HTMLTableElementImpl &>(element);
- switch (token) {
- case TableCaption: { table.setCaption(toHTMLTableCaptionElement(value)); return; }
- case TableTHead: { table.setTHead(toHTMLTableSectionElement(value)); return; }
- case TableTFoot: { table.setTFoot(toHTMLTableSectionElement(value)); return; }
- // read-only: rows
- // read-only: tbodies
- case TableAlign: { table.setAlign(str); return; }
- case TableBgColor: { table.setBgColor(str); return; }
- case TableBorder: { table.setBorder(str); return; }
- case TableCellPadding: { table.setCellPadding(str); return; }
- case TableCellSpacing: { table.setCellSpacing(str); return; }
- case TableFrame: { table.setFrame(str); return; }
- case TableRules: { table.setRules(str); return; }
- case TableSummary: { table.setSummary(str); return; }
- case TableWidth: { table.setWidth(str); return; }
- }
+}
+
+void HTMLElement::scriptSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLScriptElementImpl& script = *static_cast<HTMLScriptElementImpl*>(impl());
+ switch (token) {
+ case ScriptText: { script.setText(str); return; }
+ case ScriptHtmlFor: { script.setHtmlFor(str); return; }
+ case ScriptEvent: { script.setEvent(str); return; }
+ case ScriptCharset: { script.setCharset(str); return; }
+ case ScriptDefer: { script.setDefer(value.toBoolean(exec)); return; }
+ case ScriptSrc: { script.setSrc(str); return; }
+ case ScriptType: { script.setType(str); return; }
}
- break;
- case ID_CAPTION: {
- HTMLTableCaptionElementImpl &tableCaption = static_cast<HTMLTableCaptionElementImpl &>(element);
- switch (token) {
- case TableAlign: { tableCaption.setAlign(str); return; }
- }
+}
+
+void HTMLElement::tableSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLTableElementImpl& table = *static_cast<HTMLTableElementImpl*>(impl());
+ switch (token) {
+ case TableCaption: { table.setCaption(toHTMLTableCaptionElement(value)); return; }
+ case TableTHead: { table.setTHead(toHTMLTableSectionElement(value)); return; }
+ case TableTFoot: { table.setTFoot(toHTMLTableSectionElement(value)); return; }
+ // read-only: rows
+ // read-only: tbodies
+ case TableAlign: { table.setAlign(str); return; }
+ case TableBgColor: { table.setBgColor(str); return; }
+ case TableBorder: { table.setBorder(str); return; }
+ case TableCellPadding: { table.setCellPadding(str); return; }
+ case TableCellSpacing: { table.setCellSpacing(str); return; }
+ case TableFrame: { table.setFrame(str); return; }
+ case TableRules: { table.setRules(str); return; }
+ case TableSummary: { table.setSummary(str); return; }
+ case TableWidth: { table.setWidth(str); return; }
}
- break;
- case ID_COL: {
- HTMLTableColElementImpl &tableCol = static_cast<HTMLTableColElementImpl &>(element);
- switch (token) {
- case TableColAlign: { tableCol.setAlign(str); return; }
- case TableColCh: { tableCol.setCh(str); return; }
- case TableColChOff: { tableCol.setChOff(str); return; }
- case TableColSpan: { tableCol.setSpan(value.toInt32(exec)); return; }
- case TableColVAlign: { tableCol.setVAlign(str); return; }
- case TableColWidth: { tableCol.setWidth(str); return; }
- }
+}
+
+void HTMLElement::tableCaptionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLTableCaptionElementImpl& tableCaption = *static_cast<HTMLTableCaptionElementImpl*>(impl());
+ if (token == TableCaptionAlign)
+ tableCaption.setAlign(str);
+}
+
+void HTMLElement::tableColSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLTableColElementImpl& tableCol = *static_cast<HTMLTableColElementImpl*>(impl());
+ switch (token) {
+ case TableColAlign: { tableCol.setAlign(str); return; }
+ case TableColCh: { tableCol.setCh(str); return; }
+ case TableColChOff: { tableCol.setChOff(str); return; }
+ case TableColSpan: { tableCol.setSpan(value.toInt32(exec)); return; }
+ case TableColVAlign: { tableCol.setVAlign(str); return; }
+ case TableColWidth: { tableCol.setWidth(str); return; }
}
- break;
- case ID_THEAD:
- case ID_TBODY:
- case ID_TFOOT: {
- HTMLTableSectionElementImpl &tableSection = static_cast<HTMLTableSectionElementImpl &>(element);
- switch (token) {
- case TableSectionAlign: { tableSection.setAlign(str); return; }
- case TableSectionCh: { tableSection.setCh(str); return; }
- case TableSectionChOff: { tableSection.setChOff(str); return; }
- case TableSectionVAlign: { tableSection.setVAlign(str); return; }
- // read-only: rows
- }
+}
+
+void HTMLElement::tableSectionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLTableSectionElementImpl& tableSection = *static_cast<HTMLTableSectionElementImpl*>(impl());
+ switch (token) {
+ case TableSectionAlign: { tableSection.setAlign(str); return; }
+ case TableSectionCh: { tableSection.setCh(str); return; }
+ case TableSectionChOff: { tableSection.setChOff(str); return; }
+ case TableSectionVAlign: { tableSection.setVAlign(str); return; }
+ // read-only: rows
}
- break;
- case ID_TR: {
- HTMLTableRowElementImpl &tableRow = static_cast<HTMLTableRowElementImpl &>(element);
- switch (token) {
- // read-only: rowIndex
- // read-only: sectionRowIndex
- // read-only: cells
- case TableRowAlign: { tableRow.setAlign(str); return; }
- case TableRowBgColor: { tableRow.setBgColor(str); return; }
- case TableRowCh: { tableRow.setCh(str); return; }
- case TableRowChOff: { tableRow.setChOff(str); return; }
- case TableRowVAlign: { tableRow.setVAlign(str); return; }
- }
+}
+
+void HTMLElement::tableRowSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLTableRowElementImpl& tableRow = *static_cast<HTMLTableRowElementImpl*>(impl());
+ switch (token) {
+ // read-only: rowIndex
+ // read-only: sectionRowIndex
+ // read-only: cells
+ case TableRowAlign: { tableRow.setAlign(str); return; }
+ case TableRowBgColor: { tableRow.setBgColor(str); return; }
+ case TableRowCh: { tableRow.setCh(str); return; }
+ case TableRowChOff: { tableRow.setChOff(str); return; }
+ case TableRowVAlign: { tableRow.setVAlign(str); return; }
}
- break;
- case ID_TH:
- case ID_TD: {
- HTMLTableCellElementImpl &tableCell = static_cast<HTMLTableCellElementImpl &>(element);
- switch (token) {
- // read-only: cellIndex
- case TableCellAbbr: { tableCell.setAbbr(str); return; }
- case TableCellAlign: { tableCell.setAlign(str); return; }
- case TableCellAxis: { tableCell.setAxis(str); return; }
- case TableCellBgColor: { tableCell.setBgColor(str); return; }
- case TableCellCh: { tableCell.setCh(str); return; }
- case TableCellChOff: { tableCell.setChOff(str); return; }
- case TableCellColSpan: { tableCell.setColSpan(value.toInt32(exec)); return; }
- case TableCellHeaders: { tableCell.setHeaders(str); return; }
- case TableCellHeight: { tableCell.setHeight(str); return; }
- case TableCellNoWrap: { tableCell.setNoWrap(value.toBoolean(exec)); return; }
- case TableCellRowSpan: { tableCell.setRowSpan(value.toInt32(exec)); return; }
- case TableCellScope: { tableCell.setScope(str); return; }
- case TableCellVAlign: { tableCell.setVAlign(str); return; }
- case TableCellWidth: { tableCell.setWidth(str); return; }
- }
+}
+
+void HTMLElement::tableCellSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLTableCellElementImpl& tableCell = *static_cast<HTMLTableCellElementImpl*>(impl());
+ switch (token) {
+ // read-only: cellIndex
+ case TableCellAbbr: { tableCell.setAbbr(str); return; }
+ case TableCellAlign: { tableCell.setAlign(str); return; }
+ case TableCellAxis: { tableCell.setAxis(str); return; }
+ case TableCellBgColor: { tableCell.setBgColor(str); return; }
+ case TableCellCh: { tableCell.setCh(str); return; }
+ case TableCellChOff: { tableCell.setChOff(str); return; }
+ case TableCellColSpan: { tableCell.setColSpan(value.toInt32(exec)); return; }
+ case TableCellHeaders: { tableCell.setHeaders(str); return; }
+ case TableCellHeight: { tableCell.setHeight(str); return; }
+ case TableCellNoWrap: { tableCell.setNoWrap(value.toBoolean(exec)); return; }
+ case TableCellRowSpan: { tableCell.setRowSpan(value.toInt32(exec)); return; }
+ case TableCellScope: { tableCell.setScope(str); return; }
+ case TableCellVAlign: { tableCell.setVAlign(str); return; }
+ case TableCellWidth: { tableCell.setWidth(str); return; }
}
- break;
- case ID_FRAMESET: {
- HTMLFrameSetElementImpl &frameSet = static_cast<HTMLFrameSetElementImpl &>(element);
- switch (token) {
- case FrameSetCols: { frameSet.setCols(str); return; }
- case FrameSetRows: { frameSet.setRows(str); return; }
- }
+}
+
+void HTMLElement::frameSetSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLFrameSetElementImpl& frameSet = *static_cast<HTMLFrameSetElementImpl*>(impl());
+ switch (token) {
+ case FrameSetCols: { frameSet.setCols(str); return; }
+ case FrameSetRows: { frameSet.setRows(str); return; }
}
- break;
- case ID_FRAME: {
- HTMLFrameElementImpl &frameElement = static_cast<HTMLFrameElementImpl &>(element);
- switch (token) {
- // read-only: FrameContentDocument:
- case FrameFrameBorder: { frameElement.setFrameBorder(str); return; }
- case FrameLongDesc: { frameElement.setLongDesc(str); return; }
- case FrameMarginHeight: { frameElement.setMarginHeight(str); return; }
- case FrameMarginWidth: { frameElement.setMarginWidth(str); return; }
- case FrameName: { frameElement.setName(str); return; }
- case FrameNoResize: { frameElement.setNoResize(value.toBoolean(exec)); return; }
- case FrameScrolling: { frameElement.setScrolling(str); return; }
- case FrameSrc: { frameElement.setSrc(str); return; }
- case FrameLocation: { frameElement.setLocation(str); return; }
- }
+}
+
+void HTMLElement::frameSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLFrameElementImpl& frameElement = *static_cast<HTMLFrameElementImpl*>(impl());
+ switch (token) {
+ // read-only: FrameContentDocument:
+ case FrameFrameBorder: { frameElement.setFrameBorder(str); return; }
+ case FrameLongDesc: { frameElement.setLongDesc(str); return; }
+ case FrameMarginHeight: { frameElement.setMarginHeight(str); return; }
+ case FrameMarginWidth: { frameElement.setMarginWidth(str); return; }
+ case FrameName: { frameElement.setName(str); return; }
+ case FrameNoResize: { frameElement.setNoResize(value.toBoolean(exec)); return; }
+ case FrameScrolling: { frameElement.setScrolling(str); return; }
+ case FrameSrc: { frameElement.setSrc(str); return; }
+ case FrameLocation: { frameElement.setLocation(str); return; }
}
- break;
- case ID_IFRAME: {
- HTMLIFrameElementImpl &iFrame = static_cast<HTMLIFrameElementImpl &>(element);
- switch (token) {
- case IFrameAlign: { iFrame.setAlign(str); return; }
- // read-only: IFrameContentDocument
- case IFrameFrameBorder: { iFrame.setFrameBorder(str); return; }
- case IFrameHeight: { iFrame.setHeight(str); return; }
- case IFrameLongDesc: { iFrame.setLongDesc(str); return; }
- case IFrameMarginHeight: { iFrame.setMarginHeight(str); return; }
- case IFrameMarginWidth: { iFrame.setMarginWidth(str); return; }
- case IFrameName: { iFrame.setName(str); return; }
- case IFrameScrolling: { iFrame.setScrolling(str); return; }
- case IFrameSrc: { iFrame.setSrc(str); return; }
- case IFrameWidth: { iFrame.setWidth(str); return; }
- }
- break;
+}
+
+void HTMLElement::iFrameSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ HTMLIFrameElementImpl& iFrame = *static_cast<HTMLIFrameElementImpl*>(impl());
+ switch (token) {
+ case IFrameAlign: { iFrame.setAlign(str); return; }
+ // read-only: IFrameContentDocument
+ case IFrameFrameBorder: { iFrame.setFrameBorder(str); return; }
+ case IFrameHeight: { iFrame.setHeight(str); return; }
+ case IFrameLongDesc: { iFrame.setLongDesc(str); return; }
+ case IFrameMarginHeight: { iFrame.setMarginHeight(str); return; }
+ case IFrameMarginWidth: { iFrame.setMarginWidth(str); return; }
+ case IFrameName: { iFrame.setName(str); return; }
+ case IFrameScrolling: { iFrame.setScrolling(str); return; }
+ case IFrameSrc: { iFrame.setSrc(str); return; }
+ case IFrameWidth: { iFrame.setWidth(str); return; }
}
- }
+}
- // generic properties
- switch (token) {
- case ElementId:
- element.setId(str);
- return;
- case ElementTitle:
- element.setTitle(str);
- return;
- case ElementLang:
- element.setLang(str);
- return;
- case ElementDir:
- element.setDir(str);
- return;
- case ElementClassName:
- element.setClassName(str);
- return;
- case ElementInnerHTML:
- element.setInnerHTML(str, exception);
- return;
- case ElementInnerText:
- element.setInnerText(str, exception);
- return;
- case ElementOuterHTML:
- element.setOuterHTML(str, exception);
- return;
- case ElementOuterText:
- element.setOuterText(str, exception);
- return;
- case ElementContentEditable:
- element.setContentEditable(str);
- return;
- default:
- kdWarning() << "KJS::HTMLElement::putValue unhandled token " << token << " thisTag=" << element.tagName().string() << " str=" << str.string() << endl;
- }
+void HTMLElement::marqueeSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str)
+{
+ // FIXME: Find out what WinIE supports and implement it.
+}
+
+void HTMLElement::putValue(ExecState *exec, int token, const Value& value, int)
+{
+ DOMExceptionTranslator exception(exec);
+ DOM::DOMString str = value.isA(NullType) ? DOM::DOMString() : value.toString(exec).string();
+
+ // Check our set of generic properties first.
+ HTMLElementImpl &element = *static_cast<HTMLElementImpl *>(impl());
+ switch (token) {
+ case ElementId:
+ element.setId(str);
+ return;
+ case ElementTitle:
+ element.setTitle(str);
+ return;
+ case ElementLang:
+ element.setLang(str);
+ return;
+ case ElementDir:
+ element.setDir(str);
+ return;
+ case ElementClassName:
+ element.setClassName(str);
+ return;
+ case ElementInnerHTML:
+ element.setInnerHTML(str, exception);
+ return;
+ case ElementInnerText:
+ element.setInnerText(str, exception);
+ return;
+ case ElementOuterHTML:
+ element.setOuterHTML(str, exception);
+ return;
+ case ElementOuterText:
+ element.setOuterText(str, exception);
+ return;
+ case ElementContentEditable:
+ element.setContentEditable(str);
+ return;
+ }
+
+ // Now check for properties that apply to a specific element type.
+ const Accessors* info = getSetInfo();
+ if (info && info->m_setter)
+ return (this->*(info->m_setter))(exec, token, value, str);
}
HTMLElementImpl *toHTMLElement(ValueImp *val)
@@ -3113,23 +3274,17 @@
HTMLTableCaptionElementImpl *toHTMLTableCaptionElement(ValueImp *val)
{
- if (HTMLElementImpl *e = toHTMLElement(val))
- switch (e->id()) {
- case ID_CAPTION:
- return static_cast<HTMLTableCaptionElementImpl *>(e);
- }
+ HTMLElementImpl *e = toHTMLElement(val);
+ if (e && e->hasTagName(HTMLNames::caption()))
+ return static_cast<HTMLTableCaptionElementImpl *>(e);
return 0;
}
HTMLTableSectionElementImpl *toHTMLTableSectionElement(ValueImp *val)
{
- if (HTMLElementImpl *e = toHTMLElement(val))
- switch (e->id()) {
- case ID_THEAD:
- case ID_TBODY:
- case ID_TFOOT:
- return static_cast<HTMLTableSectionElementImpl *>(e);
- }
+ HTMLElementImpl *e = toHTMLElement(val);
+ if (e && (e->hasTagName(HTMLNames::thead()) || e->hasTagName(HTMLNames::tbody()) || e->hasTagName(HTMLNames::tfoot())))
+ return static_cast<HTMLTableSectionElementImpl *>(e);
return 0;
}
@@ -3178,10 +3333,10 @@
else if (propertyName == "selectedIndex") {
// NON-STANDARD options.selectedIndex
NodeImpl *option = collection.item(0);
- if (option->id() == ID_OPTION) {
+ if (option->hasTagName(HTMLNames::option())) {
NodeImpl *select = option;
while ((select = select->parentNode()))
- if (select->id() == ID_SELECT)
+ if (select->hasTagName(HTMLNames::select()))
return Number(static_cast<HTMLSelectElementImpl *>(select)->selectedIndex());
}
return Undefined();
@@ -3369,7 +3524,7 @@
// is v an option element ?
NodeImpl *option = toNode(value);
- if (!option || option->id() != ID_OPTION)
+ if (!option || !option->hasTagName(HTMLNames::option()))
return;
int exception = 0;
1.50 +125 -0 WebCore/khtml/ecma/kjs_html.h
Index: kjs_html.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_html.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- kjs_html.h 3 Jul 2005 10:47:56 -0000 1.49
+++ kjs_html.h 9 Jul 2005 20:19:05 -0000 1.50
@@ -85,6 +85,131 @@
caption_info, col_info, tablesection_info, tr_info,
tablecell_info, frameSet_info, frame_info, iFrame_info, marquee_info;
+ // FIXME: Might make sense to combine this with ClassInfo some day.
+ typedef Value (HTMLElement::*GetterFunction)(ExecState *exec, int token) const;
+ typedef void (HTMLElement::*SetterFunction)(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ struct Accessors { GetterFunction m_getter; SetterFunction m_setter; };
+ const Accessors* getSetInfo() const;
+ static const Accessors html_accessors, head_accessors, link_accessors, title_accessors,
+ meta_accessors, base_accessors, isIndex_accessors, style_accessors, body_accessors, form_accessors,
+ select_accessors, optGroup_accessors, option_accessors, input_accessors, textArea_accessors,
+ button_accessors, label_accessors, fieldSet_accessors, legend_accessors, ul_accessors, ol_accessors,
+ dl_accessors, dir_accessors, menu_accessors, li_accessors, div_accessors, p_accessors, heading_accessors,
+ blockQuote_accessors, q_accessors, pre_accessors, br_accessors, baseFont_accessors, font_accessors,
+ hr_accessors, mod_accessors, a_accessors, canvas_accessors, img_accessors, object_accessors, param_accessors,
+ applet_accessors, map_accessors, area_accessors, script_accessors, table_accessors,
+ caption_accessors, col_accessors, tablesection_accessors, tr_accessors,
+ tablecell_accessors, frameSet_accessors, frame_accessors, iFrame_accessors, marquee_accessors;
+
+ Value htmlGetter(ExecState* exec, int token) const;
+ void htmlSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value headGetter(ExecState* exec, int token) const;
+ void headSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value linkGetter(ExecState* exec, int token) const;
+ void linkSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value titleGetter(ExecState* exec, int token) const;
+ void titleSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value metaGetter(ExecState* exec, int token) const;
+ void metaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value baseGetter(ExecState* exec, int token) const;
+ void baseSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value isIndexGetter(ExecState* exec, int token) const;
+ void isIndexSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value styleGetter(ExecState* exec, int token) const;
+ void styleSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value bodyGetter(ExecState* exec, int token) const;
+ void bodySetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value formGetter(ExecState* exec, int token) const;
+ void formSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value selectGetter(ExecState* exec, int token) const;
+ void selectSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value optGroupGetter(ExecState* exec, int token) const;
+ void optGroupSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value optionGetter(ExecState* exec, int token) const;
+ void optionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value inputGetter(ExecState* exec, int token) const;
+ void inputSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value textAreaGetter(ExecState* exec, int token) const;
+ void textAreaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value buttonGetter(ExecState* exec, int token) const;
+ void buttonSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value labelGetter(ExecState* exec, int token) const;
+ void labelSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value fieldSetGetter(ExecState* exec, int token) const;
+ void fieldSetSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value legendGetter(ExecState* exec, int token) const;
+ void legendSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value uListGetter(ExecState* exec, int token) const;
+ void uListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value oListGetter(ExecState* exec, int token) const;
+ void oListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value dListGetter(ExecState* exec, int token) const;
+ void dListSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value dirGetter(ExecState* exec, int token) const;
+ void dirSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value menuGetter(ExecState* exec, int token) const;
+ void menuSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value liGetter(ExecState* exec, int token) const;
+ void liSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value divGetter(ExecState* exec, int token) const;
+ void divSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value paragraphGetter(ExecState* exec, int token) const;
+ void paragraphSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value headingGetter(ExecState* exec, int token) const;
+ void headingSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value blockQuoteGetter(ExecState* exec, int token) const;
+ void blockQuoteSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value quoteGetter(ExecState* exec, int token) const;
+ void quoteSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value preGetter(ExecState* exec, int token) const;
+ void preSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value brGetter(ExecState* exec, int token) const;
+ void brSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value baseFontGetter(ExecState* exec, int token) const;
+ void baseFontSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value fontGetter(ExecState* exec, int token) const;
+ void fontSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value hrGetter(ExecState* exec, int token) const;
+ void hrSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value modGetter(ExecState* exec, int token) const;
+ void modSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value anchorGetter(ExecState* exec, int token) const;
+ void anchorSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value imageGetter(ExecState* exec, int token) const;
+ void imageSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value objectGetter(ExecState* exec, int token) const;
+ void objectSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value paramGetter(ExecState* exec, int token) const;
+ void paramSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value appletGetter(ExecState* exec, int token) const;
+ void appletSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value mapGetter(ExecState* exec, int token) const;
+ void mapSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value areaGetter(ExecState* exec, int token) const;
+ void areaSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value scriptGetter(ExecState* exec, int token) const;
+ void scriptSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value tableGetter(ExecState* exec, int token) const;
+ void tableSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value tableCaptionGetter(ExecState* exec, int token) const;
+ void tableCaptionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value tableColGetter(ExecState* exec, int token) const;
+ void tableColSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value tableSectionGetter(ExecState* exec, int token) const;
+ void tableSectionSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value tableRowGetter(ExecState* exec, int token) const;
+ void tableRowSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value tableCellGetter(ExecState* exec, int token) const;
+ void tableCellSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value frameSetGetter(ExecState* exec, int token) const;
+ void frameSetSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value frameGetter(ExecState* exec, int token) const;
+ void frameSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value iFrameGetter(ExecState* exec, int token) const;
+ void iFrameSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+ Value marqueeGetter(ExecState* exec, int token) const;
+ void marqueeSetter(ExecState *exec, int token, const Value& value, const DOM::DOMString& str);
+
enum { HtmlVersion, HeadProfile, LinkHref, LinkRel, LinkMedia,
LinkCharset, LinkDisabled, LinkHrefLang, LinkRev, LinkTarget, LinkType,
LinkSheet, TitleText, MetaName, MetaHttpEquiv, MetaContent, MetaScheme,
1.163 +0 -1 WebCore/khtml/ecma/kjs_window.cpp
Index: kjs_window.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_window.cpp,v
retrieving revision 1.162
retrieving revision 1.163
diff -u -r1.162 -r1.163
--- kjs_window.cpp 3 Jul 2005 10:47:56 -0000 1.162
+++ kjs_window.cpp 9 Jul 2005 20:19:05 -0000 1.163
@@ -68,7 +68,6 @@
#include "html/html_documentimpl.h"
#include "css/css_ruleimpl.h"
#include "css/css_stylesheetimpl.h"
-#include "misc/htmltags.h"
// Must include <cmath> instead of <math.h> because of a bug in the
// gcc 3.3 library version of <math.h> where if you include both
1.5 +15 -14 WebCore/khtml/editing/apply_style_command.cpp
Index: apply_style_command.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/apply_style_command.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- apply_style_command.cpp 5 Jul 2005 23:21:07 -0000 1.4
+++ apply_style_command.cpp 9 Jul 2005 20:19:06 -0000 1.5
@@ -33,7 +33,7 @@
#include "css/cssproperties.h"
#include "dom/dom_string.h"
#include "html/html_elementimpl.h"
-#include "misc/htmltags.h"
+#include "htmlnames.h"
#include "misc/htmlattrs.h"
#include "rendering/render_object.h"
#include "xml/dom_docimpl.h"
@@ -65,6 +65,7 @@
using DOM::Position;
using DOM::RangeImpl;
using DOM::TextImpl;
+using DOM::HTMLNames;
namespace khtml {
@@ -249,12 +250,12 @@
return false;
const HTMLElementImpl *elem = static_cast<const HTMLElementImpl *>(node);
- return elem->id() == ID_SPAN && elem->getAttribute(ATTR_CLASS) == styleSpanClassString();
+ return elem->hasLocalName(HTMLNames::span()) && elem->getAttribute(ATTR_CLASS) == styleSpanClassString();
}
static bool isEmptyStyleSpan(const NodeImpl *node)
{
- if (!node || !node->isHTMLElement() || node->id() != ID_SPAN)
+ if (!node || !node->isHTMLElement() || !node->hasTagName(HTMLNames::span()))
return false;
const HTMLElementImpl *elem = static_cast<const HTMLElementImpl *>(node);
@@ -264,7 +265,7 @@
static bool isEmptyFontTag(const NodeImpl *node)
{
- if (!node || node->id() != ID_FONT)
+ if (!node || !node->hasTagName(HTMLNames::font()))
return false;
const ElementImpl *elem = static_cast<const ElementImpl *>(node);
@@ -275,7 +276,7 @@
static ElementImpl *createFontElement(DocumentImpl *document)
{
int exceptionCode = 0;
- ElementImpl *fontNode = document->createHTMLElement("font", exceptionCode);
+ ElementImpl *fontNode = document->createElementNS(HTMLNames::xhtmlNamespaceURI(), "font", exceptionCode);
ASSERT(exceptionCode == 0);
fontNode->setAttribute(ATTR_CLASS, styleSpanClassString());
return fontNode;
@@ -284,7 +285,7 @@
ElementImpl *createStyleSpanElement(DocumentImpl *document)
{
int exceptionCode = 0;
- ElementImpl *styleElement = document->createHTMLElement("SPAN", exceptionCode);
+ ElementImpl *styleElement = document->createElementNS(HTMLNames::xhtmlNamespaceURI(), "span", exceptionCode);
ASSERT(exceptionCode == 0);
styleElement->setAttribute(ATTR_CLASS, styleSpanClassString());
return styleElement;
@@ -586,7 +587,7 @@
// the current group.
if (node == end.node() ||
runStart->parentNode() != next->parentNode() ||
- (next->isHTMLElement() && next->id() != ID_BR) ||
+ (next->isElementNode() && !next->hasTagName(HTMLNames::br())) ||
(next->renderer() && !next->renderer()->isInline()))
break;
node = next;
@@ -611,11 +612,11 @@
for (QValueListConstIterator<CSSProperty> it = style->valuesIterator(); it != end; ++it) {
switch ((*it).id()) {
case CSS_PROP_FONT_WEIGHT:
- if (elem->id() == ID_B)
+ if (elem->hasLocalName(HTMLNames::b()))
return true;
break;
case CSS_PROP_FONT_STYLE:
- if (elem->id() == ID_I)
+ if (elem->hasLocalName(HTMLNames::i()))
return true;
}
}
@@ -638,7 +639,7 @@
ASSERT(style);
ASSERT(elem);
- if (elem->id() != ID_FONT)
+ if (!elem->hasLocalName(HTMLNames::font()))
return;
int exceptionCode = 0;
@@ -1047,7 +1048,7 @@
ElementImpl *firstElement = static_cast<ElementImpl *>(first);
ElementImpl *secondElement = static_cast<ElementImpl *>(second);
- if (firstElement->id() != secondElement->id())
+ if (!firstElement->tagName().matches(secondElement->tagName()))
return false;
NamedAttrMapImpl *firstMap = firstElement->attributes();
@@ -1129,7 +1130,7 @@
endOffset = parentLastOffset;
}
- if (!endNode->isElementNode() || endNode->id() == ID_BR)
+ if (!endNode->isElementNode() || endNode->hasTagName(HTMLNames::br()))
return false;
NodeImpl *nextSibling = endNode->nextSibling();
@@ -1274,14 +1275,14 @@
}
if (styleChange.applyBold()) {
- ElementImpl *boldElement = document()->createHTMLElement("B", exceptionCode);
+ ElementImpl *boldElement = document()->createElementNS(HTMLNames::xhtmlNamespaceURI(), "b", exceptionCode);
ASSERT(exceptionCode == 0);
insertNodeBefore(boldElement, startNode);
surroundNodeRangeWithElement(startNode, endNode, boldElement);
}
if (styleChange.applyItalic()) {
- ElementImpl *italicElement = document()->createHTMLElement("I", exceptionCode);
+ ElementImpl *italicElement = document()->createElementNS(HTMLNames::xhtmlNamespaceURI(), "i", exceptionCode);
ASSERT(exceptionCode == 0);
insertNodeBefore(italicElement, startNode);
surroundNodeRangeWithElement(startNode, endNode, italicElement);
1.2 +3 -2 WebCore/khtml/editing/break_blockquote_command.cpp
Index: break_blockquote_command.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/break_blockquote_command.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- break_blockquote_command.cpp 24 May 2005 07:21:47 -0000 1.1
+++ break_blockquote_command.cpp 9 Jul 2005 20:19:07 -0000 1.2
@@ -28,7 +28,7 @@
#include "htmlediting.h"
#include "visible_position.h"
-#include "misc/htmltags.h"
+#include "htmlnames.h"
#include "xml/dom_elementimpl.h"
#include "xml/dom_textimpl.h"
@@ -43,6 +43,7 @@
using DOM::NodeImpl;
using DOM::Position;
using DOM::TextImpl;
+using DOM::HTMLNames;
namespace khtml {
@@ -146,7 +147,7 @@
bool startIsBR = false;
if (startNode != topBlockquote) {
NodeImpl *n = startNode;
- startIsBR = n->id() == ID_BR;
+ startIsBR = n->hasTagName(HTMLNames::br());
if (startIsBR)
n = n->nextSibling();
while (n) {
1.4 +8 -7 WebCore/khtml/editing/composite_edit_command.cpp
Index: composite_edit_command.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/composite_edit_command.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- composite_edit_command.cpp 24 May 2005 07:21:47 -0000 1.3
+++ composite_edit_command.cpp 9 Jul 2005 20:19:07 -0000 1.4
@@ -47,7 +47,7 @@
#include "wrap_contents_in_dummy_span_command.h"
#include "misc/htmlattrs.h"
-#include "misc/htmltags.h"
+#include "htmlnames.h"
#include "rendering/render_text.h"
#include "xml/dom2_rangeimpl.h"
#include "xml/dom_textimpl.h"
@@ -67,6 +67,7 @@
using DOM::Position;
using DOM::RangeImpl;
using DOM::TextImpl;
+using DOM::HTMLNames;
namespace khtml {
@@ -127,14 +128,14 @@
void CompositeEditCommand::insertNodeBefore(NodeImpl *insertChild, NodeImpl *refChild)
{
- ASSERT(refChild->id() != ID_BODY);
+ ASSERT(!refChild->hasTagName(HTMLNames::body()));
EditCommandPtr cmd(new InsertNodeBeforeCommand(document(), insertChild, refChild));
applyCommandToComposite(cmd);
}
void CompositeEditCommand::insertNodeAfter(NodeImpl *insertChild, NodeImpl *refChild)
{
- ASSERT(refChild->id() != ID_BODY);
+ ASSERT(!refChild->hasTagName(HTMLNames::body()));
if (refChild->parentNode()->lastChild() == refChild) {
appendNode(insertChild, refChild->parentNode());
}
@@ -545,7 +546,7 @@
// additional level of quoting.
NodeImpl *startBlock = paragraphStart.node()->enclosingBlockFlowElement();
NodeImpl *newBlock = 0;
- if (startBlock->id() == ID_BODY || (isMailBlockquote(startBlock) && paragraphStart.node() != startBlock))
+ if (startBlock->hasTagName(HTMLNames::body()) || (isMailBlockquote(startBlock) && paragraphStart.node() != startBlock))
newBlock = createDefaultParagraphElement(document());
else
newBlock = startBlock->cloneNode(false);
@@ -555,10 +556,10 @@
moveNode = moveNode->traverseNextNode();
NodeImpl *endNode = paragraphEnd.node();
- if (paragraphStart.node()->id() == ID_BODY) {
+ if (paragraphStart.node()->hasTagName(HTMLNames::body())) {
insertNodeAt(newBlock, paragraphStart.node(), 0);
}
- else if (paragraphStart.node()->id() == ID_BR) {
+ else if (paragraphStart.node()->hasTagName(HTMLNames::br())) {
insertNodeAfter(newBlock, paragraphStart.node());
}
else {
@@ -578,7 +579,7 @@
ElementImpl *createBlockPlaceholderElement(DocumentImpl *document)
{
int exceptionCode = 0;
- ElementImpl *breakNode = document->createHTMLElement("br", exceptionCode);
+ ElementImpl *breakNode = document->createElementNS(HTMLNames::xhtmlNamespaceURI(), "br", exceptionCode);
ASSERT(exceptionCode == 0);
breakNode->setAttribute(ATTR_CLASS, blockPlaceholderClassString());
return breakNode;
1.5 +14 -9 WebCore/khtml/editing/delete_selection_command.cpp
Index: delete_selection_command.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/delete_selection_command.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- delete_selection_command.cpp 5 Jul 2005 23:21:07 -0000 1.4
+++ delete_selection_command.cpp 9 Jul 2005 20:19:07 -0000 1.5
@@ -28,7 +28,7 @@
#include "css/css_computedstyle.h"
#include "htmlediting.h"
#include "khtml_part.h"
-#include "misc/htmltags.h"
+#include "htmlnames.h"
#include "rendering/render_line.h"
#include "rendering/render_object.h"
#include "visible_text.h"
@@ -53,6 +53,7 @@
using DOM::Position;
using DOM::RangeImpl;
using DOM::TextImpl;
+using DOM::HTMLNames;
namespace khtml {
@@ -61,9 +62,13 @@
// FIXME: Irritating that we can get away with just going at the render tree for isTableStructureNode,
// but here we also have to peek at the type of DOM node?
RenderObject *r = node->renderer();
- NodeImpl::Id nodeID = node->id();
return (r && r->isListItem())
- || (nodeID == ID_OL || nodeID == ID_UL || nodeID == ID_DD || nodeID == ID_DT || nodeID == ID_DIR || nodeID == ID_MENU);
+ || node->hasTagName(HTMLNames::ol())
+ || node->hasTagName(HTMLNames::ul())
+ || node->hasTagName(HTMLNames::dd())
+ || node->hasTagName(HTMLNames::dt())
+ || node->hasTagName(HTMLNames::dir())
+ || node->hasTagName(HTMLNames::menu());
}
static int maxDeepOffset(NodeImpl *n)
@@ -277,8 +282,8 @@
bool DeleteSelectionCommand::handleSpecialCaseBRDelete()
{
// Check for special-case where the selection contains only a BR on a line by itself after another BR.
- bool upstreamStartIsBR = m_startNode->id() == ID_BR;
- bool downstreamStartIsBR = m_downstreamStart.node()->id() == ID_BR;
+ bool upstreamStartIsBR = m_startNode->hasTagName(HTMLNames::br());
+ bool downstreamStartIsBR = m_downstreamStart.node()->hasTagName(HTMLNames::br());
bool isBROnLineByItself = upstreamStartIsBR && downstreamStartIsBR && m_downstreamStart.node() == m_upstreamEnd.node();
if (isBROnLineByItself) {
removeNode(m_downstreamStart.node());
@@ -326,11 +331,11 @@
// end of a block other than the block containing the selection start, then do not delete the
// start block, otherwise delete the start block.
// A similar case is provided to cover selections starting in BR elements.
- if (startOffset == 1 && m_startNode && m_startNode->id() == ID_BR) {
+ if (startOffset == 1 && m_startNode && m_startNode->hasTagName(HTMLNames::br())) {
setStartNode(m_startNode->traverseNextNode());
startOffset = 0;
}
- if (m_startBlock != m_endBlock && startOffset == 0 && m_startNode && m_startNode->id() == ID_BR && endAtEndOfBlock) {
+ if (m_startBlock != m_endBlock && startOffset == 0 && m_startNode && m_startNode->hasTagName(HTMLNames::br()) && endAtEndOfBlock) {
// Don't delete the BR element
setStartNode(m_startNode->traverseNextNode());
}
@@ -552,7 +557,7 @@
NodeImpl *moveNode = node;
node = node->nextSibling();
removeNode(moveNode);
- if (moveNode->id() == ID_BR && !moveNode->renderer()) {
+ if (moveNode->hasTagName(HTMLNames::br()) && !moveNode->renderer()) {
// Just remove this node, and don't put it back.
// If the BR was not rendered (since it was at the end of a block, for instance),
// putting it back in the document might make it appear, and that is not desirable.
@@ -563,7 +568,7 @@
else
insertNodeAfter(moveNode, refNode);
refNode = moveNode;
- if (moveNode->id() == ID_BR)
+ if (moveNode->hasTagName(HTMLNames::br()))
break;
}
1.250 +7 -6 WebCore/khtml/editing/htmlediting.cpp
Index: htmlediting.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/htmlediting.cpp,v
retrieving revision 1.249
retrieving revision 1.250
diff -u -r1.249 -r1.250
--- htmlediting.cpp 5 Jul 2005 23:21:08 -0000 1.249
+++ htmlediting.cpp 9 Jul 2005 20:19:07 -0000 1.250
@@ -42,7 +42,7 @@
#include "html_imageimpl.h"
#include "html_interchange.h"
#include "htmlattrs.h"
-#include "htmltags.h"
+#include "htmlnames.h"
#include "khtml_part.h"
#include "khtml_part.h"
#include "khtmlview.h"
@@ -81,6 +81,7 @@
using DOM::RangeImpl;
using DOM::TextImpl;
using DOM::TreeWalkerImpl;
+using DOM::HTMLNames;
#if APPLE_CHANGES
#include "KWQAssertions.h"
@@ -131,10 +132,10 @@
if (!n->isHTMLElement())
return false;
- if (n->id() == ID_A && n->isLink())
+ if (n->isLink())
return true;
- if (n->id() == ID_UL || n->id() == ID_OL || n->id() == ID_DL)
+ if (n->hasTagName(HTMLNames::ul()) || n->hasTagName(HTMLNames::ol()) || n->hasTagName(HTMLNames::dl()))
return true;
RenderObject *renderer = n->renderer();
@@ -267,7 +268,7 @@
// We would need this margin-zeroing code back if we ever return to using <p> elements for default paragraphs.
// static const DOMString defaultParagraphStyle("margin-top: 0; margin-bottom: 0");
int exceptionCode = 0;
- ElementImpl *element = document->createHTMLElement("div", exceptionCode);
+ ElementImpl *element = document->createElementNS(HTMLNames::xhtmlNamespaceURI(), "div", exceptionCode);
ASSERT(exceptionCode == 0);
return element;
}
@@ -275,7 +276,7 @@
ElementImpl *createBreakElement(DocumentImpl *document)
{
int exceptionCode = 0;
- ElementImpl *breakNode = document->createHTMLElement("br", exceptionCode);
+ ElementImpl *breakNode = document->createElementNS(HTMLNames::xhtmlNamespaceURI(), "br", exceptionCode);
ASSERT(exceptionCode == 0);
return breakNode;
}
@@ -303,7 +304,7 @@
bool isMailBlockquote(const NodeImpl *node)
{
- if (!node || !node->renderer() || !node->isElementNode() && node->id() != ID_BLOCKQUOTE)
+ if (!node || !node->renderer() || !node->isElementNode() && !node->hasTagName(HTMLNames::blockquote()))
return false;
return static_cast<const ElementImpl *>(node)->getAttribute("type") == "cite";
1.2 +4 -3 WebCore/khtml/editing/insert_line_break_command.cpp
Index: insert_line_break_command.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/insert_line_break_command.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- insert_line_break_command.cpp 24 May 2005 07:21:47 -0000 1.1
+++ insert_line_break_command.cpp 9 Jul 2005 20:19:07 -0000 1.2
@@ -29,7 +29,7 @@
#include "visible_position.h"
#include "visible_units.h"
-#include "misc/htmltags.h"
+#include "htmlnames.h"
#include "xml/dom_docimpl.h"
#include "xml/dom_elementimpl.h"
#include "xml/dom2_rangeimpl.h"
@@ -50,6 +50,7 @@
using DOM::Position;
using DOM::TextImpl;
using DOM::CSSMutableStyleDeclarationImpl;
+using DOM::HTMLNames;
namespace khtml {
@@ -111,13 +112,13 @@
// This makes the "real" BR we want to insert appear in the rendering without any
// significant side effects (and no real worries either since you can't arrow past
// this extra one.
- if (pos.node()->id() == ID_BR && pos.offset() == 0) {
+ if (pos.node()->hasTagName(HTMLNames::br()) && pos.offset() == 0) {
// Already placed in a trailing BR. Insert "real" BR before it and leave the selection alone.
insertNodeBefore(nodeToInsert, pos.node());
}
else {
NodeImpl *next = pos.node()->traverseNextNode();
- bool hasTrailingBR = next && next->id() == ID_BR && pos.node()->enclosingBlockFlowElement() == next->enclosingBlockFlowElement();
+ bool hasTrailingBR = next && next->hasTagName(HTMLNames::br()) && pos.node()->enclosingBlockFlowElement() == next->enclosingBlockFlowElement();
insertNodeAfterPosition(nodeToInsert, pos);
if (hasTrailingBR) {
setEndingSelection(Selection(Position(next, 0), DOWNSTREAM));
1.2 +3 -2 WebCore/khtml/editing/insert_paragraph_separator_command.cpp
Index: insert_paragraph_separator_command.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/insert_paragraph_separator_command.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- insert_paragraph_separator_command.cpp 24 May 2005 07:21:47 -0000 1.1
+++ insert_paragraph_separator_command.cpp 9 Jul 2005 20:19:07 -0000 1.2
@@ -31,7 +31,7 @@
#include "css/css_computedstyle.h"
#include "css/css_valueimpl.h"
-#include "misc/htmltags.h"
+#include "htmlnames.h"
#include "xml/dom_docimpl.h"
#include "xml/dom_elementimpl.h"
#include "xml/dom_textimpl.h"
@@ -50,6 +50,7 @@
using DOM::NodeImpl;
using DOM::Position;
using DOM::TextImpl;
+using DOM::HTMLNames;
namespace khtml {
@@ -213,7 +214,7 @@
// then this <br> will collapse away when we add a block after it. Add an extra <br>.
if (!document()->inStrictMode()) {
Position upstreamPos = pos.upstream();
- if (upstreamPos.node()->id() == ID_BR)
+ if (upstreamPos.node()->hasTagName(HTMLNames::br()))
insertNodeAfter(createBreakElement(document()), upstreamPos.node());
}
1.24 +25 -18 WebCore/khtml/editing/markup.cpp
Index: markup.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/markup.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- markup.cpp 5 Jul 2005 23:21:08 -0000 1.23
+++ markup.cpp 9 Jul 2005 20:19:07 -0000 1.24
@@ -36,8 +36,7 @@
#include "xml/dom2_rangeimpl.h"
#include "rendering/render_text.h"
#include "misc/htmlattrs.h"
-#include "misc/htmltags.h"
-#include "html/dtd.h"
+#include "htmlnames.h"
using DOM::AttributeImpl;
using DOM::CommentImpl;
@@ -47,9 +46,9 @@
using DOM::DocumentImpl;
using DOM::DOMString;
using DOM::ElementImpl;
-using DOM::FORBIDDEN;
-using DOM::endTagRequirement;
+using DOM::TagStatusForbidden;
using DOM::HTMLElementImpl;
+using DOM::HTMLNames;
using DOM::NamedAttrMapImpl;
using DOM::Node;
using DOM::NodeImpl;
@@ -177,13 +176,11 @@
switch (type) {
case Node::TEXT_NODE: {
if (node->parentNode()) {
- switch (node->parentNode()->id()) {
- case ID_PRE:
- case ID_SCRIPT:
- case ID_STYLE:
- case ID_TEXTAREA:
- return stringValueForRange(node, range);
- }
+ if (node->parentNode()->hasTagName(HTMLNames::pre()) ||
+ node->parentNode()->hasTagName(HTMLNames::script()) ||
+ node->parentNode()->hasTagName(HTMLNames::style()) ||
+ node->parentNode()->hasTagName(HTMLNames::textarea()))
+ return stringValueForRange(node, range);
}
QString markup = annotate ? escapeHTML(renderedText(node, range)) : escapeHTML(stringValueForRange(node, range));
if (defaultStyle) {
@@ -248,9 +245,13 @@
static QString endMarkup(const NodeImpl *node)
{
- if ((!node->isHTMLElement() || endTagRequirement(node->id()) != FORBIDDEN) && node->nodeType() != Node::TEXT_NODE && node->nodeType() != Node::DOCUMENT_NODE) {
- return "</" + node->nodeName().string() + ">";
+ bool hasEndTag = node->isElementNode();
+ if (node->isHTMLElement()) {
+ const HTMLElementImpl* htmlElt = static_cast<const HTMLElementImpl*>(node);
+ hasEndTag = (htmlElt->endTagRequirement() != TagStatusForbidden);
}
+ if (hasEndTag)
+ return "</" + node->nodeName().string() + ">";
return "";
}
@@ -265,8 +266,14 @@
nodes->append(current);
}
me += startMarkup(current, 0, DoNotAnnotateForInterchange, 0);
- }
- if (!current->isHTMLElement() || endTagRequirement(current->id()) != FORBIDDEN) {
+ }
+
+ bool container = true;
+ if (current->isHTMLElement()) {
+ const HTMLElementImpl* h = static_cast<const HTMLElementImpl*>(current);
+ container = h->endTagRequirement() != TagStatusForbidden;
+ }
+ if (container) {
// print children
if (NodeImpl *n = current->firstChild()) {
me += markup(n, false, true, nodes);
@@ -414,9 +421,9 @@
}
bool breakAtEnd = false;
if (commonAncestorBlock == ancestor) {
- NodeImpl::Id id = ancestor->id();
// Include ancestors that are required to retain the appearance of the copied markup.
- if (id == ID_PRE || id == ID_TABLE || id == ID_OL || id == ID_UL) {
+ if (ancestor->hasTagName(HTMLNames::pre()) || ancestor->hasTagName(HTMLNames::table()) ||
+ ancestor->hasTagName(HTMLNames::ol()) || ancestor->hasTagName(HTMLNames::ul())) {
breakAtEnd = true;
} else {
break;
@@ -539,7 +546,7 @@
ElementImpl *element;
if (s.isEmpty() && list.isEmpty()) {
// For last line, use the "magic BR" rather than a P.
- element = document->createHTMLElement("br", exceptionCode);
+ element = document->createElementNS(HTMLNames::xhtmlNamespaceURI(), "br", exceptionCode);
ASSERT(exceptionCode == 0);
element->ref();
element->setAttribute(ATTR_CLASS, AppleInterchangeNewline);
1.5 +31 -53 WebCore/khtml/editing/replace_selection_command.cpp
Index: replace_selection_command.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/replace_selection_command.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- replace_selection_command.cpp 5 Jul 2005 23:21:08 -0000 1.4
+++ replace_selection_command.cpp 9 Jul 2005 20:19:07 -0000 1.5
@@ -27,7 +27,7 @@
#include "visible_position.h"
#include "misc/htmlattrs.h"
-#include "misc/htmltags.h"
+#include "htmlnames.h"
#include "xml/dom_docimpl.h"
#include "html_interchange.h"
#include "xml/dom_textimpl.h"
@@ -58,6 +58,7 @@
using DOM::HTMLElementImpl;
using DOM::CSSMutableStyleDeclarationImpl;
using DOM::Position;
+using DOM::HTMLNames;
namespace khtml {
@@ -167,30 +168,14 @@
if (!node)
return false;
- switch (node->id()) {
- case ID_BLOCKQUOTE:
- case ID_DD:
- case ID_DIV:
- case ID_DL:
- case ID_DT:
- case ID_H1:
- case ID_H2:
- case ID_H3:
- case ID_H4:
- case ID_H5:
- case ID_H6:
- case ID_HR:
- case ID_LI:
- case ID_OL:
- case ID_P:
- case ID_PRE:
- case ID_TD:
- case ID_TH:
- case ID_UL:
- return true;
- }
-
- return false;
+ // FIXME: This function seems really broken to me. It isn't even including all the block-level elements.
+ return (node->hasTagName(HTMLNames::blockquote()) || node->hasTagName(HTMLNames::dd()) || node->hasTagName(HTMLNames::div()) ||
+ node->hasTagName(HTMLNames::dl()) || node->hasTagName(HTMLNames::dt()) || node->hasTagName(HTMLNames::h1()) ||
+ node->hasTagName(HTMLNames::h2()) || node->hasTagName(HTMLNames::h3()) || node->hasTagName(HTMLNames::h4()) ||
+ node->hasTagName(HTMLNames::h5()) || node->hasTagName(HTMLNames::h6()) || node->hasTagName(HTMLNames::hr()) ||
+ node->hasTagName(HTMLNames::li()) || node->hasTagName(HTMLNames::ol()) || node->hasTagName(HTMLNames::p()) ||
+ node->hasTagName(HTMLNames::pre()) || node->hasTagName(HTMLNames::td()) || node->hasTagName(HTMLNames::th()) ||
+ node->hasTagName(HTMLNames::ul()));
}
static bool isMailPasteAsQuotationNode(const NodeImpl *node)
@@ -214,16 +199,8 @@
if (!node)
return false;
- switch (node->id()) {
- case ID_TABLE:
- case ID_TBODY:
- case ID_TD:
- case ID_TFOOT:
- case ID_THEAD:
- case ID_TR:
- return true;
- }
- return false;
+ return (node->hasTagName(HTMLNames::table()) || node->hasTagName(HTMLNames::tbody()) || node->hasTagName(HTMLNames::td()) ||
+ node->hasTagName(HTMLNames::tfoot()) || node->hasTagName(HTMLNames::thead()) || node->hasTagName(HTMLNames::tr()));
}
void ReplacementFragment::pruneEmptyNodes()
@@ -250,7 +227,7 @@
bool ReplacementFragment::isInterchangeNewlineNode(const NodeImpl *node)
{
static DOMString interchangeNewlineClassString(AppleInterchangeNewline);
- return node && node->id() == ID_BR && static_cast<const ElementImpl *>(node)->getAttribute(ATTR_CLASS) == interchangeNewlineClassString;
+ return node && node->hasTagName(HTMLNames::br()) && static_cast<const ElementImpl *>(node)->getAttribute(ATTR_CLASS) == interchangeNewlineClassString;
}
bool ReplacementFragment::isInterchangeConvertedSpaceSpan(const NodeImpl *node)
@@ -507,18 +484,19 @@
NodeImpl *next = node->traverseNextNode();
// This list of tags change the appearance of content
// in ways we can add back on later with CSS, if necessary.
- if (node->id() == ID_B ||
- node->id() == ID_BIG ||
- node->id() == ID_CENTER ||
- node->id() == ID_FONT ||
- node->id() == ID_I ||
- node->id() == ID_S ||
- node->id() == ID_SMALL ||
- node->id() == ID_STRIKE ||
- node->id() == ID_SUB ||
- node->id() == ID_SUP ||
- node->id() == ID_TT ||
- node->id() == ID_U ||
+ // FIXME: This list is incomplete
+ if (node->hasTagName(HTMLNames::b()) ||
+ node->hasTagName(HTMLNames::big()) ||
+ node->hasTagName(HTMLNames::center()) ||
+ node->hasTagName(HTMLNames::font()) ||
+ node->hasTagName(HTMLNames::i()) ||
+ node->hasTagName(HTMLNames::s()) ||
+ node->hasTagName(HTMLNames::small()) ||
+ node->hasTagName(HTMLNames::strike()) ||
+ node->hasTagName(HTMLNames::sub()) ||
+ node->hasTagName(HTMLNames::sup()) ||
+ node->hasTagName(HTMLNames::tt()) ||
+ node->hasTagName(HTMLNames::u()) ||
isStyleSpan(node)) {
removeNodePreservingChildren(node);
}
@@ -744,7 +722,7 @@
if (!linePlaceholder) {
Position downstream = startPos.downstream();
downstream = positionOutsideContainingSpecialElement(downstream);
- if (downstream.node()->id() == ID_BR && downstream.offset() == 0 &&
+ if (downstream.node()->hasTagName(HTMLNames::br()) && downstream.offset() == 0 &&
m_fragment.hasInterchangeNewlineAtEnd() &&
isStartOfLine(VisiblePosition(downstream, VP_DEFAULT_AFFINITY)))
linePlaceholder = downstream.node();
@@ -906,12 +884,12 @@
}
}
else {
- if (m_lastNodeInserted && m_lastNodeInserted->id() == ID_BR && !document()->inStrictMode()) {
+ if (m_lastNodeInserted && m_lastNodeInserted->hasTagName(HTMLNames::br()) && !document()->inStrictMode()) {
document()->updateLayout();
VisiblePosition pos(Position(m_lastNodeInserted, 1), DOWNSTREAM);
if (isEndOfBlock(pos)) {
NodeImpl *next = m_lastNodeInserted->traverseNextNode();
- bool hasTrailingBR = next && next->id() == ID_BR && m_lastNodeInserted->enclosingBlockFlowElement() == next->enclosingBlockFlowElement();
+ bool hasTrailingBR = next && next->hasTagName(HTMLNames::br()) && m_lastNodeInserted->enclosingBlockFlowElement() == next->enclosingBlockFlowElement();
if (!hasTrailingBR) {
// Insert an "extra" BR at the end of the block.
insertNodeBefore(createBreakElement(document()), m_lastNodeInserted);
@@ -938,7 +916,7 @@
insertNodeAfter(node, refNode);
refNode = node;
// We want to move the first BR we see, so check for that here.
- if (node->id() == ID_BR)
+ if (node->hasTagName(HTMLNames::br()))
break;
node = next;
}
@@ -1086,7 +1064,7 @@
// update m_lastNodeInserted
NodeImpl *old = m_lastNodeInserted;
- m_lastNodeInserted = node->lastDescendent();
+ m_lastNodeInserted = node->lastDescendant();
m_lastNodeInserted->ref();
if (old)
old->deref();
1.90 +1 -2 WebCore/khtml/editing/selection.cpp
Index: selection.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/selection.cpp,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -r1.89 -r1.90
--- selection.cpp 23 Jun 2005 19:47:48 -0000 1.89
+++ selection.cpp 9 Jul 2005 20:19:07 -0000 1.90
@@ -33,7 +33,6 @@
#include "dom/dom_string.h"
#include "khtml_part.h"
#include "khtmlview.h"
-#include "misc/htmltags.h"
#include "rendering/render_object.h"
#include "rendering/render_style.h"
#include "rendering/render_text.h"
@@ -938,7 +937,7 @@
{
if (r->node()->isElementNode()) {
ElementImpl *element = static_cast<ElementImpl *>(r->node());
- fprintf(stderr, "%s%s\n", selected ? "==> " : " ", element->tagName().string().latin1());
+ fprintf(stderr, "%s%s\n", selected ? "==> " : " ", element->localName().string().latin1());
}
else if (r->isText()) {
RenderText *textRenderer = static_cast<RenderText *>(r);
1.52 +5 -4 WebCore/khtml/editing/visible_position.cpp
Index: visible_position.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/visible_position.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- visible_position.cpp 23 Jun 2005 19:47:49 -0000 1.51
+++ visible_position.cpp 9 Jul 2005 20:19:07 -0000 1.52
@@ -26,7 +26,7 @@
#include "visible_position.h"
#include "visible_units.h"
-#include "misc/htmltags.h"
+#include "htmlnames.h"
#include "rendering/render_line.h"
#include "rendering/render_object.h"
#include "rendering/render_text.h"
@@ -50,6 +50,7 @@
using DOM::Range;
using DOM::RangeImpl;
using DOM::TextImpl;
+using DOM::HTMLNames;
namespace khtml {
@@ -74,7 +75,7 @@
m_affinity = affinity;
// For <br> 0, it's important not to move past the <br>.
- if (pos.node() && pos.node()->id() == ID_BR && pos.offset() == 0)
+ if (pos.node() && pos.node()->hasTagName(HTMLNames::br()) && pos.offset() == 0)
initUpstream(pos);
else
initDownstream(pos);
@@ -274,7 +275,7 @@
}
if (renderer->isBlockFlow() && (!renderer->firstChild() || !pos.node()->firstChild()) &&
- (renderer->height() || pos.node()->id() == ID_BODY)) {
+ (renderer->height() || pos.node()->hasTagName(HTMLNames::body()))) {
// return true for offset 0 into rendered blocks that are empty of rendered kids, but have a height
return pos.offset() == 0;
}
@@ -359,7 +360,7 @@
bool VisiblePosition::isAtomicNode(const NodeImpl *node)
{
- return node && (!node->hasChildNodes() || (node->id() == ID_OBJECT && node->renderer() && node->renderer()->isReplaced()));
+ return node && (!node->hasChildNodes() || (node->hasTagName(HTMLNames::object()) && node->renderer() && node->renderer()->isReplaced()));
}
QChar VisiblePosition::character() const
1.28 +65 -104 WebCore/khtml/editing/visible_text.cpp
Index: visible_text.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/visible_text.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- visible_text.cpp 13 May 2005 16:48:51 -0000 1.27
+++ visible_text.cpp 9 Jul 2005 20:19:07 -0000 1.28
@@ -25,7 +25,7 @@
#include "visible_text.h"
-#include "misc/htmltags.h"
+#include "htmlnames.h"
#include "rendering/render_text.h"
#include "xml/dom_nodeimpl.h"
#include "xml/dom_position.h"
@@ -37,6 +37,7 @@
using DOM::NodeImpl;
using DOM::offsetInCharacters;
using DOM::RangeImpl;
+using DOM::HTMLNames;
// FIXME: These classes should probably use the render tree and not the DOM tree, since elements could
// be hidden using CSS, or additional generated content could be added. For now, we just make sure
@@ -336,41 +337,25 @@
bool TextIterator::handleNonTextNode()
{
- switch (m_node->id()) {
- case ID_BR: {
- emitCharacter('\n', m_node->parentNode(), m_node, 0, 1);
- break;
+ if (m_node->hasTagName(HTMLNames::br())) {
+ emitCharacter('\n', m_node->parentNode(), m_node, 0, 1);
+ } else if (m_node->hasTagName(HTMLNames::td()) || m_node->hasTagName(HTMLNames::th())) {
+ if (m_lastCharacter != '\n' && m_lastTextNode) {
+ emitCharacter('\t', m_lastTextNode->parentNode(), m_lastTextNode, 0, 1);
+ }
+ } else if (m_node->hasTagName(HTMLNames::blockquote()) || m_node->hasTagName(HTMLNames::dd()) ||
+ m_node->hasTagName(HTMLNames::div()) ||
+ m_node->hasTagName(HTMLNames::dl()) || m_node->hasTagName(HTMLNames::dt()) ||
+ m_node->hasTagName(HTMLNames::h1()) || m_node->hasTagName(HTMLNames::h2()) ||
+ m_node->hasTagName(HTMLNames::h3()) || m_node->hasTagName(HTMLNames::h4()) ||
+ m_node->hasTagName(HTMLNames::h5()) || m_node->hasTagName(HTMLNames::h6()) ||
+ m_node->hasTagName(HTMLNames::hr()) || m_node->hasTagName(HTMLNames::li()) ||
+ m_node->hasTagName(HTMLNames::ol()) || m_node->hasTagName(HTMLNames::p()) ||
+ m_node->hasTagName(HTMLNames::pre()) || m_node->hasTagName(HTMLNames::tr()) ||
+ m_node->hasTagName(HTMLNames::ul())) {
+ if (m_lastCharacter != '\n' && m_lastTextNode) {
+ emitCharacter('\n', m_lastTextNode->parentNode(), m_lastTextNode, 0, 1);
}
-
- case ID_TD:
- case ID_TH:
- if (m_lastCharacter != '\n' && m_lastTextNode) {
- emitCharacter('\t', m_lastTextNode->parentNode(), m_lastTextNode, 0, 1);
- }
- break;
-
- case ID_BLOCKQUOTE:
- case ID_DD:
- case ID_DIV:
- case ID_DL:
- case ID_DT:
- case ID_H1:
- case ID_H2:
- case ID_H3:
- case ID_H4:
- case ID_H5:
- case ID_H6:
- case ID_HR:
- case ID_LI:
- case ID_OL:
- case ID_P:
- case ID_PRE:
- case ID_TR:
- case ID_UL:
- if (m_lastCharacter != '\n' && m_lastTextNode) {
- emitCharacter('\n', m_lastTextNode->parentNode(), m_lastTextNode, 0, 1);
- }
- break;
}
return true;
@@ -381,49 +366,37 @@
bool endLine = false;
bool addNewline = false;
- switch (m_node->id()) {
- case ID_BLOCKQUOTE:
- case ID_DD:
- case ID_DIV:
- case ID_DL:
- case ID_DT:
- case ID_HR:
- case ID_LI:
- case ID_OL:
- case ID_PRE:
- case ID_TR:
- case ID_UL:
- endLine = true;
- break;
-
- case ID_H1:
- case ID_H2:
- case ID_H3:
- case ID_H4:
- case ID_H5:
- case ID_H6:
- case ID_P: {
- endLine = true;
-
- // In certain cases, emit a new newline character for this node
- // regardless of whether we emit another one.
- // FIXME: Some day we could do this for other tags.
- // However, doing it just for the tags above makes it more likely
- // we'll end up getting the right result without margin collapsing.
- // For example: <div><p>text</p></div> will work right even if both
- // the <div> and the <p> have bottom margins.
- RenderObject *renderer = m_node->renderer();
- if (renderer) {
- RenderStyle *style = renderer->style();
- if (style) {
- int bottomMargin = renderer->collapsedMarginBottom();
- int fontSize = style->htmlFont().getFontDef().computedPixelSize();
- if (bottomMargin * 2 >= fontSize) {
- addNewline = true;
- }
+ if (m_node->hasTagName(HTMLNames::blockquote()) || m_node->hasTagName(HTMLNames::dd()) ||
+ m_node->hasTagName(HTMLNames::div()) ||
+ m_node->hasTagName(HTMLNames::dl()) || m_node->hasTagName(HTMLNames::dt()) ||
+ m_node->hasTagName(HTMLNames::hr()) || m_node->hasTagName(HTMLNames::li()) ||
+ m_node->hasTagName(HTMLNames::ol()) ||
+ m_node->hasTagName(HTMLNames::pre()) || m_node->hasTagName(HTMLNames::tr()) ||
+ m_node->hasTagName(HTMLNames::ul()))
+ endLine = true;
+ else if (m_node->hasTagName(HTMLNames::h1()) || m_node->hasTagName(HTMLNames::h2()) ||
+ m_node->hasTagName(HTMLNames::h3()) || m_node->hasTagName(HTMLNames::h4()) ||
+ m_node->hasTagName(HTMLNames::h5()) || m_node->hasTagName(HTMLNames::h6()) ||
+ m_node->hasTagName(HTMLNames::p())) {
+ endLine = true;
+
+ // In certain cases, emit a new newline character for this node
+ // regardless of whether we emit another one.
+ // FIXME: Some day we could do this for other tags.
+ // However, doing it just for the tags above makes it more likely
+ // we'll end up getting the right result without margin collapsing.
+ // For example: <div><p>text</p></div> will work right even if both
+ // the <div> and the <p> have bottom margins.
+ RenderObject *renderer = m_node->renderer();
+ if (renderer) {
+ RenderStyle *style = renderer->style();
+ if (style) {
+ int bottomMargin = renderer->collapsedMarginBottom();
+ int fontSize = style->htmlFont().getFontDef().computedPixelSize();
+ if (bottomMargin * 2 >= fontSize) {
+ addNewline = true;
}
}
- break;
}
}
@@ -660,34 +633,22 @@
bool SimplifiedBackwardsTextIterator::handleNonTextNode()
{
- switch (m_node->id()) {
- case ID_BR:
- emitNewlineForBROrText();
- break;
- case ID_TD:
- case ID_TH:
- case ID_BLOCKQUOTE:
- case ID_DD:
- case ID_DIV:
- case ID_DL:
- case ID_DT:
- case ID_H1:
- case ID_H2:
- case ID_H3:
- case ID_H4:
- case ID_H5:
- case ID_H6:
- case ID_HR:
- case ID_P:
- case ID_PRE:
- case ID_TR:
- case ID_OL:
- case ID_UL:
- case ID_LI:
- // Emit a space to "break up" content. Any word break
- // character will do.
- emitCharacter(' ', m_node, 0, 0);
- break;
+ if (m_node->hasTagName(HTMLNames::br()))
+ emitNewlineForBROrText();
+ else if (m_node->hasTagName(HTMLNames::td ()) || m_node->hasTagName(HTMLNames::th()) ||
+ m_node->hasTagName(HTMLNames::blockquote()) || m_node->hasTagName(HTMLNames::dd()) ||
+ m_node->hasTagName(HTMLNames::div()) ||
+ m_node->hasTagName(HTMLNames::dl()) || m_node->hasTagName(HTMLNames::dt()) ||
+ m_node->hasTagName(HTMLNames::h1()) || m_node->hasTagName(HTMLNames::h2()) ||
+ m_node->hasTagName(HTMLNames::h3()) || m_node->hasTagName(HTMLNames::h4()) ||
+ m_node->hasTagName(HTMLNames::h5()) || m_node->hasTagName(HTMLNames::h6()) ||
+ m_node->hasTagName(HTMLNames::hr()) || m_node->hasTagName(HTMLNames::li()) ||
+ m_node->hasTagName(HTMLNames::ol()) || m_node->hasTagName(HTMLNames::p()) ||
+ m_node->hasTagName(HTMLNames::pre()) || m_node->hasTagName(HTMLNames::tr()) ||
+ m_node->hasTagName(HTMLNames::ul())) {
+ // Emit a space to "break up" content. Any word break
+ // character will do.
+ emitCharacter(' ', m_node, 0, 0);
}
return true;
1.35 +3 -2 WebCore/khtml/editing/visible_units.cpp
Index: visible_units.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/editing/visible_units.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- visible_units.cpp 26 May 2005 20:30:12 -0000 1.34
+++ visible_units.cpp 9 Jul 2005 20:19:07 -0000 1.35
@@ -27,7 +27,7 @@
#include <qstring.h>
-#include "htmltags.h"
+#include "htmlnames.h"
#include "misc/helper.h"
#include "rendering/render_text.h"
#include "rendering/render_block.h"
@@ -41,6 +41,7 @@
using DOM::NodeImpl;
using DOM::Position;
using DOM::RangeImpl;
+using DOM::HTMLNames;
namespace khtml {
@@ -332,7 +333,7 @@
return VisiblePosition();
long endOffset = 1;
- if (endNode->id() == ID_BR) {
+ if (endNode->hasTagName(HTMLNames::br())) {
endOffset = 0;
} else if (endBox->isInlineTextBox()) {
InlineTextBox *endTextBox = static_cast<InlineTextBox *>(endBox);
1.73 +39 -36 WebCore/khtml/html/html_baseimpl.cpp
Index: html_baseimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_baseimpl.cpp,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- html_baseimpl.cpp 12 May 2005 17:11:21 -0000 1.72
+++ html_baseimpl.cpp 9 Jul 2005 20:19:09 -0000 1.73
@@ -48,7 +48,7 @@
using namespace khtml;
HTMLBodyElementImpl::HTMLBodyElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc), m_linkDecl(0)
+ : HTMLElementImpl(HTMLNames::body(), doc), m_linkDecl(0)
{
}
@@ -61,11 +61,6 @@
}
}
-NodeImpl::Id HTMLBodyElementImpl::id() const
-{
- return ID_BODY;
-}
-
void HTMLBodyElementImpl::createLinkDecl()
{
m_linkDecl = new CSSMutableStyleDeclarationImpl;
@@ -289,7 +284,18 @@
// -------------------------------------------------------------------------
HTMLFrameElementImpl::HTMLFrameElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::frame(), doc)
+{
+ init();
+}
+
+HTMLFrameElementImpl::HTMLFrameElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
+ : HTMLElementImpl(tagName, doc)
+{
+ init();
+}
+
+void HTMLFrameElementImpl::init()
{
m_frameBorder = true;
m_frameBorderSet = false;
@@ -303,11 +309,6 @@
{
}
-NodeImpl::Id HTMLFrameElementImpl::id() const
-{
- return ID_FRAME;
-}
-
bool HTMLFrameElementImpl::isURLAllowed(const AtomicString &URLString) const
{
if (URLString.isEmpty()) {
@@ -482,7 +483,7 @@
// inherit default settings from parent frameset
for (NodeImpl *node = parentNode(); node; node = node->parentNode())
- if (node->id() == ID_FRAMESET) {
+ if (node->hasTagName(HTMLNames::frameset())) {
HTMLFrameSetElementImpl* frameset = static_cast<HTMLFrameSetElementImpl*>(node);
if (!m_frameBorderSet)
m_frameBorder = frameset->frameBorder();
@@ -661,7 +662,7 @@
// -------------------------------------------------------------------------
HTMLFrameSetElementImpl::HTMLFrameSetElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::frameset(), doc)
{
// default value for rows and cols...
m_totalRows = 1;
@@ -685,9 +686,11 @@
delete [] m_cols;
}
-NodeImpl::Id HTMLFrameSetElementImpl::id() const
+bool HTMLFrameSetElementImpl::checkDTD(const NodeImpl* newChild)
{
- return ID_FRAMESET;
+ // FIXME: Old code had adjacent double returns and seemed to want to do something with NOFRAMES (but didn't).
+ // What is the correct behavior?
+ return newChild->hasTagName(HTMLNames::frameset()) || newChild->hasTagName(HTMLNames::frame());
}
void HTMLFrameSetElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
@@ -752,8 +755,7 @@
HTMLElementImpl* node = static_cast<HTMLElementImpl*>(parentNode());
while(node)
{
- if(node->id() == ID_FRAMESET)
- {
+ if (node->hasTagName(HTMLNames::frameset())) {
HTMLFrameSetElementImpl* frameset = static_cast<HTMLFrameSetElementImpl*>(node);
if(!frameBorderSet) frameborder = frameset->frameBorder();
if(!noresize) noresize = frameset->noResize();
@@ -817,7 +819,7 @@
// -------------------------------------------------------------------------
HTMLHeadElementImpl::HTMLHeadElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::head(), doc)
{
}
@@ -825,11 +827,6 @@
{
}
-NodeImpl::Id HTMLHeadElementImpl::id() const
-{
- return ID_HEAD;
-}
-
DOMString HTMLHeadElementImpl::profile() const
{
return getAttribute(ATTR_PROFILE);
@@ -840,10 +837,18 @@
setAttribute(ATTR_PROFILE, value);
}
+bool HTMLHeadElementImpl::checkDTD(const NodeImpl* newChild)
+{
+ return newChild->hasTagName(HTMLNames::title()) || newChild->hasTagName(HTMLNames::isindex()) ||
+ newChild->hasTagName(HTMLNames::base()) || newChild->hasTagName(HTMLNames::script()) ||
+ newChild->hasTagName(HTMLNames::style()) || newChild->hasTagName(HTMLNames::meta()) ||
+ newChild->hasTagName(HTMLNames::link()) || newChild->isTextNode();
+}
+
// -------------------------------------------------------------------------
HTMLHtmlElementImpl::HTMLHtmlElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::html(), doc)
{
}
@@ -851,11 +856,6 @@
{
}
-NodeImpl::Id HTMLHtmlElementImpl::id() const
-{
- return ID_HTML;
-}
-
DOMString HTMLHtmlElementImpl::version() const
{
return getAttribute(ATTR_VERSION);
@@ -866,9 +866,17 @@
setAttribute(ATTR_VERSION, value);
}
+bool HTMLHtmlElementImpl::checkDTD(const NodeImpl* newChild)
+{
+ // FIXME: Why is <script> allowed here?
+ return newChild->hasTagName(HTMLNames::head()) || newChild->hasTagName(HTMLNames::body()) ||
+ newChild->hasTagName(HTMLNames::frameset()) || newChild->hasTagName(HTMLNames::noframes()) ||
+ newChild->hasTagName(HTMLNames::script());
+}
+
// -------------------------------------------------------------------------
-HTMLIFrameElementImpl::HTMLIFrameElementImpl(DocumentPtr *doc) : HTMLFrameElementImpl(doc)
+HTMLIFrameElementImpl::HTMLIFrameElementImpl(DocumentPtr *doc) : HTMLFrameElementImpl(HTMLNames::iframe(), doc)
{
m_frameBorder = false;
m_marginWidth = -1;
@@ -880,11 +888,6 @@
{
}
-NodeImpl::Id HTMLIFrameElementImpl::id() const
-{
- return ID_IFRAME;
-}
-
bool HTMLIFrameElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
{
switch (attr) {
1.28 +19 -12 WebCore/khtml/html/html_baseimpl.h
Index: html_baseimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_baseimpl.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- html_baseimpl.h 11 May 2005 05:49:34 -0000 1.27
+++ html_baseimpl.h 9 Jul 2005 20:19:09 -0000 1.28
@@ -26,7 +26,6 @@
#ifndef HTML_BASEIMPL_H
#define HTML_BASEIMPL_H
-#include "html/dtd.h"
#include "html/html_elementimpl.h"
#include "misc/khtmllayout.h"
@@ -55,8 +54,9 @@
HTMLBodyElementImpl(DocumentPtr *doc);
~HTMLBodyElementImpl();
- virtual Id id() const;
-
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 10; }
+
virtual bool mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *);
@@ -92,11 +92,14 @@
public:
HTMLFrameElementImpl(DocumentPtr *doc);
-
+ HTMLFrameElementImpl(const QualifiedName& tagName, DocumentPtr* doc);
~HTMLFrameElementImpl();
- virtual Id id() const;
+ void init();
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
virtual void parseMappedAttribute(MappedAttributeImpl *);
virtual void attach();
virtual void detach();
@@ -168,10 +171,11 @@
friend class khtml::RenderFrameSet;
public:
HTMLFrameSetElementImpl(DocumentPtr *doc);
-
~HTMLFrameSetElementImpl();
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 10; }
+ virtual bool checkDTD(const NodeImpl* newChild);
virtual void parseMappedAttribute(MappedAttributeImpl *);
virtual void attach();
@@ -216,10 +220,11 @@
{
public:
HTMLHeadElementImpl(DocumentPtr *doc);
-
~HTMLHeadElementImpl();
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
+ virtual int tagPriority() const { return 10; }
+ virtual bool checkDTD(const NodeImpl* newChild);
DOMString profile() const;
void setProfile(const DOMString &);
@@ -233,7 +238,9 @@
HTMLHtmlElementImpl(DocumentPtr *doc);
~HTMLHtmlElementImpl();
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 11; }
+ virtual bool checkDTD(const NodeImpl* newChild);
DOMString version() const;
void setVersion(const DOMString &);
@@ -246,10 +253,10 @@
{
public:
HTMLIFrameElementImpl(DocumentPtr *doc);
-
~HTMLIFrameElementImpl();
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
virtual bool mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *attr);
1.19 +21 -47 WebCore/khtml/html/html_blockimpl.cpp
Index: html_blockimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_blockimpl.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- html_blockimpl.cpp 9 Jul 2005 00:30:58 -0000 1.18
+++ html_blockimpl.cpp 9 Jul 2005 20:19:09 -0000 1.19
@@ -37,7 +37,7 @@
using namespace DOM;
HTMLBlockquoteElementImpl::HTMLBlockquoteElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::blockquote(), doc)
{
}
@@ -45,11 +45,6 @@
{
}
-NodeImpl::Id HTMLBlockquoteElementImpl::id() const
-{
- return ID_BLOCKQUOTE;
-}
-
DOMString HTMLBlockquoteElementImpl::cite() const
{
return getAttribute(ATTR_CITE);
@@ -63,7 +58,7 @@
// -------------------------------------------------------------------------
HTMLDivElementImpl::HTMLDivElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::div(), doc)
{
}
@@ -71,11 +66,6 @@
{
}
-NodeImpl::Id HTMLDivElementImpl::id() const
-{
- return ID_DIV;
-}
-
bool HTMLDivElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
{
if (attr == ATTR_ALIGN) {
@@ -120,7 +110,7 @@
// -------------------------------------------------------------------------
HTMLHRElementImpl::HTMLHRElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::hr(), doc)
{
}
@@ -128,11 +118,6 @@
{
}
-NodeImpl::Id HTMLHRElementImpl::id() const
-{
- return ID_HR;
-}
-
bool HTMLHRElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
{
switch (attr) {
@@ -252,11 +237,21 @@
// -------------------------------------------------------------------------
-HTMLHeadingElementImpl::HTMLHeadingElementImpl(DocumentPtr *doc, ushort _tagid)
- : HTMLGenericElementImpl(doc, _tagid)
+HTMLHeadingElementImpl::HTMLHeadingElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
+ : HTMLElementImpl(tagName, doc)
{
}
+bool HTMLHeadingElementImpl::checkDTD(const NodeImpl* newChild)
+{
+ if (newChild->hasTagName(HTMLNames::h1()) || newChild->hasTagName(HTMLNames::h2()) ||
+ newChild->hasTagName(HTMLNames::h3()) || newChild->hasTagName(HTMLNames::h4()) ||
+ newChild->hasTagName(HTMLNames::h5()) || newChild->hasTagName(HTMLNames::h6()))
+ return false;
+
+ return inEitherTagList(newChild);
+}
+
DOMString HTMLHeadingElementImpl::align() const
{
return getAttribute(ATTR_ALIGN);
@@ -270,13 +265,13 @@
// -------------------------------------------------------------------------
HTMLParagraphElementImpl::HTMLParagraphElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::p(), doc)
{
}
-NodeImpl::Id HTMLParagraphElementImpl::id() const
+bool HTMLParagraphElementImpl::checkDTD(const NodeImpl* newChild)
{
- return ID_P;
+ return inInlineTagList(newChild) || (getDocument()->inCompatMode() && newChild->hasTagName(HTMLNames::table()));
}
bool HTMLParagraphElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
@@ -322,8 +317,8 @@
// -------------------------------------------------------------------------
-HTMLPreElementImpl::HTMLPreElementImpl(DocumentPtr *doc, unsigned short _tagid)
- : HTMLGenericElementImpl(doc, _tagid)
+HTMLPreElementImpl::HTMLPreElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
+ : HTMLElementImpl(tagName, doc)
{
}
@@ -343,16 +338,11 @@
const int defaultMinimumDelay = 60;
HTMLMarqueeElementImpl::HTMLMarqueeElementImpl(DocumentPtr *doc)
-: HTMLElementImpl(doc),
+: HTMLElementImpl(HTMLNames::marquee(), doc),
m_minimumDelay(defaultMinimumDelay)
{
}
-NodeImpl::Id HTMLMarqueeElementImpl::id() const
-{
- return ID_MARQUEE;
-}
-
bool HTMLMarqueeElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
{
switch (attr) {
@@ -437,19 +427,3 @@
HTMLElementImpl::parseMappedAttribute(attr);
}
}
-
-// ------------------------------------------------------------------------
-
-HTMLLayerElementImpl::HTMLLayerElementImpl(DocumentPtr *doc)
- : HTMLDivElementImpl( doc )
-{
-}
-
-HTMLLayerElementImpl::~HTMLLayerElementImpl()
-{
-}
-
-NodeImpl::Id HTMLLayerElementImpl::id() const
-{
- return ID_LAYER;
-}
1.10 +28 -35 WebCore/khtml/html/html_blockimpl.h
Index: html_blockimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_blockimpl.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- html_blockimpl.h 11 May 2005 05:49:34 -0000 1.9
+++ html_blockimpl.h 9 Jul 2005 20:19:09 -0000 1.10
@@ -26,7 +26,6 @@
#define HTML_BLOCKIMPL_H
#include "html_elementimpl.h"
-#include "dtd.h"
namespace DOM {
@@ -40,8 +39,9 @@
HTMLBlockquoteElementImpl(DocumentPtr *doc);
~HTMLBlockquoteElementImpl();
- virtual Id id() const;
-
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
+
DOMString cite() const;
void setCite(const DOMString &);
};
@@ -55,8 +55,9 @@
public:
HTMLDivElementImpl(DocumentPtr *doc);
~HTMLDivElementImpl();
-
- virtual Id id() const;
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *token);
@@ -72,8 +73,9 @@
public:
HTMLHRElementImpl(DocumentPtr *doc);
~HTMLHRElementImpl();
-
- virtual Id id() const;
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *);
@@ -93,10 +95,14 @@
// -------------------------------------------------------------------------
-class HTMLHeadingElementImpl : public HTMLGenericElementImpl
+class HTMLHeadingElementImpl : public HTMLElementImpl
{
public:
- HTMLHeadingElementImpl(DocumentPtr *doc, ushort _tagid);
+ HTMLHeadingElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
+ virtual bool checkDTD(const NodeImpl* newChild);
DOMString align() const;
void setAlign(const DOMString &);
@@ -104,21 +110,17 @@
// -------------------------------------------------------------------------
-/*
- * were not using HTMLElementImpl as parent class, since a
- * paragraph should be able to flow around aligned objects. Thus
- * a <p> element has to be inline, and is rendered by
- * HTMLBlockImpl::calcParagraph
- */
class HTMLParagraphElementImpl : public HTMLElementImpl
{
public:
HTMLParagraphElementImpl(DocumentPtr *doc);
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
+ virtual int tagPriority() const { return 3; }
+ virtual bool checkDTD(const NodeImpl* newChild);
+
virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *attr);
-
- virtual Id id() const;
DOMString align() const;
void setAlign(const DOMString &);
@@ -126,13 +128,16 @@
// -------------------------------------------------------------------------
-class HTMLPreElementImpl : public HTMLGenericElementImpl
+class HTMLPreElementImpl : public HTMLElementImpl
{
public:
- HTMLPreElementImpl(DocumentPtr *doc, ushort _tagid);
+ HTMLPreElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
long width() const;
- void setWidth( long w );
+ void setWidth(long w);
};
// -------------------------------------------------------------------------
@@ -141,9 +146,10 @@
{
public:
HTMLMarqueeElementImpl(DocumentPtr *doc);
-
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 3; }
+
virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *token);
@@ -153,18 +159,5 @@
int m_minimumDelay;
};
-// -------------------------------------------------------------------------
-
-class HTMLLayerElementImpl : public HTMLDivElementImpl
-{
-public:
- HTMLLayerElementImpl( DocumentPtr *doc );
- ~HTMLLayerElementImpl();
-
- virtual Id id() const;
-
- bool fixed;
-};
-
}; //namespace
#endif
1.4 +1 -6 WebCore/khtml/html/html_canvasimpl.cpp
Index: html_canvasimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_canvasimpl.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- html_canvasimpl.cpp 11 May 2005 05:49:34 -0000 1.3
+++ html_canvasimpl.cpp 9 Jul 2005 20:19:09 -0000 1.4
@@ -55,7 +55,7 @@
// -------------------------------------------------------------------------
HTMLCanvasElementImpl::HTMLCanvasElementImpl(DocumentPtr *doc)
- : HTMLImageElementImpl(doc)
+ : HTMLImageElementImpl(HTMLNames::canvas(), doc)
{
}
@@ -63,11 +63,6 @@
{
}
-NodeImpl::Id HTMLCanvasElementImpl::id() const
-{
- return ID_CANVAS;
-}
-
bool HTMLCanvasElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
{
return HTMLImageElementImpl::mapToEntry(attr, result);
1.3 +0 -3 WebCore/khtml/html/html_canvasimpl.h
Index: html_canvasimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_canvasimpl.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- html_canvasimpl.h 11 May 2005 05:49:34 -0000 1.2
+++ html_canvasimpl.h 9 Jul 2005 20:19:09 -0000 1.3
@@ -43,11 +43,8 @@
{
public:
HTMLCanvasElementImpl(DocumentPtr *doc);
-
~HTMLCanvasElementImpl();
- virtual Id id() const;
-
virtual bool mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *);
1.61 +6 -3 WebCore/khtml/html/html_documentimpl.cpp
Index: html_documentimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_documentimpl.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- html_documentimpl.cpp 11 May 2005 00:58:28 -0000 1.60
+++ html_documentimpl.cpp 9 Jul 2005 20:19:09 -0000 1.61
@@ -60,6 +60,7 @@
#include "html/html_miscimpl.h"
#include "html/html_imageimpl.h"
#include "html/html_formimpl.h"
+#include "htmlfactory.h"
#include "khtmlview.h"
#include "khtml_part.h"
@@ -246,12 +247,14 @@
bool HTMLDocumentImpl::childAllowed( NodeImpl *newChild )
{
// ### support comments. etc as a child
- return (newChild->id() == ID_HTML || newChild->id() == ID_COMMENT);
+ return (newChild->hasTagName(HTMLNames::html()) || newChild->isCommentNode());
}
-ElementImpl *HTMLDocumentImpl::createElement( const DOMString &name, int &exceptioncode )
+ElementImpl *HTMLDocumentImpl::createElement(const DOMString &name, int &exceptioncode)
{
- return createHTMLElement(name, exceptioncode);
+ // Do not check name validity. Other browsers don't, and it takes time.
+ DOMString lowerName(name.lower());
+ return HTMLElementFactory::createHTMLElement(AtomicString(lowerName), this, 0, false);
}
void HTMLDocumentImpl::slotHistoryChanged()
1.30 +1 -1 WebCore/khtml/html/html_documentimpl.h
Index: html_documentimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_documentimpl.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- html_documentimpl.h 11 May 2005 00:58:28 -0000 1.29
+++ html_documentimpl.h 9 Jul 2005 20:19:09 -0000 1.30
@@ -34,7 +34,7 @@
namespace DOM {
- class HTMLElementImpl;
+class HTMLElementImpl;
class HTMLDocumentImpl : public DOM::DocumentImpl, public khtml::CachedObjectClient
{
1.88 +342 -122 WebCore/khtml/html/html_elementimpl.cpp
Index: html_elementimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_elementimpl.cpp,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- html_elementimpl.cpp 13 May 2005 16:48:51 -0000 1.87
+++ html_elementimpl.cpp 9 Jul 2005 20:19:09 -0000 1.88
@@ -28,12 +28,13 @@
//#define EVENT_DEBUG
//#define UNSUPPORTED_ATTR
-#include "html/dtd.h"
#include "html/html_elementimpl.h"
#include "html/html_documentimpl.h"
#include "html/htmltokenizer.h"
+#include "htmlfactory.h"
#include "misc/htmlhashes.h"
+#include "misc/hashset.h"
#include "editing/visible_text.h"
#include "khtmlview.h"
@@ -58,8 +59,8 @@
// ------------------------------------------------------------------
-HTMLElementImpl::HTMLElementImpl(DocumentPtr *doc)
- : StyledElementImpl(doc)
+HTMLElementImpl::HTMLElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
+ : StyledElementImpl(tagName, doc)
{
}
@@ -67,51 +68,40 @@
{
}
-bool HTMLElementImpl::isInline() const
+DOMString HTMLElementImpl::nodeName() const
{
- if (renderer())
- return ElementImpl::isInline();
-
- switch(id()) {
- case ID_A:
- case ID_FONT:
- case ID_TT:
- case ID_U:
- case ID_B:
- case ID_I:
- case ID_S:
- case ID_STRIKE:
- case ID_BIG:
- case ID_SMALL:
-
- // %phrase
- case ID_EM:
- case ID_STRONG:
- case ID_DFN:
- case ID_CODE:
- case ID_SAMP:
- case ID_KBD:
- case ID_VAR:
- case ID_CITE:
- case ID_ABBR:
- case ID_ACRONYM:
+ // FIXME: Would be nice to have an atomicstring lookup based off uppercase chars that does not have to copy
+ // the string on a hit in the hash.
+ if (getDocument()->isHTMLDocument())
+ return m_tagName.localName().implementation()->upper();
+ return ElementImpl::nodeName();
+}
- // %special
- case ID_SUB:
- case ID_SUP:
- case ID_SPAN:
- case ID_NOBR:
- case ID_WBR:
- return true;
-
- default:
- return ElementImpl::isInline();
- }
+HTMLTagStatus HTMLElementImpl::endTagRequirement() const
+{
+ if (hasLocalName(HTMLNames::dt()) || hasLocalName(HTMLNames::dd()))
+ return TagStatusOptional;
+
+ // Same values as <span>. This way custom tag name elements will behave like inline spans.
+ return TagStatusRequired;
+}
+
+int HTMLElementImpl::tagPriority() const
+{
+ if (hasLocalName(HTMLNames::address()) || hasLocalName(HTMLNames::dd()) || hasLocalName(HTMLNames::dt()) || hasLocalName(HTMLNames::noscript()))
+ return 3;
+ if (hasLocalName(HTMLNames::center()) || hasLocalName(HTMLNames::nobr()))
+ return 5;
+ if (hasLocalName(HTMLNames::noembed()) || hasLocalName(HTMLNames::noframes()))
+ return 10;
+
+ // Same values as <span>. This way custom tag name elements will behave like inline spans.
+ return 1;
}
NodeImpl *HTMLElementImpl::cloneNode(bool deep)
{
- HTMLElementImpl *clone = static_cast<HTMLElementImpl *>(getDocument()->createHTMLElement(localNamePart(id())));
+ HTMLElementImpl *clone = HTMLElementFactory::createHTMLElement(m_tagName.localName(), getDocument(), 0, false);
if (!clone)
return 0;
@@ -325,26 +315,17 @@
DocumentFragmentImpl *HTMLElementImpl::createContextualFragment(const DOMString &html)
{
// the following is in accordance with the definition as used by IE
- if( endTagRequirement(id()) == FORBIDDEN )
- return NULL;
- // IE disallows innerHTML on inline elements. I don't see why we should have this restriction, as our
- // dhtml engine can cope with it. Lars
- //if ( isInline() ) return false;
- switch( id() ) {
- case ID_COL:
- case ID_COLGROUP:
- case ID_FRAMESET:
- case ID_HEAD:
- case ID_STYLE:
- case ID_TITLE:
- return NULL;
- default:
- break;
- }
- if ( !getDocument()->isHTMLDocument() )
- return NULL;
+ if (endTagRequirement() == TagStatusForbidden)
+ return 0;
+
+ if (hasLocalName(HTMLNames::col()) || hasLocalName(HTMLNames::colgroup()) || hasLocalName(HTMLNames::frameset()) ||
+ hasLocalName(HTMLNames::head()) || hasLocalName(HTMLNames::style()) || hasLocalName(HTMLNames::title()))
+ return 0;
+
+ if (!getDocument()->isHTMLDocument())
+ return 0;
- DocumentFragmentImpl *fragment = new DocumentFragmentImpl( docPtr() );
+ DocumentFragmentImpl *fragment = new DocumentFragmentImpl(docPtr());
fragment->ref();
{
HTMLTokenizer tok(docPtr(), fragment);
@@ -358,14 +339,14 @@
int ignoredExceptionCode;
// we need to pop <html> and <body> elements and remove <head> to
- // accomadate folks passing complete HTML documents to make the
+ // accommodate folks passing complete HTML documents to make the
// child of an element.
NodeImpl *nextNode;
for (NodeImpl *node = fragment->firstChild(); node != NULL; node = nextNode) {
nextNode = node->nextSibling();
node->ref();
- if (node->id() == ID_HTML || node->id() == ID_BODY) {
+ if (node->hasTagName(HTMLNames::html()) || node->hasTagName(HTMLNames::body())) {
NodeImpl *firstChild = node->firstChild();
if (firstChild != NULL) {
nextNode = firstChild;
@@ -379,9 +360,9 @@
child->deref();
}
fragment->removeChild(node, ignoredExceptionCode);
- } else if (node->id() == ID_HEAD) {
+ } else if (node->hasTagName(HTMLNames::head()))
fragment->removeChild(node, ignoredExceptionCode);
- }
+
// Important to do this deref after removeChild, because if the only thing
// keeping a node around is a parent that is non-0, removeChild will not
// delete the node. This works fine in JavaScript because there's always
@@ -400,7 +381,7 @@
void HTMLElementImpl::setInnerHTML(const DOMString &html, int &exception)
{
- DocumentFragmentImpl *fragment = createContextualFragment( html );
+ DocumentFragmentImpl *fragment = createContextualFragment(html);
if (fragment == NULL) {
exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
return;
@@ -418,7 +399,7 @@
return;
}
HTMLElementImpl *parent = static_cast<HTMLElementImpl *>(p);
- DocumentFragmentImpl *fragment = parent->createContextualFragment( html );
+ DocumentFragmentImpl *fragment = parent->createContextualFragment(html);
if (!fragment) {
exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
@@ -434,29 +415,17 @@
void HTMLElementImpl::setInnerText(const DOMString &text, int &exception)
{
// following the IE specs.
- if (endTagRequirement(id()) == FORBIDDEN) {
+ if (endTagRequirement() == TagStatusForbidden) {
exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
return;
}
- // IE disallows innerText on inline elements. I don't see why we should have this restriction, as our
- // dhtml engine can cope with it. Lars
- //if ( isInline() ) return false;
- switch( id() ) {
- case ID_COL:
- case ID_COLGROUP:
- case ID_FRAMESET:
- case ID_HEAD:
- case ID_HTML:
- case ID_TABLE:
- case ID_TBODY:
- case ID_TFOOT:
- case ID_THEAD:
- case ID_TR:
- exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
- return;
- default:
- break;
+ if (hasLocalName(HTMLNames::col()) || hasLocalName(HTMLNames::colgroup()) || hasLocalName(HTMLNames::frameset()) ||
+ hasLocalName(HTMLNames::head()) || hasLocalName(HTMLNames::html()) || hasLocalName(HTMLNames::table()) ||
+ hasLocalName(HTMLNames::tbody()) || hasLocalName(HTMLNames::tfoot()) || hasLocalName(HTMLNames::thead()) ||
+ hasLocalName(HTMLNames::tr())) {
+ exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
+ return;
}
removeChildren();
@@ -466,25 +435,17 @@
void HTMLElementImpl::setOuterText(const DOMString &text, int &exception)
{
// following the IE specs.
- if( endTagRequirement(id()) == FORBIDDEN ) {
+ if (endTagRequirement() == TagStatusForbidden) {
exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
return;
}
- switch( id() ) {
- case ID_COL:
- case ID_COLGROUP:
- case ID_FRAMESET:
- case ID_HEAD:
- case ID_HTML:
- case ID_TABLE:
- case ID_TBODY:
- case ID_TFOOT:
- case ID_THEAD:
- case ID_TR:
- exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
- return;
- default:
- break;
+
+ if (hasLocalName(HTMLNames::col()) || hasLocalName(HTMLNames::colgroup()) || hasLocalName(HTMLNames::frameset()) ||
+ hasLocalName(HTMLNames::head()) || hasLocalName(HTMLNames::html()) || hasLocalName(HTMLNames::table()) ||
+ hasLocalName(HTMLNames::tbody()) || hasLocalName(HTMLNames::tfoot()) || hasLocalName(HTMLNames::thead()) ||
+ hasLocalName(HTMLNames::tr())) {
+ exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
+ return;
}
NodeImpl *parent = parentNode();
@@ -525,17 +486,6 @@
}
}
-
-DOMString HTMLElementImpl::namespaceURI() const
-{
- // For HTML documents, we treat HTML elements as having no namespace. But for XML documents
- // the elements have the namespace defined in the XHTML spec
- if (getDocument()->isHTMLDocument())
- return DOMString();
- else
- return XHTML_NAMESPACE;
-}
-
void HTMLElementImpl::addHTMLAlignment(MappedAttributeImpl* attr)
{
//qDebug("alignment is %s", alignment.string().latin1() );
@@ -682,9 +632,9 @@
DOMString result = openTagStartToString();
result += ">";
- if (endTagRequirement(id()) == REQUIRED) {
+ if (endTagRequirement() == TagStatusRequired) {
result += "</";
- result += tagName();
+ result += nodeName();
result += ">";
}
@@ -694,7 +644,7 @@
return ElementImpl::toString();
}
-DOMString HTMLElementImpl::idDOM() const
+DOMString HTMLElementImpl::id() const
{
return getAttribute(ATTR_ID);
}
@@ -749,15 +699,285 @@
return SharedPtr<HTMLCollectionImpl>(new HTMLCollectionImpl(this, HTMLCollectionImpl::NODE_CHILDREN));
}
-// -------------------------------------------------------------------------
+// DOM Section 1.1.1
+bool HTMLElementImpl::childAllowed(NodeImpl *newChild)
+{
+ if (!ElementImpl::childAllowed(newChild))
+ return false;
+
+ // For XML documents, we are non-validating and do not check against a DTD, even for HTML elements.
+ if (!getDocument()->isHTMLDocument())
+ return true;
+
+ // Future-proof for XML content inside HTML documents (we may allow this some day).
+ if (newChild->isElementNode() && !newChild->isHTMLElement())
+ return true;
-HTMLGenericElementImpl::HTMLGenericElementImpl(DocumentPtr *doc, ushort i)
- : HTMLElementImpl(doc)
+ // Elements with forbidden tag status can never have children
+ if (endTagRequirement() == TagStatusForbidden)
+ return false;
+
+ // Comment nodes are always allowed.
+ if (newChild->isCommentNode())
+ return true;
+
+ // Now call checkDTD.
+ return checkDTD(newChild);
+}
+
+// DTD Stuff
+// This unfortunate function is only needed when checking against the DTD. Other languages (like SVG) won't need this.
+bool HTMLElementImpl::isRecognizedTagName(const QualifiedName& tagName)
+{
+ static HashSet<DOMStringImpl*, PointerHash<DOMStringImpl*> > tagList;
+ if (tagList.isEmpty()) {
+ tagList.insert(HTMLNames::a().localName().implementation());
+ tagList.insert(HTMLNames::abbr().localName().implementation());
+ tagList.insert(HTMLNames::acronym().localName().implementation());
+ tagList.insert(HTMLNames::address().localName().implementation());
+ tagList.insert(HTMLNames::applet().localName().implementation());
+ tagList.insert(HTMLNames::area().localName().implementation());
+ tagList.insert(HTMLNames::b().localName().implementation());
+ tagList.insert(HTMLNames::base().localName().implementation());
+ tagList.insert(HTMLNames::basefont().localName().implementation());
+ tagList.insert(HTMLNames::bdo().localName().implementation());
+ tagList.insert(HTMLNames::big().localName().implementation());
+ tagList.insert(HTMLNames::blockquote().localName().implementation());
+ tagList.insert(HTMLNames::body().localName().implementation());
+ tagList.insert(HTMLNames::br().localName().implementation());
+ tagList.insert(HTMLNames::button().localName().implementation());
+ tagList.insert(HTMLNames::canvas().localName().implementation());
+ tagList.insert(HTMLNames::caption().localName().implementation());
+ tagList.insert(HTMLNames::center().localName().implementation());
+ tagList.insert(HTMLNames::cite().localName().implementation());
+ tagList.insert(HTMLNames::code().localName().implementation());
+ tagList.insert(HTMLNames::col().localName().implementation());
+ tagList.insert(HTMLNames::colgroup().localName().implementation());
+ tagList.insert(HTMLNames::dd().localName().implementation());
+ tagList.insert(HTMLNames::del().localName().implementation());
+ tagList.insert(HTMLNames::dfn().localName().implementation());
+ tagList.insert(HTMLNames::dir().localName().implementation());
+ tagList.insert(HTMLNames::div().localName().implementation());
+ tagList.insert(HTMLNames::dl().localName().implementation());
+ tagList.insert(HTMLNames::dt().localName().implementation());
+ tagList.insert(HTMLNames::em().localName().implementation());
+ tagList.insert(HTMLNames::embed().localName().implementation());
+ tagList.insert(HTMLNames::fieldset().localName().implementation());
+ tagList.insert(HTMLNames::font().localName().implementation());
+ tagList.insert(HTMLNames::form().localName().implementation());
+ tagList.insert(HTMLNames::frame().localName().implementation());
+ tagList.insert(HTMLNames::frameset().localName().implementation());
+ tagList.insert(HTMLNames::head().localName().implementation());
+ tagList.insert(HTMLNames::h1().localName().implementation());
+ tagList.insert(HTMLNames::h2().localName().implementation());
+ tagList.insert(HTMLNames::h3().localName().implementation());
+ tagList.insert(HTMLNames::h4().localName().implementation());
+ tagList.insert(HTMLNames::h5().localName().implementation());
+ tagList.insert(HTMLNames::h6().localName().implementation());
+ tagList.insert(HTMLNames::hr().localName().implementation());
+ tagList.insert(HTMLNames::html().localName().implementation());
+ tagList.insert(HTMLNames::i().localName().implementation());
+ tagList.insert(HTMLNames::iframe().localName().implementation());
+ tagList.insert(HTMLNames::img().localName().implementation());
+ tagList.insert(HTMLNames::input().localName().implementation());
+ tagList.insert(HTMLNames::ins().localName().implementation());
+ tagList.insert(HTMLNames::isindex().localName().implementation());
+ tagList.insert(HTMLNames::kbd().localName().implementation());
+ tagList.insert(HTMLNames::keygen().localName().implementation());
+ tagList.insert(HTMLNames::label().localName().implementation());
+ tagList.insert(HTMLNames::layer().localName().implementation());
+ tagList.insert(HTMLNames::legend().localName().implementation());
+ tagList.insert(HTMLNames::li().localName().implementation());
+ tagList.insert(HTMLNames::link().localName().implementation());
+ tagList.insert(HTMLNames::map().localName().implementation());
+ tagList.insert(HTMLNames::marquee().localName().implementation());
+ tagList.insert(HTMLNames::menu().localName().implementation());
+ tagList.insert(HTMLNames::meta().localName().implementation());
+ tagList.insert(HTMLNames::nobr().localName().implementation());
+ tagList.insert(HTMLNames::noembed().localName().implementation());
+ tagList.insert(HTMLNames::noframes().localName().implementation());
+ tagList.insert(HTMLNames::nolayer().localName().implementation());
+ tagList.insert(HTMLNames::noscript().localName().implementation());
+ tagList.insert(HTMLNames::object().localName().implementation());
+ tagList.insert(HTMLNames::ol().localName().implementation());
+ tagList.insert(HTMLNames::optgroup().localName().implementation());
+ tagList.insert(HTMLNames::option().localName().implementation());
+ tagList.insert(HTMLNames::p().localName().implementation());
+ tagList.insert(HTMLNames::param().localName().implementation());
+ tagList.insert(HTMLNames::plaintext().localName().implementation());
+ tagList.insert(HTMLNames::pre().localName().implementation());
+ tagList.insert(HTMLNames::q().localName().implementation());
+ tagList.insert(HTMLNames::s().localName().implementation());
+ tagList.insert(HTMLNames::samp().localName().implementation());
+ tagList.insert(HTMLNames::script().localName().implementation());
+ tagList.insert(HTMLNames::select().localName().implementation());
+ tagList.insert(HTMLNames::small().localName().implementation());
+ tagList.insert(HTMLNames::span().localName().implementation());
+ tagList.insert(HTMLNames::strike().localName().implementation());
+ tagList.insert(HTMLNames::strong().localName().implementation());
+ tagList.insert(HTMLNames::style().localName().implementation());
+ tagList.insert(HTMLNames::sub().localName().implementation());
+ tagList.insert(HTMLNames::sup().localName().implementation());
+ tagList.insert(HTMLNames::table().localName().implementation());
+ tagList.insert(HTMLNames::tbody().localName().implementation());
+ tagList.insert(HTMLNames::td().localName().implementation());
+ tagList.insert(HTMLNames::textarea().localName().implementation());
+ tagList.insert(HTMLNames::tfoot().localName().implementation());
+ tagList.insert(HTMLNames::th().localName().implementation());
+ tagList.insert(HTMLNames::thead().localName().implementation());
+ tagList.insert(HTMLNames::title().localName().implementation());
+ tagList.insert(HTMLNames::tr().localName().implementation());
+ tagList.insert(HTMLNames::tt().localName().implementation());
+ tagList.insert(HTMLNames::u().localName().implementation());
+ tagList.insert(HTMLNames::ul().localName().implementation());
+ tagList.insert(HTMLNames::var().localName().implementation());
+ tagList.insert(HTMLNames::wbr().localName().implementation());
+ tagList.insert(HTMLNames::xmp().localName().implementation());
+ }
+
+ return tagList.contains(tagName.localName().implementation());
+}
+
+// The terms inline and block are used here loosely. Don't make the mistake of assuming all inlines or all blocks
+// need to be in these two lists.
+HashSet<DOMStringImpl*, PointerHash<DOMStringImpl*> >* inlineTagList() {
+ static HashSet<DOMStringImpl*, PointerHash<DOMStringImpl*> > tagList;
+ if (tagList.isEmpty()) {
+ tagList.insert(HTMLNames::tt().localName().implementation());
+ tagList.insert(HTMLNames::i().localName().implementation());
+ tagList.insert(HTMLNames::b().localName().implementation());
+ tagList.insert(HTMLNames::u().localName().implementation());
+ tagList.insert(HTMLNames::s().localName().implementation());
+ tagList.insert(HTMLNames::strike().localName().implementation());
+ tagList.insert(HTMLNames::big().localName().implementation());
+ tagList.insert(HTMLNames::small().localName().implementation());
+ tagList.insert(HTMLNames::em().localName().implementation());
+ tagList.insert(HTMLNames::strong().localName().implementation());
+ tagList.insert(HTMLNames::dfn().localName().implementation());
+ tagList.insert(HTMLNames::code().localName().implementation());
+ tagList.insert(HTMLNames::samp().localName().implementation());
+ tagList.insert(HTMLNames::kbd().localName().implementation());
+ tagList.insert(HTMLNames::var().localName().implementation());
+ tagList.insert(HTMLNames::cite().localName().implementation());
+ tagList.insert(HTMLNames::abbr().localName().implementation());
+ tagList.insert(HTMLNames::acronym().localName().implementation());
+ tagList.insert(HTMLNames::a().localName().implementation());
+ tagList.insert(HTMLNames::canvas().localName().implementation());
+ tagList.insert(HTMLNames::img().localName().implementation());
+ tagList.insert(HTMLNames::applet().localName().implementation());
+ tagList.insert(HTMLNames::object().localName().implementation());
+ tagList.insert(HTMLNames::embed().localName().implementation());
+ tagList.insert(HTMLNames::font().localName().implementation());
+ tagList.insert(HTMLNames::basefont().localName().implementation());
+ tagList.insert(HTMLNames::br().localName().implementation());
+ tagList.insert(HTMLNames::script().localName().implementation());
+ tagList.insert(HTMLNames::map().localName().implementation());
+ tagList.insert(HTMLNames::q().localName().implementation());
+ tagList.insert(HTMLNames::sub().localName().implementation());
+ tagList.insert(HTMLNames::sup().localName().implementation());
+ tagList.insert(HTMLNames::span().localName().implementation());
+ tagList.insert(HTMLNames::bdo().localName().implementation());
+ tagList.insert(HTMLNames::iframe().localName().implementation());
+ tagList.insert(HTMLNames::input().localName().implementation());
+ tagList.insert(HTMLNames::keygen().localName().implementation());
+ tagList.insert(HTMLNames::select().localName().implementation());
+ tagList.insert(HTMLNames::textarea().localName().implementation());
+ tagList.insert(HTMLNames::label().localName().implementation());
+ tagList.insert(HTMLNames::button().localName().implementation());
+ tagList.insert(HTMLNames::ins().localName().implementation());
+ tagList.insert(HTMLNames::del().localName().implementation());
+ tagList.insert(HTMLNames::nobr().localName().implementation());
+ tagList.insert(HTMLNames::wbr().localName().implementation());
+ }
+ return &tagList;
+}
+
+HashSet<DOMStringImpl*, PointerHash<DOMStringImpl*> >* blockTagList() {
+ static HashSet<DOMStringImpl*, PointerHash<DOMStringImpl*> > tagList;
+ if (tagList.isEmpty()) {
+ tagList.insert(HTMLNames::p().localName().implementation());
+ tagList.insert(HTMLNames::h1().localName().implementation());
+ tagList.insert(HTMLNames::h2().localName().implementation());
+ tagList.insert(HTMLNames::h3().localName().implementation());
+ tagList.insert(HTMLNames::h4().localName().implementation());
+ tagList.insert(HTMLNames::h5().localName().implementation());
+ tagList.insert(HTMLNames::h6().localName().implementation());
+ tagList.insert(HTMLNames::ul().localName().implementation());
+ tagList.insert(HTMLNames::ol().localName().implementation());
+ tagList.insert(HTMLNames::dir().localName().implementation());
+ tagList.insert(HTMLNames::menu().localName().implementation());
+ tagList.insert(HTMLNames::pre().localName().implementation());
+ tagList.insert(HTMLNames::plaintext().localName().implementation());
+ tagList.insert(HTMLNames::xmp().localName().implementation());
+ tagList.insert(HTMLNames::dl().localName().implementation());
+ tagList.insert(HTMLNames::div().localName().implementation());
+ tagList.insert(HTMLNames::layer().localName().implementation());
+ tagList.insert(HTMLNames::center().localName().implementation());
+ tagList.insert(HTMLNames::noscript().localName().implementation());
+ tagList.insert(HTMLNames::noframes().localName().implementation());
+ tagList.insert(HTMLNames::blockquote().localName().implementation());
+ tagList.insert(HTMLNames::form().localName().implementation());
+ tagList.insert(HTMLNames::isindex().localName().implementation());
+ tagList.insert(HTMLNames::hr().localName().implementation());
+ tagList.insert(HTMLNames::table().localName().implementation());
+ tagList.insert(HTMLNames::fieldset().localName().implementation());
+ tagList.insert(HTMLNames::address().localName().implementation());
+ tagList.insert(HTMLNames::li().localName().implementation());
+ tagList.insert(HTMLNames::dd().localName().implementation());
+ tagList.insert(HTMLNames::dt().localName().implementation());
+ tagList.insert(HTMLNames::marquee().localName().implementation());
+ }
+ return &tagList;
+}
+
+bool HTMLElementImpl::inEitherTagList(const NodeImpl* newChild)
{
- m_elementId = i;
+ if (newChild->isTextNode())
+ return true;
+
+ if (newChild->isHTMLElement()) {
+ const HTMLElementImpl* child = static_cast<const HTMLElementImpl*>(newChild);
+ if (inlineTagList()->contains(child->tagName().localName().implementation()))
+ return true;
+ if (blockTagList()->contains(child->tagName().localName().implementation()))
+ return true;
+ return !isRecognizedTagName(child->tagName()); // Accept custom html tags
+ }
+
+ return false;
+}
+
+bool HTMLElementImpl::inInlineTagList(const NodeImpl* newChild)
+{
+ if (newChild->isTextNode())
+ return true;
+
+ if (newChild->isHTMLElement()) {
+ const HTMLElementImpl* child = static_cast<const HTMLElementImpl*>(newChild);
+ if (inlineTagList()->contains(child->tagName().localName().implementation()))
+ return true;
+ return !isRecognizedTagName(child->tagName()); // Accept custom html tags
+ }
+
+ return false;
}
-NodeImpl::Id HTMLGenericElementImpl::id() const
+bool HTMLElementImpl::inBlockTagList(const NodeImpl* newChild)
{
- return m_elementId;
+ if (newChild->isTextNode())
+ return true;
+
+ if (newChild->isHTMLElement()) {
+ const HTMLElementImpl* child = static_cast<const HTMLElementImpl*>(newChild);
+ return (blockTagList()->contains(child->tagName().localName().implementation()));
+ }
+
+ return false;
+}
+
+bool HTMLElementImpl::checkDTD(const NodeImpl* newChild)
+{
+ if (hasTagName(HTMLNames::address()) && newChild->hasTagName(HTMLNames::p()))
+ return true;
+ return inEitherTagList(newChild);
}
1.36 +19 -21 WebCore/khtml/html/html_elementimpl.h
Index: html_elementimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_elementimpl.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- html_elementimpl.h 11 May 2005 05:49:34 -0000 1.35
+++ html_elementimpl.h 9 Jul 2005 20:19:10 -0000 1.36
@@ -25,27 +25,26 @@
#define HTML_ELEMENTIMPL_H
#include "xml/dom_elementimpl.h"
-#include <qptrdict.h>
+#include "htmlnames.h"
namespace DOM {
class DocumentFragmentImpl;
class DOMString;
class HTMLCollectionImpl;
-
+
+enum HTMLTagStatus { TagStatusOptional, TagStatusRequired, TagStatusForbidden };
+
class HTMLElementImpl : public StyledElementImpl
{
public:
- HTMLElementImpl(DocumentPtr *doc);
-
+ HTMLElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
virtual ~HTMLElementImpl();
virtual bool isHTMLElement() const { return true; }
- virtual bool isInline() const;
-
- virtual Id id() const = 0;
-
+ virtual DOMString nodeName() const;
+
virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl* attr);
@@ -53,7 +52,7 @@
SharedPtr<HTMLCollectionImpl> children();
- DOMString idDOM() const; // rename to id after eliminating NodeImpl::id some day
+ DOMString id() const;
void setId(const DOMString &value);
DOMString title() const;
void setTitle(const DOMString &value);
@@ -73,8 +72,6 @@
void setOuterHTML(const DOMString &html, int &exception);
void setInnerText(const DOMString &text, int &exception);
void setOuterText(const DOMString &text, int &exception);
-
- virtual DOMString namespaceURI() const;
virtual bool isFocusable() const;
virtual bool isContentEditable() const;
@@ -89,22 +86,23 @@
virtual DOMString toString() const;
+ virtual HTMLTagStatus endTagRequirement() const;
+ virtual int tagPriority() const;
+ virtual bool childAllowed(NodeImpl* newChild); // Error-checking during parsing that checks the DTD
+
+ // Helper function to check the DTD for a given child node.
+ virtual bool checkDTD(const NodeImpl* newChild);
+ static bool inEitherTagList(const NodeImpl* newChild);
+ static bool inInlineTagList(const NodeImpl* newChild);
+ static bool inBlockTagList(const NodeImpl* newChild);
+ static bool isRecognizedTagName(const QualifiedName& tagName);
+
protected:
// for IMG, OBJECT and APPLET
void addHTMLAlignment(MappedAttributeImpl* htmlAttr);
};
-class HTMLGenericElementImpl : public HTMLElementImpl
-{
-public:
- HTMLGenericElementImpl(DocumentPtr *doc, ushort elementId);
- virtual Id id() const;
-
-protected:
- ushort m_elementId;
-};
-
} //namespace
#endif
1.171 +79 -106 WebCore/khtml/html/html_formimpl.cpp
Index: html_formimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_formimpl.cpp,v
retrieving revision 1.170
retrieving revision 1.171
diff -u -r1.170 -r1.171
--- html_formimpl.cpp 29 Jun 2005 20:14:57 -0000 1.170
+++ html_formimpl.cpp 9 Jul 2005 20:19:10 -0000 1.171
@@ -103,7 +103,7 @@
};
HTMLFormElementImpl::HTMLFormElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::form(), doc)
{
collectionInfo = 0;
m_post = false;
@@ -130,11 +130,6 @@
imgElements[i]->m_form = 0;
}
-NodeImpl::Id HTMLFormElementImpl::id() const
-{
- return ID_FORM;
-}
-
#if APPLE_CHANGES
bool HTMLFormElementImpl::formWouldHaveSecureSubmission(const DOMString &url)
@@ -192,7 +187,7 @@
{
bool submitFound = false;
for (unsigned i = 0; i < formElements.count(); ++i) {
- if (formElements[i]->id() == ID_INPUT) {
+ if (formElements[i]->hasLocalName(HTMLNames::input())) {
HTMLInputElementImpl *element = static_cast<HTMLInputElementImpl *>(formElements[i]);
if (element->isSuccessfulSubmitButton() && element->renderer()) {
submitFound = true;
@@ -399,7 +394,7 @@
// if the current type is FILE, then we also need to
// include the filename
- if (current->nodeType() == Node::ELEMENT_NODE && current->id() == ID_INPUT &&
+ if (current->hasLocalName(HTMLNames::input()) &&
static_cast<HTMLInputElementImpl*>(current)->inputType() == HTMLInputElementImpl::FILE)
{
QString path = static_cast<HTMLInputElementImpl*>(current)->value().string();
@@ -547,7 +542,7 @@
#if APPLE_CHANGES
// Our app needs to get form values for password fields for doing password autocomplete,
// so we are more lenient in pushing values, and let the app decide what to save when.
- if (current->id() == ID_INPUT) {
+ if (current->hasLocalName(HTMLNames::input())) {
HTMLInputElementImpl *input = static_cast<HTMLInputElementImpl*>(current);
if (input->inputType() == HTMLInputElementImpl::TEXT
|| input->inputType() == HTMLInputElementImpl::PASSWORD
@@ -709,7 +704,7 @@
{
for (unsigned i = 0; i < formElements.count(); ++i) {
HTMLGenericFormElementImpl *current = formElements[i];
- if (current->id() == ID_INPUT &&
+ if (current->hasLocalName(HTMLNames::input()) &&
static_cast<HTMLInputElementImpl*>(current)->inputType() == HTMLInputElementImpl::RADIO &&
current != caller && current->form() == caller->form() && current->name() == caller->name()) {
static_cast<HTMLInputElementImpl*>(current)->setChecked(false);
@@ -864,8 +859,8 @@
// -------------------------------------------------------------------------
-HTMLGenericFormElementImpl::HTMLGenericFormElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
- : HTMLElementImpl(doc)
+HTMLGenericFormElementImpl::HTMLGenericFormElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f)
+ : HTMLElementImpl(tagName, doc)
{
m_disabled = m_readOnly = false;
m_dormant = false;
@@ -967,9 +962,8 @@
HTMLFormElementImpl *HTMLGenericFormElementImpl::getForm() const
{
NodeImpl *p = parentNode();
- while(p)
- {
- if( p->id() == ID_FORM )
+ while(p) {
+ if (p->hasTagName(HTMLNames::form()))
return static_cast<HTMLFormElementImpl *>(p);
p = p->parentNode();
}
@@ -1189,7 +1183,7 @@
// -------------------------------------------------------------------------
HTMLButtonElementImpl::HTMLButtonElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
- : HTMLGenericFormElementImpl(doc, f)
+ : HTMLGenericFormElementImpl(HTMLNames::button(), doc, f)
{
m_type = SUBMIT;
m_dirty = true;
@@ -1200,11 +1194,6 @@
{
}
-NodeImpl::Id HTMLButtonElementImpl::id() const
-{
- return ID_BUTTON;
-}
-
DOMString HTMLButtonElementImpl::type() const
{
return getAttribute(ATTR_TYPE);
@@ -1326,7 +1315,7 @@
// -------------------------------------------------------------------------
HTMLFieldSetElementImpl::HTMLFieldSetElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
- : HTMLGenericFormElementImpl(doc, f)
+ : HTMLGenericFormElementImpl(HTMLNames::fieldset(), doc, f)
{
}
@@ -1334,14 +1323,14 @@
{
}
-bool HTMLFieldSetElementImpl::isFocusable() const
+bool HTMLFieldSetElementImpl::checkDTD(const NodeImpl* newChild)
{
- return false;
+ return newChild->hasTagName(HTMLNames::legend()) || HTMLElementImpl::checkDTD(newChild);
}
-NodeImpl::Id HTMLFieldSetElementImpl::id() const
+bool HTMLFieldSetElementImpl::isFocusable() const
{
- return ID_FIELDSET;
+ return false;
}
DOMString HTMLFieldSetElementImpl::type() const
@@ -1357,8 +1346,21 @@
// -------------------------------------------------------------------------
HTMLInputElementImpl::HTMLInputElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
- : HTMLGenericFormElementImpl(doc, f), m_imageLoader(0), m_valueMatchesRenderer(false)
+ : HTMLGenericFormElementImpl(HTMLNames::input(), doc, f)
+{
+ init();
+}
+
+HTMLInputElementImpl::HTMLInputElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f)
+ : HTMLGenericFormElementImpl(tagName, doc, f)
{
+ init();
+}
+
+void HTMLInputElementImpl::init()
+{
+ m_imageLoader = 0;
+ m_valueMatchesRenderer = false;
m_type = TEXT;
m_maxLen = -1;
m_size = 20;
@@ -1376,8 +1378,8 @@
m_maxResults = -1;
- if ( m_form )
- m_autocomplete = f->autoComplete();
+ if (m_form)
+ m_autocomplete = m_form->autoComplete();
}
HTMLInputElementImpl::~HTMLInputElementImpl()
@@ -1386,11 +1388,6 @@
delete m_imageLoader;
}
-NodeImpl::Id HTMLInputElementImpl::id() const
-{
- return ID_INPUT;
-}
-
void HTMLInputElementImpl::setType(const DOMString& t)
{
typeEnum newType;
@@ -2468,7 +2465,7 @@
// -------------------------------------------------------------------------
HTMLLabelElementImpl::HTMLLabelElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::label(), doc)
{
}
@@ -2481,11 +2478,6 @@
return false;
}
-NodeImpl::Id HTMLLabelElementImpl::id() const
-{
- return ID_LABEL;
-}
-
void HTMLLabelElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
{
switch(attr->id())
@@ -2539,7 +2531,7 @@
HTMLFormElementImpl *HTMLLabelElementImpl::form()
{
for (NodeImpl *p = parentNode(); p != 0; p = p->parentNode()) {
- if (p->id() == ID_FORM)
+ if (p->hasTagName(HTMLNames::form()))
return static_cast<HTMLFormElementImpl *>(p);
}
@@ -2569,7 +2561,7 @@
// -------------------------------------------------------------------------
HTMLLegendElementImpl::HTMLLegendElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
-: HTMLGenericFormElementImpl(doc, f)
+: HTMLGenericFormElementImpl(HTMLNames::legend(), doc, f)
{
}
@@ -2582,11 +2574,6 @@
return false;
}
-NodeImpl::Id HTMLLegendElementImpl::id() const
-{
- return ID_LEGEND;
-}
-
RenderObject* HTMLLegendElementImpl::createRenderer(RenderArena* arena, RenderStyle* style)
{
return new (arena) RenderLegend(this);
@@ -2621,7 +2608,7 @@
{
// Check if there's a fieldset belonging to this legend.
NodeImpl *fieldset = parentNode();
- while (fieldset && fieldset->id() != ID_FIELDSET)
+ while (fieldset && !fieldset->hasTagName(HTMLNames::fieldset()))
fieldset = fieldset->parentNode();
if (!fieldset)
return 0;
@@ -2632,7 +2619,7 @@
while ((node = node->traverseNextNode(fieldset))) {
if (node->isHTMLElement()) {
HTMLElementImpl *element = static_cast<HTMLElementImpl *>(node);
- if (element->id() != ID_LEGEND && element->isGenericFormElement())
+ if (!element->hasLocalName(HTMLNames::legend()) && element->isGenericFormElement())
return element;
}
}
@@ -2655,8 +2642,20 @@
// -------------------------------------------------------------------------
HTMLSelectElementImpl::HTMLSelectElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
- : HTMLGenericFormElementImpl(doc, f), m_options(0)
+ : HTMLGenericFormElementImpl(HTMLNames::select(), doc, f), m_options(0)
{
+ init();
+}
+
+HTMLSelectElementImpl::HTMLSelectElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f)
+ : HTMLGenericFormElementImpl(tagName, doc, f), m_options(0)
+{
+ init();
+}
+
+void HTMLSelectElementImpl::init()
+{
+ m_options = 0;
m_multiple = false;
m_recalcListItems = false;
// 0 means invalid (i.e. not set)
@@ -2673,9 +2672,10 @@
}
}
-NodeImpl::Id HTMLSelectElementImpl::id() const
+bool HTMLSelectElementImpl::checkDTD(const NodeImpl* newChild)
{
- return ID_SELECT;
+ return newChild->isTextNode() || newChild->hasTagName(HTMLNames::option()) || newChild->hasTagName(HTMLNames::optgroup()) ||
+ newChild->hasTagName(HTMLNames::script());
}
void HTMLSelectElementImpl::recalcStyle( StyleChange ch )
@@ -2699,7 +2699,7 @@
uint o = 0;
QMemArray<HTMLGenericFormElementImpl*> items = listItems();
for (unsigned int i = 0; i < items.size(); i++) {
- if (items[i]->id() == ID_OPTION) {
+ if (items[i]->hasLocalName(HTMLNames::option())) {
if (static_cast<HTMLOptionElementImpl*>(items[i])->selected())
return o;
o++;
@@ -2715,7 +2715,7 @@
QMemArray<HTMLGenericFormElementImpl*> items = listItems();
int listIndex;
for (listIndex = 0; listIndex < int(items.size()); listIndex++) {
- if (items[listIndex]->id() == ID_OPTION)
+ if (items[listIndex]->hasLocalName(HTMLNames::option()))
static_cast<HTMLOptionElementImpl*>(items[listIndex])->setSelected(false);
}
listIndex = optionToListIndex(index);
@@ -2731,7 +2731,7 @@
uint i;
QMemArray<HTMLGenericFormElementImpl*> items = listItems();
for (i = 0; i < items.size(); i++) {
- if (items[i]->id() == ID_OPTION)
+ if (items[i]->hasLocalName(HTMLNames::option()))
len++;
}
return len;
@@ -2739,7 +2739,7 @@
void HTMLSelectElementImpl::add( HTMLElementImpl *element, HTMLElementImpl *before )
{
- if (!element || element->id() != ID_OPTION)
+ if (!element || !element->hasLocalName(HTMLNames::option()))
return;
int exceptioncode = 0;
@@ -2773,13 +2773,12 @@
getDocument()->setFocusNode(this);
}
-DOMString HTMLSelectElementImpl::value( )
+DOMString HTMLSelectElementImpl::value()
{
uint i;
QMemArray<HTMLGenericFormElementImpl*> items = listItems();
for (i = 0; i < items.size(); i++) {
- if ( items[i]->id() == ID_OPTION
- && static_cast<HTMLOptionElementImpl*>(items[i])->selected())
+ if (items[i]->hasLocalName(HTMLNames::option()) && static_cast<HTMLOptionElementImpl*>(items[i])->selected())
return static_cast<HTMLOptionElementImpl*>(items[i])->value();
}
return DOMString("");
@@ -2793,13 +2792,13 @@
// and make it the current selection.
QMemArray<HTMLGenericFormElementImpl*> items = listItems();
for (unsigned i = 0; i < items.size(); i++)
- if (items[i]->id() == ID_OPTION && static_cast<HTMLOptionElementImpl*>(items[i])->value() == value) {
+ if (items[i]->hasLocalName(HTMLNames::option()) && static_cast<HTMLOptionElementImpl*>(items[i])->value() == value) {
static_cast<HTMLOptionElementImpl*>(items[i])->setSelected(true);
return;
}
}
-QString HTMLSelectElementImpl::state( )
+QString HTMLSelectElementImpl::state()
{
#if !APPLE_CHANGES
QString state;
@@ -2812,7 +2811,7 @@
QChar stateChars[l];
for(int i = 0; i < l; i++)
- if(items[i]->id() == ID_OPTION && static_cast<HTMLOptionElementImpl*>(items[i])->selected())
+ if(items[i]->hasLocalName(HTMLNames::option()) && static_cast<HTMLOptionElementImpl*>(items[i])->selected())
stateChars[i] = 'X';
else
stateChars[i] = '.';
@@ -2849,7 +2848,7 @@
int l = items.count();
for(int i = 0; i < l; i++) {
- if(items[i]->id() == ID_OPTION) {
+ if(items[i]->hasLocalName(HTMLNames::option())) {
HTMLOptionElementImpl* oe = static_cast<HTMLOptionElementImpl*>(items[i]);
oe->setSelected(state[i] == 'X');
}
@@ -2941,7 +2940,7 @@
uint i;
for (i = 0; i < items.size(); i++) {
- if (items[i]->id() == ID_OPTION) {
+ if (items[i]->hasLocalName(HTMLNames::option())) {
HTMLOptionElementImpl *option = static_cast<HTMLOptionElementImpl*>(items[i]);
if (option->selected()) {
encoded_values.appendData(name(), option->value());
@@ -2954,7 +2953,7 @@
// in any case. otherwise we have no consistency with the DOM interface. FIXME!
// we return the first one if it was a combobox select
if (!successful && !m_multiple && m_size <= 1 && items.size() &&
- (items[0]->id() == ID_OPTION) ) {
+ (items[0]->hasLocalName(HTMLNames::option()))) {
HTMLOptionElementImpl *option = static_cast<HTMLOptionElementImpl*>(items[0]);
if (option->value().isNull())
encoded_values.appendData(name(), option->text().string().stripWhiteSpace());
@@ -2977,7 +2976,7 @@
for (;
optionIndex2 < int(items.size()) && optionIndex2 <= optionIndex;
listIndex++) { // not a typo!
- if (items[listIndex]->id() == ID_OPTION)
+ if (items[listIndex]->hasLocalName(HTMLNames::option()))
optionIndex2++;
}
listIndex--;
@@ -2988,13 +2987,13 @@
{
QMemArray<HTMLGenericFormElementImpl*> items = listItems();
if (listIndex < 0 || listIndex >= int(items.size()) ||
- items[listIndex]->id() != ID_OPTION)
+ !items[listIndex]->hasLocalName(HTMLNames::option()))
return -1;
int optionIndex = 0; // actual index of option not counting OPTGROUP entries that may be in list
int i;
for (i = 0; i < listIndex; i++)
- if (items[i]->id() == ID_OPTION)
+ if (items[i]->hasLocalName(HTMLNames::option()))
optionIndex++;
return optionIndex;
}
@@ -3020,13 +3019,13 @@
m_listItems.resize(0);
HTMLOptionElementImpl* foundSelected = 0;
while(current) {
- if (current->id() == ID_OPTGROUP && current->firstChild()) {
+ if (current->hasTagName(HTMLNames::optgroup()) && current->firstChild()) {
// ### what if optgroup contains just comments? don't want one of no options in it...
m_listItems.resize(m_listItems.size()+1);
m_listItems[m_listItems.size()-1] = static_cast<HTMLGenericFormElementImpl*>(current);
current = current->firstChild();
}
- if (current->id() == ID_OPTION) {
+ if (current->hasTagName(HTMLNames::option())) {
m_listItems.resize(m_listItems.size()+1);
m_listItems[m_listItems.size()-1] = static_cast<HTMLGenericFormElementImpl*>(current);
if (!foundSelected && !m_multiple && m_size <= 1) {
@@ -3068,7 +3067,7 @@
QMemArray<HTMLGenericFormElementImpl*> items = listItems();
uint i;
for (i = 0; i < items.size(); i++) {
- if (items[i]->id() == ID_OPTION) {
+ if (items[i]->hasLocalName(HTMLNames::option())) {
HTMLOptionElementImpl *option = static_cast<HTMLOptionElementImpl*>(items[i]);
bool selected = (!option->getAttribute(ATTR_SELECTED).isNull());
option->setSelected(selected);
@@ -3086,7 +3085,7 @@
QMemArray<HTMLGenericFormElementImpl*> items = listItems();
uint i;
for (i = 0; i < items.size(); i++) {
- if (items[i]->id() == ID_OPTION)
+ if (items[i]->hasLocalName(HTMLNames::option()))
static_cast<HTMLOptionElementImpl*>(items[i])->m_selected = (items[i] == selectedOption);
}
}
@@ -3133,7 +3132,7 @@
// -------------------------------------------------------------------------
HTMLKeygenElementImpl::HTMLKeygenElementImpl(DocumentPtr* doc, HTMLFormElementImpl* f)
- : HTMLSelectElementImpl(doc, f)
+ : HTMLSelectElementImpl(HTMLNames::keygen(), doc, f)
{
QStringList keys = KSSLKeyGen::supportedKeySizes();
for (QStringList::Iterator i = keys.begin(); i != keys.end(); ++i) {
@@ -3143,11 +3142,6 @@
}
}
-NodeImpl::Id HTMLKeygenElementImpl::id() const
-{
- return ID_KEYGEN;
-}
-
DOMString HTMLKeygenElementImpl::type() const
{
return "keygen";
@@ -3202,7 +3196,7 @@
// -------------------------------------------------------------------------
HTMLOptGroupElementImpl::HTMLOptGroupElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
- : HTMLGenericFormElementImpl(doc, f)
+ : HTMLGenericFormElementImpl(HTMLNames::optgroup(), doc, f)
{
}
@@ -3215,11 +3209,6 @@
return false;
}
-NodeImpl::Id HTMLOptGroupElementImpl::id() const
-{
- return ID_OPTGROUP;
-}
-
DOMString HTMLOptGroupElementImpl::type() const
{
return "optgroup";
@@ -3273,7 +3262,7 @@
void HTMLOptGroupElementImpl::recalcSelectOptions()
{
NodeImpl *select = parentNode();
- while (select && select->id() != ID_SELECT)
+ while (select && !select->hasTagName(HTMLNames::select()))
select = select->parentNode();
if (select)
static_cast<HTMLSelectElementImpl*>(select)->setRecalcListItems();
@@ -3292,7 +3281,7 @@
// -------------------------------------------------------------------------
HTMLOptionElementImpl::HTMLOptionElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
- : HTMLGenericFormElementImpl(doc, f)
+ : HTMLGenericFormElementImpl(HTMLNames::option(), doc, f)
{
m_selected = false;
}
@@ -3302,11 +3291,6 @@
return false;
}
-NodeImpl::Id HTMLOptionElementImpl::id() const
-{
- return ID_OPTION;
-}
-
DOMString HTMLOptionElementImpl::type() const
{
return "option";
@@ -3353,8 +3337,7 @@
int l = items.count();
int optionIndex = 0;
for(int i = 0; i < l; i++) {
- if(items[i]->id() == ID_OPTION)
- {
+ if (items[i]->hasLocalName(HTMLNames::option())) {
if (static_cast<HTMLOptionElementImpl*>(items[i]) == this)
return optionIndex;
optionIndex++;
@@ -3419,7 +3402,7 @@
HTMLSelectElementImpl *HTMLOptionElementImpl::getSelect() const
{
NodeImpl *select = parentNode();
- while (select && select->id() != ID_SELECT)
+ while (select && !select->hasTagName(HTMLNames::select()))
select = select->parentNode();
return static_cast<HTMLSelectElementImpl*>(select);
}
@@ -3447,7 +3430,7 @@
// -------------------------------------------------------------------------
HTMLTextAreaElementImpl::HTMLTextAreaElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
- : HTMLGenericFormElementImpl(doc, f), m_valueIsValid(false), m_valueMatchesRenderer(false)
+ : HTMLGenericFormElementImpl(HTMLNames::textarea(), doc, f), m_valueIsValid(false), m_valueMatchesRenderer(false)
{
// DTD requires rows & cols be specified, but we will provide reasonable defaults
m_rows = 2;
@@ -3460,11 +3443,6 @@
if (getDocument()) getDocument()->deregisterMaintainsState(this);
}
-NodeImpl::Id HTMLTextAreaElementImpl::id() const
-{
- return ID_TEXTAREA;
-}
-
DOMString HTMLTextAreaElementImpl::type() const
{
return "textarea";
@@ -3714,17 +3692,12 @@
// -------------------------------------------------------------------------
HTMLIsIndexElementImpl::HTMLIsIndexElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
- : HTMLInputElementImpl(doc, f)
+ : HTMLInputElementImpl(HTMLNames::isindex(), doc, f)
{
m_type = TEXT;
setOverrideName("isindex");
}
-NodeImpl::Id HTMLIsIndexElementImpl::id() const
-{
- return ID_ISINDEX;
-}
-
void HTMLIsIndexElementImpl::parseMappedAttribute(MappedAttributeImpl* attr)
{
switch(attr->id())
1.76 +31 -19 WebCore/khtml/html/html_formimpl.h
Index: html_formimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_formimpl.h,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- html_formimpl.h 24 Jun 2005 05:53:27 -0000 1.75
+++ html_formimpl.h 9 Jul 2005 20:19:10 -0000 1.76
@@ -67,7 +67,8 @@
HTMLFormElementImpl(DocumentPtr *doc);
virtual ~HTMLFormElementImpl();
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 3; }
virtual void attach();
virtual void detach();
@@ -161,9 +162,12 @@
friend class khtml::RenderFormElement;
public:
- HTMLGenericFormElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
+ HTMLGenericFormElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f = 0);
virtual ~HTMLGenericFormElementImpl();
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+
HTMLFormElementImpl *form() { return m_form; }
virtual DOMString type() const = 0;
@@ -235,7 +239,6 @@
{
public:
HTMLButtonElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
-
virtual ~HTMLButtonElementImpl();
enum typeEnum {
@@ -244,7 +247,6 @@
BUTTON
};
- virtual Id id() const;
DOMString type() const;
virtual void parseMappedAttribute(MappedAttributeImpl *attr);
@@ -280,11 +282,11 @@
{
public:
HTMLFieldSetElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
-
virtual ~HTMLFieldSetElementImpl();
-
- virtual Id id() const;
+ virtual int tagPriority() const { return 3; }
+ virtual bool checkDTD(const NodeImpl* newChild);
+
virtual bool isFocusable() const;
virtual khtml::RenderObject *createRenderer(RenderArena *, khtml::RenderStyle *);
@@ -326,9 +328,12 @@
};
HTMLInputElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
+ HTMLInputElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f = 0);
virtual ~HTMLInputElementImpl();
+ void init();
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
virtual bool isEnumeratable() const { return inputType() != IMAGE; }
@@ -459,9 +464,9 @@
HTMLLabelElementImpl(DocumentPtr *doc);
virtual ~HTMLLabelElementImpl();
+ virtual int tagPriority() const { return 5; }
+
virtual bool isFocusable() const;
-
- virtual Id id() const;
virtual void parseMappedAttribute(MappedAttributeImpl *attr);
@@ -496,7 +501,6 @@
virtual bool isFocusable() const;
- virtual Id id() const;
virtual khtml::RenderObject *createRenderer(RenderArena *, khtml::RenderStyle *);
virtual DOMString type() const;
@@ -525,9 +529,13 @@
public:
HTMLSelectElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
+ HTMLSelectElementImpl(const QualifiedName& tagName, DocumentPtr *doc, HTMLFormElementImpl *f = 0);
~HTMLSelectElementImpl();
+ void init();
+
+ virtual int tagPriority() const { return 6; }
+ virtual bool checkDTD(const NodeImpl* newChild);
- virtual Id id() const;
DOMString type() const;
virtual void recalcStyle( StyleChange );
@@ -614,7 +622,7 @@
public:
HTMLKeygenElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
- virtual Id id() const;
+ virtual int tagPriority() const { return 0; }
DOMString type() const;
@@ -636,7 +644,8 @@
HTMLOptGroupElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
virtual ~HTMLOptGroupElementImpl();
- virtual Id id() const;
+ virtual bool checkDTD(const NodeImpl* newChild) { return newChild->hasTagName(HTMLNames::option()); }
+
DOMString type() const;
virtual bool isFocusable() const;
@@ -664,9 +673,12 @@
public:
HTMLOptionElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
+ virtual int tagPriority() const { return 2; }
+ virtual bool checkDTD(const NodeImpl* newChild) { return newChild->isTextNode(); }
+
virtual bool isFocusable() const;
-
- virtual Id id() const;
+
DOMString type() const;
DOMString text() const;
@@ -714,10 +726,9 @@
HTMLTextAreaElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
~HTMLTextAreaElementImpl();
- virtual Id id() const;
+ virtual bool checkDTD(const NodeImpl* newChild) { return newChild->isTextNode(); }
long cols() const { return m_cols; }
-
long rows() const { return m_rows; }
WrapMethod wrap() const { return m_wrap; }
@@ -785,7 +796,8 @@
public:
HTMLIsIndexElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
virtual void parseMappedAttribute(MappedAttributeImpl *attr);
1.51 +6 -36 WebCore/khtml/html/html_headimpl.cpp
Index: html_headimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_headimpl.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- html_headimpl.cpp 22 Jun 2005 18:22:01 -0000 1.50
+++ html_headimpl.cpp 9 Jul 2005 20:19:10 -0000 1.51
@@ -46,7 +46,7 @@
using namespace khtml;
HTMLBaseElementImpl::HTMLBaseElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::base(), doc)
{
}
@@ -54,11 +54,6 @@
{
}
-NodeImpl::Id HTMLBaseElementImpl::id() const
-{
- return ID_BASE;
-}
-
void HTMLBaseElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
{
switch(attr->id())
@@ -119,7 +114,7 @@
// -------------------------------------------------------------------------
HTMLLinkElementImpl::HTMLLinkElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::link(), doc)
{
m_sheet = 0;
m_loading = false;
@@ -134,11 +129,6 @@
if(m_cachedSheet) m_cachedSheet->deref(this);
}
-NodeImpl::Id HTMLLinkElementImpl::id() const
-{
- return ID_LINK;
-}
-
void HTMLLinkElementImpl::setDisabledState(bool _disabled)
{
int oldDisabledState = m_disabledState;
@@ -423,7 +413,7 @@
// -------------------------------------------------------------------------
-HTMLMetaElementImpl::HTMLMetaElementImpl(DocumentPtr *doc) : HTMLElementImpl(doc)
+HTMLMetaElementImpl::HTMLMetaElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::meta(), doc)
{
}
@@ -431,11 +421,6 @@
{
}
-NodeImpl::Id HTMLMetaElementImpl::id() const
-{
- return ID_META;
-}
-
void HTMLMetaElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
{
switch(attr->id())
@@ -512,7 +497,7 @@
// -------------------------------------------------------------------------
HTMLScriptElementImpl::HTMLScriptElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc), m_cachedScript(0), m_createdByParser(false), m_evaluated(false)
+ : HTMLElementImpl(HTMLNames::script(), doc), m_cachedScript(0), m_createdByParser(false), m_evaluated(false)
{
}
@@ -522,11 +507,6 @@
m_cachedScript->deref(this);
}
-NodeImpl::Id HTMLScriptElementImpl::id() const
-{
- return ID_SCRIPT;
-}
-
bool HTMLScriptElementImpl::isURLAttribute(AttributeImpl *attr) const
{
return attr->id() == ATTR_SRC;
@@ -697,7 +677,7 @@
// -------------------------------------------------------------------------
-HTMLStyleElementImpl::HTMLStyleElementImpl(DocumentPtr *doc) : HTMLElementImpl(doc)
+HTMLStyleElementImpl::HTMLStyleElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::style(), doc)
{
m_sheet = 0;
m_loading = false;
@@ -708,11 +688,6 @@
if(m_sheet) m_sheet->deref();
}
-NodeImpl::Id HTMLStyleElementImpl::id() const
-{
- return ID_STYLE;
-}
-
// other stuff...
void HTMLStyleElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
{
@@ -824,7 +799,7 @@
// -------------------------------------------------------------------------
HTMLTitleElementImpl::HTMLTitleElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc), m_title("")
+ : HTMLElementImpl(HTMLNames::title(), doc), m_title("")
{
}
@@ -832,11 +807,6 @@
{
}
-NodeImpl::Id HTMLTitleElementImpl::id() const
-{
- return ID_TITLE;
-}
-
void HTMLTitleElementImpl::insertedIntoDocument()
{
HTMLElementImpl::insertedIntoDocument();
1.21 +19 -10 WebCore/khtml/html/html_headimpl.h
Index: html_headimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_headimpl.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- html_headimpl.h 19 Jun 2005 05:44:28 -0000 1.20
+++ html_headimpl.h 9 Jul 2005 20:19:10 -0000 1.21
@@ -49,10 +49,12 @@
HTMLBaseElementImpl(DocumentPtr *doc);
~HTMLBaseElementImpl();
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
DOMString href() const { return m_href; }
DOMString target() const { return m_target; }
- virtual Id id() const;
virtual void parseMappedAttribute(MappedAttributeImpl *attr);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
@@ -77,7 +79,8 @@
HTMLLinkElementImpl(DocumentPtr *doc);
~HTMLLinkElementImpl();
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
bool disabled() const;
void setDisabled(bool);
@@ -152,10 +155,11 @@
{
public:
HTMLMetaElementImpl(DocumentPtr *doc);
-
~HTMLMetaElementImpl();
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
virtual void parseMappedAttribute(MappedAttributeImpl *attr);
virtual void insertedIntoDocument();
@@ -185,13 +189,17 @@
public:
HTMLScriptElementImpl(DocumentPtr *doc);
~HTMLScriptElementImpl();
-
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+ virtual bool checkDTD(const NodeImpl* newChild) { return newChild->isTextNode(); }
+
virtual void insertedIntoDocument();
virtual void removedFromDocument();
virtual void notifyFinished(khtml::CachedObject *finishedObj);
+
virtual void childrenChanged();
-
- virtual Id id() const;
+
virtual bool isURLAttribute(AttributeImpl *attr) const;
void setCreatedByParser(bool createdByParser) { m_createdByParser = createdByParser; }
@@ -233,7 +241,9 @@
HTMLStyleElementImpl(DocumentPtr *doc);
~HTMLStyleElementImpl();
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+ virtual bool checkDTD(const NodeImpl* newChild) { return newChild->isTextNode(); }
StyleSheetImpl *sheet() const { return m_sheet; }
@@ -268,10 +278,9 @@
{
public:
HTMLTitleElementImpl(DocumentPtr *doc);
-
~HTMLTitleElementImpl();
- virtual Id id() const;
+ virtual bool checkDTD(const NodeImpl* newChild) { return newChild->isTextNode(); }
virtual void insertedIntoDocument();
virtual void removedFromDocument();
1.44 +25 -28 WebCore/khtml/html/html_imageimpl.cpp
Index: html_imageimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_imageimpl.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- html_imageimpl.cpp 21 Jun 2005 22:27:55 -0000 1.43
+++ html_imageimpl.cpp 9 Jul 2005 20:19:10 -0000 1.44
@@ -51,7 +51,7 @@
using namespace DOM;
using namespace khtml;
-//#define INSTRUMENT_LAYOUT_SCHEDULING 1
+// #define INSTRUMENT_LAYOUT_SCHEDULING 1
HTMLImageLoader::HTMLImageLoader(ElementImpl* elt)
:m_element(elt), m_image(0), m_firedLoad(true), m_imageComplete(true)
@@ -75,7 +75,7 @@
return;
AtomicString attr;
- if (element()->id() == ID_OBJECT)
+ if (element()->hasLocalName(HTMLNames::object()))
attr = element()->getAttribute(ATTR_DATA);
else
attr = element()->getAttribute(ATTR_SRC);
@@ -86,6 +86,10 @@
newImage = element()->getDocument()->docLoader()->requestImage(khtml::parseURL(attr));
if (newImage != m_image) {
+#ifdef INSTRUMENT_LAYOUT_SCHEDULING
+ if (!document->ownerElement() && newImage)
+ printf("Image requested at %d\n", element()->getDocument()->elapsedTime());
+#endif
m_firedLoad = false;
m_imageComplete = false;
CachedImage* oldImage = m_image;
@@ -133,21 +137,21 @@
// -------------------------------------------------------------------------
HTMLImageElementImpl::HTMLImageElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f)
- : HTMLElementImpl(doc), m_imageLoader(this), ismap(false), m_form(f)
+ : HTMLElementImpl(HTMLNames::img(), doc), m_imageLoader(this), ismap(false), m_form(f)
{
if (m_form)
m_form->registerImgElement(this);
}
-HTMLImageElementImpl::~HTMLImageElementImpl()
+HTMLImageElementImpl::HTMLImageElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
+ : HTMLElementImpl(tagName, doc), m_imageLoader(this), ismap(false), m_form(0)
{
- if (m_form)
- m_form->removeImgElement(this);
}
-NodeImpl::Id HTMLImageElementImpl::id() const
+HTMLImageElementImpl::~HTMLImageElementImpl()
{
- return ID_IMG;
+ if (m_form)
+ m_form->removeImgElement(this);
}
bool HTMLImageElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
@@ -528,7 +532,7 @@
// -------------------------------------------------------------------------
HTMLMapElementImpl::HTMLMapElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::map(), doc)
{
}
@@ -538,9 +542,11 @@
getDocument()->removeImageMap(this);
}
-NodeImpl::Id HTMLMapElementImpl::id() const
+bool HTMLMapElementImpl::checkDTD(const NodeImpl* newChild)
{
- return ID_MAP;
+ // FIXME: This seems really odd, allowing only blocks inside map.
+ return newChild->hasTagName(HTMLNames::area()) || newChild->hasTagName(HTMLNames::script()) ||
+ inBlockTagList(newChild);
}
bool
@@ -552,32 +558,28 @@
QPtrStack<NodeImpl> nodeStack;
NodeImpl *current = firstChild();
- while(1)
- {
- if(!current)
- {
+ while (1) {
+ if (!current) {
if(nodeStack.isEmpty()) break;
current = nodeStack.pop();
current = current->nextSibling();
continue;
}
- if(current->id()==ID_AREA)
- {
+
+ if (current->hasTagName(HTMLNames::area())) {
//cout << "area found " << endl;
- HTMLAreaElementImpl* area=static_cast<HTMLAreaElementImpl*>(current);
+ HTMLAreaElementImpl* area = static_cast<HTMLAreaElementImpl*>(current);
if (area->mapMouseEvent(x_,y_,width_,height_, info))
return true;
}
+
NodeImpl *child = current->firstChild();
- if(child)
- {
+ if (child) {
nodeStack.push(current);
current = child;
}
else
- {
current = current->nextSibling();
- }
}
return false;
@@ -622,7 +624,7 @@
// -------------------------------------------------------------------------
HTMLAreaElementImpl::HTMLAreaElementImpl(DocumentPtr *doc)
- : HTMLAnchorElementImpl(doc)
+ : HTMLAnchorElementImpl(HTMLNames::area(), doc)
{
m_coords=0;
m_coordsLen = 0;
@@ -635,11 +637,6 @@
if (m_coords) delete [] m_coords;
}
-NodeImpl::Id HTMLAreaElementImpl::id() const
-{
- return ID_AREA;
-}
-
void HTMLAreaElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
{
switch (attr->id())
1.22 +8 -4 WebCore/khtml/html/html_imageimpl.h
Index: html_imageimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_imageimpl.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- html_imageimpl.h 11 May 2005 05:49:34 -0000 1.21
+++ html_imageimpl.h 9 Jul 2005 20:19:10 -0000 1.22
@@ -75,9 +75,11 @@
friend class HTMLFormElementImpl;
public:
HTMLImageElementImpl(DocumentPtr *doc, HTMLFormElementImpl *f = 0);
+ HTMLImageElementImpl(const QualifiedName& tagName, DocumentPtr* doc);
~HTMLImageElementImpl();
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
virtual bool mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *);
@@ -161,7 +163,8 @@
HTMLAreaElementImpl(DocumentPtr *doc);
~HTMLAreaElementImpl();
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
virtual void parseMappedAttribute(MappedAttributeImpl *attr);
@@ -212,10 +215,11 @@
{
public:
HTMLMapElementImpl(DocumentPtr *doc);
-
~HTMLMapElementImpl();
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+ virtual bool checkDTD(const NodeImpl* newChild);
virtual DOMString getName() const { return m_name; }
1.43 +13 -27 WebCore/khtml/html/html_inlineimpl.cpp
Index: html_inlineimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_inlineimpl.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- html_inlineimpl.cpp 11 May 2005 05:49:34 -0000 1.42
+++ html_inlineimpl.cpp 9 Jul 2005 20:19:10 -0000 1.43
@@ -45,7 +45,13 @@
namespace DOM {
HTMLAnchorElementImpl::HTMLAnchorElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::a(), doc)
+{
+ m_hasTarget = false;
+}
+
+HTMLAnchorElementImpl::HTMLAnchorElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
+ : HTMLElementImpl(tagName, doc)
{
m_hasTarget = false;
}
@@ -104,11 +110,6 @@
return getDocument()->part()->tabsToLinks();
}
-NodeImpl::Id HTMLAnchorElementImpl::id() const
-{
- return ID_A;
-}
-
void HTMLAnchorElementImpl::defaultEventHandler(EventImpl *evt)
{
// React on clicks and on keypresses.
@@ -152,7 +153,7 @@
if ( e && e->button() == 1 )
utarget = "_blank";
- if ( evt->target()->id() == ID_IMG ) {
+ if (evt->target()->hasTagName(HTMLNames::img())) {
HTMLImageElementImpl* img = static_cast<HTMLImageElementImpl*>( evt->target() );
if ( img && img->isServerMap() )
{
@@ -382,7 +383,7 @@
// -------------------------------------------------------------------------
-HTMLBRElementImpl::HTMLBRElementImpl(DocumentPtr *doc) : HTMLElementImpl(doc)
+HTMLBRElementImpl::HTMLBRElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::br(), doc)
{
}
@@ -390,11 +391,6 @@
{
}
-NodeImpl::Id HTMLBRElementImpl::id() const
-{
- return ID_BR;
-}
-
bool HTMLBRElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
{
if (attr == ATTR_CLEAR) {
@@ -445,7 +441,7 @@
// -------------------------------------------------------------------------
HTMLFontElementImpl::HTMLFontElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::font(), doc)
{
}
@@ -453,11 +449,6 @@
{
}
-NodeImpl::Id HTMLFontElementImpl::id() const
-{
- return ID_FONT;
-}
-
// Allows leading spaces.
// Allows trailing nonnumeric characters.
// Returns 10 for any size greater than 9.
@@ -590,8 +581,8 @@
// -------------------------------------------------------------------------
-HTMLModElementImpl::HTMLModElementImpl(DocumentPtr *doc, ushort elementId)
- : HTMLGenericElementImpl(doc, elementId)
+HTMLModElementImpl::HTMLModElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
+ : HTMLElementImpl(tagName, doc)
{
}
@@ -618,15 +609,10 @@
// -------------------------------------------------------------------------
HTMLQuoteElementImpl::HTMLQuoteElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::q(), doc)
{
}
-NodeImpl::Id HTMLQuoteElementImpl::id() const
-{
- return ID_Q;
-}
-
DOMString HTMLQuoteElementImpl::cite() const
{
return getAttribute(ATTR_CITE);
1.20 +18 -9 WebCore/khtml/html/html_inlineimpl.h
Index: html_inlineimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_inlineimpl.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- html_inlineimpl.h 11 May 2005 05:49:34 -0000 1.19
+++ html_inlineimpl.h 9 Jul 2005 20:19:10 -0000 1.20
@@ -34,12 +34,15 @@
{
public:
HTMLAnchorElementImpl(DocumentPtr *doc);
+ HTMLAnchorElementImpl(const QualifiedName& tagName, DocumentPtr* doc);
~HTMLAnchorElementImpl();
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+
virtual bool isMouseFocusable() const;
virtual bool isKeyboardFocusable() const;
virtual bool isFocusable() const;
- virtual Id id() const;
virtual void parseMappedAttribute(MappedAttributeImpl *attr);
virtual void defaultEventHandler(EventImpl *evt);
virtual void accessKeyAction(bool fullAction);
@@ -97,9 +100,10 @@
public:
HTMLBRElementImpl(DocumentPtr *doc);
~HTMLBRElementImpl();
-
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *attr);
@@ -116,9 +120,10 @@
public:
HTMLFontElementImpl(DocumentPtr *doc);
~HTMLFontElementImpl();
-
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+
virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *attr);
@@ -134,10 +139,13 @@
// -------------------------------------------------------------------------
-class HTMLModElementImpl : public HTMLGenericElementImpl
+class HTMLModElementImpl : public HTMLElementImpl
{
public:
- HTMLModElementImpl(DocumentPtr *doc, ushort elementId);
+ HTMLModElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
DOMString cite() const;
void setCite(const DOMString &);
@@ -152,9 +160,10 @@
{
public:
HTMLQuoteElementImpl(DocumentPtr *doc);
-
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+
DOMString cite() const;
void setCite(const DOMString &);
};
1.10 +7 -38 WebCore/khtml/html/html_listimpl.cpp
Index: html_listimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_listimpl.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- html_listimpl.cpp 11 May 2005 05:49:34 -0000 1.9
+++ html_listimpl.cpp 9 Jul 2005 20:19:10 -0000 1.10
@@ -32,11 +32,6 @@
namespace DOM {
-NodeImpl::Id HTMLUListElementImpl::id() const
-{
- return ID_UL;
-}
-
bool HTMLUListElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
{
switch (attr) {
@@ -84,11 +79,6 @@
// -------------------------------------------------------------------------
-NodeImpl::Id HTMLDirectoryElementImpl::id() const
-{
- return ID_DIR;
-}
-
bool HTMLDirectoryElementImpl::compact() const
{
return !getAttribute(ATTR_COMPACT).isNull();
@@ -101,11 +91,6 @@
// -------------------------------------------------------------------------
-NodeImpl::Id HTMLMenuElementImpl::id() const
-{
- return ID_MENU;
-}
-
bool HTMLMenuElementImpl::compact() const
{
return !getAttribute(ATTR_COMPACT).isNull();
@@ -118,11 +103,6 @@
// -------------------------------------------------------------------------
-NodeImpl::Id HTMLOListElementImpl::id() const
-{
- return ID_OL;
-}
-
bool HTMLOListElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
{
switch (attr) {
@@ -153,9 +133,10 @@
addCSSProperty(attr, CSS_PROP_LIST_STYLE_TYPE, CSS_VAL_DECIMAL);
break;
case ATTR_START:
- _start = !attr->isNull() ? attr->value().toInt() : 1;
+ _start = !attr->isNull() ? attr->value().toInt() : 1;
+ break;
default:
- HTMLUListElementImpl::parseMappedAttribute(attr);
+ HTMLElementImpl::parseMappedAttribute(attr);
}
}
@@ -186,11 +167,6 @@
// -------------------------------------------------------------------------
-NodeImpl::Id HTMLLIElementImpl::id() const
-{
- return ID_LI;
-}
-
bool HTMLLIElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
{
switch (attr) {
@@ -252,11 +228,8 @@
NodeImpl *listNode = 0;
NodeImpl *n = this;
while (!listNode && (n = n->parentNode())) {
- switch (n->id()) {
- case ID_UL:
- case ID_OL:
- listNode = n;
- }
+ if (n->hasTagName(HTMLNames::ul()) || n->hasTagName(HTMLNames::ol()))
+ listNode = n;
}
// If we are not in a list, tell the renderer so it can position us inside.
@@ -265,7 +238,7 @@
render->setNotInList(true);
// If we are first, and the OL has a start attr, set the value.
- if (listNode && listNode->id() == ID_OL && !m_render->previousSibling()) {
+ if (listNode && listNode->hasTagName(HTMLNames::ol()) && !m_render->previousSibling()) {
HTMLOListElementImpl *ol = static_cast<HTMLOListElementImpl *>(listNode);
render->setValue(ol->start());
}
@@ -295,12 +268,8 @@
{
setAttribute(ATTR_VALUE, QString::number(value));
}
-// -------------------------------------------------------------------------
-NodeImpl::Id HTMLDListElementImpl::id() const
-{
- return ID_DL;
-}
+// -------------------------------------------------------------------------
bool HTMLDListElementImpl::compact() const
{
1.8 +20 -14 WebCore/khtml/html/html_listimpl.h
Index: html_listimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_listimpl.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- html_listimpl.h 11 May 2005 05:49:34 -0000 1.7
+++ html_listimpl.h 9 Jul 2005 20:19:10 -0000 1.8
@@ -35,10 +35,11 @@
class HTMLUListElementImpl : public HTMLElementImpl
{
public:
- HTMLUListElementImpl(DocumentPtr *doc) : HTMLElementImpl(doc) {}
+ HTMLUListElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::ul(), doc) {}
virtual ~HTMLUListElementImpl() {}
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *);
@@ -57,9 +58,10 @@
class HTMLDirectoryElementImpl : public HTMLElementImpl
{
public:
- HTMLDirectoryElementImpl(DocumentPtr *doc) : HTMLElementImpl(doc) {}
+ HTMLDirectoryElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::dir(), doc) {}
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
bool compact() const;
void setCompact(bool);
@@ -70,9 +72,10 @@
class HTMLMenuElementImpl : public HTMLElementImpl
{
public:
- HTMLMenuElementImpl(DocumentPtr *doc) : HTMLElementImpl(doc) {}
+ HTMLMenuElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::menu(), doc) {}
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
bool compact() const;
void setCompact(bool);
@@ -80,14 +83,15 @@
// -------------------------------------------------------------------------
-class HTMLOListElementImpl : public HTMLUListElementImpl
+class HTMLOListElementImpl : public HTMLElementImpl
{
public:
HTMLOListElementImpl(DocumentPtr *doc)
- : HTMLUListElementImpl(doc) { _start = 1; }
-
- virtual Id id() const;
+ : HTMLElementImpl(HTMLNames::ol(), doc) { _start = 1; }
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
+
virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *);
@@ -110,10 +114,11 @@
{
public:
HTMLLIElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc) { isValued = false; }
+ : HTMLElementImpl(HTMLNames::li(), doc) { isValued = false; }
virtual ~HTMLLIElementImpl() {}
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
+ virtual int tagPriority() const { return 3; }
virtual bool mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *attr);
@@ -136,10 +141,11 @@
class HTMLDListElementImpl : public HTMLElementImpl
{
public:
- HTMLDListElementImpl(DocumentPtr *doc) : HTMLElementImpl(doc) {}
+ HTMLDListElementImpl(DocumentPtr *doc) : HTMLElementImpl(HTMLNames::dl(), doc) {}
virtual ~HTMLDListElementImpl() {}
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
bool compact() const;
void setCompact(bool);
1.27 +46 -50 WebCore/khtml/html/html_miscimpl.cpp
Index: html_miscimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_miscimpl.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- html_miscimpl.cpp 11 Jun 2005 09:51:01 -0000 1.26
+++ html_miscimpl.cpp 9 Jul 2005 20:19:10 -0000 1.27
@@ -35,15 +35,10 @@
namespace DOM {
HTMLBaseFontElementImpl::HTMLBaseFontElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::basefont(), doc)
{
}
-NodeImpl::Id HTMLBaseFontElementImpl::id() const
-{
- return ID_BASEFONT;
-}
-
DOMString HTMLBaseFontElementImpl::color() const
{
return getAttribute(ATTR_COLOR);
@@ -141,72 +136,72 @@
HTMLElementImpl *e = static_cast<HTMLElementImpl *>(current);
switch(type) {
case DOC_IMAGES:
- if(e->id() == ID_IMG)
+ if (e->hasLocalName(HTMLNames::img()))
found = true;
break;
case DOC_FORMS:
- if(e->id() == ID_FORM)
+ if(e->hasLocalName(HTMLNames::form()))
found = true;
break;
case DOC_NAMEABLE_ITEMS:
- if(e->id() == ID_IMG)
+ if (e->hasLocalName(HTMLNames::img()))
found = true;
- if(e->id() == ID_FORM)
+ if (e->hasLocalName(HTMLNames::form()))
found = true;
- if(e->id() == ID_APPLET)
+ if (e->hasLocalName(HTMLNames::applet()))
found = true;
- if(e->id() == ID_EMBED)
+ if (e->hasLocalName(HTMLNames::embed()))
found = true;
- if(e->id() == ID_OBJECT)
+ if (e->hasLocalName(HTMLNames::object()))
found = true;
break;
case TABLE_TBODIES:
- if(e->id() == ID_TBODY)
+ if (e->hasLocalName(HTMLNames::tbody()))
found = true;
- else if(e->id() == ID_TABLE)
+ else if (e->hasLocalName(HTMLNames::table()))
deep = false;
break;
case TR_CELLS:
- if(e->id() == ID_TD || e->id() == ID_TH)
+ if (e->hasLocalName(HTMLNames::td()) || e->hasLocalName(HTMLNames::th()))
found = true;
- else if(e->id() == ID_TABLE)
+ else if (e->hasLocalName(HTMLNames::table()))
deep = false;
break;
case TABLE_ROWS:
case TSECTION_ROWS:
- if(e->id() == ID_TR)
+ if (e->hasLocalName(HTMLNames::tr()))
found = true;
- else if(e->id() == ID_TABLE)
+ else if (e->hasLocalName(HTMLNames::table()))
deep = false;
break;
case SELECT_OPTIONS:
- if(e->id() == ID_OPTION)
+ if (e->hasLocalName(HTMLNames::option()))
found = true;
break;
case MAP_AREAS:
- if(e->id() == ID_AREA)
+ if (e->hasLocalName(HTMLNames::area()))
found = true;
break;
case DOC_APPLETS: // all OBJECT and APPLET elements
- if(e->id() == ID_OBJECT || e->id() == ID_APPLET)
+ if (e->hasLocalName(HTMLNames::object()) || e->hasLocalName(HTMLNames::applet()))
found = true;
break;
case DOC_EMBEDS: // all EMBED elements
- if(e->id() == ID_EMBED)
+ if (e->hasLocalName(HTMLNames::embed()))
found = true;
break;
case DOC_OBJECTS: // all OBJECT elements
- if(e->id() == ID_OBJECT)
+ if (e->hasLocalName(HTMLNames::object()))
found = true;
break;
case DOC_LINKS: // all A _and_ AREA elements with a value for href
- if(e->id() == ID_A || e->id() == ID_AREA)
- if(!e->getAttribute(ATTR_HREF).isNull())
+ if (e->hasLocalName(HTMLNames::a()) || e->hasLocalName(HTMLNames::area()))
+ if (!e->getAttribute(ATTR_HREF).isNull())
found = true;
break;
case DOC_ANCHORS: // all A elements with a value for name or an id attribute
- if(e->id() == ID_A)
- if(!e->getAttribute(ATTR_NAME).isNull())
+ if (e->hasLocalName(HTMLNames::a()))
+ if (!e->getAttribute(ATTR_NAME).isNull())
found = true;
break;
case DOC_ALL:
@@ -219,9 +214,9 @@
default:
kdDebug( 6030 ) << "Error in HTMLCollection, wrong tagId!" << endl;
}
- if (found) {
+
+ if (found)
return current;
- }
if (deep) {
current = current->traverseNextNode(m_base.get());
continue;
@@ -298,29 +293,31 @@
bool HTMLCollectionImpl::checkForNameMatch(NodeImpl *node, bool checkName, const DOMString &name, bool caseSensitive) const
{
- ElementImpl *e = static_cast<ElementImpl *>(node);
+ if (!node->isHTMLElement())
+ return false;
+
+ HTMLElementImpl *e = static_cast<HTMLElementImpl*>(node);
if (caseSensitive) {
if (checkName) {
// document.all returns only images, forms, applets, objects and embeds
// by name (though everything by id)
if (type == DOC_ALL &&
- !(e->id() == ID_IMG || e->id() == ID_FORM ||
- e->id() == ID_APPLET || e->id() == ID_OBJECT ||
- e->id() == ID_EMBED))
+ !(e->hasLocalName(HTMLNames::img()) || e->hasLocalName(HTMLNames::form()) ||
+ e->hasLocalName(HTMLNames::applet()) || e->hasLocalName(HTMLNames::object()) ||
+ e->hasLocalName(HTMLNames::embed())))
return false;
return e->getAttribute(ATTR_NAME) == name && e->getAttribute(ATTR_ID) != name;
- } else {
+ } else
return e->getAttribute(ATTR_ID) == name;
- }
} else {
if (checkName) {
// document.all returns only images, forms, applets, objects and embeds
// by name (though everything by id)
if (type == DOC_ALL &&
- !(e->id() == ID_IMG || e->id() == ID_FORM ||
- e->id() == ID_APPLET || e->id() == ID_OBJECT ||
- e->id() == ID_EMBED))
+ !(e->hasLocalName(HTMLNames::img()) || e->hasLocalName(HTMLNames::form()) ||
+ e->hasLocalName(HTMLNames::applet()) || e->hasLocalName(HTMLNames::object()) ||
+ e->hasLocalName(HTMLNames::embed())))
return false;
return e->getAttribute(ATTR_NAME).domString().lower() == name.lower() &&
@@ -379,7 +376,9 @@
return;
for (NodeImpl *n = traverseNextItem(m_base.get()); n; n = traverseNextItem(n)) {
- ElementImpl *e = static_cast<ElementImpl *>(n);
+ if (!n->isHTMLElement())
+ continue;
+ HTMLElementImpl* e = static_cast<HTMLElementImpl*>(n);
QString idAttr = e->getAttribute(ATTR_ID).string();
QString nameAttr = e->getAttribute(ATTR_NAME).string();
if (!idAttr.isEmpty()) {
@@ -393,9 +392,9 @@
}
if (!nameAttr.isEmpty() && idAttr != nameAttr
&& (type != DOC_ALL ||
- (e->id() == ID_IMG || e->id() == ID_FORM ||
- e->id() == ID_APPLET || e->id() == ID_OBJECT ||
- e->id() == ID_EMBED))) {
+ (e->hasLocalName(HTMLNames::img()) || e->hasLocalName(HTMLNames::form()) ||
+ e->hasLocalName(HTMLNames::applet()) || e->hasLocalName(HTMLNames::object()) ||
+ e->hasLocalName(HTMLNames::embed())))) {
// add to name cache
QPtrVector<NodeImpl> *nameVector = info->nameCache.find(nameAttr);
if (!nameVector) {
@@ -532,12 +531,10 @@
NodeImpl* HTMLFormCollectionImpl::getNamedFormItem(int attr_id, const DOMString& name, int duplicateNumber, bool caseSensitive) const
{
- if(m_base->nodeType() == Node::ELEMENT_NODE)
- {
+ if (m_base->nodeType() == Node::ELEMENT_NODE) {
HTMLElementImpl* baseElement = static_cast<HTMLElementImpl*>(m_base.get());
bool foundInputElements = false;
- if(baseElement->id() == ID_FORM)
- {
+ if (baseElement->hasLocalName(HTMLNames::form())) {
HTMLFormElementImpl* f = static_cast<HTMLFormElementImpl*>(baseElement);
for (unsigned i = 0; i < f->formElements.count(); ++i) {
HTMLGenericFormElementImpl* e = f->formElements[i];
@@ -557,8 +554,7 @@
}
}
- if ( !foundInputElements )
- {
+ if (!foundInputElements) {
HTMLFormElementImpl* f = static_cast<HTMLFormElementImpl*>(baseElement);
for(unsigned i = 0; i < f->imgElements.count(); ++i)
@@ -650,7 +646,7 @@
QDict<char> foundInputElements;
- if (m_base->id() != ID_FORM) {
+ if (!m_base->hasTagName(HTMLNames::form())) {
info->hasNameCache = true;
return;
}
1.17 +2 -1 WebCore/khtml/html/html_miscimpl.h
Index: html_miscimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_miscimpl.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- html_miscimpl.h 11 May 2005 00:58:28 -0000 1.16
+++ html_miscimpl.h 9 Jul 2005 20:19:10 -0000 1.17
@@ -39,7 +39,8 @@
public:
HTMLBaseFontElementImpl(DocumentPtr *doc);
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
DOMString color() const;
void setColor(const DOMString &);
1.68 +13 -18 WebCore/khtml/html/html_objectimpl.cpp
Index: html_objectimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_objectimpl.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- html_objectimpl.cpp 29 Jun 2005 17:50:24 -0000 1.67
+++ html_objectimpl.cpp 9 Jul 2005 20:19:10 -0000 1.68
@@ -58,7 +58,7 @@
// -------------------------------------------------------------------------
HTMLAppletElementImpl::HTMLAppletElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::applet(), doc)
{
appletInstance = 0;
m_allParamsAvailable = false;
@@ -69,9 +69,9 @@
delete appletInstance;
}
-NodeImpl::Id HTMLAppletElementImpl::id() const
+bool HTMLAppletElementImpl::checkDTD(const NodeImpl* newChild)
{
- return ID_APPLET;
+ return newChild->hasTagName(HTMLNames::param()) || HTMLElementImpl::checkDTD(newChild);
}
bool HTMLAppletElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
@@ -353,16 +353,16 @@
// -------------------------------------------------------------------------
HTMLEmbedElementImpl::HTMLEmbedElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc), embedInstance(0)
+ : HTMLElementImpl(HTMLNames::embed(), doc), embedInstance(0)
{}
HTMLEmbedElementImpl::~HTMLEmbedElementImpl()
{
}
-NodeImpl::Id HTMLEmbedElementImpl::id() const
+bool HTMLEmbedElementImpl::checkDTD(const NodeImpl* newChild)
{
- return ID_EMBED;
+ return newChild->hasTagName(HTMLNames::param()) || HTMLElementImpl::checkDTD(newChild);
}
#if APPLE_CHANGES
@@ -479,7 +479,7 @@
KHTMLPart *part = getDocument()->part();
if (!part)
return false;
- return part->pluginsEnabled() && parentNode()->id() != ID_OBJECT;
+ return part->pluginsEnabled() && !parentNode()->hasTagName(HTMLNames::object());
}
RenderObject *HTMLEmbedElementImpl::createRenderer(RenderArena *arena, RenderStyle *style)
@@ -504,9 +504,9 @@
HTMLObjectElementImpl::HTMLObjectElementImpl(DocumentPtr *doc)
#if APPLE_CHANGES
-: HTMLElementImpl(doc), m_imageLoader(0), objectInstance(0)
+: HTMLElementImpl(HTMLNames::object(), doc), m_imageLoader(0), objectInstance(0)
#else
-: HTMLElementImpl(doc), m_imageLoader(0)
+: HTMLElementImpl(HTMLNames::object(), doc), m_imageLoader(0)
#endif
{
needWidgetUpdate = false;
@@ -518,9 +518,9 @@
delete m_imageLoader;
}
-NodeImpl::Id HTMLObjectElementImpl::id() const
+bool HTMLObjectElementImpl::checkDTD(const NodeImpl* newChild)
{
- return ID_OBJECT;
+ return newChild->hasTagName(HTMLNames::param()) || HTMLElementImpl::checkDTD(newChild);
}
#if APPLE_CHANGES
@@ -555,7 +555,7 @@
HTMLFormElementImpl *HTMLObjectElementImpl::form() const
{
for (NodeImpl *p = parentNode(); p != 0; p = p->parentNode()) {
- if (p->id() == ID_FORM)
+ if (p->hasTagName(HTMLNames::form()))
return static_cast<HTMLFormElementImpl *>(p);
}
@@ -950,7 +950,7 @@
// -------------------------------------------------------------------------
HTMLParamElementImpl::HTMLParamElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::param(), doc)
{
}
@@ -958,11 +958,6 @@
{
}
-NodeImpl::Id HTMLParamElementImpl::id() const
-{
- return ID_PARAM;
-}
-
void HTMLParamElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
{
switch( attr->id() )
1.32 +12 -9 WebCore/khtml/html/html_objectimpl.h
Index: html_objectimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_objectimpl.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- html_objectimpl.h 11 May 2005 05:49:34 -0000 1.31
+++ html_objectimpl.h 9 Jul 2005 20:19:10 -0000 1.32
@@ -42,11 +42,12 @@
{
public:
HTMLAppletElementImpl(DocumentPtr *doc);
-
~HTMLAppletElementImpl();
- virtual Id id() const;
-
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+ virtual bool checkDTD(const NodeImpl* newChild);
+
virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *token);
@@ -112,10 +113,11 @@
{
public:
HTMLEmbedElementImpl(DocumentPtr *doc);
-
~HTMLEmbedElementImpl();
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 0; }
+ virtual bool checkDTD(const NodeImpl* newChild);
virtual bool mapToEntry(Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *attr);
@@ -146,10 +148,11 @@
{
public:
HTMLObjectElementImpl(DocumentPtr *doc);
-
~HTMLObjectElementImpl();
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 7; }
+ virtual bool checkDTD(const NodeImpl* newChild);
HTMLFormElementImpl *form() const;
@@ -247,10 +250,10 @@
friend class HTMLAppletElementImpl;
public:
HTMLParamElementImpl(DocumentPtr *doc);
-
~HTMLParamElementImpl();
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
virtual void parseMappedAttribute(MappedAttributeImpl *token);
1.54 +55 -84 WebCore/khtml/html/html_tableimpl.cpp
Index: html_tableimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_tableimpl.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- html_tableimpl.cpp 17 Jun 2005 21:55:39 -0000 1.53
+++ html_tableimpl.cpp 9 Jul 2005 20:19:10 -0000 1.54
@@ -51,7 +51,7 @@
namespace DOM {
HTMLTableElementImpl::HTMLTableElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ : HTMLElementImpl(HTMLNames::table(), doc)
{
tCaption = 0;
head = 0;
@@ -73,9 +73,13 @@
{
}
-NodeImpl::Id HTMLTableElementImpl::id() const
+bool HTMLTableElementImpl::checkDTD(const NodeImpl* newChild)
{
- return ID_TABLE;
+ return newChild->isTextNode() || newChild->hasTagName(HTMLNames::caption()) ||
+ newChild->hasTagName(HTMLNames::col()) || newChild->hasTagName(HTMLNames::colgroup()) ||
+ newChild->hasTagName(HTMLNames::thead()) || newChild->hasTagName(HTMLNames::tfoot()) ||
+ newChild->hasTagName(HTMLNames::tbody()) || newChild->hasTagName(HTMLNames::form()) ||
+ newChild->hasTagName(HTMLNames::script());
}
NodeImpl* HTMLTableElementImpl::setCaption( HTMLTableCaptionElementImpl *c )
@@ -146,7 +150,7 @@
if(!head)
{
int exceptioncode = 0;
- head = new HTMLTableSectionElementImpl(docPtr(), ID_THEAD, true /* implicit */);
+ head = new HTMLTableSectionElementImpl(HTMLNames::thead(), docPtr(), true /* implicit */);
if(foot)
insertBefore( head, foot, exceptioncode );
else if(firstBody)
@@ -171,7 +175,7 @@
if(!foot)
{
int exceptioncode = 0;
- foot = new HTMLTableSectionElementImpl(docPtr(), ID_TFOOT, true /*implicit */);
+ foot = new HTMLTableSectionElementImpl(HTMLNames::tfoot(), docPtr(), true /*implicit */);
if(firstBody)
insertBefore( foot, firstBody, exceptioncode );
else
@@ -216,7 +220,7 @@
// (note: this is different from "if the table has no sections", since we can have
// <TABLE><TR>)
if(!firstBody && !head && !foot && !hasChildNodes())
- setTBody( new HTMLTableSectionElementImpl(docPtr(), ID_TBODY, true /* implicit */) );
+ setTBody( new HTMLTableSectionElementImpl(HTMLNames::tbody(), docPtr(), true /* implicit */) );
//kdDebug(6030) << k_funcinfo << index << endl;
// IE treats index=-1 as default value meaning 'append after last'
@@ -230,7 +234,8 @@
{
// there could be 2 tfoot elements in the table. Only the first one is the "foot", that's why we have the more
// complicated if statement below.
- if ( node != foot && (node->id() == ID_THEAD || node->id() == ID_TFOOT || node->id() == ID_TBODY) )
+ if (node != foot && (node->hasTagName(HTMLNames::thead()) || node->hasTagName(HTMLNames::tfoot()) ||
+ node->hasTagName(HTMLNames::tbody())))
{
section = static_cast<HTMLTableSectionElementImpl *>(node);
lastSection = section;
@@ -276,8 +281,8 @@
bool found = false;
for ( ; node ; node = node->nextSibling() )
{
- if ( node != foot && (node->id() == ID_THEAD || node->id() == ID_TFOOT || node->id() == ID_TBODY) )
- {
+ if (node != foot && (node->hasTagName(HTMLNames::thead()) || node->hasTagName(HTMLNames::tfoot()) ||
+ node->hasTagName(HTMLNames::tbody()))) {
section = static_cast<HTMLTableSectionElementImpl *>(node);
lastSection = section;
int rows = section->numRows();
@@ -309,7 +314,7 @@
kdDebug( 6030 ) << nodeName().string() << "(Table)::addChild( " << child->nodeName().string() << " )" << endl;
#endif
- if (child->id() == ID_FORM) {
+ if (child->hasTagName(HTMLNames::form())) {
// First add the child.
HTMLElementImpl::addChild(child);
// Now simply return ourselves as the newnode. This has the effect of
@@ -337,28 +342,15 @@
int exceptioncode = 0;
NodeImpl *retval = appendChild( child, exceptioncode );
- if ( retval ) {
- switch(child->id()) {
- case ID_CAPTION:
- if ( !tCaption )
- tCaption = static_cast<HTMLTableCaptionElementImpl *>(child);
- break;
- case ID_COL:
- case ID_COLGROUP:
- break;
- case ID_THEAD:
- if ( !head )
- head = static_cast<HTMLTableSectionElementImpl *>(child);
- break;
- case ID_TFOOT:
- if ( !foot )
- foot = static_cast<HTMLTableSectionElementImpl *>(child);
- break;
- case ID_TBODY:
- if ( !firstBody )
- firstBody = static_cast<HTMLTableSectionElementImpl *>(child);
- break;
- }
+ if (retval) {
+ if (!tCaption && child->hasTagName(HTMLNames::caption()))
+ tCaption = static_cast<HTMLTableCaptionElementImpl *>(child);
+ else if (!head && child->hasTagName(HTMLNames::thead()))
+ head = static_cast<HTMLTableSectionElementImpl *>(child);
+ else if (!foot && child->hasTagName(HTMLNames::tfoot()))
+ foot = static_cast<HTMLTableSectionElementImpl *>(child);
+ else if (!firstBody && child->hasTagName(HTMLNames::tbody()))
+ firstBody = static_cast<HTMLTableSectionElementImpl *>(child);
}
return retval;
}
@@ -802,17 +794,16 @@
// -------------------------------------------------------------------------
-HTMLTableSectionElementImpl::HTMLTableSectionElementImpl(DocumentPtr *doc,
- ushort tagid, bool implicit)
- : HTMLTablePartElementImpl(doc)
+HTMLTableSectionElementImpl::HTMLTableSectionElementImpl(const QualifiedName& tagName, DocumentPtr *doc, bool implicit)
+ : HTMLTablePartElementImpl(tagName, doc)
{
- _id = tagid;
m_implicit = implicit;
}
-NodeImpl::Id HTMLTableSectionElementImpl::id() const
+bool HTMLTableSectionElementImpl::checkDTD(const NodeImpl* newChild)
{
- return _id;
+ return newChild->hasTagName(HTMLNames::tr()) || newChild->hasTagName(HTMLNames::form()) ||
+ newChild->hasTagName(HTMLNames::script());
}
NodeImpl *HTMLTableSectionElementImpl::addChild(NodeImpl *child)
@@ -821,7 +812,7 @@
kdDebug( 6030 ) << nodeName().string() << "(Tbody)::addChild( " << child->nodeName().string() << " )" << endl;
#endif
- if (child->id() == ID_FORM) {
+ if (child->hasTagName(HTMLNames::form())) {
// First add the child.
HTMLElementImpl::addChild(child);
// Now simply return ourselves as the newnode. This has the effect of
@@ -877,7 +868,7 @@
int rows = 0;
const NodeImpl *n = firstChild();
while (n) {
- if (n->id() == ID_TR)
+ if (n->hasTagName(HTMLNames::tr()))
rows++;
n = n->nextSibling();
}
@@ -932,9 +923,10 @@
// -------------------------------------------------------------------------
-NodeImpl::Id HTMLTableRowElementImpl::id() const
+bool HTMLTableRowElementImpl::checkDTD(const NodeImpl* newChild)
{
- return ID_TR;
+ return newChild->hasTagName(HTMLNames::td()) || newChild->hasTagName(HTMLNames::th()) ||
+ newChild->hasTagName(HTMLNames::form()) || newChild->hasTagName(HTMLNames::script());
}
NodeImpl *HTMLTableRowElementImpl::addChild(NodeImpl *child)
@@ -943,7 +935,7 @@
kdDebug( 6030 ) << nodeName().string() << "(Trow)::addChild( " << child->nodeName().string() << " )" << endl;
#endif
- if (child->id() == ID_FORM) {
+ if (child->hasTagName(HTMLNames::form())) {
// First add the child.
HTMLElementImpl::addChild(child);
// Now simply return ourselves as the newnode. This has the effect of
@@ -958,16 +950,16 @@
int rIndex = 0;
NodeImpl *table = parentNode();
- if ( !table )
+ if (!table)
return -1;
table = table->parentNode();
- if ( !table || table->id() != ID_TABLE )
+ if (!table || !table->hasTagName(HTMLNames::table()))
return -1;
HTMLTableSectionElementImpl *foot = static_cast<HTMLTableElementImpl *>(table)->tFoot();
NodeImpl *node = table->firstChild();
- while ( node ) {
- if ( node != foot && (node->id() == ID_THEAD || node->id() == ID_TFOOT || node->id() == ID_TBODY) ) {
+ while (node) {
+ if (node != foot && (node->hasTagName(HTMLNames::thead()) || node->hasTagName(HTMLNames::tfoot()) || node->hasTagName(HTMLNames::tbody()))) {
HTMLTableSectionElementImpl* section = static_cast<HTMLTableSectionElementImpl *>(node);
const NodeImpl *row = section->firstChild();
while ( row ) {
@@ -996,7 +988,7 @@
const NodeImpl *n = this;
do {
n = n->previousSibling();
- if (n && n->isElementNode() && n->id() == ID_TR)
+ if (n && n->hasTagName(HTMLNames::tr()))
rIndex++;
}
while (n);
@@ -1013,7 +1005,7 @@
exceptioncode = DOMException::INDEX_SIZE_ERR; // per the DOM
else
{
- c = new HTMLTableCellElementImpl(docPtr(), ID_TD);
+ c = new HTMLTableCellElementImpl(HTMLNames::td(), docPtr());
if(numCells == index || index == -1)
appendChild(c, exceptioncode);
else {
@@ -1103,15 +1095,14 @@
// -------------------------------------------------------------------------
-HTMLTableCellElementImpl::HTMLTableCellElementImpl(DocumentPtr *doc, int tag)
- : HTMLTablePartElementImpl(doc)
+HTMLTableCellElementImpl::HTMLTableCellElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
+ : HTMLTablePartElementImpl(tagName, doc)
{
- _col = -1;
- _row = -1;
- cSpan = rSpan = 1;
- _id = tag;
- rowHeight = 0;
- m_solid = false;
+ _col = -1;
+ _row = -1;
+ cSpan = rSpan = 1;
+ rowHeight = 0;
+ m_solid = false;
}
HTMLTableCellElementImpl::~HTMLTableCellElementImpl()
@@ -1122,7 +1113,7 @@
{
int index = 0;
for (const NodeImpl * node = previousSibling(); node; node = node->previousSibling()) {
- if (node->id() == ID_TD || node->id() == ID_TH)
+ if (node->hasTagName(HTMLNames::td()) || node->hasTagName(HTMLNames::th()))
index++;
}
@@ -1189,9 +1180,9 @@
// used by table cells to share style decls created by the enclosing table.
CSSMutableStyleDeclarationImpl* HTMLTableCellElementImpl::additionalAttributeStyleDecl()
{
- HTMLElementImpl* p = static_cast<HTMLElementImpl*>(parentNode());
- while(p && p->id() != ID_TABLE)
- p = static_cast<HTMLElementImpl*>(p->parentNode());
+ NodeImpl* p = parentNode();
+ while (p && !p->hasTagName(HTMLNames::table()))
+ p = p->parentNode();
if (p) {
HTMLTableElementImpl* table = static_cast<HTMLTableElementImpl*>(p);
@@ -1201,15 +1192,6 @@
return 0;
}
-void HTMLTableCellElementImpl::attach()
-{
- HTMLElementImpl* p = static_cast<HTMLElementImpl*>(parentNode());
- while(p && p->id() != ID_TABLE)
- p = static_cast<HTMLElementImpl*>(p->parentNode());
-
- HTMLTablePartElementImpl::attach();
-}
-
bool HTMLTableCellElementImpl::isURLAttribute(AttributeImpl *attr) const
{
return attr->id() == ATTR_BACKGROUND;
@@ -1347,16 +1329,10 @@
// -------------------------------------------------------------------------
-HTMLTableColElementImpl::HTMLTableColElementImpl(DocumentPtr *doc, ushort i)
- : HTMLTablePartElementImpl(doc)
+HTMLTableColElementImpl::HTMLTableColElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
+ : HTMLTablePartElementImpl(tagName, doc)
{
- _id = i;
- _span = (_id == ID_COLGROUP ? 0 : 1);
-}
-
-NodeImpl::Id HTMLTableColElementImpl::id() const
-{
- return _id;
+ _span = (tagName.matches(HTMLNames::colgroup()) ? 0 : 1);
}
bool HTMLTableColElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
@@ -1447,11 +1423,6 @@
// -------------------------------------------------------------------------
-NodeImpl::Id HTMLTableCaptionElementImpl::id() const
-{
- return ID_CAPTION;
-}
-
bool HTMLTableCaptionElementImpl::mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const
{
if (attr == ATTR_ALIGN) {
1.22 +26 -28 WebCore/khtml/html/html_tableimpl.h
Index: html_tableimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_tableimpl.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- html_tableimpl.h 17 Jun 2005 21:55:39 -0000 1.21
+++ html_tableimpl.h 9 Jul 2005 20:19:10 -0000 1.22
@@ -62,7 +62,9 @@
HTMLTableElementImpl(DocumentPtr *doc);
~HTMLTableElementImpl();
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 9; }
+ virtual bool checkDTD(const NodeImpl* newChild);
HTMLTableCaptionElementImpl *caption() const { return tCaption; }
NodeImpl *setCaption( HTMLTableCaptionElementImpl * );
@@ -147,8 +149,8 @@
{
public:
- HTMLTablePartElementImpl(DocumentPtr *doc)
- : HTMLElementImpl(doc)
+ HTMLTablePartElementImpl(const QualifiedName& tagName, DocumentPtr *doc)
+ : HTMLElementImpl(tagName, doc)
{ }
virtual bool mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const;
@@ -160,9 +162,11 @@
class HTMLTableSectionElementImpl : public HTMLTablePartElementImpl
{
public:
- HTMLTableSectionElementImpl(DocumentPtr *doc, ushort tagid, bool implicit);
+ HTMLTableSectionElementImpl(const QualifiedName& tagName, DocumentPtr *doc, bool implicit);
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
+ virtual int tagPriority() const { return 8; }
+ virtual bool checkDTD(const NodeImpl* newChild);
virtual NodeImpl *addChild(NodeImpl *child);
@@ -184,9 +188,6 @@
void setVAlign( const DOMString & );
khtml::SharedPtr<HTMLCollectionImpl> rows();
-
-protected:
- ushort _id;
};
// -------------------------------------------------------------------------
@@ -195,10 +196,12 @@
{
public:
HTMLTableRowElementImpl(DocumentPtr *doc)
- : HTMLTablePartElementImpl(doc) {}
-
- virtual Id id() const;
+ : HTMLTablePartElementImpl(HTMLNames::tr(), doc) {}
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
+ virtual int tagPriority() const { return 7; }
+ virtual bool checkDTD(const NodeImpl* newChild);
+
virtual NodeImpl *addChild(NodeImpl *child);
long rowIndex() const;
@@ -238,10 +241,12 @@
class HTMLTableCellElementImpl : public HTMLTablePartElementImpl
{
public:
- HTMLTableCellElementImpl(DocumentPtr *doc, int tagId);
+ HTMLTableCellElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
~HTMLTableCellElementImpl();
- // ### FIX these two...
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
+ virtual int tagPriority() const { return 6; }
+
long cellIndex() const;
int col() const { return _col; }
@@ -251,14 +256,10 @@
int colSpan() const { return cSpan; }
int rowSpan() const { return rSpan; }
-
- virtual Id id() const { return _id; }
-
+
virtual bool mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *attr);
- virtual void attach();
-
// used by table cells to share style decls created by the enclosing table.
virtual CSSMutableStyleDeclarationImpl* additionalAttributeStyleDecl();
@@ -311,7 +312,6 @@
int _col;
int rSpan;
int cSpan;
- int _id;
int rowHeight;
bool m_solid : 1;
};
@@ -321,10 +321,11 @@
class HTMLTableColElementImpl : public HTMLTablePartElementImpl
{
public:
- HTMLTableColElementImpl(DocumentPtr *doc, ushort i);
-
- virtual Id id() const;
+ HTMLTableColElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
+ virtual HTMLTagStatus endTagRequirement() const { return hasLocalName(HTMLNames::col()) ? TagStatusForbidden : TagStatusOptional; }
+ virtual int tagPriority() const { return hasLocalName(HTMLNames::col()) ? 0 : 1; }
+ virtual bool checkDTD(const NodeImpl* newChild) { return hasLocalName(HTMLNames::colgroup()) && newChild->hasTagName(HTMLNames::col()); }
void setTable(HTMLTableElementImpl *t) { table = t; }
// overrides
@@ -351,10 +352,6 @@
void setWidth( const DOMString & );
protected:
- // could be ID_COL or ID_COLGROUP ... The DOM is not quite clear on
- // this, but since both elements work quite similar, we use one
- // DOMElement for them...
- ushort _id;
int _span;
HTMLTableElementImpl *table;
};
@@ -365,9 +362,10 @@
{
public:
HTMLTableCaptionElementImpl(DocumentPtr *doc)
- : HTMLTablePartElementImpl(doc) {}
+ : HTMLTablePartElementImpl(HTMLNames::caption(), doc) {}
- virtual Id id() const;
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 5; }
virtual bool mapToEntry(NodeImpl::Id attr, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(MappedAttributeImpl *attr);
1.3 +223 -539 WebCore/khtml/html/htmlnames.cpp
Index: htmlnames.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/htmlnames.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- htmlnames.cpp 16 Jun 2005 20:33:57 -0000 1.2
+++ htmlnames.cpp 9 Jul 2005 20:19:10 -0000 1.3
@@ -20,551 +20,235 @@
*
*/
+#define KHTML_HTMLNAMES_HIDE_GLOBALS 1
+
+#include <qptrdict.h>
#include "htmlnames.h"
#include "dom_qname.h"
namespace DOM {
-const AtomicString& HTMLNames::xhtmlNamespaceURI()
-{
- static AtomicString xhtmlNS("http://www.w3.org/1999/xhtml");
- return xhtmlNS;
-}
-
-
-// Tag names.
-const QualifiedName& HTMLNames::a()
-{
- static QualifiedName a(nullAtom, "a", xhtmlNamespaceURI());
- return a;
-}
-
-const QualifiedName& HTMLNames::address()
-{
- static QualifiedName address(nullAtom, "address", xhtmlNamespaceURI());
- return address;
-}
-
-const QualifiedName& HTMLNames::applet()
-{
- static QualifiedName applet(nullAtom, "applet", xhtmlNamespaceURI());
- return applet;
-}
-
-const QualifiedName& HTMLNames::area()
-{
- static QualifiedName area(nullAtom, "area", xhtmlNamespaceURI());
- return area;
-}
-
-const QualifiedName& HTMLNames::b()
-{
- static QualifiedName b(nullAtom, "b", xhtmlNamespaceURI());
- return b;
-}
-
-const QualifiedName& HTMLNames::base()
-{
- static QualifiedName base(nullAtom, "base", xhtmlNamespaceURI());
- return base;
-}
-
-const QualifiedName& HTMLNames::basefont()
-{
- static QualifiedName basefont(nullAtom, "basefont", xhtmlNamespaceURI());
- return basefont;
-}
-
-const QualifiedName& HTMLNames::big()
-{
- static QualifiedName big(nullAtom, "big", xhtmlNamespaceURI());
- return big;
-}
-
-const QualifiedName& HTMLNames::blockquote()
-{
- static QualifiedName blockquote(nullAtom, "blockquote", xhtmlNamespaceURI());
- return blockquote;
-}
-
-const QualifiedName& HTMLNames::body()
-{
- static QualifiedName body(nullAtom, "body", xhtmlNamespaceURI());
- return body;
-}
-
-const QualifiedName& HTMLNames::br()
-{
- static QualifiedName br(nullAtom, "br", xhtmlNamespaceURI());
- return br;
-}
-
-const QualifiedName& HTMLNames::button()
-{
- static QualifiedName button(nullAtom, "button", xhtmlNamespaceURI());
- return button;
-}
-
-const QualifiedName& HTMLNames::canvas()
-{
- static QualifiedName canvas(nullAtom, "canvas", xhtmlNamespaceURI());
- return canvas;
-}
-
-const QualifiedName& HTMLNames::caption()
-{
- static QualifiedName caption(nullAtom, "caption", xhtmlNamespaceURI());
- return caption;
-}
-
-const QualifiedName& HTMLNames::center()
-{
- static QualifiedName center(nullAtom, "center", xhtmlNamespaceURI());
- return center;
-}
-
-const QualifiedName& HTMLNames::code()
-{
- static QualifiedName code(nullAtom, "code", xhtmlNamespaceURI());
- return code;
-}
-
-const QualifiedName& HTMLNames::col()
-{
- static QualifiedName col(nullAtom, "col", xhtmlNamespaceURI());
- return col;
-}
+void* xhtmlNamespaceURIAtom[(sizeof(AtomicString) + sizeof(void*) - 1) / sizeof(void*)];
-const QualifiedName& HTMLNames::colgroup()
-{
- static QualifiedName colgroup(nullAtom, "colgroup", xhtmlNamespaceURI());
- return colgroup;
-}
-
-const QualifiedName& HTMLNames::dd()
-{
- static QualifiedName dd(nullAtom, "dd", xhtmlNamespaceURI());
- return dd;
-}
-
-const QualifiedName& HTMLNames::del()
-{
- static QualifiedName del(nullAtom, "del", xhtmlNamespaceURI());
- return del;
-}
-
-const QualifiedName& HTMLNames::dfn()
-{
- static QualifiedName dfn(nullAtom, "dfn", xhtmlNamespaceURI());
- return dfn;
-}
-
-const QualifiedName& HTMLNames::dir()
-{
- static QualifiedName dir(nullAtom, "dir", xhtmlNamespaceURI());
- return dir;
-}
-
-const QualifiedName& HTMLNames::div()
-{
- static QualifiedName div(nullAtom, "div", xhtmlNamespaceURI());
- return div;
-}
-
-const QualifiedName& HTMLNames::dl()
-{
- static QualifiedName dl(nullAtom, "dl", xhtmlNamespaceURI());
- return dl;
-}
-
-const QualifiedName& HTMLNames::dt()
-{
- static QualifiedName dt(nullAtom, "dt", xhtmlNamespaceURI());
- return dt;
-}
-
-const QualifiedName& HTMLNames::em()
-{
- static QualifiedName em(nullAtom, "em", xhtmlNamespaceURI());
- return em;
-}
-
-const QualifiedName& HTMLNames::embed()
-{
- static QualifiedName embed(nullAtom, "embed", xhtmlNamespaceURI());
- return embed;
-}
-
-const QualifiedName& HTMLNames::fieldset()
-{
- static QualifiedName fieldset(nullAtom, "fieldset", xhtmlNamespaceURI());
- return fieldset;
-}
-
-const QualifiedName& HTMLNames::font()
-{
- static QualifiedName font(nullAtom, "font", xhtmlNamespaceURI());
- return font;
-}
-
-const QualifiedName& HTMLNames::form()
-{
- static QualifiedName form(nullAtom, "form", xhtmlNamespaceURI());
- return form;
-}
-
-const QualifiedName& HTMLNames::frame()
-{
- static QualifiedName frame(nullAtom, "frame", xhtmlNamespaceURI());
- return frame;
-}
-
-const QualifiedName& HTMLNames::frameset()
-{
- static QualifiedName frameset(nullAtom, "frameset", xhtmlNamespaceURI());
- return frameset;
-}
-
-const QualifiedName& HTMLNames::head()
-{
- static QualifiedName head(nullAtom, "head", xhtmlNamespaceURI());
- return head;
-}
-
-const QualifiedName& HTMLNames::h1()
-{
- static QualifiedName h1(nullAtom, "h1", xhtmlNamespaceURI());
- return h1;
-}
-
-const QualifiedName& HTMLNames::h2()
-{
- static QualifiedName h2(nullAtom, "h2", xhtmlNamespaceURI());
- return h2;
-}
-
-const QualifiedName& HTMLNames::h3()
-{
- static QualifiedName h3(nullAtom, "h3", xhtmlNamespaceURI());
- return h3;
-}
-
-const QualifiedName& HTMLNames::h4()
-{
- static QualifiedName h4(nullAtom, "h4", xhtmlNamespaceURI());
- return h4;
-}
-
-const QualifiedName& HTMLNames::h5()
-{
- static QualifiedName h5(nullAtom, "h5", xhtmlNamespaceURI());
- return h5;
-}
-
-const QualifiedName& HTMLNames::h6()
-{
- static QualifiedName h6(nullAtom, "h6", xhtmlNamespaceURI());
- return h6;
-}
-
-const QualifiedName& HTMLNames::hr()
-{
- static QualifiedName hr(nullAtom, "hr", xhtmlNamespaceURI());
- return hr;
-}
-
-const QualifiedName& HTMLNames::html()
-{
- static QualifiedName html(nullAtom, "html", xhtmlNamespaceURI());
- return html;
-}
-
-const QualifiedName& HTMLNames::i()
-{
- static QualifiedName i(nullAtom, "i", xhtmlNamespaceURI());
- return i;
-}
-
-const QualifiedName& HTMLNames::iframe()
-{
- static QualifiedName iframe(nullAtom, "iframe", xhtmlNamespaceURI());
- return iframe;
-}
-
-const QualifiedName& HTMLNames::img()
-{
- static QualifiedName img(nullAtom, "img", xhtmlNamespaceURI());
- return img;
-}
-
-const QualifiedName& HTMLNames::input()
-{
- static QualifiedName input(nullAtom, "input", xhtmlNamespaceURI());
- return input;
-}
-
-const QualifiedName& HTMLNames::ins()
-{
- static QualifiedName ins(nullAtom, "ins", xhtmlNamespaceURI());
- return ins;
-}
-
-const QualifiedName& HTMLNames::isindex()
-{
- static QualifiedName isindex(nullAtom, "isindex", xhtmlNamespaceURI());
- return isindex;
-}
-
-const QualifiedName& HTMLNames::kbd()
-{
- static QualifiedName kbd(nullAtom, "kbd", xhtmlNamespaceURI());
- return kbd;
-}
-
-const QualifiedName& HTMLNames::keygen()
-{
- static QualifiedName keygen(nullAtom, "keygen", xhtmlNamespaceURI());
- return keygen;
-}
-
-const QualifiedName& HTMLNames::label()
-{
- static QualifiedName label(nullAtom, "label", xhtmlNamespaceURI());
- return label;
-}
-
-const QualifiedName& HTMLNames::legend()
-{
- static QualifiedName legend(nullAtom, "legend", xhtmlNamespaceURI());
- return legend;
-}
-
-const QualifiedName& HTMLNames::li()
-{
- static QualifiedName li(nullAtom, "li", xhtmlNamespaceURI());
- return li;
-}
-
-const QualifiedName& HTMLNames::link()
-{
- static QualifiedName link(nullAtom, "link", xhtmlNamespaceURI());
- return link;
-}
-
-const QualifiedName& HTMLNames::map()
-{
- static QualifiedName map(nullAtom, "map", xhtmlNamespaceURI());
- return map;
-}
-
-const QualifiedName& HTMLNames::marquee()
-{
- static QualifiedName marquee(nullAtom, "marquee", xhtmlNamespaceURI());
- return marquee;
-}
-
-const QualifiedName& HTMLNames::menu()
-{
- static QualifiedName menu(nullAtom, "menu", xhtmlNamespaceURI());
- return menu;
-}
-
-const QualifiedName& HTMLNames::meta()
-{
- static QualifiedName meta(nullAtom, "meta", xhtmlNamespaceURI());
- return meta;
-}
-
-const QualifiedName& HTMLNames::noembed()
-{
- static QualifiedName noembed(nullAtom, "noembed", xhtmlNamespaceURI());
- return noembed;
-}
-
-const QualifiedName& HTMLNames::noframes()
-{
- static QualifiedName noframes(nullAtom, "noframes", xhtmlNamespaceURI());
- return noframes;
-}
-
-const QualifiedName& HTMLNames::noscript()
-{
- static QualifiedName noscript(nullAtom, "noscript", xhtmlNamespaceURI());
- return noscript;
-}
-
-const QualifiedName& HTMLNames::object()
-{
- static QualifiedName object(nullAtom, "object", xhtmlNamespaceURI());
- return object;
-}
-
-const QualifiedName& HTMLNames::ol()
-{
- static QualifiedName ol(nullAtom, "ol", xhtmlNamespaceURI());
- return ol;
-}
-
-const QualifiedName& HTMLNames::optgroup()
-{
- static QualifiedName optgroup(nullAtom, "optgroup", xhtmlNamespaceURI());
- return optgroup;
-}
-
-const QualifiedName& HTMLNames::p()
-{
- static QualifiedName p(nullAtom, "p", xhtmlNamespaceURI());
- return p;
-}
-
-const QualifiedName& HTMLNames::param()
-{
- static QualifiedName param(nullAtom, "param", xhtmlNamespaceURI());
- return param;
-}
-
-const QualifiedName& HTMLNames::pre()
-{
- static QualifiedName pre(nullAtom, "pre", xhtmlNamespaceURI());
- return pre;
-}
-
-const QualifiedName& HTMLNames::q()
-{
- static QualifiedName q(nullAtom, "q", xhtmlNamespaceURI());
- return q;
-}
-
-const QualifiedName& HTMLNames::s()
-{
- static QualifiedName s(nullAtom, "s", xhtmlNamespaceURI());
- return s;
-}
-
-const QualifiedName& HTMLNames::samp()
-{
- static QualifiedName samp(nullAtom, "samp", xhtmlNamespaceURI());
- return samp;
-}
-
-const QualifiedName& HTMLNames::script()
-{
- static QualifiedName script(nullAtom, "script", xhtmlNamespaceURI());
- return script;
-}
-
-const QualifiedName& HTMLNames::select()
-{
- static QualifiedName select(nullAtom, "select", xhtmlNamespaceURI());
- return select;
-}
-
-const QualifiedName& HTMLNames::small()
-{
- static QualifiedName small(nullAtom, "small", xhtmlNamespaceURI());
- return small;
-}
-
-const QualifiedName& HTMLNames::strike()
-{
- static QualifiedName strike(nullAtom, "strike", xhtmlNamespaceURI());
- return strike;
-}
-
-const QualifiedName& HTMLNames::strong()
-{
- static QualifiedName strong(nullAtom, "strong", xhtmlNamespaceURI());
- return strong;
-}
-
-const QualifiedName& HTMLNames::style()
-{
- static QualifiedName style(nullAtom, "style", xhtmlNamespaceURI());
- return style;
-}
-
-const QualifiedName& HTMLNames::table()
-{
- static QualifiedName table(nullAtom, "table", xhtmlNamespaceURI());
- return table;
-}
-
-const QualifiedName& HTMLNames::tbody()
-{
- static QualifiedName tbody(nullAtom, "tbody", xhtmlNamespaceURI());
- return tbody;
-}
-
-const QualifiedName& HTMLNames::td()
-{
- static QualifiedName td(nullAtom, "td", xhtmlNamespaceURI());
- return td;
-}
-
-const QualifiedName& HTMLNames::textarea()
-{
- static QualifiedName textarea(nullAtom, "textarea", xhtmlNamespaceURI());
- return textarea;
-}
-
-const QualifiedName& HTMLNames::tfoot()
-{
- static QualifiedName tfoot(nullAtom, "tfoot", xhtmlNamespaceURI());
- return tfoot;
-}
-
-const QualifiedName& HTMLNames::th()
-{
- static QualifiedName th(nullAtom, "th", xhtmlNamespaceURI());
- return th;
-}
-
-const QualifiedName& HTMLNames::thead()
-{
- static QualifiedName thead(nullAtom, "thead", xhtmlNamespaceURI());
- return thead;
-}
-
-const QualifiedName& HTMLNames::title()
-{
- static QualifiedName title(nullAtom, "title", xhtmlNamespaceURI());
- return title;
-}
-
-const QualifiedName& HTMLNames::tr()
-{
- static QualifiedName tr(nullAtom, "tr", xhtmlNamespaceURI());
- return tr;
-}
-
-const QualifiedName& HTMLNames::tt()
-{
- static QualifiedName tt(nullAtom, "tt", xhtmlNamespaceURI());
- return tt;
-}
-
-const QualifiedName& HTMLNames::u()
-{
- static QualifiedName u(nullAtom, "u", xhtmlNamespaceURI());
- return u;
-}
-
-const QualifiedName& HTMLNames::ul()
-{
- static QualifiedName ul(nullAtom, "ul", xhtmlNamespaceURI());
- return ul;
-}
-
-const QualifiedName& HTMLNames::var()
-{
- static QualifiedName var(nullAtom, "var", xhtmlNamespaceURI());
- return var;
-}
-
-const QualifiedName& HTMLNames::xmp()
-{
- static QualifiedName xmp(nullAtom, "xmp", xhtmlNamespaceURI());
- return xmp;
+// Define a QualifiedName-sized array of pointers to avoid static initialization.
+// Use an array of pointers instead of an array of char in case there is some alignment issue.
+#define DEFINE_GLOBAL(name) \
+ void* name ## QName[(sizeof(QualifiedName) + sizeof(void*) - 1) / sizeof(void*)];
+
+DEFINE_GLOBAL(a)
+DEFINE_GLOBAL(abbr)
+DEFINE_GLOBAL(acronym)
+DEFINE_GLOBAL(address)
+DEFINE_GLOBAL(applet)
+DEFINE_GLOBAL(area)
+DEFINE_GLOBAL(b)
+DEFINE_GLOBAL(base)
+DEFINE_GLOBAL(basefont)
+DEFINE_GLOBAL(bdo)
+DEFINE_GLOBAL(big)
+DEFINE_GLOBAL(blockquote)
+DEFINE_GLOBAL(body)
+DEFINE_GLOBAL(br)
+DEFINE_GLOBAL(button)
+DEFINE_GLOBAL(canvas)
+DEFINE_GLOBAL(caption)
+DEFINE_GLOBAL(center)
+DEFINE_GLOBAL(cite)
+DEFINE_GLOBAL(code)
+DEFINE_GLOBAL(col)
+DEFINE_GLOBAL(colgroup)
+DEFINE_GLOBAL(dd)
+DEFINE_GLOBAL(del)
+DEFINE_GLOBAL(dfn)
+DEFINE_GLOBAL(dir)
+DEFINE_GLOBAL(div)
+DEFINE_GLOBAL(dl)
+DEFINE_GLOBAL(dt)
+DEFINE_GLOBAL(em)
+DEFINE_GLOBAL(embed)
+DEFINE_GLOBAL(fieldset)
+DEFINE_GLOBAL(font)
+DEFINE_GLOBAL(form)
+DEFINE_GLOBAL(frame)
+DEFINE_GLOBAL(frameset)
+DEFINE_GLOBAL(head)
+DEFINE_GLOBAL(h1)
+DEFINE_GLOBAL(h2)
+DEFINE_GLOBAL(h3)
+DEFINE_GLOBAL(h4)
+DEFINE_GLOBAL(h5)
+DEFINE_GLOBAL(h6)
+DEFINE_GLOBAL(hr)
+DEFINE_GLOBAL(html)
+DEFINE_GLOBAL(i)
+DEFINE_GLOBAL(iframe)
+DEFINE_GLOBAL(img)
+DEFINE_GLOBAL(input)
+DEFINE_GLOBAL(ins)
+DEFINE_GLOBAL(isindex)
+DEFINE_GLOBAL(kbd)
+DEFINE_GLOBAL(keygen)
+DEFINE_GLOBAL(label)
+DEFINE_GLOBAL(layer)
+DEFINE_GLOBAL(legend)
+DEFINE_GLOBAL(li)
+DEFINE_GLOBAL(link)
+DEFINE_GLOBAL(map)
+DEFINE_GLOBAL(marquee)
+DEFINE_GLOBAL(menu)
+DEFINE_GLOBAL(meta)
+DEFINE_GLOBAL(nobr)
+DEFINE_GLOBAL(noembed)
+DEFINE_GLOBAL(noframes)
+DEFINE_GLOBAL(nolayer)
+DEFINE_GLOBAL(noscript)
+DEFINE_GLOBAL(object)
+DEFINE_GLOBAL(ol)
+DEFINE_GLOBAL(optgroup)
+DEFINE_GLOBAL(option)
+DEFINE_GLOBAL(p)
+DEFINE_GLOBAL(param)
+DEFINE_GLOBAL(plaintext)
+DEFINE_GLOBAL(pre)
+DEFINE_GLOBAL(q)
+DEFINE_GLOBAL(s)
+DEFINE_GLOBAL(samp)
+DEFINE_GLOBAL(script)
+DEFINE_GLOBAL(select)
+DEFINE_GLOBAL(small)
+DEFINE_GLOBAL(span)
+DEFINE_GLOBAL(strike)
+DEFINE_GLOBAL(strong)
+DEFINE_GLOBAL(style)
+DEFINE_GLOBAL(sub)
+DEFINE_GLOBAL(sup)
+DEFINE_GLOBAL(table)
+DEFINE_GLOBAL(tbody)
+DEFINE_GLOBAL(td)
+DEFINE_GLOBAL(textarea)
+DEFINE_GLOBAL(tfoot)
+DEFINE_GLOBAL(th)
+DEFINE_GLOBAL(thead)
+DEFINE_GLOBAL(title)
+DEFINE_GLOBAL(tr)
+DEFINE_GLOBAL(tt)
+DEFINE_GLOBAL(u)
+DEFINE_GLOBAL(ul)
+DEFINE_GLOBAL(var)
+DEFINE_GLOBAL(wbr)
+DEFINE_GLOBAL(xmp)
+
+void HTMLNames::init()
+{
+ static bool initialized;
+ if (!initialized) {
+ // Use placement new to initialize the globals.
+ static AtomicString xhtmlNS("http://www.w3.org/1999/xhtml");
+ new (&xhtmlNamespaceURIAtom) AtomicString(xhtmlNS);
+ new (&aQName) QualifiedName(nullAtom, "a", xhtmlNS);
+ new (&abbrQName) QualifiedName(nullAtom, "abbr", xhtmlNS);
+ new (&acronymQName) QualifiedName(nullAtom, "acronym", xhtmlNS);
+ new (&addressQName) QualifiedName(nullAtom, "address", xhtmlNS);
+ new (&appletQName) QualifiedName(nullAtom, "applet", xhtmlNS);
+ new (&areaQName) QualifiedName(nullAtom, "area", xhtmlNS);
+ new (&bQName) QualifiedName(nullAtom, "b", xhtmlNS);
+ new (&baseQName) QualifiedName(nullAtom, "base", xhtmlNS);
+ new (&basefontQName) QualifiedName(nullAtom, "basefont", xhtmlNS);
+ new (&bdoQName) QualifiedName(nullAtom, "bdo", xhtmlNS);
+ new (&bigQName) QualifiedName(nullAtom, "big", xhtmlNS);
+ new (&blockquoteQName) QualifiedName(nullAtom, "blockquote", xhtmlNS);
+ new (&bodyQName) QualifiedName(nullAtom, "body", xhtmlNS);
+ new (&brQName) QualifiedName(nullAtom, "br", xhtmlNS);
+ new (&buttonQName) QualifiedName(nullAtom, "button", xhtmlNS);
+ new (&canvasQName) QualifiedName(nullAtom, "canvas", xhtmlNS);
+ new (&captionQName) QualifiedName(nullAtom, "caption", xhtmlNS);
+ new (¢erQName) QualifiedName(nullAtom, "center", xhtmlNS);
+ new (&citeQName) QualifiedName(nullAtom, "cite", xhtmlNS);
+ new (&codeQName) QualifiedName(nullAtom, "code", xhtmlNS);
+ new (&colQName) QualifiedName(nullAtom, "col", xhtmlNS);
+ new (&colgroupQName) QualifiedName(nullAtom, "colgroup", xhtmlNS);
+ new (&ddQName) QualifiedName(nullAtom, "dd", xhtmlNS);
+ new (&delQName) QualifiedName(nullAtom, "del", xhtmlNS);
+ new (&dfnQName) QualifiedName(nullAtom, "dfn", xhtmlNS);
+ new (&dirQName) QualifiedName(nullAtom, "dir", xhtmlNS);
+ new (&divQName) QualifiedName(nullAtom, "div", xhtmlNS);
+ new (&dlQName) QualifiedName(nullAtom, "dl", xhtmlNS);
+ new (&dtQName) QualifiedName(nullAtom, "dt", xhtmlNS);
+ new (&emQName) QualifiedName(nullAtom, "em", xhtmlNS);
+ new (&embedQName) QualifiedName(nullAtom, "embed", xhtmlNS);
+ new (&fieldsetQName) QualifiedName(nullAtom, "fieldset", xhtmlNS);
+ new (&fontQName) QualifiedName(nullAtom, "font", xhtmlNS);
+ new (&formQName) QualifiedName(nullAtom, "form", xhtmlNS);
+ new (&frameQName) QualifiedName(nullAtom, "frame", xhtmlNS);
+ new (&framesetQName) QualifiedName(nullAtom, "frameset", xhtmlNS);
+ new (&headQName) QualifiedName(nullAtom, "head", xhtmlNS);
+ new (&h1QName) QualifiedName(nullAtom, "h1", xhtmlNS);
+ new (&h2QName) QualifiedName(nullAtom, "h2", xhtmlNS);
+ new (&h3QName) QualifiedName(nullAtom, "h3", xhtmlNS);
+ new (&h4QName) QualifiedName(nullAtom, "h4", xhtmlNS);
+ new (&h5QName) QualifiedName(nullAtom, "h5", xhtmlNS);
+ new (&h6QName) QualifiedName(nullAtom, "h6", xhtmlNS);
+ new (&hrQName) QualifiedName(nullAtom, "hr", xhtmlNS);
+ new (&htmlQName) QualifiedName(nullAtom, "html", xhtmlNS);
+ new (&iQName) QualifiedName(nullAtom, "i", xhtmlNS);
+ new (&iframeQName) QualifiedName(nullAtom, "iframe", xhtmlNS);
+ new (&imgQName) QualifiedName(nullAtom, "img", xhtmlNS);
+ new (&inputQName) QualifiedName(nullAtom, "input", xhtmlNS);
+ new (&insQName) QualifiedName(nullAtom, "ins", xhtmlNS);
+ new (&isindexQName) QualifiedName(nullAtom, "isindex", xhtmlNS);
+ new (&kbdQName) QualifiedName(nullAtom, "kbd", xhtmlNS);
+ new (&keygenQName) QualifiedName(nullAtom, "keygen", xhtmlNS);
+ new (&labelQName) QualifiedName(nullAtom, "label", xhtmlNS);
+ new (&layerQName) QualifiedName(nullAtom, "layer", xhtmlNS);
+ new (&legendQName) QualifiedName(nullAtom, "legend", xhtmlNS);
+ new (&liQName) QualifiedName(nullAtom, "li", xhtmlNS);
+ new (&linkQName) QualifiedName(nullAtom, "link", xhtmlNS);
+ new (&mapQName) QualifiedName(nullAtom, "map", xhtmlNS);
+ new (&marqueeQName) QualifiedName(nullAtom, "marquee", xhtmlNS);
+ new (&menuQName) QualifiedName(nullAtom, "menu", xhtmlNS);
+ new (&metaQName) QualifiedName(nullAtom, "meta", xhtmlNS);
+ new (&nobrQName) QualifiedName(nullAtom, "nobr", xhtmlNS);
+ new (&noembedQName) QualifiedName(nullAtom, "noembed", xhtmlNS);
+ new (&noframesQName) QualifiedName(nullAtom, "noframes", xhtmlNS);
+ new (&nolayerQName) QualifiedName(nullAtom, "nolayer", xhtmlNS);
+ new (&noscriptQName) QualifiedName(nullAtom, "noscript", xhtmlNS);
+ new (&objectQName) QualifiedName(nullAtom, "object", xhtmlNS);
+ new (&olQName) QualifiedName(nullAtom, "ol", xhtmlNS);
+ new (&optgroupQName) QualifiedName(nullAtom, "optgroup", xhtmlNS);
+ new (&optionQName) QualifiedName(nullAtom, "option", xhtmlNS);
+ new (&pQName) QualifiedName(nullAtom, "p", xhtmlNS);
+ new (¶mQName) QualifiedName(nullAtom, "param", xhtmlNS);
+ new (&plaintextQName) QualifiedName(nullAtom, "plaintext", xhtmlNS);
+ new (&preQName) QualifiedName(nullAtom, "pre", xhtmlNS);
+ new (&qQName) QualifiedName(nullAtom, "q", xhtmlNS);
+ new (&sQName) QualifiedName(nullAtom, "s", xhtmlNS);
+ new (&sampQName) QualifiedName(nullAtom, "samp", xhtmlNS);
+ new (&scriptQName) QualifiedName(nullAtom, "script", xhtmlNS);
+ new (&selectQName) QualifiedName(nullAtom, "select", xhtmlNS);
+ new (&smallQName) QualifiedName(nullAtom, "small", xhtmlNS);
+ new (&spanQName) QualifiedName(nullAtom, "span", xhtmlNS);
+ new (&strikeQName) QualifiedName(nullAtom, "strike", xhtmlNS);
+ new (&strongQName) QualifiedName(nullAtom, "strong", xhtmlNS);
+ new (&styleQName) QualifiedName(nullAtom, "style", xhtmlNS);
+ new (&subQName) QualifiedName(nullAtom, "sub", xhtmlNS);
+ new (&supQName) QualifiedName(nullAtom, "sup", xhtmlNS);
+ new (&tableQName) QualifiedName(nullAtom, "table", xhtmlNS);
+ new (&tbodyQName) QualifiedName(nullAtom, "tbody", xhtmlNS);
+ new (&tdQName) QualifiedName(nullAtom, "td", xhtmlNS);
+ new (&textareaQName) QualifiedName(nullAtom, "textarea", xhtmlNS);
+ new (&tfootQName) QualifiedName(nullAtom, "tfoot", xhtmlNS);
+ new (&thQName) QualifiedName(nullAtom, "th", xhtmlNS);
+ new (&theadQName) QualifiedName(nullAtom, "thead", xhtmlNS);
+ new (&titleQName) QualifiedName(nullAtom, "title", xhtmlNS);
+ new (&trQName) QualifiedName(nullAtom, "tr", xhtmlNS);
+ new (&ttQName) QualifiedName(nullAtom, "tt", xhtmlNS);
+ new (&uQName) QualifiedName(nullAtom, "u", xhtmlNS);
+ new (&ulQName) QualifiedName(nullAtom, "ul", xhtmlNS);
+ new (&varQName) QualifiedName(nullAtom, "var", xhtmlNS);
+ new (&wbrQName) QualifiedName(nullAtom, "wbr", xhtmlNS);
+ new (&xmpQName) QualifiedName(nullAtom, "xmp", xhtmlNS);
+ initialized = true;
+ }
}
}
1.3 +223 -93 WebCore/khtml/html/htmlnames.h
Index: htmlnames.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/htmlnames.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- htmlnames.h 16 Jun 2005 20:33:57 -0000 1.2
+++ htmlnames.h 9 Jul 2005 20:19:11 -0000 1.3
@@ -22,112 +22,242 @@
#ifndef HTMLNAMES_H
#define HTMLNAMES_H
-#include "xml/dom_elementimpl.h"
+#include "dom_qname.h"
namespace DOM
{
class QualifiedName;
+// The globals.
+// Define external global variables for all HTML names above.
+#if !KHTML_HTMLNAMES_HIDE_GLOBALS
+ extern const AtomicString xhtmlNamespaceURIAtom;
+ extern const QualifiedName aQName;
+ extern const QualifiedName abbrQName;
+ extern const QualifiedName acronymQName;
+ extern const QualifiedName addressQName;
+ extern const QualifiedName appletQName;
+ extern const QualifiedName areaQName;
+ extern const QualifiedName bQName;
+ extern const QualifiedName baseQName;
+ extern const QualifiedName basefontQName;
+ extern const QualifiedName bdoQName;
+ extern const QualifiedName bigQName;
+ extern const QualifiedName blockquoteQName;
+ extern const QualifiedName bodyQName;
+ extern const QualifiedName brQName;
+ extern const QualifiedName buttonQName;
+ extern const QualifiedName canvasQName;
+ extern const QualifiedName captionQName;
+ extern const QualifiedName centerQName;
+ extern const QualifiedName citeQName;
+ extern const QualifiedName codeQName;
+ extern const QualifiedName colQName;
+ extern const QualifiedName colgroupQName;
+ extern const QualifiedName ddQName;
+ extern const QualifiedName delQName;
+ extern const QualifiedName dfnQName;
+ extern const QualifiedName dirQName;
+ extern const QualifiedName divQName;
+ extern const QualifiedName dlQName;
+ extern const QualifiedName dtQName;
+ extern const QualifiedName emQName;
+ extern const QualifiedName embedQName;
+ extern const QualifiedName fieldsetQName;
+ extern const QualifiedName fontQName;
+ extern const QualifiedName formQName;
+ extern const QualifiedName frameQName;
+ extern const QualifiedName framesetQName;
+ extern const QualifiedName headQName;
+ extern const QualifiedName h1QName;
+ extern const QualifiedName h2QName;
+ extern const QualifiedName h3QName;
+ extern const QualifiedName h4QName;
+ extern const QualifiedName h5QName;
+ extern const QualifiedName h6QName;
+ extern const QualifiedName hrQName;
+ extern const QualifiedName htmlQName;
+ extern const QualifiedName iQName;
+ extern const QualifiedName iframeQName;
+ extern const QualifiedName imgQName;
+ extern const QualifiedName inputQName;
+ extern const QualifiedName insQName;
+ extern const QualifiedName isindexQName;
+ extern const QualifiedName kbdQName;
+ extern const QualifiedName keygenQName;
+ extern const QualifiedName labelQName;
+ extern const QualifiedName layerQName;
+ extern const QualifiedName legendQName;
+ extern const QualifiedName liQName;
+ extern const QualifiedName linkQName;
+ extern const QualifiedName mapQName;
+ extern const QualifiedName marqueeQName;
+ extern const QualifiedName menuQName;
+ extern const QualifiedName metaQName;
+ extern const QualifiedName nobrQName;
+ extern const QualifiedName noembedQName;
+ extern const QualifiedName noframesQName;
+ extern const QualifiedName nolayerQName;
+ extern const QualifiedName noscriptQName;
+ extern const QualifiedName objectQName;
+ extern const QualifiedName olQName;
+ extern const QualifiedName optgroupQName;
+ extern const QualifiedName optionQName;
+ extern const QualifiedName pQName;
+ extern const QualifiedName paramQName;
+ extern const QualifiedName plaintextQName;
+ extern const QualifiedName preQName;
+ extern const QualifiedName qQName;
+ extern const QualifiedName sQName;
+ extern const QualifiedName sampQName;
+ extern const QualifiedName scriptQName;
+ extern const QualifiedName selectQName;
+ extern const QualifiedName smallQName;
+ extern const QualifiedName spanQName;
+ extern const QualifiedName strikeQName;
+ extern const QualifiedName strongQName;
+ extern const QualifiedName styleQName;
+ extern const QualifiedName subQName;
+ extern const QualifiedName supQName;
+ extern const QualifiedName tableQName;
+ extern const QualifiedName tbodyQName;
+ extern const QualifiedName tdQName;
+ extern const QualifiedName textareaQName;
+ extern const QualifiedName tfootQName;
+ extern const QualifiedName thQName;
+ extern const QualifiedName theadQName;
+ extern const QualifiedName titleQName;
+ extern const QualifiedName trQName;
+ extern const QualifiedName ttQName;
+ extern const QualifiedName uQName;
+ extern const QualifiedName ulQName;
+ extern const QualifiedName varQName;
+ extern const QualifiedName wbrQName;
+ extern const QualifiedName xmpQName;
+
+#endif
+
+// FIXME: Make this a namespace instead of a class.
class HTMLNames
{
public:
+#if !KHTML_HTMLNAMES_HIDE_GLOBALS
// The namespace URI.
- static const AtomicString& xhtmlNamespaceURI();
+ static const AtomicString& xhtmlNamespaceURI() { return xhtmlNamespaceURIAtom; }
- // Full tag names.
- static const QualifiedName& a();
- static const QualifiedName& address();
- static const QualifiedName& applet();
- static const QualifiedName& area();
- static const QualifiedName& b();
- static const QualifiedName& base();
- static const QualifiedName& basefont();
- static const QualifiedName& big();
- static const QualifiedName& blockquote();
- static const QualifiedName& body();
- static const QualifiedName& br();
- static const QualifiedName& button();
- static const QualifiedName& canvas();
- static const QualifiedName& caption();
- static const QualifiedName& center();
- static const QualifiedName& code();
- static const QualifiedName& col();
- static const QualifiedName& colgroup();
- static const QualifiedName& dd();
- static const QualifiedName& del();
- static const QualifiedName& dfn();
- static const QualifiedName& dir();
- static const QualifiedName& div();
- static const QualifiedName& dl();
- static const QualifiedName& dt();
- static const QualifiedName& em();
- static const QualifiedName& embed();
- static const QualifiedName& fieldset();
- static const QualifiedName& font();
- static const QualifiedName& form();
- static const QualifiedName& frame();
- static const QualifiedName& frameset();
- static const QualifiedName& head();
- static const QualifiedName& h1();
- static const QualifiedName& h2();
- static const QualifiedName& h3();
- static const QualifiedName& h4();
- static const QualifiedName& h5();
- static const QualifiedName& h6();
- static const QualifiedName& hr();
- static const QualifiedName& html();
- static const QualifiedName& i();
- static const QualifiedName& iframe();
- static const QualifiedName& img();
- static const QualifiedName& input();
- static const QualifiedName& ins();
- static const QualifiedName& isindex();
- static const QualifiedName& kbd();
- static const QualifiedName& keygen();
- static const QualifiedName& label();
- static const QualifiedName& legend();
- static const QualifiedName& li();
- static const QualifiedName& link();
- static const QualifiedName& map();
- static const QualifiedName& marquee();
- static const QualifiedName& menu();
- static const QualifiedName& meta();
- static const QualifiedName& noembed();
- static const QualifiedName& noframes();
- static const QualifiedName& noscript();
- static const QualifiedName& object();
- static const QualifiedName& ol();
- static const QualifiedName& optgroup();
- static const QualifiedName& option();
- static const QualifiedName& p();
- static const QualifiedName& param();
- static const QualifiedName& pre();
- static const QualifiedName& q();
- static const QualifiedName& s();
- static const QualifiedName& samp();
- static const QualifiedName& script();
- static const QualifiedName& select();
- static const QualifiedName& small();
- static const QualifiedName& strike();
- static const QualifiedName& strong();
- static const QualifiedName& style();
- static const QualifiedName& table();
- static const QualifiedName& tbody();
- static const QualifiedName& td();
- static const QualifiedName& textarea();
- static const QualifiedName& tfoot();
- static const QualifiedName& th();
- static const QualifiedName& thead();
- static const QualifiedName& title();
- static const QualifiedName& tr();
- static const QualifiedName& tt();
- static const QualifiedName& u();
- static const QualifiedName& ul();
- static const QualifiedName& var();
- static const QualifiedName& xmp();
+// Full tag names.
+#define DEFINE_GETTER(name) \
+ static const QualifiedName& name() { return name ## QName; }
+
+ DEFINE_GETTER(a)
+ DEFINE_GETTER(abbr)
+ DEFINE_GETTER(acronym)
+ DEFINE_GETTER(address)
+ DEFINE_GETTER(applet)
+ DEFINE_GETTER(area)
+ DEFINE_GETTER(b)
+ DEFINE_GETTER(base)
+ DEFINE_GETTER(basefont)
+ DEFINE_GETTER(bdo)
+ DEFINE_GETTER(big)
+ DEFINE_GETTER(blockquote)
+ DEFINE_GETTER(body)
+ DEFINE_GETTER(br)
+ DEFINE_GETTER(button)
+ DEFINE_GETTER(canvas)
+ DEFINE_GETTER(caption)
+ DEFINE_GETTER(center)
+ DEFINE_GETTER(cite)
+ DEFINE_GETTER(code)
+ DEFINE_GETTER(col)
+ DEFINE_GETTER(colgroup)
+ DEFINE_GETTER(dd)
+ DEFINE_GETTER(del)
+ DEFINE_GETTER(dfn)
+ DEFINE_GETTER(dir)
+ DEFINE_GETTER(div)
+ DEFINE_GETTER(dl)
+ DEFINE_GETTER(dt)
+ DEFINE_GETTER(em)
+ DEFINE_GETTER(embed)
+ DEFINE_GETTER(fieldset)
+ DEFINE_GETTER(font)
+ DEFINE_GETTER(form)
+ DEFINE_GETTER(frame)
+ DEFINE_GETTER(frameset)
+ DEFINE_GETTER(head)
+ DEFINE_GETTER(h1)
+ DEFINE_GETTER(h2)
+ DEFINE_GETTER(h3)
+ DEFINE_GETTER(h4)
+ DEFINE_GETTER(h5)
+ DEFINE_GETTER(h6)
+ DEFINE_GETTER(hr)
+ DEFINE_GETTER(html)
+ DEFINE_GETTER(i)
+ DEFINE_GETTER(iframe)
+ DEFINE_GETTER(img)
+ DEFINE_GETTER(input)
+ DEFINE_GETTER(ins)
+ DEFINE_GETTER(isindex)
+ DEFINE_GETTER(kbd)
+ DEFINE_GETTER(keygen)
+ DEFINE_GETTER(label)
+ DEFINE_GETTER(layer)
+ DEFINE_GETTER(legend)
+ DEFINE_GETTER(li)
+ DEFINE_GETTER(link)
+ DEFINE_GETTER(map)
+ DEFINE_GETTER(marquee)
+ DEFINE_GETTER(menu)
+ DEFINE_GETTER(meta)
+ DEFINE_GETTER(nobr)
+ DEFINE_GETTER(noembed)
+ DEFINE_GETTER(noframes)
+ DEFINE_GETTER(nolayer)
+ DEFINE_GETTER(noscript)
+ DEFINE_GETTER(object)
+ DEFINE_GETTER(ol)
+ DEFINE_GETTER(optgroup)
+ DEFINE_GETTER(option)
+ DEFINE_GETTER(p)
+ DEFINE_GETTER(param)
+ DEFINE_GETTER(plaintext)
+ DEFINE_GETTER(pre)
+ DEFINE_GETTER(q)
+ DEFINE_GETTER(s)
+ DEFINE_GETTER(samp)
+ DEFINE_GETTER(script)
+ DEFINE_GETTER(select)
+ DEFINE_GETTER(small)
+ DEFINE_GETTER(span)
+ DEFINE_GETTER(strike)
+ DEFINE_GETTER(strong)
+ DEFINE_GETTER(style)
+ DEFINE_GETTER(sub)
+ DEFINE_GETTER(sup)
+ DEFINE_GETTER(table)
+ DEFINE_GETTER(tbody)
+ DEFINE_GETTER(td)
+ DEFINE_GETTER(textarea)
+ DEFINE_GETTER(tfoot)
+ DEFINE_GETTER(th)
+ DEFINE_GETTER(thead)
+ DEFINE_GETTER(title)
+ DEFINE_GETTER(tr)
+ DEFINE_GETTER(tt)
+ DEFINE_GETTER(u)
+ DEFINE_GETTER(ul)
+ DEFINE_GETTER(var)
+ DEFINE_GETTER(wbr)
+ DEFINE_GETTER(xmp)
// Attribute names.
+#endif
+
+ // Init routine
+ static void init();
};
}
1.97 +614 -772 WebCore/khtml/html/htmlparser.cpp
Index: htmlparser.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/htmlparser.cpp,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- htmlparser.cpp 11 May 2005 00:58:28 -0000 1.96
+++ htmlparser.cpp 9 Jul 2005 20:19:11 -0000 1.97
@@ -44,9 +44,12 @@
#include "html/html_miscimpl.h"
#include "html/html_tableimpl.h"
#include "html/html_objectimpl.h"
+#include "htmlfactory.h"
#include "xml/dom_textimpl.h"
#include "xml/dom_nodeimpl.h"
#include "misc/htmlhashes.h"
+#include "misc/main_thread_malloc.h"
+#include "misc/hashset.h"
#include "html/htmltokenizer.h"
#include "khtmlview.h"
#include "khtml_part.h"
@@ -55,6 +58,8 @@
#include "rendering/render_object.h"
+#include "misc/pointerhash.h"
+
#include <kdebug.h>
#include <klocale.h>
@@ -69,24 +74,26 @@
class HTMLStackElem
{
public:
- HTMLStackElem( int _id,
- int _level,
- DOM::NodeImpl *_node,
- HTMLStackElem * _next
+ HTMLStackElem(const AtomicString& _tagName,
+ int _level,
+ DOM::NodeImpl *_node,
+ HTMLStackElem * _next
)
:
- id(_id),
+ tagName(_tagName),
level(_level),
strayTableContent(false),
node(_node),
next(_next)
{ }
- int id;
- int level;
- bool strayTableContent;
- NodeImpl *node;
- HTMLStackElem *next;
+ MAIN_THREAD_ALLOCATED;
+
+ AtomicString tagName;
+ int level;
+ bool strayTableContent;
+ NodeImpl* node;
+ HTMLStackElem* next;
};
/**
@@ -112,14 +119,9 @@
* element or ignore the tag.
*
*/
-KHTMLParser::KHTMLParser(KHTMLView *_parent, DocumentPtr *doc, bool includesComments)
+HTMLParser::HTMLParser(KHTMLView *_parent, DocumentPtr *doc, bool includesComments)
: current(0), currentIsReferenced(false), includesCommentsInDOM(includesComments)
{
- //kdDebug( 6035 ) << "parser constructor" << endl;
-#if SPEED_DEBUG > 0
- qt.start();
-#endif
-
HTMLWidget = _parent;
document = doc;
document->ref();
@@ -129,7 +131,7 @@
reset();
}
-KHTMLParser::KHTMLParser(DOM::DocumentFragmentImpl *i, DocumentPtr *doc, bool includesComments)
+HTMLParser::HTMLParser(DOM::DocumentFragmentImpl *i, DocumentPtr *doc, bool includesComments)
: current(0), currentIsReferenced(false), includesCommentsInDOM(includesComments)
{
HTMLWidget = 0;
@@ -143,12 +145,8 @@
inBody = true;
}
-KHTMLParser::~KHTMLParser()
+HTMLParser::~HTMLParser()
{
-#if SPEED_DEBUG > 0
- kdDebug( ) << "TIME: parsing time was = " << qt.elapsed() << endl;
-#endif
-
freeBlock();
setCurrent(0);
@@ -159,15 +157,12 @@
isindex->deref();
}
-void KHTMLParser::reset()
+void HTMLParser::reset()
{
setCurrent(doc());
freeBlock();
- // before parsing, no tags are forbidden
- memset(forbiddenTag, 0, sizeof(forbiddenTag));
-
inBody = false;
haveFrameSet = false;
haveContent = false;
@@ -180,10 +175,10 @@
end = false;
isindex = 0;
- discard_until = 0;
+ discard_until = nullAtom;
}
-void KHTMLParser::setCurrent(DOM::NodeImpl *newCurrent)
+void HTMLParser::setCurrent(DOM::NodeImpl *newCurrent)
{
bool newCurrentIsReferenced = newCurrent && newCurrent != doc();
if (newCurrentIsReferenced)
@@ -194,144 +189,108 @@
currentIsReferenced = newCurrentIsReferenced;
}
-void KHTMLParser::parseToken(Token *t)
+void HTMLParser::parseToken(Token *t)
{
- if(discard_until) {
- if(t->id == discard_until)
- discard_until = 0;
+ if (!discard_until.isNull()) {
+ if (t->tagName == discard_until && !t->beginTag)
+ discard_until = nullAtom;
// do not skip </iframe>
- if ( discard_until || current->id() + ID_CLOSE_TAG != t->id )
+ if (!discard_until.isNull() || (current->localName() != t->tagName))
return;
}
-#ifdef PARSER_DEBUG
- kdDebug( 6035 ) << "\n\n==> parser: processing token " << getTagName(t->id).string() << "(" << t->id << ")"
- << " current = " << getTagName(current->id()).string() << "(" << current->id() << ")" << endl;
- kdDebug(6035) << " inBody=" << inBody << " haveFrameSet=" << haveFrameSet << endl;
-#endif
+ // Apparently some sites use </br> instead of <br>. Be compatible with IE and Firefox and treat this like <br>.
+ if (t->isCloseTag(HTMLNames::br()) && doc()->inCompatMode())
+ t->beginTag = true;
- // holy shit. apparently some sites use </br> instead of <br>
- // be compatible with IE and NS
- if (t->id == ID_BR + ID_CLOSE_TAG && doc()->inCompatMode())
- t->id = ID_BR;
-
- if (t->id > ID_CLOSE_TAG)
- {
+ if (!t->beginTag) {
processCloseTag(t);
return;
}
// ignore spaces, if we're not inside a paragraph or other inline code
- if( t->id == ID_TEXT && t->text ) {
- if(inBody && !skipMode() && current->id() != ID_STYLE
- && current->id() != ID_TITLE && current->id() != ID_SCRIPT &&
- !t->text->containsOnlyWhitespace())
+ if (t->tagName == textAtom && t->text) {
+ if (inBody && !skipMode() && current->localName() != HTMLNames::style() && current->localName() != HTMLNames::title() &&
+ current->localName() != HTMLNames::script() && !t->text->containsOnlyWhitespace())
haveContent = true;
-#ifdef PARSER_DEBUG
- kdDebug(6035) << "length="<< t->text->l << " text='" << QConstString(t->text->s, t->text->l).string() << "'" << endl;
-#endif
}
- NodeImpl *n = getElement(t);
+ NodeImpl *n = getNode(t);
// just to be sure, and to catch currently unimplemented stuff
- if(!n)
+ if (!n)
return;
SharedPtr<NodeImpl> protectNode(n);
// set attributes
- if(n->isElementNode())
- {
- ElementImpl *e = static_cast<ElementImpl *>(n);
+ if (n->isHTMLElement()) {
+ HTMLElementImpl *e = static_cast<HTMLElementImpl*>(n);
e->setAttributeMap(t->attrs);
// take care of optional close tags
- if(endTagRequirement(e->id()) == DOM::OPTIONAL)
- popBlock(t->id);
+ if (e->endTagRequirement() == TagStatusOptional)
+ popBlock(t->tagName);
- if (isHeaderTag(t->id))
+ if (isHeaderTag(t->tagName))
// Do not allow two header tags to be nested if the intervening tags are inlines.
popNestedHeaderTag();
}
- // if this tag is forbidden inside the current context, pop
- // blocks until we are allowed to add it...
- while (blockStack && t->id <= ID_LAST_TAG && forbiddenTag[t->id]) {
-#ifdef PARSER_DEBUG
- kdDebug( 6035 ) << "t->id: " << t->id << " is forbidden :-( " << endl;
-#endif
- popOneBlock();
- }
-
- if (!insertNode(n, t->flat))
- {
+ if (!insertNode(n, t->flat)) {
// we couldn't insert the node...
-
- if(n->isElementNode())
- {
- ElementImpl *e = static_cast<ElementImpl *>(n);
+ if (n->isElementNode()) {
+ ElementImpl* e = static_cast<ElementImpl*>(n);
e->setAttributeMap(0);
}
-#ifdef PARSER_DEBUG
- kdDebug( 6035 ) << "insertNode failed current=" << current->id() << ", new=" << n->id() << "!" << endl;
-#endif
if (map == n)
- {
-#ifdef PARSER_DEBUG
- kdDebug( 6035 ) << " --> resetting map!" << endl;
-#endif
map = 0;
- }
+
if (form == n)
- {
-#ifdef PARSER_DEBUG
- kdDebug( 6035 ) << " --> resetting form!" << endl;
-#endif
form = 0;
- }
}
}
-static bool isTableRelatedTag(int id)
+static bool isTableSection(NodeImpl* n)
{
- return (id == ID_TR || id == ID_TD || id == ID_TABLE || id == ID_TBODY || id == ID_TFOOT || id == ID_THEAD ||
- id == ID_TH);
+ return n->hasTagName(HTMLNames::tbody()) || n->hasTagName(HTMLNames::tfoot()) || n->hasTagName(HTMLNames::thead());
}
-bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
+static bool isTablePart(NodeImpl* n)
{
- SharedPtr<NodeImpl> protectNode(n);
+ return n->hasTagName(HTMLNames::tr()) || n->hasTagName(HTMLNames::td()) || n->hasTagName(HTMLNames::th()) ||
+ isTableSection(n);
+}
- int id = n->id();
+static bool isTableRelated(NodeImpl* n)
+{
+ return n->hasTagName(HTMLNames::table()) || isTablePart(n);
+}
+
+bool HTMLParser::insertNode(NodeImpl *n, bool flat)
+{
+ SharedPtr<NodeImpl> protectNode(n);
+ const AtomicString& localName = n->localName();
+ int tagPriority = n->isHTMLElement() ? static_cast<HTMLElementImpl*>(n)->tagPriority() : 0;
+
// let's be stupid and just try to insert it.
- // this should work if the document is wellformed
-#ifdef PARSER_DEBUG
- NodeImpl *tmp = current;
-#endif
+ // this should work if the document is well-formed
NodeImpl *newNode = current->addChild(n);
- if ( newNode ) {
-#ifdef PARSER_DEBUG
- kdDebug( 6035 ) << "added " << n->nodeName().string() << " to " << tmp->nodeName().string() << ", new current=" << newNode->nodeName().string() << endl;
-#endif
- // don't push elements without end tag on the stack
- if(tagPriority(id) != 0 && !flat)
- {
- pushBlock(id, tagPriority(id));
+ if (newNode) {
+ // don't push elements without end tags (e.g., <img>) on the stack
+ if (tagPriority > 0 && !flat) {
+ pushBlock(localName, tagPriority);
if (newNode == current)
- popBlock(id);
+ popBlock(localName);
else
setCurrent(newNode);
-#if SPEED_DEBUG < 2
- if(!n->attached() && HTMLWidget)
+ if (!n->attached() && HTMLWidget)
n->attach();
-#endif
}
else {
-#if SPEED_DEBUG < 2
- if(!n->attached() && HTMLWidget)
+ if (!n->attached() && HTMLWidget)
n->attach();
if (n->maintainsState()) {
doc()->registerMaintainsState(n);
@@ -340,104 +299,86 @@
n->restoreState(states);
}
n->closeRenderer();
-#endif
}
return true;
- } else {
-#ifdef PARSER_DEBUG
- kdDebug( 6035 ) << "ADDING NODE FAILED!!!! current = " << current->nodeName().string() << ", new = " << n->nodeName().string() << endl;
-#endif
- // error handling...
- HTMLElementImpl *e;
- bool handled = false;
-
- // switch according to the element to insert
- switch(id)
- {
- case ID_TR:
- case ID_TH:
- case ID_TD:
- if (inStrayTableContent && !isTableRelatedTag(current->id())) {
+ } else
+ return handleError(n, flat, localName, tagPriority); // Try to handle the error.
+}
+
+bool HTMLParser::handleError(NodeImpl* n, bool flat, const AtomicString& localName, int tagPriority)
+{
+ // Error handling code. This is just ad hoc handling of specific parent/child combinations.
+ HTMLElementImpl *e;
+ bool handled = false;
+
+ // 1. Check out the element's tag name to decide how to deal with errors.
+ if (n->isTextNode()) {
+ if (current->hasTagName(HTMLNames::select()))
+ return false;
+ } else if (n->isHTMLElement()) {
+ HTMLElementImpl* h = static_cast<HTMLElementImpl*>(n);
+ if (h->hasLocalName(HTMLNames::tr()) || h->hasLocalName(HTMLNames::th()) ||
+ h->hasLocalName(HTMLNames::td())) {
+ if (inStrayTableContent && !isTableRelated(current)) {
// pop out to the nearest enclosing table-related tag.
- while (blockStack && !isTableRelatedTag(current->id()))
+ while (blockStack && !isTableRelated(current))
popOneBlock();
return insertNode(n);
}
- break;
- case ID_COMMENT:
- break;
- case ID_HEAD:
- // ### alllow not having <HTML> in at all, as per HTML spec
- if (!current->isDocumentNode() && current->id() != ID_HTML )
+ } else if (h->hasLocalName(HTMLNames::head())) {
+ if (!current->isDocumentNode() && !current->hasTagName(HTMLNames::html()))
return false;
- break;
- // We can deal with a base, meta and link element in the body, by just adding the element to head.
- case ID_META:
- case ID_LINK:
- case ID_BASE:
- if( !head )
+ } else if (h->hasLocalName(HTMLNames::meta()) || h->hasLocalName(HTMLNames::link()) || h->hasLocalName(HTMLNames::base())) {
+ if (!head)
createHead();
- if( head ) {
- if ( head->addChild(n) ) {
-#if SPEED_DEBUG < 2
- if(!n->attached() && HTMLWidget)
+ if (head) {
+ if (head->addChild(n)) {
+ if (!n->attached() && HTMLWidget)
n->attach();
-#endif
return true;
- } else {
- return false;
- }
+ } else
+ return false;
}
- break;
- case ID_HTML:
+ } else if (h->hasLocalName(HTMLNames::html())) {
if (!current->isDocumentNode() ) {
- if ( doc()->firstChild()->id() == ID_HTML) {
- // we have another <HTML> element.... apply attributes to existing one
- // make sure we don't overwrite already existing attributes
- NamedAttrMapImpl *map = static_cast<ElementImpl*>(n)->attributes(true);
- NamedAttrMapImpl *bmap = static_cast<ElementImpl*>(doc()->firstChild())->attributes(false);
- bool changed = false;
- for (unsigned long l = 0; map && l < map->length(); ++l) {
- AttributeImpl* it = map->attributeItem(l);
- changed = !bmap->getAttributeItem(it->id());
- bmap->insertAttribute(it->clone(false));
- }
- if ( changed )
- doc()->recalcStyle( NodeImpl::Inherit );
- }
+ if (doc()->firstChild()->hasTagName(HTMLNames::html())) {
+ // we have another <HTML> element.... apply attributes to existing one
+ // make sure we don't overwrite already existing attributes
+ NamedAttrMapImpl *map = static_cast<ElementImpl*>(n)->attributes(true);
+ NamedAttrMapImpl *bmap = static_cast<ElementImpl*>(doc()->firstChild())->attributes(false);
+ bool changed = false;
+ for (unsigned long l = 0; map && l < map->length(); ++l) {
+ AttributeImpl* it = map->attributeItem(l);
+ changed = !bmap->getAttributeItem(it->id());
+ bmap->insertAttribute(it->clone(false));
+ }
+ if (changed)
+ doc()->recalcStyle(NodeImpl::Inherit);
+ }
return false;
- }
- break;
- case ID_TITLE:
- case ID_STYLE:
- if ( !head )
+ }
+ } else if (h->hasLocalName(HTMLNames::title()) || h->hasLocalName(HTMLNames::style())) {
+ if (!head)
createHead();
- if ( head ) {
+ if (head) {
DOM::NodeImpl *newNode = head->addChild(n);
- if ( newNode ) {
- pushBlock(id, tagPriority(id));
+ if (newNode) {
+ pushBlock(localName, tagPriority);
setCurrent(newNode);
-#if SPEED_DEBUG < 2
- if(!n->attached() && HTMLWidget)
+ if (!n->attached() && HTMLWidget)
n->attach();
-#endif
} else {
-#ifdef PARSER_DEBUG
- kdDebug( 6035 ) << "adding style before to body failed!!!!" << endl;
-#endif
- discard_until = ID_STYLE + ID_CLOSE_TAG;
+ setSkipMode(HTMLNames::style());
return false;
}
return true;
} else if(inBody) {
- discard_until = ID_STYLE + ID_CLOSE_TAG;
+ setSkipMode(HTMLNames::style());
return false;
}
- break;
- // SCRIPT and OBJECT are allowed in the body.
- case ID_BODY:
- if(inBody && doc()->body()) {
+ } else if (h->hasLocalName(HTMLNames::body())) {
+ if (inBody && doc()->body()) {
// we have another <BODY> element.... apply attributes to existing one
// make sure we don't overwrite already existing attributes
// some sites use <body bgcolor=rightcolor>...<body bgcolor=wrongcolor>
@@ -449,661 +390,587 @@
changed = !bmap->getAttributeItem(it->id());
bmap->insertAttribute(it->clone(false));
}
- if ( changed )
- doc()->recalcStyle( NodeImpl::Inherit );
- } else if ( current->isDocumentNode() )
- break;
- return false;
- break;
-
- // the following is a hack to move non rendered elements
- // outside of tables.
- // needed for broken constructs like <table><form ...><tr>....
- case ID_INPUT:
- {
- ElementImpl *e = static_cast<ElementImpl *>(n);
- DOMString type = e->getAttribute(ATTR_TYPE);
-
- if ( strcasecmp( type, "hidden" ) == 0 && form) {
+ if (changed)
+ doc()->recalcStyle(NodeImpl::Inherit);
+ return false;
+ }
+ else if (!current->isDocumentNode())
+ return false;
+ } else if (h->hasLocalName(HTMLNames::input())) {
+ DOMString type = h->getAttribute(ATTR_TYPE);
+ if (strcasecmp(type, "hidden") == 0 && form) {
form->addChild(n);
-#if SPEED_DEBUG < 2
- if(!n->attached() && HTMLWidget)
+ if (!n->attached() && HTMLWidget)
n->attach();
-#endif
return true;
}
- break;
- }
- case ID_TEXT:
- // ignore text inside the following elements.
- switch(current->id())
- {
- case ID_SELECT:
- return false;
- default:
- ;
- // fall through!!
- };
- break;
- case ID_DD:
- case ID_DT:
+ } else if (h->hasLocalName(HTMLNames::dd()) || h->hasLocalName(HTMLNames::dt())) {
e = new HTMLDListElementImpl(document);
- if ( insertNode(e) ) {
+ if (insertNode(e)) {
insertNode(n);
return true;
}
- break;
- case ID_AREA:
- {
- if(map)
- {
+ } else if (h->hasLocalName(HTMLNames::area())) {
+ if (map) {
map->addChild(n);
-#if SPEED_DEBUG < 2
- if(!n->attached() && HTMLWidget)
+ if (!n->attached() && HTMLWidget)
n->attach();
-#endif
handled = true;
}
else
return false;
return true;
- }
- case ID_CAPTION: {
- switch (current->id()) {
- case ID_THEAD:
- case ID_TBODY:
- case ID_TFOOT:
- case ID_TR:
- case ID_TH:
- case ID_TD: {
- NodeImpl* tsection = current;
- if (current->id() == ID_TR)
- tsection = current->parent();
- else if (current->id() == ID_TD || current->id() == ID_TH)
- tsection = current->parent()->parent();
- NodeImpl* table = tsection->parent();
- int exceptioncode = 0;
- table->insertBefore(n, tsection, exceptioncode);
- pushBlock(id, tagPriority(id));
- setCurrent(n);
- inStrayTableContent++;
- blockStack->strayTableContent = true;
- return true;
- }
- default:
- break;
+ } else if (h->hasLocalName(HTMLNames::caption())) {
+ if (isTablePart(current)) {
+ NodeImpl* tsection = current;
+ if (current->hasTagName(HTMLNames::tr()))
+ tsection = current->parent();
+ else if (current->hasTagName(HTMLNames::td()) || current->hasTagName(HTMLNames::th()))
+ tsection = current->parent()->parent();
+ NodeImpl* table = tsection->parent();
+ int exceptioncode = 0;
+ table->insertBefore(n, tsection, exceptioncode);
+ pushBlock(localName, tagPriority);
+ setCurrent(n);
+ inStrayTableContent++;
+ blockStack->strayTableContent = true;
+ return true;
}
- break;
- }
- case ID_THEAD:
- case ID_TBODY:
- case ID_TFOOT:
- case ID_COLGROUP: {
- if (isTableRelatedTag(current->id())) {
- while (blockStack && current->id() != ID_TABLE && isTableRelatedTag(current->id()))
+ } else if (h->hasLocalName(HTMLNames::thead()) || h->hasLocalName(HTMLNames::tbody()) ||
+ h->hasLocalName(HTMLNames::tfoot()) || h->hasLocalName(HTMLNames::colgroup())) {
+ if (isTableRelated(current)) {
+ while (blockStack && isTablePart(current))
popOneBlock();
return insertNode(n);
}
}
- default:
- break;
- }
-
- // switch on the currently active element
- switch(current->id())
- {
- case ID_HTML:
- switch(id)
- {
- case ID_SCRIPT:
- case ID_STYLE:
- case ID_META:
- case ID_LINK:
- case ID_OBJECT:
- case ID_EMBED:
- case ID_TITLE:
- case ID_ISINDEX:
- case ID_BASE:
- if(!head) {
+ }
+
+ // 2. Next we examine our currently active element to do some further error handling.
+ if (current->isHTMLElement()) {
+ HTMLElementImpl* h = static_cast<HTMLElementImpl*>(current);
+ const AtomicString& currentTagName = current->localName();
+ if (h->hasLocalName(HTMLNames::html())) {
+ HTMLElementImpl* elt = n->isHTMLElement() ? static_cast<HTMLElementImpl*>(n) : 0;
+ if (elt && (elt->hasLocalName(HTMLNames::script()) || elt->hasLocalName(HTMLNames::style()) ||
+ elt->hasLocalName(HTMLNames::meta()) || elt->hasLocalName(HTMLNames::link()) ||
+ elt->hasLocalName(HTMLNames::object()) || elt->hasLocalName(HTMLNames::embed()) ||
+ elt->hasLocalName(HTMLNames::title()) || elt->hasLocalName(HTMLNames::isindex()) ||
+ elt->hasLocalName(HTMLNames::base()))) {
+ if (!head) {
head = new HTMLHeadElementImpl(document);
e = head;
insertNode(e);
handled = true;
}
- break;
- case ID_TEXT: {
- TextImpl *t = static_cast<TextImpl *>(n);
- if (t->containsOnlyWhitespace())
- return false;
- /* Fall through to default */
+ } else {
+ if (n->isTextNode()) {
+ TextImpl *t = static_cast<TextImpl *>(n);
+ if (t->containsOnlyWhitespace())
+ return false;
+ }
+ if (!haveFrameSet) {
+ e = new HTMLBodyElementImpl(document);
+ startBody();
+ insertNode(e);
+ handled = true;
+ }
}
- default:
- if ( haveFrameSet ) break;
- e = new HTMLBodyElementImpl(document);
- startBody();
- insertNode(e);
- handled = true;
- break;
- }
- break;
- case ID_HEAD:
- // we can get here only if the element is not allowed in head.
- if (id == ID_HTML)
+ } else if (h->hasLocalName(HTMLNames::head())) {
+ if (n->hasTagName(HTMLNames::html()))
return false;
else {
// This means the body starts here...
- if ( haveFrameSet ) break;
- popBlock(ID_HEAD);
- e = new HTMLBodyElementImpl(document);
- startBody();
- insertNode(e);
- handled = true;
+ if (!haveFrameSet) {
+ popBlock(currentTagName);
+ e = new HTMLBodyElementImpl(document);
+ startBody();
+ insertNode(e);
+ handled = true;
+ }
}
- break;
- case ID_BODY:
- break;
- case ID_CAPTION:
+ } else if (h->hasLocalName(HTMLNames::caption())) {
// Illegal content in a caption. Close the caption and try again.
- popBlock(ID_CAPTION);
- switch( id ) {
- case ID_THEAD:
- case ID_TFOOT:
- case ID_TBODY:
- case ID_TR:
- case ID_TD:
- case ID_TH:
+ popBlock(currentTagName);
+ if (isTablePart(n))
return insertNode(n, flat);
- }
- break;
- case ID_TABLE:
- case ID_THEAD:
- case ID_TFOOT:
- case ID_TBODY:
- case ID_TR:
- switch(id)
- {
- case ID_TABLE:
- popBlock(ID_TABLE); // end the table
+ } else if (h->hasLocalName(HTMLNames::table()) || h->hasLocalName(HTMLNames::tr()) || isTableSection(h)) {
+ if (n->hasTagName(HTMLNames::table())) {
+ popBlock(localName); // end the table
handled = true; // ...and start a new one
- break;
- case ID_TEXT:
- {
- TextImpl *t = static_cast<TextImpl *>(n);
- if (t->containsOnlyWhitespace())
- return false;
- DOMStringImpl *i = t->string();
- unsigned int pos = 0;
- while(pos < i->l && ( *(i->s+pos) == QChar(' ') ||
- *(i->s+pos) == QChar(0xa0))) pos++;
- if(pos == i->l)
- break;
- }
- default:
- {
- NodeImpl *node = current;
- NodeImpl *parent = node->parentNode();
-
- NodeImpl *parentparent = parent->parentNode();
-
- if (n->isTextNode() ||
- ( node->id() == ID_TR &&
- ( parent->id() == ID_THEAD ||
- parent->id() == ID_TBODY ||
- parent->id() == ID_TFOOT ) && parentparent->id() == ID_TABLE ) ||
- ( !checkChild(ID_TR, id, !doc()->inCompatMode()) && ( node->id() == ID_THEAD || node->id() == ID_TBODY || node->id() == ID_TFOOT ) &&
- parent->id() == ID_TABLE ))
- {
- node = (node->id() == ID_TABLE) ? node :
- ((node->id() == ID_TR) ? parentparent : parent);
+ } else {
+ bool possiblyMoveStrayContent = true;
+ int exceptionCode = 0;
+ if (n->isTextNode()) {
+ TextImpl *t = static_cast<TextImpl *>(n);
+ if (t->containsOnlyWhitespace())
+ return false;
+ DOMStringImpl *i = t->string();
+ unsigned int pos = 0;
+ while (pos < i->l && (*(i->s+pos) == QChar(' ') ||
+ *(i->s+pos) == QChar(0xa0))) pos++;
+ if (pos == i->l)
+ possiblyMoveStrayContent = false;
+ }
+ if (possiblyMoveStrayContent) {
+ NodeImpl *node = current;
NodeImpl *parent = node->parentNode();
- int exceptioncode = 0;
- parent->insertBefore( n, node, exceptioncode );
- if ( exceptioncode ) {
-#ifdef PARSER_DEBUG
- kdDebug( 6035 ) << "adding content before table failed!" << endl;
-#endif
- break;
+ NodeImpl *grandparent = parent->parentNode();
+
+ if (n->isTextNode() ||
+ (h->hasLocalName(HTMLNames::tr()) &&
+ isTableSection(parent) && grandparent->hasTagName(HTMLNames::table())) ||
+ ((!n->hasTagName(HTMLNames::td()) && !n->hasTagName(HTMLNames::th()) &&
+ !n->hasTagName(HTMLNames::form()) && !n->hasTagName(HTMLNames::script())) && isTableSection(node) &&
+ parent->hasTagName(HTMLNames::table()))) {
+ node = (node->hasTagName(HTMLNames::table())) ? node :
+ ((node->hasTagName(HTMLNames::tr())) ? grandparent : parent);
+ NodeImpl *parent = node->parentNode();
+ parent->insertBefore(n, node, exceptionCode);
+ if (!exceptionCode) {
+ if (n->isHTMLElement() && tagPriority > 0 &&
+ !flat && static_cast<HTMLElementImpl*>(n)->endTagRequirement() != TagStatusForbidden)
+ {
+ pushBlock(localName, tagPriority);
+ setCurrent(n);
+ inStrayTableContent++;
+ blockStack->strayTableContent = true;
+ }
+ return true;
+ }
}
- if (n->isElementNode() && tagPriority(id) != 0 &&
- !flat && endTagRequirement(id) != DOM::FORBIDDEN)
- {
- pushBlock(id, tagPriority(id));
- setCurrent(n);
- inStrayTableContent++;
- blockStack->strayTableContent = true;
+
+ if (!exceptionCode) {
+ if (current->hasTagName(HTMLNames::tr()))
+ e = new HTMLTableCellElementImpl(HTMLNames::td(), document);
+ else if (current->hasTagName(HTMLNames::table()))
+ e = new HTMLTableSectionElementImpl(HTMLNames::tbody(), document, true); // implicit
+ else
+ e = new HTMLTableRowElementImpl(document);
+
+ insertNode(e);
+ handled = true;
}
- return true;
}
-
- if ( current->id() == ID_TR )
- e = new HTMLTableCellElementImpl(document, ID_TD);
- else if ( current->id() == ID_TABLE )
- e = new HTMLTableSectionElementImpl( document, ID_TBODY, true /* implicit */ );
- else
- e = new HTMLTableRowElementImpl( document );
-
- insertNode(e);
- handled = true;
- break;
- } // end default
- } // end switch
- break;
- case ID_OBJECT:
- discard_until = ID_OBJECT + ID_CLOSE_TAG;
+ }
+ }
+ else if (h->hasLocalName(HTMLNames::object())) {
+ setSkipMode(HTMLNames::object());
return false;
- case ID_UL:
- case ID_OL:
- case ID_DIR:
- case ID_MENU:
+ } else if (h->hasLocalName(HTMLNames::ul()) || h->hasLocalName(HTMLNames::ol()) ||
+ h->hasLocalName(HTMLNames::dir()) || h->hasLocalName(HTMLNames::menu())) {
e = new HTMLDivElementImpl(document);
insertNode(e);
handled = true;
- break;
- case ID_DL:
- popBlock(ID_DL);
- handled = true;
- break;
- case ID_DT:
- popBlock(ID_DT);
- handled = true;
- break;
- case ID_SELECT:
- if( n->isInline() )
+ } else if (h->hasLocalName(HTMLNames::dl()) || h->hasLocalName(HTMLNames::dt())) {
+ popBlock(currentTagName);
+ handled = true;
+ } else if (h->hasLocalName(HTMLNames::select())) {
+ if (isInline(n))
return false;
- break;
- case ID_P:
- case ID_H1:
- case ID_H2:
- case ID_H3:
- case ID_H4:
- case ID_H5:
- case ID_H6:
- if(!n->isInline())
- {
- popBlock(current->id());
+ } else if (h->hasLocalName(HTMLNames::p()) || isHeaderTag(currentTagName)) {
+ if (!isInline(n)) {
+ popBlock(currentTagName);
handled = true;
}
- break;
- case ID_OPTION:
- case ID_OPTGROUP:
- if (id == ID_OPTGROUP)
- {
- popBlock(current->id());
+ } else if (h->hasLocalName(HTMLNames::option()) || h->hasLocalName(HTMLNames::optgroup())) {
+ if (localName == HTMLNames::optgroup()) {
+ popBlock(currentTagName);
handled = true;
}
- else if(id == ID_SELECT)
- {
+ else if (localName == HTMLNames::select()) {
// IE treats a nested select as </select>. Let's do the same
- popBlock( ID_SELECT );
- break;
+ popBlock(localName);
}
- break;
- // head elements in the body should be ignored.
- case ID_ADDRESS:
- popBlock(ID_ADDRESS);
+ } else if (h->hasLocalName(HTMLNames::address())) {
+ popBlock(currentTagName);
handled = true;
- break;
- case ID_COLGROUP:
- if (id != ID_TEXT) {
- popBlock(ID_COLGROUP);
+ } else if (h->hasLocalName(HTMLNames::colgroup())) {
+ if (!n->isTextNode()) {
+ popBlock(currentTagName);
handled = true;
}
- break;
- case ID_FONT:
- popBlock(ID_FONT);
+ } else if (h->hasLocalName(HTMLNames::font())) {
+ popBlock(currentTagName);
handled = true;
- break;
- default:
- if(current->isDocumentNode())
- {
- if(current->firstChild() == 0) {
- e = new HTMLHtmlElementImpl(document);
- insertNode(e);
- handled = true;
- }
- }
- else if(current->isInline())
- {
+ } else if (!h->hasLocalName(HTMLNames::body())) {
+ if (isInline(current)) {
popInlineBlocks();
handled = true;
}
}
-
- // if we couldn't handle the error, just rethrow the exception...
- if(!handled)
- {
- //kdDebug( 6035 ) << "Exception handler failed in HTMLPArser::insertNode()" << endl;
- return false;
+ }
+ else if (current->isDocumentNode()) {
+ if (current->firstChild() == 0) {
+ e = new HTMLHtmlElementImpl(document);
+ insertNode(e);
+ handled = true;
}
-
- return insertNode(n);
}
+
+ // 3. If we couldn't handle the error, just return false and attempt to error-correct again.
+ if (!handled)
+ return false;
+ return insertNode(n);
}
-NodeImpl *KHTMLParser::getElement(Token* t)
+typedef bool (HTMLParser::*CreateErrorCheckFunc)(Token* t, NodeImpl*&);
+typedef HashMap<DOMStringImpl *, CreateErrorCheckFunc, PointerHash<DOMStringImpl *> > FunctionMap;
+
+bool HTMLParser::textCreateErrorCheck(Token* t, NodeImpl*& result)
{
- switch (t->id)
- {
- case ID_HEAD:
- if (!head && current->id() == ID_HTML) {
- head = new HTMLHeadElementImpl(document);
- return head;
- }
- return 0;
- case ID_BODY:
- // body no longer allowed if we have a frameset
- if (haveFrameSet)
- return 0;
- popBlock(ID_HEAD);
- startBody();
- return new HTMLBodyElementImpl(document);
-
-// frames
- case ID_FRAMESET:
- popBlock(ID_HEAD);
- if (inBody && !haveFrameSet && !haveContent) {
- popBlock(ID_BODY);
- // ### actually for IE document.body returns the now hidden "body" element
- // we can't implement that behaviour now because it could cause too many
- // regressions and the headaches are not worth the work as long as there is
- // no site actually relying on that detail (Dirk)
- if (doc()->body())
- doc()->body()->setAttribute(ATTR_STYLE, "display:none");
- inBody = false;
- }
- if ((haveContent || haveFrameSet) && current->id() == ID_HTML)
- return 0;
- haveFrameSet = true;
- startBody();
- return new HTMLFrameSetElementImpl(document);
+ result = new TextImpl(document, t->text);
+ return false;
+}
+bool HTMLParser::commentCreateErrorCheck(Token* t, NodeImpl*& result)
+{
+ if (includesCommentsInDOM)
+ result = new CommentImpl(document, t->text);
+ return false;
+}
+
+bool HTMLParser::headCreateErrorCheck(Token* t, NodeImpl*& result)
+{
+ return (!head || current->localName() == HTMLNames::html());
+}
+
+bool HTMLParser::bodyCreateErrorCheck(Token* t, NodeImpl*& result)
+{
+ // body no longer allowed if we have a frameset
+ if (haveFrameSet)
+ return false;
+ popBlock(HTMLNames::head());
+ startBody();
+ return true;
+}
+
+bool HTMLParser::framesetCreateErrorCheck(Token* t, NodeImpl*& result)
+{
+ popBlock(HTMLNames::head());
+ if (inBody && !haveFrameSet && !haveContent) {
+ popBlock(HTMLNames::body());
+ // ### actually for IE document.body returns the now hidden "body" element
+ // we can't implement that behaviour now because it could cause too many
+ // regressions and the headaches are not worth the work as long as there is
+ // no site actually relying on that detail (Dirk)
+ if (doc()->body())
+ doc()->body()->setAttribute(ATTR_STYLE, "display:none");
+ inBody = false;
+ }
+ if ((haveContent || haveFrameSet) && current->localName() == HTMLNames::html())
+ return false;
+ haveFrameSet = true;
+ startBody();
+ return true;
+}
+
+bool HTMLParser::iframeCreateErrorCheck(Token* t, NodeImpl*& result)
+{
// a bit of a special case, since the frame is inlined
- case ID_IFRAME:
- discard_until = ID_IFRAME + ID_CLOSE_TAG;
- break;
-
-// form elements
- case ID_FORM:
- // Only create a new form if we're not already inside one.
- // This is consistent with other browsers' behavior.
- if (form)
- return 0;
- form = new HTMLFormElementImpl(document);
- return form;
- case ID_BUTTON:
- return new HTMLButtonElementImpl(document, form);
- case ID_FIELDSET:
- return new HTMLFieldSetElementImpl(document, form);
- case ID_INPUT:
- return new HTMLInputElementImpl(document, form);
- case ID_ISINDEX: {
- NodeImpl *n = handleIsindex(t);
- if (!inBody) {
- if (isindex)
- isindex->deref();
- isindex = n;
- isindex->ref();
- return 0;
- }
+ setSkipMode(HTMLNames::iframe());
+ return true;
+}
+
+bool HTMLParser::formCreateErrorCheck(Token* t, NodeImpl*& result)
+{
+ // Only create a new form if we're not already inside one.
+ // This is consistent with other browsers' behavior.
+ return !form;
+}
+
+bool HTMLParser::isindexCreateErrorCheck(Token* t, NodeImpl*& result)
+{
+ NodeImpl *n = handleIsindex(t);
+ if (!inBody) {
+ if (isindex)
+ isindex->deref();
+ isindex = n;
+ isindex->ref();
+ } else {
t->flat = true;
- return n;
+ result = n;
}
- case ID_KEYGEN:
- return new HTMLKeygenElementImpl(document, form);
- case ID_LEGEND:
- return new HTMLLegendElementImpl(document, form);
- case ID_OPTGROUP:
- return new HTMLOptGroupElementImpl(document, form);
- case ID_OPTION:
- return new HTMLOptionElementImpl(document, form);
- case ID_SELECT:
- inSelect = true;
- return new HTMLSelectElementImpl(document, form);
- case ID_TEXTAREA:
- return new HTMLTextAreaElementImpl(document, form);
-
-// lists
- case ID_DD:
- popBlock(ID_DT);
- popBlock(ID_DD);
- break;
- case ID_DT:
- popBlock(ID_DD);
- popBlock(ID_DT);
- break;
- case ID_LI:
- popBlock(ID_LI);
- break;
-
-// anchor
- case ID_A:
- // Never allow nested <a>s.
- popBlock(ID_A);
- break;
-
-// images
- case ID_IMG:
- return new HTMLImageElementImpl(document, form);
- case ID_MAP:
- map = new HTMLMapElementImpl(document);
- return map;
-
-// tables
- case ID_TR:
- popBlock(ID_TR);
- break;
- case ID_TD:
- case ID_TH:
- popBlock(ID_TH);
- popBlock(ID_TD);
- break;
- case ID_TBODY:
- case ID_THEAD:
- case ID_TFOOT:
- popBlock(ID_THEAD);
- popBlock(ID_TBODY);
- popBlock(ID_TFOOT);
- break;
-
-// elements with no special representation in the DOM
- case ID_TT:
- case ID_U:
- case ID_B:
- case ID_I:
- case ID_S:
- case ID_STRIKE:
- case ID_BIG:
- case ID_SMALL:
- if (!allowNestedRedundantTag(t->id))
- return 0;
- break;
-
- case ID_NOBR:
- case ID_WBR:
- popBlock(t->id); // Don't allow nested <nobr> or <wbr>
- break;
-
-// these are special, and normally not rendered
- case ID_NOEMBED:
- discard_until = ID_NOEMBED + ID_CLOSE_TAG;
- return 0;
- case ID_NOFRAMES:
- discard_until = ID_NOFRAMES + ID_CLOSE_TAG;
- return 0;
- case ID_NOSCRIPT:
- if (HTMLWidget && HTMLWidget->part()->jScriptEnabled())
- discard_until = ID_NOSCRIPT + ID_CLOSE_TAG;
- return 0;
- case ID_NOLAYER:
- //discard_until = ID_NOLAYER + ID_CLOSE_TAG;
- return 0;
- case ID_TEXT:
- return new TextImpl(document, t->text);
- case ID_COMMENT:
- if (!includesCommentsInDOM)
- return 0;
- break;
-
- case ID_SCRIPT:
- {
- HTMLScriptElementImpl *scriptElement = new HTMLScriptElementImpl(document);
- scriptElement->setCreatedByParser(true);
- return scriptElement;
- }
+ return false;
+}
+
+bool HTMLParser::selectCreateErrorCheck(Token* t, NodeImpl*& result)
+{
+ inSelect = true;
+ return true;
+}
+
+bool HTMLParser::ddCreateErrorCheck(Token* t, NodeImpl*& result)
+{
+ popBlock(HTMLNames::dt());
+ popBlock(HTMLNames::dd());
+ return true;
+}
+
+bool HTMLParser::dtCreateErrorCheck(Token* t, NodeImpl*& result)
+{
+ popBlock(HTMLNames::dd());
+ popBlock(HTMLNames::dt());
+ return true;
+}
+
+bool HTMLParser::nestedCreateErrorCheck(Token* t, NodeImpl*& result)
+{
+ popBlock(t->tagName);
+ return true;
+}
+
+bool HTMLParser::nestedStyleCreateErrorCheck(Token* t, NodeImpl*& result)
+{
+ return allowNestedRedundantTag(t->tagName);
+}
+
+bool HTMLParser::tableCellCreateErrorCheck(Token* t, NodeImpl*& result)
+{
+ popBlock(HTMLNames::td());
+ popBlock(HTMLNames::th());
+ return true;
+}
+
+bool HTMLParser::tableSectionCreateErrorCheck(Token* t, NodeImpl*& result)
+{
+ popBlock(HTMLNames::thead());
+ popBlock(HTMLNames::tbody());
+ popBlock(HTMLNames::tfoot());
+ return true;
+}
+
+bool HTMLParser::noembedCreateErrorCheck(Token* t, NodeImpl*& result)
+{
+ setSkipMode(HTMLNames::noembed());
+ return false;
+}
+
+bool HTMLParser::noframesCreateErrorCheck(Token* t, NodeImpl*& result)
+{
+ setSkipMode(HTMLNames::noframes());
+ return false;
+}
+
+bool HTMLParser::noscriptCreateErrorCheck(Token* t, NodeImpl*& result)
+{
+ if (HTMLWidget && HTMLWidget->part()->jScriptEnabled())
+ setSkipMode(HTMLNames::noscript());
+ return false;
+}
+
+bool HTMLParser::nolayerCreateErrorCheck(Token* t, NodeImpl*& result)
+{
+ return false;
+}
+
+NodeImpl *HTMLParser::getNode(Token* t)
+{
+ // Init our error handling table.
+ static FunctionMap gFunctionMap;
+ if (gFunctionMap.isEmpty()) {
+ gFunctionMap.insert(textAtom.implementation(), &HTMLParser::textCreateErrorCheck);
+ gFunctionMap.insert(commentAtom.implementation(), &HTMLParser::commentCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::head().localName().implementation(), &HTMLParser::headCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::body().localName().implementation(), &HTMLParser::bodyCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::frameset().localName().implementation(), &HTMLParser::framesetCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::iframe().localName().implementation(), &HTMLParser::iframeCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::form().localName().implementation(), &HTMLParser::formCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::isindex().localName().implementation(), &HTMLParser::isindexCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::select().localName().implementation(), &HTMLParser::selectCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::dd().localName().implementation(), &HTMLParser::ddCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::dt().localName().implementation(), &HTMLParser::dtCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::li().localName().implementation(), &HTMLParser::nestedCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::a().localName().implementation(), &HTMLParser::nestedCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::nobr().localName().implementation(), &HTMLParser::nestedCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::wbr().localName().implementation(), &HTMLParser::nestedCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::tr().localName().implementation(), &HTMLParser::nestedCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::td().localName().implementation(), &HTMLParser::tableCellCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::th().localName().implementation(), &HTMLParser::tableCellCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::tbody().localName().implementation(), &HTMLParser::tableSectionCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::thead().localName().implementation(), &HTMLParser::tableSectionCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::tfoot().localName().implementation(), &HTMLParser::tableSectionCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::tt().localName().implementation(), &HTMLParser::nestedStyleCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::u().localName().implementation(), &HTMLParser::nestedStyleCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::b().localName().implementation(), &HTMLParser::nestedStyleCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::i().localName().implementation(), &HTMLParser::nestedStyleCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::s().localName().implementation(), &HTMLParser::nestedStyleCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::strike().localName().implementation(), &HTMLParser::nestedStyleCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::big().localName().implementation(), &HTMLParser::nestedStyleCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::small().localName().implementation(), &HTMLParser::nestedStyleCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::noembed().localName().implementation(), &HTMLParser::noembedCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::noframes().localName().implementation(), &HTMLParser::noframesCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::noscript().localName().implementation(), &HTMLParser::noscriptCreateErrorCheck);
+ gFunctionMap.insert(HTMLNames::nolayer().localName().implementation(), &HTMLParser::nolayerCreateErrorCheck);
}
- return document->document()->createHTMLElement(t->id);
+ bool proceed = true;
+ NodeImpl* result = 0;
+ CreateErrorCheckFunc errorCheckFunc = gFunctionMap.get(t->tagName.implementation());
+ if (errorCheckFunc)
+ proceed = (this->*(errorCheckFunc))(t, result);
+
+ if (proceed) {
+ result = HTMLElementFactory::createHTMLElement(t->tagName, doc(), form);
+ if (t->tagName == HTMLNames::form())
+ form = static_cast<HTMLFormElementImpl*>(result);
+ }
+ return result;
}
#define MAX_REDUNDANT 20
-bool KHTMLParser::allowNestedRedundantTag(int _id)
+bool HTMLParser::allowNestedRedundantTag(const AtomicString& _tagName)
{
// www.liceo.edu.mx is an example of a site that achieves a level of nesting of
// about 1500 tags, all from a bunch of <b>s. We will only allow at most 20
// nested tags of the same type before just ignoring them all together.
int i = 0;
for (HTMLStackElem* curr = blockStack;
- i < MAX_REDUNDANT && curr && curr->id == _id;
+ i < MAX_REDUNDANT && curr && curr->tagName == _tagName;
curr = curr->next, i++);
return i != MAX_REDUNDANT;
}
-void KHTMLParser::processCloseTag(Token *t)
+void HTMLParser::processCloseTag(Token *t)
{
- // support for really broken html. Can't believe I'm supporting such crap (lars)
- switch(t->id)
- {
- case ID_HTML+ID_CLOSE_TAG:
- case ID_BODY+ID_CLOSE_TAG:
- // we never close the body tag, since some stupid web pages close it before the actual end of the doc.
- // let's rely on the end() call to close things.
+ // Support for really broken html.
+ // we never close the body tag, since some stupid web pages close it before the actual end of the doc.
+ // let's rely on the end() call to close things.
+ if (t->tagName == HTMLNames::html() || t->tagName == HTMLNames::body())
return;
- case ID_FORM+ID_CLOSE_TAG:
+
+ if (t->tagName == HTMLNames::form())
form = 0;
- // this one is to get the right style on the body element
- break;
- case ID_MAP+ID_CLOSE_TAG:
+ else if (t->tagName == HTMLNames::map())
map = 0;
- break;
- case ID_SELECT+ID_CLOSE_TAG:
+ else if (t->tagName == HTMLNames::select())
inSelect = false;
- break;
- default:
- break;
- }
-
-#ifdef PARSER_DEBUG
- kdDebug( 6035 ) << "added the following childs to " << current->nodeName().string() << endl;
- NodeImpl *child = current->firstChild();
- while(child != 0)
- {
- kdDebug( 6035 ) << " " << child->nodeName().string() << endl;
- child = child->nextSibling();
- }
-#endif
+
HTMLStackElem* oldElem = blockStack;
- popBlock(t->id-ID_CLOSE_TAG);
- if (oldElem == blockStack && t->id == ID_P+ID_CLOSE_TAG) {
+ popBlock(t->tagName);
+ if (oldElem == blockStack && t->tagName == HTMLNames::p()) {
// We encountered a stray </p>. Amazingly Gecko, WinIE, and MacIE all treat
// this as a valid break, i.e., <p></p>. So go ahead and make the empty
// paragraph.
- t->id-=ID_CLOSE_TAG;
+ t->beginTag = true;
parseToken(t);
- popBlock(ID_P);
+ popBlock(t->tagName);
}
#ifdef PARSER_DEBUG
kdDebug( 6035 ) << "closeTag --> current = " << current->nodeName().string() << endl;
#endif
}
-bool KHTMLParser::isHeaderTag(int _id)
+bool HTMLParser::isHeaderTag(const AtomicString& tagName)
{
- switch (_id) {
- case ID_H1:
- case ID_H2:
- case ID_H3:
- case ID_H4:
- case ID_H5:
- case ID_H6:
- return true;
- default:
- return false;
+ static HashSet<DOMStringImpl*, PointerHash<DOMStringImpl*> > headerTags;
+ if (headerTags.isEmpty()) {
+ headerTags.insert(HTMLNames::h1().localName().implementation());
+ headerTags.insert(HTMLNames::h2().localName().implementation());
+ headerTags.insert(HTMLNames::h3().localName().implementation());
+ headerTags.insert(HTMLNames::h4().localName().implementation());
+ headerTags.insert(HTMLNames::h5().localName().implementation());
+ headerTags.insert(HTMLNames::h6().localName().implementation());
}
+
+ return headerTags.contains(tagName.implementation());
}
-void KHTMLParser::popNestedHeaderTag()
+void HTMLParser::popNestedHeaderTag()
{
// This function only cares about checking for nested headers that have only inlines in between them.
NodeImpl* currNode = current;
for (HTMLStackElem* curr = blockStack; curr; curr = curr->next) {
- if (isHeaderTag(curr->id)) {
- popBlock(curr->id);
+ if (isHeaderTag(curr->tagName)) {
+ popBlock(curr->tagName);
return;
}
- if (currNode && !currNode->isInline())
+ if (currNode && !isInline(currNode))
return;
currNode = curr->node;
}
}
-bool KHTMLParser::isResidualStyleTag(int _id)
+bool HTMLParser::isInline(DOM::NodeImpl* node) const
{
- switch (_id) {
- case ID_A:
- case ID_FONT:
- case ID_TT:
- case ID_U:
- case ID_B:
- case ID_I:
- case ID_S:
- case ID_STRIKE:
- case ID_BIG:
- case ID_SMALL:
- case ID_EM:
- case ID_STRONG:
- case ID_DFN:
- case ID_CODE:
- case ID_SAMP:
- case ID_KBD:
- case ID_VAR:
+ if (node->isTextNode())
+ return true;
+
+ if (node->isHTMLElement()) {
+ HTMLElementImpl* e = static_cast<HTMLElementImpl*>(node);
+ if (e->hasLocalName(HTMLNames::a()) || e->hasLocalName(HTMLNames::font()) || e->hasLocalName(HTMLNames::tt()) ||
+ e->hasLocalName(HTMLNames::u()) || e->hasLocalName(HTMLNames::b()) || e->hasLocalName(HTMLNames::i()) ||
+ e->hasLocalName(HTMLNames::s()) || e->hasLocalName(HTMLNames::strike()) || e->hasLocalName(HTMLNames::big()) ||
+ e->hasLocalName(HTMLNames::small()) || e->hasLocalName(HTMLNames::em()) || e->hasLocalName(HTMLNames::strong()) ||
+ e->hasLocalName(HTMLNames::dfn()) || e->hasLocalName(HTMLNames::code()) || e->hasLocalName(HTMLNames::samp()) ||
+ e->hasLocalName(HTMLNames::kbd()) || e->hasLocalName(HTMLNames::var()) || e->hasLocalName(HTMLNames::cite()) ||
+ e->hasLocalName(HTMLNames::abbr()) || e->hasLocalName(HTMLNames::acronym()) || e->hasLocalName(HTMLNames::sub()) ||
+ e->hasLocalName(HTMLNames::sup()) || e->hasLocalName(HTMLNames::span()) || e->hasLocalName(HTMLNames::nobr()) ||
+ e->hasLocalName(HTMLNames::wbr()))
return true;
- default:
- return false;
}
+
+ return false;
}
-bool KHTMLParser::isAffectedByResidualStyle(int _id)
+bool HTMLParser::isResidualStyleTag(const AtomicString& tagName)
{
- if (isResidualStyleTag(_id))
- return true;
+ static HashSet<DOMStringImpl*, PointerHash<DOMStringImpl*> > residualStyleTags;
+ if (residualStyleTags.isEmpty()) {
+ residualStyleTags.insert(HTMLNames::a().localName().implementation());
+ residualStyleTags.insert(HTMLNames::font().localName().implementation());
+ residualStyleTags.insert(HTMLNames::tt().localName().implementation());
+ residualStyleTags.insert(HTMLNames::u().localName().implementation());
+ residualStyleTags.insert(HTMLNames::b().localName().implementation());
+ residualStyleTags.insert(HTMLNames::i().localName().implementation());
+ residualStyleTags.insert(HTMLNames::s().localName().implementation());
+ residualStyleTags.insert(HTMLNames::strike().localName().implementation());
+ residualStyleTags.insert(HTMLNames::big().localName().implementation());
+ residualStyleTags.insert(HTMLNames::small().localName().implementation());
+ residualStyleTags.insert(HTMLNames::em().localName().implementation());
+ residualStyleTags.insert(HTMLNames::strong().localName().implementation());
+ residualStyleTags.insert(HTMLNames::dfn().localName().implementation());
+ residualStyleTags.insert(HTMLNames::code().localName().implementation());
+ residualStyleTags.insert(HTMLNames::samp().localName().implementation());
+ residualStyleTags.insert(HTMLNames::kbd().localName().implementation());
+ residualStyleTags.insert(HTMLNames::var().localName().implementation());
+ }
- switch (_id) {
- case ID_P:
- case ID_DIV:
- case ID_BLOCKQUOTE:
- case ID_ADDRESS:
- case ID_H1:
- case ID_H2:
- case ID_H3:
- case ID_H4:
- case ID_H5:
- case ID_H6:
- case ID_CENTER:
- case ID_UL:
- case ID_OL:
- case ID_LI:
- case ID_DL:
- case ID_DT:
- case ID_DD:
- case ID_PRE:
- return true;
- default:
- return false;
+ return residualStyleTags.contains(tagName.implementation());
+}
+
+bool HTMLParser::isAffectedByResidualStyle(const AtomicString& tagName)
+{
+ if (isResidualStyleTag(tagName))
+ return true;
+
+ static HashSet<DOMStringImpl*, PointerHash<DOMStringImpl*> > affectedBlockTags;
+ if (affectedBlockTags.isEmpty()) {
+ affectedBlockTags.insert(HTMLNames::h1().localName().implementation());
+ affectedBlockTags.insert(HTMLNames::h2().localName().implementation());
+ affectedBlockTags.insert(HTMLNames::h3().localName().implementation());
+ affectedBlockTags.insert(HTMLNames::h4().localName().implementation());
+ affectedBlockTags.insert(HTMLNames::h5().localName().implementation());
+ affectedBlockTags.insert(HTMLNames::h6().localName().implementation());
+ affectedBlockTags.insert(HTMLNames::p().localName().implementation());
+ affectedBlockTags.insert(HTMLNames::div().localName().implementation());
+ affectedBlockTags.insert(HTMLNames::blockquote().localName().implementation());
+ affectedBlockTags.insert(HTMLNames::address().localName().implementation());
+ affectedBlockTags.insert(HTMLNames::center().localName().implementation());
+ affectedBlockTags.insert(HTMLNames::ul().localName().implementation());
+ affectedBlockTags.insert(HTMLNames::ol().localName().implementation());
+ affectedBlockTags.insert(HTMLNames::li().localName().implementation());
+ affectedBlockTags.insert(HTMLNames::dl().localName().implementation());
+ affectedBlockTags.insert(HTMLNames::dt().localName().implementation());
+ affectedBlockTags.insert(HTMLNames::dd().localName().implementation());
+ affectedBlockTags.insert(HTMLNames::pre().localName().implementation());
}
+
+ return affectedBlockTags.contains(tagName.implementation());
}
-void KHTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem)
+void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem)
{
// Find the element that crosses over to a higher level. For now, if there is more than
// one, we will just give up and not attempt any sort of correction. It's highly unlikely that
@@ -1125,7 +992,7 @@
curr = curr->next;
}
- if (!curr || !maxElem || !isAffectedByResidualStyle(maxElem->id)) return;
+ if (!curr || !maxElem || !isAffectedByResidualStyle(maxElem->tagName)) return;
NodeImpl* residualElem = prev->node;
NodeImpl* blockElem = prevMaxElem ? prevMaxElem->node : current;
@@ -1147,7 +1014,7 @@
HTMLStackElem* prevElem = maxElem;
while (currElem != elem) {
HTMLStackElem* nextElem = currElem->next;
- if (!isResidualStyleTag(currElem->id)) {
+ if (!isResidualStyleTag(currElem->tagName)) {
prevElem->next = nextElem;
prevElem->node = currElem->node;
delete currElem;
@@ -1169,7 +1036,7 @@
NodeImpl* currNode = 0;
currElem = maxElem;
while (currElem->node != residualElem) {
- if (isResidualStyleTag(currElem->node->id())) {
+ if (isResidualStyleTag(currElem->node->localName())) {
// Create a clone of this element.
currNode = currElem->node->cloneNode(false);
@@ -1245,7 +1112,7 @@
// We will actually schedule this tag for reopening
// after we complete the close of this entire block.
NodeImpl* currNode = current;
- if (isResidualStyleTag(curr->id)) {
+ if (isResidualStyleTag(curr->tagName)) {
// We've overloaded the use of stack elements and are just reusing the
// struct with a slightly different meaning to the variables. Instead of chaining
// from innermost to outermost, we build up a list of all the tags we need to reopen
@@ -1269,7 +1136,7 @@
// if it becomes necessary to do so.
}
-void KHTMLParser::reopenResidualStyleTags(HTMLStackElem* elem, DOM::NodeImpl* malformedTableParent)
+void HTMLParser::reopenResidualStyleTags(HTMLStackElem* elem, DOM::NodeImpl* malformedTableParent)
{
// Loop for each tag that needs to be reopened.
while (elem) {
@@ -1286,7 +1153,7 @@
// FIXME: Is it really OK to ignore the exceptions here?
// Now push a new stack element for this node we just created.
- pushBlock(elem->id, elem->level);
+ pushBlock(elem->tagName, elem->level);
// Set our strayTableContent boolean if needed, so that the reopened tag also knows
// that it is inside a malformed table.
@@ -1307,35 +1174,21 @@
}
}
-void KHTMLParser::pushBlock(int _id, int _level)
+void HTMLParser::pushBlock(const AtomicString& tagName, int _level)
{
- HTMLStackElem *Elem = new HTMLStackElem(_id, _level, current, blockStack);
-
+ HTMLStackElem *Elem = new HTMLStackElem(tagName, _level, current, blockStack);
blockStack = Elem;
- addForbidden(_id, forbiddenTag);
}
-void KHTMLParser::popBlock( int _id )
+void HTMLParser::popBlock(const AtomicString& _tagName)
{
HTMLStackElem *Elem = blockStack;
int maxLevel = 0;
-#ifdef PARSER_DEBUG
- kdDebug( 6035 ) << "popBlock(" << getTagName(_id).string() << ")" << endl;
- while(Elem) {
- kdDebug( 6035) << " > " << getTagName(Elem->id).string() << endl;
- Elem = Elem->next;
- }
- Elem = blockStack;
-#endif
-
- while( Elem && (Elem->id != _id))
- {
+ while (Elem && (Elem->tagName != _tagName)) {
if (maxLevel < Elem->level)
- {
maxLevel = Elem->level;
- }
Elem = Elem->next;
}
@@ -1345,20 +1198,18 @@
if (maxLevel > Elem->level) {
// We didn't match because the tag is in a different scope, e.g.,
// <b><p>Foo</b>. Try to correct the problem.
- if (!isResidualStyleTag(_id))
+ if (!isResidualStyleTag(_tagName))
return;
return handleResidualStyleCloseTagAcrossBlocks(Elem);
}
- bool isAffectedByStyle = isAffectedByResidualStyle(Elem->id);
+ bool isAffectedByStyle = isAffectedByResidualStyle(Elem->tagName);
HTMLStackElem* residualStyleStack = 0;
NodeImpl* malformedTableParent = 0;
Elem = blockStack;
- while (Elem)
- {
- if (Elem->id == _id)
- {
+ while (Elem) {
+ if (Elem->tagName == _tagName) {
int strayTable = inStrayTableContent;
popOneBlock();
Elem = 0;
@@ -1369,14 +1220,13 @@
// must also know that it is the root of malformed content inside a <tbody>/<tr>.
if (strayTable && (inStrayTableContent < strayTable) && residualStyleStack) {
NodeImpl* curr = current;
- while (curr && curr->id() != ID_TABLE)
+ while (curr && !curr->hasTagName(HTMLNames::table()))
curr = curr->parentNode();
malformedTableParent = curr ? curr->parentNode() : 0;
}
}
- else
- {
- if (Elem->id == ID_FORM && form)
+ else {
+ if (form && Elem->tagName == HTMLNames::form())
// A <form> is being closed prematurely (and this is
// malformed HTML). Set an attribute on the form to clear out its
// bottom margin.
@@ -1385,7 +1235,7 @@
// Schedule this tag for reopening
// after we complete the close of this entire block.
NodeImpl* currNode = current;
- if (isAffectedByStyle && isResidualStyleTag(Elem->id)) {
+ if (isAffectedByStyle && isResidualStyleTag(Elem->tagName)) {
// We've overloaded the use of stack elements and are just reusing the
// struct with a slightly different meaning to the variables. Instead of chaining
// from innermost to outermost, we build up a list of all the tags we need to reopen
@@ -1408,19 +1258,14 @@
reopenResidualStyleTags(residualStyleStack, malformedTableParent);
}
-void KHTMLParser::popOneBlock(bool delBlock)
+void HTMLParser::popOneBlock(bool delBlock)
{
HTMLStackElem *Elem = blockStack;
// we should never get here, but some bad html might cause it.
-#ifndef PARSER_DEBUG
- if(!Elem) return;
-#else
- kdDebug( 6035 ) << "popping block: " << getTagName(Elem->id).string() << "(" << Elem->id << ")" << endl;
-#endif
-
-#if SPEED_DEBUG < 1
- if((Elem->node != current)) {
+ if (!Elem) return;
+
+ if ((Elem->node != current)) {
if (current->maintainsState() && doc()){
doc()->registerMaintainsState(current);
QStringList &states = doc()->restoreState();
@@ -1431,9 +1276,6 @@
// A few elements (<applet>, <object>) need to know when all child elements (<param>s) are available:
current->closeRenderer();
}
-#endif
-
- removeForbidden(Elem->id, forbiddenTag);
blockStack = Elem->next;
setCurrent(Elem->node);
@@ -1445,19 +1287,19 @@
delete Elem;
}
-void KHTMLParser::popInlineBlocks()
+void HTMLParser::popInlineBlocks()
{
- while (blockStack && current->isInline())
+ while (blockStack && isInline(current))
popOneBlock();
}
-void KHTMLParser::freeBlock()
+void HTMLParser::freeBlock()
{
while (blockStack)
popOneBlock();
}
-void KHTMLParser::createHead()
+void HTMLParser::createHead()
{
if(head || !doc()->firstChild())
return;
@@ -1474,7 +1316,7 @@
}
}
-NodeImpl *KHTMLParser::handleIsindex( Token *t )
+NodeImpl *HTMLParser::handleIsindex( Token *t )
{
NodeImpl *n;
HTMLFormElementImpl *myform = form;
@@ -1504,7 +1346,7 @@
return n;
}
-void KHTMLParser::startBody()
+void HTMLParser::startBody()
{
if(inBody) return;
@@ -1516,7 +1358,7 @@
}
}
-void KHTMLParser::finished()
+void HTMLParser::finished()
{
// In the case of a completely empty document, here's the place to create the HTML element.
if (current->isDocumentNode() && current->firstChild() == 0) {
1.28 +44 -40 WebCore/khtml/html/htmlparser.h
Index: htmlparser.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/htmlparser.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- htmlparser.h 6 Jan 2005 21:13:16 -0000 1.27
+++ htmlparser.h 9 Jul 2005 20:19:11 -0000 1.28
@@ -29,19 +29,9 @@
#ifndef HTMLPARSER_H
#define HTMLPARSER_H
-// 0 all
-// 1 domtree + rendertree + styleForElement, no layouting
-// 2 domtree only
-#define SPEED_DEBUG 0
-
-#ifdef SPEED_DEBUG
-#include <qdatetime.h>
-#endif
-
#include "dom/dom_string.h"
#include "xml/dom_nodeimpl.h"
#include "html/html_documentimpl.h"
-#include "misc/htmltags.h"
class KHTMLView;
class HTMLStackElem;
@@ -61,18 +51,16 @@
class Token;
};
-class KHTMLParser;
-
/**
* The parser for html. It receives a stream of tokens from the HTMLTokenizer, and
* builds up the Document structure form it.
*/
-class KHTMLParser
+class HTMLParser
{
public:
- KHTMLParser(KHTMLView *w, DOM::DocumentPtr *i, bool includesComments=false);
- KHTMLParser(DOM::DocumentFragmentImpl *frag, DOM::DocumentPtr *doc, bool includesComments=false);
- virtual ~KHTMLParser();
+ HTMLParser(KHTMLView *w, DOM::DocumentPtr *i, bool includesComments=false);
+ HTMLParser(DOM::DocumentFragmentImpl *frag, DOM::DocumentPtr *doc, bool includesComments=false);
+ virtual ~HTMLParser();
/**
* parses one token delivered by the tokenizer
@@ -89,7 +77,7 @@
*/
void reset();
- bool skipMode() const { return (discard_until != 0); }
+ bool skipMode() const { return !discard_until.isNull(); }
bool noSpaces() const { return !inBody; }
bool selectMode() const { return inSelect; }
@@ -97,48 +85,70 @@
DOM::DocumentPtr *docPtr() const { return document; }
protected:
- void setCurrent(DOM::NodeImpl *newCurrent);
+ void setCurrent(DOM::NodeImpl* newCurrent);
+ void setSkipMode(const DOM::QualifiedName& qName) { discard_until = qName.localName(); }
KHTMLView *HTMLWidget;
DOM::DocumentPtr *document;
/*
- * generate an element from the token
+ * generate a node from the token
*/
- DOM::NodeImpl *getElement(khtml::Token *);
+ DOM::NodeImpl *getNode(khtml::Token *);
+ bool textCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool commentCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool headCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool bodyCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool framesetCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool iframeCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool formCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool isindexCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool selectCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool ddCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool dtCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool nestedCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool nestedStyleCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool tableCellCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool tableSectionCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool noembedCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool noscriptCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool noframesCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
+ bool nolayerCreateErrorCheck(khtml::Token*, DOM::NodeImpl*&);
void processCloseTag(khtml::Token *);
bool insertNode(DOM::NodeImpl *n, bool flat = false);
+ bool handleError(DOM::NodeImpl* n, bool flat, const DOM::AtomicString& localName, int tagPriority);
+
+ // The currently active element (the one new elements will be added to). Can be a DocumentFragment, a Document or an Element.
+ DOM::NodeImpl* current;
- /*
- * The currently active element (the one new elements will be added to)
- */
- DOM::NodeImpl *current;
bool currentIsReferenced;
HTMLStackElem *blockStack;
- void pushBlock( int _id, int _level);
-
- void popBlock( int _id );
+ void pushBlock(const DOM::AtomicString& tagName, int _level);
+ void popBlock(const DOM::AtomicString& tagName);
+ void popBlock(const DOM::QualifiedName& qName) { return popBlock(qName.localName()); } // Convenience function for readability.
void popOneBlock(bool delBlock = true);
void popInlineBlocks();
- void freeBlock( void);
+ void freeBlock();
void createHead();
- bool isResidualStyleTag(int _id);
- bool isAffectedByResidualStyle(int _id);
+ bool isResidualStyleTag(const DOM::AtomicString& tagName);
+ bool isAffectedByResidualStyle(const DOM::AtomicString& tagName);
void handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem);
void reopenResidualStyleTags(HTMLStackElem* elem, DOM::NodeImpl* malformedTableParent);
- bool allowNestedRedundantTag(int _id);
+ bool allowNestedRedundantTag(const DOM::AtomicString& tagName);
- static bool isHeaderTag(int _id);
+ static bool isHeaderTag(const DOM::AtomicString& tagName);
void popNestedHeaderTag();
+ bool isInline(DOM::NodeImpl* node) const;
+
/*
* currently active form
*/
@@ -175,18 +185,12 @@
/*
* tells the parser to discard all tags, until it reaches the one specified
*/
- int discard_until;
+ DOM::AtomicString discard_until;
bool headLoaded;
int inStrayTableContent;
bool includesCommentsInDOM;
-
- ushort forbiddenTag[ID_LAST_TAG + 1];
-
-#if SPEED_DEBUG > 0
- QTime qt;
-#endif
};
-
+
#endif // HTMLPARSER_H
1.96 +48 -87 WebCore/khtml/html/htmltokenizer.cpp
Index: htmltokenizer.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/htmltokenizer.cpp,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -r1.95 -r1.96
--- htmltokenizer.cpp 5 Jul 2005 23:21:10 -0000 1.95
+++ htmltokenizer.cpp 9 Jul 2005 20:19:11 -0000 1.96
@@ -39,7 +39,6 @@
#include "html/htmltokenizer.h"
#include "html/html_documentimpl.h"
#include "html/htmlparser.h"
-#include "html/dtd.h"
#include "misc/loader.h"
#include "misc/htmlhashes.h"
@@ -63,7 +62,10 @@
using DOM::DOMStringImpl;
using DOM::DocumentImpl;
using DOM::emptyAtom;
-using DOM::endTagRequirement;
+using DOM::commentAtom;
+using DOM::nullAtom;
+using DOM::textAtom;
+using DOM::HTMLNames;
// turn off inlining to void warning with newer gcc
#undef __inline
@@ -239,7 +241,7 @@
scriptCode = 0;
scriptCodeSize = scriptCodeMaxSize = scriptCodeResync = 0;
charsets = KGlobal::charsets();
- parser = new KHTMLParser(_view, _doc, includesComments);
+ parser = new HTMLParser(_view, _doc, includesComments);
m_executingScript = 0;
loadingExtScript = false;
onHold = false;
@@ -259,7 +261,7 @@
scriptCode = 0;
scriptCodeSize = scriptCodeMaxSize = scriptCodeResync = 0;
charsets = KGlobal::charsets();
- parser = new KHTMLParser(i, _doc, includesComments);
+ parser = new HTMLParser(i, _doc, includesComments);
m_executingScript = 0;
loadingExtScript = false;
onHold = false;
@@ -451,10 +453,10 @@
else {
processListing(TokenizerString(scriptCode, scriptCodeSize));
processToken();
- if ( style ) { currToken.id = ID_STYLE + ID_CLOSE_TAG; }
- else if ( textarea ) { currToken.id = ID_TEXTAREA + ID_CLOSE_TAG; }
- else if ( title ) { currToken.id = ID_TITLE + ID_CLOSE_TAG; }
- else if ( xmp ) { currToken.id = ID_XMP + ID_CLOSE_TAG; }
+ if ( style ) { currToken.tagName = HTMLNames::style().localName(); currToken.beginTag = false; }
+ else if ( textarea ) { currToken.tagName = HTMLNames::textarea().localName(); currToken.beginTag = false; }
+ else if ( title ) { currToken.tagName = HTMLNames::title().localName(); currToken.beginTag = false; }
+ else if ( xmp ) { currToken.tagName = HTMLNames::xmp().localName(); currToken.beginTag = false; }
processToken();
style = script = style = textarea = title = xmp = false;
tquote = NoQuote;
@@ -524,7 +526,8 @@
processListing(TokenizerString(scriptCode, scriptCodeSize));
QString exScript( buffer, dest-buffer );
processToken();
- currToken.id = ID_SCRIPT + ID_CLOSE_TAG;
+ currToken.tagName = HTMLNames::script().localName();
+ currToken.beginTag = false;
processToken();
TokenizerString *savedPrependingSrc = currentPrependingSrc;
@@ -701,10 +704,12 @@
checkScriptBuffer();
scriptCode[ scriptCodeSize ] = 0;
scriptCode[ scriptCodeSize + 1 ] = 0;
- currToken.id = ID_COMMENT;
+ currToken.tagName = commentAtom;
+ currToken.beginTag = true;
processListing(TokenizerString(scriptCode, scriptCodeSize - endCharsCount));
processToken();
- currToken.id = ID_COMMENT + ID_CLOSE_TAG;
+ currToken.tagName = commentAtom;
+ currToken.beginTag = false;
processToken();
}
scriptCodeSize = 0;
@@ -1022,10 +1027,12 @@
finish = true;
break;
}
- // Use tolower() instead of | 0x20 to lowercase the char because there is no
- // performance gain in using | 0x20 since tolower() is optimized and
- // | 0x20 turns characters such as '_' into junk.
- cBuffer[cBufferPos++] = tolower(curchar);
+
+ // tolower() shows up on profiles. This is faster!
+ if (curchar >= 'A' && curchar <= 'Z')
+ cBuffer[cBufferPos++] = curchar + ('a' - 'A');
+ else
+ cBuffer[cBufferPos++] = curchar;
++src;
}
@@ -1047,27 +1054,13 @@
// Start Tag
beginTag = true;
- // Accept empty xml tags like <br/>. We trim off the "/" so that when we call
- // getTagID, we'll look up "br" as the tag name and not "br/".
+ // 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/".
if(len > 1 && ptr[len-1] == '/' )
ptr[--len] = '\0';
- // Look up the tagID for the specified tag name (now that we've shaved off any
- // invalid / that might have followed the name).
- unsigned short tagID = getTagID(ptr, len);
- if (!tagID) {
- DOMString tagName(ptr);
- DocumentImpl *doc = parser->docPtr()->document();
- if (doc->isValidName(tagName))
- tagID = parser->docPtr()->document()->tagId(0, tagName.implementation(), false);
- }
- if (tagID) {
-#ifdef TOKEN_DEBUG
- QCString tmp(ptr, len+1);
- kdDebug( 6036 ) << "found tag id=" << tagID << ": " << tmp.data() << endl;
-#endif
- currToken.id = beginTag ? tagID : tagID + ID_CLOSE_TAG;
- }
+ // Now that we've shaved off any invalid / that might have followed the name), make the tag.
+ currToken.tagName = AtomicString(ptr);
+ currToken.beginTag = beginTag;
dest = buffer;
tag = SearchAttribute;
cBufferPos = 0;
@@ -1118,15 +1111,6 @@
else {
attrName = QString::fromLatin1(QCString(cBuffer, cBufferPos+1).data());
attrNamePresent = !attrName.isEmpty();
-
- // This is a deliberate quirk to match Mozilla and Opera. We have to do this
- // since sites that use the "standards-compliant" path sometimes send
- // <script src="foo.js"/>. Both Moz and Opera will honor this, despite it
- // being bogus HTML. They do not honor the "/" for other tags. This behavior
- // also deviates from WinIE, but in this case we'll just copy Moz and Opera.
- if (currToken.id == ID_SCRIPT && curchar == '>' &&
- attrName == "/")
- currToken.flat = true;
}
dest = buffer;
@@ -1142,10 +1126,12 @@
break;
}
}
- // Use tolower() instead of | 0x20 to lowercase the char because there is no
- // performance gain in using | 0x20 since tolower() is optimized and
- // | 0x20 turns characters such as '_' into junk.
- cBuffer[cBufferPos++] = tolower(curchar);
+
+ // tolower() shows up on profiles. This is faster!
+ if (curchar >= 'A' && curchar <= 'Z')
+ cBuffer[cBufferPos++] = curchar + ('a' - 'A');
+ else
+ cBuffer[cBufferPos++] = curchar;
++src;
}
if ( cBufferPos == CBUFLEN ) {
@@ -1328,18 +1314,15 @@
if (*src != '<')
++src;
- if ( !currToken.id ) //stop if tag is unknown
+ if (currToken.tagName == nullAtom) //stop if tag is unknown
return;
- uint tagID = currToken.id;
+ AtomicString tagName = currToken.tagName;
#if defined(TOKEN_DEBUG) && TOKEN_DEBUG > 0
kdDebug( 6036 ) << "appending Tag: " << tagID << endl;
#endif
- bool beginTag = !currToken.flat && (tagID <= ID_CLOSE_TAG);
-
- if (tagID > ID_CLOSE_TAG)
- tagID -= ID_CLOSE_TAG;
- else if (tagID == ID_SCRIPT) {
+ bool beginTag = !currToken.flat && currToken.beginTag;
+ if (beginTag && currToken.tagName == HTMLNames::script()) {
AttributeImpl* a = 0;
bool foundTypeAttribute = false;
scriptSrc = QString::null;
@@ -1414,71 +1397,49 @@
processToken();
- // we have to take care to close the pre block in
- // case we encounter an unallowed element....
- if(pre && beginTag && !DOM::checkChild(ID_PRE, tagID, !parser->doc()->inCompatMode())) {
- kdDebug(6036) << " not allowed in <pre> " << (int)tagID << endl;
- pre = false;
- }
-
- switch( tagID ) {
- case ID_PRE:
+ if (tagName == HTMLNames::pre()) {
prePos = 0;
pre = beginTag;
discard = LFDiscard; // Discard the first LF after we open a pre.
- break;
- case ID_SCRIPT:
+ } else if (tagName == HTMLNames::script()) {
if (beginTag) {
searchStopper = scriptEnd;
searchStopperLen = 8;
script = true;
parseSpecial(src);
}
- else if (tagID <= ID_CLOSE_TAG) { // Handle <script src="foo"/>
- script = true;
- scriptHandler();
- }
- break;
- case ID_STYLE:
+ } else if (tagName == HTMLNames::style()) {
if (beginTag) {
searchStopper = styleEnd;
searchStopperLen = 7;
style = true;
parseSpecial(src);
}
- break;
- case ID_TEXTAREA:
+ } else if (tagName == HTMLNames::textarea()) {
if(beginTag) {
searchStopper = textareaEnd;
searchStopperLen = 10;
textarea = true;
parseSpecial(src);
}
- break;
- case ID_TITLE:
- if (beginTag) {
+ } else if (tagName == HTMLNames::title()) {
+ if (beginTag) {
searchStopper = titleEnd;
searchStopperLen = 7;
title = true;
parseSpecial(src);
}
- break;
- case ID_XMP:
+ } else if (tagName == HTMLNames::xmp()) {
if (beginTag) {
searchStopper = xmpEnd;
searchStopperLen = 5;
xmp = true;
parseSpecial(src);
}
- break;
- case ID_SELECT:
+ } else if (tagName == HTMLNames::select())
select = beginTag;
- break;
- case ID_PLAINTEXT:
+ else if (tagName == HTMLNames::plaintext())
plaintext = beginTag;
- break;
- }
-
return; // Finished parsing tag!
}
} // end switch
@@ -1989,10 +1950,10 @@
#endif
currToken.text = new DOMStringImpl( buffer, dest - buffer );
currToken.text->ref();
- if (currToken.id != ID_COMMENT)
- currToken.id = ID_TEXT;
+ if (currToken.tagName != commentAtom)
+ currToken.tagName = textAtom;
}
- else if(!currToken.id) {
+ else if (currToken.tagName == nullAtom) {
currToken.reset();
if (jsProxy)
jsProxy->setEventHandlerLineno(lineno+src.lineCount());
1.37 +24 -14 WebCore/khtml/html/htmltokenizer.h
Index: htmltokenizer.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/htmltokenizer.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- htmltokenizer.h 5 Jul 2005 23:21:10 -0000 1.36
+++ htmltokenizer.h 9 Jul 2005 20:19:11 -0000 1.37
@@ -34,8 +34,6 @@
#include <qptrqueue.h>
#include "misc/loader_client.h"
-#include "misc/htmltags.h"
-#include "xml/dom_stringimpl.h"
#include "xml/xml_tokenizer.h"
#include "html/html_elementimpl.h"
#include "xml/dom_docimpl.h"
@@ -47,7 +45,7 @@
#endif
class KCharsets;
-class KHTMLParser;
+class HTMLParser;
class KHTMLView;
namespace DOM {
@@ -70,22 +68,24 @@
{
public:
Token() {
- id = 0;
attrs = 0;
text = 0;
+ beginTag = true;
flat = false;
//qDebug("new token, creating %08lx", attrs);
}
+
~Token() {
- if(attrs) attrs->deref();
- if(text) text->deref();
+ if (attrs) attrs->deref();
+ if (text) text->deref();
}
+
void addAttribute(DOM::DocumentImpl* doc, QChar* buffer, const QString& attrName, const DOM::AtomicString& v)
{
DOM::AttributeImpl* a = 0;
- if(buffer->unicode())
+ if (buffer->unicode())
a = new DOM::MappedAttributeImpl(buffer->unicode(), v);
- else if ( !attrName.isEmpty() && attrName != "/" )
+ else if (!attrName.isEmpty() && attrName != "/")
a = new DOM::MappedAttributeImpl(doc->attrId(0, DOM::DOMString(attrName).implementation(), false),
v);
@@ -97,23 +97,33 @@
attrs->insertAttribute(a);
}
}
+
+ bool isOpenTag(const DOM::QualifiedName& fullName) const { return beginTag && fullName.localName() == tagName; }
+ bool isCloseTag(const DOM::QualifiedName& fullName) const { return !beginTag && fullName.localName() == tagName; }
+
void reset()
{
- if(attrs) {
+ if (attrs) {
attrs->deref();
attrs = 0;
}
- id = 0;
- if(text) {
+
+ tagName = DOM::nullAtom;
+
+ if (text) {
text->deref();
text = 0;
}
+
+ beginTag = true;
flat = false;
}
+
DOM::NamedMappedAttrMapImpl* attrs;
DOM::DOMStringImpl* text;
- ushort id;
- bool flat;
+ DOM::AtomicString tagName;
+ bool beginTag : 1;
+ bool flat : 1;
};
// The count of spaces used for each tab.
@@ -368,7 +378,7 @@
TokenizerString src;
KCharsets *charsets;
- KHTMLParser *parser;
+ HTMLParser *parser;
QGuardedPtr<KHTMLView> view;
1.1 WebCore/khtml/html/htmlfactory.cpp
Index: htmlfactory.cpp
===================================================================
/*
* This file is part of the HTML DOM implementation for KDE.
*
* Copyright (C) 2005 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#include "htmlfactory.h"
#include "dom_docimpl.h"
#include "html/html_baseimpl.h"
#include "html/html_blockimpl.h"
#include "html/html_canvasimpl.h"
#include "html/html_documentimpl.h"
#include "html/html_formimpl.h"
#include "html/html_headimpl.h"
#include "html/html_imageimpl.h"
#include "html/html_listimpl.h"
#include "html/html_miscimpl.h"
#include "html/html_tableimpl.h"
#include "html/html_objectimpl.h"
#include "misc/pointerhash.h"
using khtml::PointerHash;
using khtml::HashMap;
namespace DOM
{
typedef HTMLElementImpl* (*ConstructorFunc)(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser);
typedef HashMap<DOMStringImpl *, void*, PointerHash<DOMStringImpl *> > FunctionMap;
static FunctionMap* gFunctionMap;
HTMLElementImpl* htmlConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLHtmlElementImpl(docPtr);
}
HTMLElementImpl* headConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLHeadElementImpl(docPtr);
}
HTMLElementImpl* bodyConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLBodyElementImpl(docPtr);
}
HTMLElementImpl* baseConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLBaseElementImpl(docPtr);
}
HTMLElementImpl* linkConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLLinkElementImpl(docPtr);
}
HTMLElementImpl* metaConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLMetaElementImpl(docPtr);
}
HTMLElementImpl* styleConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLStyleElementImpl(docPtr);
}
HTMLElementImpl* titleConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLTitleElementImpl(docPtr);
}
HTMLElementImpl* frameConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLFrameElementImpl(docPtr);
}
HTMLElementImpl* framesetConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLFrameSetElementImpl(docPtr);
}
HTMLElementImpl* iframeConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLIFrameElementImpl(docPtr);
}
HTMLElementImpl* formConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLFormElementImpl(docPtr);
}
HTMLElementImpl* buttonConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLButtonElementImpl(docPtr, form);
}
HTMLElementImpl* inputConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLInputElementImpl(docPtr, form);
}
HTMLElementImpl* isindexConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLIsIndexElementImpl(docPtr, form);
}
HTMLElementImpl* fieldsetConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLFieldSetElementImpl(docPtr, form);
}
HTMLElementImpl* labelConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLLabelElementImpl(docPtr);
}
HTMLElementImpl* legendConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLLegendElementImpl(docPtr, form);
}
HTMLElementImpl* optgroupConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLOptGroupElementImpl(docPtr, form);
}
HTMLElementImpl* optionConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLOptionElementImpl(docPtr, form);
}
HTMLElementImpl* selectConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLSelectElementImpl(docPtr, form);
}
HTMLElementImpl* textareaConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLTextAreaElementImpl(docPtr, form);
}
HTMLElementImpl* dlConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLDListElementImpl(docPtr);
}
HTMLElementImpl* ulConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLUListElementImpl(docPtr);
}
HTMLElementImpl* olConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLOListElementImpl(docPtr);
}
HTMLElementImpl* dirConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLDirectoryElementImpl(docPtr);
}
HTMLElementImpl* menuConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLMenuElementImpl(docPtr);
}
HTMLElementImpl* liConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLLIElementImpl(docPtr);
}
HTMLElementImpl* blockquoteConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLBlockquoteElementImpl(docPtr);
}
HTMLElementImpl* divConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLDivElementImpl(docPtr);
}
HTMLElementImpl* headingConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLHeadingElementImpl(QualifiedName(nullAtom, tagName, HTMLNames::xhtmlNamespaceURI()), docPtr);
}
HTMLElementImpl* hrConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLHRElementImpl(docPtr);
}
HTMLElementImpl* paragraphConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLParagraphElementImpl(docPtr);
}
HTMLElementImpl* preConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLPreElementImpl(QualifiedName(nullAtom, tagName, HTMLNames::xhtmlNamespaceURI()), docPtr);
}
HTMLElementImpl* basefontConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLBaseFontElementImpl(docPtr);
}
HTMLElementImpl* fontConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLFontElementImpl(docPtr);
}
HTMLElementImpl* modConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLModElementImpl(QualifiedName(nullAtom, tagName, HTMLNames::xhtmlNamespaceURI()), docPtr);
}
HTMLElementImpl* anchorConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLAnchorElementImpl(docPtr);
}
HTMLElementImpl* imageConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLImageElementImpl(docPtr, form);
}
HTMLElementImpl* mapConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLMapElementImpl(docPtr);
}
HTMLElementImpl* areaConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLAreaElementImpl(docPtr);
}
HTMLElementImpl* canvasConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLCanvasElementImpl(docPtr);
}
HTMLElementImpl* appletConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLAppletElementImpl(docPtr);
}
HTMLElementImpl* embedConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLEmbedElementImpl(docPtr);
}
HTMLElementImpl* objectConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLObjectElementImpl(docPtr);
}
HTMLElementImpl* paramConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLParamElementImpl(docPtr);
}
HTMLElementImpl* scriptConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
HTMLScriptElementImpl* script = new HTMLScriptElementImpl(docPtr);
script->setCreatedByParser(createdByParser);
return script;
}
HTMLElementImpl* tableConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLTableElementImpl(docPtr);
}
HTMLElementImpl* tableCaptionConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLTableCaptionElementImpl(docPtr);
}
HTMLElementImpl* tableColConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLTableColElementImpl(QualifiedName(nullAtom, tagName, HTMLNames::xhtmlNamespaceURI()), docPtr);
}
HTMLElementImpl* tableRowConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLTableRowElementImpl(docPtr);
}
HTMLElementImpl* tableCellConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLTableCellElementImpl(QualifiedName(nullAtom, tagName, HTMLNames::xhtmlNamespaceURI()), docPtr);
}
HTMLElementImpl* tableSectionConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLTableSectionElementImpl(QualifiedName(nullAtom, tagName, HTMLNames::xhtmlNamespaceURI()), docPtr, false);
}
HTMLElementImpl* brConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLBRElementImpl(docPtr);
}
HTMLElementImpl* quoteConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLQuoteElementImpl(docPtr);
}
HTMLElementImpl* marqueeConstructor(const AtomicString& tagName, DocumentPtr* docPtr, HTMLFormElementImpl* form, bool createdByParser)
{
return new HTMLMarqueeElementImpl(docPtr);
}
HTMLElementImpl* HTMLElementFactory::createHTMLElement(const AtomicString& tagName, DocumentImpl* doc, HTMLFormElementImpl* form, bool createdByParser)
{
if (!doc)
return 0; // Don't allow elements to ever be made without having a doc.
DocumentPtr* docPtr = doc->docPtr();
if (!gFunctionMap) {
// Create the table.
gFunctionMap = new FunctionMap;
// Populate it with constructor functions.
gFunctionMap->insert(HTMLNames::html().localName().implementation(), (void*)&htmlConstructor);
gFunctionMap->insert(HTMLNames::head().localName().implementation(), (void*)&headConstructor);
gFunctionMap->insert(HTMLNames::body().localName().implementation(), (void*)&bodyConstructor);
gFunctionMap->insert(HTMLNames::base().localName().implementation(), (void*)&baseConstructor);
gFunctionMap->insert(HTMLNames::link().localName().implementation(), (void*)&linkConstructor);
gFunctionMap->insert(HTMLNames::meta().localName().implementation(), (void*)&metaConstructor);
gFunctionMap->insert(HTMLNames::style().localName().implementation(), (void*)&styleConstructor);
gFunctionMap->insert(HTMLNames::title().localName().implementation(), (void*)&titleConstructor);
gFunctionMap->insert(HTMLNames::frame().localName().implementation(), (void*)&frameConstructor);
gFunctionMap->insert(HTMLNames::frameset().localName().implementation(), (void*)&framesetConstructor);
gFunctionMap->insert(HTMLNames::iframe().localName().implementation(), (void*)&iframeConstructor);
gFunctionMap->insert(HTMLNames::form().localName().implementation(), (void*)&formConstructor);
gFunctionMap->insert(HTMLNames::button().localName().implementation(), (void*)&buttonConstructor);
gFunctionMap->insert(HTMLNames::input().localName().implementation(), (void*)&inputConstructor);
gFunctionMap->insert(HTMLNames::isindex().localName().implementation(), (void*)&isindexConstructor);
gFunctionMap->insert(HTMLNames::fieldset().localName().implementation(), (void*)&fieldsetConstructor);
gFunctionMap->insert(HTMLNames::label().localName().implementation(), (void*)&labelConstructor);
gFunctionMap->insert(HTMLNames::legend().localName().implementation(), (void*)&legendConstructor);
gFunctionMap->insert(HTMLNames::optgroup().localName().implementation(), (void*)&optgroupConstructor);
gFunctionMap->insert(HTMLNames::option().localName().implementation(), (void*)&optionConstructor);
gFunctionMap->insert(HTMLNames::select().localName().implementation(), (void*)&selectConstructor);
gFunctionMap->insert(HTMLNames::textarea().localName().implementation(), (void*)&textareaConstructor);
gFunctionMap->insert(HTMLNames::dl().localName().implementation(), (void*)&dlConstructor);
gFunctionMap->insert(HTMLNames::ol().localName().implementation(), (void*)&olConstructor);
gFunctionMap->insert(HTMLNames::ul().localName().implementation(), (void*)&ulConstructor);
gFunctionMap->insert(HTMLNames::dir().localName().implementation(), (void*)&dirConstructor);
gFunctionMap->insert(HTMLNames::menu().localName().implementation(), (void*)&menuConstructor);
gFunctionMap->insert(HTMLNames::li().localName().implementation(), (void*)&liConstructor);
gFunctionMap->insert(HTMLNames::blockquote().localName().implementation(), (void*)&blockquoteConstructor);
gFunctionMap->insert(HTMLNames::div().localName().implementation(), (void*)&divConstructor);
gFunctionMap->insert(HTMLNames::h1().localName().implementation(), (void*)&headingConstructor);
gFunctionMap->insert(HTMLNames::h2().localName().implementation(), (void*)&headingConstructor);
gFunctionMap->insert(HTMLNames::h3().localName().implementation(), (void*)&headingConstructor);
gFunctionMap->insert(HTMLNames::h4().localName().implementation(), (void*)&headingConstructor);
gFunctionMap->insert(HTMLNames::h5().localName().implementation(), (void*)&headingConstructor);
gFunctionMap->insert(HTMLNames::h6().localName().implementation(), (void*)&headingConstructor);
gFunctionMap->insert(HTMLNames::hr().localName().implementation(), (void*)&hrConstructor);
gFunctionMap->insert(HTMLNames::p().localName().implementation(), (void*)¶graphConstructor);
gFunctionMap->insert(HTMLNames::pre().localName().implementation(), (void*)&preConstructor);
gFunctionMap->insert(HTMLNames::xmp().localName().implementation(), (void*)&preConstructor);
gFunctionMap->insert(HTMLNames::basefont().localName().implementation(), (void*)&basefontConstructor);
gFunctionMap->insert(HTMLNames::font().localName().implementation(), (void*)&fontConstructor);
gFunctionMap->insert(HTMLNames::del().localName().implementation(), (void*)&modConstructor);
gFunctionMap->insert(HTMLNames::ins().localName().implementation(), (void*)&modConstructor);
gFunctionMap->insert(HTMLNames::a().localName().implementation(), (void*)&anchorConstructor);
gFunctionMap->insert(HTMLNames::img().localName().implementation(), (void*)&imageConstructor);
gFunctionMap->insert(HTMLNames::map().localName().implementation(), (void*)&mapConstructor);
gFunctionMap->insert(HTMLNames::area().localName().implementation(), (void*)&areaConstructor);
gFunctionMap->insert(HTMLNames::canvas().localName().implementation(), (void*)&canvasConstructor);
gFunctionMap->insert(HTMLNames::applet().localName().implementation(), (void*)&appletConstructor);
gFunctionMap->insert(HTMLNames::embed().localName().implementation(), (void*)&embedConstructor);
gFunctionMap->insert(HTMLNames::object().localName().implementation(), (void*)&objectConstructor);
gFunctionMap->insert(HTMLNames::param().localName().implementation(), (void*)¶mConstructor);
gFunctionMap->insert(HTMLNames::script().localName().implementation(), (void*)&scriptConstructor);
gFunctionMap->insert(HTMLNames::table().localName().implementation(), (void*)&tableConstructor);
gFunctionMap->insert(HTMLNames::caption().localName().implementation(), (void*)&tableCaptionConstructor);
gFunctionMap->insert(HTMLNames::colgroup().localName().implementation(), (void*)&tableColConstructor);
gFunctionMap->insert(HTMLNames::col().localName().implementation(), (void*)&tableColConstructor);
gFunctionMap->insert(HTMLNames::tr().localName().implementation(), (void*)&tableRowConstructor);
gFunctionMap->insert(HTMLNames::td().localName().implementation(), (void*)&tableCellConstructor);
gFunctionMap->insert(HTMLNames::th().localName().implementation(), (void*)&tableCellConstructor);
gFunctionMap->insert(HTMLNames::thead().localName().implementation(), (void*)&tableSectionConstructor);
gFunctionMap->insert(HTMLNames::tbody().localName().implementation(), (void*)&tableSectionConstructor);
gFunctionMap->insert(HTMLNames::tfoot().localName().implementation(), (void*)&tableSectionConstructor);
gFunctionMap->insert(HTMLNames::br().localName().implementation(), (void*)&brConstructor);
gFunctionMap->insert(HTMLNames::q().localName().implementation(), (void*)"eConstructor);
gFunctionMap->insert(HTMLNames::marquee().localName().implementation(), (void*)&marqueeConstructor);
}
void* result = gFunctionMap->get(tagName.implementation());
if (result) {
ConstructorFunc func = (ConstructorFunc)result;
return (func)(tagName, docPtr, form, createdByParser);
}
// elements with no special representation in the DOM
return new HTMLElementImpl(QualifiedName(nullAtom, tagName, HTMLNames::xhtmlNamespaceURI()), docPtr);
}
}
1.1 WebCore/khtml/html/htmlfactory.h
Index: htmlfactory.h
===================================================================
/*
* This file is part of the HTML DOM implementation for KDE.
*
* Copyright (C) 2005 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef HTMLELEMENTFACTORY_H
#define HTMLELEMENTFACTORY_H
namespace DOM
{
class ElementImpl;
class DocumentImpl;
class HTMLElementImpl;
class HTMLFormElementImpl;
class QualifiedName;
class AtomicString;
// The idea behind this class is that there will eventually be a mapping from namespace URIs to ElementFactories that can dispense
// elements. In a compound document world, the generic createElement function (will end up being virtual) will be called.
class HTMLElementFactory
{
public:
ElementImpl* createElement(const QualifiedName& qName, DocumentImpl* doc, bool createdByParser = true);
static HTMLElementImpl* createHTMLElement(const AtomicString& tagName, DocumentImpl* doc, HTMLFormElementImpl* form = 0, bool createdByParser = true);
};
}
#endif
1.36 +13 -28 WebCore/khtml/misc/decoder.cpp
Index: decoder.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/misc/decoder.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- decoder.cpp 28 Jun 2005 18:47:12 -0000 1.35
+++ decoder.cpp 9 Jul 2005 20:19:15 -0000 1.36
@@ -41,6 +41,12 @@
#include <kdebug.h>
#include <klocale.h>
+#include "htmlnames.h"
+
+using DOM::AtomicString;
+using DOM::HTMLNames;
+using DOM::nullAtom;
+
class KanjiCode
{
public:
@@ -526,12 +532,8 @@
len++;
}
tmp[len] = 0;
- int id = khtml::getTagID(tmp, len);
- if(end) id += ID_CLOSE_TAG;
-
- switch( id ) {
- case ID_META:
- {
+ AtomicString tag(tmp);
+ if (!end && tag == HTMLNames::meta()) {
// found a meta tag...
//ptr += 5;
const char * end = ptr;
@@ -570,28 +572,11 @@
pos = endpos + 1;
}
- }
- case (ID_META+ID_CLOSE_TAG):
- case ID_SCRIPT:
- case (ID_SCRIPT+ID_CLOSE_TAG):
- case ID_NOSCRIPT:
- case (ID_NOSCRIPT+ID_CLOSE_TAG):
- case ID_STYLE:
- case (ID_STYLE+ID_CLOSE_TAG):
- case ID_LINK:
- case (ID_LINK+ID_CLOSE_TAG):
- case ID_OBJECT:
- case (ID_OBJECT+ID_CLOSE_TAG):
- case ID_TITLE:
- case (ID_TITLE+ID_CLOSE_TAG):
- case ID_BASE:
- case (ID_BASE+ID_CLOSE_TAG):
- case ID_HTML:
- case ID_HEAD:
- case 0:
- case (0 + ID_CLOSE_TAG ):
- break;
- default:
+ } else if (tag != HTMLNames::script() && tag != HTMLNames::noscript() && tag != HTMLNames::style() &&
+ tag != HTMLNames::link() && tag != HTMLNames::meta() && tag != HTMLNames::object() &&
+ tag != HTMLNames::title() && tag != HTMLNames::base() &&
+ (end || tag != HTMLNames::html()) &&
+ (end || tag != HTMLNames::head()) && isalpha(tmp[0])) {
body = true;
#ifdef DECODE_DEBUG
kdDebug( 6005 ) << "Decoder: no charset found. Id=" << id << endl;
1.2 +8 -8 WebCore/khtml/misc/hashmap.h
Index: hashmap.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/misc/hashmap.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- hashmap.h 6 Jul 2005 01:28:42 -0000 1.1
+++ hashmap.h 9 Jul 2005 20:19:16 -0000 1.2
@@ -75,9 +75,9 @@
};
template<typename Key, typename Mapped, typename HashFunctions, typename KeyTraits, typename MappedTraits>
-int HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::size() const
+inline int HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::size() const
{
- return m_impl.count();
+ return m_impl.size();
}
template<typename Key, typename Mapped, typename HashFunctions, typename KeyTraits, typename MappedTraits>
@@ -87,31 +87,31 @@
}
template<typename Key, typename Mapped, typename HashFunctions, typename KeyTraits, typename MappedTraits>
-bool HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::isEmpty() const
+inline bool HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::isEmpty() const
{
return size() == 0;
}
template<typename Key, typename Mapped, typename HashFunctions, typename KeyTraits, typename MappedTraits>
-typename HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::iterator HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::begin()
+inline typename HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::iterator HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::begin()
{
return m_impl.begin();
}
template<typename Key, typename Mapped, typename HashFunctions, typename KeyTraits, typename MappedTraits>
-typename HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::iterator HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::end()
+inline typename HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::iterator HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::end()
{
return m_impl.end();
}
template<typename Key, typename Mapped, typename HashFunctions, typename KeyTraits, typename MappedTraits>
-typename HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::const_iterator HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::begin() const
+inline typename HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::const_iterator HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::begin() const
{
return m_impl.begin();
}
template<typename Key, typename Mapped, typename HashFunctions, typename KeyTraits, typename MappedTraits>
-typename HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::const_iterator HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::end() const
+inline typename HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::const_iterator HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::end() const
{
return m_impl.end();
}
@@ -148,7 +148,7 @@
}
template<typename Key, typename Mapped, typename HashFunctions, typename KeyTraits, typename MappedTraits>
-Mapped HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::get(const KeyType &key) const
+inline Mapped HashMap<Key, Mapped, HashFunctions, KeyTraits, MappedTraits>::get(const KeyType &key) const
{
const_iterator it = find(key);
if (it == end())
1.6 +7 -7 WebCore/khtml/misc/hashset.h
Index: hashset.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/misc/hashset.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- hashset.h 7 Jul 2005 05:42:26 -0000 1.5
+++ hashset.h 9 Jul 2005 20:19:16 -0000 1.6
@@ -82,7 +82,7 @@
};
template<typename Value, typename HashFunctions, typename Traits>
-int HashSet<Value, HashFunctions, Traits>::size() const
+inline int HashSet<Value, HashFunctions, Traits>::size() const
{
return m_impl.size();
}
@@ -94,31 +94,31 @@
}
template<typename Value, typename HashFunctions, typename Traits>
-bool HashSet<Value, HashFunctions, Traits>::isEmpty() const
+inline bool HashSet<Value, HashFunctions, Traits>::isEmpty() const
{
return size() == 0;
}
template<typename Value, typename HashFunctions, typename Traits>
-typename HashSet<Value, HashFunctions, Traits>::iterator HashSet<Value, HashFunctions, Traits>::begin()
+inline typename HashSet<Value, HashFunctions, Traits>::iterator HashSet<Value, HashFunctions, Traits>::begin()
{
return m_impl.begin();
}
template<typename Value, typename HashFunctions, typename Traits>
-typename HashSet<Value, HashFunctions, Traits>::iterator HashSet<Value, HashFunctions, Traits>::end()
+inline typename HashSet<Value, HashFunctions, Traits>::iterator HashSet<Value, HashFunctions, Traits>::end()
{
return m_impl.end();
}
template<typename Value, typename HashFunctions, typename Traits>
-typename HashSet<Value, HashFunctions, Traits>::const_iterator HashSet<Value, HashFunctions, Traits>::begin() const
+inline typename HashSet<Value, HashFunctions, Traits>::const_iterator HashSet<Value, HashFunctions, Traits>::begin() const
{
return m_impl.begin();
}
template<typename Value, typename HashFunctions, typename Traits>
-typename HashSet<Value, HashFunctions, Traits>::const_iterator HashSet<Value, HashFunctions, Traits>::end() const
+inline typename HashSet<Value, HashFunctions, Traits>::const_iterator HashSet<Value, HashFunctions, Traits>::end() const
{
return m_impl.end();
}
@@ -136,7 +136,7 @@
}
template<typename Value, typename HashFunctions, typename Traits>
-bool HashSet<Value, HashFunctions, Traits>::contains(const ValueType& value) const
+inline bool HashSet<Value, HashFunctions, Traits>::contains(const ValueType& value) const
{
return m_impl.contains(value);
}
1.9 +27 -14 WebCore/khtml/misc/hashtable.h
Index: hashtable.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/misc/hashtable.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- hashtable.h 8 Jul 2005 05:51:36 -0000 1.8
+++ hashtable.h 9 Jul 2005 20:19:16 -0000 1.9
@@ -66,6 +66,13 @@
friend class HashTable<Key, Value, ExtractKey, HashFunctions, Traits>;
+ void skipEmptyBuckets()
+ {
+ while (m_position != m_endPosition && (HashTableType::isEmptyOrDeletedBucket(*m_position))) {
+ ++m_position;
+ }
+ }
+
HashTableIterator(PointerType position, PointerType endPosition)
: m_position(position), m_endPosition(endPosition)
{
@@ -99,14 +106,7 @@
return m_position != other.m_position;
}
-private:
- void skipEmptyBuckets()
- {
- while (m_position != m_endPosition && (HashTableType::isEmptyOrDeletedBucket(*m_position))) {
- ++m_position;
- }
- }
-
+ private:
PointerType m_position;
PointerType m_endPosition;
};
@@ -271,11 +271,11 @@
template<typename T, unsigned HashT(const T&), bool EqualT(const Key&, const T&)>
inline typename HashTable<Key, Value, ExtractKey, HashFunctions, Traits>::FullLookupType HashTable<Key, Value, ExtractKey, HashFunctions, Traits>::lookup(const T& key)
{
- if (!m_table)
- return makeLookupResult(0, false, 0);
+ assert(m_table);
unsigned h = HashT(key);
- int i = h & m_tableSizeMask;
+ int sizeMask = m_tableSizeMask;
+ int i = h & sizeMask;
int k = 0;
#if DUMP_HASHTABLE_STATS
@@ -283,9 +283,10 @@
int probeCount = 0;
#endif
+ ValueType *table = m_table;
ValueType *entry;
ValueType *deletedEntry = 0;
- while (!isEmptyBucket(*(entry = m_table + i))) {
+ while (!isEmptyBucket(*(entry = table + i))) {
if (isDeletedBucket(*entry))
deletedEntry = entry;
else if (EqualT(extractKey(*entry), key))
@@ -295,8 +296,8 @@
++probeCount;
#endif
if (k == 0)
- k = 1 | (h % m_tableSizeMask);
- i = (i + k) & m_tableSizeMask;
+ k = 1 | (h % sizeMask);
+ i = (i + k) & sizeMask;
}
return makeLookupResult(deletedEntry ? deletedEntry : entry, false, h);
@@ -355,6 +356,9 @@
template<typename Key, typename Value, Key ExtractKey(const Value &), typename HashFunctions, typename Traits>
inline typename HashTable<Key, Value, ExtractKey, HashFunctions, Traits>::iterator HashTable<Key, Value, ExtractKey, HashFunctions, Traits>::find(const Key& key)
{
+ if (!m_table)
+ return end();
+
LookupType result = lookup(key);
if (!result.second)
return end();
@@ -364,6 +368,9 @@
template<typename Key, typename Value, Key ExtractKey(const Value &), typename HashFunctions, typename Traits>
inline typename HashTable<Key, Value, ExtractKey, HashFunctions, Traits>::const_iterator HashTable<Key, Value, ExtractKey, HashFunctions, Traits>::find(const Key& key) const
{
+ if (!m_table)
+ return end();
+
LookupType result = const_cast<HashTable *>(this)->lookup(key);
if (!result.second)
return end();
@@ -373,6 +380,9 @@
template<typename Key, typename Value, Key ExtractKey(const Value &), typename HashFunctions, typename Traits>
inline bool HashTable<Key, Value, ExtractKey, HashFunctions, Traits>::contains(const KeyType& key) const
{
+ if (!m_table)
+ return false;
+
return const_cast<HashTable *>(this)->lookup(key).second;
}
@@ -398,6 +408,9 @@
template<typename Key, typename Value, Key ExtractKey(const Value &), typename HashFunctions, typename Traits>
inline void HashTable<Key, Value, ExtractKey, HashFunctions, Traits>::remove(const KeyType& key)
{
+ if (!m_table)
+ return;
+
remove(lookup(key).first);
}
1.11 +4 -13 WebCore/khtml/misc/htmlhashes.cpp
Index: htmlhashes.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/misc/htmlhashes.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- htmlhashes.cpp 5 Jan 2005 22:56:46 -0000 1.10
+++ htmlhashes.cpp 9 Jul 2005 20:19:16 -0000 1.11
@@ -25,22 +25,13 @@
// turn off inlining to void warning with newer gcc
#undef __inline
#define __inline
-#include "htmltags.c"
#include "htmlattrs.c"
#undef __inline
-unsigned short khtml::getTagID(const char *tagStr, int len)
+unsigned short khtml::getAttrID(const char *attrStr, int len)
{
- const struct tags *tagPtr = findTag(tagStr, len);
- if (!tagPtr)
+ const struct attrs *attrPtr = findAttr(attrStr, len);
+ if (!attrPtr)
return 0;
- return tagPtr->id;
-}
-
-unsigned short khtml::getAttrID(const char *tagStr, int len)
-{
- const struct attrs *tagPtr = findAttr(tagStr, len);
- if (!tagPtr)
- return 0;
- return tagPtr->id;
+ return attrPtr->id;
}
1.7 +0 -2 WebCore/khtml/misc/htmlhashes.h
Index: htmlhashes.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/misc/htmlhashes.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- htmlhashes.h 5 Jan 2005 22:56:46 -0000 1.6
+++ htmlhashes.h 9 Jul 2005 20:19:16 -0000 1.7
@@ -23,12 +23,10 @@
#ifndef HTMLHASHES_H
#define HTMLHASHES_H
-#include "htmltags.h"
#include "htmlattrs.h"
namespace khtml
{
- unsigned short getTagID(const char *tagStr, int len);
unsigned short getAttrID(const char *tagStr, int len);
}
1.134 +2 -3 WebCore/khtml/rendering/bidi.cpp
Index: bidi.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/bidi.cpp,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -r1.133 -r1.134
--- bidi.cpp 6 Jul 2005 00:21:47 -0000 1.133
+++ bidi.cpp 9 Jul 2005 20:19:17 -0000 1.134
@@ -360,10 +360,9 @@
if (!obj->isText())
return QChar::DirON;
- RenderText *renderTxt = static_cast<RenderText *>( obj );
- if ( pos >= renderTxt->stringLength() )
+ RenderText *renderTxt = static_cast<RenderText *>(obj);
+ if (pos >= renderTxt->stringLength())
return QChar::DirON;
-
return renderTxt->text()[pos].direction();
}
1.20 +2 -1 WebCore/khtml/rendering/break_lines.cpp
Index: break_lines.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/break_lines.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- break_lines.cpp 5 Jul 2005 23:21:11 -0000 1.19
+++ break_lines.cpp 9 Jul 2005 20:19:17 -0000 1.20
@@ -112,7 +112,8 @@
if (lastCh == '-' || lastCh == '?')
return true;
- return c->direction() == QChar::DirWS;
+ // No other ascii chars are breakable.
+ return false;
#endif
}
1.31 +1 -2 WebCore/khtml/rendering/render_applet.cpp
Index: render_applet.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_applet.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- render_applet.cpp 10 May 2005 18:42:03 -0000 1.30
+++ render_applet.cpp 9 Jul 2005 20:19:17 -0000 1.31
@@ -36,7 +36,6 @@
#ifndef Q_WS_QWS // We don't have Java in Qt Embedded
#include "java/kjavaappletwidget.h"
-#include "misc/htmltags.h"
#include "html/html_objectimpl.h"
using namespace khtml;
@@ -103,7 +102,7 @@
m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom();
NodeImpl *child = element()->firstChild();
while (child) {
- if (child->id() == ID_PARAM) {
+ if (child->hasTagName(HTMLNames::param())) {
HTMLParamElementImpl *p = static_cast<HTMLParamElementImpl *>(child);
m_args.insert(p->name().string(), p->value().string());
}
1.187 +1 -2 WebCore/khtml/rendering/render_block.cpp
Index: render_block.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_block.cpp,v
retrieving revision 1.186
retrieving revision 1.187
diff -u -r1.186 -r1.187
--- render_block.cpp 5 Jul 2005 23:21:11 -0000 1.186
+++ render_block.cpp 9 Jul 2005 20:19:17 -0000 1.187
@@ -40,7 +40,6 @@
#include "khtmlview.h"
#include "khtml_part.h"
-#include "htmltags.h"
using namespace DOM;
@@ -475,7 +474,7 @@
m_topMarginQuirk = style()->marginTop().quirk;
m_bottomMarginQuirk = style()->marginBottom().quirk;
- if (element() && element()->id() == ID_FORM && element()->isMalformed())
+ if (element() && element()->hasTagName(HTMLNames::form()) && element()->isMalformed())
// See if this form is malformed (i.e., unclosed). If so, don't give the form
// a bottom margin.
m_maxBottomPosMargin = m_maxBottomNegMargin = 0;
1.155 +3 -3 WebCore/khtml/rendering/render_box.cpp
Index: render_box.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_box.cpp,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -r1.154 -r1.155
--- render_box.cpp 11 Jun 2005 05:01:17 -0000 1.154
+++ render_box.cpp 9 Jul 2005 20:19:17 -0000 1.155
@@ -256,7 +256,7 @@
// anonymous blocks created by inline <body> tags etc. We can locate the <body>
// render object very easily via the DOM.
HTMLElementImpl* body = document()->body();
- RenderObject* bodyObject = (body && body->id() == ID_BODY) ? body->renderer() : 0;
+ RenderObject* bodyObject = (body && body->hasLocalName(HTMLNames::body())) ? body->renderer() : 0;
if (bodyObject) {
bgLayer = bodyObject->style()->backgroundLayers();
bgColor = bodyObject->style()->backgroundColor();
@@ -369,7 +369,7 @@
bool isTransparent;
DOM::NodeImpl* elt = document()->ownerElement();
if (elt) {
- if (elt->id() == ID_FRAME)
+ if (elt->hasTagName(HTMLNames::frame()))
isTransparent = false;
else {
// Locate the <body> element using the DOM. This is easier than trying
@@ -377,7 +377,7 @@
// anonymous blocks created by inline <body> tags etc. We can locate the <body>
// render object very easily via the DOM.
HTMLElementImpl* body = document()->body();
- isTransparent = !body || body->id() != ID_FRAMESET; // Can't scroll a frameset document anyway.
+ isTransparent = !body || !body->hasLocalName(HTMLNames::frameset()); // Can't scroll a frameset document anyway.
}
} else
isTransparent = canvas()->view()->isTransparent();
1.13 +1 -3 WebCore/khtml/rendering/render_canvasimage.cpp
Index: render_canvasimage.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_canvasimage.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- render_canvasimage.cpp 7 Jul 2005 07:17:28 -0000 1.12
+++ render_canvasimage.cpp 9 Jul 2005 20:19:17 -0000 1.13
@@ -37,10 +37,8 @@
#include "css/csshelper.h"
#include "misc/helper.h"
#include "misc/htmlattrs.h"
-#include "misc/htmltags.h"
#include "html/html_formimpl.h"
#include "html/html_canvasimpl.h"
-#include "html/dtd.h"
#include "xml/dom2_eventsimpl.h"
#include "html/html_documentimpl.h"
@@ -191,7 +189,7 @@
}
if (drawnImage()) {
- HTMLCanvasElementImpl* i = (element() && element()->id() == ID_CANVAS) ? static_cast<HTMLCanvasElementImpl*>(element()) : 0;
+ HTMLCanvasElementImpl* i = (element() && element()->hasTagName(HTMLNames::canvas())) ? static_cast<HTMLCanvasElementImpl*>(element()) : 0;
int oldOperation = 0;
if (i && !i->compositeOperator().isNull()){
oldOperation = QPainter::getCompositeOperation(p->currentContext());
1.4 +0 -1 WebCore/khtml/rendering/render_canvasimage.h
Index: render_canvasimage.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_canvasimage.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- render_canvasimage.h 4 Sep 2004 19:59:58 -0000 1.3
+++ render_canvasimage.h 9 Jul 2005 20:19:17 -0000 1.4
@@ -26,7 +26,6 @@
#ifndef RENDER_CANVASIMAGE_H
#define RENDER_CANVASIMAGE_H
-#include "html/dtd.h"
#include "html/html_elementimpl.h"
#include "rendering/render_image.h"
#include "dom/dom_string.h"
1.67 +2 -2 WebCore/khtml/rendering/render_container.cpp
Index: render_container.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_container.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- render_container.cpp 14 Feb 2005 18:19:18 -0000 1.66
+++ render_container.cpp 9 Jul 2005 20:19:17 -0000 1.67
@@ -226,12 +226,12 @@
// For <q><p/></q>, if this object is the inline continuation of the <q>, we only want to generate
// :after content and not :before content.
- if (type == RenderStyle::BEFORE && isInlineContinuation())
+ if (newContentWanted && type == RenderStyle::BEFORE && isInlineContinuation())
newContentWanted = false;
// Similarly, if we're the beginning of a <q>, and there's an inline continuation for our object,
// then we don't generate the :after content.
- if (type == RenderStyle::AFTER && isRenderInline() && continuation())
+ if (newContentWanted && type == RenderStyle::AFTER && isRenderInline() && continuation())
newContentWanted = false;
// If we don't want generated content any longer, or if we have generated content, but it's no longer
1.161 +1 -2 WebCore/khtml/rendering/render_flow.cpp
Index: render_flow.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_flow.cpp,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -r1.160 -r1.161
--- render_flow.cpp 11 May 2005 02:10:10 -0000 1.160
+++ render_flow.cpp 9 Jul 2005 20:19:17 -0000 1.161
@@ -40,7 +40,6 @@
#include "render_line.h"
#include "khtmlview.h"
-#include "htmltags.h"
using namespace DOM;
using namespace khtml;
@@ -654,7 +653,7 @@
// Only paint focus ring around outermost contenteditable element.
// But skip the body element if it is outermost.
if (element() && element()->isContentEditable()) {
- if (element()->parentNode() && !element()->parentNode()->isContentEditable() && element()->id() != ID_BODY)
+ if (element()->parentNode() && !element()->parentNode()->isContentEditable() && !element()->hasTagName(HTMLNames::body()))
p->addFocusRingRect(_tx, _ty, width(), height());
return;
}
1.109 +12 -12 WebCore/khtml/rendering/render_form.cpp
Index: render_form.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_form.cpp,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -r1.108 -r1.109
--- render_form.cpp 24 Jun 2005 05:53:28 -0000 1.108
+++ render_form.cpp 9 Jul 2005 20:19:17 -0000 1.109
@@ -797,7 +797,7 @@
{
for (RenderObject* legend = firstChild(); legend; legend = legend->nextSibling()) {
if (!legend->isFloatingOrPositioned() && legend->element() &&
- legend->element()->id() == ID_LEGEND)
+ legend->element()->hasTagName(HTMLNames::legend()))
return legend;
}
return 0;
@@ -1191,7 +1191,7 @@
static_cast<KComboBox*>(m_widget)->clear();
for (listIndex = 0; listIndex < int(listItems.size()); listIndex++) {
- if (listItems[listIndex]->id() == ID_OPTGROUP) {
+ if (listItems[listIndex]->hasTagName(HTMLNames::optgroup())) {
QString label = listItems[listIndex]->getAttribute(ATTR_LABEL).string();
label.replace(QChar('\\'), backslashAsCurrencySymbol());
@@ -1215,14 +1215,14 @@
static_cast<KComboBox*>(m_widget)->insertItem(label, listIndex);
#endif
}
- else if (listItems[listIndex]->id() == ID_OPTION) {
+ else if (listItems[listIndex]->hasTagName(HTMLNames::option())) {
QString itemText = static_cast<HTMLOptionElementImpl*>(listItems[listIndex])->text().string();
itemText.replace(QChar('\\'), backslashAsCurrencySymbol());
// In WinIE, leading and trailing whitespace is ignored in options. We match this behavior.
itemText = itemText.stripWhiteSpace();
- if (listItems[listIndex]->parentNode()->id() == ID_OPTGROUP)
+ if (listItems[listIndex]->parentNode()->hasTagName(HTMLNames::optgroup()))
itemText.prepend(" ");
#if APPLE_CHANGES
@@ -1348,7 +1348,7 @@
bool foundOption = false;
for (uint i = 0; i < listItems.size() && !foundOption; i++)
- foundOption = (listItems[i]->id() == ID_OPTION);
+ foundOption = (listItems[i]->hasTagName(HTMLNames::option()));
m_widget->setEnabled(foundOption && ! element()->disabled());
}
@@ -1362,12 +1362,12 @@
QMemArray<HTMLGenericFormElementImpl*> listItems = element()->listItems();
if(index >= 0 && index < int(listItems.size()))
{
- bool found = ( listItems[index]->id() == ID_OPTION );
+ bool found = (listItems[index]->hasTagName(HTMLNames::option()));
if ( !found ) {
// this one is not selectable, we need to find an option element
while ( ( unsigned ) index < listItems.size() ) {
- if ( listItems[index]->id() == ID_OPTION ) {
+ if (listItems[index]->hasTagName(HTMLNames::option())) {
found = true;
break;
}
@@ -1376,7 +1376,7 @@
if ( !found ) {
while ( index >= 0 ) {
- if ( listItems[index]->id() == ID_OPTION ) {
+ if (listItems[index]->hasTagName(HTMLNames::option())) {
found = true;
break;
}
@@ -1390,7 +1390,7 @@
static_cast<ComboBoxWidget*>( m_widget )->setCurrentItem( index );
for ( unsigned int i = 0; i < listItems.size(); ++i )
- if ( listItems[i]->id() == ID_OPTION && i != (unsigned int) index )
+ if (listItems[i]->hasTagName(HTMLNames::option()) && i != (unsigned int) index)
static_cast<HTMLOptionElementImpl*>( listItems[i] )->m_selected = false;
static_cast<HTMLOptionElementImpl*>(listItems[index])->m_selected = true;
@@ -1411,7 +1411,7 @@
for ( unsigned i = 0; i < listItems.count(); i++ )
// don't use setSelected() here because it will cause us to be called
// again with updateSelection.
- if ( listItems[i]->id() == ID_OPTION )
+ if (listItems[i]->hasTagName(HTMLNames::option()))
static_cast<HTMLOptionElementImpl*>( listItems[i] )
->m_selected = static_cast<KListBox*>( m_widget )->isSelected( i );
@@ -1453,7 +1453,7 @@
// if multi-select, we select only the new selected index
KListBox *listBox = static_cast<KListBox*>(m_widget);
for (i = 0; i < int(listItems.size()); i++)
- listBox->setSelected(i,listItems[i]->id() == ID_OPTION &&
+ listBox->setSelected(i, listItems[i]->hasTagName(HTMLNames::option()) &&
static_cast<HTMLOptionElementImpl*>(listItems[i])->selected());
}
else {
@@ -1461,7 +1461,7 @@
unsigned firstOption = listItems.size();
i = listItems.size();
while (i--)
- if (listItems[i]->id() == ID_OPTION) {
+ if (listItems[i]->hasTagName(HTMLNames::option())) {
if (found)
static_cast<HTMLOptionElementImpl*>(listItems[i])->m_selected = false;
else if (static_cast<HTMLOptionElementImpl*>(listItems[i])->selected()) {
1.70 +9 -10 WebCore/khtml/rendering/render_frames.cpp
Index: render_frames.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_frames.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- render_frames.cpp 10 May 2005 18:42:04 -0000 1.69
+++ render_frames.cpp 9 Jul 2005 20:19:17 -0000 1.70
@@ -34,7 +34,6 @@
#include "misc/htmlattrs.h"
#include "xml/dom2_eventsimpl.h"
#include "xml/dom_docimpl.h"
-#include "misc/htmltags.h"
#include "khtmlview.h"
#include "khtml_part.h"
#include "render_arena.h"
@@ -669,17 +668,17 @@
setNeedsLayoutAndMinMaxRecalc();
- if (element()->id() == ID_OBJECT) {
+ if (element()->hasTagName(HTMLNames::object())) {
HTMLObjectElementImpl *o = static_cast<HTMLObjectElementImpl *>(element());
// Check for a child EMBED tag.
HTMLEmbedElementImpl *embed = 0;
for (NodeImpl *child = o->firstChild(); child; ) {
- if (child->id() == ID_EMBED) {
+ if (child->hasTagName(HTMLNames::embed())) {
embed = static_cast<HTMLEmbedElementImpl *>( child );
break;
- } else if (child->id() == ID_OBJECT) {
+ } else if (child->hasTagName(HTMLNames::object())) {
child = child->nextSibling(); // Don't descend into nested OBJECT tags
} else {
child = child->traverseNextNode(o); // Otherwise descend (EMBEDs may be inside COMMENT tags)
@@ -719,7 +718,7 @@
// Get the attributes from the params if there is no EMBED tag.
NodeImpl *child = o->firstChild();
while (child && (url.isEmpty() || serviceType.isEmpty() || !embed)) {
- if (child->id() == ID_PARAM) {
+ if (child->hasTagName(HTMLNames::param())) {
HTMLParamElementImpl *p = static_cast<HTMLParamElementImpl *>( child );
QString name = p->name().string().lower();
if (url.isEmpty() && (name == "src" || name == "movie" || name == "code" || name == "url")) {
@@ -810,14 +809,14 @@
// Find out if we support fallback content.
m_hasFallbackContent = false;
for (NodeImpl *child = o->firstChild(); child && !m_hasFallbackContent; child = child->nextSibling()) {
- if ((!child->isTextNode() && child->id() != ID_EMBED && child->id() != ID_PARAM) || // Discount <embed> and <param>
+ if ((!child->isTextNode() && !child->hasTagName(HTMLNames::embed()) && !child->hasTagName(HTMLNames::param())) || // Discount <embed> and <param>
(child->isTextNode() && !child->containsOnlyWhitespace()))
m_hasFallbackContent = true;
}
bool success = part->requestObject( this, url, serviceType, paramNames, paramValues );
if (!success && m_hasFallbackContent)
o->renderFallbackContent();
- } else if ( element()->id() == ID_EMBED ) {
+ } else if (element()->hasTagName(HTMLNames::embed())) {
HTMLEmbedElementImpl *o = static_cast<HTMLEmbedElementImpl *>(element());
url = o->url;
@@ -844,7 +843,7 @@
}
part->requestObject( this, url, serviceType, paramNames, paramValues );
} else {
- assert(element()->id() == ID_IFRAME);
+ assert(element()->hasTagName(HTMLNames::iframe()));
HTMLIFrameElementImpl *o = static_cast<HTMLIFrameElementImpl *>(element());
url = o->m_URL.string();
if (url.isEmpty()) {
@@ -890,7 +889,7 @@
QScrollView::ScrollBarMode scroll = QScrollView::Auto;
int marginw = -1;
int marginh = -1;
- if ( element()->id() == ID_IFRAME) {
+ if (element()->hasTagName(HTMLNames::iframe())) {
HTMLIFrameElementImpl *frame = static_cast<HTMLIFrameElementImpl *>(element());
if(frame->m_frameBorder)
frameStyle = QFrame::Box;
@@ -910,7 +909,7 @@
kdDebug(6031) << "frame is a KHTMLview!" << endl;
#endif
KHTMLView *htmlView = static_cast<KHTMLView *>(view);
- htmlView->setIgnoreWheelEvents( element()->id() == ID_IFRAME );
+ htmlView->setIgnoreWheelEvents(element()->hasTagName(HTMLNames::iframe()));
if(marginw != -1) htmlView->setMarginWidth(marginw);
if(marginh != -1) htmlView->setMarginHeight(marginh);
}
1.79 +4 -6 WebCore/khtml/rendering/render_image.cpp
Index: render_image.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_image.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- render_image.cpp 7 Jul 2005 07:17:28 -0000 1.78
+++ render_image.cpp 9 Jul 2005 20:19:17 -0000 1.79
@@ -37,10 +37,8 @@
#include "css/csshelper.h"
#include "misc/helper.h"
#include "misc/htmlattrs.h"
-#include "misc/htmltags.h"
#include "html/html_formimpl.h"
#include "html/html_imageimpl.h"
-#include "html/dtd.h"
#include "xml/dom2_eventsimpl.h"
#include "html/html_documentimpl.h"
@@ -424,7 +422,7 @@
// p->drawPixmap( offs.x(), y, pix, rect.x(), rect.y(), rect.width(), rect.height() );
- HTMLImageElementImpl* i = (element() && element()->id() == ID_IMG) ? static_cast<HTMLImageElementImpl*>(element()) : 0;
+ HTMLImageElementImpl* i = (element() && element()->hasTagName(HTMLNames::img())) ? static_cast<HTMLImageElementImpl*>(element()) : 0;
if (i && !i->compositeOperator().isNull()){
p->drawPixmap (offs, pix, rect, i->compositeOperator());
}
@@ -491,7 +489,7 @@
HTMLMapElementImpl* RenderImage::imageMap()
{
- HTMLImageElementImpl* i = element()->id() == ID_IMG ? static_cast<HTMLImageElementImpl*>(element()) : 0;
+ HTMLImageElementImpl* i = element()->hasTagName(HTMLNames::img()) ? static_cast<HTMLImageElementImpl*>(element()) : 0;
return i ? i->getDocument()->getImageMap(i->imageMap()) : 0;
}
@@ -517,9 +515,9 @@
void RenderImage::updateAltText()
{
- if (element()->id() == ID_INPUT)
+ if (element()->hasTagName(HTMLNames::input()))
alt = static_cast<HTMLInputElementImpl*>(element())->altText();
- else if (element()->id() == ID_IMG)
+ else if (element()->hasTagName(HTMLNames::img()))
alt = static_cast<HTMLImageElementImpl*>(element())->altText();
}
1.28 +0 -1 WebCore/khtml/rendering/render_image.h
Index: render_image.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_image.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- render_image.h 25 Feb 2005 00:25:12 -0000 1.27
+++ render_image.h 9 Jul 2005 20:19:17 -0000 1.28
@@ -23,7 +23,6 @@
#ifndef RENDER_IMAGE_H
#define RENDER_IMAGE_H
-#include "html/dtd.h"
#include "html/html_elementimpl.h"
#include "rendering/render_replaced.h"
#include "dom/dom_string.h"
1.97 +1 -2 WebCore/khtml/rendering/render_layer.cpp
Index: render_layer.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_layer.cpp,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- render_layer.cpp 10 May 2005 22:25:04 -0000 1.96
+++ render_layer.cpp 9 Jul 2005 20:19:17 -0000 1.97
@@ -49,7 +49,6 @@
#include "render_arena.h"
#include "xml/dom_docimpl.h"
#include "xml/dom2_eventsimpl.h"
-#include "misc/htmltags.h"
#include "html/html_blockimpl.h"
#include <qscrollbar.h>
@@ -1467,7 +1466,7 @@
{
int result = m_layer->renderer()->style()->marqueeSpeed();
DOM::NodeImpl* elt = m_layer->renderer()->element();
- if (elt && elt->id() == ID_MARQUEE) {
+ if (elt && elt->hasTagName(HTMLNames::marquee())) {
HTMLMarqueeElementImpl* marqueeElt = static_cast<HTMLMarqueeElementImpl*>(elt);
result = kMax(result, marqueeElt->minimumDelay());
}
1.44 +0 -1 WebCore/khtml/rendering/render_line.cpp
Index: render_line.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_line.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- render_line.cpp 5 Jul 2005 23:21:12 -0000 1.43
+++ render_line.cpp 9 Jul 2005 20:19:17 -0000 1.44
@@ -37,7 +37,6 @@
#include "render_line.h"
#include "khtmlview.h"
-#include "htmltags.h"
using namespace DOM;
1.63 +4 -2 WebCore/khtml/rendering/render_list.cpp
Index: render_list.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_list.cpp,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- render_list.cpp 5 Jul 2005 23:21:12 -0000 1.62
+++ render_list.cpp 9 Jul 2005 20:19:18 -0000 1.63
@@ -26,7 +26,8 @@
#include "rendering/render_canvas.h"
#include "xml/dom_docimpl.h"
-#include "misc/htmltags.h"
+
+#include "htmlnames.h"
#include <qpainter.h>
@@ -37,6 +38,7 @@
//#define BOX_DEBUG
using DOM::DocumentImpl;
+using DOM::HTMLNames;
using namespace khtml;
const int cMarkerPadding = 7;
@@ -213,7 +215,7 @@
break;
if (currChild->style()->htmlHacks() && currChild->element() &&
- (currChild->element()->id() == ID_UL || currChild->element()->id() == ID_OL))
+ (currChild->element()->hasTagName(HTMLNames::ul())|| currChild->element()->hasTagName(HTMLNames::ol())))
break;
RenderObject* lineBox = getParentOfFirstLineBox(currChild, marker);
1.198 +9 -8 WebCore/khtml/rendering/render_object.cpp
Index: render_object.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_object.cpp,v
retrieving revision 1.197
retrieving revision 1.198
diff -u -r1.197 -r1.198
--- render_object.cpp 5 Jul 2005 23:21:12 -0000 1.197
+++ render_object.cpp 9 Jul 2005 20:19:18 -0000 1.198
@@ -43,6 +43,7 @@
#include "render_inline.h"
#include "render_block.h"
#include "render_flexbox.h"
+#include "htmlnames.h"
#if APPLE_CHANGES
// For accessibility
@@ -175,17 +176,17 @@
bool RenderObject::isBody() const
{
- return element() && element()->renderer() == this && element()->id() == ID_BODY;
+ return element() && element()->renderer() == this && element()->hasTagName(HTMLNames::body());
}
bool RenderObject::isHR() const
{
- return element() && element()->id() == ID_HR;
+ return element() && element()->hasTagName(HTMLNames::hr());
}
bool RenderObject::isHTMLMarquee() const
{
- return element() && element()->renderer() == this && element()->id() == ID_MARQUEE;
+ return element() && element()->renderer() == this && element()->hasTagName(HTMLNames::marquee());
}
bool RenderObject::canHaveChildren() const
@@ -737,7 +738,7 @@
// but they allow text to sit on the same line as the marquee.
if (isFloating() || (isCompact() && isInline()) ||
(isInlineBlockOrInlineTable() && !isHTMLMarquee()) ||
- (element() && (element()->id() == ID_BUTTON || element()->id() == ID_LEGEND)))
+ (element() && (element()->hasTagName(HTMLNames::button()) || element()->hasTagName(HTMLNames::legend()))))
return true;
// Children of a horizontal marquee do not fill the container by default.
@@ -1326,7 +1327,7 @@
if (element() && element()->active()) ts << "act ";
if (element() && element()->isLink()) ts << "anchor ";
if (element() && element()->focused()) ts << "focus ";
- if (element()) ts << " <" << getTagName(element()->id()).string() << ">";
+ if (element()) ts << " <" << element()->localName().string() << ">";
ts << " (" << xPos() << "," << yPos() << "," << width() << "," << height() << ")"
<< (isTableCell() ?
( QString::fromLatin1(" [r=") +
@@ -1556,7 +1557,7 @@
// The background of the root element or the body element could propagate up to
// the canvas. Just dirty the entire canvas when our style changes substantially.
if (d >= RenderStyle::Repaint && element() &&
- (element()->id() == ID_HTML || element()->id() == ID_BODY))
+ (element()->hasTagName(HTMLNames::html()) || element()->hasTagName(HTMLNames::body())))
canvas()->repaint();
else if (m_parent && !isText()) {
// Do a repaint with the old style first, e.g., for example if we go from
@@ -2188,7 +2189,7 @@
if (curr && curr->isRenderBlock() && curr->continuation())
curr = curr->continuation();
} while (curr && decorations && (!quirksMode || !curr->element() ||
- (curr->element()->id() != ID_A && curr->element()->id() != ID_FONT)));
+ (!curr->element()->hasTagName(HTMLNames::a()) && !curr->element()->hasTagName(HTMLNames::font()))));
// If we bailed out, use the element we bailed out at (typically a <font> or <a> element).
if (decorations && curr) {
@@ -2322,7 +2323,7 @@
// would avoid putting this function and the CachedObjectClient base class into RenderObject.
if (image && image->pixmap_size() == image->valid_rect().size() && parent()) {
- if (canvas() && element() && (element()->id() == ID_HTML || element()->id() == ID_BODY))
+ if (canvas() && element() && (element()->hasTagName(HTMLNames::html()) || element()->hasTagName(HTMLNames::body())))
canvas()->repaint(); // repaint the entire canvas since the background gets propagated up
else
repaint(); // repaint object, which is a box or a container with boxes inside it
1.67 +3 -0 WebCore/khtml/rendering/render_style.cpp
Index: render_style.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_style.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- render_style.cpp 11 Jun 2005 01:58:02 -0000 1.66
+++ render_style.cpp 9 Jul 2005 20:19:18 -0000 1.67
@@ -607,6 +607,9 @@
RenderStyle* RenderStyle::getPseudoStyle(PseudoId pid)
{
+ if (!pseudoStyle)
+ return 0;
+
RenderStyle *ps = 0;
if (noninherited_flags._styleType==NOPSEUDO) {
ps = pseudoStyle;
1.83 +19 -5 WebCore/khtml/rendering/render_style.h
Index: render_style.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_style.h,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- render_style.h 12 May 2005 17:11:22 -0000 1.82
+++ render_style.h 9 Jul 2005 20:19:18 -0000 1.83
@@ -299,8 +299,10 @@
{
public:
StyleSurroundData();
+ StyleSurroundData(const StyleSurroundData& o);
+
+ MAIN_THREAD_ALLOCATED;
- StyleSurroundData(const StyleSurroundData& o );
bool operator==(const StyleSurroundData& o) const;
bool operator!=(const StyleSurroundData& o) const {
return !(*this == o);
@@ -320,9 +322,9 @@
{
public:
StyleBoxData();
+ StyleBoxData(const StyleBoxData& o);
- StyleBoxData(const StyleBoxData& o );
-
+ MAIN_THREAD_ALLOCATED;
// copy and assignment
// StyleBoxData(const StyleBoxData &other);
@@ -399,11 +401,11 @@
{
public:
StyleVisualData();
-
~StyleVisualData();
-
StyleVisualData(const StyleVisualData& o );
+ MAIN_THREAD_ALLOCATED;
+
bool operator==( const StyleVisualData &o ) const {
return ( clip == o.clip &&
hasClip == o.hasClip &&
@@ -521,6 +523,8 @@
~StyleBackgroundData() {}
StyleBackgroundData(const StyleBackgroundData& o );
+ MAIN_THREAD_ALLOCATED;
+
bool operator==(const StyleBackgroundData& o) const;
bool operator!=(const StyleBackgroundData &o) const {
return !(*this == o);
@@ -543,6 +547,8 @@
StyleMarqueeData();
StyleMarqueeData(const StyleMarqueeData& o);
+ MAIN_THREAD_ALLOCATED;
+
bool operator==(const StyleMarqueeData& o) const;
bool operator!=(const StyleMarqueeData& o) const {
return !(*this == o);
@@ -571,6 +577,8 @@
StyleFlexibleBoxData();
StyleFlexibleBoxData(const StyleFlexibleBoxData& o);
+ MAIN_THREAD_ALLOCATED;
+
bool operator==(const StyleFlexibleBoxData& o) const;
bool operator!=(const StyleFlexibleBoxData &o) const {
return !(*this == o);
@@ -677,6 +685,8 @@
~StyleCSS3NonInheritedData();
StyleCSS3NonInheritedData(const StyleCSS3NonInheritedData& o);
+ MAIN_THREAD_ALLOCATED;
+
#ifndef KHTML_NO_XBL
bool bindingsEquivalent(const StyleCSS3NonInheritedData& o) const;
#endif
@@ -715,6 +725,8 @@
~StyleCSS3InheritedData();
StyleCSS3InheritedData(const StyleCSS3InheritedData& o);
+ MAIN_THREAD_ALLOCATED;
+
bool operator==(const StyleCSS3InheritedData& o) const;
bool operator!=(const StyleCSS3InheritedData &o) const {
return !(*this == o);
@@ -769,6 +781,8 @@
~StyleInheritedData();
StyleInheritedData(const StyleInheritedData& o );
+ MAIN_THREAD_ALLOCATED;
+
bool operator==(const StyleInheritedData& o) const;
bool operator != ( const StyleInheritedData &o ) const {
return !(*this == o);
1.127 +7 -7 WebCore/khtml/rendering/render_table.cpp
Index: render_table.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_table.cpp,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -r1.126 -r1.127
--- render_table.cpp 11 May 2005 02:10:10 -0000 1.126
+++ render_table.cpp 9 Jul 2005 20:19:18 -0000 1.127
@@ -31,8 +31,8 @@
#include "rendering/render_table.h"
#include "rendering/table_layout.h"
#include "html/html_tableimpl.h"
-#include "misc/htmltags.h"
#include "misc/htmlattrs.h"
+#include "htmlnames.h"
#include "xml/dom_docimpl.h"
#include <kglobal.h>
@@ -112,7 +112,7 @@
#endif
RenderObject *o = child;
- if (child->element() && child->element()->id() == ID_FORM) {
+ if (child->element() && child->element()->hasTagName(HTMLNames::form())) {
RenderContainer::addChild(child,beforeChild);
return;
}
@@ -262,7 +262,7 @@
RenderObject *child = firstChild();
while( child ) {
- if ( child->needsLayout() && !(child->element() && child->element()->id() == ID_FORM))
+ if ( child->needsLayout() && !(child->element() && child->element()->hasTagName(HTMLNames::form())))
child->layout();
if ( child->isTableSection() ) {
static_cast<RenderTableSection *>(child)->calcRowHeight();
@@ -849,7 +849,7 @@
#endif
RenderObject *row = child;
- if (child->element() && child->element()->id() == ID_FORM) {
+ if (child->element() && child->element()->hasTagName(HTMLNames::form())) {
RenderContainer::addChild(child,beforeChild);
return;
}
@@ -1495,7 +1495,7 @@
kdDebug( 6040 ) << renderName() << "(TableRow)::addChild( " << child->renderName() << " )" << ", " <<
(beforeChild ? beforeChild->renderName() : "0") << " )" << endl;
#endif
- if (child->element() && child->element()->id() == ID_FORM) {
+ if (child->element() && child->element()->hasTagName(HTMLNames::form())) {
RenderContainer::addChild(child,beforeChild);
return;
}
@@ -1606,7 +1606,7 @@
int oldRSpan = rSpan;
int oldCSpan = cSpan;
DOM::NodeImpl* node = element();
- if (node && (node->id() == ID_TD || node->id() == ID_TH)) {
+ if (node && (node->hasTagName(HTMLNames::td()) || node->hasTagName(HTMLNames::th()))) {
DOM::HTMLTableCellElementImpl *tc = static_cast<DOM::HTMLTableCellElementImpl *>(node);
cSpan = tc->colSpan();
rSpan = tc->rowSpan();
@@ -2290,7 +2290,7 @@
{
int oldSpan = _span;
DOM::NodeImpl *node = element();
- if (node && (node->id() == ID_COL || node->id() == ID_COLGROUP)) {
+ if (node && (node->hasTagName(HTMLNames::col()) || node->hasTagName(HTMLNames::colgroup()))) {
DOM::HTMLTableColElementImpl *tc = static_cast<DOM::HTMLTableColElementImpl *>(node);
_span = tc->span();
}
1.41 +0 -1 WebCore/khtml/xml/dom2_rangeimpl.cpp
Index: dom2_rangeimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom2_rangeimpl.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- dom2_rangeimpl.cpp 13 May 2005 16:48:51 -0000 1.40
+++ dom2_rangeimpl.cpp 9 Jul 2005 20:19:21 -0000 1.41
@@ -29,7 +29,6 @@
#include "dom_textimpl.h"
#include "dom_xmlimpl.h"
#include "html/html_elementimpl.h"
-#include "misc/htmltags.h"
#include "editing/markup.h"
#include "editing/visible_position.h"
#include "editing/visible_units.h"
1.11 +0 -2 WebCore/khtml/xml/dom2_traversalimpl.cpp
Index: dom2_traversalimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom2_traversalimpl.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- dom2_traversalimpl.cpp 10 May 2005 21:59:14 -0000 1.10
+++ dom2_traversalimpl.cpp 9 Jul 2005 20:19:21 -0000 1.11
@@ -26,8 +26,6 @@
#include "dom/dom_exception.h"
#include "xml/dom_docimpl.h"
-#include "htmltags.h"
-
namespace DOM {
NodeFilterImpl::NodeFilterImpl(NodeFilterCondition *condition)
1.10 +16 -41 WebCore/khtml/xml/dom_atomicstring.cpp
Index: dom_atomicstring.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_atomicstring.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- dom_atomicstring.cpp 8 Jul 2005 05:19:21 -0000 1.9
+++ dom_atomicstring.cpp 9 Jul 2005 20:19:21 -0000 1.10
@@ -26,13 +26,7 @@
// portable, and it would be good to figure out a 100% clean way that still avoids code that
// runs at init time.
-#if APPLE_CHANGES
-#define AVOID_STATIC_CONSTRUCTORS 1
-#endif
-
-#if AVOID_STATIC_CONSTRUCTORS
#define KHTML_ATOMICSTRING_HIDE_GLOBALS 1
-#endif
#include "dom_atomicstring.h"
#include "xml/dom_stringimpl.h"
@@ -51,9 +45,6 @@
inline bool equal(DOMStringImpl* const& r, const char* const& s)
{
- if (!r && !s) return true;
- if (!r || !s) return false;
-
int length = r->l;
const QChar *d = r->s;
for (int i = 0; i != length; ++i)
@@ -100,17 +91,13 @@
inline bool equal(DOMStringImpl* const& str, const QCharBuffer &buf)
{
- const uint32_t *strChars = reinterpret_cast<const uint32_t *>(str->s);
- const uint32_t *bufChars = reinterpret_cast<const uint32_t *>(buf.s);
-
- if (!strChars && !bufChars) return true;
- if (!strChars || !bufChars) return false;
-
uint strLength = str->l;
uint bufLength = buf.length;
if (strLength != bufLength)
return false;
+ const uint32_t *strChars = reinterpret_cast<const uint32_t *>(str->s);
+ const uint32_t *bufChars = reinterpret_cast<const uint32_t *>(buf.s);
uint halfLength = strLength >> 1;
for (uint i = 0; i != halfLength; ++i) {
@@ -165,42 +152,30 @@
stringTable.remove(r);
}
-// Global constants for property name strings.
-
-#if !AVOID_STATIC_CONSTRUCTORS
- // Define an AtomicString in the normal way.
- #define DEFINE_GLOBAL(name, string) extern const AtomicString name ## Atom(string);
-
- extern const AtomicString nullAtom;
- extern const AtomicString emptyAtom;
-#else
- // Define an AtomicString-sized array of pointers to avoid static initialization.
- // Use an array of pointers instead of an array of char in case there is some alignment issue.
- #define DEFINE_GLOBAL(name, string) \
- void * name ## Atom[(sizeof(AtomicString) + sizeof(void *) - 1) / sizeof(void *)];
-
- DEFINE_GLOBAL(null, ignored)
- DEFINE_GLOBAL(empty, ignored)
-#endif
-
-#define CALL_DEFINE_GLOBAL(name) DEFINE_GLOBAL(name, #name)
-KHTML_ATOMICSTRING_EACH_GLOBAL(CALL_DEFINE_GLOBAL)
+// Define an AtomicString-sized array of pointers to avoid static initialization.
+// Use an array of pointers instead of an array of char in case there is some alignment issue.
+#define DEFINE_GLOBAL(name) \
+ void* name ## Atom[(sizeof(AtomicString) + sizeof(void*) - 1) / sizeof(void*)];
+
+DEFINE_GLOBAL(null)
+DEFINE_GLOBAL(empty)
+DEFINE_GLOBAL(text)
+DEFINE_GLOBAL(comment)
+DEFINE_GLOBAL(star)
void AtomicString::init()
{
-#if AVOID_STATIC_CONSTRUCTORS
static bool initialized;
if (!initialized) {
// Use placement new to initialize the globals.
new (&nullAtom) AtomicString;
new (&emptyAtom) AtomicString("");
-
- #define PLACEMENT_NEW_GLOBAL(name, string) new (&name ## PropertyName) AtomicString(string);
- #define CALL_PLACEMENT_NEW_GLOBAL(name) PLACEMENT_NEW_GLOBAL(name, #name)
- KHTML_ATOMICSTRING_EACH_GLOBAL(CALL_PLACEMENT_NEW_GLOBAL)
+ new (&textAtom) AtomicString("#text");
+ new (&commentAtom) AtomicString("#comment");
+ new (&starAtom) AtomicString("*");
+
initialized = true;
}
-#endif
}
bool operator==(const AtomicString &a, const DOMString &b)
1.5 +5 -7 WebCore/khtml/xml/dom_atomicstring.h
Index: dom_atomicstring.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_atomicstring.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- dom_atomicstring.h 28 Jun 2005 01:54:34 -0000 1.4
+++ dom_atomicstring.h 9 Jul 2005 20:19:21 -0000 1.5
@@ -55,7 +55,7 @@
bool percentage(int &_percentage) const { return m_string.percentage(_percentage); }
khtml::Length* toLengthArray(int& len) const { return m_string.toLengthArray(len); }
khtml::Length* toCoordsArray(int& len) const { return m_string.toCoordsArray(len); }
-
+
bool isNull() const { return m_string.isNull(); }
bool isEmpty() const { return m_string.isEmpty(); }
@@ -109,16 +109,14 @@
// List of property names, passed to a macro so we can do set them up various
// ways without repeating the list.
-#define KHTML_ATOMICSTRING_EACH_GLOBAL(macro)
- // Define external global variables for all property names above (and one more).
+// Define external global variables for the commonly used atomic strings.
#if !KHTML_ATOMICSTRING_HIDE_GLOBALS
extern const AtomicString nullAtom;
extern const AtomicString emptyAtom;
-#define KHTML_ATOMICSTRING_DECLARE_GLOBAL(name) extern const AtomicString name ## PropertyName;
- KHTML_ATOMICSTRING_EACH_GLOBAL(KHTML_ATOMICSTRING_DECLARE_GLOBAL)
- KHTML_ATOMICSTRING_DECLARE_GLOBAL(specialPrototype)
-#undef KHTML_ATOMICSTRING_DECLARE_GLOBAL
+ extern const AtomicString textAtom;
+ extern const AtomicString commentAtom;
+ extern const AtomicString starAtom;
#endif
bool operator==(const AtomicString &a, const DOMString &b);
1.233 +45 -384 WebCore/khtml/xml/dom_docimpl.cpp
Index: dom_docimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_docimpl.cpp,v
retrieving revision 1.232
retrieving revision 1.233
diff -u -r1.232 -r1.233
--- dom_docimpl.cpp 8 Jul 2005 00:20:01 -0000 1.232
+++ dom_docimpl.cpp 9 Jul 2005 20:19:21 -0000 1.233
@@ -34,8 +34,6 @@
#include "xml/dom2_viewsimpl.h"
#include "xml/xml_tokenizer.h"
-#include "xml_namespace_table.h"
-
#include "css/csshelper.h"
#include "css/cssstyleselector.h"
#include "css/css_stylesheetimpl.h"
@@ -65,17 +63,11 @@
#include "khtml_settings.h"
#include "khtmlpart_p.h"
-#include "html/html_baseimpl.h"
-#include "html/html_blockimpl.h"
-#include "html/html_canvasimpl.h"
+// FIXME: We want to cut the remaining HTML dependencies so that we don't need to include these files.
#include "html/html_documentimpl.h"
-#include "html/html_formimpl.h"
#include "html/html_headimpl.h"
#include "html/html_imageimpl.h"
-#include "html/html_listimpl.h"
-#include "html/html_miscimpl.h"
-#include "html/html_tableimpl.h"
-#include "html/html_objectimpl.h"
+#include "htmlfactory.h"
#include "cssvalues.h"
@@ -504,9 +496,9 @@
return static_cast<ElementImpl*>(n);
}
-ElementImpl *DocumentImpl::createElement( const DOMString &name, int &exceptioncode )
+ElementImpl *DocumentImpl::createElement(const DOMString &name, int &exceptionCode)
{
- return new XMLElementImpl( document, name.implementation() );
+ return createElementNS(emptyAtom, name, exceptionCode);
}
DocumentFragmentImpl *DocumentImpl::createDocumentFragment( )
@@ -573,10 +565,8 @@
return createComment(importedNode->nodeValue());
case Node::ELEMENT_NODE: {
ElementImpl *oldElement = static_cast<ElementImpl *>(importedNode);
- DocumentImpl *oldDoc = oldElement->getDocument();
- static DOMString HTMLNamespace(XHTML_NAMESPACE);
- DOMString elementNamespace = oldElement->isHTMLElement() ? HTMLNamespace : oldElement->namespaceURI();
- ElementImpl *newElement = createElementNS(elementNamespace.implementation(), oldElement->tagName(), exceptioncode);
+ // FIXME: Prefix is lost. Is that right?
+ ElementImpl *newElement = createElementNS(oldElement->namespaceURI(), oldElement->localName(), exceptioncode);
if (exceptioncode != 0)
return 0;
@@ -597,7 +587,8 @@
// ### extract and set new prefix
}
- NodeImpl::Id nodeId = attrId(oldDoc->namespaceURI(attr->attrImpl()->id()), localName.implementation(), false /* allocate */);
+ // FIXME: Lose the namespace here for now. This code will change soon anyway.
+ NodeImpl::Id nodeId = attrId(0, localName.implementation(), false /* allocate */);
newElement->setAttribute(nodeId, value.implementation(), exceptioncode);
if (exceptioncode != 0) {
newElement->deref();
@@ -636,28 +627,36 @@
ElementImpl *DocumentImpl::createElementNS( const DOMString &_namespaceURI, const DOMString &_qualifiedName, int &exceptioncode)
{
- ElementImpl *e = 0;
- QString qName = _qualifiedName.string();
- int colonPos = qName.find(':',0);
-
- if (_namespaceURI == XHTML_NAMESPACE) {
- // User requested an element in the XHTML namespace - this means we create a specific element
- // (elements not in this namespace are treated as normal XML elements)
- e = createHTMLElement(qName.mid(colonPos+1), exceptioncode);
- if (exceptioncode)
+ // Split the name.
+ int exceptionCode = 0;
+ ElementImpl* e = 0;
+ DOMString prefix, localName;
+ int colonPos = _qualifiedName.find(':');
+ if (colonPos >= 0) {
+ prefix = _qualifiedName.substring(0, colonPos);
+ localName = _qualifiedName.substring(colonPos+1, _qualifiedName.length() - colonPos);
+ }
+ else
+ localName = _qualifiedName;
+
+ // FIXME: Use registered namespaces and look up in a hash to find the right factory.
+ if (_namespaceURI == HTMLNames::xhtmlNamespaceURI()) {
+ // FIXME: Really should only be done from the public DOM API. Internal callers know the name is valid.
+ if (!isValidName(localName)) {
+ exceptioncode = DOMException::INVALID_CHARACTER_ERR;
return 0;
- if (e && colonPos >= 0) {
- e->setPrefix(qName.left(colonPos), exceptioncode);
- if (exceptioncode) {
- delete e;
+ }
+ e = HTMLElementFactory::createHTMLElement(AtomicString(localName), this, 0, false);
+ if (e && !prefix.isNull()) {
+ e->setPrefix(AtomicString(prefix), exceptionCode);
+ if (exceptionCode)
return 0;
- }
}
}
-
+
if (!e)
- e = new XMLElementImpl( document, _qualifiedName.implementation(), _namespaceURI.implementation() );
-
+ e = new ElementImpl(QualifiedName(AtomicString(prefix), AtomicString(localName), AtomicString(_namespaceURI)), document);
+
return e;
}
@@ -811,220 +810,6 @@
return Node::DOCUMENT_NODE;
}
-ElementImpl *DocumentImpl::createHTMLElement( const DOMString &name, int &exceptioncode )
-{
- if (!isValidName(name)) {
- exceptioncode = DOMException::INVALID_CHARACTER_ERR;
- return 0;
- }
- return createHTMLElement(tagId(0, name.implementation(), false));
-}
-
-ElementImpl *DocumentImpl::createHTMLElement(unsigned short tagID)
-{
- switch (tagID)
- {
- case ID_HTML:
- return new HTMLHtmlElementImpl(docPtr());
- case ID_HEAD:
- return new HTMLHeadElementImpl(docPtr());
- case ID_BODY:
- return new HTMLBodyElementImpl(docPtr());
-
-// head elements
- case ID_BASE:
- return new HTMLBaseElementImpl(docPtr());
- case ID_LINK:
- return new HTMLLinkElementImpl(docPtr());
- case ID_META:
- return new HTMLMetaElementImpl(docPtr());
- case ID_STYLE:
- return new HTMLStyleElementImpl(docPtr());
- case ID_TITLE:
- return new HTMLTitleElementImpl(docPtr());
-
-// frames
- case ID_FRAME:
- return new HTMLFrameElementImpl(docPtr());
- case ID_FRAMESET:
- return new HTMLFrameSetElementImpl(docPtr());
- case ID_IFRAME:
- return new HTMLIFrameElementImpl(docPtr());
-
-// form elements
-// ### FIXME: we need a way to set form dependency after we have made the form elements
- case ID_FORM:
- return new HTMLFormElementImpl(docPtr());
- case ID_BUTTON:
- return new HTMLButtonElementImpl(docPtr());
- case ID_FIELDSET:
- return new HTMLFieldSetElementImpl(docPtr());
- case ID_INPUT:
- return new HTMLInputElementImpl(docPtr());
- case ID_ISINDEX:
- return new HTMLIsIndexElementImpl(docPtr());
- case ID_LABEL:
- return new HTMLLabelElementImpl(docPtr());
- case ID_LEGEND:
- return new HTMLLegendElementImpl(docPtr());
- case ID_OPTGROUP:
- return new HTMLOptGroupElementImpl(docPtr());
- case ID_OPTION:
- return new HTMLOptionElementImpl(docPtr());
- case ID_SELECT:
- return new HTMLSelectElementImpl(docPtr());
- case ID_TEXTAREA:
- return new HTMLTextAreaElementImpl(docPtr());
-
-// lists
- case ID_DL:
- return new HTMLDListElementImpl(docPtr());
- case ID_DD:
- return new HTMLGenericElementImpl(docPtr(), tagID);
- case ID_DT:
- return new HTMLGenericElementImpl(docPtr(), tagID);
- case ID_UL:
- return new HTMLUListElementImpl(docPtr());
- case ID_OL:
- return new HTMLOListElementImpl(docPtr());
- case ID_DIR:
- return new HTMLDirectoryElementImpl(docPtr());
- case ID_MENU:
- return new HTMLMenuElementImpl(docPtr());
- case ID_LI:
- return new HTMLLIElementImpl(docPtr());
-
-// formatting elements (block)
- case ID_BLOCKQUOTE:
- return new HTMLBlockquoteElementImpl(docPtr());
- case ID_DIV:
- return new HTMLDivElementImpl(docPtr());
- case ID_H1:
- case ID_H2:
- case ID_H3:
- case ID_H4:
- case ID_H5:
- case ID_H6:
- return new HTMLHeadingElementImpl(docPtr(), tagID);
- case ID_HR:
- return new HTMLHRElementImpl(docPtr());
- case ID_P:
- return new HTMLParagraphElementImpl(docPtr());
- case ID_PRE:
- case ID_XMP:
- case ID_PLAINTEXT:
- return new HTMLPreElementImpl(docPtr(), tagID);
- case ID_LAYER:
- return new HTMLLayerElementImpl(docPtr());
-
-// font stuff
- case ID_BASEFONT:
- return new HTMLBaseFontElementImpl(docPtr());
- case ID_FONT:
- return new HTMLFontElementImpl(docPtr());
-
-// ins/del
- case ID_DEL:
- case ID_INS:
- return new HTMLModElementImpl(docPtr(), tagID);
-
-// anchor
- case ID_A:
- return new HTMLAnchorElementImpl(docPtr());
-
-// images
- case ID_IMG:
- return new HTMLImageElementImpl(docPtr());
- case ID_MAP:
- return new HTMLMapElementImpl(docPtr());
- case ID_AREA:
- return new HTMLAreaElementImpl(docPtr());
- case ID_CANVAS:
- return new HTMLCanvasElementImpl(docPtr());
-
-// objects, applets and scripts
- case ID_APPLET:
- return new HTMLAppletElementImpl(docPtr());
- case ID_EMBED:
- return new HTMLEmbedElementImpl(docPtr());
- case ID_OBJECT:
- return new HTMLObjectElementImpl(docPtr());
- case ID_PARAM:
- return new HTMLParamElementImpl(docPtr());
- case ID_SCRIPT:
- return new HTMLScriptElementImpl(docPtr());
-
-// tables
- case ID_TABLE:
- return new HTMLTableElementImpl(docPtr());
- case ID_CAPTION:
- return new HTMLTableCaptionElementImpl(docPtr());
- case ID_COLGROUP:
- case ID_COL:
- return new HTMLTableColElementImpl(docPtr(), tagID);
- case ID_TR:
- return new HTMLTableRowElementImpl(docPtr());
- case ID_TD:
- case ID_TH:
- return new HTMLTableCellElementImpl(docPtr(), tagID);
- case ID_THEAD:
- case ID_TBODY:
- case ID_TFOOT:
- return new HTMLTableSectionElementImpl(docPtr(), tagID, false);
-
-// inline elements
- case ID_BR:
- return new HTMLBRElementImpl(docPtr());
- case ID_Q:
- return new HTMLQuoteElementImpl(docPtr());
-
- case ID_MARQUEE:
- return new HTMLMarqueeElementImpl(docPtr());
-
-// elements with no special representation in the DOM
-
-// block:
- case ID_ADDRESS:
- case ID_CENTER:
-
-// inline
- // %fontstyle
- case ID_TT:
- case ID_U:
- case ID_B:
- case ID_I:
- case ID_S:
- case ID_STRIKE:
- case ID_BIG:
- case ID_SMALL:
-
- // %phrase
- case ID_EM:
- case ID_STRONG:
- case ID_DFN:
- case ID_CODE:
- case ID_SAMP:
- case ID_KBD:
- case ID_VAR:
- case ID_CITE:
- case ID_ABBR:
- case ID_ACRONYM:
-
- // %special
- case ID_SUB:
- case ID_SUP:
- case ID_SPAN:
- case ID_NOBR:
- case ID_WBR:
-
- case ID_BDO:
- default:
- return new HTMLGenericElementImpl(docPtr(), tagID);
- }
-
- return 0;
-}
-
QString DocumentImpl::nextState()
{
QString state;
@@ -1465,10 +1250,10 @@
// try to prefer a FRAMESET element over BODY
NodeImpl* body = 0;
for (NodeImpl* i = de->firstChild(); i; i = i->nextSibling()) {
- if (i->id() == ID_FRAMESET)
+ if (i->hasTagName(HTMLNames::frameset()))
return static_cast<HTMLElementImpl*>(i);
- if (i->id() == ID_BODY)
+ if (i->hasTagName(HTMLNames::body()))
body = i;
}
return static_cast<HTMLElementImpl *>(body);
@@ -1598,7 +1383,7 @@
// (c) we have a <body>
return (renderer() && renderer()->needsLayout() && haveStylesheetsLoaded() &&
documentElement() && documentElement()->renderer() &&
- (documentElement()->id() != ID_HTML || body()));
+ (!documentElement()->hasTagName(HTMLNames::html()) || body()));
}
int DocumentImpl::minimumLayoutDelay()
@@ -1722,42 +1507,6 @@
kdDebug(6020) << " using strict parseMode" << endl;
}
-// Please see if there`s a possibility to merge that code
-// with the next function and getElementByID().
-NodeImpl *DocumentImpl::findElement( Id id )
-{
- QPtrStack<NodeImpl> nodeStack;
- NodeImpl *current = _first;
-
- while(1)
- {
- if(!current)
- {
- if(nodeStack.isEmpty()) break;
- current = nodeStack.pop();
- current = current->nextSibling();
- }
- else
- {
- if(current->id() == id)
- return current;
-
- NodeImpl *child = current->firstChild();
- if(child)
- {
- nodeStack.push(current);
- current = child;
- }
- else
- {
- current = current->nextSibling();
- }
- }
- }
-
- return 0;
-}
-
NodeImpl *DocumentImpl::nextFocusNode(NodeImpl *fromNode)
{
unsigned short fromTabIndex;
@@ -2138,7 +1887,7 @@
// First see if it's a HTML attribute name
QConstString n(_name->s, _name->l);
- if (!_namespaceURI || !strcasecmp(_namespaceURI, XHTML_NAMESPACE)) {
+ if (!_namespaceURI) {
// we're in HTML namespace if we know the tag.
// xhtml is lower case - case sensitive, easy to implement
if ( htmlMode() == XHtml && (id = getAttrID(n.string().ascii(), _name->l)) )
@@ -2152,12 +1901,13 @@
// now lets find out the namespace
Q_UINT16 ns = noNamespace;
+ /* FIXME: Just break namespaced attributes for now. Will fix in next stage of QualifiedName conversion.
if (_namespaceURI) {
DOMString nsU(_namespaceURI);
int nsID = XmlNamespaceTable::getNamespaceID(nsU, readonly);
if (nsID != -1)
ns = (Q_UINT16)nsID;
- }
+ }*/
// Look in the m_attrNames array for the name
// ### yeah, this is lame. use a dictionary / map instead
@@ -2208,95 +1958,6 @@
return result;
}
-NodeImpl::Id DocumentImpl::tagId(DOMStringImpl* _namespaceURI, DOMStringImpl *_name, bool readonly)
-{
- if (!_name) return 0;
- // Each document maintains a mapping of tag name -> id for every tag name encountered
- // in the document.
- NodeImpl::Id id = 0;
-
- // First see if it's a HTML element name
- QConstString n(_name->s, _name->l);
- if (!_namespaceURI || !strcasecmp(_namespaceURI, XHTML_NAMESPACE)) {
- // we're in HTML namespace if we know the tag.
- // xhtml is lower case - case sensitive, easy to implement
- if ( htmlMode() == XHtml && (id = getTagID(n.string().ascii(), _name->l)) )
- return id;
- // compatibility: upper case - case insensitive
- if ( htmlMode() != XHtml && (id = getTagID(n.string().lower().ascii(), _name->l )) )
- return id;
-
- // ok, the fast path didn't work out, we need the full check
- }
-
- // now lets find out the namespace
- Q_UINT16 ns = noNamespace;
- if (_namespaceURI) {
- DOMString nsU(_namespaceURI);
- int nsID = XmlNamespaceTable::getNamespaceID(nsU, readonly);
- if (nsID != -1)
- ns = (Q_UINT16)nsID;
- }
-
- // Look in the m_elementNames array for the name
- // ### yeah, this is lame. use a dictionary / map instead
- DOMString nme(n.string());
- // compatibility mode has to store upper case
- if (htmlMode() != XHtml) nme = nme.upper();
- for (id = 0; id < m_elementNameCount; id++)
- if (DOMString(m_elementNames[id]) == nme)
- return makeId(ns, ID_LAST_TAG + 1 + id);
-
- // unknown
- if (readonly) return 0;
-
- // Name not found in m_elementNames, so let's add it
- if (m_elementNameCount+1 > m_elementNameAlloc) {
- m_elementNameAlloc += 100;
- DOMStringImpl **newNames = new DOMStringImpl* [m_elementNameAlloc];
- // ### yeah, this is lame. use a dictionary / map instead
- if (m_elementNames) {
- unsigned short i;
- for (i = 0; i < m_elementNameCount; i++)
- newNames[i] = m_elementNames[i];
- delete [] m_elementNames;
- }
- m_elementNames = newNames;
- }
-
- id = m_elementNameCount++;
- m_elementNames[id] = nme.implementation();
- m_elementNames[id]->ref();
-
- return makeId(ns, ID_LAST_TAG + 1 + id);
-}
-
-DOMString DocumentImpl::tagName(NodeImpl::Id _id) const
-{
- if (localNamePart(_id) > ID_LAST_TAG)
- return m_elementNames[localNamePart(_id) - (ID_LAST_TAG + 1)];
- else {
- // ### put them in a cache
- if (htmlMode() == XHtml)
- return getTagName(_id).lower();
- else
- return getTagName(_id);
- }
-}
-
-
-DOMStringImpl* DocumentImpl::namespaceURI(NodeImpl::Id _id) const
-{
- if (_id <= ID_LAST_TAG)
- return htmlMode() == XHtml ? XmlNamespaceTable::getNamespaceURI(xhtmlNamespace).implementation() : 0;
-
- unsigned short ns = _id >> 16;
-
- if (!ns) return 0;
-
- return XmlNamespaceTable::getNamespaceURI(ns).implementation();
-}
-
StyleSheetListImpl* DocumentImpl::styleSheets()
{
return m_styleSheets;
@@ -2420,11 +2081,11 @@
}
}
- else if (n->isHTMLElement() && (n->id() == ID_LINK || n->id() == ID_STYLE)) {
- ElementImpl *e = static_cast<ElementImpl *>(n);
+ else if (n->isHTMLElement() && (n->hasTagName(HTMLNames::link()) || n->hasTagName(HTMLNames::style()))) {
+ HTMLElementImpl *e = static_cast<HTMLElementImpl *>(n);
QString title = e->getAttribute( ATTR_TITLE ).string();
bool enabledViaScript = false;
- if (n->id() == ID_LINK) {
+ if (e->hasLocalName(HTMLNames::link())) {
// <LINK> element
HTMLLinkElementImpl* l = static_cast<HTMLLinkElementImpl*>(n);
if (l->isLoading() || l->isDisabled())
@@ -2436,7 +2097,7 @@
// Get the current preferred styleset. This is the
// set of sheets that will be enabled.
- if ( n->id() == ID_LINK )
+ if (e->hasLocalName(HTMLNames::link()))
sheet = static_cast<HTMLLinkElementImpl*>(n)->sheet();
else
// <STYLE> element
@@ -2453,7 +2114,7 @@
// us as the preferred set. Otherwise, just ignore
// this sheet.
QString rel = e->getAttribute( ATTR_REL ).string();
- if (n->id() == ID_STYLE || !rel.contains("alternate"))
+ if (e->hasLocalName(HTMLNames::style()) || !rel.contains("alternate"))
m_preferredStylesheetSet = view()->part()->d->m_sheetUsed = title;
}
@@ -2472,7 +2133,7 @@
// For HTML documents, stylesheets are not allowed within/after the <BODY> tag. So we
// can stop searching here.
- if (isHTMLDocument() && n->id() == ID_BODY)
+ if (isHTMLDocument() && n->hasTagName(HTMLNames::body()))
break;
}
1.116 +2 -15 WebCore/khtml/xml/dom_docimpl.h
Index: dom_docimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_docimpl.h,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -r1.115 -r1.116
--- dom_docimpl.h 22 Jun 2005 18:22:02 -0000 1.115
+++ dom_docimpl.h 9 Jul 2005 20:19:21 -0000 1.116
@@ -177,7 +177,7 @@
DOMImplementationImpl *implementation() const;
virtual ElementImpl *documentElement() const;
- virtual ElementImpl *createElement ( const DOMString &tagName, int &exceptioncode );
+ virtual ElementImpl *createElement(const DOMString &tagName, int &exceptioncode);
DocumentFragmentImpl *createDocumentFragment ();
TextImpl *createTextNode ( const DOMString &data );
CommentImpl *createComment ( const DOMString &data );
@@ -188,7 +188,7 @@
AttrImpl *createAttributeNS(const DOMString &namespaceURI, const DOMString &qualifiedName, int &exception);
EntityReferenceImpl *createEntityReference ( const DOMString &name );
NodeImpl *importNode( NodeImpl *importedNode, bool deep, int &exceptioncode );
- virtual ElementImpl *createElementNS ( const DOMString &_namespaceURI, const DOMString &_qualifiedName, int &exceptioncode );
+ virtual ElementImpl *createElementNS(const DOMString &_namespaceURI, const DOMString &_qualifiedName, int &exceptioncode);
ElementImpl *getElementById ( const DOMString &elementId ) const;
ElementImpl *elementFromPoint ( const int _x, const int _y ) const;
@@ -218,9 +218,6 @@
virtual bool isDocumentNode() const { return true; }
virtual bool isHTMLDocument() const { return false; }
- ElementImpl *createHTMLElement(const DOMString &tagName, int &exceptioncode);
- ElementImpl *createHTMLElement(unsigned short tagID);
-
khtml::CSSStyleSelector *styleSelector() { return m_styleSelector; }
ElementImpl *DocumentImpl::getElementByAccessKey( const DOMString &key );
@@ -387,9 +384,6 @@
void resetVisitedLinkColor();
void resetActiveLinkColor();
- // internal
- NodeImpl *findElement( Id id );
-
bool prepareMouseEvent( bool readonly, int x, int y, MouseEvent *ev );
virtual bool childAllowed( NodeImpl *newChild );
@@ -399,16 +393,9 @@
// ### think about implementing ref'counting for the id's
// in order to be able to reassign those that are no longer in use
// (could make problems when it is still kept somewhere around, i.e. styleselector)
- NodeImpl::Id tagId(DOMStringImpl* _namespaceURI, DOMStringImpl *_name, bool readonly);
- DOMString tagName(NodeImpl::Id _id) const;
-
NodeImpl::Id attrId(DOMStringImpl* _namespaceURI, DOMStringImpl *_name, bool readonly);
DOMString attrName(NodeImpl::Id _id) const;
- // the namespace uri is mapped to the same id for both
- // tagnames as well as attributes.
- DOMStringImpl* namespaceURI(NodeImpl::Id _id) const;
-
StyleSheetListImpl* styleSheets();
/* Newly proposed CSS3 mechanism for selecting alternate
1.68 +43 -86 WebCore/khtml/xml/dom_elementimpl.cpp
Index: dom_elementimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_elementimpl.cpp,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- dom_elementimpl.cpp 11 May 2005 05:49:35 -0000 1.67
+++ dom_elementimpl.cpp 9 Jul 2005 20:19:21 -0000 1.68
@@ -33,7 +33,6 @@
#include "khtml_part.h"
-#include "html/dtd.h"
#include "html/htmlparser.h"
#include "rendering/render_canvas.h"
@@ -90,18 +89,18 @@
return Node::ATTRIBUTE_NODE;
}
-DOMString AttrImpl::prefix() const
+const AtomicString& AttrImpl::prefix() const
{
return m_attribute->prefix();
}
-void AttrImpl::setPrefix(const DOMString &_prefix, int &exceptioncode )
+void AttrImpl::setPrefix(const AtomicString &_prefix, int &exceptioncode )
{
checkSetPrefix(_prefix, exceptioncode);
if (exceptioncode)
return;
- m_attribute->setPrefix(_prefix.implementation());
+ m_attribute->setPrefix(_prefix);
}
DOMString AttrImpl::nodeValue() const
@@ -202,11 +201,10 @@
// -------------------------------------------------------------------------
-ElementImpl::ElementImpl(DocumentPtr *doc)
- : ContainerNodeImpl(doc)
+ElementImpl::ElementImpl(const QualifiedName& qName, DocumentPtr *doc)
+ : ContainerNodeImpl(doc), m_tagName(qName)
{
namedAttrMap = 0;
- m_prefix = 0;
}
ElementImpl::~ElementImpl()
@@ -215,9 +213,22 @@
namedAttrMap->detachFromElement();
namedAttrMap->deref();
}
+}
- if (m_prefix)
- m_prefix->deref();
+NodeImpl *ElementImpl::cloneNode(bool deep)
+{
+ int exceptionCode = 0;
+ ElementImpl *clone = getDocument()->createElementNS(namespaceURI(), nodeName(), exceptionCode);
+ assert(!exceptionCode);
+
+ // clone attributes
+ if (namedAttrMap)
+ *clone->attributes() = *namedAttrMap;
+
+ if (deep)
+ cloneChildNodes(clone);
+
+ return clone;
}
void ElementImpl::removeAttribute( NodeImpl::Id id, int &exceptioncode )
@@ -351,36 +362,24 @@
bool ElementImpl::hasAttributes() const
{
updateStyleAttributeIfNeeded();
-
return namedAttrMap && namedAttrMap->length() > 0;
}
DOMString ElementImpl::nodeName() const
{
- return tagName();
-}
-
-DOMString ElementImpl::tagName() const
-{
- DOMString tn = getDocument()->tagName(id());
-
- if (m_prefix)
- return DOMString(m_prefix) + ":" + tn;
-
+ DOMString tn = m_tagName.localName();
+ if (m_tagName.hasPrefix())
+ return DOMString(m_tagName.prefix()) + ":" + tn;
return tn;
}
-void ElementImpl::setPrefix( const DOMString &_prefix, int &exceptioncode )
+void ElementImpl::setPrefix(const AtomicString &_prefix, int &exceptioncode)
{
checkSetPrefix(_prefix, exceptioncode);
if (exceptioncode)
return;
- if (m_prefix)
- m_prefix->deref();
- m_prefix = _prefix.implementation();
- if (m_prefix)
- m_prefix->ref();
+ m_tagName.setPrefix(_prefix);
}
void ElementImpl::createAttributeMap() const
@@ -521,18 +520,6 @@
setHasChangedChild( false );
}
-// DOM Section 1.1.1
-bool ElementImpl::childAllowed( NodeImpl *newChild )
-{
- if (!childTypeAllowed(newChild->nodeType()))
- return false;
-
- // For XML documents, we are non-validating and do not check against a DTD, even for HTML elements.
- if (getDocument()->isHTMLDocument())
- return checkChild(id(), newChild->id(), !getDocument()->inCompatMode());
- return true;
-}
-
bool ElementImpl::childTypeAllowed( unsigned short type )
{
switch (type) {
@@ -569,7 +556,7 @@
DOMString ElementImpl::openTagStartToString() const
{
- DOMString result = DOMString("<") + tagName();
+ DOMString result = DOMString("<") + nodeName();
NamedAttrMapImpl *attrMap = attributes(true);
@@ -610,7 +597,7 @@
}
result += "</";
- result += tagName();
+ result += nodeName();
result += ">";
} else {
result += " />";
@@ -759,12 +746,7 @@
// -------------------------------------------------------------------------
-XMLElementImpl::XMLElementImpl(DocumentPtr *doc, DOMStringImpl *_tagName)
- : ElementImpl(doc)
-{
- m_id = doc->document()->tagId(0 /* no namespace */, _tagName, false /* allocate */);
-}
-
+/*
XMLElementImpl::XMLElementImpl(DocumentPtr *doc, DOMStringImpl *_qualifiedName, DOMStringImpl *_namespaceURI)
: ElementImpl(doc)
{
@@ -780,49 +762,24 @@
DOMStringImpl* localName = _qualifiedName->copy();
localName->ref();
localName->remove(0,colonpos+1);
- m_id = doc->document()->tagId(_namespaceURI, localName, false /* allocate */);
+ m_id = doc->document()->tagId(_namespaceURI, localName, false);
localName->deref();
- m_prefix = _qualifiedName->copy();
- m_prefix->ref();
- m_prefix->truncate(colonpos);
+
+ // FIXME: This is a temporary situation for stage one of the QualifiedName patch. This is also a really stupid way to
+ // have to handle the prefix. Way too much copying. We should make sure the XML tokenizer has done the split
+ // already into prefix and localName.
+ DOMStringImpl* prefix = _qualifiedName->copy();
+ prefix->ref();
+ prefix->truncate(colonpos);
+ m_tagName = QualifiedName(prefix, nullAtom, nullAtom);
+ prefix->deref();
}
- else {
+ else
// no prefix
- m_id = doc->document()->tagId(_namespaceURI, _qualifiedName, false /* allocate */);
- m_prefix = 0;
- }
+ m_id = doc->document()->tagId(_namespaceURI, _qualifiedName, false);
}
-XMLElementImpl::~XMLElementImpl()
-{
-}
-
-DOMString XMLElementImpl::localName() const
-{
- return getDocument()->tagName(m_id);
-}
-
-DOMString XMLElementImpl::namespaceURI() const
-{
- return getDocument()->namespaceURI(m_id);
-}
-
-NodeImpl *XMLElementImpl::cloneNode ( bool deep )
-{
- // ### we lose namespace here FIXME
- // should pass id around
- XMLElementImpl *clone = new XMLElementImpl(docPtr(), getDocument()->tagName(m_id).implementation());
- clone->m_id = m_id;
-
- // clone attributes
- if (namedAttrMap)
- *clone->attributes(false) = *namedAttrMap;
-
- if (deep)
- cloneChildNodes(clone);
-
- return clone;
-}
+*/
// -------------------------------------------------------------------------
@@ -1270,8 +1227,8 @@
}
}
-StyledElementImpl::StyledElementImpl(DocumentPtr *doc)
- : ElementImpl(doc)
+StyledElementImpl::StyledElementImpl(const QualifiedName& name, DocumentPtr *doc)
+ : ElementImpl(name, doc)
{
m_inlineStyleDecl = 0;
m_isStyleAttributeValid = true;
1.43 +21 -35 WebCore/khtml/xml/dom_elementimpl.h
Index: dom_elementimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_elementimpl.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- dom_elementimpl.h 9 Jul 2005 00:30:58 -0000 1.42
+++ dom_elementimpl.h 9 Jul 2005 20:19:22 -0000 1.43
@@ -23,13 +23,14 @@
* Boston, MA 02111-1307, USA.
*
*/
-#ifndef _DOM_ELEMENTImpl_h_
-#define _DOM_ELEMENTImpl_h_
+#ifndef _DOM_ELEMENTIMPL_h_
+#define _DOM_ELEMENTIMPL_h_
#include "dom_nodeimpl.h"
#include "xml/dom_stringimpl.h"
#include "misc/shared.h"
#include "css/css_valueimpl.h"
+#include "dom_qname.h"
#if APPLE_CHANGES
#ifdef __OBJC__
@@ -128,8 +129,8 @@
// DOM methods overridden from parent classes
virtual DOMString nodeName() const;
virtual unsigned short nodeType() const;
- virtual DOMString prefix() const;
- virtual void setPrefix(const DOMString &_prefix, int &exceptioncode );
+ virtual const AtomicString& prefix() const;
+ virtual void setPrefix(const AtomicString &_prefix, int &exceptioncode );
virtual DOMString nodeValue() const;
virtual void setNodeValue( const DOMString &, int &exceptioncode );
@@ -156,7 +157,7 @@
friend class NodeImpl;
friend class khtml::CSSStyleSelector;
public:
- ElementImpl(DocumentPtr *doc);
+ ElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
~ElementImpl();
// Used to quickly determine whether or not an element has a given CSS class.
@@ -186,15 +187,23 @@
SharedPtr<AttrImpl> setAttributeNodeNS(AttrImpl *newAttr, int &exception) { return setAttributeNode(newAttr, exception); }
SharedPtr<AttrImpl> removeAttributeNode(AttrImpl *oldAttr, int &exception);
- DOMString prefix() const { return m_prefix; }
- void setPrefix(const DOMString &_prefix, int &exceptioncode );
-
virtual CSSStyleDeclarationImpl *style();
+ virtual const QualifiedName& tagName() const { return m_tagName; }
+ virtual bool hasTagName(const QualifiedName& tagName) const { return m_tagName.matches(tagName); }
+
+ // A fast function for checking the local name against another atomic string.
+ bool hasLocalName(const AtomicString& other) const { return m_tagName.localName() == other; }
+ bool hasLocalName(const QualifiedName& other) const { return m_tagName.localName() == other.localName(); }
+
+ virtual const AtomicString& localName() const { return m_tagName.localName(); }
+ virtual const AtomicString& prefix() const { return m_tagName.prefix(); }
+ virtual void setPrefix(const AtomicString &_prefix, int &exceptioncode);
+ virtual const AtomicString& namespaceURI() const { return m_tagName.namespaceURI(); }
+
// DOM methods overridden from parent classes
- virtual DOMString tagName() const;
virtual unsigned short nodeType() const;
- virtual NodeImpl *cloneNode ( bool deep ) = 0;
+ virtual NodeImpl *cloneNode(bool deep);
virtual DOMString nodeName() const;
virtual bool isElementNode() const { return true; }
virtual void insertedIntoDocument();
@@ -221,7 +230,6 @@
virtual void recalcStyle( StyleChange = NoChange );
virtual void mouseEventHandler( MouseEvent */*ev*/, bool /*inside*/ ) {};
- virtual bool childAllowed( NodeImpl *newChild );
virtual bool childTypeAllowed( unsigned short type );
virtual AttributeImpl* createAttribute(Id id, DOMStringImpl* value);
@@ -254,29 +262,7 @@
protected: // member variables
mutable NamedAttrMapImpl *namedAttrMap;
- DOMStringImpl *m_prefix;
-};
-
-
-class XMLElementImpl : public ElementImpl
-{
-
-public:
- XMLElementImpl(DocumentPtr *doc, DOMStringImpl *_tagName);
- XMLElementImpl(DocumentPtr *doc, DOMStringImpl *_qualifiedName, DOMStringImpl *_namespaceURI);
- ~XMLElementImpl();
-
- // DOM methods overridden from parent classes
- virtual DOMString namespaceURI() const;
- virtual DOMString localName() const;
- virtual NodeImpl *cloneNode ( bool deep );
-
- // Other methods (not part of DOM)
- virtual bool isXMLElementNode() const { return true; }
- virtual Id id() const { return m_id; }
-
-protected:
- Id m_id;
+ QualifiedName m_tagName;
};
// the map of attributes of an element
@@ -414,7 +400,7 @@
class StyledElementImpl : public ElementImpl
{
public:
- StyledElementImpl(DocumentPtr *doc);
+ StyledElementImpl(const QualifiedName& tagName, DocumentPtr *doc);
virtual ~StyledElementImpl();
virtual bool isStyledElement() const { return true; }
1.157 +76 -182 WebCore/khtml/xml/dom_nodeimpl.cpp
Index: dom_nodeimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.cpp,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -r1.156 -r1.157
--- dom_nodeimpl.cpp 23 Jun 2005 19:47:50 -0000 1.156
+++ dom_nodeimpl.cpp 9 Jul 2005 20:19:22 -0000 1.157
@@ -27,7 +27,6 @@
#include "dom/dom_exception.h"
#include "dom/dom2_events.h"
#include "misc/htmlattrs.h"
-#include "misc/htmltags.h"
#include "xml/dom_elementimpl.h"
#include "xml/dom_textimpl.h"
#include "xml/dom2_eventsimpl.h"
@@ -50,7 +49,8 @@
#include "khtmlview.h"
#include "khtml_part.h"
-#include "html/dtd.h"
+// FIXME: Should not have to include this. Cut the HTML dependency!
+#include "htmlnames.h"
#ifndef KHTML_NO_XBL
#include "xbl/xbl_binding_manager.h"
@@ -64,9 +64,30 @@
#define LOG(channel, formatAndArgs...) ((void)0)
#endif
-using namespace DOM;
using namespace khtml;
+namespace DOM {
+/**
+ * NodeList which lists all Nodes in a document with a given tag name
+ */
+class TagNodeListImpl : public NodeListImpl
+{
+public:
+ TagNodeListImpl(NodeImpl *n, const AtomicString& namespaceURI, const AtomicString& localName);
+
+ // DOM methods overridden from parent classes
+ virtual unsigned long length() const;
+ virtual NodeImpl *item (unsigned long index) const;
+
+ // Other methods (not part of DOM)
+
+protected:
+ virtual bool nodeMatches(NodeImpl *testNode) const;
+
+ AtomicString m_namespaceURI;
+ AtomicString m_localName;
+};
+
NodeImpl::NodeImpl(DocumentPtr *doc)
: document(doc),
m_previous(0),
@@ -154,7 +175,7 @@
return 0;
}
-NodeImpl *NodeImpl::lastDescendent() const
+NodeImpl *NodeImpl::lastDescendant() const
{
NodeImpl *n = const_cast<NodeImpl *>(this);
while (n && n->lastChild())
@@ -239,13 +260,13 @@
}
}
-DOMString NodeImpl::prefix() const
+const AtomicString& NodeImpl::prefix() const
{
// For nodes other than elements and attributes, the prefix is always null
- return DOMString();
+ return nullAtom;
}
-void NodeImpl::setPrefix(const DOMString &/*_prefix*/, int &exceptioncode )
+void NodeImpl::setPrefix(const AtomicString &/*_prefix*/, int &exceptioncode )
{
// The spec says that for nodes other than elements and attributes, prefix is always null.
// It does not say what to do when the user tries to set the prefix on another type of
@@ -253,14 +274,14 @@
exceptioncode = DOMException::NAMESPACE_ERR;
}
-DOMString NodeImpl::localName() const
+const AtomicString& NodeImpl::localName() const
{
- return DOMString();
+ return emptyAtom;
}
-DOMString NodeImpl::namespaceURI() const
+const AtomicString& NodeImpl::namespaceURI() const
{
- return DOMString();
+ return emptyAtom;
}
void NodeImpl::setFirstChild(NodeImpl *)
@@ -306,12 +327,6 @@
}
}
-bool NodeImpl::isInline() const
-{
- if (m_render) return m_render->style()->display() == khtml::INLINE;
- return !isElementNode();
-}
-
bool NodeImpl::isFocusable() const
{
return false;
@@ -1006,43 +1021,34 @@
return 0;
}
-void NodeImpl::checkSetPrefix(const DOMString &_prefix, int &exceptioncode)
+void NodeImpl::checkSetPrefix(const AtomicString &_prefix, int &exceptioncode)
{
// Perform error checking as required by spec for setting Node.prefix. Used by
// ElementImpl::setPrefix() and AttrImpl::setPrefix()
-#if 0
- // FIXME: Add this check (but not in a way that depends on the C++ DOM!)
- // INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character.
- if (!Element::khtmlValidPrefix(_prefix)) {
- exceptioncode = DOMException::INVALID_CHARACTER_ERR;
- return;
- }
-#endif
-
+ // FIXME: Implement support for INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character.
+
// NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
if (isReadOnly()) {
exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR;
return;
}
- // NAMESPACE_ERR: - Raised if the specified prefix is malformed
+ // FIXME: Implement NAMESPACE_ERR: - Raised if the specified prefix is malformed
+ // We have to comment this out, since it's used for attributes and tag names, and we've only
+ // switched one over.
+ /*
// - if the namespaceURI of this node is null,
// - if the specified prefix is "xml" and the namespaceURI of this node is different from
// "http://www.w3.org/XML/1998/namespace",
// - if this node is an attribute and the specified prefix is "xmlns" and
// the namespaceURI of this node is different from "http://www.w3.org/2000/xmlns/",
// - or if this node is an attribute and the qualifiedName of this node is "xmlns" [Namespaces].
- if (
-#if 0
- // FIXME: Add this check (but not in a way that depends on the C++ DOM!)
- Element::khtmlMalformedPrefix(_prefix) ||
-#endif
- (namespacePart(id()) == noNamespace && id() > ID_LAST_TAG) ||
+ if ((namespacePart(id()) == noNamespace && id() > ID_LAST_TAG) ||
(_prefix == "xml" && DOMString(getDocument()->namespaceURI(id())) != "http://www.w3.org/XML/1998/namespace")) {
exceptioncode = DOMException::NAMESPACE_ERR;
return;
- }
+ }*/
}
void NodeImpl::checkAddChild(NodeImpl *newChild, int &exceptioncode)
@@ -1283,9 +1289,10 @@
return 0;
}
+// FIXME: This code is used by editing. Seems like it could move over there and not pollute NodeImpl.
bool NodeImpl::isAtomicNode() const
{
- return !hasChildNodes() || (id() == ID_OBJECT && renderer() && renderer()->isReplaced());
+ return !hasChildNodes() || (renderer() && renderer()->isWidget());
}
NodeImpl *NodeImpl::previousNodeConsideringAtomicNodes() const
@@ -1402,13 +1409,15 @@
return 1;
}
+// FIXME: Shouldn't these functions be in the editing code? Code that asks questions about HTML in the core DOM class
+// is obviously misplaced.
// method for editing madness, which allows BR,1 as a position, though that is incorrect
long NodeImpl::maxDeepOffset() const
{
if (offsetInCharacters(nodeType()))
return static_cast<const TextImpl*>(this)->length();
- if (id() == ID_BR || (renderer() && renderer()->isReplaced()))
+ if (hasTagName(HTMLNames::br()) || (renderer() && renderer()->isReplaced()))
return 1;
return childNodeCount();
@@ -1464,7 +1473,7 @@
n = n->parentNode();
if (!n)
break;
- if (n->isBlockFlowOrTable() || n->id() == ID_BODY)
+ if (n->isBlockFlowOrTable() || n->hasTagName(HTMLNames::body()))
return static_cast<ElementImpl *>(n);
}
return 0;
@@ -1480,7 +1489,7 @@
n = n->parentNode();
if (!n)
break;
- if (n->isBlockFlow() || n->id() == ID_BODY)
+ if (n->isBlockFlow() || n->hasTagName(HTMLNames::body()))
return static_cast<ElementImpl *>(n);
}
return 0;
@@ -1493,7 +1502,7 @@
while (1) {
p = n->parentNode();
- if (!p || p->isBlockFlow() || p->id() == ID_BODY)
+ if (!p || p->isBlockFlow() || p->hasTagName(HTMLNames::body()))
return static_cast<ElementImpl *>(n);
// Also stop if any previous sibling is a block
for (NodeImpl *sibling = n->previousSibling(); sibling; sibling = sibling->previousSibling()) {
@@ -1512,7 +1521,7 @@
return 0;
NodeImpl *n = const_cast<NodeImpl *>(this);
- if (n->id() == ID_BODY)
+ if (n->hasTagName(HTMLNames::body()))
return static_cast<ElementImpl *>(n);
NodeImpl *result = n->isEditableBlock() ? n : 0;
@@ -1520,7 +1529,7 @@
n = n->parentNode();
if (!n || !n->isContentEditable())
break;
- if (n->id() == ID_BODY) {
+ if (n->hasTagName(HTMLNames::body())) {
result = n;
break;
}
@@ -1540,6 +1549,8 @@
return n ? enclosingBlockFlowElement() == n->enclosingBlockFlowElement() : false;
}
+// FIXME: End of obviously misplaced HTML editing functions. Try to move these out of NodeImpl.
+
void NodeImpl::addEventListener(const DOMString &type, EventListener *listener, bool useCapture)
{
addEventListener(EventImpl::typeToId(type), listener, useCapture);
@@ -1550,25 +1561,15 @@
removeEventListener(EventImpl::typeToId(type), listener, useCapture);
}
-SharedPtr<NodeListImpl> NodeImpl::getElementsByTagNameNS ( const DOMString &namespaceURI, const DOMString &localName )
+SharedPtr<NodeListImpl> NodeImpl::getElementsByTagNameNS(const DOMString &namespaceURI, const DOMString &localName)
{
- if (localName.isNull())
- return SharedPtr<NodeListImpl>();
-
- Id idMask = namespaceMask | localNameMask;
- if (localName[0] == '*')
- idMask &= ~localNameMask;
- if (namespaceURI.isNull() || namespaceURI[0] == '*')
- idMask &= ~namespaceMask;
-
- Id id = 0; // 0 means "all items"
- if ((idMask & localNameMask) || !namespaceURI.isNull()) { // not getElementsByTagName("*")
- id = getDocument()->tagId(namespaceURI.implementation(), localName.implementation(), true);
- if ( !id ) // not found -> we want to return an empty list, not "all items"
- id = (Id)-1; // HACK. HEAD has a cleaner implementation of TagNodeListImpl it seems.
- }
-
- return SharedPtr<NodeListImpl>(new TagNodeListImpl(this, id, idMask));
+ if (namespaceURI.isNull() || localName.isNull())
+ return SharedPtr<NodeListImpl>(); // FIXME: Who cares about this additional check?
+
+ DOMString name = localName;
+ if (getDocument()->isHTMLDocument())
+ name = localName.lower();
+ return SharedPtr<NodeListImpl>(new TagNodeListImpl(this, AtomicString(namespaceURI), AtomicString(name)));
}
bool NodeImpl::isSupported(const DOMString &feature, const DOMString &version)
@@ -1592,13 +1593,6 @@
return 0;
}
-#if APPLE_CHANGES
-NodeImpl::Id NodeImpl::identifier() const
-{
- return id();
-}
-#endif
-
#ifndef NDEBUG
static void appendAttributeDesc(const NodeImpl *node, QString &string, NodeImpl::Id attrID, QString attrDesc)
@@ -1638,7 +1632,7 @@
{
NodeImpl *rootNode;
NodeImpl *node = (NodeImpl *)this;
- while(node->parentNode() != NULL && node->id() != ID_BODY)
+ while (node->parentNode() && !node->hasTagName(HTMLNames::body()))
node = node->parentNode();
rootNode = node;
@@ -2094,11 +2088,8 @@
SharedPtr<NodeImpl> protectNewChild(newChild); // make sure the new child is ref'd and deref'd so we don't leak it
// short check for consistency with DTD
- if(!isXMLElementNode() && !newChild->isXMLElementNode() && !childAllowed(newChild))
- {
- //kdDebug( 6020 ) << "AddChild failed! id=" << id() << ", child->id=" << newChild->id() << endl;
+ if (getDocument()->isHTMLDocument() && !childAllowed(newChild))
return 0;
- }
// just add it...
newChild->setParent(this);
@@ -2536,10 +2527,10 @@
return testNode->parentNode() == rootNode;
}
-TagNodeListImpl::TagNodeListImpl(NodeImpl *n, NodeImpl::Id _id, NodeImpl::Id _idMask )
+TagNodeListImpl::TagNodeListImpl(NodeImpl *n, const AtomicString& namespaceURI, const AtomicString& localName)
: NodeListImpl(n),
- m_id(_id & _idMask),
- m_idMask(_idMask)
+ m_namespaceURI(namespaceURI),
+ m_localName(localName)
{
}
@@ -2548,15 +2539,20 @@
return recursiveLength();
}
-NodeImpl *TagNodeListImpl::item ( unsigned long index ) const
+NodeImpl *TagNodeListImpl::item(unsigned long index) const
{
- return recursiveItem( index );
+ return recursiveItem(index);
}
-bool TagNodeListImpl::nodeMatches( NodeImpl *testNode ) const
+bool TagNodeListImpl::nodeMatches(NodeImpl *testNode) const
{
- return ( testNode->isElementNode() &&
- (testNode->id() & m_idMask) == m_id);
+ if (!testNode->isElementNode())
+ return false;
+
+ if (m_namespaceURI != starAtom && m_namespaceURI != testNode->namespaceURI())
+ return false;
+
+ return m_localName == starAtom || m_localName == testNode->localName();
}
NameNodeListImpl::NameNodeListImpl(NodeImpl *n, const DOMString &t )
@@ -2595,106 +2591,4 @@
return removeNamedItem(mapId(namespaceURI, localName, true), exception);
}
-// ----------------------------------------------------------------------------
-
-// ### unused
-#if 0
-GenericRONamedNodeMapImpl::GenericRONamedNodeMapImpl(DocumentPtr* doc)
- : NamedNodeMapImpl()
-{
- m_doc = doc->document();
- m_contents = new QPtrList<NodeImpl>;
-}
-
-GenericRONamedNodeMapImpl::~GenericRONamedNodeMapImpl()
-{
- while (m_contents->count() > 0)
- m_contents->take(0)->deref();
-
- delete m_contents;
-}
-
-NodeImpl *GenericRONamedNodeMapImpl::getNamedItem ( const DOMString &name, int &/*exceptioncode*/ ) const
-{
- QPtrListIterator<NodeImpl> it(*m_contents);
- for (; it.current(); ++it)
- if (it.current()->nodeName() == name)
- return it.current();
- return 0;
}
-
-Node GenericRONamedNodeMapImpl::setNamedItem ( const Node &/*arg*/, int &exceptioncode )
-{
- // can't modify this list through standard DOM functions
- // NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly
- exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR;
- return 0;
-}
-
-Node GenericRONamedNodeMapImpl::removeNamedItem ( const DOMString &/*name*/, int &exceptioncode )
-{
- // can't modify this list through standard DOM functions
- // NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly
- exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR;
- return 0;
-}
-
-NodeImpl *GenericRONamedNodeMapImpl::item ( unsigned long index ) const
-{
- // ### check this when calling from javascript using -1 = 2^sizeof(int)-1
- // (also for other similar methods)
- if (index >= m_contents->count())
- return 0;
-
- return m_contents->at(index);
-}
-
-unsigned long GenericRONamedNodeMapImpl::length( ) const
-{
- return m_contents->count();
-}
-
-NodeImpl *GenericRONamedNodeMapImpl::getNamedItemNS( const DOMString &namespaceURI,
- const DOMString &localName,
- int &/*exceptioncode*/ ) const
-{
- NodeImpl::Id searchId = m_doc->tagId(namespaceURI.implementation(),
- localName.implementation(), true);
-
- QPtrListIterator<NodeImpl> it(*m_contents);
- for (; it.current(); ++it)
- if (it.current()->id() == searchId)
- return it.current();
-
- return 0;
-}
-
-NodeImpl *GenericRONamedNodeMapImpl::setNamedItemNS( NodeImpl */*arg*/, int &exceptioncode )
-{
- // can't modify this list through standard DOM functions
- // NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly
- exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR;
- return 0;
-}
-
-NodeImpl *GenericRONamedNodeMapImpl::removeNamedItemNS( const DOMString &/*namespaceURI*/,
- const DOMString &/*localName*/,
- int &exceptioncode )
-{
- // can't modify this list through standard DOM functions
- exceptioncode = DOMException::NO_MODIFICATION_ALLOWED_ERR;
- return 0;
-}
-
-void GenericRONamedNodeMapImpl::addNode(NodeImpl *n)
-{
- // The spec says that in the case of duplicates we only keep the first one
- int exceptioncode = 0;
- if (getNamedItem(n->nodeName(),exceptioncode))
- return;
-
- n->ref();
- m_contents->append(n);
-}
-
-#endif
1.88 +21 -61 WebCore/khtml/xml/dom_nodeimpl.h
Index: dom_nodeimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.h,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- dom_nodeimpl.h 23 Jun 2005 19:47:50 -0000 1.87
+++ dom_nodeimpl.h 9 Jul 2005 20:19:22 -0000 1.88
@@ -59,11 +59,9 @@
class EventListener;
class NodeListImpl;
class NamedAttrMapImpl;
+class QualifiedName;
class RegisteredEventListener;
-// The namespace used for XHTML elements
-#define XHTML_NAMESPACE "http://www.w3.org/1999/xhtml"
-
const Q_UINT16 noNamespace = 0;
const Q_UINT16 anyNamespace = 1;
const Q_UINT16 xhtmlNamespace = 2;
@@ -102,6 +100,7 @@
MAIN_THREAD_ALLOCATED;
// DOM methods & attributes for Node
+ virtual bool hasTagName(const QualifiedName& tagName) const { return false; }
virtual DOMString nodeName() const = 0;
virtual DOMString nodeValue() const;
virtual void setNodeValue( const DOMString &_nodeValue, int &exceptioncode );
@@ -122,14 +121,14 @@
virtual void remove(int &exceptioncode);
virtual bool hasChildNodes ( ) const;
virtual NodeImpl *cloneNode ( bool deep ) = 0;
- virtual DOMString localName() const;
- virtual DOMString namespaceURI() const;
- virtual DOMString prefix() const;
- virtual void setPrefix(const DOMString &_prefix, int &exceptioncode );
+ virtual const AtomicString& localName() const;
+ virtual const AtomicString& namespaceURI() const;
+ virtual const AtomicString& prefix() const;
+ virtual void setPrefix(const AtomicString &_prefix, int &exceptioncode);
void normalize ();
static bool isSupported(const DOMString &feature, const DOMString &version);
- NodeImpl *lastDescendent() const;
+ NodeImpl *lastDescendant() const;
// Other methods (not part of DOM)
virtual bool isElementNode() const { return false; }
@@ -137,8 +136,8 @@
virtual bool isStyledElement() const { return false; }
virtual bool isAttributeNode() const { return false; }
virtual bool isTextNode() const { return false; }
+ virtual bool isCommentNode() const { return false; }
virtual bool isDocumentNode() const { return false; }
- virtual bool isXMLElementNode() const { return false; }
bool isBlockFlow() const;
bool isBlockFlowOrTable() const;
@@ -188,35 +187,18 @@
bool inSameRootEditableElement(NodeImpl *);
bool inSameContainingBlockFlowElement(NodeImpl *);
- // used by the parser. Doesn't do as many error checkings as
- // appendChild(), and returns the node into which will be parsed next.
+ // used by the parser. Checks against the DTD, unlike DOM operations like
+ // appendChild(), and returns the new container node for future insertions as you parse.
virtual NodeImpl *addChild(NodeImpl *newChild);
// called by the parser when this element's close tag is reached,
// signalling that all child tags have been parsed and added.
// This is only needed for <applet> and <object> elements, which can't lay themselves out
// until they know all of their nested <param>s. [3603191, 4040848]
- virtual void closeRenderer() { }
+ virtual void closeRenderer() {}
+
+ typedef Q_UINT32 Id; // FIXME: Yank this once attributes are also switched over.
- typedef Q_UINT32 Id;
- // id() is used to easily and exactly identify a node. It
- // is optimized for quick comparison and low memory consumption.
- // its value depends on the owner document of the node and is
- // categorized in the following way:
- // 1..ID_LAST_TAG: the node inherits HTMLElementImpl and is
- // part of the HTML namespace.
- // The HTML namespace is either the global
- // one (no namespace) or the XHTML namespace
- // depending on the owner document's doctype
- // ID_LAST_TAG+1..0xffff: non-HTML elements in the global namespace
- // others non-HTML elements in a namespace.
- // the upper 16 bit identify the namespace
- // the lower 16 bit identify the local part of the
- // qualified element name.
- virtual Id id() const { return 0; };
-#if APPLE_CHANGES
- Id identifier() const;
-#endif
enum MouseEventType {
MousePress,
MouseRelease,
@@ -278,8 +260,6 @@
virtual bool isKeyboardFocusable() const;
virtual bool isMouseFocusable() const;
- virtual bool isInline() const;
-
virtual bool isContentEditable() const;
virtual QRect getRect() const;
@@ -369,11 +349,15 @@
khtml::RenderObject *previousRenderer();
void setRenderer(khtml::RenderObject* renderer) { m_render = renderer; }
- void checkSetPrefix(const DOMString &_prefix, int &exceptioncode);
- void checkAddChild(NodeImpl *newChild, int &exceptioncode);
+ void checkSetPrefix(const AtomicString &_prefix, int &exceptioncode);
bool isAncestor(const NodeImpl *) const;
- virtual bool childAllowed( NodeImpl *newChild );
+ // These two methods are mutually exclusive. The former is used to do strict error-checking
+ // when adding children via the public DOM API (e.g., appendChild()). The latter is called only when parsing,
+ // to sanity-check against the DTD for error recovery.
+ void checkAddChild(NodeImpl *newChild, int &exceptioncode); // Error-checking when adding via the DOM API
+ virtual bool childAllowed(NodeImpl *newChild); // Error-checking during parsing that checks the DTD
+
virtual long maxOffset() const;
long maxDeepOffset() const;
virtual long caretMinOffset() const;
@@ -481,7 +465,7 @@
void notifyNodeListsSubtreeModified();
void notifyLocalNodeListsSubtreeModified();
- SharedPtr<NodeListImpl> getElementsByTagName(const DOMString &name) { return getElementsByTagNameNS(DOMString(), name); }
+ SharedPtr<NodeListImpl> getElementsByTagName(const DOMString &name) { return getElementsByTagNameNS("*", name); }
SharedPtr<NodeListImpl> getElementsByTagNameNS(const DOMString &namespaceURI, const DOMString &localName);
private: // members
@@ -618,30 +602,6 @@
virtual bool nodeMatches( NodeImpl *testNode ) const;
};
-
-/**
- * NodeList which lists all Nodes in a document with a given tag name
- */
-class TagNodeListImpl : public NodeListImpl
-{
-public:
- TagNodeListImpl( NodeImpl *n, NodeImpl::Id tagId, NodeImpl::Id tagIdMask );
-
- // DOM methods overridden from parent classes
-
- virtual unsigned long length() const;
- virtual NodeImpl *item ( unsigned long index ) const;
-
- // Other methods (not part of DOM)
-
-protected:
- virtual bool nodeMatches( NodeImpl *testNode ) const;
-
- NodeImpl::Id m_id;
- NodeImpl::Id m_idMask;
-};
-
-
/**
* NodeList which lists all Nodes in a Element with a given "name=" tag
*/
1.72 +7 -7 WebCore/khtml/xml/dom_position.cpp
Index: dom_position.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_position.cpp,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- dom_position.cpp 21 Jun 2005 18:11:10 -0000 1.71
+++ dom_position.cpp 9 Jul 2005 20:19:22 -0000 1.72
@@ -35,7 +35,6 @@
#include "dom2_rangeimpl.h"
#include "dom2_viewsimpl.h"
#include "helper.h"
-#include "htmltags.h"
#include "text_affinity.h"
#include "visible_position.h"
#include "visible_units.h"
@@ -45,6 +44,7 @@
#include "rendering/render_style.h"
#include "rendering/render_text.h"
#include "editing/visible_text.h"
+#include "htmlnames.h"
#if APPLE_CHANGES
#include "KWQAssertions.h"
@@ -440,7 +440,7 @@
// stop before going above the body, up into the head
// return the last visible streamer position
- if (currentNode->id() == ID_BODY && currentOffset >= (int) currentNode->childNodeCount())
+ if (currentNode->hasTagName(HTMLNames::body()) && currentOffset >= (int) currentNode->childNodeCount())
break;
// limit traversal to block or table enclosing the original element
@@ -694,7 +694,7 @@
return false;
if (node() == pos.node()) {
- if (node()->id() == ID_BR)
+ if (node()->hasTagName(HTMLNames::br()))
return false;
if (offset() == pos.offset())
@@ -706,10 +706,10 @@
}
}
- if (node()->id() == ID_BR && pos.inRenderedContent())
+ if (node()->hasTagName(HTMLNames::br()) && pos.inRenderedContent())
return true;
- if (pos.node()->id() == ID_BR && inRenderedContent())
+ if (pos.node()->hasTagName(HTMLNames::br()) && inRenderedContent())
return true;
if (node()->enclosingBlockFlowElement() != pos.node()->enclosingBlockFlowElement())
@@ -764,7 +764,7 @@
if (isNull())
return Position();
- if (upstream().node()->id() == ID_BR)
+ if (upstream().node()->hasTagName(HTMLNames::br()))
return Position();
Position prev = previousCharacterPosition(affinity);
@@ -794,7 +794,7 @@
}
}
- if (downstream().node()->id() == ID_BR)
+ if (downstream().node()->hasTagName(HTMLNames::br()))
return Position();
Position next = nextCharacterPosition(affinity);
1.3 +89 -54 WebCore/khtml/xml/dom_qname.cpp
Index: dom_qname.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_qname.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- dom_qname.cpp 16 Jun 2005 21:06:46 -0000 1.2
+++ dom_qname.cpp 9 Jul 2005 20:19:22 -0000 1.3
@@ -19,48 +19,98 @@
* Boston, MA 02111-1307, USA.
*/
-#include <qptrdict.h>
#include "dom_qname.h"
+#include "misc/hashset.h"
+
+using khtml::HashSet;
namespace DOM {
-static QPtrDict<QPtrDict<QPtrDict<QualifiedName::QualifiedNameImpl> > >* gNameCache = 0;
+struct QualifiedNameComponents {
+ DOMStringImpl *m_prefix;
+ DOMStringImpl *m_localName;
+ DOMStringImpl *m_namespace;
+};
-QualifiedName::QualifiedName(const AtomicString& p, const AtomicString& l, const AtomicString& n)
+// Golden ratio - arbitrary start value to avoid mapping all 0's to all 0's
+static const unsigned PHI = 0x9e3779b9U;
+
+inline unsigned hashComponents(const QualifiedNameComponents& buf)
{
- // Obtain an appropriate inner from our dictionary.
- QPtrDict<QPtrDict<QualifiedNameImpl> >* namespaceDict = 0;
- QPtrDict<QualifiedNameImpl>* prefixDict = 0;
- if (gNameCache) {
- namespaceDict = gNameCache->find((void*)(n.implementation()));
- if (namespaceDict) {
- prefixDict = namespaceDict->find((void*)p.implementation());
- if (prefixDict)
- m_impl = prefixDict->find((void*)l.implementation());
- }
- }
-
- if (!m_impl) {
- m_impl = new QualifiedNameImpl(p, l, n);
-
- // Put the object into the hash.
- if (!gNameCache)
- gNameCache = new QPtrDict<QPtrDict<QPtrDict<QualifiedNameImpl> > >;
-
- if (!namespaceDict) {
- namespaceDict = new QPtrDict<QPtrDict<QualifiedNameImpl> >;
- namespaceDict->setAutoDelete(true);
- gNameCache->insert((void*)n.implementation(), namespaceDict);
- }
-
- if (!prefixDict) {
- prefixDict = new QPtrDict<QualifiedNameImpl>;
- namespaceDict->insert((void*)p.implementation(), prefixDict);
- }
+ unsigned l = sizeof(QualifiedNameComponents) / sizeof(uint16_t);
+ const uint16_t *s = reinterpret_cast<const uint16_t*>(&buf);
+ uint32_t hash = PHI;
+ uint32_t tmp;
- prefixDict->insert((void*)l.implementation(), m_impl);
+ int rem = l & 1;
+ l >>= 1;
+
+ // Main loop
+ for (; l > 0; l--) {
+ hash += s[0];
+ tmp = (s[1] << 11) ^ hash;
+ hash = (hash << 16) ^ tmp;
+ s += 2;
+ hash += hash >> 11;
}
+ // Handle end case
+ if (rem) {
+ hash += s[0];
+ hash ^= hash << 11;
+ hash += hash >> 17;
+ }
+
+ // Force "avalanching" of final 127 bits
+ hash ^= hash << 3;
+ hash += hash >> 5;
+ hash ^= hash << 2;
+ hash += hash >> 15;
+ hash ^= hash << 10;
+
+ // this avoids ever returning a hash code of 0, since that is used to
+ // signal "hash not computed yet", using a value that is likely to be
+ // effectively the same as 0 when the low bits are masked
+ if (hash == 0)
+ hash = 0x80000000;
+
+ return hash;
+}
+
+struct QNameHash {
+ static unsigned hash(const QualifiedName::QualifiedNameImpl *name) {
+ QualifiedNameComponents components = { name->m_prefix.implementation(),
+ name->m_localName.implementation(),
+ name->m_namespace.implementation() };
+ return hashComponents(components);
+ }
+ static bool equal(const QualifiedName::QualifiedNameImpl *a, const QualifiedName::QualifiedNameImpl *b) { return a == b; }
+};
+
+typedef HashSet<QualifiedName::QualifiedNameImpl*, QNameHash> QNameSet;
+
+static QNameSet *gNameCache;
+
+inline bool equalComponents(QualifiedName::QualifiedNameImpl* const& name, const QualifiedNameComponents &components)
+{
+ return components.m_localName == name->m_localName.implementation() &&
+ components.m_namespace == name->m_namespace.implementation() &&
+ components.m_prefix == name->m_prefix.implementation();
+}
+
+inline QualifiedName::QualifiedNameImpl *convertComponents(const QualifiedNameComponents& components, unsigned hash)
+{
+ return new QualifiedName::QualifiedNameImpl(components.m_prefix, components.m_localName, components.m_namespace);
+}
+
+
+QualifiedName::QualifiedName(const AtomicString& p, const AtomicString& l, const AtomicString& n)
+ : m_impl(0)
+{
+ if (!gNameCache)
+ gNameCache = new QNameSet;
+ QualifiedNameComponents components = { p.implementation(), l.implementation(), n.implementation() };
+ m_impl = *gNameCache->insert<QualifiedNameComponents, hashComponents, equalComponents, convertComponents>(components).first;
ref();
}
@@ -88,31 +138,16 @@
void QualifiedName::deref()
{
- if (m_impl->refCount() == 1) {
- // Before decrementing the ref to 0, remove ourselves from the hash table.
- QPtrDict<QPtrDict<QualifiedNameImpl> >* namespaceDict = 0;
- QPtrDict<QualifiedNameImpl>* prefixDict = 0;
- if (gNameCache) {
- namespaceDict = gNameCache->find((void*)(namespaceURI().implementation()));
- if (namespaceDict) {
- prefixDict = namespaceDict->find((void*)prefix().implementation());
- if (prefixDict)
- prefixDict->remove((void*)localName().implementation());
- }
- }
- }
-
+ if (m_impl->hasOneRef())
+ gNameCache->remove(m_impl);
+
m_impl->deref();
}
-bool operator==(const AtomicString& a, const QualifiedName& q)
-{
- return a == q.localName();
-}
-
-bool operator==(const QualifiedName& q, const AtomicString& a)
+void QualifiedName::setPrefix(const AtomicString& prefix)
{
- return a == q.localName();
+ QualifiedName other(prefix, localName(), namespaceURI());
+ *this = other;
}
}
1.3 +5 -8 WebCore/khtml/xml/dom_qname.h
Index: dom_qname.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_qname.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- dom_qname.h 16 Jun 2005 21:06:46 -0000 1.2
+++ dom_qname.h 9 Jul 2005 20:19:22 -0000 1.3
@@ -32,9 +32,6 @@
public:
QualifiedNameImpl(const AtomicString& p, const AtomicString& l, const AtomicString& n) :m_prefix(p), m_localName(l), m_namespace(n) {}
- friend class QualifiedName;
-
- private:
AtomicString m_prefix;
AtomicString m_localName;
AtomicString m_namespace;
@@ -47,13 +44,14 @@
QualifiedName(const QualifiedName& other);
const QualifiedName& operator=(const QualifiedName& other);
- DOMStringImpl* localNamePtr() const { return localName().implementation(); }
-
bool operator==(const QualifiedName& other) const { return m_impl == other.m_impl; }
bool operator!=(const QualifiedName& other) const { return !(*this == other); }
bool matches(const QualifiedName& other) const { return m_impl == other.m_impl || (localName() == other.localName() && namespaceURI() == other.namespaceURI()); }
+ bool hasPrefix() const { return m_impl->m_prefix != nullAtom; }
+ void setPrefix(const AtomicString& prefix);
+
const AtomicString& prefix() const { return m_impl->m_prefix; }
const AtomicString& localName() const { return m_impl->m_localName; }
const AtomicString& namespaceURI() const { return m_impl->m_namespace; }
@@ -66,11 +64,10 @@
QualifiedNameImpl* m_impl;
};
-bool operator==(const AtomicString& a, const QualifiedName& q);
+inline bool operator==(const AtomicString& a, const QualifiedName& q) { return a == q.localName(); }
inline bool operator!=(const AtomicString& a, const QualifiedName& q) { return a != q.localName(); }
-bool operator==(const QualifiedName& q, const AtomicString& a);
+inline bool operator==(const QualifiedName& q, const AtomicString& a) { return a == q.localName(); }
inline bool operator!=(const QualifiedName& q, const AtomicString& a) { return a != q.localName(); }
-
}
#endif
1.24 +12 -12 WebCore/khtml/xml/dom_textimpl.cpp
Index: dom_textimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_textimpl.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- dom_textimpl.cpp 19 Oct 2004 23:04:29 -0000 1.23
+++ dom_textimpl.cpp 9 Jul 2005 20:19:22 -0000 1.24
@@ -304,9 +304,14 @@
{
}
+const AtomicString& CommentImpl::localName() const
+{
+ return commentAtom;
+}
+
DOMString CommentImpl::nodeName() const
{
- return "#comment";
+ return commentAtom.string();
}
unsigned short CommentImpl::nodeType() const
@@ -319,11 +324,6 @@
return getDocument()->createComment( str );
}
-NodeImpl::Id CommentImpl::id() const
-{
- return ID_COMMENT;
-}
-
// DOM Section 1.1.1
bool CommentImpl::childTypeAllowed( unsigned short /*type*/ )
{
@@ -394,9 +394,14 @@
return newText;
}
+const AtomicString& TextImpl::localName() const
+{
+ return textAtom;
+}
+
DOMString TextImpl::nodeName() const
{
- return "#text";
+ return textAtom.string();
}
unsigned short TextImpl::nodeType() const
@@ -462,11 +467,6 @@
CharacterDataImpl::attach();
}
-NodeImpl::Id TextImpl::id() const
-{
- return ID_TEXT;
-}
-
void TextImpl::recalcStyle( StyleChange change )
{
// qDebug("textImpl::recalcStyle");
1.17 +3 -3 WebCore/khtml/xml/dom_textimpl.h
Index: dom_textimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_textimpl.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- dom_textimpl.h 10 May 2005 21:59:15 -0000 1.16
+++ dom_textimpl.h 9 Jul 2005 20:19:22 -0000 1.17
@@ -95,13 +95,13 @@
virtual ~CommentImpl();
// DOM methods overridden from parent classes
+ const AtomicString& localName() const;
virtual DOMString nodeName() const;
virtual unsigned short nodeType() const;
virtual NodeImpl *cloneNode(bool deep);
// Other methods (not part of DOM)
-
- virtual Id id() const;
+ virtual bool isCommentNode() const { return true; }
virtual bool childTypeAllowed( unsigned short type );
virtual DOMString toString() const;
@@ -121,6 +121,7 @@
TextImpl *splitText ( const unsigned long offset, int &exceptioncode );
// DOM methods overridden from parent classes
+ const AtomicString& localName() const;
virtual DOMString nodeName() const;
virtual unsigned short nodeType() const;
virtual NodeImpl *cloneNode(bool deep);
@@ -128,7 +129,6 @@
// Other methods (not part of DOM)
virtual bool isTextNode() const { return true; }
- virtual Id id() const;
virtual void attach();
virtual bool rendererIsNeeded(khtml::RenderStyle *);
virtual khtml::RenderObject *createRenderer(RenderArena *, khtml::RenderStyle *);
1.32 +14 -13 WebCore/khtml/xml/xml_tokenizer.cpp
Index: xml_tokenizer.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/xml_tokenizer.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- xml_tokenizer.cpp 4 May 2005 21:11:23 -0000 1.31
+++ xml_tokenizer.cpp 9 Jul 2005 20:19:22 -0000 1.32
@@ -26,7 +26,7 @@
#include "xml/dom_xmlimpl.h"
#include "html/html_headimpl.h"
#include "html/html_tableimpl.h"
-#include "misc/htmltags.h"
+#include "htmlnames.h"
#include "misc/htmlattrs.h"
#include "misc/loader.h"
@@ -44,6 +44,7 @@
using DOM::DocumentPtr;
using DOM::DOMString;
using DOM::ElementImpl;
+using DOM::HTMLNames;
using DOM::HTMLScriptElementImpl;
using DOM::HTMLTableSectionElementImpl;
using DOM::Node;
@@ -322,18 +323,18 @@
// FIXME: This hack ensures implicit table bodies get constructed in XHTML and XML files.
// We want to consolidate this with the HTML parser and HTML DOM code at some point.
// For now, it's too risky to rip that code up.
- if (m_currentNode->id() == ID_TABLE &&
- newElement->id() == ID_TR &&
+ if (m_currentNode->hasTagName(HTMLNames::table()) &&
+ newElement->hasTagName(HTMLNames::tr()) &&
m_currentNode->isHTMLElement() && newElement->isHTMLElement()) {
NodeImpl* implicitTBody =
- new HTMLTableSectionElementImpl( m_doc, ID_TBODY, true /* implicit */ );
+ new HTMLTableSectionElementImpl(HTMLNames::tbody(), m_doc, true /* implicit */);
m_currentNode->addChild(implicitTBody);
if (m_view && !implicitTBody->attached())
implicitTBody->attach();
m_currentNode = implicitTBody;
}
- if (newElement->id() == ID_SCRIPT)
+ if (newElement->hasTagName(HTMLNames::script()))
static_cast<HTMLScriptElementImpl *>(newElement)->setCreatedByParser(true);
if (m_currentNode->addChild(newElement)) {
@@ -611,30 +612,30 @@
DocumentImpl *doc = m_doc->document();
NodeImpl* root = doc->documentElement();
if (!root) {
- root = doc->createElementNS(XHTML_NAMESPACE, "html", exceptioncode);
- NodeImpl* body = doc->createElementNS(XHTML_NAMESPACE, "body", exceptioncode);
+ root = doc->createElementNS(HTMLNames::xhtmlNamespaceURI(), "html", exceptioncode);
+ NodeImpl* body = doc->createElementNS(HTMLNames::xhtmlNamespaceURI(), "body", exceptioncode);
root->appendChild(body, exceptioncode);
doc->appendChild(root, exceptioncode);
root = body;
}
- ElementImpl* reportElement = doc->createElementNS(XHTML_NAMESPACE, "parsererror", exceptioncode);
+ ElementImpl* reportElement = doc->createElementNS(HTMLNames::xhtmlNamespaceURI(), "parsererror", exceptioncode);
reportElement->setAttribute(ATTR_STYLE, "white-space: pre; border: 2px solid #c77; padding: 0 1em 0 1em; margin: 1em; background-color: #fdd; color: black");
- ElementImpl* h3 = doc->createElementNS(XHTML_NAMESPACE, "h3", exceptioncode);
+ ElementImpl* h3 = doc->createElementNS(HTMLNames::xhtmlNamespaceURI(), "h3", exceptioncode);
h3->appendChild(doc->createTextNode("This page contains the following errors:"), exceptioncode);
reportElement->appendChild(h3, exceptioncode);
- ElementImpl* fixed = doc->createElementNS(XHTML_NAMESPACE, "div", exceptioncode);
+ ElementImpl* fixed = doc->createElementNS(HTMLNames::xhtmlNamespaceURI(), "div", exceptioncode);
fixed->setAttribute(ATTR_STYLE, "font-family:monospace;font-size:12px");
NodeImpl* textNode = doc->createTextNode(m_errorMessages);
fixed->appendChild(textNode, exceptioncode);
reportElement->appendChild(fixed, exceptioncode);
- h3 = doc->createElementNS(XHTML_NAMESPACE, "h3", exceptioncode);
+ h3 = doc->createElementNS(HTMLNames::xhtmlNamespaceURI(), "h3", exceptioncode);
reportElement->appendChild(h3, exceptioncode);
h3->appendChild(doc->createTextNode("Below is a rendering of the page up to the first error."), exceptioncode);
#ifdef KHTML_XSLT
if (doc->transformSourceDocument()) {
- ElementImpl* par = doc->createElementNS(XHTML_NAMESPACE, "p", exceptioncode);
+ ElementImpl* par = doc->createElementNS(HTMLNames::xhtmlNamespaceURI(), "p", exceptioncode);
reportElement->appendChild(par, exceptioncode);
par->setAttribute(ATTR_STYLE, "white-space: normal");
par->appendChild(doc->createTextNode("This document was created as the result of an XSL transformation. The line and column numbers given are from the transformed result."), exceptioncode);
@@ -650,7 +651,7 @@
// Recursively go through the entire document tree, looking for html <script> tags. For each of these
// that is found, add it to the m_scripts list from which they will be executed
- if (n->id() == ID_SCRIPT) {
+ if (n->hasTagName(HTMLNames::script())) {
m_scripts.append(static_cast<HTMLScriptElementImpl*>(n));
}
1.37 +121 -151 WebCore/kwq/DOM.mm
Index: DOM.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/DOM.mm,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- DOM.mm 19 May 2005 18:32:27 -0000 1.36
+++ DOM.mm 9 Jul 2005 20:19:24 -0000 1.37
@@ -44,7 +44,6 @@
#import "dom_textimpl.h"
#import "dom_xmlimpl.h"
#import "html_elementimpl.h"
-#import "htmltags.h"
#import "khtml_part.h"
@@ -72,6 +71,7 @@
using DOM::EntityImpl;
using DOM::FilterNode;
using DOM::HTMLElementImpl;
+using DOM::HTMLNames;
using DOM::NamedNodeMapImpl;
using DOM::Node;
using DOM::NodeFilter;
@@ -338,7 +338,8 @@
ASSERT(prefix);
int exceptionCode = 0;
- [self _nodeImpl]->setPrefix(prefix, exceptionCode);
+ DOMString prefixStr(prefix);
+ [self _nodeImpl]->setPrefix(prefixStr.implementation(), exceptionCode);
raiseOnDOMError(exceptionCode);
}
@@ -399,154 +400,123 @@
switch (impl->nodeType()) {
case Node::ELEMENT_NODE:
if (impl->isHTMLElement()) {
- // FIXME: There are no identifiers for HTMLHeadingElement, HTMLModElement,
- // HTMLTableCaptionElement, HTMLTableColElement, HTMLTableSectionElement.
- // Find other ways to identify them.
- switch (impl->identifier()) {
- case ID_HTML:
- wrapperClass = [DOMHTMLHtmlElement class];
- break;
- case ID_HEAD:
- wrapperClass = [DOMHTMLHeadElement class];
- break;
- case ID_LINK:
- wrapperClass = [DOMHTMLLinkElement class];
- break;
- case ID_TITLE:
- wrapperClass = [DOMHTMLTitleElement class];
- break;
- case ID_META:
- wrapperClass = [DOMHTMLMetaElement class];
- break;
- case ID_BASE:
- wrapperClass = [DOMHTMLBaseElement class];
- break;
- case ID_ISINDEX:
- wrapperClass = [DOMHTMLIsIndexElement class];
- break;
- case ID_STYLE:
- wrapperClass = [DOMHTMLStyleElement class];
- break;
- case ID_BODY:
- wrapperClass = [DOMHTMLBodyElement class];
- break;
- case ID_FORM:
- wrapperClass = [DOMHTMLFormElement class];
- break;
- case ID_SELECT:
- wrapperClass = [DOMHTMLSelectElement class];
- break;
- case ID_OPTGROUP:
- wrapperClass = [DOMHTMLOptGroupElement class];
- break;
- case ID_OPTION:
- wrapperClass = [DOMHTMLOptionElement class];
- break;
- case ID_INPUT:
- wrapperClass = [DOMHTMLInputElement class];
- break;
- case ID_TEXTAREA:
- wrapperClass = [DOMHTMLTextAreaElement class];
- break;
- case ID_BUTTON:
- wrapperClass = [DOMHTMLButtonElement class];
- break;
- case ID_LABEL:
- wrapperClass = [DOMHTMLLabelElement class];
- break;
- case ID_FIELDSET:
- wrapperClass = [DOMHTMLFieldSetElement class];
- break;
- case ID_LEGEND:
- wrapperClass = [DOMHTMLLegendElement class];
- break;
- case ID_UL:
- wrapperClass = [DOMHTMLUListElement class];
- break;
- case ID_OL:
- wrapperClass = [DOMHTMLOListElement class];
- break;
- case ID_DL:
- wrapperClass = [DOMHTMLDListElement class];
- break;
- case ID_DIR:
- wrapperClass = [DOMHTMLDirectoryElement class];
- break;
- case ID_MENU:
- wrapperClass = [DOMHTMLMenuElement class];
- break;
- case ID_LI:
- wrapperClass = [DOMHTMLLIElement class];
- break;
- case ID_DIV:
- wrapperClass = [DOMHTMLDivElement class];
- break;
- case ID_P:
- wrapperClass = [DOMHTMLParagraphElement class];
- break;
- case ID_Q:
- wrapperClass = [DOMHTMLQuoteElement class];
- break;
- case ID_PRE:
- wrapperClass = [DOMHTMLPreElement class];
- break;
- case ID_BR:
- wrapperClass = [DOMHTMLBRElement class];
- break;
- case ID_BASEFONT:
- wrapperClass = [DOMHTMLFontElement class];
- break;
- case ID_FONT:
- wrapperClass = [DOMHTMLFontElement class];
- break;
- case ID_HR:
- wrapperClass = [DOMHTMLHRElement class];
- break;
- case ID_A:
- wrapperClass = [DOMHTMLAnchorElement class];
- break;
- case ID_IMG:
- wrapperClass = [DOMHTMLImageElement class];
- break;
- case ID_OBJECT:
- wrapperClass = [DOMHTMLObjectElement class];
- break;
- case ID_PARAM:
- wrapperClass = [DOMHTMLParamElement class];
- break;
- case ID_APPLET:
- wrapperClass = [DOMHTMLAppletElement class];
- break;
- case ID_MAP:
- wrapperClass = [DOMHTMLMapElement class];
- break;
- case ID_AREA:
- wrapperClass = [DOMHTMLAreaElement class];
- break;
- case ID_SCRIPT:
- wrapperClass = [DOMHTMLScriptElement class];
- break;
- case ID_TABLE:
- wrapperClass = [DOMHTMLTableElement class];
- break;
- case ID_TD:
- wrapperClass = [DOMHTMLTableCellElement class];
- break;
- case ID_TR:
- wrapperClass = [DOMHTMLTableRowElement class];
- break;
- case ID_FRAMESET:
- wrapperClass = [DOMHTMLFrameSetElement class];
- break;
- case ID_FRAME:
- wrapperClass = [DOMHTMLFrameElement class];
- break;
- case ID_IFRAME:
- wrapperClass = [DOMHTMLIFrameElement class];
- break;
- default:
- wrapperClass = [DOMHTMLElement class];
- }
+ // FIXME: Reflect marquee once the API has been determined.
+ // FIXME: We could make the HTML classes hand back their class names and then use that to make
+ // the appropriate Obj-C class from the string.
+ HTMLElementImpl* htmlElt = static_cast<HTMLElementImpl*>(impl);
+ if (htmlElt->hasLocalName(HTMLNames::html()))
+ wrapperClass = [DOMHTMLHtmlElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::head()))
+ wrapperClass = [DOMHTMLHeadElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::link()))
+ wrapperClass = [DOMHTMLLinkElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::title()))
+ wrapperClass = [DOMHTMLTitleElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::meta()))
+ wrapperClass = [DOMHTMLMetaElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::base()))
+ wrapperClass = [DOMHTMLBaseElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::isindex()))
+ wrapperClass = [DOMHTMLIsIndexElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::style()))
+ wrapperClass = [DOMHTMLStyleElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::body()))
+ wrapperClass = [DOMHTMLBodyElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::form()))
+ wrapperClass = [DOMHTMLFormElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::select()))
+ wrapperClass = [DOMHTMLSelectElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::optgroup()))
+ wrapperClass = [DOMHTMLOptGroupElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::option()))
+ wrapperClass = [DOMHTMLOptionElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::input()))
+ wrapperClass = [DOMHTMLInputElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::textarea()))
+ wrapperClass = [DOMHTMLTextAreaElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::button()))
+ wrapperClass = [DOMHTMLButtonElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::label()))
+ wrapperClass = [DOMHTMLLabelElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::fieldset()))
+ wrapperClass = [DOMHTMLFieldSetElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::legend()))
+ wrapperClass = [DOMHTMLLegendElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::ul()))
+ wrapperClass = [DOMHTMLUListElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::ol()))
+ wrapperClass = [DOMHTMLOListElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::dl()))
+ wrapperClass = [DOMHTMLDListElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::dir()))
+ wrapperClass = [DOMHTMLDirectoryElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::menu()))
+ wrapperClass = [DOMHTMLMenuElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::li()))
+ wrapperClass = [DOMHTMLLIElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::div()))
+ wrapperClass = [DOMHTMLDivElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::p()))
+ wrapperClass = [DOMHTMLParagraphElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::h1()) ||
+ htmlElt->hasLocalName(HTMLNames::h2()) ||
+ htmlElt->hasLocalName(HTMLNames::h3()) ||
+ htmlElt->hasLocalName(HTMLNames::h4()) ||
+ htmlElt->hasLocalName(HTMLNames::h5()) ||
+ htmlElt->hasLocalName(HTMLNames::h6()))
+ wrapperClass = [DOMHTMLHeadingElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::q()))
+ wrapperClass = [DOMHTMLQuoteElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::pre()))
+ wrapperClass = [DOMHTMLPreElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::br()))
+ wrapperClass = [DOMHTMLBRElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::basefont()))
+ wrapperClass = [DOMHTMLBaseFontElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::font()))
+ wrapperClass = [DOMHTMLFontElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::hr()))
+ wrapperClass = [DOMHTMLHRElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::a()))
+ wrapperClass = [DOMHTMLAnchorElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::img()) ||
+ htmlElt->hasLocalName(HTMLNames::canvas()))
+ wrapperClass = [DOMHTMLImageElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::object()))
+ wrapperClass = [DOMHTMLObjectElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::param()))
+ wrapperClass = [DOMHTMLParamElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::applet()))
+ wrapperClass = [DOMHTMLAppletElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::map()))
+ wrapperClass = [DOMHTMLMapElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::area()))
+ wrapperClass = [DOMHTMLAreaElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::script()))
+ wrapperClass = [DOMHTMLScriptElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::table()))
+ wrapperClass = [DOMHTMLTableElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::thead()) ||
+ htmlElt->hasLocalName(HTMLNames::tbody()) ||
+ htmlElt->hasLocalName(HTMLNames::tfoot()))
+ wrapperClass = [DOMHTMLTableSectionElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::td()))
+ wrapperClass = [DOMHTMLTableCellElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::tr()))
+ wrapperClass = [DOMHTMLTableRowElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::col()) ||
+ htmlElt->hasLocalName(HTMLNames::colgroup()))
+ wrapperClass = [DOMHTMLTableColElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::caption()))
+ wrapperClass = [DOMHTMLTableCaptionElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::frameset()))
+ wrapperClass = [DOMHTMLFrameSetElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::frame()))
+ wrapperClass = [DOMHTMLFrameElement class];
+ else if (htmlElt->hasLocalName(HTMLNames::iframe()))
+ wrapperClass = [DOMHTMLIFrameElement class];
+ else
+ wrapperClass = [DOMHTMLElement class];
} else {
wrapperClass = [DOMElement class];
}
@@ -1268,7 +1238,7 @@
- (NSString *)tagName
{
- return [self _elementImpl]->tagName();
+ return [self _elementImpl]->nodeName();
}
- (DOMNamedNodeMap *)attributes
1.19 +2 -3 WebCore/kwq/DOMHTML.mm
Index: DOMHTML.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/DOMHTML.mm,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- DOMHTML.mm 13 May 2005 16:48:51 -0000 1.18
+++ DOMHTML.mm 9 Jul 2005 20:19:24 -0000 1.19
@@ -74,7 +74,6 @@
using DOM::HTMLFormElementImpl;
using DOM::HTMLFrameElementImpl;
using DOM::HTMLFrameSetElementImpl;
-using DOM::HTMLGenericElementImpl;
using DOM::HTMLGenericFormElementImpl;
using DOM::HTMLHeadElementImpl;
using DOM::HTMLHeadingElementImpl;
@@ -1905,9 +1904,9 @@
@implementation DOMHTMLQuoteElement
-- (HTMLGenericElementImpl *)_quoteElementImpl
+- (HTMLElementImpl *)_quoteElementImpl
{
- return static_cast<HTMLGenericElementImpl *>(DOM_cast<NodeImpl *>(_internal));
+ return static_cast<HTMLElementImpl *>(DOM_cast<NodeImpl *>(_internal));
}
- (NSString *)cite
1.70 +4 -4 WebCore/kwq/KWQAccObject.mm
Index: KWQAccObject.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQAccObject.mm,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- KWQAccObject.mm 7 Jul 2005 08:03:21 -0000 1.69
+++ KWQAccObject.mm 9 Jul 2005 20:19:25 -0000 1.70
@@ -48,7 +48,6 @@
#import "dom2_eventsimpl.h"
#import "dom2_range.h"
#import "htmlattrs.h"
-#import "htmltags.h"
#import "khtmlview.h"
#import "khtml_part.h"
#import "render_canvas.h"
@@ -77,6 +76,7 @@
using DOM::HTMLElementImpl;
using DOM::HTMLInputElementImpl;
using DOM::HTMLMapElementImpl;
+using DOM::HTMLNames;
using DOM::Node;
using DOM::NodeImpl;
using DOM::Position;
@@ -366,7 +366,7 @@
}
if (m_renderer->isListMarker())
return @"AXListMarker";
- if (m_renderer->element() && m_renderer->element()->identifier() == ID_BUTTON)
+ if (m_renderer->element() && m_renderer->element()->hasTagName(HTMLNames::button()))
return NSAccessibilityButtonRole;
if (m_renderer->isText())
return NSAccessibilityStaticTextRole;
@@ -532,7 +532,7 @@
if (!m_renderer || m_areaElement || !m_renderer->element())
return nil;
- if (m_renderer->element()->isHTMLElement() && m_renderer->element()->identifier() == ID_BUTTON)
+ if (m_renderer->element()->isHTMLElement() && m_renderer->element()->hasTagName(HTMLNames::button()))
return [self textUnderElement];
if (m_renderer->element()->isLink())
return [self textUnderElement];
@@ -622,7 +622,7 @@
return (!m_renderer->isListMarker() && !m_renderer->isCanvas() &&
!m_renderer->isImage() &&
!(m_renderer->element() && m_renderer->element()->isHTMLElement() &&
- m_renderer->element()->identifier() == ID_BUTTON));
+ m_renderer->element()->hasTagName(HTMLNames::button())));
}
- (NSArray *)accessibilityAttributeNames
1.32 +5 -2 WebCore/kwq/KWQFont.h
Index: KWQFont.h
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQFont.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- KWQFont.h 4 Apr 2003 16:56:02 -0000 1.31
+++ KWQFont.h 9 Jul 2005 20:19:25 -0000 1.32
@@ -37,6 +37,7 @@
class QFont {
public:
enum Weight { Normal = 50, Bold = 63 };
+ enum Pitch { Unknown, Fixed, Variable };
QFont();
~QFont();
@@ -61,7 +62,8 @@
void setPixelSize(float s);
int pixelSize() const { return (int)_size; }
- bool isFixedPitch() const;
+ bool isFixedPitch() const { if (_pitch == Unknown) determinePitch(); return _pitch == Fixed; };
+ void determinePitch() const;
void setPrinterFont(bool);
bool isPrinterFont() const { return _isPrinterFont; }
@@ -79,7 +81,8 @@
KWQFontFamily _family;
int _trait;
float _size;
- bool _isPrinterFont;
+ bool _isPrinterFont : 1;
+ mutable Pitch _pitch : 2;
mutable NSFont *_NSFont;
};
1.46 +10 -5 WebCore/kwq/KWQFont.mm
Index: KWQFont.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQFont.mm,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- KWQFont.mm 9 Mar 2005 22:30:25 -0000 1.45
+++ KWQFont.mm 9 Jul 2005 20:19:25 -0000 1.46
@@ -34,6 +34,7 @@
: _trait(0)
, _size(12.0)
, _isPrinterFont(false)
+ , _pitch(Unknown)
, _NSFont(0)
{
}
@@ -48,6 +49,7 @@
, _trait(other._trait)
, _size(other._size)
, _isPrinterFont(other._isPrinterFont)
+ , _pitch(other._pitch)
, _NSFont(KWQRetain(other._NSFont))
{
}
@@ -58,6 +60,7 @@
_trait = other._trait;
_size = other._size;
_isPrinterFont = other._isPrinterFont;
+ _pitch = other._pitch;
KWQRetain(other._NSFont);
KWQRelease(_NSFont);
_NSFont = other._NSFont;
@@ -146,21 +149,23 @@
return _trait & NSBoldFontMask;
}
-bool QFont::isFixedPitch() const
+void QFont::determinePitch() const
{
KWQ_BLOCK_EXCEPTIONS;
- return [[WebCoreTextRendererFactory sharedFactory] isFontFixedPitch: getNSFont()];
+ if ([[WebCoreTextRendererFactory sharedFactory] isFontFixedPitch: getNSFont()])
+ _pitch = Fixed;
+ else
+ _pitch = Variable;
KWQ_UNBLOCK_EXCEPTIONS;
- return false;
}
-
bool QFont::operator==(const QFont &compareFont) const
{
return _family == compareFont._family
&& _trait == compareFont._trait
&& _size == compareFont._size
- && _isPrinterFont == compareFont._isPrinterFont;
+ && _isPrinterFont == compareFont._isPrinterFont
+ && _pitch == compareFont._pitch;
}
NSFont *QFont::getNSFont() const
1.10 +3 -1 WebCore/kwq/KWQKHTMLPart.cpp
Index: KWQKHTMLPart.cpp
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQKHTMLPart.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- KWQKHTMLPart.cpp 27 Mar 2003 01:57:47 -0000 1.9
+++ KWQKHTMLPart.cpp 9 Jul 2005 20:19:25 -0000 1.10
@@ -32,13 +32,15 @@
using DOM::DocumentImpl;
using DOM::HTMLDocumentImpl;
+using DOM::HTMLNames;
using DOM::NodeImpl;
+// FIXME: What on earth is this single tiny file with only this method doing here?
bool KWQKHTMLPart::isFrameSet() const
{
DocumentImpl *document = d->m_doc;
if (!document || !document->isHTMLDocument())
return false;
NodeImpl *body = static_cast<HTMLDocumentImpl *>(document)->body();
- return body && body->renderer() && body->id() == ID_FRAMESET;
+ return body && body->renderer() && body->hasTagName(HTMLNames::frameset());
}
1.646 +146 -182 WebCore/kwq/KWQKHTMLPart.mm
Index: KWQKHTMLPart.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQKHTMLPart.mm,v
retrieving revision 1.645
retrieving revision 1.646
diff -u -r1.645 -r1.646
--- KWQKHTMLPart.mm 8 Jul 2005 18:39:37 -0000 1.645
+++ KWQKHTMLPart.mm 9 Jul 2005 20:19:25 -0000 1.646
@@ -28,7 +28,6 @@
#import "DOMInternal.h"
#import "KWQClipboard.h"
-#import "KWQDOMNode.h"
#import "KWQDummyView.h"
#import "KWQEditCommand.h"
#import "KWQExceptions.h"
@@ -100,6 +99,7 @@
using DOM::HTMLFormElementImpl;
using DOM::HTMLFrameElementImpl;
using DOM::HTMLGenericFormElementImpl;
+using DOM::HTMLNames;
using DOM::HTMLTableCellElementImpl;
using DOM::Node;
using DOM::NodeImpl;
@@ -364,13 +364,12 @@
{
NodeImpl *n;
for (n = start; n; n = n->traverseNextNode()) {
- NodeImpl::Id nodeID = idFromNode(n);
- if (nodeID == ID_FORM) {
+ if (n->hasTagName(HTMLNames::form())) {
return static_cast<HTMLFormElementImpl *>(n);
} else if (n->isHTMLElement()
&& static_cast<HTMLElementImpl *>(n)->isGenericFormElement()) {
return static_cast<HTMLGenericFormElementImpl *>(n)->form();
- } else if (nodeID == ID_FRAME || nodeID == ID_IFRAME) {
+ } else if (n->hasTagName(HTMLNames::frame()) || n->hasTagName(HTMLNames::iframe())) {
NodeImpl *childDoc = static_cast<HTMLFrameElementImpl *>(n)->contentDocument();
HTMLFormElementImpl *frameResult = scanForForm(childDoc);
if (frameResult) {
@@ -393,7 +392,7 @@
// try walking up the node tree to find a form element
NodeImpl *n;
for (n = start; n; n = n->parentNode()) {
- if (idFromNode(n) == ID_FORM) {
+ if (n->hasTagName(HTMLNames::form())) {
return static_cast<HTMLFormElementImpl *>(n);
} else if (n->isHTMLElement()
&& static_cast<HTMLElementImpl *>(n)->isGenericFormElement()) {
@@ -492,8 +491,7 @@
if (aboveCell) {
// search within the above cell we found for a match
for (NodeImpl *n = aboveCell->firstChild(); n; n = n->traverseNextNode(aboveCell)) {
- if (idFromNode(n) == ID_TEXT
- && n->renderer() && n->renderer()->style()->visibility() == VISIBLE)
+ if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE)
{
// For each text chunk, run the regexp
QString nodeString = n->nodeValue().string();
@@ -528,23 +526,21 @@
n && lengthSearched < charsSearchedThreshold;
n = n->traversePreviousNode())
{
- NodeImpl::Id nodeID = idFromNode(n);
- if (nodeID == ID_FORM
+ if (n->hasTagName(HTMLNames::form())
|| (n->isHTMLElement()
&& static_cast<HTMLElementImpl *>(n)->isGenericFormElement()))
{
// We hit another form element or the start of the form - bail out
break;
- } else if (nodeID == ID_TD && !startingTableCell) {
+ } else if (n->hasTagName(HTMLNames::td()) && !startingTableCell) {
startingTableCell = static_cast<HTMLTableCellElementImpl *>(n);
- } else if (nodeID == ID_TR && startingTableCell) {
+ } else if (n->hasTagName(HTMLNames::tr()) && startingTableCell) {
NSString *result = searchForLabelsAboveCell(regExp, startingTableCell);
if (result) {
return result;
}
searchedCellAbove = true;
- } else if (nodeID == ID_TEXT
- && n->renderer() && n->renderer()->style()->visibility() == VISIBLE)
+ } else if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE)
{
// For each text chunk, run the regexp
QString nodeString = n->nodeValue().string();
@@ -2851,14 +2847,10 @@
static ElementImpl *listParent(ElementImpl *item)
{
- // Ick! Avoid use of item->id() which confuses ObjC++.
- unsigned short _id = item->identifier();
-
- while (_id != ID_UL && _id != ID_OL) {
+ while (!item->hasTagName(HTMLNames::ul()) && !item->hasTagName(HTMLNames::ol())) {
item = static_cast<ElementImpl *>(item->parentNode());
if (!item)
break;
- _id = item->identifier();
}
return item;
}
@@ -2871,7 +2863,7 @@
while (par) {
if (par->firstChild() != e)
return 0;
- if (par->identifier() == ID_LI)
+ if (par->hasTagName(HTMLNames::li()))
return par;
e = par;
par = par->parentNode();
@@ -3025,109 +3017,93 @@
} else {
// This is our simple HTML -> ASCII transformation:
QString text;
- NodeImpl::Id _id = n->identifier();
- switch(_id) {
- case ID_A:
- // Note the start of the <a> element. We will add the NSLinkAttributeName
- // attribute to the attributed string when navigating to the next sibling
- // of this node.
- linkStartLocation = [result length];
- linkStartNode = static_cast<ElementImpl*>(n);
- break;
-
- case ID_BR:
- text += "\n";
- hasNewLine = true;
- break;
-
- case ID_LI:
- {
- QString listText;
- ElementImpl *itemParent = listParent(static_cast<ElementImpl *>(n));
-
- if (!hasNewLine)
- listText += '\n';
- hasNewLine = true;
-
- listItems.append(static_cast<ElementImpl*>(n));
- ListItemInfo info;
- info.start = [result length];
- info.end = 0;
- listItemLocations.append (info);
-
- listText += '\t';
- if (itemParent && renderer->isListItem()) {
- RenderListItem *listRenderer = static_cast<RenderListItem*>(renderer);
-
- maxMarkerWidth = MAX([font pointSize], maxMarkerWidth);
- switch(style->listStyleType()) {
- case khtml::DISC:
- listText += ((QChar)BULLET_CHAR);
- break;
- case khtml::CIRCLE:
- listText += ((QChar)CIRCLE_CHAR);
- break;
- case khtml::SQUARE:
- listText += ((QChar)SQUARE_CHAR);
- break;
- case khtml::LNONE:
- break;
- default:
- QString marker = listRenderer->markerStringValue();
- listText += marker;
- // Use AppKit metrics. Will be rendered by AppKit.
- float markerWidth = [font widthOfString: marker.getNSString()];
- maxMarkerWidth = MAX(markerWidth, maxMarkerWidth);
- }
+ if (n->hasTagName(HTMLNames::a())) {
+ // Note the start of the <a> element. We will add the NSLinkAttributeName
+ // attribute to the attributed string when navigating to the next sibling
+ // of this node.
+ linkStartLocation = [result length];
+ linkStartNode = static_cast<ElementImpl*>(n);
+ } else if (n->hasTagName(HTMLNames::br())) {
+ text += "\n";
+ hasNewLine = true;
+ } else if (n->hasTagName(HTMLNames::li())) {
+ QString listText;
+ ElementImpl *itemParent = listParent(static_cast<ElementImpl *>(n));
+
+ if (!hasNewLine)
+ listText += '\n';
+ hasNewLine = true;
- listText += ' ';
- listText += '\t';
-
- NSMutableDictionary *attrs;
-
- attrs = [[NSMutableDictionary alloc] init];
- [attrs setObject:font forKey:NSFontAttributeName];
- if (style && style->color().isValid())
- [attrs setObject:nsColor(style->color()) forKey:NSForegroundColorAttributeName];
- if (style && style->backgroundColor().isValid())
- [attrs setObject:nsColor(style->backgroundColor()) forKey:NSBackgroundColorAttributeName];
-
- NSAttributedString *partialString = [[NSAttributedString alloc] initWithString:listText.getNSString() attributes:attrs];
- [attrs release];
- [result appendAttributedString: partialString];
- [partialString release];
- }
+ listItems.append(static_cast<ElementImpl*>(n));
+ ListItemInfo info;
+ info.start = [result length];
+ info.end = 0;
+ listItemLocations.append (info);
+
+ listText += '\t';
+ if (itemParent && renderer->isListItem()) {
+ RenderListItem *listRenderer = static_cast<RenderListItem*>(renderer);
+
+ maxMarkerWidth = MAX([font pointSize], maxMarkerWidth);
+ switch(style->listStyleType()) {
+ case khtml::DISC:
+ listText += ((QChar)BULLET_CHAR);
+ break;
+ case khtml::CIRCLE:
+ listText += ((QChar)CIRCLE_CHAR);
+ break;
+ case khtml::SQUARE:
+ listText += ((QChar)SQUARE_CHAR);
+ break;
+ case khtml::LNONE:
+ break;
+ default:
+ QString marker = listRenderer->markerStringValue();
+ listText += marker;
+ // Use AppKit metrics. Will be rendered by AppKit.
+ float markerWidth = [font widthOfString: marker.getNSString()];
+ maxMarkerWidth = MAX(markerWidth, maxMarkerWidth);
}
- break;
- case ID_OL:
- case ID_UL:
+ listText += ' ';
+ listText += '\t';
+
+ NSMutableDictionary *attrs = [[NSMutableDictionary alloc] init];
+ [attrs setObject:font forKey:NSFontAttributeName];
+ if (style && style->color().isValid())
+ [attrs setObject:nsColor(style->color()) forKey:NSForegroundColorAttributeName];
+ if (style && style->backgroundColor().isValid())
+ [attrs setObject:nsColor(style->backgroundColor()) forKey:NSBackgroundColorAttributeName];
+
+ NSAttributedString *partialString = [[NSAttributedString alloc] initWithString:listText.getNSString() attributes:attrs];
+ [attrs release];
+ [result appendAttributedString: partialString];
+ [partialString release];
+ }
+ else if (n->hasTagName(HTMLNames::ol()) || n->hasTagName(HTMLNames::ul())) {
if (!hasNewLine)
text += "\n";
hasNewLine = true;
- break;
-
- case ID_TD:
- case ID_TH:
- case ID_HR:
- case ID_DD:
- case ID_DL:
- case ID_DT:
- case ID_PRE:
- case ID_BLOCKQUOTE:
- case ID_DIV:
+ } else if (n->hasTagName(HTMLNames::td()) ||
+ n->hasTagName(HTMLNames::th()) ||
+ n->hasTagName(HTMLNames::hr()) ||
+ n->hasTagName(HTMLNames::dd()) ||
+ n->hasTagName(HTMLNames::dl()) ||
+ n->hasTagName(HTMLNames::dt()) ||
+ n->hasTagName(HTMLNames::pre()) ||
+ n->hasTagName(HTMLNames::blockquote()) ||
+ n->hasTagName(HTMLNames::div())) {
if (!hasNewLine)
text += '\n';
hasNewLine = true;
- break;
- case ID_P:
- case ID_TR:
- case ID_H1:
- case ID_H2:
- case ID_H3:
- case ID_H4:
- case ID_H5:
- case ID_H6: {
+ } else if (n->hasTagName(HTMLNames::p()) ||
+ n->hasTagName(HTMLNames::tr()) ||
+ n->hasTagName(HTMLNames::h1()) ||
+ n->hasTagName(HTMLNames::h2()) ||
+ n->hasTagName(HTMLNames::h3()) ||
+ n->hasTagName(HTMLNames::h4()) ||
+ n->hasTagName(HTMLNames::h5()) ||
+ n->hasTagName(HTMLNames::h6())) {
if (!hasNewLine)
text += '\n';
@@ -3142,10 +3118,8 @@
}
hasNewLine = true;
- break;
}
-
- case ID_IMG:
+ else if (n->hasTagName(HTMLNames::img())) {
if (pendingStyledSpace != nil) {
if (linkStartLocation == [result length]) {
++linkStartLocation;
@@ -3159,8 +3133,9 @@
NSAttributedString *iString = [NSAttributedString attributedStringWithAttachment:attachment];
[result appendAttributedString: iString];
[attachment release];
- break;
+ }
}
+
NSAttributedString *partialString = [[NSAttributedString alloc] initWithString:text.getNSString()];
[result appendAttributedString: partialString];
[partialString release];
@@ -3182,71 +3157,60 @@
break;
next = n->nextSibling();
- NodeImpl::Id _id = n->identifier();
- switch(_id) {
- case ID_A:
- // End of a <a> element. Create an attributed string NSLinkAttributeName attribute
- // for the range of the link. Note that we create the attributed string from the DOM, which
- // will have corrected any illegally nested <a> elements.
- if (linkStartNode && n == linkStartNode){
- DOMString href = parseURL(linkStartNode->getAttribute(ATTR_HREF));
- KURL kURL = KWQ(linkStartNode->getDocument()->part())->completeURL(href.string());
-
- NSURL *URL = kURL.getNSURL();
- [result addAttribute:NSLinkAttributeName value:URL range:NSMakeRange(linkStartLocation, [result length]-linkStartLocation)];
- linkStartNode = 0;
- }
- break;
+ if (n->hasTagName(HTMLNames::a())) {
+ // End of a <a> element. Create an attributed string NSLinkAttributeName attribute
+ // for the range of the link. Note that we create the attributed string from the DOM, which
+ // will have corrected any illegally nested <a> elements.
+ if (linkStartNode && n == linkStartNode) {
+ DOMString href = parseURL(linkStartNode->getAttribute(ATTR_HREF));
+ KURL kURL = KWQ(linkStartNode->getDocument()->part())->completeURL(href.string());
+
+ NSURL *URL = kURL.getNSURL();
+ [result addAttribute:NSLinkAttributeName value:URL range:NSMakeRange(linkStartLocation, [result length]-linkStartLocation)];
+ linkStartNode = 0;
+ }
+ }
+ else if (n->hasTagName(HTMLNames::ol()) || n->hasTagName(HTMLNames::ul())) {
+ if (!hasNewLine)
+ text += '\n';
+ hasNewLine = true;
+ } else if (n->hasTagName(HTMLNames::li())) {
- case ID_OL:
- case ID_UL:
- if (!hasNewLine)
- text += '\n';
- hasNewLine = true;
- break;
-
- case ID_LI:
- {
- int i, count = listItems.count();
- for (i = 0; i < count; i++){
- if (listItems.at(i) == n){
- listItemLocations[i].end = [result length];
- break;
- }
- }
+ int i, count = listItems.count();
+ for (i = 0; i < count; i++){
+ if (listItems.at(i) == n){
+ listItemLocations[i].end = [result length];
+ break;
}
- if (!hasNewLine)
- text += '\n';
- hasNewLine = true;
- break;
-
- case ID_TD:
- case ID_TH:
- case ID_HR:
- case ID_DD:
- case ID_DL:
- case ID_DT:
- case ID_PRE:
- case ID_BLOCKQUOTE:
- case ID_DIV:
- if (!hasNewLine)
- text += '\n';
- hasNewLine = true;
- break;
- case ID_P:
- case ID_TR:
- case ID_H1:
- case ID_H2:
- case ID_H3:
- case ID_H4:
- case ID_H5:
- case ID_H6:
- if (!hasNewLine)
- text += '\n';
- // An extra newline is needed at the start, not the end, of these types of tags,
- // so don't add another here.
- hasNewLine = true;
- break;
+ }
+ if (!hasNewLine)
+ text += '\n';
+ hasNewLine = true;
+ } else if (n->hasTagName(HTMLNames::td()) ||
+ n->hasTagName(HTMLNames::th()) ||
+ n->hasTagName(HTMLNames::hr()) ||
+ n->hasTagName(HTMLNames::dd()) ||
+ n->hasTagName(HTMLNames::dl()) ||
+ n->hasTagName(HTMLNames::dt()) ||
+ n->hasTagName(HTMLNames::pre()) ||
+ n->hasTagName(HTMLNames::blockquote()) ||
+ n->hasTagName(HTMLNames::div())) {
+ if (!hasNewLine)
+ text += '\n';
+ hasNewLine = true;
+ } else if (n->hasTagName(HTMLNames::p()) ||
+ n->hasTagName(HTMLNames::tr()) ||
+ n->hasTagName(HTMLNames::h1()) ||
+ n->hasTagName(HTMLNames::h2()) ||
+ n->hasTagName(HTMLNames::h3()) ||
+ n->hasTagName(HTMLNames::h4()) ||
+ n->hasTagName(HTMLNames::h5()) ||
+ n->hasTagName(HTMLNames::h6())) {
+ if (!hasNewLine)
+ text += '\n';
+ // An extra newline is needed at the start, not the end, of these types of tags,
+ // so don't add another here.
+ hasNewLine = true;
}
NSAttributedString *partialString = [[NSAttributedString alloc] initWithString:text.getNSString()];
@@ -3479,7 +3443,7 @@
return node->renderer()->style();
int exceptionCode = 0;
- ElementImpl *styleElement = xmlDocImpl()->createHTMLElement("span", exceptionCode);
+ ElementImpl *styleElement = xmlDocImpl()->createElementNS(HTMLNames::xhtmlNamespaceURI(), "span", exceptionCode);
ASSERT(exceptionCode == 0);
styleElement->ref();
@@ -3706,7 +3670,7 @@
while (node) {
// Look for a block flow, but skip over the HTML element, since we really
// want to get at least as far as the the BODY element in a document.
- if (node->isBlockFlow() && node->identifier() != ID_HTML)
+ if (node->isBlockFlow() && node->hasTagName(HTMLNames::html()))
break;
node = node->traverseNextNode();
}
1.42 +7 -4 WebCore/kwq/KWQRenderTreeDebug.cpp
Index: KWQRenderTreeDebug.cpp
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQRenderTreeDebug.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- KWQRenderTreeDebug.cpp 16 May 2005 22:03:48 -0000 1.41
+++ KWQRenderTreeDebug.cpp 9 Jul 2005 20:19:25 -0000 1.42
@@ -27,7 +27,6 @@
#include "dom_docimpl.h"
#include "dom_position.h"
-#include "htmltags.h"
#include "jsediting.h"
#include "khtmlview.h"
#include "render_canvas.h"
@@ -116,9 +115,13 @@
{
if (n->isDocumentNode())
return "";
- if (n->id() <= ID_LAST_TAG)
- return getTagName(n->id()).string();
- return n->nodeName().string();
+ if (n->isTextNode())
+ return "TEXT"; // FIXME: Remove once the layout tests are ready to change.
+ if (n->isCommentNode())
+ return "COMMENT";
+ if (n->isHTMLElement())
+ return n->nodeName().upper().string(); // FIXME: We want to dump the real DOM name, not an uppercase name.
+ return n->nodeName().string();
}
static QTextStream &operator<<(QTextStream &ts, const RenderObject &o)
1.398 +6 -7 WebCore/kwq/WebCoreBridge.mm
Index: WebCoreBridge.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/WebCoreBridge.mm,v
retrieving revision 1.397
retrieving revision 1.398
diff -u -r1.397 -r1.398
--- WebCoreBridge.mm 7 Jul 2005 08:03:23 -0000 1.397
+++ WebCoreBridge.mm 9 Jul 2005 20:19:25 -0000 1.398
@@ -39,7 +39,6 @@
#import "html_imageimpl.h"
#import "htmlattrs.h"
#import "htmlediting.h"
-#import "htmltags.h"
#import "khtml_part.h"
#import "khtmlview.h"
#import "kjs_proxy.h"
@@ -67,7 +66,6 @@
#import "KWQAssertions.h"
#import "KWQCharsets.h"
#import "KWQClipboard.h"
-#import "KWQDOMNode.h"
#import "KWQEditCommand.h"
#import "KWQFont.h"
#import "KWQFoundationExtras.h"
@@ -100,6 +98,7 @@
using DOM::HTMLGenericFormElementImpl;
using DOM::HTMLImageElementImpl;
using DOM::HTMLInputElementImpl;
+using DOM::HTMLNames;
using DOM::NodeImpl;
using DOM::Position;
using DOM::RangeImpl;
@@ -913,7 +912,7 @@
static HTMLInputElementImpl *inputElementFromDOMElement(DOMElement *element)
{
NodeImpl *node = [element _nodeImpl];
- if (node && idFromNode(node) == ID_INPUT) {
+ if (node->hasTagName(HTMLNames::input())) {
return static_cast<HTMLInputElementImpl *>(node);
}
return nil;
@@ -926,7 +925,7 @@
// maps.google.com crashes otherwise because it is an xslt file
// that contains <form> elements that aren't in any namespace, so
// they come out as generic CML elements
- if (node && node->isHTMLElement() && idFromNode(node) == ID_FORM) {
+ if (node && node->hasTagName(HTMLNames::form())) {
return static_cast<HTMLFormElementImpl *>(node);
}
return nil;
@@ -1096,7 +1095,7 @@
// FIXME: Code copied from RenderImage::updateFromElement; should share.
DOMString attr;
- if (idFromNode(i) == ID_OBJECT) {
+ if (i->hasTagName(HTMLNames::object())) {
attr = i->getAttribute(ATTR_DATA);
} else {
attr = i->getAttribute(ATTR_SRC);
@@ -1108,9 +1107,9 @@
// FIXME: Code copied from RenderImage::updateFromElement; should share.
DOMString alt;
- if (idFromNode(i) == ID_INPUT)
+ if (i->hasTagName(HTMLNames::input()))
alt = static_cast<HTMLInputElementImpl *>(i)->altText();
- else if (idFromNode(i) == ID_IMG)
+ else if (i->hasTagName(HTMLNames::img()))
alt = static_cast<HTMLImageElementImpl *>(i)->altText();
if (!alt.isNull()) {
QString altText = alt.string();
1.2 +1 -1 WebCore/layout-tests/fast/dom/css-dom-read-expected.txt
Index: css-dom-read-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/fast/dom/css-dom-read-expected.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- css-dom-read-expected.txt 19 Jun 2005 06:38:09 -0000 1.1
+++ css-dom-read-expected.txt 9 Jul 2005 20:19:27 -0000 1.2
@@ -9,5 +9,5 @@
.two { display: inline; }
.three { display: list-item; list-style-type: square; margin-left: 3em; }
.four { display: none; color: red; }
-I { display: block; }
+i { display: block; }
1.11 +14 -14 WebCore/layout-tests/fast/overflow/003-expected.txt
Index: 003-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/fast/overflow/003-expected.txt,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- 003-expected.txt 11 Feb 2005 22:59:07 -0000 1.10
+++ 003-expected.txt 9 Jul 2005 20:19:28 -0000 1.11
@@ -4,14 +4,14 @@
RenderBlock {fake} at (10,10) size 780x302 [bgcolor=#FFFF00]
layer at (10,10) size 282x302 clip at (11,11) size 265x300 scrollHeight 1292
RenderBlock {channel} at (0,0) size 282x302 [bgcolor=#EEEEEE] [border: (1px solid #000000)]
- RenderBlock {TITLE} at (11,11) size 255x19
+ RenderBlock {title} at (11,11) size 255x19
RenderText {TEXT} at (0,0) size 154x19
text run at (0,0) width 154: "scottandrew.com"
RenderBlock {description} at (11,40) size 255x12
RenderText {TEXT} at (0,0) size 191x12
text run at (0,0) width 191: "DHTML, DOM and JavaScript News"
RenderBlock {item} at (1,62) size 265x97 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
- RenderInline {TITLE} at (0,0) size 233x15
+ RenderInline {title} at (0,0) size 233x15
RenderText {TEXT} at (10,11) size 233x15
text run at (10,11) width 233: "DHTML Animation Array Generator"
RenderText {TEXT} at (0,0) size 0x0
@@ -24,7 +24,7 @@
RenderText {TEXT} at (0,0) size 0x0
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {item} at (1,169) size 265x82 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
- RenderInline {TITLE} at (0,0) size 177x15
+ RenderInline {title} at (0,0) size 177x15
RenderText {TEXT} at (10,11) size 177x15
text run at (10,11) width 177: "DOM and Extended Entries"
RenderText {TEXT} at (187,11) size 4x15
@@ -38,7 +38,7 @@
RenderText {TEXT} at (0,0) size 0x0
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {item} at (1,261) size 265x82 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
- RenderInline {TITLE} at (0,0) size 164x15
+ RenderInline {title} at (0,0) size 164x15
RenderText {TEXT} at (10,11) size 164x15
text run at (10,11) width 164: "cellspacing and the DOM"
RenderText {TEXT} at (174,11) size 4x15
@@ -52,7 +52,7 @@
RenderText {TEXT} at (0,0) size 0x0
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {item} at (1,353) size 265x97 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
- RenderInline {TITLE} at (0,0) size 177x15
+ RenderInline {title} at (0,0) size 177x15
RenderText {TEXT} at (10,11) size 177x15
text run at (10,11) width 177: "contenteditable for Mozilla"
RenderText {TEXT} at (187,11) size 4x15
@@ -67,7 +67,7 @@
RenderText {TEXT} at (0,0) size 0x0
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {item} at (1,460) size 265x82 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
- RenderInline {TITLE} at (0,0) size 182x30
+ RenderInline {title} at (0,0) size 182x30
RenderText {TEXT} at (10,11) size 182x30
text run at (10,11) width 182: "DHTML Timeline/Keyframe"
text run at (10,26) width 69: "Animation"
@@ -81,7 +81,7 @@
RenderText {TEXT} at (0,0) size 0x0
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {item} at (1,552) size 265x97 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
- RenderInline {TITLE} at (0,0) size 157x30
+ RenderInline {title} at (0,0) size 157x30
RenderText {TEXT} at (10,11) size 157x30
text run at (10,11) width 157: "DynAPI 2.9 and Mozilla"
text run at (10,26) width 124: "compatibility ports"
@@ -96,7 +96,7 @@
RenderText {TEXT} at (0,0) size 0x0
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {item} at (1,659) size 265x67 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
- RenderInline {TITLE} at (0,0) size 154x15
+ RenderInline {title} at (0,0) size 154x15
RenderText {TEXT} at (10,11) size 154x15
text run at (10,11) width 154: "!lineDraw bookmarklet"
RenderText {TEXT} at (164,11) size 4x15
@@ -109,7 +109,7 @@
RenderText {TEXT} at (0,0) size 0x0
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {item} at (1,736) size 265x97 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
- RenderInline {TITLE} at (0,0) size 201x15
+ RenderInline {title} at (0,0) size 201x15
RenderText {TEXT} at (10,11) size 201x15
text run at (10,11) width 201: "Mozilla, DHTML and DOM links"
RenderText {TEXT} at (211,11) size 4x15
@@ -124,7 +124,7 @@
RenderText {TEXT} at (0,0) size 0x0
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {item} at (1,843) size 265x67 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
- RenderInline {TITLE} at (0,0) size 103x15
+ RenderInline {title} at (0,0) size 103x15
RenderText {TEXT} at (10,11) size 103x15
text run at (10,11) width 103: "Mozilla 1.0 RC2"
RenderText {TEXT} at (113,11) size 4x15
@@ -137,7 +137,7 @@
RenderText {TEXT} at (0,0) size 0x0
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {item} at (1,920) size 265x97 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
- RenderInline {TITLE} at (0,0) size 236x30
+ RenderInline {title} at (0,0) size 236x30
RenderText {TEXT} at (10,11) size 236x30
text run at (10,11) width 236: "javascript: is deprecated. Don't use"
text run at (10,26) width 13: "it."
@@ -152,7 +152,7 @@
RenderText {TEXT} at (0,0) size 0x0
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {item} at (1,1027) size 265x67 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
- RenderInline {TITLE} at (0,0) size 176x15
+ RenderInline {title} at (0,0) size 176x15
RenderText {TEXT} at (10,11) size 176x15
text run at (10,11) width 176: "Conditional Script Loading"
RenderText {TEXT} at (0,0) size 0x0
@@ -163,7 +163,7 @@
RenderText {TEXT} at (0,0) size 0x0
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {item} at (1,1104) size 265x82 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
- RenderInline {TITLE} at (0,0) size 115x15
+ RenderInline {title} at (0,0) size 115x15
RenderText {TEXT} at (10,11) size 115x15
text run at (10,11) width 115: "Stories and Tools"
RenderText {TEXT} at (125,11) size 4x15
@@ -177,7 +177,7 @@
RenderText {TEXT} at (0,0) size 0x0
RenderText {TEXT} at (0,0) size 0x0
RenderBlock {item} at (1,1196) size 265x97 [bgcolor=#FFFFFF] [border: (1px solid #CCCCCC) none (1px solid #CCCCCC) none]
- RenderInline {TITLE} at (0,0) size 166x15
+ RenderInline {title} at (0,0) size 166x15
RenderText {TEXT} at (10,11) size 166x15
text run at (10,11) width 166: "Whole Lotto Gecko Links"
RenderText {TEXT} at (176,11) size 4x15
1.2 +3 -3 WebCore/layout-tests/fast/tokenizer/002-expected.txt
Index: 002-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/fast/tokenizer/002-expected.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- 002-expected.txt 26 Jul 2004 22:45:51 -0000 1.1
+++ 002-expected.txt 9 Jul 2005 20:19:28 -0000 1.2
@@ -1,7 +1,7 @@
layer at (0,0) size 800x600
RenderCanvas at (0,0) size 800x600
-layer at (0,0) size 800x34
- RenderBlock {HTML} at (0,0) size 800x34
- RenderBody {BODY} at (8,8) size 784x18
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
RenderText {TEXT} at (0,0) size 315x18
text run at (0,0) width 315: "you shouldn't see a random chinese character here"
1.2 +2 -2 WebCore/layout-tests/fast/tokenizer/external-script-document-write-expected.txt
Index: external-script-document-write-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/fast/tokenizer/external-script-document-write-expected.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- external-script-document-write-expected.txt 19 Oct 2004 19:01:15 -0000 1.1
+++ external-script-document-write-expected.txt 9 Jul 2005 20:19:28 -0000 1.2
@@ -4,5 +4,5 @@
RenderBlock {HTML} at (0,0) size 800x34
RenderBody {BODY} at (8,8) size 784x18
RenderInline {SPAN} at (0,0) size 0x0
- RenderText {TEXT} at (0,0) size 226x18
- text run at (0,0) width 226: "This should be a span: [object span]"
+ RenderText {TEXT} at (0,0) size 239x18
+ text run at (0,0) width 239: "This should be a span: [object SPAN]"
1.6 +0 -1 WebCore/layout-tests/fast/tokenizer/script_extra_close-expected.txt
Index: script_extra_close-expected.txt
===================================================================
RCS file: /cvs/root/WebCore/layout-tests/fast/tokenizer/script_extra_close-expected.txt,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- script_extra_close-expected.txt 6 Jul 2005 18:49:06 -0000 1.5
+++ script_extra_close-expected.txt 9 Jul 2005 20:19:28 -0000 1.6
@@ -6,7 +6,6 @@
RenderText {TEXT} at (0,0) size 55x18
text run at (0,0) width 55: "TEST... "
RenderText {TEXT} at (0,0) size 0x0
- RenderText {TEXT} at (0,0) size 0x0
RenderText {TEXT} at (55,0) size 232x18
text run at (55,0) width 69: "PASSED. "
text run at (124,0) width 163: "This text should show up."
More information about the webkit-changes
mailing list