summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/html
diff options
context:
space:
mode:
authorNaiem Shaik <snaiem@codeaurora.org>2012-07-19 10:45:56 -0700
committerSteve Kondik <shade@chemlab.org>2013-01-20 18:38:33 -0800
commit0f5d4355d7a384679722338d55f65bbb92350cfc (patch)
treedf4a638aa4e81152ee68f0d523ed706128a251ff /Source/WebCore/html
parent8f6cf525ead3381029545c1d292c8586ec45ddb0 (diff)
downloadexternal_webkit-0f5d4355d7a384679722338d55f65bbb92350cfc.zip
external_webkit-0f5d4355d7a384679722338d55f65bbb92350cfc.tar.gz
external_webkit-0f5d4355d7a384679722338d55f65bbb92350cfc.tar.bz2
DOM Optimizations
DOM traversal optimizations DOM Core optimizations Prefetch optimization for DOM Tree Traversal Conflicts: Source/WebKit/android/jni/WebViewCore.cpp Change-Id: Icbb8a7229ee9cff1a5401b57c8181f18b9a6d6e0
Diffstat (limited to 'Source/WebCore/html')
-rw-r--r--Source/WebCore/html/CollectionCache.cpp1
-rw-r--r--Source/WebCore/html/CollectionCache.h2
-rw-r--r--Source/WebCore/html/HTMLAllCollection.cpp43
-rw-r--r--Source/WebCore/html/HTMLAllCollection.h6
-rw-r--r--Source/WebCore/html/HTMLAreaElement.cpp1
-rw-r--r--Source/WebCore/html/HTMLBRElement.cpp1
-rw-r--r--Source/WebCore/html/HTMLBaseElement.cpp1
-rw-r--r--Source/WebCore/html/HTMLCanvasElement.cpp7
-rw-r--r--Source/WebCore/html/HTMLCollection.cpp226
-rw-r--r--Source/WebCore/html/HTMLCollection.h10
-rw-r--r--Source/WebCore/html/HTMLDataGridCellElement.cpp1
-rw-r--r--Source/WebCore/html/HTMLDataGridColElement.cpp1
-rw-r--r--Source/WebCore/html/HTMLElement.cpp45
-rw-r--r--Source/WebCore/html/HTMLElement.h2
-rw-r--r--Source/WebCore/html/HTMLEmbedElement.cpp1
-rw-r--r--Source/WebCore/html/HTMLFrameElement.cpp1
-rw-r--r--Source/WebCore/html/HTMLHRElement.cpp1
-rw-r--r--Source/WebCore/html/HTMLImageElement.cpp1
-rw-r--r--Source/WebCore/html/HTMLInputElement.cpp1
-rw-r--r--Source/WebCore/html/HTMLLinkElement.cpp1
-rw-r--r--Source/WebCore/html/HTMLMetaElement.cpp1
-rw-r--r--Source/WebCore/html/HTMLParamElement.cpp1
-rw-r--r--Source/WebCore/html/HTMLSourceElement.cpp1
-rw-r--r--Source/WebCore/html/HTMLTableColElement.cpp1
-rw-r--r--Source/WebCore/html/HTMLTagNames.in2
-rw-r--r--Source/WebCore/html/HTMLWbrElement.cpp62
-rw-r--r--Source/WebCore/html/HTMLWbrElement.h50
27 files changed, 329 insertions, 142 deletions
diff --git a/Source/WebCore/html/CollectionCache.cpp b/Source/WebCore/html/CollectionCache.cpp
index 745cf6e..d831ad1 100644
--- a/Source/WebCore/html/CollectionCache.cpp
+++ b/Source/WebCore/html/CollectionCache.cpp
@@ -83,6 +83,7 @@ void CollectionCache::reset()
deleteAllValues(nameCache);
nameCache.clear();
hasNameCache = false;
+ lastDecendantOfBase = 0;
}
#if !ASSERT_DISABLED
diff --git a/Source/WebCore/html/CollectionCache.h b/Source/WebCore/html/CollectionCache.h
index d160db2..799263c 100644
--- a/Source/WebCore/html/CollectionCache.h
+++ b/Source/WebCore/html/CollectionCache.h
@@ -28,6 +28,7 @@
namespace WebCore {
class Element;
+class Node;
struct CollectionCache {
WTF_MAKE_FAST_ALLOCATED;
@@ -58,6 +59,7 @@ public:
NodeCacheMap nameCache;
bool hasLength;
bool hasNameCache;
+ Node* lastDecendantOfBase;
private:
static void copyCacheMap(NodeCacheMap&, const NodeCacheMap&);
diff --git a/Source/WebCore/html/HTMLAllCollection.cpp b/Source/WebCore/html/HTMLAllCollection.cpp
index dbfed28..8c92a00 100644
--- a/Source/WebCore/html/HTMLAllCollection.cpp
+++ b/Source/WebCore/html/HTMLAllCollection.cpp
@@ -26,17 +26,18 @@
#include "config.h"
#include "HTMLAllCollection.h"
+#include "Element.h"
#include "Node.h"
namespace WebCore {
-PassRefPtr<HTMLAllCollection> HTMLAllCollection::create(PassRefPtr<Node> base)
+PassRefPtr<HTMLAllCollection> HTMLAllCollection::create(PassRefPtr<Node> base, CollectionType type)
{
- return adoptRef(new HTMLAllCollection(base));
+ return adoptRef(new HTMLAllCollection(base, type));
}
-HTMLAllCollection::HTMLAllCollection(PassRefPtr<Node> base)
- : HTMLCollection(base, DocAll)
+HTMLAllCollection::HTMLAllCollection(PassRefPtr<Node> base, CollectionType type)
+ : HTMLCollection(base, type)
{
}
@@ -44,4 +45,38 @@ HTMLAllCollection::~HTMLAllCollection()
{
}
+Element* HTMLAllCollection::itemAfter(Element* previous) const
+{
+ bool includeChildren = (type() == DocAll);
+ Node* current;
+ Node* root = base();
+ if (!previous)
+ current = root->firstChild();
+ else
+ current = includeChildren ? previous->traverseNextNode(root) : previous->traverseNextSibling(root);
+
+ if (includeChildren) {
+ Node * lastDecendant = info()->lastDecendantOfBase;
+ if (!lastDecendant) {
+ info()->lastDecendantOfBase = root->lastDescendantNode();
+ lastDecendant = info()->lastDecendantOfBase;
+ }
+
+ for (; current; current = current->traverseNextNodeFastPath()) {
+ if (current->isElementNode())
+ return static_cast<Element*>(current);
+ if (current == lastDecendant)
+ break;
+ }
+ } else {
+ for (; current; current = current->traverseNextSibling(root)) {
+ if (current->isElementNode())
+ return static_cast<Element*>(current);
+ }
+ }
+
+ return 0;
+}
+
+
} // namespace WebCore
diff --git a/Source/WebCore/html/HTMLAllCollection.h b/Source/WebCore/html/HTMLAllCollection.h
index 1dd3ede..443e855 100644
--- a/Source/WebCore/html/HTMLAllCollection.h
+++ b/Source/WebCore/html/HTMLAllCollection.h
@@ -32,11 +32,13 @@ namespace WebCore {
class HTMLAllCollection : public HTMLCollection {
public:
- static PassRefPtr<HTMLAllCollection> create(PassRefPtr<Node>);
+ static PassRefPtr<HTMLAllCollection> create(PassRefPtr<Node>, CollectionType = DocAll);
virtual ~HTMLAllCollection();
private:
- HTMLAllCollection(PassRefPtr<Node>);
+ HTMLAllCollection(PassRefPtr<Node>, CollectionType = DocAll);
+
+ virtual Element* itemAfter(Element*) const;
};
} // namespace WebCore
diff --git a/Source/WebCore/html/HTMLAreaElement.cpp b/Source/WebCore/html/HTMLAreaElement.cpp
index 4cb2748..cf37ff2 100644
--- a/Source/WebCore/html/HTMLAreaElement.cpp
+++ b/Source/WebCore/html/HTMLAreaElement.cpp
@@ -45,6 +45,7 @@ inline HTMLAreaElement::HTMLAreaElement(const QualifiedName& tagName, Document*
, m_shape(Unknown)
{
ASSERT(hasTagName(areaTag));
+ setIeForbidsInsertHTML();
}
PassRefPtr<HTMLAreaElement> HTMLAreaElement::create(const QualifiedName& tagName, Document* document)
diff --git a/Source/WebCore/html/HTMLBRElement.cpp b/Source/WebCore/html/HTMLBRElement.cpp
index e8f4520..da20fbf 100644
--- a/Source/WebCore/html/HTMLBRElement.cpp
+++ b/Source/WebCore/html/HTMLBRElement.cpp
@@ -36,6 +36,7 @@ HTMLBRElement::HTMLBRElement(const QualifiedName& tagName, Document* document)
: HTMLElement(tagName, document)
{
ASSERT(hasTagName(brTag));
+ setIeForbidsInsertHTML();
}
PassRefPtr<HTMLBRElement> HTMLBRElement::create(Document* document)
diff --git a/Source/WebCore/html/HTMLBaseElement.cpp b/Source/WebCore/html/HTMLBaseElement.cpp
index 0dd16fa..961cc49 100644
--- a/Source/WebCore/html/HTMLBaseElement.cpp
+++ b/Source/WebCore/html/HTMLBaseElement.cpp
@@ -35,6 +35,7 @@ inline HTMLBaseElement::HTMLBaseElement(const QualifiedName& tagName, Document*
: HTMLElement(tagName, document)
{
ASSERT(hasTagName(baseTag));
+ setIeForbidsInsertHTML();
}
PassRefPtr<HTMLBaseElement> HTMLBaseElement::create(const QualifiedName& tagName, Document* document)
diff --git a/Source/WebCore/html/HTMLCanvasElement.cpp b/Source/WebCore/html/HTMLCanvasElement.cpp
index 81aa1cf..35ce549 100644
--- a/Source/WebCore/html/HTMLCanvasElement.cpp
+++ b/Source/WebCore/html/HTMLCanvasElement.cpp
@@ -2,7 +2,7 @@
* Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007 Alp Toker <alp@atoker.com>
* Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
- * Copyright (c) 2012, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2012, The Linux Foundation All rights reserved.
* Copyright (C) 2011, 2012 Sony Ericsson Mobile Communications AB
* Copyright (C) 2012 Sony Mobile Communications AB
*
@@ -321,6 +321,11 @@ void HTMLCanvasElement::paint(GraphicsContext* context, const IntRect& r)
if (is3D())
static_cast<WebGLRenderingContext*>(m_context.get())->markLayerComposited();
#endif
+#if ENABLE(DASHBOARD_SUPPORT)
+ Settings* settings = document()->settings();
+ if (settings && settings->usesDashboardBackwardCompatibilityMode())
+ setIeForbidsInsertHTML();
+#endif
}
#if ENABLE(WEBGL)
diff --git a/Source/WebCore/html/HTMLCollection.cpp b/Source/WebCore/html/HTMLCollection.cpp
index 2782e50..2c6b135 100644
--- a/Source/WebCore/html/HTMLCollection.cpp
+++ b/Source/WebCore/html/HTMLCollection.cpp
@@ -2,6 +2,7 @@
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 The Linux Foundation All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -22,6 +23,7 @@
#include "config.h"
#include "HTMLCollection.h"
+#include "HTMLAllCollection.h"
#include "HTMLDocument.h"
#include "HTMLElement.h"
@@ -38,24 +40,30 @@ using namespace HTMLNames;
HTMLCollection::HTMLCollection(PassRefPtr<Node> base, CollectionType type)
: m_idsDone(false)
+ , m_matchTag(htmlTag)
, m_base(base)
, m_type(type)
, m_info(m_base->isDocumentNode() ? static_cast<Document*>(m_base.get())->collectionInfo(type) : 0)
, m_ownsInfo(false)
{
+ init();
}
HTMLCollection::HTMLCollection(PassRefPtr<Node> base, CollectionType type, CollectionCache* info)
: m_idsDone(false)
+ , m_matchTag(htmlTag)
, m_base(base)
, m_type(type)
, m_info(info)
, m_ownsInfo(false)
{
+ init();
}
PassRefPtr<HTMLCollection> HTMLCollection::create(PassRefPtr<Node> base, CollectionType type)
{
+ if (type == DocAll || type == NodeChildren)
+ return HTMLAllCollection::create(base, type);
return adoptRef(new HTMLCollection(base, type));
}
@@ -65,32 +73,9 @@ HTMLCollection::~HTMLCollection()
delete m_info;
}
-void HTMLCollection::resetCollectionInfo() const
-{
- uint64_t docversion = static_cast<HTMLDocument*>(m_base->document())->domTreeVersion();
-
- if (!m_info) {
- m_info = new CollectionCache;
- m_ownsInfo = true;
- m_info->version = docversion;
- return;
- }
-
- if (m_info->version != docversion) {
- m_info->reset();
- m_info->version = docversion;
- }
-}
-
-static Node* nextNodeOrSibling(Node* base, Node* node, bool includeChildren)
-{
- return includeChildren ? node->traverseNextNode(base) : node->traverseNextSibling(base);
-}
-
-Element* HTMLCollection::itemAfter(Element* previous) const
+void HTMLCollection::init()
{
- bool deep = true;
-
+ m_includeChildren = true;
switch (m_type) {
case DocAll:
case DocAnchors:
@@ -112,91 +97,158 @@ Element* HTMLCollection::itemAfter(Element* previous) const
case TRCells:
case TSectionRows:
case TableTBodies:
- deep = false;
+ m_includeChildren = false;
break;
}
- Node* current;
- if (!previous)
- current = m_base->firstChild();
- else
- current = nextNodeOrSibling(m_base.get(), previous, deep);
+ m_matchType = MatchNone;
+ switch (m_type) {
+ case DocImages:
+ m_matchTag = imgTag;
+ m_matchType = MatchTag;
+ break;
+ case DocScripts:
+ m_matchTag = scriptTag;
+ m_matchType = MatchTag;
+ break;
+ case DocForms:
+ m_matchTag = formTag;
+ m_matchType = MatchTag;
+ break;
+ case TableTBodies:
+ m_matchTag = tbodyTag;
+ m_matchType = MatchTag;
+ break;
+ case TSectionRows:
+ m_matchTag = trTag;
+ m_matchType = MatchTag;
+ break;
+ case SelectOptions:
+ m_matchTag = optionTag;
+ m_matchType = MatchTag;
+ break;
+ case MapAreas:
+ m_matchTag = areaTag;
+ m_matchType = MatchTag;
+ break;
+ case DocEmbeds:
+ m_matchTag = embedTag;
+ m_matchType = MatchTag;
+ break;
+ case DocObjects:
+ m_matchTag = objectTag;
+ m_matchType = MatchTag;
+ break;
+ case TRCells:
+ case DataListOptions:
+ case DocApplets: // all <applet> elements and <object> elements that contain Java Applets
+ case DocLinks: // all <a> and <area> elements with a value for href
+ case DocAnchors: // all <a> elements with a value for name
+ m_matchType = MatchCustom;
+ break;
+ case DocAll:
+ case NodeChildren:
+ m_matchType = MatchAll;
+ break;
+ case DocumentNamedItems:
+ case OtherCollection:
+ case WindowNamedItems:
+ m_matchType = MatchNone;
+ break;
+ }
+}
- for (; current; current = nextNodeOrSibling(m_base.get(), current, deep)) {
- if (!current->isElementNode())
- continue;
- Element* e = static_cast<Element*>(current);
+void HTMLCollection::resetCollectionInfo() const
+{
+ uint64_t docversion = static_cast<HTMLDocument*>(m_base->document())->domTreeVersion();
+
+ if (!m_info) {
+ m_info = new CollectionCache;
+ m_ownsInfo = true;
+ m_info->version = docversion;
+ return;
+ }
+
+ if (m_info->version != docversion) {
+ m_info->reset();
+ m_info->version = docversion;
+ }
+}
+
+static Node* nextNodeOrSibling(Node* base, Node* node, bool includeChildren)
+{
+ return includeChildren ? node->traverseNextNode(base) : node->traverseNextSibling(base);
+}
+
+inline bool HTMLCollection::nodeMatchesShallow(Element* e) const
+{
+ if (m_matchType == MatchTag && e->hasLocalName(m_matchTag))
+ return true;
+ if (m_type == TRCells && (e->hasLocalName(tdTag) || e->hasLocalName(thTag)))
+ return true;
+
+ return false;
+}
+
+inline bool HTMLCollection::nodeMatchesDeep(Element* e) const
+{
+ if (m_matchType == MatchTag && e->hasLocalName(m_matchTag))
+ return true;
+ if (m_matchType == MatchCustom) {
switch (m_type) {
- case DocImages:
- if (e->hasLocalName(imgTag))
- return e;
- break;
- case DocScripts:
- if (e->hasLocalName(scriptTag))
- return e;
- break;
- case DocForms:
- if (e->hasLocalName(formTag))
- return e;
- break;
- case TableTBodies:
- if (e->hasLocalName(tbodyTag))
- return e;
- break;
- case TRCells:
- if (e->hasLocalName(tdTag) || e->hasLocalName(thTag))
- return e;
- break;
- case TSectionRows:
- if (e->hasLocalName(trTag))
- return e;
- break;
- case SelectOptions:
- if (e->hasLocalName(optionTag))
- return e;
- break;
case DataListOptions:
if (e->hasLocalName(optionTag)) {
HTMLOptionElement* option = static_cast<HTMLOptionElement*>(e);
if (!option->disabled() && !option->value().isEmpty())
- return e;
+ return true;
}
break;
- case MapAreas:
- if (e->hasLocalName(areaTag))
- return e;
- break;
case DocApplets: // all <applet> elements and <object> elements that contain Java Applets
if (e->hasLocalName(appletTag))
- return e;
+ return true;
if (e->hasLocalName(objectTag) && static_cast<HTMLObjectElement*>(e)->containsJavaApplet())
- return e;
- break;
- case DocEmbeds:
- if (e->hasLocalName(embedTag))
- return e;
- break;
- case DocObjects:
- if (e->hasLocalName(objectTag))
- return e;
+ return true;
break;
case DocLinks: // all <a> and <area> elements with a value for href
if ((e->hasLocalName(aTag) || e->hasLocalName(areaTag)) && e->fastHasAttribute(hrefAttr))
- return e;
+ return true;
break;
case DocAnchors: // all <a> elements with a value for name
if (e->hasLocalName(aTag) && e->fastHasAttribute(nameAttr))
- return e;
+ return true;
break;
- case DocAll:
- case NodeChildren:
- return e;
- case DocumentNamedItems:
- case OtherCollection:
- case WindowNamedItems:
- ASSERT_NOT_REACHED();
+ }
+ }
+
+ return false;
+}
+
+Element* HTMLCollection::itemAfter(Element* previous) const
+{
+ Node* current;
+ Node* base = m_base.get();
+ if (!previous)
+ current = base->firstChild();
+ else
+ current = nextNodeOrSibling(base, previous, m_includeChildren);
+
+ if (m_includeChildren) {
+ if (!m_info->lastDecendantOfBase)
+ m_info->lastDecendantOfBase = base->lastDescendantNode();
+
+ for (; current; current = current->traverseNextNodeFastPath()) {
+ if (current->isElementNode() && HTMLCollection::nodeMatchesDeep(static_cast<Element*>(current)))
+ return static_cast<Element*>(current);
+ if (current == m_info->lastDecendantOfBase)
break;
}
+ } else {
+ for (; current; current = current->traverseNextSibling(base)) {
+ if (!current->isElementNode())
+ continue;
+ if (HTMLCollection::nodeMatchesShallow(static_cast<Element*>(current)))
+ return static_cast<Element*>(current);
+ }
}
return 0;
diff --git a/Source/WebCore/html/HTMLCollection.h b/Source/WebCore/html/HTMLCollection.h
index 4359724..47449da 100644
--- a/Source/WebCore/html/HTMLCollection.h
+++ b/Source/WebCore/html/HTMLCollection.h
@@ -2,6 +2,7 @@
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 The Linux Foundation All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -24,6 +25,7 @@
#define HTMLCollection_h
#include "CollectionType.h"
+#include "QualifiedName.h"
#include <wtf/RefCounted.h>
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
@@ -72,11 +74,19 @@ private:
virtual Element* itemAfter(Element*) const;
virtual unsigned calcLength() const;
virtual void updateNameCache() const;
+ void init();
+ bool nodeMatchesDeep(Element*) const;
+ bool nodeMatchesShallow(Element*) const;
bool checkForNameMatch(Element*, bool checkName, const AtomicString& name) const;
+ enum MatchType { MatchNone, MatchTag, MatchCustom, MatchAll };
+ MatchType m_matchType;
+ QualifiedName m_matchTag;
+
RefPtr<Node> m_base;
CollectionType m_type;
+ bool m_includeChildren;
mutable CollectionCache* m_info;
mutable bool m_ownsInfo;
diff --git a/Source/WebCore/html/HTMLDataGridCellElement.cpp b/Source/WebCore/html/HTMLDataGridCellElement.cpp
index 9596d63..a0a5e13 100644
--- a/Source/WebCore/html/HTMLDataGridCellElement.cpp
+++ b/Source/WebCore/html/HTMLDataGridCellElement.cpp
@@ -38,6 +38,7 @@ using namespace HTMLNames;
inline HTMLDataGridCellElement::HTMLDataGridCellElement(const QualifiedName& name, Document* document)
: HTMLElement(name, document)
{
+ setIeForbidsInsertHTML();
}
PassRefPtr<HTMLDataGridCellElement> HTMLDataGridCellElement::create(const QualifiedName& name, Document* document)
diff --git a/Source/WebCore/html/HTMLDataGridColElement.cpp b/Source/WebCore/html/HTMLDataGridColElement.cpp
index 196c7b6..c546ce9 100644
--- a/Source/WebCore/html/HTMLDataGridColElement.cpp
+++ b/Source/WebCore/html/HTMLDataGridColElement.cpp
@@ -42,6 +42,7 @@ inline HTMLDataGridColElement::HTMLDataGridColElement(const QualifiedName& name,
: HTMLElement(name, document)
, m_dataGrid(0)
{
+ setIeForbidsInsertHTML();
}
PassRefPtr<HTMLDataGridColElement> HTMLDataGridColElement::create(const QualifiedName& name, Document* document)
diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp
index 0aa9664..f8f2113 100644
--- a/Source/WebCore/html/HTMLElement.cpp
+++ b/Source/WebCore/html/HTMLElement.cpp
@@ -71,49 +71,6 @@ String HTMLElement::nodeName() const
return Element::nodeName();
}
-bool HTMLElement::ieForbidsInsertHTML() const
-{
- // FIXME: Supposedly IE disallows settting innerHTML, outerHTML
- // and createContextualFragment on these tags. We have no tests to
- // verify this however, so this list could be totally wrong.
- // This list was moved from the previous endTagRequirement() implementation.
- // This is also called from editing and assumed to be the list of tags
- // for which no end tag should be serialized. It's unclear if the list for
- // IE compat and the list for serialization sanity are the same.
- if (hasLocalName(areaTag)
- || hasLocalName(baseTag)
- || hasLocalName(basefontTag)
- || hasLocalName(brTag)
- || hasLocalName(colTag)
-#if ENABLE(DATAGRID)
- || hasLocalName(dcellTag)
- || hasLocalName(dcolTag)
-#endif
- || hasLocalName(embedTag)
- || hasLocalName(frameTag)
- || hasLocalName(hrTag)
- || hasLocalName(imageTag)
- || hasLocalName(imgTag)
- || hasLocalName(inputTag)
- || hasLocalName(isindexTag)
- || hasLocalName(linkTag)
- || hasLocalName(metaTag)
- || hasLocalName(paramTag)
- || hasLocalName(sourceTag)
- || hasLocalName(wbrTag))
- return true;
- // FIXME: I'm not sure why dashboard mode would want to change the
- // serialization of <canvas>, that seems like a bad idea.
-#if ENABLE(DASHBOARD_SUPPORT)
- if (hasLocalName(canvasTag)) {
- Settings* settings = document()->settings();
- if (settings && settings->usesDashboardBackwardCompatibilityMode())
- return true;
- }
-#endif
- return false;
-}
-
bool HTMLElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
{
if (attrName == alignAttr
@@ -786,8 +743,6 @@ bool HTMLElement::rendererIsNeeded(RenderStyle *style)
RenderObject* HTMLElement::createRenderer(RenderArena* arena, RenderStyle* style)
{
- if (hasLocalName(wbrTag))
- return new (arena) RenderWordBreak(this);
return RenderObject::createObject(this, style);
}
diff --git a/Source/WebCore/html/HTMLElement.h b/Source/WebCore/html/HTMLElement.h
index 5a5fdfb..6e0b8c5 100644
--- a/Source/WebCore/html/HTMLElement.h
+++ b/Source/WebCore/html/HTMLElement.h
@@ -70,8 +70,6 @@ public:
virtual void accessKeyAction(bool sendToAnyElement);
- bool ieForbidsInsertHTML() const;
-
virtual bool rendererIsNeeded(RenderStyle*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
diff --git a/Source/WebCore/html/HTMLEmbedElement.cpp b/Source/WebCore/html/HTMLEmbedElement.cpp
index 851deb8..b6ad707 100644
--- a/Source/WebCore/html/HTMLEmbedElement.cpp
+++ b/Source/WebCore/html/HTMLEmbedElement.cpp
@@ -49,6 +49,7 @@ inline HTMLEmbedElement::HTMLEmbedElement(const QualifiedName& tagName, Document
: HTMLPlugInImageElement(tagName, document, createdByParser, ShouldPreferPlugInsForImages)
{
ASSERT(hasTagName(embedTag));
+ setIeForbidsInsertHTML();
}
PassRefPtr<HTMLEmbedElement> HTMLEmbedElement::create(const QualifiedName& tagName, Document* document, bool createdByParser)
diff --git a/Source/WebCore/html/HTMLFrameElement.cpp b/Source/WebCore/html/HTMLFrameElement.cpp
index 71c8f3f..f5297da 100644
--- a/Source/WebCore/html/HTMLFrameElement.cpp
+++ b/Source/WebCore/html/HTMLFrameElement.cpp
@@ -41,6 +41,7 @@ inline HTMLFrameElement::HTMLFrameElement(const QualifiedName& tagName, Document
, m_noResize(false)
{
ASSERT(hasTagName(frameTag));
+ setIeForbidsInsertHTML();
}
PassRefPtr<HTMLFrameElement> HTMLFrameElement::create(const QualifiedName& tagName, Document* document)
diff --git a/Source/WebCore/html/HTMLHRElement.cpp b/Source/WebCore/html/HTMLHRElement.cpp
index 44aa052..4de829c 100644
--- a/Source/WebCore/html/HTMLHRElement.cpp
+++ b/Source/WebCore/html/HTMLHRElement.cpp
@@ -36,6 +36,7 @@ HTMLHRElement::HTMLHRElement(const QualifiedName& tagName, Document* document)
: HTMLElement(tagName, document)
{
ASSERT(hasTagName(hrTag));
+ setIeForbidsInsertHTML();
}
PassRefPtr<HTMLHRElement> HTMLHRElement::create(Document* document)
diff --git a/Source/WebCore/html/HTMLImageElement.cpp b/Source/WebCore/html/HTMLImageElement.cpp
index d66075e..836388f 100644
--- a/Source/WebCore/html/HTMLImageElement.cpp
+++ b/Source/WebCore/html/HTMLImageElement.cpp
@@ -51,6 +51,7 @@ HTMLImageElement::HTMLImageElement(const QualifiedName& tagName, Document* docum
ASSERT(hasTagName(imgTag));
if (form)
form->registerImgElement(this);
+ setIeForbidsInsertHTML();
}
PassRefPtr<HTMLImageElement> HTMLImageElement::create(Document* document)
diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp
index 27b29a8..626fdc0 100644
--- a/Source/WebCore/html/HTMLInputElement.cpp
+++ b/Source/WebCore/html/HTMLInputElement.cpp
@@ -85,6 +85,7 @@ HTMLInputElement::HTMLInputElement(const QualifiedName& tagName, Document* docum
, m_inputType(InputType::createText(this))
{
ASSERT(hasTagName(inputTag) || hasTagName(isindexTag));
+ setIeForbidsInsertHTML();
}
PassRefPtr<HTMLInputElement> HTMLInputElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form, bool createdByParser)
diff --git a/Source/WebCore/html/HTMLLinkElement.cpp b/Source/WebCore/html/HTMLLinkElement.cpp
index 4e1e843..223fcf6 100644
--- a/Source/WebCore/html/HTMLLinkElement.cpp
+++ b/Source/WebCore/html/HTMLLinkElement.cpp
@@ -61,6 +61,7 @@ inline HTMLLinkElement::HTMLLinkElement(const QualifiedName& tagName, Document*
, m_pendingSheetType(None)
{
ASSERT(hasTagName(linkTag));
+ setIeForbidsInsertHTML();
}
PassRefPtr<HTMLLinkElement> HTMLLinkElement::create(const QualifiedName& tagName, Document* document, bool createdByParser)
diff --git a/Source/WebCore/html/HTMLMetaElement.cpp b/Source/WebCore/html/HTMLMetaElement.cpp
index 4f65065..3c3db44 100644
--- a/Source/WebCore/html/HTMLMetaElement.cpp
+++ b/Source/WebCore/html/HTMLMetaElement.cpp
@@ -40,6 +40,7 @@ inline HTMLMetaElement::HTMLMetaElement(const QualifiedName& tagName, Document*
: HTMLElement(tagName, document)
{
ASSERT(hasTagName(metaTag));
+ setIeForbidsInsertHTML();
}
PassRefPtr<HTMLMetaElement> HTMLMetaElement::create(const QualifiedName& tagName, Document* document)
diff --git a/Source/WebCore/html/HTMLParamElement.cpp b/Source/WebCore/html/HTMLParamElement.cpp
index 45a74b2..830c1ad 100644
--- a/Source/WebCore/html/HTMLParamElement.cpp
+++ b/Source/WebCore/html/HTMLParamElement.cpp
@@ -35,6 +35,7 @@ inline HTMLParamElement::HTMLParamElement(const QualifiedName& tagName, Document
: HTMLElement(tagName, document)
{
ASSERT(hasTagName(paramTag));
+ setIeForbidsInsertHTML();
}
PassRefPtr<HTMLParamElement> HTMLParamElement::create(const QualifiedName& tagName, Document* document)
diff --git a/Source/WebCore/html/HTMLSourceElement.cpp b/Source/WebCore/html/HTMLSourceElement.cpp
index 59b3882..ca683c2 100644
--- a/Source/WebCore/html/HTMLSourceElement.cpp
+++ b/Source/WebCore/html/HTMLSourceElement.cpp
@@ -47,6 +47,7 @@ inline HTMLSourceElement::HTMLSourceElement(const QualifiedName& tagName, Docume
{
LOG(Media, "HTMLSourceElement::HTMLSourceElement - %p", this);
ASSERT(hasTagName(sourceTag));
+ setIeForbidsInsertHTML();
}
PassRefPtr<HTMLSourceElement> HTMLSourceElement::create(const QualifiedName& tagName, Document* document)
diff --git a/Source/WebCore/html/HTMLTableColElement.cpp b/Source/WebCore/html/HTMLTableColElement.cpp
index 96af708..f7b8f2b 100644
--- a/Source/WebCore/html/HTMLTableColElement.cpp
+++ b/Source/WebCore/html/HTMLTableColElement.cpp
@@ -40,6 +40,7 @@ inline HTMLTableColElement::HTMLTableColElement(const QualifiedName& tagName, Do
: HTMLTablePartElement(tagName, document)
, m_span(1)
{
+ setIeForbidsInsertHTML();
}
PassRefPtr<HTMLTableColElement> HTMLTableColElement::create(const QualifiedName& tagName, Document* document)
diff --git a/Source/WebCore/html/HTMLTagNames.in b/Source/WebCore/html/HTMLTagNames.in
index 0bf4ff9..0de0632 100644
--- a/Source/WebCore/html/HTMLTagNames.in
+++ b/Source/WebCore/html/HTMLTagNames.in
@@ -132,7 +132,7 @@ u interfaceName=HTMLElement
ul interfaceName=HTMLUListElement
var interfaceName=HTMLElement
video wrapperOnlyIfMediaIsAvailable, conditional=VIDEO
-wbr interfaceName=HTMLElement
+wbr interfaceName=HTMLWbrElement, JSInterfaceName=HTMLElement
xmp interfaceName=HTMLPreElement
#if ENABLE_XHTMLMP
diff --git a/Source/WebCore/html/HTMLWbrElement.cpp b/Source/WebCore/html/HTMLWbrElement.cpp
new file mode 100644
index 0000000..4de25ac
--- /dev/null
+++ b/Source/WebCore/html/HTMLWbrElement.cpp
@@ -0,0 +1,62 @@
+/*
+* Copyright (C) 2012, The Linux Foundation All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "config.h"
+#include "HTMLWbrElement.h"
+
+#include "HTMLNames.h"
+#include "RenderWordBreak.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+HTMLWbrElement::HTMLWbrElement(const QualifiedName& tagName, Document* document)
+ : HTMLElement(tagName, document)
+{
+ ASSERT(hasTagName(wbrTag));
+ setIeForbidsInsertHTML();
+}
+
+PassRefPtr<HTMLWbrElement> HTMLWbrElement::create(Document* document)
+{
+ return adoptRef(new HTMLWbrElement(wbrTag, document));
+}
+
+PassRefPtr<HTMLWbrElement> HTMLWbrElement::create(const QualifiedName& tagName, Document* document)
+{
+ return adoptRef(new HTMLWbrElement(tagName, document));
+}
+
+RenderObject* HTMLWbrElement::createRenderer(RenderArena* arena, RenderStyle* style)
+{
+ return new (arena) RenderWordBreak(this);
+}
+
+}
diff --git a/Source/WebCore/html/HTMLWbrElement.h b/Source/WebCore/html/HTMLWbrElement.h
new file mode 100644
index 0000000..fa6856e
--- /dev/null
+++ b/Source/WebCore/html/HTMLWbrElement.h
@@ -0,0 +1,50 @@
+/*
+* Copyright (C) 2012, The Linux Foundation All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef HTMLWbrElement_h
+#define HTMLWbrElement_h
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLWbrElement : public HTMLElement {
+public:
+ static PassRefPtr<HTMLWbrElement> create(Document*);
+ static PassRefPtr<HTMLWbrElement> create(const QualifiedName&, Document*);
+
+private:
+ HTMLWbrElement(const QualifiedName&, Document*);
+
+ virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
+};
+
+} // namespace
+
+#endif