summaryrefslogtreecommitdiffstats
path: root/WebCore/html/HTMLElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/html/HTMLElement.cpp')
-rw-r--r--WebCore/html/HTMLElement.cpp75
1 files changed, 22 insertions, 53 deletions
diff --git a/WebCore/html/HTMLElement.cpp b/WebCore/html/HTMLElement.cpp
index d3a7f22..816bb60 100644
--- a/WebCore/html/HTMLElement.cpp
+++ b/WebCore/html/HTMLElement.cpp
@@ -107,6 +107,7 @@ static const TagPriorityMap* createTagPriorityMap()
map->add(centerTag.localName().impl(), 5);
map->add(footerTag.localName().impl(), 5);
map->add(headerTag.localName().impl(), 5);
+ map->add(hgroupTag.localName().impl(), 5);
map->add(nobrTag.localName().impl(), 5);
map->add(rubyTag.localName().impl(), 5);
map->add(navTag.localName().impl(), 5);
@@ -197,6 +198,10 @@ void HTMLElement::parseMappedAttribute(MappedAttribute *attr)
setAttributeEventListener(eventNames().mousewheelEvent, createAttributeEventListener(this, attr));
} else if (attr->name() == onfocusAttr) {
setAttributeEventListener(eventNames().focusEvent, createAttributeEventListener(this, attr));
+ } else if (attr->name() == onfocusinAttr) {
+ setAttributeEventListener(eventNames().focusinEvent, createAttributeEventListener(this, attr));
+ } else if (attr->name() == onfocusoutAttr) {
+ setAttributeEventListener(eventNames().focusoutEvent, createAttributeEventListener(this, attr));
} else if (attr->name() == onblurAttr) {
setAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(this, attr));
} else if (attr->name() == onkeydownAttr) {
@@ -272,9 +277,9 @@ String HTMLElement::outerHTML() const
return createMarkup(this);
}
-PassRefPtr<DocumentFragment> HTMLElement::createContextualFragment(const String &html, FragmentScriptingPermission scriptingPermission)
+PassRefPtr<DocumentFragment> HTMLElement::createContextualFragment(const String& markup, FragmentScriptingPermission scriptingPermission)
{
- // the following is in accordance with the definition as used by IE
+ // The following is in accordance with the definition as used by IE.
if (endTagRequirement() == TagStatusForbidden)
return 0;
@@ -282,47 +287,7 @@ PassRefPtr<DocumentFragment> HTMLElement::createContextualFragment(const String
hasLocalName(headTag) || hasLocalName(styleTag) || hasLocalName(titleTag))
return 0;
- RefPtr<DocumentFragment> fragment = DocumentFragment::create(document());
-
- if (document()->isHTMLDocument())
- parseHTMLDocumentFragment(html, fragment.get(), scriptingPermission);
- else {
- if (!parseXMLDocumentFragment(html, fragment.get(), this, scriptingPermission))
- // FIXME: We should propagate a syntax error exception out here.
- return 0;
- }
-
- // Exceptions are ignored because none ought to happen here.
- int ignoredExceptionCode;
-
- // we need to pop <html> and <body> elements and remove <head> to
- // accommodate folks passing complete HTML documents to make the
- // child of an element.
-
- RefPtr<Node> nextNode;
- for (RefPtr<Node> node = fragment->firstChild(); node; node = nextNode) {
- nextNode = node->nextSibling();
- if (node->hasTagName(htmlTag) || node->hasTagName(bodyTag)) {
- Node *firstChild = node->firstChild();
- if (firstChild)
- nextNode = firstChild;
- RefPtr<Node> nextChild;
- for (RefPtr<Node> child = firstChild; child; child = nextChild) {
- nextChild = child->nextSibling();
- node->removeChild(child.get(), ignoredExceptionCode);
- ASSERT(!ignoredExceptionCode);
- fragment->insertBefore(child, node.get(), ignoredExceptionCode);
- ASSERT(!ignoredExceptionCode);
- }
- fragment->removeChild(node.get(), ignoredExceptionCode);
- ASSERT(!ignoredExceptionCode);
- } else if (node->hasTagName(headTag)) {
- fragment->removeChild(node.get(), ignoredExceptionCode);
- ASSERT(!ignoredExceptionCode);
- }
- }
-
- return fragment.release();
+ return Element::createContextualFragment(markup, scriptingPermission);
}
static inline bool hasOneChild(ContainerNode* node)
@@ -415,7 +380,7 @@ void HTMLElement::setOuterHTML(const String& html, ExceptionCode& ec)
void HTMLElement::setInnerText(const String& text, ExceptionCode& ec)
{
- // follow the IE specs about when this is allowed
+ // Follow the IE specs about when this is allowed.
if (endTagRequirement() == TagStatusForbidden) {
ec = NO_MODIFICATION_ALLOWED_ERR;
return;
@@ -485,7 +450,7 @@ void HTMLElement::setInnerText(const String& text, ExceptionCode& ec)
void HTMLElement::setOuterText(const String &text, ExceptionCode& ec)
{
- // follow the IE specs about when this is allowed
+ // Follow the IE specs about when this is allowed.
if (endTagRequirement() == TagStatusForbidden) {
ec = NO_MODIFICATION_ALLOWED_ERR;
return;
@@ -513,7 +478,7 @@ void HTMLElement::setOuterText(const String &text, ExceptionCode& ec)
if (ec)
return;
- // is previous node a text node? if so, merge into it
+ // Is previous node a text node? If so, merge into it.
Node* prev = t->previousSibling();
if (prev && prev->isTextNode()) {
Text* textPrev = static_cast<Text*>(prev);
@@ -526,7 +491,7 @@ void HTMLElement::setOuterText(const String &text, ExceptionCode& ec)
t = textPrev;
}
- // is next node a text node? if so, merge it in
+ // Is next node a text node? If so, merge it in.
Node* next = t->nextSibling();
if (next && next->isTextNode()) {
Text* textNext = static_cast<Text*>(next);
@@ -566,7 +531,7 @@ Node* HTMLElement::insertAdjacent(const String& where, Node* newChild, Exception
return 0;
}
- // IE throws COM Exception E_INVALIDARG; this is the best DOM exception alternative
+ // IE throws COM Exception E_INVALIDARG; this is the best DOM exception alternative.
ec = NOT_SUPPORTED_ERR;
return 0;
}
@@ -574,7 +539,7 @@ Node* HTMLElement::insertAdjacent(const String& where, Node* newChild, Exception
Element* HTMLElement::insertAdjacentElement(const String& where, Element* newChild, ExceptionCode& ec)
{
if (!newChild) {
- // IE throws COM Exception E_INVALIDARG; this is the best DOM exception alternative
+ // IE throws COM Exception E_INVALIDARG; this is the best DOM exception alternative.
ec = TYPE_MISMATCH_ERR;
return 0;
}
@@ -611,8 +576,8 @@ void HTMLElement::addHTMLAlignment(MappedAttribute* attr)
void HTMLElement::addHTMLAlignmentToStyledElement(StyledElement* element, MappedAttribute* attr)
{
- // vertical alignment with respect to the current baseline of the text
- // right or left means floating images
+ // Vertical alignment with respect to the current baseline of the text
+ // right or left means floating images.
int floatValue = CSSValueInvalid;
int verticalAlignValue = CSSValueInvalid;
@@ -893,6 +858,9 @@ static HashSet<AtomicStringImpl*>* inlineTagList()
tagList.add(rpTag.localName().impl());
tagList.add(rtTag.localName().impl());
tagList.add(rubyTag.localName().impl());
+#if ENABLE(PROGRESS_TAG)
+ tagList.add(progressTag.localName().impl());
+#endif
}
return &tagList;
}
@@ -921,6 +889,7 @@ static HashSet<AtomicStringImpl*>* blockTagList()
tagList.add(h5Tag.localName().impl());
tagList.add(h6Tag.localName().impl());
tagList.add(headerTag.localName().impl());
+ tagList.add(hgroupTag.localName().impl());
tagList.add(hrTag.localName().impl());
tagList.add(isindexTag.localName().impl());
tagList.add(layerTag.localName().impl());
@@ -1011,8 +980,8 @@ bool HTMLElement::rendererIsNeeded(RenderStyle *style)
{
#if !ENABLE(XHTMLMP)
if (hasLocalName(noscriptTag)) {
- Settings* settings = document()->settings();
- if (settings && settings->isJavaScriptEnabled())
+ Frame* frame = document()->frame();
+ if (frame && frame->script()->canExecuteScripts(NotAboutToExecuteScript))
return false;
}
#endif