2 * This file is part of the DOM implementation for KDE.
4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
5 * (C) 1999 Antti Koivisto (koivisto@kde.org)
6 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
26 #include "HTMLElementImpl.h"
28 #include "EventNames.h"
30 #include "css_ruleimpl.h"
31 #include "css_stylesheetimpl.h"
32 #include "css_valueimpl.h"
33 #include "cssproperties.h"
34 #include "cssvalues.h"
35 #include "dom2_events.h"
36 #include "dom2_eventsimpl.h"
37 #include "dom_exception.h"
38 #include "dom_textimpl.h"
39 #include "html_documentimpl.h"
40 #include "htmlfactory.h"
41 #include "htmlnames.h"
42 #include "htmltokenizer.h"
44 #include "render_replaced.h"
45 #include "visible_text.h"
46 #include <kxmlcore/HashSet.h>
50 using namespace EventNames;
51 using namespace HTMLNames;
53 HTMLElementImpl::HTMLElementImpl(const QualifiedName& tagName, DocumentImpl *doc)
54 : StyledElementImpl(tagName, doc)
58 HTMLElementImpl::~HTMLElementImpl()
62 DOMString HTMLElementImpl::nodeName() const
64 // FIXME: Would be nice to have an atomicstring lookup based off uppercase chars that does not have to copy
65 // the string on a hit in the hash.
66 if (getDocument()->isHTMLDocument())
67 return m_tagName.localName().impl()->upper();
68 return ElementImpl::nodeName();
71 HTMLTagStatus HTMLElementImpl::endTagRequirement() const
73 if (hasLocalName(dtTag) || hasLocalName(ddTag))
74 return TagStatusOptional;
76 // Same values as <span>. This way custom tag name elements will behave like inline spans.
77 return TagStatusRequired;
80 int HTMLElementImpl::tagPriority() const
82 if (hasLocalName(addressTag) || hasLocalName(ddTag) || hasLocalName(dtTag) || hasLocalName(noscriptTag))
84 if (hasLocalName(centerTag) || hasLocalName(nobrTag))
86 if (hasLocalName(noembedTag) || hasLocalName(noframesTag))
89 // Same values as <span>. This way custom tag name elements will behave like inline spans.
93 PassRefPtr<NodeImpl> HTMLElementImpl::cloneNode(bool deep)
95 PassRefPtr<HTMLElementImpl> clone = HTMLElementFactory::createHTMLElement(m_tagName.localName(), getDocument(), 0, false);
100 *clone->attributes() = *namedAttrMap;
102 if (m_inlineStyleDecl)
103 *clone->getInlineStyleDecl() = *m_inlineStyleDecl;
105 clone->copyNonAttributeProperties(this);
108 cloneChildNodes(clone.get());
113 bool HTMLElementImpl::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
115 if (attrName == alignAttr ||
116 attrName == contenteditableAttr) {
120 if (attrName == dirAttr) {
121 result = hasTagName(bdoTag) ? eBDO : eUniversal;
125 return StyledElementImpl::mapToEntry(attrName, result);
128 void HTMLElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
130 if (attr->name() == idAttr || attr->name() == classAttr || attr->name() == styleAttr)
131 return StyledElementImpl::parseMappedAttribute(attr);
133 DOMString indexstring;
134 if (attr->name() == alignAttr) {
135 if (equalIgnoringCase(attr->value(), "middle"))
136 addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, "center");
138 addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, attr->value());
139 } else if (attr->name() == contenteditableAttr) {
140 setContentEditable(attr);
141 } else if (attr->name() == tabindexAttr) {
142 indexstring = getAttribute(tabindexAttr);
143 if (indexstring.length())
144 setTabIndex(indexstring.toInt());
145 } else if (attr->name() == langAttr) {
147 } else if (attr->name() == dirAttr) {
148 addCSSProperty(attr, CSS_PROP_DIRECTION, attr->value());
149 addCSSProperty(attr, CSS_PROP_UNICODE_BIDI, hasTagName(bdoTag) ? CSS_VAL_BIDI_OVERRIDE : CSS_VAL_EMBED);
152 else if (attr->name() == onclickAttr) {
153 setHTMLEventListener(clickEvent, attr);
154 } else if (attr->name() == oncontextmenuAttr) {
155 setHTMLEventListener(contextmenuEvent, attr);
156 } else if (attr->name() == ondblclickAttr) {
157 setHTMLEventListener(khtmlDblclickEvent, attr);
158 } else if (attr->name() == onmousedownAttr) {
159 setHTMLEventListener(mousedownEvent, attr);
160 } else if (attr->name() == onmousemoveAttr) {
161 setHTMLEventListener(mousemoveEvent, attr);
162 } else if (attr->name() == onmouseoutAttr) {
163 setHTMLEventListener(mouseoutEvent, attr);
164 } else if (attr->name() == onmouseoverAttr) {
165 setHTMLEventListener(mouseoverEvent, attr);
166 } else if (attr->name() == onmouseupAttr) {
167 setHTMLEventListener(mouseupEvent, attr);
168 } else if (attr->name() == onmousewheelAttr) {
169 setHTMLEventListener(mousewheelEvent, attr);
170 } else if (attr->name() == onfocusAttr) {
171 setHTMLEventListener(DOMFocusInEvent, attr);
172 } else if (attr->name() == onblurAttr) {
173 setHTMLEventListener(DOMFocusOutEvent, attr);
174 } else if (attr->name() == onkeydownAttr) {
175 setHTMLEventListener(keydownEvent, attr);
176 } else if (attr->name() == onkeypressAttr) {
177 setHTMLEventListener(keypressEvent, attr);
178 } else if (attr->name() == onkeyupAttr) {
179 setHTMLEventListener(keyupEvent, attr);
180 } else if (attr->name() == onscrollAttr) {
181 setHTMLEventListener(scrollEvent, attr);
182 } else if (attr->name() == onbeforecutAttr) {
183 setHTMLEventListener(beforecutEvent, attr);
184 } else if (attr->name() == oncutAttr) {
185 setHTMLEventListener(cutEvent, attr);
186 } else if (attr->name() == onbeforecopyAttr) {
187 setHTMLEventListener(beforecopyEvent, attr);
188 } else if (attr->name() == oncopyAttr) {
189 setHTMLEventListener(copyEvent, attr);
190 } else if (attr->name() == onbeforepasteAttr) {
191 setHTMLEventListener(beforepasteEvent, attr);
192 } else if (attr->name() == onpasteAttr) {
193 setHTMLEventListener(pasteEvent, attr);
194 } else if (attr->name() == ondragenterAttr) {
195 setHTMLEventListener(dragenterEvent, attr);
196 } else if (attr->name() == ondragoverAttr) {
197 setHTMLEventListener(dragoverEvent, attr);
198 } else if (attr->name() == ondragleaveAttr) {
199 setHTMLEventListener(dragleaveEvent, attr);
200 } else if (attr->name() == ondropAttr) {
201 setHTMLEventListener(dropEvent, attr);
202 } else if (attr->name() == ondragstartAttr) {
203 setHTMLEventListener(dragstartEvent, attr);
204 } else if (attr->name() == ondragAttr) {
205 setHTMLEventListener(dragEvent, attr);
206 } else if (attr->name() == ondragendAttr) {
207 setHTMLEventListener(dragendEvent, attr);
208 } else if (attr->name() == onselectstartAttr) {
209 setHTMLEventListener(selectstartEvent, attr);
213 DOMString HTMLElementImpl::innerHTML() const
215 return createMarkup(this, ChildrenOnly);
218 DOMString HTMLElementImpl::outerHTML() const
220 return createMarkup(this);
223 DOMString HTMLElementImpl::innerText() const
225 // We need to update layout, since plainText uses line boxes in the render tree.
226 getDocument()->updateLayoutIgnorePendingStylesheets();
227 return plainText(rangeOfContents(const_cast<HTMLElementImpl *>(this)).get());
230 DOMString HTMLElementImpl::outerText() const
232 // Getting outerText is the same as getting innerText, only
233 // setting is different. You would think this should get the plain
234 // text for the outer range, but this is wrong, <br> for instance
235 // would return different values for inner and outer text by such
236 // a rule, but it doesn't in WinIE, and we want to match that.
240 DocumentFragmentImpl *HTMLElementImpl::createContextualFragment(const DOMString &html)
242 // the following is in accordance with the definition as used by IE
243 if (endTagRequirement() == TagStatusForbidden)
246 if (hasLocalName(colTag) || hasLocalName(colgroupTag) || hasLocalName(framesetTag) ||
247 hasLocalName(headTag) || hasLocalName(styleTag) || hasLocalName(titleTag))
250 DocumentFragmentImpl *fragment = new DocumentFragmentImpl(getDocument());
253 if (getDocument()->isHTMLDocument())
254 parseHTMLDocumentFragment(html, fragment);
256 if (!parseXMLDocumentFragment(html, fragment, this)) {
257 // FIXME: We should propagate a syntax error exception out here.
263 // Exceptions are ignored because none ought to happen here.
264 int ignoredExceptionCode;
266 // we need to pop <html> and <body> elements and remove <head> to
267 // accommodate folks passing complete HTML documents to make the
268 // child of an element.
270 RefPtr<NodeImpl> nextNode;
271 for (RefPtr<NodeImpl> node = fragment->firstChild(); node; node = nextNode) {
272 nextNode = node->nextSibling();
273 if (node->hasTagName(htmlTag) || node->hasTagName(bodyTag)) {
274 NodeImpl *firstChild = node->firstChild();
276 nextNode = firstChild;
277 RefPtr<NodeImpl> nextChild;
278 for (RefPtr<NodeImpl> child = firstChild; child; child = nextChild) {
279 nextChild = child->nextSibling();
280 node->removeChild(child.get(), ignoredExceptionCode);
281 assert(!ignoredExceptionCode);
282 fragment->insertBefore(child, node.get(), ignoredExceptionCode);
283 assert(!ignoredExceptionCode);
285 fragment->removeChild(node.get(), ignoredExceptionCode);
286 assert(!ignoredExceptionCode);
287 } else if (node->hasTagName(headTag)) {
288 fragment->removeChild(node.get(), ignoredExceptionCode);
289 assert(!ignoredExceptionCode);
293 // Trick to get the fragment back to the floating state, with 0
294 // refs but not destroyed.
295 fragment->setParent(this);
297 fragment->setParent(0);
302 void HTMLElementImpl::setInnerHTML(const DOMString &html, int &exception)
304 DocumentFragmentImpl *fragment = createContextualFragment(html);
305 if (fragment == NULL) {
306 exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
311 appendChild(fragment, exception);
314 void HTMLElementImpl::setOuterHTML(const DOMString &html, int &exception)
316 NodeImpl *p = parent();
317 if (!p || !p->isHTMLElement()) {
318 exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
321 HTMLElementImpl *parent = static_cast<HTMLElementImpl *>(p);
322 DocumentFragmentImpl *fragment = parent->createContextualFragment(html);
325 exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
330 parent->replaceChild(fragment, this, exception);
335 void HTMLElementImpl::setInnerText(const DOMString &text, int &exception)
337 // following the IE specs.
338 if (endTagRequirement() == TagStatusForbidden) {
339 exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
343 if (hasLocalName(colTag) || hasLocalName(colgroupTag) || hasLocalName(framesetTag) ||
344 hasLocalName(headTag) || hasLocalName(htmlTag) || hasLocalName(tableTag) ||
345 hasLocalName(tbodyTag) || hasLocalName(tfootTag) || hasLocalName(theadTag) ||
346 hasLocalName(trTag)) {
347 exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
352 appendChild(new TextImpl(getDocument(), text), exception);
355 void HTMLElementImpl::setOuterText(const DOMString &text, int &exception)
357 // following the IE specs.
358 if (endTagRequirement() == TagStatusForbidden) {
359 exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
363 if (hasLocalName(colTag) || hasLocalName(colgroupTag) || hasLocalName(framesetTag) ||
364 hasLocalName(headTag) || hasLocalName(htmlTag) || hasLocalName(tableTag) ||
365 hasLocalName(tbodyTag) || hasLocalName(tfootTag) || hasLocalName(theadTag) ||
366 hasLocalName(trTag)) {
367 exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
371 NodeImpl *parent = parentNode();
374 exception = DOMException::NO_MODIFICATION_ALLOWED_ERR;
378 TextImpl *t = new TextImpl(getDocument(), text);
380 parent->replaceChild(t, this, exception);
385 // is previous node a text node? if so, merge into it
386 NodeImpl *prev = t->previousSibling();
387 if (prev && prev->isTextNode()) {
388 TextImpl *textPrev = static_cast<TextImpl *>(prev);
389 textPrev->appendData(t->data(), exception);
392 t->remove(exception);
398 // is next node a text node? if so, merge it in
399 NodeImpl *next = t->nextSibling();
400 if (next && next->isTextNode()) {
401 TextImpl *textNext = static_cast<TextImpl *>(next);
402 t->appendData(textNext->data(), exception);
405 textNext->remove(exception);
411 void HTMLElementImpl::addHTMLAlignment(MappedAttributeImpl* attr)
413 // vertical alignment with respect to the current baseline of the text
414 // right or left means floating images
417 const AtomicString& alignment = attr->value();
418 if (equalIgnoringCase(alignment, "absmiddle")) {
419 propvalign = CSS_VAL_MIDDLE;
420 } else if (equalIgnoringCase(alignment, "absbottom")) {
421 propvalign = CSS_VAL_BOTTOM;
422 } else if (equalIgnoringCase(alignment, "left")) {
423 propfloat = CSS_VAL_LEFT;
424 propvalign = CSS_VAL_TOP;
425 } else if (equalIgnoringCase(alignment, "right")) {
426 propfloat = CSS_VAL_RIGHT;
427 propvalign = CSS_VAL_TOP;
428 } else if (equalIgnoringCase(alignment, "top")) {
429 propvalign = CSS_VAL_TOP;
430 } else if (equalIgnoringCase(alignment, "middle")) {
431 propvalign = CSS_VAL__KHTML_BASELINE_MIDDLE;
432 } else if (equalIgnoringCase(alignment, "center")) {
433 propvalign = CSS_VAL_MIDDLE;
434 } else if (equalIgnoringCase(alignment, "bottom")) {
435 propvalign = CSS_VAL_BASELINE;
436 } else if (equalIgnoringCase(alignment, "texttop")) {
437 propvalign = CSS_VAL_TEXT_TOP;
440 if ( propfloat != -1 )
441 addCSSProperty( attr, CSS_PROP_FLOAT, propfloat );
442 if ( propvalign != -1 )
443 addCSSProperty( attr, CSS_PROP_VERTICAL_ALIGN, propvalign );
446 bool HTMLElementImpl::isFocusable() const
448 return isContentEditable() && parent() && !parent()->isContentEditable();
451 bool HTMLElementImpl::isContentEditable() const
453 if (getDocument()->frame() && getDocument()->frame()->isContentEditable())
456 getDocument()->updateRendering();
460 return parentNode()->isContentEditable();
465 return renderer()->style()->userModify() == READ_WRITE;
468 DOMString HTMLElementImpl::contentEditable() const
470 getDocument()->updateRendering();
475 switch (renderer()->style()->userModify()) {
486 void HTMLElementImpl::setContentEditable(MappedAttributeImpl* attr)
488 Frame *frame = getDocument()->frame();
489 const AtomicString& enabled = attr->value();
490 if (enabled.isEmpty() || equalIgnoringCase(enabled, "true")) {
491 addCSSProperty(attr, CSS_PROP__KHTML_USER_MODIFY, CSS_VAL_READ_WRITE);
493 frame->applyEditingStyleToElement(this);
494 } else if (equalIgnoringCase(enabled, "false")) {
495 addCSSProperty(attr, CSS_PROP__KHTML_USER_MODIFY, CSS_VAL_READ_ONLY);
497 frame->removeEditingStyleFromElement(this);
498 } else if (equalIgnoringCase(enabled, "inherit")) {
499 addCSSProperty(attr, CSS_PROP__KHTML_USER_MODIFY, CSS_VAL_INHERIT);
501 frame->removeEditingStyleFromElement(this);
505 void HTMLElementImpl::setContentEditable(const DOMString &enabled)
507 if (enabled == "inherit") {
509 removeAttribute(contenteditableAttr, exceptionCode);
512 setAttribute(contenteditableAttr, enabled.isEmpty() ? "true" : enabled);
515 void HTMLElementImpl::click(bool sendMouseEvents, bool showPressedLook)
517 // send mousedown and mouseup before the click, if requested
519 dispatchSimulatedMouseEvent(mousedownEvent);
520 setActive(true, showPressedLook);
522 dispatchSimulatedMouseEvent(mouseupEvent);
526 dispatchSimulatedMouseEvent(clickEvent);
529 // accessKeyAction is used by the accessibility support code
530 // to send events to elements that our JavaScript caller does
531 // does not. The elements JS is interested in have subclasses
532 // that override this method to direct the click appropriately.
533 // Here in the base class, then, we only send the click if
534 // the caller wants it to go to any HTMLElementImpl, and we say
535 // to send the mouse events in addition to the click.
536 void HTMLElementImpl::accessKeyAction(bool sendToAnyElement)
538 if (sendToAnyElement)
542 DOMString HTMLElementImpl::toString() const
544 if (!hasChildNodes() && getDocument()->isHTMLDocument()) {
545 DOMString result = openTagStartToString();
548 if (endTagRequirement() == TagStatusRequired) {
550 result += nodeName();
557 return ElementImpl::toString();
560 DOMString HTMLElementImpl::id() const
562 return getAttribute(idAttr);
565 void HTMLElementImpl::setId(const DOMString &value)
567 setAttribute(idAttr, value);
570 DOMString HTMLElementImpl::title() const
572 return getAttribute(titleAttr);
575 void HTMLElementImpl::setTitle(const DOMString &value)
577 setAttribute(titleAttr, value);
580 DOMString HTMLElementImpl::lang() const
582 return getAttribute(langAttr);
585 void HTMLElementImpl::setLang(const DOMString &value)
587 setAttribute(langAttr, value);
590 DOMString HTMLElementImpl::dir() const
592 return getAttribute(dirAttr);
595 void HTMLElementImpl::setDir(const DOMString &value)
597 setAttribute(dirAttr, value);
600 DOMString HTMLElementImpl::className() const
602 return getAttribute(classAttr);
605 void HTMLElementImpl::setClassName(const DOMString &value)
607 setAttribute(classAttr, value);
610 PassRefPtr<HTMLCollectionImpl> HTMLElementImpl::children()
612 return new HTMLCollectionImpl(this, HTMLCollectionImpl::NODE_CHILDREN);
616 bool HTMLElementImpl::childAllowed(NodeImpl *newChild)
618 if (!ElementImpl::childAllowed(newChild))
621 // For XML documents, we are non-validating and do not check against a DTD, even for HTML elements.
622 if (!getDocument()->isHTMLDocument())
625 // Future-proof for XML content inside HTML documents (we may allow this some day).
626 if (newChild->isElementNode() && !newChild->isHTMLElement())
629 // Elements with forbidden tag status can never have children
630 if (endTagRequirement() == TagStatusForbidden)
633 // Comment nodes are always allowed.
634 if (newChild->isCommentNode())
637 // Now call checkDTD.
638 return checkDTD(newChild);
642 // This unfortunate function is only needed when checking against the DTD. Other languages (like SVG) won't need this.
643 bool HTMLElementImpl::isRecognizedTagName(const QualifiedName& tagName)
645 static HashSet<AtomicStringImpl*> tagList;
646 if (tagList.isEmpty()) {
647 #define ADD_TAG(name) tagList.add(name##Tag.localName().impl());
648 DOM_HTMLNAMES_FOR_EACH_TAG(ADD_TAG)
650 return tagList.contains(tagName.localName().impl());
653 // The terms inline and block are used here loosely. Don't make the mistake of assuming all inlines or all blocks
654 // need to be in these two lists.
655 HashSet<AtomicStringImpl*>* inlineTagList()
657 static HashSet<AtomicStringImpl*> tagList;
658 if (tagList.isEmpty()) {
659 tagList.add(ttTag.localName().impl());
660 tagList.add(iTag.localName().impl());
661 tagList.add(bTag.localName().impl());
662 tagList.add(uTag.localName().impl());
663 tagList.add(sTag.localName().impl());
664 tagList.add(strikeTag.localName().impl());
665 tagList.add(bigTag.localName().impl());
666 tagList.add(smallTag.localName().impl());
667 tagList.add(emTag.localName().impl());
668 tagList.add(strongTag.localName().impl());
669 tagList.add(dfnTag.localName().impl());
670 tagList.add(codeTag.localName().impl());
671 tagList.add(sampTag.localName().impl());
672 tagList.add(kbdTag.localName().impl());
673 tagList.add(varTag.localName().impl());
674 tagList.add(citeTag.localName().impl());
675 tagList.add(abbrTag.localName().impl());
676 tagList.add(acronymTag.localName().impl());
677 tagList.add(aTag.localName().impl());
678 tagList.add(canvasTag.localName().impl());
679 tagList.add(imgTag.localName().impl());
680 tagList.add(appletTag.localName().impl());
681 tagList.add(objectTag.localName().impl());
682 tagList.add(embedTag.localName().impl());
683 tagList.add(fontTag.localName().impl());
684 tagList.add(basefontTag.localName().impl());
685 tagList.add(brTag.localName().impl());
686 tagList.add(scriptTag.localName().impl());
687 tagList.add(mapTag.localName().impl());
688 tagList.add(qTag.localName().impl());
689 tagList.add(subTag.localName().impl());
690 tagList.add(supTag.localName().impl());
691 tagList.add(spanTag.localName().impl());
692 tagList.add(bdoTag.localName().impl());
693 tagList.add(iframeTag.localName().impl());
694 tagList.add(inputTag.localName().impl());
695 tagList.add(keygenTag.localName().impl());
696 tagList.add(selectTag.localName().impl());
697 tagList.add(textareaTag.localName().impl());
698 tagList.add(labelTag.localName().impl());
699 tagList.add(buttonTag.localName().impl());
700 tagList.add(insTag.localName().impl());
701 tagList.add(delTag.localName().impl());
702 tagList.add(nobrTag.localName().impl());
703 tagList.add(wbrTag.localName().impl());
708 HashSet<AtomicStringImpl*>* blockTagList()
710 static HashSet<AtomicStringImpl*> tagList;
711 if (tagList.isEmpty()) {
712 tagList.add(pTag.localName().impl());
713 tagList.add(h1Tag.localName().impl());
714 tagList.add(h2Tag.localName().impl());
715 tagList.add(h3Tag.localName().impl());
716 tagList.add(h4Tag.localName().impl());
717 tagList.add(h5Tag.localName().impl());
718 tagList.add(h6Tag.localName().impl());
719 tagList.add(ulTag.localName().impl());
720 tagList.add(olTag.localName().impl());
721 tagList.add(dirTag.localName().impl());
722 tagList.add(menuTag.localName().impl());
723 tagList.add(preTag.localName().impl());
724 tagList.add(plaintextTag.localName().impl());
725 tagList.add(xmpTag.localName().impl());
726 tagList.add(dlTag.localName().impl());
727 tagList.add(divTag.localName().impl());
728 tagList.add(layerTag.localName().impl());
729 tagList.add(centerTag.localName().impl());
730 tagList.add(noscriptTag.localName().impl());
731 tagList.add(noframesTag.localName().impl());
732 tagList.add(noembedTag.localName().impl());
733 tagList.add(nolayerTag.localName().impl());
734 tagList.add(blockquoteTag.localName().impl());
735 tagList.add(formTag.localName().impl());
736 tagList.add(isindexTag.localName().impl());
737 tagList.add(hrTag.localName().impl());
738 tagList.add(tableTag.localName().impl());
739 tagList.add(fieldsetTag.localName().impl());
740 tagList.add(addressTag.localName().impl());
741 tagList.add(liTag.localName().impl());
742 tagList.add(ddTag.localName().impl());
743 tagList.add(dtTag.localName().impl());
744 tagList.add(marqueeTag.localName().impl());
749 bool HTMLElementImpl::inEitherTagList(const NodeImpl* newChild)
751 if (newChild->isTextNode())
754 if (newChild->isHTMLElement()) {
755 const HTMLElementImpl* child = static_cast<const HTMLElementImpl*>(newChild);
756 if (inlineTagList()->contains(child->tagName().localName().impl()))
758 if (blockTagList()->contains(child->tagName().localName().impl()))
760 return !isRecognizedTagName(child->tagName()); // Accept custom html tags
766 bool HTMLElementImpl::inInlineTagList(const NodeImpl* newChild)
768 if (newChild->isTextNode())
771 if (newChild->isHTMLElement()) {
772 const HTMLElementImpl* child = static_cast<const HTMLElementImpl*>(newChild);
773 if (inlineTagList()->contains(child->tagName().localName().impl()))
775 return !isRecognizedTagName(child->tagName()); // Accept custom html tags
781 bool HTMLElementImpl::inBlockTagList(const NodeImpl* newChild)
783 if (newChild->isTextNode())
786 if (newChild->isHTMLElement()) {
787 const HTMLElementImpl* child = static_cast<const HTMLElementImpl*>(newChild);
788 return (blockTagList()->contains(child->tagName().localName().impl()));
794 bool HTMLElementImpl::checkDTD(const NodeImpl* newChild)
796 if (hasTagName(addressTag) && newChild->hasTagName(pTag))
798 return inEitherTagList(newChild);
801 void HTMLElementImpl::setHTMLEventListener(const AtomicString& eventType, AttributeImpl* attr)
803 ElementImpl::setHTMLEventListener(eventType, getDocument()->createHTMLEventListener(attr->value(), this));